1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sd.hxx" 26 27 #include "OutlineViewShell.hxx" 28 29 #include "ViewShellImplementation.hxx" 30 #include <memory> 31 #include "helpids.h" 32 #include "app.hrc" 33 #include <svx/hyprlink.hxx> 34 #include <svx/hyperdlg.hxx> 35 #include <svx/zoomslideritem.hxx> 36 37 #include <sfx2/objface.hxx> 38 #include <sot/exchange.hxx> 39 #include <svx/ruler.hxx> 40 #include <svx/zoomitem.hxx> 41 #include <editeng/eeitem.hxx> 42 #include <editeng/flditem.hxx> 43 #include <sfx2/shell.hxx> 44 #include <sfx2/templdlg.hxx> 45 #include <sfx2/viewfac.hxx> 46 #include <sfx2/request.hxx> 47 #include <svx/hlnkitem.hxx> 48 #include <svx/svdotext.hxx> 49 #include <sfx2/dispatch.hxx> 50 #include <vcl/scrbar.hxx> 51 #include <svl/whiter.hxx> 52 #include <editeng/editstat.hxx> 53 #include <svl/itempool.hxx> 54 #include <sfx2/tplpitem.hxx> 55 #include <sfx2/sidebar/SidebarChildWindow.hxx> 56 #include <svx/svdorect.hxx> 57 #include <sot/formats.hxx> 58 #include <com/sun/star/linguistic2/XThesaurus.hpp> 59 #include <com/sun/star/i18n/TransliterationModules.hpp> 60 #include <com/sun/star/i18n/TransliterationModulesExtra.hpp> 61 #include <editeng/unolingu.hxx> 62 #include <comphelper/processfactory.hxx> 63 #include <editeng/outlobj.hxx> 64 #include <svl/cjkoptions.hxx> 65 #include <svtools/cliplistener.hxx> 66 #include <svl/srchitem.hxx> 67 #include <editeng/editobj.hxx> 68 #include "fubullet.hxx" 69 #include "optsitem.hxx" 70 71 #include "strings.hrc" 72 #include "glob.hrc" 73 #include "res_bmp.hrc" 74 #include "Outliner.hxx" 75 #include "Window.hxx" 76 #include "TextObjectBar.hxx" 77 #include "drawdoc.hxx" 78 #include "sdresid.hxx" 79 #include "sdpage.hxx" 80 #include "fuoltext.hxx" 81 #include "FrameView.hxx" 82 #include "zoomlist.hxx" 83 #include "stlsheet.hxx" 84 #include "slideshow.hxx" 85 #include "SdUnoOutlineView.hxx" 86 #include "SpellDialogChildWindow.hxx" 87 88 #include "AccessibleOutlineView.hxx" 89 #include "ViewShellBase.hxx" 90 #include "ViewShellManager.hxx" 91 #include "DrawController.hxx" 92 #include "framework/FrameworkHelper.hxx" 93 94 using ::rtl::OUString; 95 using namespace ::com::sun::star; 96 using namespace ::com::sun::star::uno; 97 using namespace ::com::sun::star::lang; 98 using namespace ::com::sun::star::linguistic2; 99 100 using namespace sd; 101 #define OutlineViewShell 102 #include "sdslots.hxx" 103 104 namespace sd { 105 106 #define MIN_ZOOM 10 // Minimaler Zoomfaktor 107 #define MAX_ZOOM 1000 // Maximaler Zoomfaktor 108 109 /************************************************************************/ 110 111 112 /************************************************************************* 113 |* 114 |* SFX-Slotmap und Standardinterface deklarieren 115 |* 116 \************************************************************************/ 117 118 119 SFX_IMPL_INTERFACE(OutlineViewShell, SfxShell, SdResId(STR_OUTLINEVIEWSHELL)) 120 { 121 SFX_POPUPMENU_REGISTRATION( SdResId(RID_OUTLINE_POPUP) ); 122 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD | 123 SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER, 124 SdResId(RID_OUTLINE_TOOLBOX) ); 125 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC, 126 SdResId(RID_DRAW_VIEWER_TOOLBOX) ); 127 SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() ); 128 SFX_CHILDWINDOW_REGISTRATION( SvxHyperlinkDlgWrapper::GetChildWindowId() ); 129 SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() ); 130 SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); 131 SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); 132 SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); 133 } 134 135 136 TYPEINIT1( OutlineViewShell, ViewShell ); 137 138 139 /************************************************************************* 140 |* 141 |* gemeinsamer Initialiserungsanteil der beiden Konstruktoren 142 |* 143 \************************************************************************/ 144 145 void OutlineViewShell::Construct(DrawDocShell* ) 146 { 147 sal_Bool bModified = GetDoc()->IsChanged(); 148 149 meShellType = ST_OUTLINE; 150 Size aSize(29700, 21000); 151 Point aWinPos (0, 0); 152 Point aViewOrigin(0, 0); 153 GetActiveWindow()->SetMinZoomAutoCalc(sal_False); 154 GetActiveWindow()->SetMinZoom( MIN_ZOOM ); 155 GetActiveWindow()->SetMaxZoom( MAX_ZOOM ); 156 InitWindows(aViewOrigin, aSize, aWinPos); 157 pOlView = new OutlineView(GetDocSh(), GetActiveWindow(), this); 158 mpView = pOlView; // Pointer der Basisklasse ViewShell 159 160 SetPool( &GetDoc()->GetPool() ); 161 162 SetZoom(69); 163 164 // Einstellungen der FrameView uebernehmen 165 ReadFrameViewData(mpFrameView); 166 167 ::Outliner* pOutl = pOlView->GetOutliner(); 168 pOutl->SetUpdateMode(sal_True); 169 170 if (!bModified) 171 { 172 pOutl->ClearModifyFlag(); 173 } 174 175 pLastPage = GetActualPage(); 176 177 String aName( RTL_CONSTASCII_USTRINGPARAM( "OutlineViewShell" )); 178 SetName (aName); 179 180 SetHelpId( SD_IF_SDOUTLINEVIEWSHELL ); 181 GetActiveWindow()->SetHelpId( HID_SDOUTLINEVIEWSHELL ); 182 GetActiveWindow()->SetUniqueId( HID_SDOUTLINEVIEWSHELL ); 183 } 184 185 186 187 188 Reference<drawing::XDrawSubController> OutlineViewShell::CreateSubController (void) 189 { 190 Reference<drawing::XDrawSubController> xSubController; 191 192 if (IsMainViewShell()) 193 { 194 // Create uno sub controller for the main view shell. 195 xSubController = Reference<drawing::XDrawSubController>( 196 new SdUnoOutlineView ( 197 GetViewShellBase().GetDrawController(), 198 *this, 199 *GetView())); 200 } 201 202 return xSubController; 203 } 204 205 206 207 208 /************************************************************************* 209 |* 210 |* Standard-Konstruktor, Fenster duerfen nicht automatisch zentrieren 211 |* 212 \************************************************************************/ 213 214 OutlineViewShell::OutlineViewShell ( 215 SfxViewFrame* pFrame, 216 ViewShellBase& rViewShellBase, 217 ::Window* pParentWindow, 218 FrameView* pFrameViewArgument) 219 : ViewShell(pFrame, pParentWindow, rViewShellBase), 220 pOlView(NULL), 221 pLastPage( NULL ), 222 pClipEvtLstnr(NULL), 223 bPastePossible(false), 224 mbInitialized(false) 225 226 { 227 if (pFrameViewArgument != NULL) 228 mpFrameView = pFrameViewArgument; 229 else 230 mpFrameView = new FrameView(GetDoc()); 231 232 mpFrameView->Connect(); 233 234 Construct(GetDocSh()); 235 } 236 237 /************************************************************************* 238 |* 239 |* Destruktor 240 |* 241 \************************************************************************/ 242 243 OutlineViewShell::~OutlineViewShell() 244 { 245 DisposeFunctions(); 246 247 delete pOlView; 248 249 mpFrameView->Disconnect(); 250 251 if ( pClipEvtLstnr ) 252 { 253 pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_False ); 254 pClipEvtLstnr->ClearCallbackLink(); // #103849# prevent callback if another thread is waiting 255 pClipEvtLstnr->release(); 256 } 257 } 258 259 260 261 262 void OutlineViewShell::Shutdown (void) 263 { 264 ViewShell::Shutdown(); 265 266 PrepareClose(); 267 } 268 269 270 271 272 /************************************************************************* 273 |* 274 |* Paint-Methode: das Ereignis wird vom Fenster pWindow an 275 |* die Viewshell und die aktuelle Funktion weitergeleitet 276 |* 277 \************************************************************************/ 278 279 void OutlineViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin) 280 { 281 if (pOlView) 282 { 283 pOlView->Paint(rRect, pWin); 284 } 285 286 if(HasCurrentFunction()) 287 { 288 GetCurrentFunction()->Paint(rRect, pWin); 289 } 290 } 291 292 void OutlineViewShell::ArrangeGUIElements () 293 { 294 // Retrieve the current size (thickness) of the scroll bars. That is 295 // the width of the vertical and the height of the horizontal scroll 296 // bar. 297 int nScrollBarSize = 298 GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize(); 299 maScrBarWH = Size (nScrollBarSize, nScrollBarSize); 300 301 ViewShell::ArrangeGUIElements (); 302 303 ::sd::Window* pWindow = mpContentWindow.get(); 304 if (pWindow != NULL) 305 { 306 pWindow->SetMinZoomAutoCalc(sal_False); 307 308 // pWindow->SetPosSizePixel(rNewPos, Size(nSizeX, nSizeY)); 309 310 // OutputArea der OutlinerView aendern 311 OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow); 312 313 Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel()); 314 // aWin.nLeft = pOlView->GetPageNumberWidthPixel(); 315 316 aWin = pWindow->PixelToLogic(aWin); 317 pOutlinerView->SetOutputArea(aWin); 318 319 Rectangle aVis = pOutlinerView->GetVisArea(); 320 321 Rectangle aText = Rectangle(Point(0,0), 322 Size(pOlView->GetPaperWidth(), 323 pOlView->GetOutliner()->GetTextHeight())); 324 aText.Bottom() += aWin.GetHeight(); 325 326 if (!aWin.IsEmpty()) // nicht beim Oeffnen 327 { 328 InitWindows(Point(0,0), aText.GetSize(), Point(aVis.TopLeft())); 329 UpdateScrollBars(); 330 } 331 } 332 } 333 334 /************************************************************************* 335 |* 336 |* SfxRequests fuer Controller bearbeiten 337 |* 338 \************************************************************************/ 339 340 void OutlineViewShell::ExecCtrl(SfxRequest &rReq) 341 { 342 sal_uInt16 nSlot = rReq.GetSlot(); 343 switch ( nSlot ) 344 { 345 case SID_MAIL_SCROLLBODY_PAGEDOWN: 346 { 347 ExecReq( rReq ); 348 break; 349 } 350 351 case SID_OPT_LOCALE_CHANGED: 352 { 353 pOlView->GetOutliner()->UpdateFields(); 354 UpdatePreview( GetActualPage() ); 355 rReq.Done(); 356 break; 357 } 358 359 default: 360 break; 361 } 362 } 363 364 365 366 367 void OutlineViewShell::AddWindow (::sd::Window* pWin) 368 { 369 pOlView->AddWindowToPaintView(pWin); 370 } 371 372 373 374 375 void OutlineViewShell::RemoveWindow (::sd::Window* pWin) 376 { 377 pOlView->DeleteWindowFromPaintView(pWin); 378 } 379 380 381 382 383 /************************************************************************* 384 |* 385 |* Activate(), beim ersten Aufruf erfolgt ein Update der Felder 386 |* 387 \************************************************************************/ 388 void OutlineViewShell::Activate( sal_Bool bIsMDIActivate ) 389 { 390 if ( ! mbInitialized) 391 { 392 mbInitialized = true; 393 SfxRequest aRequest (SID_EDIT_OUTLINER, 0, GetDoc()->GetItemPool()); 394 FuPermanent (aRequest); 395 } 396 397 ViewShell::Activate( bIsMDIActivate ); 398 pOlView->SetLinks(); 399 pOlView->ConnectToApplication(); 400 401 if( bIsMDIActivate ) 402 { 403 OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() ); 404 ::Outliner* pOutl = pOutlinerView->GetOutliner(); 405 pOutl->UpdateFields(); 406 } 407 } 408 409 /************************************************************************* 410 |* 411 |* Deactivate() 412 |* 413 \************************************************************************/ 414 void OutlineViewShell::Deactivate( sal_Bool bIsMDIActivate ) 415 { 416 pOlView->DisconnectFromApplication(); 417 418 // #96416# Links must be kept also on deactivated viewshell, to allow drag'n'drop 419 // to function properly 420 // pOlView->ResetLinks(); 421 422 ViewShell::Deactivate( bIsMDIActivate ); 423 } 424 425 /************************************************************************* 426 |* 427 |* Status von Controller-SfxSlots setzen 428 |* 429 \************************************************************************/ 430 void OutlineViewShell::GetCtrlState(SfxItemSet &rSet) 431 { 432 if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK)) 433 { 434 SvxHyperlinkItem aHLinkItem; 435 436 OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow()); 437 if (pOLV) 438 { 439 const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); 440 if (pFieldItem) 441 { 442 ESelection aSel = pOLV->GetSelection(); 443 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 ) 444 { 445 const SvxFieldData* pField = pFieldItem->GetField(); 446 if ( pField->ISA(SvxURLField) ) 447 { 448 aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation()); 449 aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL()); 450 aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame()); 451 } 452 } 453 } 454 } 455 rSet.Put(aHLinkItem); 456 } 457 rSet.Put( SfxBoolItem( SID_READONLY_MODE, GetDocSh()->IsReadOnly() ) ); 458 459 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) ) 460 rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) ); 461 462 if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_HALFWIDTH) || 463 SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_FULLWIDTH) || 464 SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_HIRAGANA) || 465 SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_KATAGANA) ) 466 { 467 SvtCJKOptions aCJKOptions; 468 if( !aCJKOptions.IsChangeCaseMapEnabled() ) 469 { 470 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False ); 471 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False ); 472 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False ); 473 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False ); 474 rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH ); 475 rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH ); 476 rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA ); 477 rSet.DisableItem( SID_TRANSLITERATE_KATAGANA ); 478 } 479 else 480 { 481 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True ); 482 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True ); 483 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True ); 484 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True ); 485 } 486 } 487 } 488 489 /************************************************************************* 490 |* 491 |* SfxRequests fuer Support-Funktionen 492 |* 493 \************************************************************************/ 494 495 void OutlineViewShell::FuSupport(SfxRequest &rReq) 496 { 497 if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs()) 498 GetDocSh()->SetStyleFamily(((SfxUInt16Item&)rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue()); 499 500 sal_Bool bPreviewState = sal_False; 501 sal_uLong nSlot = rReq.GetSlot(); 502 503 std::auto_ptr< OutlineViewModelChangeGuard > aGuard; 504 if( pOlView && ( 505 (nSlot == SID_TRANSLITERATE_SENTENCE_CASE) || 506 (nSlot == SID_TRANSLITERATE_TITLE_CASE) || 507 (nSlot == SID_TRANSLITERATE_TOGGLE_CASE) || 508 (nSlot == SID_TRANSLITERATE_UPPER) || 509 (nSlot == SID_TRANSLITERATE_LOWER) || 510 (nSlot == SID_TRANSLITERATE_HALFWIDTH) || 511 (nSlot == SID_TRANSLITERATE_FULLWIDTH) || 512 (nSlot == SID_TRANSLITERATE_HIRAGANA) || 513 (nSlot == SID_TRANSLITERATE_KATAGANA) || 514 (nSlot == SID_CUT) || 515 // (nSlot == SID_COPY) || 516 (nSlot == SID_PASTE) || 517 (nSlot == SID_DELETE))) 518 { 519 aGuard.reset( new OutlineViewModelChangeGuard( *pOlView ) ); 520 } 521 522 switch ( nSlot ) 523 { 524 case SID_CUT: 525 { 526 if(HasCurrentFunction()) 527 { 528 GetCurrentFunction()->DoCut(); 529 } 530 else if (pOlView) 531 { 532 pOlView->DoCut(); 533 } 534 rReq.Done(); 535 bPreviewState = sal_True; 536 } 537 break; 538 539 case SID_COPY: 540 { 541 if(HasCurrentFunction()) 542 { 543 GetCurrentFunction()->DoCopy(); 544 } 545 else if (pOlView) 546 { 547 pOlView->DoCopy(); 548 } 549 rReq.Done(); 550 bPreviewState = sal_True; 551 } 552 break; 553 554 case SID_PASTE: 555 { 556 OutlineViewPageChangesGuard aGuard2(pOlView); 557 558 if(HasCurrentFunction()) 559 { 560 GetCurrentFunction()->DoPaste(); 561 } 562 else if (pOlView) 563 { 564 pOlView->DoPaste(); 565 } 566 rReq.Done(); 567 bPreviewState = sal_True; 568 } 569 break; 570 571 case SID_DELETE: 572 { 573 if( pOlView ) 574 { 575 OutlinerView* pOutlView = pOlView->GetViewByWindow(GetActiveWindow()); 576 if (pOutlView) 577 { 578 OutlineViewPageChangesGuard aGuard2(pOlView); 579 580 KeyCode aKCode(KEY_DELETE); 581 KeyEvent aKEvt( 0, aKCode ); 582 pOutlView->PostKeyEvent(aKEvt); 583 584 FunctionReference xFunc( GetCurrentFunction() ); 585 FuOutlineText* pFuOutlineText = dynamic_cast< FuOutlineText* >( xFunc.get() ); 586 if( pFuOutlineText ) 587 pFuOutlineText->UpdateForKeyPress (aKEvt); 588 } 589 } 590 rReq.Done(); 591 bPreviewState = sal_True; 592 } 593 break; 594 595 case SID_DRAWINGMODE: 596 case SID_NOTESMODE: 597 case SID_HANDOUTMODE: 598 case SID_DIAMODE: 599 case SID_OUTLINEMODE: 600 framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot( 601 nSlot, 602 rReq); 603 rReq.Done(); 604 break; 605 606 case SID_RULER: 607 SetRuler( !HasRuler() ); 608 Invalidate( SID_RULER ); 609 rReq.Done(); 610 break; 611 612 case SID_ZOOM_PREV: 613 { 614 if (mpZoomList->IsPreviousPossible()) 615 { 616 // Vorheriges ZoomRect einstellen 617 SetZoomRect(mpZoomList->GetPreviousZoomRect()); 618 } 619 rReq.Done (); 620 } 621 break; 622 623 case SID_ZOOM_NEXT: 624 { 625 if (mpZoomList->IsNextPossible()) 626 { 627 // Naechstes ZoomRect einstellen 628 SetZoomRect(mpZoomList->GetNextZoomRect()); 629 } 630 rReq.Done (); 631 } 632 break; 633 634 case SID_AUTOSPELL_CHECK: 635 { 636 GetDoc()->SetOnlineSpell(!GetDoc()->GetOnlineSpell()); 637 rReq.Done (); 638 } 639 break; 640 641 case SID_TRANSLITERATE_SENTENCE_CASE: 642 case SID_TRANSLITERATE_TITLE_CASE: 643 case SID_TRANSLITERATE_TOGGLE_CASE: 644 case SID_TRANSLITERATE_UPPER: 645 case SID_TRANSLITERATE_LOWER: 646 case SID_TRANSLITERATE_HALFWIDTH: 647 case SID_TRANSLITERATE_FULLWIDTH: 648 case SID_TRANSLITERATE_HIRAGANA: 649 case SID_TRANSLITERATE_KATAGANA: 650 { 651 OutlinerView* pOLV = pOlView->GetViewByWindow( GetActiveWindow() ); 652 if( pOLV ) 653 { 654 using namespace ::com::sun::star::i18n; 655 sal_Int32 nType = 0; 656 657 switch( nSlot ) 658 { 659 case SID_TRANSLITERATE_SENTENCE_CASE: 660 nType = TransliterationModulesExtra::SENTENCE_CASE; 661 break; 662 case SID_TRANSLITERATE_TITLE_CASE: 663 nType = TransliterationModulesExtra::TITLE_CASE; 664 break; 665 case SID_TRANSLITERATE_TOGGLE_CASE: 666 nType = TransliterationModulesExtra::TOGGLE_CASE; 667 break; 668 case SID_TRANSLITERATE_UPPER: 669 nType = TransliterationModules_LOWERCASE_UPPERCASE; 670 break; 671 case SID_TRANSLITERATE_LOWER: 672 nType = TransliterationModules_UPPERCASE_LOWERCASE; 673 break; 674 case SID_TRANSLITERATE_HALFWIDTH: 675 nType = TransliterationModules_FULLWIDTH_HALFWIDTH; 676 break; 677 case SID_TRANSLITERATE_FULLWIDTH: 678 nType = TransliterationModules_HALFWIDTH_FULLWIDTH; 679 break; 680 case SID_TRANSLITERATE_HIRAGANA: 681 nType = TransliterationModules_KATAKANA_HIRAGANA; 682 break; 683 case SID_TRANSLITERATE_KATAGANA: 684 nType = TransliterationModules_HIRAGANA_KATAKANA; 685 break; 686 } 687 688 pOLV->TransliterateText( nType ); 689 } 690 691 rReq.Done(); 692 bPreviewState = sal_True; 693 } 694 break; 695 696 // #96090# added Undo/Redo handling 697 case SID_UNDO : 698 { 699 OutlineViewPageChangesGuard aGuard2(pOlView); 700 ImpSidUndo(sal_False, rReq); 701 } 702 break; 703 case SID_REDO : 704 { 705 OutlineViewPageChangesGuard aGuard2(pOlView); 706 ImpSidRedo(sal_False, rReq); 707 } 708 break; 709 710 default: 711 break; 712 } 713 714 if( bPreviewState ) 715 Invalidate( SID_PREVIEW_STATE ); 716 717 Invalidate(SID_CUT); 718 Invalidate(SID_COPY); 719 Invalidate(SID_PASTE); 720 } 721 722 /************************************************************************* 723 |* 724 |* SfxRequests fuer permanente Funktionen 725 |* 726 \************************************************************************/ 727 728 void OutlineViewShell::FuPermanent(SfxRequest &rReq) 729 { 730 if(HasCurrentFunction()) 731 { 732 DeactivateCurrentFunction(true); 733 } 734 735 switch ( rReq.GetSlot() ) 736 { 737 case SID_EDIT_OUTLINER: 738 { 739 ::Outliner* pOutl = pOlView->GetOutliner(); 740 if( pOutl ) 741 { 742 pOutl->GetUndoManager().Clear(); 743 pOutl->UpdateFields(); 744 } 745 746 SetCurrentFunction( FuOutlineText::Create(this,GetActiveWindow(),pOlView,GetDoc(),rReq) ); 747 748 rReq.Done(); 749 } 750 break; 751 752 default: 753 break; 754 } 755 756 if(HasOldFunction()) 757 { 758 GetOldFunction()->Deactivate(); 759 SetOldFunction(0); 760 } 761 762 if(HasCurrentFunction()) 763 { 764 GetCurrentFunction()->Activate(); 765 SetOldFunction(GetCurrentFunction()); 766 } 767 } 768 769 770 IMPL_LINK( OutlineViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper ) 771 { 772 if ( pDataHelper ) 773 { 774 bPastePossible = ( pDataHelper->GetFormatCount() != 0 && 775 ( pDataHelper->HasFormat( FORMAT_STRING ) || 776 pDataHelper->HasFormat( FORMAT_RTF ) || 777 pDataHelper->HasFormat( SOT_FORMATSTR_ID_HTML ) ) ); 778 779 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 780 rBindings.Invalidate( SID_PASTE ); 781 rBindings.Invalidate( SID_PASTE_SPECIAL ); 782 rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); 783 } 784 return 0; 785 } 786 787 /************************************************************************* 788 |* 789 |* Status (Enabled/Disabled) von Menue-SfxSlots setzen 790 |* 791 \************************************************************************/ 792 793 void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) 794 { 795 ViewShell::GetMenuState(rSet); 796 797 // Vorlagenkatalog darf nicht aufgerufen werden 798 rSet.DisableItem( SID_STYLE_CATALOG ); 799 800 rSet.Put(SfxBoolItem(SID_DIAMODE, sal_False)); 801 rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_False)); 802 rSet.Put(SfxBoolItem(SID_OUTLINEMODE, sal_True)); 803 rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_False)); 804 rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_False)); 805 806 if (!mpZoomList->IsNextPossible()) 807 { 808 rSet.DisableItem(SID_ZOOM_NEXT); 809 } 810 if (!mpZoomList->IsPreviousPossible()) 811 { 812 rSet.DisableItem(SID_ZOOM_PREV); 813 } 814 815 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_IN ) || 816 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_OUT ) ) 817 { 818 if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() ) 819 rSet.DisableItem( SID_ZOOM_IN ); 820 if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() ) 821 rSet.DisableItem( SID_ZOOM_OUT ); 822 } 823 824 ::Outliner* pOutl = pOlView->GetOutliner(); 825 DBG_ASSERT(pOutl, "OutlineViewShell::GetMenuState(), no outliner? Fatality!"); 826 if( !pOutl ) 827 return; 828 829 // 'Alles auswaehlen' zulassen? 830 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) ) 831 { 832 sal_uLong nParaCount = pOutl->GetParagraphCount(); 833 sal_Bool bDisable = nParaCount == 0; 834 if (!bDisable && nParaCount == 1) 835 { 836 String aTest( pOutl->GetText( pOutl->GetParagraph( 0 ) ) ); 837 if (aTest.Len() == 0) 838 { 839 bDisable = sal_True; 840 } 841 } 842 if (bDisable) 843 rSet.DisableItem(SID_SELECTALL); 844 } 845 846 // Status des Lineals setzen 847 rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) ); 848 849 // Formatierung ein oder aus? 850 rSet.Put( SfxBoolItem( SID_OUTLINE_FORMAT, !pOutl->IsFlatMode() ) ); 851 852 if( pOutl->IsFlatMode() ) 853 rSet.DisableItem( SID_COLORVIEW ); 854 else 855 { 856 // Farbansicht ein/aus 857 sal_uLong nCntrl = pOutl->GetControlWord(); 858 sal_Bool bNoColor = sal_False; 859 if (nCntrl & EE_CNTRL_NOCOLORS) 860 bNoColor = sal_True; 861 862 rSet.Put( SfxBoolItem( SID_COLORVIEW, bNoColor ) ); 863 } 864 865 // Buttons der Werkzeugleiste 866 // zunaechst selektionsabhaengige: COLLAPSE, EXPAND 867 sal_Bool bDisableCollapse = sal_True; 868 sal_Bool bDisableExpand = sal_True; 869 sal_Bool bUnique = sal_True; 870 OutlinerView* pOutlinerView = pOlView->GetViewByWindow(GetActiveWindow()); 871 List* pList = pOutlinerView->CreateSelectionList(); 872 Paragraph* pPara = (Paragraph*)pList->First(); 873 874 sal_Int16 nDepth; 875 sal_Int16 nTmpDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) ); 876 bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ); 877 while (pPara) 878 { 879 nDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) ); 880 881 if( nDepth != nTmpDepth ) 882 bUnique = sal_False; 883 if( bPage != pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) 884 bUnique = sal_False; 885 if (!pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara)) 886 bDisableExpand = sal_False; 887 if (pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara)) 888 bDisableCollapse = sal_False; 889 890 pPara = (Paragraph*)pList->Next(); 891 } 892 893 delete pList; 894 895 if (bDisableExpand) 896 rSet.DisableItem(SID_OUTLINE_EXPAND); 897 if (bDisableCollapse) 898 rSet.DisableItem(SID_OUTLINE_COLLAPSE); 899 900 // ergibt die Selektion ein eindeutiges Praesentationslayout? 901 // wenn nicht, duerfen die Vorlagen nicht bearbeitet werden 902 SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT); 903 GetStatusBarState(aSet); 904 String aTest(((SfxStringItem&)aSet.Get(SID_STATUS_LAYOUT)).GetValue()); 905 if (aTest.Len() == 0) 906 { 907 bUnique = sal_False; 908 rSet.DisableItem(SID_PRESENTATION_TEMPLATES); 909 } 910 911 if (!bUnique) 912 rSet.DisableItem( SID_PRESENTATIONOBJECT ); 913 914 // jetzt die selektionsunabhaengigen: COLLAPSE_ALL, EXPAND_ALL 915 sal_Bool bDisableCollapseAll = sal_True; 916 sal_Bool bDisableExpandAll = sal_True; 917 918 // wenn schon die Selektion etwas kollabierbares/expandierbares enthaelt 919 if (!bDisableCollapse) 920 bDisableCollapseAll = sal_False; 921 if (!bDisableExpand) 922 bDisableExpandAll = sal_False; 923 924 // schade, so billig kommen wir nicht davon; alle Absaetze durchsuchen 925 if (bDisableCollapseAll || bDisableExpandAll) 926 { 927 sal_uLong nParaPos = 0; 928 pPara = pOutl->GetParagraph( nParaPos ); 929 while (pPara && (bDisableCollapseAll || bDisableExpandAll)) 930 { 931 if (!pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara)) 932 bDisableExpandAll = sal_False; 933 934 if (pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara)) 935 bDisableCollapseAll = sal_False; 936 937 pPara = pOutl->GetParagraph( ++nParaPos ); 938 } 939 } 940 941 if (bDisableExpandAll) 942 rSet.DisableItem(SID_OUTLINE_EXPAND_ALL); 943 if (bDisableCollapseAll) 944 rSet.DisableItem(SID_OUTLINE_COLLAPSE_ALL); 945 946 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) ) 947 { 948 if ( !pClipEvtLstnr ) 949 { 950 // create listener 951 pClipEvtLstnr = new TransferableClipboardListener( LINK( this, OutlineViewShell, ClipboardChanged ) ); 952 pClipEvtLstnr->acquire(); 953 pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_True ); 954 955 // get initial state 956 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) ); 957 bPastePossible = ( aDataHelper.GetFormatCount() != 0 && 958 ( aDataHelper.HasFormat( FORMAT_STRING ) || 959 aDataHelper.HasFormat( FORMAT_RTF ) || 960 aDataHelper.HasFormat( SOT_FORMATSTR_ID_HTML ) ) ); 961 } 962 963 if( !bPastePossible ) 964 { 965 rSet.DisableItem( SID_PASTE ); 966 } 967 } 968 969 if (!pOlView->GetViewByWindow(GetActiveWindow())->HasSelection()) 970 { 971 rSet.DisableItem(SID_CUT); 972 rSet.DisableItem(SID_COPY); 973 } 974 975 if (pOlView->GetOutliner()->IsModified()) 976 { 977 GetDoc()->SetChanged(sal_True); 978 } 979 980 // Da �berladen, muss hier der Status gesetzt werden 981 if( !GetDocSh()->IsModified() ) 982 { 983 rSet.DisableItem( SID_SAVEDOC ); 984 } 985 986 if ( GetDocSh()->IsReadOnly() ) 987 { 988 rSet.DisableItem( SID_AUTOSPELL_CHECK ); 989 } 990 else 991 { 992 if (GetDoc()->GetOnlineSpell()) 993 { 994 rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_True)); 995 } 996 else 997 { 998 rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_False)); 999 } 1000 } 1001 1002 // Feldbefehle 1003 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MODIFY_FIELD ) ) 1004 { 1005 const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection(); 1006 1007 if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) || 1008 pFldItem->GetField()->ISA( SvxAuthorField ) || 1009 pFldItem->GetField()->ISA( SvxExtFileField ) || 1010 pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) ) 1011 { 1012 rSet.DisableItem( SID_MODIFY_FIELD ); 1013 } 1014 } 1015 1016 if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE)) 1017 { 1018 sal_Bool bDisable = sal_True; 1019 sal_uInt16 i = 0; 1020 sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD); 1021 pOlView->SetSelectedPages(); 1022 1023 while (i < nCount && bDisable) 1024 { 1025 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD); 1026 1027 if (pPage->IsSelected()) 1028 { 1029 SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE); 1030 1031 if (pObj!=NULL ) 1032 { 1033 if( !pObj->IsEmptyPresObj() ) 1034 { 1035 bDisable = false; 1036 } 1037 else 1038 { 1039 // check if the object is in edit, than its temporarely not empty 1040 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); 1041 if( pTextObj ) 1042 { 1043 OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject(); 1044 if( pParaObj ) 1045 { 1046 delete pParaObj; 1047 bDisable = false; 1048 } 1049 } 1050 } 1051 } 1052 } 1053 1054 i++; 1055 } 1056 1057 if (bDisable) 1058 { 1059 rSet.DisableItem(SID_EXPAND_PAGE); 1060 } 1061 } 1062 1063 if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE)) 1064 { 1065 sal_Bool bDisable = sal_True; 1066 sal_uInt16 i = 0; 1067 sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD); 1068 pOlView->SetSelectedPages(); 1069 1070 while (i < nCount && bDisable) 1071 { 1072 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD); 1073 1074 if (pPage->IsSelected()) 1075 { 1076 SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE); 1077 1078 if (pObj && !pObj->IsEmptyPresObj()) 1079 { 1080 bDisable = sal_False; 1081 } 1082 } 1083 1084 i++; 1085 } 1086 1087 if (bDisable) 1088 { 1089 rSet.DisableItem(SID_SUMMARY_PAGE); 1090 } 1091 } 1092 1093 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_THESAURUS ) ) 1094 { 1095 if ( !pOlView->IsTextEdit() ) 1096 { 1097 rSet.DisableItem( SID_THESAURUS ); 1098 } 1099 else 1100 { 1101 LanguageType eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ); 1102 Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() ); 1103 Locale aLocale; 1104 1105 SvxLanguageToLocale( aLocale, eLang ); 1106 1107 if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale)) 1108 rSet.DisableItem( SID_THESAURUS ); 1109 } 1110 } 1111 1112 // Starten der Praesentation moeglich? 1113 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) ) 1114 { 1115 sal_Bool bDisable = sal_True; 1116 sal_uInt16 nCount = GetDoc()->GetSdPageCount( PK_STANDARD ); 1117 1118 for( sal_uInt16 i = 0; i < nCount && bDisable; i++ ) 1119 { 1120 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD); 1121 1122 if( !pPage->IsExcluded() ) 1123 bDisable = sal_False; 1124 } 1125 if( bDisable || GetDocSh()->IsPreview()) 1126 { 1127 rSet.DisableItem( SID_PRESENTATION ); 1128 } 1129 } 1130 1131 FuBullet::GetSlotState( rSet, this, GetViewFrame() ); 1132 1133 //rSet.DisableItem( SID_PRINTDOC ); 1134 //rSet.DisableItem( SID_PRINTDOCDIRECT ); 1135 //rSet.DisableItem( SID_SETUPPRINTER ); 1136 } 1137 1138 /************************************************************************* 1139 |* 1140 |* wird gerufen, wenn ScrollBar benutzt wird 1141 |* 1142 \************************************************************************/ 1143 1144 long OutlineViewShell::VirtHScrollHdl(ScrollBar* pHScroll) 1145 { 1146 long nThumb = pHScroll->GetThumbPos(); 1147 long nRange = pHScroll->GetRange().Len(); 1148 double fX = (double) nThumb / nRange; 1149 1150 Window* pWin = mpContentWindow.get(); 1151 OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin); 1152 long nViewWidth = pWin->PixelToLogic( 1153 pWin->GetSizePixel()).Width(); 1154 long nTextWidth = pOlView->GetPaperWidth(); 1155 nViewWidth = Max(nViewWidth, nTextWidth); 1156 long nCurrentPos = pOutlinerView->GetVisArea().Left(); 1157 long nTargetPos = (long)(fX * nViewWidth); 1158 long nDelta = nTargetPos - nCurrentPos; 1159 1160 pOutlinerView->HideCursor(); 1161 pOutlinerView->Scroll(-nDelta, 0); 1162 pOutlinerView->ShowCursor(sal_False); 1163 1164 pOlView->InvalidateSlideNumberArea(); 1165 return 0; 1166 } 1167 1168 /************************************************************************* 1169 |* 1170 |* wird gerufen, wenn ScrollBar benutzt wird 1171 |* 1172 \************************************************************************/ 1173 1174 long OutlineViewShell::VirtVScrollHdl(ScrollBar* pVScroll) 1175 { 1176 long nThumb = pVScroll->GetThumbPos(); 1177 long nRange = pVScroll->GetRange().Len(); 1178 double fY = (double) nThumb / nRange; 1179 1180 Window* pWin = mpContentWindow.get(); 1181 OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin); 1182 long nViewHeight = pWin->PixelToLogic( 1183 pWin->GetSizePixel()).Height(); 1184 long nTextHeight = pOlView->GetOutliner()->GetTextHeight(); 1185 nViewHeight += nTextHeight; 1186 long nCurrentPos = pOutlinerView->GetVisArea().Top(); 1187 long nTargetPos = (long)(fY * nViewHeight); 1188 long nDelta = nTargetPos - nCurrentPos; 1189 1190 pOutlinerView->HideCursor(); 1191 pOutlinerView->Scroll(0, -nDelta); 1192 pOutlinerView->ShowCursor(sal_False); 1193 1194 pOlView->InvalidateSlideNumberArea(); 1195 1196 return 0; 1197 } 1198 1199 /************************************************************************* 1200 |* 1201 |* PrepareClose, wird gerufen, wenn die Shell zestoert werden soll, 1202 |* leitet den Aufruf an die View weiter 1203 |* 1204 \************************************************************************/ 1205 1206 sal_uInt16 OutlineViewShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ) 1207 { 1208 if( ViewShell::PrepareClose(bUI, bForBrowsing) != sal_True ) 1209 return sal_False; 1210 1211 return pOlView == NULL || pOlView->PrepareClose(bUI); 1212 } 1213 1214 1215 /************************************************************************* 1216 |* 1217 |* Zoomen mit Zoomfaktor, OutlinerView informieren 1218 |* 1219 \************************************************************************/ 1220 1221 void OutlineViewShell::SetZoom(long nZoom) 1222 { 1223 ViewShell::SetZoom(nZoom); 1224 1225 ::sd::Window* pWindow = mpContentWindow.get(); 1226 if (pWindow) 1227 { 1228 // OutputArea der OutlinerView aendern 1229 OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow); 1230 Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel()); 1231 aWin = pWindow->PixelToLogic(aWin); 1232 pOutlinerView->SetOutputArea(aWin); 1233 } 1234 1235 // #106268# 1236 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM ); 1237 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); 1238 } 1239 1240 /************************************************************************* 1241 |* 1242 |* Zoomen mit Zoomrechteck, OutlinerView informieren 1243 |* 1244 \************************************************************************/ 1245 1246 void OutlineViewShell::SetZoomRect(const Rectangle& rZoomRect) 1247 { 1248 ViewShell::SetZoomRect(rZoomRect); 1249 1250 ::sd::Window* pWindow = mpContentWindow.get(); 1251 if (pWindow) 1252 { 1253 // OutputArea der OutlinerView aendern 1254 OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow); 1255 Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel()); 1256 aWin = pWindow->PixelToLogic(aWin); 1257 pOutlinerView->SetOutputArea(aWin); 1258 } 1259 1260 // #106268# 1261 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM ); 1262 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); 1263 } 1264 1265 /************************************************************************* 1266 |* 1267 |* Vorm Speichern das Model der Drawing Engine aktualisieren, dann den 1268 |* Call weiterleiten an die ObjectShell. 1269 |* 1270 \************************************************************************/ 1271 1272 void OutlineViewShell::Execute(SfxRequest& rReq) 1273 { 1274 bool bForwardCall = true; 1275 1276 switch(rReq.GetSlot()) 1277 { 1278 case SID_SAVEDOC: 1279 case SID_SAVEASDOC: 1280 PrepareClose(); 1281 break; 1282 1283 case SID_SEARCH_ITEM: 1284 // Forward this request to the the common (old) code of the 1285 // document shell. 1286 GetDocSh()->Execute (rReq); 1287 bForwardCall = false; 1288 break; 1289 1290 case SID_SPELL_DIALOG: 1291 { 1292 SfxViewFrame* pViewFrame = GetViewFrame(); 1293 if (rReq.GetArgs() != NULL) 1294 pViewFrame->SetChildWindow (SID_SPELL_DIALOG, 1295 ((const SfxBoolItem&) (rReq.GetArgs()-> 1296 Get(SID_SPELL_DIALOG))).GetValue()); 1297 else 1298 pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG); 1299 1300 pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG); 1301 rReq.Done (); 1302 1303 bForwardCall = false; 1304 } 1305 break; 1306 1307 default: 1308 OSL_TRACE ("OutlineViewShell::Execute(): can not handle slot %d", rReq.GetSlot()); 1309 break; 1310 1311 } 1312 1313 if (bForwardCall) 1314 ((DrawDocShell*)GetViewFrame()->GetObjectShell())->ExecuteSlot( rReq ); 1315 } 1316 1317 /************************************************************************* 1318 |* 1319 |* Read FrameViews data and set actual views data 1320 |* 1321 \************************************************************************/ 1322 1323 void OutlineViewShell::ReadFrameViewData(FrameView* pView) 1324 { 1325 ::Outliner* pOutl = pOlView->GetOutliner(); 1326 1327 if ( pView->IsNoAttribs() ) 1328 pOutl->SetFlatMode( sal_True ); // Attribut-Darstellung ausschalten 1329 else 1330 pOutl->SetFlatMode( sal_False ); // Attribut-Darstellung einschalten 1331 1332 sal_uLong nCntrl = pOutl->GetControlWord(); 1333 1334 if ( pView->IsNoColors() ) 1335 pOutl->SetControlWord(nCntrl | EE_CNTRL_NOCOLORS); // Farbansicht ausschalten 1336 else 1337 pOutl->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS); // Farbansicht einschalten 1338 1339 sal_uInt16 nPage = mpFrameView->GetSelectedPage(); 1340 pLastPage = GetDoc()->GetSdPage( nPage, PK_STANDARD ); 1341 pOlView->SetActualPage(pLastPage); 1342 } 1343 1344 1345 1346 /************************************************************************* 1347 |* 1348 |* Write actual views data to FrameView 1349 |* 1350 \************************************************************************/ 1351 1352 void OutlineViewShell::WriteFrameViewData() 1353 { 1354 ::Outliner* pOutl = pOlView->GetOutliner(); 1355 1356 sal_uLong nCntrl = pOutl->GetControlWord(); 1357 sal_Bool bNoColor = sal_False; 1358 if (nCntrl & EE_CNTRL_NOCOLORS) 1359 bNoColor = sal_True; 1360 mpFrameView->SetNoColors(bNoColor); 1361 mpFrameView->SetNoAttribs( pOutl->IsFlatMode() ); 1362 SdPage* pActualPage = pOlView->GetActualPage(); 1363 DBG_ASSERT(pActualPage, "No current page"); 1364 if( pActualPage ) 1365 mpFrameView->SetSelectedPage((pActualPage->GetPageNum() - 1) / 2); 1366 } 1367 1368 1369 /************************************************************************* 1370 |* 1371 |* SfxRequests fuer StatusBar bearbeiten 1372 |* 1373 \************************************************************************/ 1374 1375 void OutlineViewShell::ExecStatusBar(SfxRequest&) 1376 { 1377 } 1378 1379 /************************************************************************* 1380 |* 1381 |* Statuswerte der Statusbar zurueckgeben 1382 |* 1383 \************************************************************************/ 1384 1385 void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) 1386 { 1387 // Zoom-Item 1388 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOM ) ) 1389 { 1390 SvxZoomItem* pZoomItem; 1391 sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom(); 1392 1393 pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nZoom ); 1394 1395 // Bereich einschraenken 1396 sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL; 1397 nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL; 1398 nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE; 1399 nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH; 1400 1401 pZoomItem->SetValueSet( nZoomValues ); 1402 rSet.Put( *pZoomItem ); 1403 delete pZoomItem; 1404 } 1405 1406 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) ) 1407 { 1408 if (GetDocSh()->IsUIActive() || !GetActiveWindow() ) 1409 { 1410 rSet.DisableItem( SID_ATTR_ZOOMSLIDER ); 1411 } 1412 else 1413 { 1414 sd::Window * pActiveWindow = GetActiveWindow(); 1415 SvxZoomSliderItem aZoomItem( (sal_uInt16) pActiveWindow->GetZoom(), (sal_uInt16)pActiveWindow->GetMinZoom(), (sal_uInt16)pActiveWindow->GetMaxZoom() ) ; 1416 aZoomItem.AddSnappingPoint(100); 1417 rSet.Put( aZoomItem ); 1418 } 1419 } 1420 1421 1422 // Seitenanzeige und Layout 1423 /* 1424 if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_PAGE ) || 1425 SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_LAYOUT ) ) 1426 */ 1427 sal_uInt16 nPageCount = GetDoc()->GetSdPageCount( PK_STANDARD ); 1428 String aPageStr, aLayoutStr; 1429 1430 ::sd::Window* pWin = GetActiveWindow(); 1431 OutlinerView* pActiveView = pOlView->GetViewByWindow( pWin ); 1432 ::Outliner* pOutliner = pOlView->GetOutliner(); 1433 List* pSelList = (List*)pActiveView->CreateSelectionList(); 1434 Paragraph* pFirstPara = (Paragraph*)pSelList->First(); 1435 Paragraph* pLastPara = (Paragraph*)pSelList->Last(); 1436 1437 if( !pOutliner->HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) ) 1438 pFirstPara = pOlView->GetPrevTitle( pFirstPara ); 1439 1440 if( !pOutliner->HasParaFlag(pLastPara, PARAFLAG_ISPAGE) ) 1441 pLastPara = pOlView->GetPrevTitle( pLastPara ); 1442 1443 delete pSelList; // die wurde extra fuer uns erzeugt 1444 1445 // nur eine Seite selektiert? 1446 if( pFirstPara == pLastPara ) 1447 { 1448 // wieviele Seiten sind vor der selektierten Seite? 1449 sal_uLong nPos = 0L; 1450 while( pFirstPara ) 1451 { 1452 pFirstPara = pOlView->GetPrevTitle( pFirstPara ); 1453 if( pFirstPara ) 1454 nPos++; 1455 } 1456 1457 if( nPos >= GetDoc()->GetSdPageCount( PK_STANDARD ) ) 1458 nPos = 0; 1459 1460 SdrPage* pPage = GetDoc()->GetSdPage( (sal_uInt16) nPos, PK_STANDARD ); 1461 1462 aPageStr = String(SdResId( STR_SD_PAGE )); 1463 aPageStr += sal_Unicode(' '); 1464 aPageStr += String::CreateFromInt32( (sal_Int32)(nPos + 1) ); // sal_uLong -> sal_Int32 1465 aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " )); 1466 aPageStr += String::CreateFromInt32( nPageCount ); 1467 1468 aLayoutStr = pPage->GetLayoutName(); 1469 aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) ); 1470 } 1471 rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) ); 1472 rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) ); 1473 } 1474 1475 /************************************************************************* 1476 |* 1477 |* Command event 1478 |* 1479 \************************************************************************/ 1480 1481 void OutlineViewShell::Command( const CommandEvent& rCEvt, ::sd::Window* pWin ) 1482 { 1483 if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) 1484 { 1485 GetActiveWindow()->ReleaseMouse(); 1486 1487 OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow()); 1488 Point aPos(rCEvt.GetMousePosPixel()); 1489 1490 if (pOLV && pOLV->IsWrongSpelledWordAtPos(aPos)) 1491 { 1492 // #91457# Popup for Online-Spelling now handled by DrawDocShell 1493 // Link aLink = LINK(GetDoc(), SdDrawDocument, OnlineSpellCallback); 1494 Link aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback); 1495 1496 pOLV->ExecuteSpellPopup(aPos, &aLink); 1497 } 1498 else 1499 { 1500 GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(RID_OUTLINE_POPUP)); 1501 } 1502 } 1503 else 1504 { 1505 ViewShell::Command( rCEvt, pWin ); 1506 1507 // ggfs. Preview den neuen Kontext mitteilen 1508 Invalidate( SID_PREVIEW_STATE ); 1509 1510 } 1511 } 1512 1513 1514 /************************************************************************* 1515 |* 1516 |* Keyboard event 1517 |* 1518 \************************************************************************/ 1519 1520 sal_Bool OutlineViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) 1521 { 1522 sal_Bool bReturn = sal_False; 1523 OutlineViewPageChangesGuard aGuard(pOlView); 1524 1525 if (pWin == NULL && HasCurrentFunction()) 1526 { 1527 bReturn = GetCurrentFunction()->KeyInput(rKEvt); 1528 } 1529 1530 // nein, weiterleiten an Basisklasse 1531 else 1532 { 1533 bReturn = ViewShell::KeyInput(rKEvt, pWin); 1534 } 1535 1536 Invalidate(SID_STYLE_EDIT); 1537 Invalidate(SID_STYLE_NEW); 1538 Invalidate(SID_STYLE_DELETE); 1539 Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE); 1540 Invalidate(SID_STYLE_NEW_BY_EXAMPLE); 1541 Invalidate(SID_STYLE_WATERCAN); 1542 Invalidate(SID_STYLE_FAMILY5); 1543 1544 // Pruefen und Unterscheiden von CursorBewegungs- oder Eingabe-Keys 1545 KeyCode aKeyGroup( rKEvt.GetKeyCode().GetGroup() ); 1546 if( (aKeyGroup != KEYGROUP_CURSOR && aKeyGroup != KEYGROUP_FKEYS) || 1547 (GetActualPage() != pLastPage) ) 1548 { 1549 Invalidate( SID_PREVIEW_STATE ); 1550 } 1551 1552 return(bReturn); 1553 } 1554 1555 1556 /************************************************************************* 1557 |* 1558 |* Optimale Groesse zurueckgeben 1559 |* 1560 \************************************************************************/ 1561 1562 Size OutlineViewShell::GetOptimalSizePixel() const 1563 { 1564 Size aResult(200, 200); 1565 if (pOlView) 1566 { 1567 ::Outliner* pOutliner = pOlView->GetOutliner(); 1568 if (pOutliner) 1569 { 1570 Size aTemp = pOutliner->CalcTextSize(); 1571 aTemp = GetActiveWindow()->LogicToPixel(aTemp); 1572 aResult.Width() = Max(aResult.Width(), aTemp.Width()); 1573 aResult.Height() = Max(aResult.Height(), aTemp.Height()); 1574 if (4 * aResult.Height() > 3 * aResult.Width()) 1575 { 1576 aResult.Height() = 3 * aResult.Width() / 4; 1577 } 1578 } 1579 } 1580 1581 // und jetzt jetzt das Standardgelumpe draufaddieren 1582 aResult.Width() += mpVerticalScrollBar->GetSizePixel().Width(); 1583 aResult.Height() += mpHorizontalScrollBar->GetSizePixel().Height(); 1584 //!!! + System::GetMenuBarHeightPixel(); // statt Titlebar 1585 return aResult; 1586 } 1587 1588 1589 /************************************************************************* 1590 |* 1591 |* Text der Selektion zurueckgeben 1592 |* 1593 \************************************************************************/ 1594 1595 String OutlineViewShell::GetSelectionText(sal_Bool bCompleteWords) 1596 { 1597 String aStrSelection; 1598 ::Outliner* pOl = pOlView->GetOutliner(); 1599 OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() ); 1600 1601 if (pOl && pOlView) 1602 { 1603 if (bCompleteWords) 1604 { 1605 ESelection aSel = pOutlinerView->GetSelection(); 1606 String aStrCurrentDelimiters = pOl->GetWordDelimiters(); 1607 1608 pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" ))); 1609 aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos ); 1610 pOl->SetWordDelimiters( aStrCurrentDelimiters ); 1611 } 1612 else 1613 { 1614 aStrSelection = pOutlinerView->GetSelected(); 1615 } 1616 } 1617 1618 return (aStrSelection); 1619 } 1620 1621 1622 /************************************************************************* 1623 |* 1624 |* Ist etwas selektiert? 1625 |* 1626 \************************************************************************/ 1627 1628 sal_Bool OutlineViewShell::HasSelection(sal_Bool bText) const 1629 { 1630 sal_Bool bReturn = sal_False; 1631 1632 if (bText) 1633 { 1634 OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() ); 1635 1636 if (pOutlinerView && pOutlinerView->GetSelected().Len() != 0) 1637 { 1638 bReturn = sal_True; 1639 } 1640 } 1641 1642 return bReturn; 1643 } 1644 1645 1646 /************************************************************************* 1647 |* 1648 |* Status der Attribut-Items 1649 |* 1650 \************************************************************************/ 1651 1652 void OutlineViewShell::GetAttrState( SfxItemSet& rSet ) 1653 { 1654 SfxWhichIter aIter( rSet ); 1655 sal_uInt16 nWhich = aIter.FirstWhich(); 1656 SfxAllItemSet aAllSet( *rSet.GetPool() ); 1657 1658 while ( nWhich ) 1659 { 1660 sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) 1661 ? GetPool().GetSlotId(nWhich) 1662 : nWhich; 1663 1664 switch ( nSlotId ) 1665 { 1666 case SID_STYLE_FAMILY2: 1667 case SID_STYLE_FAMILY3: 1668 { 1669 rSet.DisableItem( nWhich ); 1670 } 1671 break; 1672 1673 case SID_STYLE_FAMILY5: 1674 { 1675 SfxStyleSheet* pStyleSheet = pOlView->GetViewByWindow(GetActiveWindow())->GetStyleSheet(); 1676 1677 if( pStyleSheet ) 1678 { 1679 pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet(); 1680 1681 if (pStyleSheet) 1682 { 1683 SfxTemplateItem aItem( nWhich, pStyleSheet->GetName() ); 1684 aAllSet.Put( aItem, aItem.Which() ); 1685 } 1686 } 1687 1688 if( !pStyleSheet ) 1689 { 1690 SfxTemplateItem aItem( nWhich, String() ); 1691 aAllSet.Put( aItem, aItem.Which() ); 1692 // rSet.DisableItem( nWhich ); 1693 } 1694 } 1695 break; 1696 1697 case SID_STYLE_EDIT: 1698 { 1699 ISfxTemplateCommon* pTmplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 1700 1701 if (pTmplCommon && pTmplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 1702 { 1703 SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT); 1704 GetStatusBarState(aSet); 1705 String aRealStyle(((SfxStringItem&) aSet.Get(SID_STATUS_LAYOUT)).GetValue()); 1706 1707 if (!aRealStyle.Len()) 1708 { 1709 // Kein eindeutiger Layoutname gefunden 1710 rSet.DisableItem(nWhich); 1711 } 1712 } 1713 } 1714 break; 1715 1716 case SID_STYLE_UPDATE_BY_EXAMPLE: 1717 { 1718 ::sd::Window* pActWin = GetActiveWindow(); 1719 OutlinerView* pOV = pOlView->GetViewByWindow(pActWin); 1720 ESelection aESel(pOV->GetSelection()); 1721 1722 if (aESel.nStartPara != aESel.nEndPara || 1723 aESel.nStartPos != aESel.nEndPos) 1724 // aufgespannte Selektion, also StyleSheet und/oder 1725 // Attributierung nicht zwingend eindeutig 1726 rSet.DisableItem(nWhich); 1727 } 1728 break; 1729 1730 case SID_STYLE_NEW: 1731 case SID_STYLE_DELETE: 1732 case SID_STYLE_NEW_BY_EXAMPLE: 1733 case SID_STYLE_WATERCAN: 1734 { 1735 rSet.DisableItem(nWhich); 1736 } 1737 break; 1738 } 1739 1740 nWhich = aIter.NextWhich(); 1741 } 1742 1743 rSet.Put( aAllSet, sal_False ); 1744 } 1745 1746 1747 1748 /************************************************************************* 1749 |* 1750 |* MouseButtonUp event 1751 |* 1752 \************************************************************************/ 1753 1754 void OutlineViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) 1755 { 1756 // Zuerst die Basisklasse 1757 ViewShell::MouseButtonUp(rMEvt, pWin); 1758 1759 Invalidate(SID_STYLE_EDIT); 1760 Invalidate(SID_STYLE_NEW); 1761 Invalidate(SID_STYLE_DELETE); 1762 Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE); 1763 Invalidate(SID_STYLE_NEW_BY_EXAMPLE); 1764 Invalidate(SID_STYLE_WATERCAN); 1765 Invalidate(SID_STYLE_FAMILY5); 1766 1767 // ggfs. Preview den neuen Kontext mitteilen 1768 if( GetActualPage() != pLastPage ) 1769 Invalidate( SID_PREVIEW_STATE ); 1770 } 1771 1772 1773 1774 SdPage* OutlineViewShell::getCurrentPage() const 1775 { 1776 // since there are no master pages in outline view, we can 1777 // for now use the GetActualPage method 1778 return const_cast<OutlineViewShell*>(this)->GetActualPage(); 1779 } 1780 1781 /************************************************************************* 1782 |* 1783 |* Liefert die erste selektierte Seite zurueck. 1784 |* Wenn nichts selektiert ist, wird die erste Seite zurueckgeliefert. 1785 |* 1786 \************************************************************************/ 1787 SdPage* OutlineViewShell::GetActualPage() 1788 { 1789 return pOlView->GetActualPage(); 1790 } 1791 1792 1793 void OutlineViewShell::UpdatePreview( SdPage* pPage, sal_Bool ) 1794 { 1795 const bool bNewPage = pPage != pLastPage; 1796 pLastPage = pPage; 1797 if (bNewPage) 1798 { 1799 OutlineViewPageChangesGuard aGuard(pOlView); 1800 SetCurrentPage(pPage); 1801 } 1802 } 1803 1804 /************************************************************************* 1805 |* 1806 |* Update Title 1807 |* 1808 \************************************************************************/ 1809 1810 bool OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph* pPara ) 1811 { 1812 DBG_ASSERT( pPage, "sd::OutlineViewShell::UpdateTitleObject(), pPage == 0?" ); 1813 DBG_ASSERT( pPara, "sd::OutlineViewShell::UpdateTitleObject(), pPara == 0?" ); 1814 1815 if( !pPage || !pPara ) 1816 return false; 1817 1818 ::Outliner* pOutliner = pOlView->GetOutliner(); 1819 SdrTextObj* pTO = pOlView->GetTitleTextObject( pPage ); 1820 OutlinerParaObject* pOPO = NULL; 1821 1822 String aTest( pOutliner->GetText( pPara ) ); 1823 bool bText = aTest.Len() > 0; 1824 bool bNewObject = false; 1825 1826 if( bText ) 1827 { 1828 // create a title object if we don't have one but have text 1829 if( !pTO ) 1830 { 1831 DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" ); 1832 pTO = pOlView->CreateTitleTextObject(pPage); 1833 bNewObject = sal_True; 1834 } 1835 1836 // if we have a title object and a text, set the text 1837 if( pTO ) 1838 { 1839 pOPO = pOutliner->CreateParaObject( (sal_uInt16) pOutliner->GetAbsPos( pPara ), 1 ); 1840 pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT ); 1841 pOPO->SetVertical( pTO->IsVerticalWriting() ); 1842 if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) ) 1843 { 1844 // do nothing, same text already set 1845 delete pOPO; 1846 } 1847 else 1848 { 1849 DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" ); 1850 if( !bNewObject && pOlView->isRecordingUndo() ) 1851 pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0)); 1852 1853 pTO->SetOutlinerParaObject( pOPO ); 1854 pTO->SetEmptyPresObj( sal_False ); 1855 pTO->ActionChanged(); 1856 } 1857 } 1858 } 1859 else if( pTO ) 1860 { 1861 // no text but object available? 1862 // outline object available, but we have no text 1863 if(pPage->IsPresObj(pTO)) 1864 { 1865 // if it is not already empty 1866 if( !pTO->IsEmptyPresObj() ) 1867 { 1868 DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" ); 1869 1870 // make it empty 1871 if( pOlView->isRecordingUndo() ) 1872 pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0)); 1873 pPage->RestoreDefaultText( pTO ); 1874 pTO->SetEmptyPresObj(sal_True); 1875 pTO->ActionChanged(); 1876 } 1877 } 1878 else 1879 { 1880 DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" ); 1881 // outline object is not part of the layout, delete it 1882 if( pOlView->isRecordingUndo() ) 1883 pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoRemoveObject(*pTO)); 1884 pPage->RemoveObject(pTO->GetOrdNum()); 1885 } 1886 } 1887 1888 return bNewObject; 1889 } 1890 1891 /************************************************************************* 1892 |* 1893 |* Update LayoutObject 1894 |* 1895 \************************************************************************/ 1896 1897 bool OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara ) 1898 { 1899 DBG_ASSERT( pPage, "sd::OutlineViewShell::UpdateOutlineObject(), pPage == 0?" ); 1900 DBG_ASSERT( pPara, "sd::OutlineViewShell::UpdateOutlineObject(), pPara == 0?" ); 1901 1902 if( !pPage || !pPara ) 1903 return false; 1904 1905 ::Outliner* pOutliner = pOlView->GetOutliner(); 1906 OutlinerParaObject* pOPO = NULL; 1907 SdrTextObj* pTO = NULL; 1908 1909 sal_Bool bNewObject = sal_False; 1910 1911 sal_uInt16 eOutlinerMode = OUTLINERMODE_TITLEOBJECT; 1912 pTO = (SdrTextObj*)pPage->GetPresObj( PRESOBJ_TEXT ); 1913 if( !pTO ) 1914 { 1915 eOutlinerMode = OUTLINERMODE_OUTLINEOBJECT; 1916 pTO = pOlView->GetOutlineTextObject( pPage ); 1917 } 1918 1919 // wieviele Absaetze in der Gliederung? 1920 sal_uLong nTitlePara = pOutliner->GetAbsPos( pPara ); 1921 sal_uLong nPara = nTitlePara + 1; 1922 sal_uLong nParasInLayout = 0L; 1923 pPara = pOutliner->GetParagraph( nPara ); 1924 while( pPara && !pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) 1925 { 1926 nParasInLayout++; 1927 pPara = pOutliner->GetParagraph( ++nPara ); 1928 } 1929 if( nParasInLayout ) 1930 { 1931 // ein OutlinerParaObject erzeugen 1932 pPara = pOutliner->GetParagraph( nTitlePara + 1 ); 1933 pOPO = pOutliner->CreateParaObject( (sal_uInt16) nTitlePara + 1, (sal_uInt16) nParasInLayout ); 1934 } 1935 1936 if( pOPO ) 1937 { 1938 DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" ); 1939 1940 // do we need an outline text object? 1941 if( !pTO ) 1942 { 1943 pTO = pOlView->CreateOutlineTextObject( pPage ); 1944 bNewObject = sal_True; 1945 } 1946 1947 // Seitenobjekt, Gliederungstext im Outliner: 1948 // Text uebernehmen 1949 if( pTO ) 1950 { 1951 pOPO->SetVertical( pTO->IsVerticalWriting() ); 1952 pOPO->SetOutlinerMode( eOutlinerMode ); 1953 if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) ) 1954 { 1955 // do nothing, same text already set 1956 delete pOPO; 1957 } 1958 else 1959 { 1960 if( !bNewObject && pOlView->isRecordingUndo() ) 1961 pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0)); 1962 1963 pTO->SetOutlinerParaObject( pOPO ); 1964 pTO->SetEmptyPresObj( sal_False ); 1965 pTO->ActionChanged(); 1966 } 1967 } 1968 } 1969 else if( pTO ) 1970 { 1971 // Seitenobjekt, aber kein Gliederungstext: 1972 // wenn Objekt in Praesentationsliste der Seite ist -> Defaulttext, 1973 // sonst Objekt loeschen 1974 if( pPage->IsPresObj(pTO) ) 1975 { 1976 if( !pTO->IsEmptyPresObj() ) 1977 { 1978 DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" ); 1979 1980 // loescht auch altes OutlinerParaObject 1981 if( pOlView->isRecordingUndo() ) 1982 pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0)); 1983 pPage->RestoreDefaultText( pTO ); 1984 pTO->SetEmptyPresObj(sal_True); 1985 pTO->ActionChanged(); 1986 } 1987 } 1988 else 1989 { 1990 DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" ); 1991 if( pOlView->isRecordingUndo() ) 1992 pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoRemoveObject(*pTO)); 1993 pPage->RemoveObject(pTO->GetOrdNum()); 1994 } 1995 } 1996 1997 return bNewObject; 1998 } 1999 2000 2001 /************************************************************************* 2002 |* 2003 |* Outliner aus Stream fuellen 2004 |* 2005 \************************************************************************/ 2006 2007 sal_uLong OutlineViewShell::Read(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat) 2008 { 2009 sal_uLong bRet = 0; 2010 2011 ::Outliner* pOutl = pOlView->GetOutliner(); 2012 2013 { 2014 OutlineViewPageChangesGuard aGuard( pOlView ); 2015 OutlineViewModelChangeGuard aGuard2( *pOlView ); 2016 2017 bRet = pOutl->Read( rInput, rBaseURL, eFormat, GetDocSh()->GetHeaderAttributes() ); 2018 2019 SdPage* pPage = GetDoc()->GetSdPage( GetDoc()->GetSdPageCount(PK_STANDARD) - 1, PK_STANDARD );; 2020 SfxStyleSheet* pTitleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ); 2021 SfxStyleSheet* pOutlSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ); 2022 2023 sal_uInt16 nParaCount = (sal_uInt16)pOutl->GetParagraphCount(); 2024 if ( nParaCount > 0 ) 2025 { 2026 for ( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ ) 2027 { 2028 pOlView->UpdateParagraph( nPara ); 2029 2030 sal_Int16 nDepth = pOutl->GetDepth( nPara ); 2031 2032 if( (nDepth == 0) || !nPara ) 2033 { 2034 Paragraph* pPara = pOutl->GetParagraph( nPara ); 2035 pOutl->SetDepth(pPara, -1); 2036 pOutl->SetParaFlag(pPara, PARAFLAG_ISPAGE); 2037 2038 pOutl->SetStyleSheet( nPara, pTitleSheet ); 2039 2040 if( nPara ) // first slide already exists 2041 pOlView->InsertSlideForParagraph( pPara ); 2042 } 2043 else 2044 { 2045 pOutl->SetDepth( pOutl->GetParagraph( nPara ), nDepth - 1 ); 2046 String aStyleSheetName( pOutlSheet->GetName() ); 2047 aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 ); 2048 aStyleSheetName += String::CreateFromInt32( nDepth ); 2049 SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool(); 2050 SfxStyleSheet* pStyle = (SfxStyleSheet*) pStylePool->Find( aStyleSheetName, pOutlSheet->GetFamily() ); 2051 DBG_ASSERT( pStyle, "AutoStyleSheetName - Style not found!" ); 2052 if ( pStyle ) 2053 pOutl->SetStyleSheet( nPara, pStyle ); 2054 } 2055 } 2056 } 2057 } 2058 2059 pOutl->GetUndoManager().Clear(); 2060 2061 return( bRet ); 2062 } 2063 2064 void OutlineViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse ) 2065 { 2066 WriteFrameViewData(); 2067 2068 ViewShell::WriteUserDataSequence( rSequence, bBrowse ); 2069 } 2070 2071 void OutlineViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse ) 2072 { 2073 WriteFrameViewData(); 2074 2075 ViewShell::ReadUserDataSequence( rSequence, bBrowse ); 2076 2077 ReadFrameViewData( mpFrameView ); 2078 } 2079 2080 void OutlineViewShell::VisAreaChanged(const Rectangle& rRect) 2081 { 2082 ViewShell::VisAreaChanged( rRect ); 2083 2084 GetViewShellBase().GetDrawController().FireVisAreaChanged(rRect); 2085 } 2086 2087 /** If there is a valid controller then create a new instance of 2088 <type>AccessibleDrawDocumentView</type>. Otherwise delegate this call 2089 to the base class to return a default object (probably an empty 2090 reference). 2091 */ 2092 ::com::sun::star::uno::Reference< 2093 ::com::sun::star::accessibility::XAccessible> 2094 OutlineViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow) 2095 { 2096 OSL_ASSERT (GetViewShell()!=NULL); 2097 if (GetViewShell()->GetController() != NULL) 2098 { 2099 ::accessibility::AccessibleOutlineView* pDocumentView = 2100 new ::accessibility::AccessibleOutlineView ( 2101 pWindow, 2102 this, 2103 GetViewShell()->GetController(), 2104 pWindow->GetAccessibleParentWindow()->GetAccessible()); 2105 pDocumentView->Init(); 2106 return ::com::sun::star::uno::Reference< 2107 ::com::sun::star::accessibility::XAccessible> 2108 (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView), 2109 ::com::sun::star::uno::UNO_QUERY); 2110 } 2111 else 2112 { 2113 OSL_TRACE ("OutlineViewShell::CreateAccessibleDocumentView: no controller"); 2114 return ViewShell::CreateAccessibleDocumentView (pWindow); 2115 } 2116 } 2117 2118 2119 2120 2121 void OutlineViewShell::GetState (SfxItemSet& rSet) 2122 { 2123 // Iterate over all requested items in the set. 2124 SfxWhichIter aIter( rSet ); 2125 sal_uInt16 nWhich = aIter.FirstWhich(); 2126 while (nWhich) 2127 { 2128 switch (nWhich) 2129 { 2130 case SID_SEARCH_ITEM: 2131 case SID_SEARCH_OPTIONS: 2132 // Call common (old) implementation in the document shell. 2133 GetDocSh()->GetState (rSet); 2134 break; 2135 default: 2136 OSL_TRACE ("OutlineViewShell::GetState(): can not handle which id %d", nWhich); 2137 break; 2138 } 2139 nWhich = aIter.NextWhich(); 2140 } 2141 } 2142 2143 2144 2145 2146 void OutlineViewShell::SetCurrentPage (SdPage* pPage) 2147 { 2148 // Adapt the selection of the model. 2149 for (sal_uInt16 i=0; i<GetDoc()->GetSdPageCount(PK_STANDARD); i++) 2150 GetDoc()->SetSelected( 2151 GetDoc()->GetSdPage(i, PK_STANDARD), 2152 sal_False); 2153 GetDoc()->SetSelected (pPage, sal_True); 2154 2155 DrawController& rController(GetViewShellBase().GetDrawController()); 2156 rController.FireSelectionChangeListener(); 2157 rController.FireSwitchCurrentPage (pPage); 2158 2159 pOlView->SetActualPage(pPage); 2160 } 2161 2162 2163 } // end of namespace sd 2164