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