1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "OutlineView.hxx"
#include <editeng/forbiddencharacterstable.hxx>
#include <sfx2/progress.hxx>
#include <vcl/wrkwin.hxx>
#include <svx/svxids.hrc>
#include <editeng/outliner.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/editstat.hxx>
#include <editeng/lrspitem.hxx>
#include <svx/svdotext.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/imagemgr.hxx>
#include <sfx2/app.hxx>
#include <sfx2/bindings.hxx>
#include <svl/itempool.hxx>
#include <svl/style.hxx>
#include <svx/svdorect.hxx>
#include <svx/svdundo.hxx>
#include <svl/brdcst.hxx>
#include <vcl/msgbox.hxx>
#include <editeng/adjustitem.hxx>
#include <editeng/tstpitem.hxx>
#include <editeng/lspcitem.hxx>
#include <editeng/numitem.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editobj.hxx>
#include <editeng/editund2.hxx>
#include <editeng/editview.hxx>
#include <editeng/svxfont.hxx>
#include <editeng/fhgtitem.hxx>
#include "DrawDocShell.hxx"
#include "drawdoc.hxx"
#include "Window.hxx"
#include "sdpage.hxx"
#include "pres.hxx"
#include "OutlineViewShell.hxx"
#include "app.hrc"
#include "glob.hrc"
#include "sdresid.hxx"
#include "Outliner.hxx"
#include "strings.hrc"
#include "EventMultiplexer.hxx"
#include "ViewShellBase.hxx"
#include "undo/undoobjects.hxx"
#include "undo/undomanager.hxx"
#include "stlsheet.hxx"
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
namespace sd {
// a progress bar gets displayed when more than
// PROCESS_WITH_PROGRESS_THRESHOLD pages are concerned
#define PROCESS_WITH_PROGRESS_THRESHOLD 5
struct SdParaAndPos
{
Paragraph* pPara;
sal_uInt16 nPos;
};
// - OutlineView -
TYPEINIT1( OutlineView, ::sd::View );
OutlineView::OutlineView( DrawDocShell& rDocSh, ::Window* pWindow, OutlineViewShell& rOutlineViewShell)
: ::sd::View(*rDocSh.GetDoc(), pWindow, &rOutlineViewShell)
, mrOutlineViewShell(rOutlineViewShell)
, mrOutliner(*mrDoc.GetOutliner(true))
, mnPagesToProcess(0)
, mnPagesProcessed(0)
, mbFirstPaint(true)
, mpProgress(NULL)
, maDocColor( COL_WHITE )
, maLRSpaceItem( 0, 0, 2000, 0, EE_PARA_OUTLLRSPACE )
{
bool bInitOutliner = false;
if (mrOutliner.GetViewCount() == 0)
{
// initialize Outliner: set Reference Device
bInitOutliner = true;
mrOutliner.Init( OUTLINERMODE_OUTLINEVIEW );
mrOutliner.SetRefDevice( SD_MOD()->GetRefDevice( rDocSh ) );
//viewsize without the width of the image and number in front
mnPaperWidth = (mrOutlineViewShell.GetActiveWindow()->GetViewSize().Width() - 4000);
mrOutliner.SetPaperSize(Size(mnPaperWidth, 400000000));
}
// insert View into Outliner
for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
{
mpOutlinerView[nView] = NULL;
}
mpOutlinerView[0] = new OutlinerView(&mrOutliner, pWindow);
Rectangle aNullRect;
mpOutlinerView[0]->SetOutputArea(aNullRect);
mrOutliner.SetUpdateMode(false);
mrOutliner.InsertView(mpOutlinerView[0], EE_APPEND);
onUpdateStyleSettings( true );
if (bInitOutliner)
{
// fill Outliner with contents
FillOutliner();
}
Link aLink( LINK(this,OutlineView,EventMultiplexerListener) );
mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->AddEventListener(
aLink,
tools::EventMultiplexerEvent::EID_CURRENT_PAGE
| tools::EventMultiplexerEvent::EID_PAGE_ORDER);
LanguageType eLang = mrOutliner.GetDefaultLanguage();
maPageNumberFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE, eLang, 0 );
maPageNumberFont.SetHeight( 500 );
maBulletFont.SetColor( COL_AUTO );
maBulletFont.SetHeight( 1000 );
maBulletFont.SetCharSet(RTL_TEXTENCODING_MS_1252); // and replacing other values by standard
maBulletFont.SetName( OUString( "StarSymbol" ) );
maBulletFont.SetWeight(WEIGHT_NORMAL);
maBulletFont.SetUnderline(UNDERLINE_NONE);
maBulletFont.SetStrikeout(STRIKEOUT_NONE);
maBulletFont.SetItalic(ITALIC_NONE);
maBulletFont.SetOutline(false);
maBulletFont.SetShadow(false);
Reference<XFrame> xFrame (mrOutlineViewShell.GetViewShellBase().GetFrame()->GetTopFrame().GetFrameInterface(), UNO_QUERY);
const OUString aSlotURL( ".uno:ShowSlide" );
maSlideImage = GetImage( xFrame, aSlotURL, true );
// Tell undo manager of the document about the undo manager of the
// outliner, so that the former can synchronize with the later.
sd::UndoManager* pDocUndoMgr = dynamic_cast<sd::UndoManager*>(mpDocSh->GetUndoManager());
if (pDocUndoMgr != NULL)
pDocUndoMgr->SetLinkedUndoManager(&mrOutliner.GetUndoManager());
}
/**
* Destructor, restore Links, clear Oultiner
*/
OutlineView::~OutlineView()
{
DBG_ASSERT(maDragAndDropModelGuard.get() == 0, "sd::OutlineView::~OutlineView(), prior drag operation not finished correctly!" );
Link aLink( LINK(this,OutlineView,EventMultiplexerListener) );
mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->RemoveEventListener( aLink );
DisconnectFromApplication();
if( mpProgress )
delete mpProgress;
// unregister OutlinerViews and destroy them
for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
{
if (mpOutlinerView[nView] != NULL)
{
mrOutliner.RemoveView( mpOutlinerView[nView] );
delete mpOutlinerView[nView];
mpOutlinerView[nView] = NULL;
}
}
if (mrOutliner.GetViewCount() == 0)
{
// uninitialize Outliner: enable color display
ResetLinks();
sal_uLong nCntrl = mrOutliner.GetControlWord();
mrOutliner.SetUpdateMode(false); // otherwise there will be drawn on SetControlWord
mrOutliner.SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);
SvtAccessibilityOptions aOptions;
mrOutliner.ForceAutoColor( aOptions.GetIsAutomaticFontColor() );
mrOutliner.Clear();
}
}
void OutlineView::ConnectToApplication (void)
{
mrOutlineViewShell.GetActiveWindow()->GrabFocus();
Application::AddEventListener(LINK(this, OutlineView, AppEventListenerHdl));
}
void OutlineView::DisconnectFromApplication (void)
{
Application::RemoveEventListener(LINK(this, OutlineView, AppEventListenerHdl));
}
void OutlineView::Paint(const Rectangle& rRect, ::sd::Window* pWin)
{
OutlinerView* pOlView = GetViewByWindow(pWin);
if (pOlView)
{
pOlView->HideCursor();
pOlView->Paint(rRect);
pOlView->ShowCursor(mbFirstPaint);
mbFirstPaint = false;
}
}
void OutlineView::InvalidateSlideNumberArea()
{
}
/**
* Window size was changed
*/
void OutlineView::AdjustPosSizePixel(const Point &,const Size &,::sd::Window*)
{
}
void OutlineView::AddWindowToPaintView(OutputDevice* pWin)
{
bool bAdded = false;
bool bValidArea = false;
Rectangle aOutputArea;
const Color aWhiteColor( COL_WHITE );
sal_uInt16 nView = 0;
while (nView < MAX_OUTLINERVIEWS && !bAdded)
{
if (mpOutlinerView[nView] == NULL)
{
mpOutlinerView[nView] = new OutlinerView(&mrOutliner, dynamic_cast< ::sd::Window* >(pWin));
mpOutlinerView[nView]->SetBackgroundColor( aWhiteColor );
mrOutliner.InsertView(mpOutlinerView[nView], EE_APPEND);
bAdded = true;
if (bValidArea)
{
mpOutlinerView[nView]->SetOutputArea(aOutputArea);
}
}
else if (!bValidArea)
{
aOutputArea = mpOutlinerView[nView]->GetOutputArea();
bValidArea = true;
}
nView++;
}
// white background in Outliner
pWin->SetBackground( Wallpaper( aWhiteColor ) );
::sd::View::AddWindowToPaintView(pWin);
}
void OutlineView::DeleteWindowFromPaintView(OutputDevice* pWin)
{
bool bRemoved = false;
sal_uInt16 nView = 0;
::Window* pWindow;
while (nView < MAX_OUTLINERVIEWS && !bRemoved)
{
if (mpOutlinerView[nView] != NULL)
{
pWindow = mpOutlinerView[nView]->GetWindow();
if (pWindow == pWin)
{
mrOutliner.RemoveView( mpOutlinerView[nView] );
delete mpOutlinerView[nView];
mpOutlinerView[nView] = NULL;
bRemoved = true;
}
}
nView++;
}
::sd::View::DeleteWindowFromPaintView(pWin);
}
/**
* Return a pointer to the OutlinerView corresponding to the window
*/
OutlinerView* OutlineView::GetViewByWindow (::Window* pWin) const
{
OutlinerView* pOlView = NULL;
for (sal_uInt16 nView = 0; nView < MAX_OUTLINERVIEWS; nView++)
{
if (mpOutlinerView[nView] != NULL)
{
if ( pWin == mpOutlinerView[nView]->GetWindow() )
{
pOlView = mpOutlinerView[nView];
}
}
}
return (pOlView);
}
/**
* Return the title before a random paragraph
*/
Paragraph* OutlineView::GetPrevTitle(const Paragraph* pPara)
{
sal_Int32 nPos = mrOutliner.GetAbsPos(const_cast<Paragraph*>(pPara));
if (nPos > 0)
{
while(nPos)
{
pPara = mrOutliner.GetParagraph(--nPos);
if( mrOutliner.HasParaFlag(pPara, PARAFLAG_ISPAGE) )
{
return const_cast< Paragraph* >( pPara );
}
}
}
return NULL;
}
/**
* Return the title after a random paragraph
*/
Paragraph* OutlineView::GetNextTitle(const Paragraph* pPara)
{
Paragraph* pResult = const_cast< Paragraph* >( pPara );
sal_Int32 nPos = mrOutliner.GetAbsPos(pResult);
do
{
pResult = mrOutliner.GetParagraph(++nPos);
if( pResult && mrOutliner.HasParaFlag(pResult, PARAFLAG_ISPAGE) )
return pResult;
}
while( pResult );
return NULL;
}
/**
* Handler for inserting pages (paragraphs)
*/
IMPL_LINK( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner )
{
// we get calls to this handler during binary insert of drag and drop contents but
// we ignore it here and handle it later in OnEndPasteOrDrop()
if( maDragAndDropModelGuard.get() == 0 )
{
OutlineViewPageChangesGuard aGuard(this);
Paragraph* pPara = pOutliner->GetHdlParagraph();
sal_Int32 nAbsPos = mrOutliner.GetAbsPos( pPara );
UpdateParagraph( nAbsPos );
if( (nAbsPos == 0) || mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) || mrOutliner.HasParaFlag(mrOutliner.GetParagraph( nAbsPos-1 ), PARAFLAG_ISPAGE) )
{
InsertSlideForParagraph( pPara );
InvalidateSlideNumberArea();
}
}
return 0;
}
/** creates and inserts an empty slide for the given paragraph */
SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara )
{
DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::InsertSlideForParagraph(), model change without undo?!" );
OutlineViewPageChangesGuard aGuard(this);
mrOutliner.SetParaFlag( pPara, PARAFLAG_ISPAGE );
// how many titles are there before the new title paragraph?
sal_uLong nExample = 0L; // position of the "example" page
sal_uLong nTarget = 0L; // position of insertion
while(pPara)
{
pPara = GetPrevTitle(pPara);
if (pPara)
nTarget++;
}
// if a new paragraph is created via RETURN before the first paragraph, the
// Outliner reports the old paragraph (which was moved down) as a new
// paragraph
if (nTarget == 1)
{
OUString aTest = mrOutliner.GetText(mrOutliner.GetParagraph(0));
if (aTest.isEmpty())
{
nTarget = 0;
}
}
// the "example" page is the previous page - if it is available
if (nTarget > 0)
{
nExample = nTarget - 1;
sal_uInt16 nPageCount = mrDoc.GetSdPageCount( PK_STANDARD );
if( nExample >= nPageCount )
nExample = nPageCount - 1;
}
/**********************************************************************
* All the time, a standard page is created before a notes page.
* It is ensured that after each standard page the corresponding notes page
* follows. A handout page is exactly one handout page.
**********************************************************************/
// this page is exemplary
SdPage* pExample = (SdPage*)mrDoc.GetSdPage((sal_uInt16)nExample, PK_STANDARD);
SdPage* pPage = (SdPage*)mrDoc.AllocPage(false);
pPage->SetLayoutName(pExample->GetLayoutName());
// insert (page)
mrDoc.InsertPage(pPage, (sal_uInt16)(nTarget) * 2 + 1);
if( isRecordingUndo() )
AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewPage(*pPage));
// assign a master page to the standard page
pPage->TRG_SetMasterPage(pExample->TRG_GetMasterPage());
// set page size
pPage->SetSize(pExample->GetSize());
pPage->SetBorder( pExample->GetLftBorder(),
pExample->GetUppBorder(),
pExample->GetRgtBorder(),
pExample->GetLwrBorder() );
// create new presentation objects (after <Title> or <Title with subtitle>
// follows <Title with outline>, otherwise apply the layout of the previous
// page
AutoLayout eAutoLayout = pExample->GetAutoLayout();
if (eAutoLayout == AUTOLAYOUT_TITLE ||
eAutoLayout == AUTOLAYOUT_ONLY_TITLE)
{
pPage->SetAutoLayout(AUTOLAYOUT_ENUM, true);
}
else
{
pPage->SetAutoLayout(pExample->GetAutoLayout(), true);
}
/**********************************************************************
|* now the notes page
\*********************************************************************/
pExample = (SdPage*)mrDoc.GetSdPage((sal_uInt16)nExample, PK_NOTES);
SdPage* pNotesPage = (SdPage*)mrDoc.AllocPage(false);
pNotesPage->SetLayoutName(pExample->GetLayoutName());
pNotesPage->SetPageKind(PK_NOTES);
// insert (notes page)
mrDoc.InsertPage(pNotesPage, (sal_uInt16)(nTarget) * 2 + 2);
if( isRecordingUndo() )
AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage));
// assign a master page to the notes page
pNotesPage->TRG_SetMasterPage(pExample->TRG_GetMasterPage());
// set page size, there must be already one page available
pNotesPage->SetSize(pExample->GetSize());
pNotesPage->SetBorder( pExample->GetLftBorder(),
pExample->GetUppBorder(),
pExample->GetRgtBorder(),
pExample->GetLwrBorder() );
// create presentation objects
pNotesPage->SetAutoLayout(pExample->GetAutoLayout(), true);
mrOutliner.UpdateFields();
return pPage;
}
/**
* Handler for deleting pages (paragraphs)
*/
IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner )
{
DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::ParagraphRemovingHdl(), model change without undo?!" );
OutlineViewPageChangesGuard aGuard(this);
Paragraph* pPara = pOutliner->GetHdlParagraph();
if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
{
// how many titles are in front of the title paragraph in question?
sal_uLong nPos = 0L;
while(pPara)
{
pPara = GetPrevTitle(pPara);
if (pPara) nPos++;
}
// delete page and notes page
sal_uInt16 nAbsPos = (sal_uInt16)nPos * 2 + 1;
SdrPage* pPage = mrDoc.GetPage(nAbsPos);
if( isRecordingUndo() )
AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
mrDoc.RemovePage(nAbsPos);
nAbsPos = (sal_uInt16)nPos * 2 + 1;
pPage = mrDoc.GetPage(nAbsPos);
if( isRecordingUndo() )
AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
mrDoc.RemovePage(nAbsPos);
// progress display if necessary
if (mnPagesToProcess)
{
mnPagesProcessed++;
if(mpProgress)
mpProgress->SetState(mnPagesProcessed);
if (mnPagesProcessed == mnPagesToProcess)
{
if(mpProgress)
{
delete mpProgress;
mpProgress = NULL;
}
mnPagesToProcess = 0;
mnPagesProcessed = 0;
}
}
pOutliner->UpdateFields();
}
InvalidateSlideNumberArea();
return 0;
}
/**
* Handler for changing the indentation depth of paragraphs (requires inserting
* or deleting of pages in some cases)
*/
IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner )
{
DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::DepthChangedHdl(), no undo for model change?!" );
OutlineViewPageChangesGuard aGuard(this);
Paragraph* pPara = pOutliner->GetHdlParagraph();
if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && ((pOutliner->GetPrevFlags() & PARAFLAG_ISPAGE) == 0) )
{
// the current paragraph is transformed into a slide
mrOutliner.SetDepth( pPara, -1 );
// are multiple level 1 paragraphs being brought to level 0 and we
// should start a progress view or a timer and didn't already?
if (mnPagesToProcess == 0)
{
Window* pActWin = mrOutlineViewShell.GetActiveWindow();
OutlinerView* pOlView = GetViewByWindow(pActWin);
std::vector<Paragraph*> aSelList;
pOlView->CreateSelectionList(aSelList);
Paragraph *pParagraph = NULL;
for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
{
pParagraph = *iter;
if( !pOutliner->HasParaFlag( pParagraph, PARAFLAG_ISPAGE ) &&
(pOutliner->GetDepth( pOutliner->GetAbsPos( pParagraph ) ) <= 0) )
mnPagesToProcess++;
}
mnPagesToProcess++; // the paragraph being in level 0 already
// should be included
mnPagesProcessed = 0;
if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD)
{
if( mpProgress )
delete mpProgress;
mpProgress = new SfxProgress( GetDocSh(), SD_RESSTR(STR_CREATE_PAGES), mnPagesToProcess );
}
else
{
mpDocSh->SetWaitCursor( true );
}
}
ParagraphInsertedHdl(pOutliner);
mnPagesProcessed++;
// should there be a progress display?
if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD)
{
if (mpProgress)
mpProgress->SetState(mnPagesProcessed);
}
// was this the last page?
if (mnPagesProcessed == mnPagesToProcess)
{
if (mnPagesToProcess > PROCESS_WITH_PROGRESS_THRESHOLD && mpProgress)
{
delete mpProgress;
mpProgress = NULL;
}
else
mpDocSh->SetWaitCursor( false );
mnPagesToProcess = 0;
mnPagesProcessed = 0;
}
pOutliner->UpdateFields();
}
else if( !pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && ((pOutliner->GetPrevFlags() & PARAFLAG_ISPAGE) != 0) )
{
// the paragraph was a page but now becomes a normal paragraph
// how many titles are before the title paragraph in question?
sal_uLong nPos = 0L;
Paragraph* pParagraph = pPara;
while(pParagraph)
{
pParagraph = GetPrevTitle(pParagraph);
if (pParagraph)
nPos++;
}
// delete page and notes page
sal_uInt16 nAbsPos = (sal_uInt16)nPos * 2 + 1;
SdrPage* pPage = mrDoc.GetPage(nAbsPos);
if( isRecordingUndo() )
AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
mrDoc.RemovePage(nAbsPos);
nAbsPos = (sal_uInt16)nPos * 2 + 1;
pPage = mrDoc.GetPage(nAbsPos);
if( isRecordingUndo() )
AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
mrDoc.RemovePage(nAbsPos);
pPage = GetPageForParagraph( pPara );
mrOutliner.SetDepth( pPara, (pPage && (static_cast<SdPage*>(pPage)->GetAutoLayout() == AUTOLAYOUT_TITLE)) ? -1 : 0 );
// progress display if necessary
if (mnPagesToProcess)
{
mnPagesProcessed++;
if (mpProgress)
mpProgress->SetState(mnPagesProcessed);
if (mnPagesProcessed == mnPagesToProcess)
{
if(mpProgress)
{
delete mpProgress;
mpProgress = NULL;
}
mnPagesToProcess = 0;
mnPagesProcessed = 0;
}
}
pOutliner->UpdateFields();
}
else if ( (pOutliner->GetPrevDepth() == 1) && ( pOutliner->GetDepth( pOutliner->GetAbsPos( pPara ) ) == 2 ) )
{
// how many titles are in front of the title paragraph in question?
sal_Int32 nPos = -1L;
Paragraph* pParagraph = pPara;
while(pParagraph)
{
pParagraph = GetPrevTitle(pParagraph);
if (pParagraph)
nPos++;
}
if(nPos >= 0)
{
SdPage*pPage = (SdPage*)mrDoc.GetSdPage( (sal_uInt16) nPos, PK_STANDARD);
if(pPage && pPage->GetPresObj(PRESOBJ_TEXT))
pOutliner->SetDepth( pPara, 0 );
}
}
// how many titles are in front of the title paragraph in question?
sal_Int32 nPos = -1L;
Paragraph* pTempPara = pPara;
while(pTempPara)
{
pTempPara = GetPrevTitle(pTempPara);
if (pTempPara)
nPos++;
}
if( nPos >= 0 )
{
SdPage* pPage = (SdPage*) mrDoc.GetSdPage( (sal_uInt16) nPos, PK_STANDARD );
if( pPage )
{
SfxStyleSheet* pStyleSheet = NULL;
sal_Int32 nPara = pOutliner->GetAbsPos( pPara );
sal_Int16 nDepth = pOutliner->GetDepth( nPara );
bool bSubTitle = pPage->GetPresObj(PRESOBJ_TEXT) != NULL;
if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
{
pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
}
else if( bSubTitle )
{
pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT );
}
else
{
pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
if( nDepth > 0 )
{
OUString aNewStyleSheetName = pStyleSheet->GetName();
if (!aNewStyleSheetName.isEmpty())
aNewStyleSheetName = aNewStyleSheetName.copy(0, aNewStyleSheetName.getLength() - 1);
aNewStyleSheetName += OUString::number( nDepth+1 );
SfxStyleSheetBasePool* pStylePool = mrDoc.GetStyleSheetPool();
pStyleSheet = (SfxStyleSheet*) pStylePool->Find( aNewStyleSheetName, pStyleSheet->GetFamily() );
}
}
// before we set the style sheet we need to preserve the bullet item
// since all items will be deleted while setting a new style sheet
SfxItemSet aOldAttrs( pOutliner->GetParaAttribs( nPara ) );
pOutliner->SetStyleSheet( nPara, pStyleSheet );
// restore the old bullet item but not if the style changed
if ( pOutliner->GetPrevDepth() != -1 && nDepth != -1 &&
aOldAttrs.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
{
SfxItemSet aAttrs( pOutliner->GetParaAttribs( nPara ) );
aAttrs.Put( *aOldAttrs.GetItem( EE_PARA_NUMBULLET ) );
pOutliner->SetParaAttribs( nPara, aAttrs );
}
}
}
InvalidateSlideNumberArea();
return 0;
}
/**
* Handler for StatusEvents
*/
IMPL_LINK_NOARG(OutlineView, StatusEventHdl)
{
::sd::Window* pWin = mrOutlineViewShell.GetActiveWindow();
OutlinerView* pOutlinerView = GetViewByWindow(pWin);
Rectangle aVis = pOutlinerView->GetVisArea();
Rectangle aText = Rectangle(Point(0,0),
Size(mnPaperWidth,
mrOutliner.GetTextHeight()));
Rectangle aWin(Point(0,0), pWin->GetOutputSizePixel());
aWin = pWin->PixelToLogic(aWin);
if (!aVis.IsEmpty()) // not when opening
{
if (aWin.GetHeight() > aText.Bottom())
aText.Bottom() = aWin.GetHeight();
mrOutlineViewShell.InitWindows(Point(0,0), aText.GetSize(),
Point(aVis.TopLeft()));
mrOutlineViewShell.UpdateScrollBars();
}
InvalidateSlideNumberArea();
return 0;
}
IMPL_LINK_NOARG(OutlineView, BeginDropHdl)
{
DBG_ASSERT(maDragAndDropModelGuard.get() == 0, "sd::OutlineView::BeginDropHdl(), prior drag operation not finished correctly!" );
maDragAndDropModelGuard.reset( new OutlineViewModelChangeGuard( *this ) );
return 0;
}
IMPL_LINK_NOARG(OutlineView, EndDropHdl)
{
maDragAndDropModelGuard.reset(0);
InvalidateSlideNumberArea();
return 0;
}
/**
* Handler for the start of a paragraph movement
*/
IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner )
{
OutlineViewPageChangesGuard aGuard(this);
// list of selected title paragraphs
mpOutlinerView[0]->CreateSelectionList(maSelectedParas);
for (std::vector<Paragraph*>::iterator it = maSelectedParas.begin(); it != maSelectedParas.end();)
{
if (!pOutliner->HasParaFlag(*it, PARAFLAG_ISPAGE))
it = maSelectedParas.erase(it);
else
++it;
}
// select the pages belonging to the paragraphs on level 0 to select
sal_uInt16 nPos = 0;
sal_Int32 nParaPos = 0;
Paragraph* pPara = pOutliner->GetParagraph( 0 );
std::vector<Paragraph*>::const_iterator fiter;
while(pPara)
{
if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page?
{
maOldParaOrder.push_back(pPara);
SdPage* pPage = mrDoc.GetSdPage(nPos, PK_STANDARD);
fiter = std::find(maSelectedParas.begin(),maSelectedParas.end(),pPara);
pPage->SetSelected(fiter != maSelectedParas.end());
++nPos;
}
pPara = pOutliner->GetParagraph( ++nParaPos );
}
return 0;
}
/**
* Handler for the end of a paragraph movement
*/
IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner )
{
OutlineViewPageChangesGuard aGuard(this);
DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::EndMovingHdl(), model change without undo?!" );
// look for insertion position via the first paragraph
Paragraph* pSearchIt = maSelectedParas.empty() ? NULL : *(maSelectedParas.begin());
// look for the first of the selected paragraphs in the new ordering
sal_uInt16 nPosNewOrder = 0;
sal_Int32 nParaPos = 0;
Paragraph* pPara = pOutliner->GetParagraph( 0 );
Paragraph* pPrev = NULL;
while (pPara && pPara != pSearchIt)
{
if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
{
nPosNewOrder++;
pPrev = pPara;
}
pPara = pOutliner->GetParagraph( ++nParaPos );
}
sal_uInt16 nPos = nPosNewOrder; // don't change nPosNewOrder
if (nPos == 0)
{
nPos = (sal_uInt16)-1; // insert before the first page
}
else
{
// look for the predecessor in the old ordering
std::vector<Paragraph*>::const_iterator it = std::find(maOldParaOrder.begin(),
maOldParaOrder.end(),
pPrev);
if (it != maOldParaOrder.end())
nPos = static_cast<sal_uInt16>(it-maOldParaOrder.begin());
else
nPos = 0xffff;
DBG_ASSERT(nPos != 0xffff, "Paragraph not found");
}
mrDoc.MovePages(nPos);
// deselect the pages again
sal_uInt16 nPageCount = (sal_uInt16)maSelectedParas.size();
while (nPageCount)
{
SdPage* pPage = mrDoc.GetSdPage(nPosNewOrder, PK_STANDARD);
pPage->SetSelected(false);
nPosNewOrder++;
nPageCount--;
}
pOutliner->UpdateFields();
maSelectedParas.clear();
maOldParaOrder.clear();
InvalidateSlideNumberArea();
return 0;
}
/**
* Look for the title text object in one page of the model
*/
SdrTextObj* OutlineView::GetTitleTextObject(SdrPage* pPage)
{
sal_uLong nObjectCount = pPage->GetObjCount();
SdrObject* pObject = NULL;
SdrTextObj* pResult = NULL;
for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
{
pObject = pPage->GetObj(nObject);
if (pObject->GetObjInventor() == SdrInventor &&
pObject->GetObjIdentifier() == OBJ_TITLETEXT)
{
pResult = (SdrTextObj*)pObject;
break;
}
}
return pResult;
}
/**
* Look for the outline text object in one page of the model
*/
SdrTextObj* OutlineView::GetOutlineTextObject(SdrPage* pPage)
{
sal_uLong nObjectCount = pPage->GetObjCount();
SdrObject* pObject = NULL;
SdrTextObj* pResult = NULL;
for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
{
pObject = pPage->GetObj(nObject);
if (pObject->GetObjInventor() == SdrInventor &&
pObject->GetObjIdentifier() == OBJ_OUTLINETEXT)
{
pResult = (SdrTextObj*)pObject;
break;
}
}
return pResult;
}
SdrTextObj* OutlineView::CreateTitleTextObject(SdPage* pPage)
{
DBG_ASSERT( GetTitleTextObject(pPage) == 0, "sd::OutlineView::CreateTitleTextObject(), there is already a title text object!" );
if( pPage->GetAutoLayout() == AUTOLAYOUT_NONE )
{
// simple case
pPage->SetAutoLayout( AUTOLAYOUT_ONLY_TITLE, true );
}
else
{
// we already have a layout with a title but the title
// object was deleted, create a new one
pPage->InsertAutoLayoutShape( 0, PRESOBJ_TITLE, false, pPage->GetTitleRect(), true );
}
return GetTitleTextObject(pPage);
}
SdrTextObj* OutlineView::CreateOutlineTextObject(SdPage* pPage)
{
DBG_ASSERT( GetOutlineTextObject(pPage) == 0, "sd::OutlineView::CreateOutlineTextObject(), there is already a layout text object!" );
AutoLayout eNewLayout = pPage->GetAutoLayout();
switch( eNewLayout )
{
case AUTOLAYOUT_NONE:
case AUTOLAYOUT_ONLY_TITLE:
case AUTOLAYOUT_TITLE: eNewLayout = AUTOLAYOUT_ENUM; break;
case AUTOLAYOUT_CHART: eNewLayout = AUTOLAYOUT_CHARTTEXT; break;
case AUTOLAYOUT_ORG:
case AUTOLAYOUT_TAB:
case AUTOLAYOUT_OBJ: eNewLayout = AUTOLAYOUT_OBJTEXT; break;
default:
break;
}
if( eNewLayout != pPage->GetAutoLayout() )
{
pPage->SetAutoLayout( eNewLayout, true );
}
else
{
// we already have a layout with a text but the text
// object was deleted, create a new one
pPage->InsertAutoLayoutShape( 0,
(eNewLayout == AUTOLAYOUT_TITLE) ? PRESOBJ_TEXT : PRESOBJ_OUTLINE,
false, pPage->GetLayoutRect(), true );
}
return GetOutlineTextObject(pPage);
}
sal_uLong OutlineView::GetPaperWidth()
{
return mnPaperWidth;
}
/** updates draw model with all changes from outliner model */
bool OutlineView::PrepareClose(bool)
{
::sd::UndoManager* pDocUndoMgr = dynamic_cast<sd::UndoManager*>(mpDocSh->GetUndoManager());
if (pDocUndoMgr != NULL)
pDocUndoMgr->SetLinkedUndoManager(NULL);
mrOutliner.GetUndoManager().Clear();
BegUndo(SD_RESSTR(STR_UNDO_CHANGE_TITLE_AND_LAYOUT));
UpdateDocument();
EndUndo();
mrDoc.SetSelected(GetActualPage(), true);
return true;
}
/**
* Set attributes of the selected text
*/
bool OutlineView::SetAttributes(const SfxItemSet& rSet, bool )
{
bool bOk = false;
OutlinerView* pOlView = GetViewByWindow(mrOutlineViewShell.GetActiveWindow());
if (pOlView)
{
pOlView->SetAttribs(rSet);
bOk = true;
}
mrOutlineViewShell.Invalidate (SID_PREVIEW_STATE);
return (bOk);
}
/**
* Get attributes of the selected text
*/
bool OutlineView::GetAttributes( SfxItemSet& rTargetSet, bool ) const
{
OutlinerView* pOlView = GetViewByWindow(
mrOutlineViewShell.GetActiveWindow());
DBG_ASSERT(pOlView, "keine OutlinerView gefunden");
rTargetSet.Put( pOlView->GetAttribs(), false );
return true;
}
/** creates outliner model from draw model */
void OutlineView::FillOutliner()
{
mrOutliner.GetUndoManager().Clear();
mrOutliner.EnableUndo(false);
ResetLinks();
mrOutliner.SetUpdateMode(false);
Paragraph* pTitleToSelect = NULL;
sal_uLong nPageCount = mrDoc.GetSdPageCount(PK_STANDARD);
// fill outliner with paragraphs from slides title & (outlines|subtitles)
for (sal_uInt16 nPage = 0; nPage < nPageCount; nPage++)
{
SdPage* pPage = (SdPage*)mrDoc.GetSdPage(nPage, PK_STANDARD);
Paragraph * pPara = NULL;
// take text from title shape
SdrTextObj* pTO = GetTitleTextObject(pPage);
if(pTO && !(pTO->IsEmptyPresObj()))
{
OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
if (pOPO)
{
bool bVertical = pOPO->IsVertical();
pOPO->SetVertical( false );
mrOutliner.AddText(*pOPO);
pOPO->SetVertical( bVertical );
pPara = mrOutliner.GetParagraph( mrOutliner.GetParagraphCount()-1 );
}
}
if( pPara == 0 ) // no title, insert an empty paragraph
{
pPara = mrOutliner.Insert(OUString());
mrOutliner.SetDepth(pPara, -1);
// do not apply hard attributes from the previous paragraph
mrOutliner.SetParaAttribs( mrOutliner.GetAbsPos(pPara),
mrOutliner.GetEmptyItemSet() );
mrOutliner.SetStyleSheet( mrOutliner.GetAbsPos( pPara ), pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ) );
}
mrOutliner.SetParaFlag( pPara, PARAFLAG_ISPAGE );
sal_Int32 nPara = mrOutliner.GetAbsPos( pPara );
UpdateParagraph( nPara );
// remember paragraph of currently selected page
if (pPage->IsSelected())
pTitleToSelect = pPara;
// take text from subtitle or outline
pTO = static_cast<SdrTextObj*>(pPage->GetPresObj(PRESOBJ_TEXT));
const bool bSubTitle = pTO != 0;
if (!pTO) // if no subtile found, try outline
pTO = GetOutlineTextObject(pPage);
if(pTO && !(pTO->IsEmptyPresObj())) // found some text
{
OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
if (pOPO)
{
sal_Int32 nParaCount1 = mrOutliner.GetParagraphCount();
bool bVertical = pOPO->IsVertical();
pOPO->SetVertical( false );
mrOutliner.AddText(*pOPO);
pOPO->SetVertical( bVertical );
sal_Int32 nParaCount2 = mrOutliner.GetParagraphCount();
for (sal_Int32 n = nParaCount1; n < nParaCount2; n++)
{
if( bSubTitle )
{
Paragraph* p = mrOutliner.GetParagraph(n);
if(p && mrOutliner.GetDepth( n ) > 0 )
mrOutliner.SetDepth(p, 0);
}
UpdateParagraph( n );
}
}
}
}
// place cursor at the start
Paragraph* pFirstPara = mrOutliner.GetParagraph( 0 );
mpOutlinerView[0]->Select( pFirstPara, true, false );
mpOutlinerView[0]->Select( pFirstPara, false, false );
// select title of slide that was selected
if (pTitleToSelect)
mpOutlinerView[0]->Select(pTitleToSelect, true, false);
SetLinks();
mrOutliner.EnableUndo(true);
mrOutliner.SetUpdateMode(true);
}
/**
* Handler for deleting of level 0 paragraphs (pages): Warning
*/
IMPL_LINK_NOARG(OutlineView, RemovingPagesHdl)
{
sal_Int32 nNumOfPages = mrOutliner.GetSelPageCount();
if (nNumOfPages > PROCESS_WITH_PROGRESS_THRESHOLD)
{
mnPagesToProcess = nNumOfPages;
mnPagesProcessed = 0;
}
if (mnPagesToProcess)
{
if( mpProgress )
delete mpProgress;
mpProgress = new SfxProgress( GetDocSh(), SD_RESSTR(STR_DELETE_PAGES), mnPagesToProcess );
}
mrOutliner.UpdateFields();
InvalidateSlideNumberArea();
return 1;
}
/**
* Handler for indenting level 0 paragraphs (pages): Warning
*/
IMPL_LINK_INLINE_START( OutlineView, IndentingPagesHdl, OutlinerView *, pOutlinerView )
{
return RemovingPagesHdl(pOutlinerView);
}
IMPL_LINK_INLINE_END( OutlineView, IndentingPagesHdl, OutlinerView *, pOutlinerView )
/** returns the first slide that is selected in the outliner or where
the cursor is located */
SdPage* OutlineView::GetActualPage()
{
::sd::Window* pWin = mrOutlineViewShell.GetActiveWindow();
OutlinerView* pActiveView = GetViewByWindow(pWin);
std::vector<Paragraph*> aSelList;
pActiveView->CreateSelectionList(aSelList);
Paragraph *pPar = aSelList.empty() ? NULL : *(aSelList.begin());
SdPage* pCurrent = GetPageForParagraph(pPar);
DBG_ASSERT( pCurrent ||
(mpDocSh->GetUndoManager() && static_cast< sd::UndoManager *>(mpDocSh->GetUndoManager())->IsDoing()) ||
maDragAndDropModelGuard.get(),
"sd::OutlineView::GetActualPage(), no current page?" );
if( pCurrent )
return pCurrent;
return mrDoc.GetSdPage( 0, PK_STANDARD );
}
SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara )
{
if( !mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) )
pPara = GetPrevTitle(pPara);
sal_uInt32 nPageToSelect = 0;
while(pPara)
{
pPara = GetPrevTitle(pPara);
if(pPara)
nPageToSelect++;
}
if( nPageToSelect < (sal_uInt32)mrDoc.GetSdPageCount( PK_STANDARD ) )
return static_cast< SdPage* >( mrDoc.GetSdPage( (sal_uInt16)nPageToSelect, PK_STANDARD) );
return 0;
}
Paragraph* OutlineView::GetParagraphForPage( ::Outliner& rOutl, SdPage* pPage )
{
// get the number of paragraphs with ident 0 we need to skip before
// we finde the actual page
sal_uInt32 nPagesToSkip = (pPage->GetPageNum() - 1) >> 1;
sal_Int32 nParaPos = 0;
Paragraph* pPara = rOutl.GetParagraph( 0 );
while( pPara )
{
// if this paragraph is a page ...
if( mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) )
{
// see if we already skiped enough pages
if( 0 == nPagesToSkip )
break; // and if so, end the loop
// we skiped another page
nPagesToSkip--;
}
// get next paragraph
pPara = mrOutliner.GetParagraph( ++nParaPos );
}
return pPara;
}
/** selects the paragraph for the given page at the outliner view*/
void OutlineView::SetActualPage( SdPage* pActual )
{
if( pActual && dynamic_cast<Outliner&>(mrOutliner).GetIgnoreCurrentPageChangesLevel()==0 && !mbFirstPaint)
{
// if we found a paragraph, select its text at the outliner view
Paragraph* pPara = GetParagraphForPage( mrOutliner, pActual );
if( pPara )
mpOutlinerView[0]->Select( pPara, true, false );
}
}
/**
* Get StyleSheet from the selection
*/
SfxStyleSheet* OutlineView::GetStyleSheet() const
{
::sd::Window* pActWin = mrOutlineViewShell.GetActiveWindow();
OutlinerView* pOlView = GetViewByWindow(pActWin);
SfxStyleSheet* pResult = pOlView->GetStyleSheet();
return pResult;
}
/**
* Mark pages as selected / not selected
*/
void OutlineView::SetSelectedPages()
{
// list of selected title paragraphs
std::vector<Paragraph*> aSelParas;
mpOutlinerView[0]->CreateSelectionList(aSelParas);
for (std::vector<Paragraph*>::iterator it = aSelParas.begin(); it != aSelParas.end();)
{
if (!mrOutliner.HasParaFlag(*it, PARAFLAG_ISPAGE))
it = aSelParas.erase(it);
else
++it;
}
// select the pages belonging to the paragraphs on level 0 to select
sal_uInt16 nPos = 0;
sal_Int32 nParaPos = 0;
Paragraph *pPara = mrOutliner.GetParagraph( 0 );
std::vector<Paragraph*>::const_iterator fiter;
while(pPara)
{
if( mrOutliner.HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page
{
SdPage* pPage = mrDoc.GetSdPage(nPos, PK_STANDARD);
DBG_ASSERT(pPage!=NULL,
"Trying to select non-existing page OutlineView::SetSelectedPages()");
if (pPage)
{
fiter = std::find(aSelParas.begin(),aSelParas.end(),pPara);
pPage->SetSelected(fiter != aSelParas.end());
}
nPos++;
}
pPara = mrOutliner.GetParagraph( ++nParaPos );
}
}
/**
* Set new links
*/
void OutlineView::SetLinks()
{
// set notification links
mrOutliner.SetParaInsertedHdl(LINK(this, OutlineView, ParagraphInsertedHdl));
mrOutliner.SetParaRemovingHdl(LINK(this, OutlineView, ParagraphRemovingHdl));
mrOutliner.SetDepthChangedHdl(LINK(this, OutlineView, DepthChangedHdl));
mrOutliner.SetBeginMovingHdl(LINK(this, OutlineView, BeginMovingHdl));
mrOutliner.SetEndMovingHdl(LINK(this, OutlineView, EndMovingHdl));
mrOutliner.SetRemovingPagesHdl(LINK(this, OutlineView, RemovingPagesHdl));
mrOutliner.SetIndentingPagesHdl(LINK(this, OutlineView, IndentingPagesHdl));
mrOutliner.SetStatusEventHdl(LINK(this, OutlineView, StatusEventHdl));
mrOutliner.SetBeginDropHdl(LINK(this,OutlineView, BeginDropHdl));
mrOutliner.SetEndDropHdl(LINK(this,OutlineView, EndDropHdl));
mrOutliner.SetPaintFirstLineHdl(LINK(this,OutlineView,PaintingFirstLineHdl));
mrOutliner.SetBeginPasteOrDropHdl(LINK(this,OutlineView, BeginPasteOrDropHdl));
mrOutliner.SetEndPasteOrDropHdl(LINK(this,OutlineView, EndPasteOrDropHdl));
}
/**
* Restore old links
*/
void OutlineView::ResetLinks() const
{
Link aEmptyLink;
mrOutliner.SetParaInsertedHdl(aEmptyLink);
mrOutliner.SetParaRemovingHdl(aEmptyLink);
mrOutliner.SetDepthChangedHdl(aEmptyLink);
mrOutliner.SetBeginMovingHdl(aEmptyLink);
mrOutliner.SetEndMovingHdl(aEmptyLink);
mrOutliner.SetStatusEventHdl(aEmptyLink);
mrOutliner.SetRemovingPagesHdl(aEmptyLink);
mrOutliner.SetIndentingPagesHdl(aEmptyLink);
mrOutliner.SetDrawPortionHdl(aEmptyLink);
mrOutliner.SetBeginPasteOrDropHdl(aEmptyLink);
mrOutliner.SetEndPasteOrDropHdl(aEmptyLink);
}
sal_Int8 OutlineView::AcceptDrop( const AcceptDropEvent&, DropTargetHelper&, ::sd::Window*, sal_uInt16, sal_uInt16)
{
return DND_ACTION_NONE;
}
sal_Int8 OutlineView::ExecuteDrop( const ExecuteDropEvent&, DropTargetHelper&, ::sd::Window*, sal_uInt16, sal_uInt16)
{
return DND_ACTION_NONE;
}
// Re-implement GetScriptType for this view to get correct results
sal_uInt16 OutlineView::GetScriptType() const
{
sal_uInt16 nScriptType = ::sd::View::GetScriptType();
OutlinerParaObject* pTempOPObj = mrOutliner.CreateParaObject();
if(pTempOPObj)
{
nScriptType = pTempOPObj->GetTextObject().GetScriptType();
delete pTempOPObj;
}
return nScriptType;
}
void OutlineView::onUpdateStyleSettings( bool bForceUpdate /* = false */ )
{
svtools::ColorConfig aColorConfig;
const Color aDocColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
if( bForceUpdate || (maDocColor != aDocColor) )
{
sal_uInt16 nView;
for( nView = 0; nView < MAX_OUTLINERVIEWS; nView++ )
{
if (mpOutlinerView[nView] != NULL)
{
mpOutlinerView[nView]->SetBackgroundColor( aDocColor );
::Window* pWindow = mpOutlinerView[nView]->GetWindow();
if( pWindow )
pWindow->SetBackground( Wallpaper( aDocColor ) );
}
}
mrOutliner.SetBackgroundColor( aDocColor );
maDocColor = aDocColor;
}
}
IMPL_LINK_NOARG(OutlineView, AppEventListenerHdl)
{
onUpdateStyleSettings();
return 0;
}
IMPL_LINK(OutlineView, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*, pEvent)
{
if (pEvent != NULL)
{
switch (pEvent->meEventId)
{
case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
SetActualPage(mrOutlineViewShell.GetActualPage());
InvalidateSlideNumberArea();
break;
case tools::EventMultiplexerEvent::EID_PAGE_ORDER:
if (dynamic_cast<Outliner&>(mrOutliner).GetIgnoreCurrentPageChangesLevel()==0)
{
if (((mrDoc.GetPageCount()-1)%2) == 0)
{
mrOutliner.Clear();
FillOutliner();
::sd::Window* pWindow = mrOutlineViewShell.GetActiveWindow();
if (pWindow != NULL)
pWindow->Invalidate();
}
}
break;
}
}
return 0;
}
void OutlineView::IgnoreCurrentPageChanges (bool bIgnoreChanges)
{
if (bIgnoreChanges)
dynamic_cast<Outliner&>(mrOutliner).IncreIgnoreCurrentPageChangesLevel();
else
dynamic_cast<Outliner&>(mrOutliner).DecreIgnoreCurrentPageChangesLevel();
}
/** call this method before you do anything that can modify the outliner
and or the drawing document model. It will create needed undo actions */
void OutlineView::BeginModelChange()
{
mrOutliner.GetUndoManager().EnterListAction("", "");
BegUndo(SD_RESSTR(STR_UNDO_CHANGE_TITLE_AND_LAYOUT));
}
/** call this method after BeginModelChange(), when all possible model
changes are done. */
void OutlineView::EndModelChange()
{
UpdateDocument();
::svl::IUndoManager* pDocUndoMgr = mpDocSh->GetUndoManager();
bool bHasUndoActions = pDocUndoMgr->GetUndoActionCount() != 0;
EndUndo();
DBG_ASSERT( bHasUndoActions == (mrOutliner.GetUndoManager().GetUndoActionCount() != 0), "sd::OutlineView::EndModelChange(), undo actions not in sync!" );
mrOutliner.GetUndoManager().LeaveListAction();
if( bHasUndoActions && mrOutliner.GetEditEngine().HasTriedMergeOnLastAddUndo() )
TryToMergeUndoActions();
mrOutlineViewShell.Invalidate( SID_UNDO );
mrOutlineViewShell.Invalidate( SID_REDO );
}
/** updates all changes in the outliner model to the draw model */
void OutlineView::UpdateDocument()
{
const sal_uInt32 nPageCount = mrDoc.GetSdPageCount(PK_STANDARD);
Paragraph* pPara = mrOutliner.GetParagraph( 0 );
sal_uInt32 nPage;
for (nPage = 0; nPage < nPageCount; nPage++)
{
SdPage* pPage = mrDoc.GetSdPage( (sal_uInt16)nPage, PK_STANDARD);
mrDoc.SetSelected(pPage, false);
mrOutlineViewShell.UpdateTitleObject( pPage, pPara );
mrOutlineViewShell.UpdateOutlineObject( pPage, pPara );
if( pPara )
pPara = GetNextTitle(pPara);
}
DBG_ASSERT( pPara == 0, "sd::OutlineView::UpdateDocument(), slides are out of sync, creating missing ones" );
while( pPara )
{
SdPage* pPage = InsertSlideForParagraph( pPara );
mrDoc.SetSelected(pPage, false);
mrOutlineViewShell.UpdateTitleObject( pPage, pPara );
mrOutlineViewShell.UpdateOutlineObject( pPage, pPara );
if( pPara )
pPara = GetNextTitle(pPara);
}
}
/** merge edit engine undo actions if possible */
void OutlineView::TryToMergeUndoActions()
{
::svl::IUndoManager& rOutlineUndo = mrOutliner.GetUndoManager();
if( rOutlineUndo.GetUndoActionCount() > 1 )
{
SfxListUndoAction* pListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction(0) );
SfxListUndoAction* pPrevListAction = dynamic_cast< SfxListUndoAction* >( rOutlineUndo.GetUndoAction(1) );
if( pListAction && pPrevListAction )
{
// find the top EditUndo action in the top undo action list
size_t nAction = pListAction->aUndoActions.size();
EditUndo* pEditUndo = 0;
while( !pEditUndo && nAction )
{
pEditUndo = dynamic_cast< EditUndo* >(pListAction->aUndoActions[--nAction].pAction);
}
sal_uInt16 nEditPos = nAction; // we need this later to remove the merged undo actions
// make sure it is the only EditUndo action in the top undo list
while( pEditUndo && nAction )
{
if( dynamic_cast< EditUndo* >(pListAction->aUndoActions[--nAction].pAction) )
pEditUndo = 0;
}
// do we have one and only one EditUndo action in the top undo list?
if( pEditUndo )
{
// yes, see if we can merge it with the prev undo list
nAction = pPrevListAction->aUndoActions.size();
EditUndo* pPrevEditUndo = 0;
while( !pPrevEditUndo && nAction )
pPrevEditUndo = dynamic_cast< EditUndo* >(pPrevListAction->aUndoActions[--nAction].pAction);
if( pPrevEditUndo && pPrevEditUndo->Merge( pEditUndo ) )
{
// ok we merged the only EditUndo of the top undo list with
// the top EditUndo of the previous undo list
// first remove the merged undo action
DBG_ASSERT( pListAction->aUndoActions[nEditPos].pAction == pEditUndo,
"sd::OutlineView::TryToMergeUndoActions(), wrong edit pos!" );
pListAction->aUndoActions.Remove(nEditPos);
delete pEditUndo;
// now check if we also can merge the draw undo actions
::svl::IUndoManager* pDocUndoManager = mpDocSh->GetUndoManager();
if( pDocUndoManager && ( pListAction->aUndoActions.size() == 1 ))
{
SfxLinkUndoAction* pLinkAction = dynamic_cast< SfxLinkUndoAction* >( pListAction->aUndoActions[0].pAction );
SfxLinkUndoAction* pPrevLinkAction = 0;
if( pLinkAction )
{
nAction = pPrevListAction->aUndoActions.size();
while( !pPrevLinkAction && nAction )
pPrevLinkAction = dynamic_cast< SfxLinkUndoAction* >(pPrevListAction->aUndoActions[--nAction].pAction);
}
if( pLinkAction && pPrevLinkAction &&
( pLinkAction->GetAction() == pDocUndoManager->GetUndoAction(0) ) &&
( pPrevLinkAction->GetAction() == pDocUndoManager->GetUndoAction(1) ) )
{
SfxListUndoAction* pSourceList = dynamic_cast< SfxListUndoAction* >(pLinkAction->GetAction());
SfxListUndoAction* pDestinationList = dynamic_cast< SfxListUndoAction* >(pPrevLinkAction->GetAction());
if( pSourceList && pDestinationList )
{
sal_uInt16 nCount = pSourceList->aUndoActions.size();
sal_uInt16 nDestAction = pDestinationList->aUndoActions.size();
while( nCount-- )
{
SfxUndoAction* pTemp = pSourceList->aUndoActions[0].pAction;
pSourceList->aUndoActions.Remove(0);
pDestinationList->aUndoActions.Insert( pTemp, nDestAction++ );
}
pDestinationList->nCurUndoAction = pDestinationList->aUndoActions.size();
pListAction->aUndoActions.Remove(0);
delete pLinkAction;
pDocUndoManager->RemoveLastUndoAction();
}
}
}
if ( !pListAction->aUndoActions.empty() )
{
// now we have to move all remaining doc undo actions from the top undo
// list to the previous undo list and remove the top undo list
size_t nCount = pListAction->aUndoActions.size();
size_t nDestAction = pPrevListAction->aUndoActions.size();
while( nCount-- )
{
SfxUndoAction* pTemp = pListAction->aUndoActions[0].pAction;
pListAction->aUndoActions.Remove(0);
if( pTemp )
pPrevListAction->aUndoActions.Insert( pTemp, nDestAction++ );
}
pPrevListAction->nCurUndoAction = pPrevListAction->aUndoActions.size();
}
rOutlineUndo.RemoveLastUndoAction();
}
}
}
}
}
IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo)
{
if( pInfo )
{
Paragraph* pPara = mrOutliner.GetParagraph( pInfo->mnPara );
EditEngine& rEditEngine = const_cast< EditEngine& >( mrOutliner.GetEditEngine() );
Size aImageSize( pInfo->mpOutDev->PixelToLogic( maSlideImage.GetSizePixel() ) );
Size aOffset( 100, 100 );
// paint slide number
if( pPara && mrOutliner.HasParaFlag(pPara,PARAFLAG_ISPAGE) )
{
long nPage = 0; // todo, printing??
for ( sal_Int32 n = 0; n <= pInfo->mnPara; n++ )
{
Paragraph* p = mrOutliner.GetParagraph( n );
if ( mrOutliner.HasParaFlag(p,PARAFLAG_ISPAGE) )
nPage++;
}
long nBulletHeight = (long)mrOutliner.GetLineHeight( pInfo->mnPara );
long nFontHeight = 0;
if ( !rEditEngine.IsFlatMode() )
{
nFontHeight = nBulletHeight / 5;
}
else
{
nFontHeight = (nBulletHeight * 10) / 25;
}
Size aFontSz( 0, nFontHeight );
Size aOutSize( 2000, nBulletHeight );
const float fImageHeight = ((float)aOutSize.Height() * (float)4) / (float)7;
const float fImageRatio = (float)aImageSize.Height() / (float)aImageSize.Width();
aImageSize.Width() = (long)( fImageRatio * fImageHeight );
aImageSize.Height() = (long)( fImageHeight );
Point aImagePos( pInfo->mrStartPos );
aImagePos.X() += aOutSize.Width() - aImageSize.Width() - aOffset.Width() ;
aImagePos.Y() += (aOutSize.Height() - aImageSize.Height()) / 2;
pInfo->mpOutDev->DrawImage( aImagePos, aImageSize, maSlideImage );
const bool bVertical = mrOutliner.IsVertical();
const bool bRightToLeftPara = rEditEngine.IsRightToLeft( pInfo->mnPara );
LanguageType eLang = rEditEngine.GetDefaultLanguage();
Point aTextPos( aImagePos.X() - aOffset.Width(), pInfo->mrStartPos.Y() );
Font aNewFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE, eLang, 0 ) );
aNewFont.SetSize( aFontSz );
aNewFont.SetVertical( bVertical );
aNewFont.SetOrientation( bVertical ? 2700 : 0 );
aNewFont.SetColor( COL_AUTO );
pInfo->mpOutDev->SetFont( aNewFont );
OUString aPageText = OUString::number( nPage );
Size aTextSz;
aTextSz.Width() = pInfo->mpOutDev->GetTextWidth( aPageText );
aTextSz.Height() = pInfo->mpOutDev->GetTextHeight();
if ( !bVertical )
{
aTextPos.Y() += (aOutSize.Height() - aTextSz.Height()) / 2;
if ( !bRightToLeftPara )
{
aTextPos.X() -= aTextSz.Width();
}
else
{
aTextPos.X() += aTextSz.Width();
}
}
else
{
aTextPos.Y() -= aTextSz.Width();
aTextPos.X() += nBulletHeight / 2;
}
pInfo->mpOutDev->DrawText( aTextPos, aPageText );
}
}
return 0;
}
void OutlineView::UpdateParagraph( sal_Int32 nPara )
{
SfxItemSet aNewAttrs2( mrOutliner.GetParaAttribs( nPara ) );
aNewAttrs2.Put( maLRSpaceItem );
mrOutliner.SetParaAttribs( nPara, aNewAttrs2 );
}
void OutlineView::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfos*/ )
{
}
/** this is called after a paste or drop operation, make sure that the newly inserted paragraphs
get the correct style sheet and new slides are inserted. */
void OutlineView::OnEndPasteOrDrop( PasteOrDropInfos* pInfos )
{
SdPage* pPage = 0;
SfxStyleSheetBasePool* pStylePool = GetDoc().GetStyleSheetPool();
for( sal_Int32 nPara = pInfos->nStartPara; nPara <= pInfos->nEndPara; nPara++ )
{
Paragraph* pPara = mrOutliner.GetParagraph( nPara );
bool bPage = mrOutliner.HasParaFlag( pPara, PARAFLAG_ISPAGE );
if( !bPage )
{
SdStyleSheet* pStyleSheet = dynamic_cast< SdStyleSheet* >( mrOutliner.GetStyleSheet( nPara ) );
if( pStyleSheet )
{
const OUString aName( pStyleSheet->GetApiName() );
if ( aName == "title" )
bPage = true;
}
}
if( !pPara )
continue; // fatality!?
if( bPage && (nPara != pInfos->nStartPara) )
{
// insert new slide for this paragraph
pPage = InsertSlideForParagraph( pPara );
}
else
{
// newly inserted non page paragraphs get the outline style
if( !pPage )
pPage = GetPageForParagraph( pPara );
if( pPage )
{
SfxStyleSheet* pStyle = pPage->GetStyleSheetForPresObj( bPage ? PRESOBJ_TITLE : PRESOBJ_OUTLINE );
if( !bPage )
{
const sal_Int16 nDepth = mrOutliner.GetDepth( nPara );
if( nDepth > 0 )
{
OUString aStyleSheetName = pStyle->GetName();
if (!aStyleSheetName.isEmpty())
aStyleSheetName = aStyleSheetName.copy(0, aStyleSheetName.getLength() - 1);
aStyleSheetName += OUString::number( nDepth );
pStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyle->GetFamily() ) );
DBG_ASSERT( pStyle, "sd::OutlineView::OnEndPasteOrDrop(), Style not found!" );
}
}
mrOutliner.SetStyleSheet( nPara, pStyle );
}
UpdateParagraph( nPara );
}
}
}
// - OutlineViewModelChangeGuard -
OutlineViewModelChangeGuard::OutlineViewModelChangeGuard( OutlineView& rView )
: mrView( rView )
{
mrView.BeginModelChange();
}
OutlineViewModelChangeGuard::~OutlineViewModelChangeGuard()
{
mrView.EndModelChange();
}
// - OutlineViewPageChangesGuard -
OutlineViewPageChangesGuard::OutlineViewPageChangesGuard( OutlineView* pView )
: mpView( pView )
{
if( mpView )
mpView->IgnoreCurrentPageChanges( true );
}
OutlineViewPageChangesGuard::~OutlineViewPageChangesGuard()
{
if( mpView )
mpView->IgnoreCurrentPageChanges( false );
}
} // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|