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 "DrawViewShell.hxx" 28 #include "ViewShellImplementation.hxx" 29 30 #include "DrawController.hxx" 31 #include <com/sun/star/embed/EmbedStates.hpp> 32 33 #include "comphelper/anytostring.hxx" 34 #include "comphelper/scopeguard.hxx" 35 #include "cppuhelper/exc_hlp.hxx" 36 #include "rtl/ref.hxx" 37 38 #ifndef _SVXIDS_HRC 39 #include <svx/svxids.hrc> 40 #endif 41 #include <svx/svdpagv.hxx> 42 #include <sfx2/viewfrm.hxx> 43 #include <sfx2/bindings.hxx> 44 #include <svx/svdoole2.hxx> 45 #include <sfx2/dispatch.hxx> 46 #include <vcl/scrbar.hxx> 47 #include <svx/svdograf.hxx> 48 #include <svx/svdopage.hxx> 49 #include <vcl/msgbox.hxx> 50 #include <sot/storage.hxx> 51 #include <svx/fmshell.hxx> 52 #include <svx/globl3d.hxx> 53 #include <svx/fmglob.hxx> 54 #include <editeng/outliner.hxx> 55 56 57 #include "misc.hxx" 58 59 #ifdef STARIMAGE_AVAILABLE 60 #ifndef _SIMDLL_HXX 61 #include <sim2/simdll.hxx> 62 #endif 63 #endif 64 65 #include <svx/dialogs.hrc> 66 67 #include "view/viewoverlaymanager.hxx" 68 69 #include "glob.hrc" 70 #include "app.hrc" 71 #include "res_bmp.hrc" 72 #include "strings.hrc" 73 #include "helpids.h" 74 75 #include "app.hxx" 76 #include "fupoor.hxx" 77 #include "sdresid.hxx" 78 #include "fusel.hxx" 79 #include "sdpage.hxx" 80 #include "FrameView.hxx" 81 #include "stlpool.hxx" 82 #include "Window.hxx" 83 #ifndef SD_DRAWVIEW_HXX 84 #include "drawview.hxx" 85 #endif 86 #include "drawdoc.hxx" 87 #include "DrawDocShell.hxx" 88 #include "Ruler.hxx" 89 #include "Client.hxx" 90 #include "slideshow.hxx" 91 #include "optsitem.hxx" 92 #include "fusearch.hxx" 93 #include "Outliner.hxx" 94 #include "AnimationChildWindow.hxx" 95 #include "SdUnoDrawView.hxx" 96 #include "ToolBarManager.hxx" 97 #include "FormShellManager.hxx" 98 #include "ViewShellBase.hxx" 99 #include "LayerDialogChildWindow.hxx" 100 #include "LayerTabBar.hxx" 101 #include "ViewShellManager.hxx" 102 #include "ViewShellHint.hxx" 103 104 #include <sfx2/request.hxx> 105 #include <boost/bind.hpp> 106 107 #ifdef _MSC_VER 108 #if (_MSC_VER < 1400) 109 #pragma optimize ( "", off ) 110 #endif 111 #endif 112 113 using namespace com::sun::star; 114 115 namespace sd { 116 117 void DrawViewShell::Activate(sal_Bool bIsMDIActivate) 118 { 119 ViewShell::Activate(bIsMDIActivate); 120 } 121 122 void DrawViewShell::UIActivating( SfxInPlaceClient* pCli ) 123 { 124 ViewShell::UIActivating(pCli); 125 126 // #94252# Disable own controls 127 maTabControl.Disable(); 128 if (GetLayerTabControl() != NULL) 129 GetLayerTabControl()->Disable(); 130 } 131 132 void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli ) 133 { 134 // #94252# Enable own controls 135 maTabControl.Enable(); 136 if (GetLayerTabControl() != NULL) 137 GetLayerTabControl()->Enable(); 138 139 ViewShell::UIDeactivated(pCli); 140 } 141 142 143 /************************************************************************* 144 |* 145 |* Deactivate() 146 |* 147 \************************************************************************/ 148 149 void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate) 150 { 151 // Do not forward to ViewShell::Deactivate() to prevent a context change. 152 } 153 154 namespace 155 { 156 class LockUI 157 { 158 private: 159 void Lock(bool bLock); 160 SfxViewFrame *mpFrame; 161 public: 162 LockUI(SfxViewFrame *pFrame) : mpFrame(pFrame) { Lock(true); } 163 ~LockUI() { Lock(false); } 164 165 }; 166 167 void LockUI::Lock(bool bLock) 168 { 169 if (!mpFrame) 170 return; 171 mpFrame->Enable( !bLock ); 172 } 173 } 174 175 /************************************************************************* 176 |* 177 |* Wird gerufen, wenn sich der Selektionszustand der View aendert 178 |* 179 \************************************************************************/ 180 void DrawViewShell::SelectionHasChanged (void) 181 { 182 Invalidate(); 183 184 //Update3DWindow(); // 3D-Controller 185 SfxBoolItem aItem( SID_3D_STATE, sal_True ); 186 GetViewFrame()->GetDispatcher()->Execute( 187 SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); 188 189 SdrOle2Obj* pOleObj = NULL; 190 SdrGrafObj* pGrafObj = NULL; 191 192 if ( mpDrawView->AreObjectsMarked() ) 193 { 194 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 195 196 if (rMarkList.GetMarkCount() == 1) 197 { 198 SdrMark* pMark = rMarkList.GetMark(0); 199 SdrObject* pObj = pMark->GetMarkedSdrObj(); 200 201 sal_uInt32 nInv = pObj->GetObjInventor(); 202 sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); 203 204 if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2) 205 { 206 pOleObj = (SdrOle2Obj*) pObj; 207 UpdateIMapDlg( pObj ); 208 } 209 else if (nSdrObjKind == OBJ_GRAF) 210 { 211 pGrafObj = (SdrGrafObj*) pObj; 212 UpdateIMapDlg( pObj ); 213 } 214 } 215 } 216 217 ViewShellBase& rBase = GetViewShellBase(); 218 rBase.SetVerbs( uno::Sequence< embed::VerbDescriptor >() ); 219 220 try 221 { 222 Client* pIPClient = static_cast<Client*>(rBase.GetIPClient()); 223 if ( pIPClient && pIPClient->IsObjectInPlaceActive() ) 224 { 225 /********************************************************************** 226 * Ggf. OLE-Objekt beruecksichtigen und deaktivieren 227 **********************************************************************/ 228 229 // this means we recently deselected an inplace active ole object so 230 // we need to deselect it now 231 if (!pOleObj) 232 { 233 //#i47279# disable frame until after object has completed unload 234 LockUI aUILock(GetViewFrame()); 235 pIPClient->DeactivateObject(); 236 //HMHmpDrView->ShowMarkHdl(); 237 } 238 else 239 { 240 uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef(); 241 if ( xObj.is() ) 242 { 243 rBase.SetVerbs( xObj->getSupportedVerbs() ); 244 } 245 else 246 { 247 rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() ); 248 } 249 } 250 } 251 else 252 { 253 if ( pOleObj ) 254 { 255 uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef(); 256 if ( xObj.is() ) 257 { 258 rBase.SetVerbs( xObj->getSupportedVerbs() ); 259 } 260 else 261 { 262 rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() ); 263 } 264 } 265 else 266 { 267 rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() ); 268 } 269 } 270 } 271 catch( ::com::sun::star::uno::Exception& e ) 272 { 273 (void)e; 274 DBG_ERROR( 275 (rtl::OString("sd::DrawViewShell::SelectionHasChanged(), " 276 "exception caught: ") + 277 rtl::OUStringToOString( 278 comphelper::anyToString( cppu::getCaughtException() ), 279 RTL_TEXTENCODING_UTF8 )).getStr() ); 280 } 281 282 if( HasCurrentFunction() ) 283 { 284 GetCurrentFunction()->SelectionHasChanged(); 285 } 286 else 287 { 288 GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView); 289 } 290 291 // #96124# Invalidate for every subshell 292 GetViewShellBase().GetViewShellManager()->InvalidateAllSubShells(this); 293 294 mpDrawView->UpdateSelectionClipboard( sal_False ); 295 296 GetViewShellBase().GetDrawController().FireSelectionChangeListener(); 297 } 298 299 300 /************************************************************************* 301 |* 302 |* Zoomfaktor setzen 303 |* 304 \************************************************************************/ 305 306 void DrawViewShell::SetZoom( long nZoom ) 307 { 308 // Make sure that the zoom factor will not be recalculated on 309 // following window resizings. 310 mbZoomOnPage = sal_False; 311 ViewShell::SetZoom( nZoom ); 312 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM ); 313 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); 314 mpViewOverlayManager->onZoomChanged(); 315 } 316 317 /************************************************************************* 318 |* 319 |* Zoomrechteck fuer aktives Fenster einstellen 320 |* 321 \************************************************************************/ 322 323 void DrawViewShell::SetZoomRect( const Rectangle& rZoomRect ) 324 { 325 ViewShell::SetZoomRect( rZoomRect ); 326 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM ); 327 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); 328 mpViewOverlayManager->onZoomChanged(); 329 } 330 331 /************************************************************************* 332 |* 333 |* PrepareClose, ggfs. Texteingabe beenden, damit andere Viewshells ein 334 |* aktualisiertes Textobjekt vorfinden 335 |* 336 \************************************************************************/ 337 338 sal_uInt16 DrawViewShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ) 339 { 340 if ( ViewShell::PrepareClose(bUI, bForBrowsing) != sal_True ) 341 return sal_False; 342 343 sal_Bool bRet = sal_True; 344 345 if( bRet && HasCurrentFunction() ) 346 { 347 sal_uInt16 nID = GetCurrentFunction()->GetSlotID(); 348 if (nID == SID_TEXTEDIT || nID == SID_ATTR_CHAR) 349 { 350 mpDrawView->SdrEndTextEdit(); 351 } 352 } 353 else if( !bRet ) 354 { 355 maCloseTimer.SetTimeoutHdl( LINK( this, DrawViewShell, CloseHdl ) ); 356 maCloseTimer.SetTimeout( 20 ); 357 maCloseTimer.Start(); 358 } 359 360 return bRet; 361 } 362 363 /************************************************************************* 364 |* 365 |* Status (Enabled/Disabled) von Menue-SfxSlots setzen 366 |* 367 \************************************************************************/ 368 369 void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) 370 { 371 if (meEditMode != eEMode || mbIsLayerModeActive != bIsLayerModeActive) 372 { 373 ViewShellManager::UpdateLock aLock (GetViewShellBase().GetViewShellManager()); 374 375 sal_uInt16 nActualPageNum = 0; 376 377 GetViewShellBase().GetDrawController().FireChangeEditMode (eEMode == EM_MASTERPAGE); 378 GetViewShellBase().GetDrawController().FireChangeLayerMode (bIsLayerModeActive); 379 380 if ( mpDrawView->IsTextEdit() ) 381 { 382 mpDrawView->SdrEndTextEdit(); 383 } 384 385 LayerTabBar* pLayerBar = GetLayerTabControl(); 386 if (pLayerBar != NULL) 387 pLayerBar->EndEditMode(); 388 maTabControl.EndEditMode(); 389 390 if (mePageKind == PK_HANDOUT) 391 { 392 // Bei Handzetteln nur MasterPage zulassen 393 eEMode = EM_MASTERPAGE; 394 } 395 396 GetViewShellBase().GetDrawController().BroadcastContextChange(); 397 398 meEditMode = eEMode; 399 mbIsLayerModeActive = bIsLayerModeActive; 400 401 // Determine whether to show the master view toolbar. The master 402 // page mode has to be active and the shell must not be a handout 403 // view. 404 bool bShowMasterViewToolbar (meEditMode == EM_MASTERPAGE 405 && GetShellType() != ViewShell::ST_HANDOUT); 406 407 // If the master view toolbar is not shown we hide it before 408 // switching the edit mode. 409 if (::sd::ViewShell::mpImpl->mbIsInitialized 410 && IsMainViewShell() 411 && ! bShowMasterViewToolbar) 412 { 413 GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::TBG_MASTER_MODE); 414 } 415 416 if (meEditMode == EM_PAGE) 417 { 418 /****************************************************************** 419 * PAGEMODE 420 ******************************************************************/ 421 422 maTabControl.Clear(); 423 424 SdPage* pPage; 425 String aPageName; 426 sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); 427 428 for (sal_uInt16 i = 0; i < nPageCnt; i++) 429 { 430 pPage = GetDoc()->GetSdPage(i, mePageKind); 431 aPageName = pPage->GetName(); 432 maTabControl.InsertPage(i + 1, aPageName); 433 434 if ( pPage->IsSelected() && nActualPageNum == 0 ) 435 { 436 nActualPageNum = i; 437 } 438 } 439 440 maTabControl.SetCurPageId(nActualPageNum + 1); 441 442 SwitchPage(nActualPageNum); 443 } 444 else 445 { 446 /****************************************************************** 447 * MASTERPAGE 448 ******************************************************************/ 449 GetViewFrame()->SetChildWindow( 450 AnimationChildWindow::GetChildWindowId(), sal_False ); 451 452 if (!mpActualPage) 453 { 454 // Sofern es keine mpActualPage gibt, wird die erste genommen 455 mpActualPage = GetDoc()->GetSdPage(0, mePageKind); 456 } 457 458 maTabControl.Clear(); 459 sal_uInt16 nActualMasterPageNum = 0; 460 sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); 461 462 for (sal_uInt16 i = 0; i < nMasterPageCnt; i++) 463 { 464 SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind); 465 String aLayoutName(pMaster->GetLayoutName()); 466 aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR)); 467 468 maTabControl.InsertPage(i + 1, aLayoutName); 469 470 if (&(mpActualPage->TRG_GetMasterPage()) == pMaster) 471 { 472 nActualMasterPageNum = i; 473 } 474 } 475 476 maTabControl.SetCurPageId(nActualMasterPageNum + 1); 477 SwitchPage(nActualMasterPageNum); 478 } 479 480 // If the master view toolbar is to be shown we turn it on after the 481 // edit mode has been changed. 482 if (::sd::ViewShell::mpImpl->mbIsInitialized 483 && IsMainViewShell() 484 && bShowMasterViewToolbar) 485 { 486 GetViewShellBase().GetToolBarManager()->SetToolBar( 487 ToolBarManager::TBG_MASTER_MODE, 488 ToolBarManager::msMasterViewToolBar); 489 } 490 491 if ( ! mbIsLayerModeActive) 492 { 493 maTabControl.Show(); 494 // Set the tab control only for draw pages. For master page 495 // this has been done already above. 496 if (meEditMode == EM_PAGE) 497 maTabControl.SetCurPageId (nActualPageNum + 1); 498 } 499 /*AF: The LayerDialogChildWindow is not used anymore (I hope). 500 if (GetViewFrame()->KnowsChildWindow( 501 LayerDialogChildWindow::GetChildWindowId())) 502 { 503 GetViewFrame()->SetChildWindow( 504 LayerDialogChildWindow::GetChildWindowId(), 505 IsLayerModeActive()); 506 } 507 */ 508 ResetActualLayer(); 509 510 Invalidate( SID_PAGEMODE ); 511 Invalidate( SID_LAYERMODE ); 512 Invalidate( SID_MASTERPAGE ); 513 Invalidate( SID_DELETE_MASTER_PAGE ); 514 Invalidate( SID_DELETE_PAGE ); 515 Invalidate( SID_SLIDE_MASTERPAGE ); 516 Invalidate( SID_TITLE_MASTERPAGE ); 517 Invalidate( SID_NOTES_MASTERPAGE ); 518 Invalidate( SID_HANDOUT_MASTERPAGE ); 519 520 SetContextName(GetSidebarContextName()); 521 } 522 } 523 524 525 526 527 bool DrawViewShell::IsLayerModeActive (void) const 528 { 529 return mbIsLayerModeActive; 530 } 531 532 533 534 535 /************************************************************************* 536 |* 537 |* Groesse des TabControls und der ModeButtons zurueckgeben 538 |* 539 \************************************************************************/ 540 541 long DrawViewShell::GetHCtrlWidth() 542 { 543 // return maTabControl.GetSizePixel().Width(); 544 return 0; 545 } 546 547 548 /************************************************************************* 549 |* 550 |* Horizontales Lineal erzeugen 551 |* 552 \************************************************************************/ 553 554 SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin, sal_Bool bIsFirst) 555 { 556 Ruler* pRuler; 557 WinBits aWBits; 558 sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT; 559 560 if ( bIsFirst ) 561 { 562 aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER | WB_EXTRAFIELD; 563 nFlags |= ( SVXRULER_SUPPORT_SET_NULLOFFSET | 564 SVXRULER_SUPPORT_TABS | 565 SVXRULER_SUPPORT_PARAGRAPH_MARGINS ); // Neu 566 } 567 else 568 aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER; 569 570 pRuler = new Ruler (*this, GetParentWindow(), pWin, nFlags, 571 GetViewFrame()->GetBindings(), aWBits); 572 pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit()); 573 574 // Metric ... 575 sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit(); 576 577 if( nMetric == 0xffff ) 578 nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit(); 579 580 pRuler->SetUnit( FieldUnit( nMetric ) ); 581 582 // ... und auch DefTab am Lineal einstellen 583 pRuler->SetDefTabDist( GetDoc()->GetDefaultTabulator() ); // Neu 584 585 Fraction aUIScale(pWin->GetMapMode().GetScaleX()); 586 aUIScale *= GetDoc()->GetUIScale(); 587 pRuler->SetZoom(aUIScale); 588 589 return pRuler; 590 } 591 592 /************************************************************************* 593 |* 594 |* Vertikales Lineal erzeugen 595 |* 596 \************************************************************************/ 597 598 SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin) 599 { 600 Ruler* pRuler; 601 WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER; 602 sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT; 603 604 pRuler = new Ruler(*this, GetParentWindow(), pWin, nFlags, 605 GetViewFrame()->GetBindings(), aWBits); 606 pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit()); 607 608 // #96629# Metric same as HRuler, use document setting 609 sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit(); 610 611 if( nMetric == 0xffff ) 612 nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit(); 613 614 pRuler->SetUnit( FieldUnit( nMetric ) ); 615 616 Fraction aUIScale(pWin->GetMapMode().GetScaleY()); 617 aUIScale *= GetDoc()->GetUIScale(); 618 pRuler->SetZoom(aUIScale); 619 620 return pRuler; 621 } 622 623 /************************************************************************* 624 |* 625 |* Horizontales Lineal aktualisieren 626 |* 627 \************************************************************************/ 628 629 void DrawViewShell::UpdateHRuler() 630 { 631 Invalidate( SID_ATTR_LONG_LRSPACE ); 632 Invalidate( SID_RULER_PAGE_POS ); 633 Invalidate( SID_RULER_OBJECT ); 634 Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT ); 635 636 if (mpHorizontalRuler.get() != NULL) 637 mpHorizontalRuler->ForceUpdate(); 638 } 639 640 /************************************************************************* 641 |* 642 |* Vertikales Lineal aktualisieren 643 |* 644 \************************************************************************/ 645 646 void DrawViewShell::UpdateVRuler() 647 { 648 Invalidate( SID_ATTR_LONG_LRSPACE ); 649 Invalidate( SID_RULER_PAGE_POS ); 650 Invalidate( SID_RULER_OBJECT ); 651 652 if (mpVerticalRuler.get() != NULL) 653 mpVerticalRuler->ForceUpdate(); 654 } 655 656 /************************************************************************* 657 |* 658 |* Metrik setzen 659 |* 660 \************************************************************************/ 661 662 void DrawViewShell::SetUIUnit(FieldUnit eUnit) 663 { 664 ViewShell::SetUIUnit(eUnit); 665 } 666 667 /************************************************************************* 668 |* 669 |* TabControl nach Splitteraenderung aktualisieren 670 |* 671 \************************************************************************/ 672 673 IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab ) 674 { 675 const long int nMax = maViewSize.Width() - maScrBarWH.Width() 676 - maTabControl.GetPosPixel().X() ; 677 678 Size aTabSize = maTabControl.GetSizePixel(); 679 aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1)); 680 681 maTabControl.SetSizePixel(aTabSize); 682 GetLayerTabControl()->SetSizePixel(aTabSize); 683 684 Point aPos = maTabControl.GetPosPixel(); 685 aPos.X() += aTabSize.Width(); 686 687 Size aScrSize(nMax - aTabSize.Width(), maScrBarWH.Height()); 688 mpHorizontalScrollBar->SetPosSizePixel(aPos, aScrSize); 689 690 return 0; 691 } 692 693 /// inherited from sd::ViewShell 694 SdPage* DrawViewShell::getCurrentPage() const 695 { 696 const sal_Int32 nPageCount = (meEditMode == EM_PAGE)? 697 GetDoc()->GetSdPageCount(mePageKind): 698 GetDoc()->GetMasterSdPageCount(mePageKind); 699 700 sal_Int32 nCurrentPage = maTabControl.GetCurPageId() - 1; 701 DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" ); 702 if( (nPageCount < 0) || (nCurrentPage>=nPageCount) ) 703 nCurrentPage = 0; // play safe here 704 705 if (meEditMode == EM_PAGE) 706 { 707 return GetDoc()->GetSdPage((sal_uInt16)nCurrentPage, mePageKind); 708 } 709 else // EM_MASTERPAGE 710 { 711 return GetDoc()->GetMasterSdPage((sal_uInt16)nCurrentPage, mePageKind); 712 } 713 } 714 715 /************************************************************************* 716 |* 717 |* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert 718 |* hat (z. B. durch Undo) 719 |* 720 \************************************************************************/ 721 722 void DrawViewShell::ResetActualPage() 723 { 724 sal_uInt16 nCurrentPage = maTabControl.GetCurPageId() - 1; 725 sal_uInt16 nPageCount = (meEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind); 726 if (nPageCount > 0) 727 nCurrentPage = Min((sal_uInt16)(nPageCount - 1), nCurrentPage); 728 else 729 nCurrentPage = 0; 730 731 if (meEditMode == EM_PAGE) 732 { 733 734 // Update fuer TabControl 735 maTabControl.Clear(); 736 737 SdPage* pPage = NULL; 738 String aPageName; 739 740 for (sal_uInt16 i = 0; i < nPageCount; i++) 741 { 742 pPage = GetDoc()->GetSdPage(i, mePageKind); 743 aPageName = pPage->GetName(); 744 maTabControl.InsertPage(i + 1, aPageName); 745 746 // Selektionskennungen der Seiten korrigieren 747 GetDoc()->SetSelected(pPage, i == nCurrentPage); 748 } 749 750 maTabControl.SetCurPageId(nCurrentPage + 1); 751 } 752 else // EM_MASTERPAGE 753 { 754 SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind); 755 maTabControl.Clear(); 756 sal_uInt16 nActualMasterPageNum = 0; 757 758 sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); 759 for (sal_uInt16 i = 0; i < nMasterPageCnt; i++) 760 { 761 SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind); 762 String aLayoutName(pMaster->GetLayoutName()); 763 aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR)); 764 maTabControl.InsertPage(i + 1, aLayoutName); 765 766 if (pActualPage == pMaster) 767 nActualMasterPageNum = i; 768 } 769 770 maTabControl.SetCurPageId(nActualMasterPageNum + 1); 771 SwitchPage(nActualMasterPageNum); 772 } 773 774 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHPAGE, 775 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 776 } 777 778 /************************************************************************* 779 |* 780 |* Verb auf OLE-Objekt anwenden 781 |* 782 \************************************************************************/ 783 784 785 ErrCode DrawViewShell::DoVerb(long nVerb) 786 { 787 if ( mpDrawView->AreObjectsMarked() ) 788 { 789 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 790 791 if (rMarkList.GetMarkCount() == 1) 792 { 793 SdrMark* pMark = rMarkList.GetMark(0); 794 SdrObject* pObj = pMark->GetMarkedSdrObj(); 795 796 sal_uInt32 nInv = pObj->GetObjInventor(); 797 sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); 798 799 if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2) 800 { 801 ActivateObject( (SdrOle2Obj*) pObj, nVerb); 802 } 803 #ifdef STARIMAGE_AVAILABLE 804 else if (nInv = SdrInventor && nSdrObjKind == OBJ_GRAF && 805 ((SdrGrafObj*) pObj)->GetGraphicType() == GRAPHIC_BITMAP && 806 SFX_APP()->HasFeature(SFX_FEATURE_SIMAGE)) 807 { 808 SdrGrafObj* pSdrGrafObj = (SdrGrafObj*) pObj; 809 short nOK = RET_YES; 810 811 if ( pSdrGrafObj->GetFileName().Len() ) 812 { 813 // Graphik ist gelinkt, soll der Link aufgehoben werden? 814 QueryBox aBox(pWindow, WB_YES_NO | WB_DEF_YES, 815 String( SdResId(STR_REMOVE_LINK) ) ); 816 nOK = aBox.Execute(); 817 818 if (nOK == RET_YES) 819 { 820 // Link aufheben (File- und Filtername zuruecksetzen) 821 pSdrGrafObj->SetGraphicLink(String(), String()); 822 } 823 } 824 825 if (nOK == RET_YES) 826 { 827 /************************************************************** 828 * OLE-Objekt erzeugen, StarImage starten 829 * Grafik-Objekt loeschen (durch OLE-Objekt ersetzt) 830 **************************************************************/ 831 //HMHmpDrView->HideMarkHdl(); 832 833 SvStorageRef aStor = new SvStorage(String()); 834 SvInPlaceObjectRef aNewIPObj = &((SvFactory*)SvInPlaceObject::ClassFactory()) 835 ->CreateAndInit(SimModuleDummy::GetID(SOFFICE_FILEFORMAT_CURRENT), aStor); 836 if ( aNewIPObj.Is() ) 837 { 838 SdrGrafObj* pTempSdrGrafObj = (SdrGrafObj*) pSdrGrafObj->Clone (); 839 840 SvEmbeddedInfoObject * pInfo; 841 pInfo = GetViewFrame()->GetObjectShell()-> 842 InsertObject( aNewIPObj, String() ); 843 844 String aName; 845 if (pInfo) 846 { 847 aName = pInfo->GetObjName(); 848 } 849 850 Rectangle aRect = pObj->GetLogicRect(); 851 SdrOle2Obj* pSdrOle2Obj = new SdrOle2Obj( aNewIPObj, 852 aName, aRect ); 853 854 SdrPageView* pPV = mpDrawView->GetSdrPageView(); 855 856 pPV->GetObjList()->InsertObject( pSdrOle2Obj ); 857 mpDrawView->ReplaceObjectAtView( pObj, *pPV, pTempSdrGrafObj ); 858 859 pSdrOle2Obj->SetLogicRect(aRect); 860 aNewIPObj->SetVisAreaSize(aRect.GetSize()); 861 862 SimDLL::Update(aNewIPObj, pTempSdrGrafObj->GetGraphic(), pWindow); 863 ActivateObject(pSdrOle2Obj, SVVERB_SHOW); 864 865 Client* pClient = (Client*) GetIPClient(); 866 867 if (pClient) 868 pClient->SetSdrGrafObj( pTempSdrGrafObj ); 869 } 870 } 871 } 872 #endif 873 } 874 } 875 876 return 0; 877 } 878 879 880 /************************************************************************* 881 |* 882 |* OLE-Object aktivieren 883 |* 884 \************************************************************************/ 885 886 sal_Bool DrawViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) 887 { 888 sal_Bool bActivated = sal_False; 889 890 if ( !GetDocSh()->IsUIActive() ) 891 { 892 ToolBarManager::UpdateLock aLock (GetViewShellBase().GetToolBarManager()); 893 894 bActivated = ViewShell::ActivateObject(pObj, nVerb); 895 896 OSL_ASSERT(GetViewShell()!=NULL); 897 Client* pClient = static_cast<Client*>(GetViewShell()->GetIPClient()); 898 if (pClient) 899 pClient->SetSdrGrafObj(NULL); 900 } 901 902 return(bActivated); 903 } 904 905 /************************************************************************* 906 |* 907 |* Auf gewuenschte Seite schalten 908 |* Der Parameter nSelectedPage bezieht sich auf den aktuellen EditMode 909 |* 910 \************************************************************************/ 911 912 void LclResetFlag (bool& rbFlag) {rbFlag = false;} 913 914 sal_Bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) 915 { 916 /** Under some circumstances there are nested calls to SwitchPage() and 917 may crash the application (activation of form controls when the 918 shell of the edit view is not on top of the shell stack, see issue 919 83888 for details.) Therefore the nested calls are ignored (they 920 would jump to the wrong page anyway.) 921 */ 922 if (mbIsInSwitchPage) 923 return sal_False; 924 mbIsInSwitchPage = true; 925 comphelper::ScopeGuard aGuard (::boost::bind(LclResetFlag, ::boost::ref(mbIsInSwitchPage))); 926 927 if (GetActiveWindow()->IsInPaint()) 928 { 929 // Switching the current page while a Paint is being executed is 930 // dangerous. So, post it for later execution and return. 931 maAsynchronousSwitchPageCall.Post(::boost::bind( 932 ::std::mem_fun(&DrawViewShell::SwitchPage), 933 this, 934 nSelectedPage)); 935 return sal_False; 936 } 937 938 sal_Bool bOK = sal_False; 939 940 // With the current implementation of FuSlideShow there is a problem 941 // when it dsplays the show in a window: When the show is stopped it 942 // returns at one point in time SDRPAGE_NOTFOUND as current page index. 943 // Because FuSlideShow is currently being rewritten this bug is fixed 944 // here. 945 // This is not as bad a hack as it may look because making SwitchPage() 946 // more robust with respect to invalid page numbers is a good thing 947 // anyway. 948 if (nSelectedPage == SDRPAGE_NOTFOUND) 949 { 950 nSelectedPage = 0; 951 } 952 else 953 { 954 // Make sure that the given page index points to an existing page. Move 955 // the index into the valid range if necessary. 956 sal_uInt16 nPageCount = (meEditMode == EM_PAGE) 957 ? GetDoc()->GetSdPageCount(mePageKind) 958 : GetDoc()->GetMasterSdPageCount(mePageKind); 959 if (nSelectedPage >= nPageCount) 960 nSelectedPage = nPageCount-1; 961 } 962 963 if (IsSwitchPageAllowed()) 964 { 965 ModifyGuard aGuard2( GetDoc() ); 966 967 bOK = sal_True; 968 969 if (mpActualPage) 970 { 971 SdPage* pNewPage = NULL; 972 973 if (meEditMode == EM_MASTERPAGE) 974 { 975 if( GetDoc()->GetMasterSdPageCount(mePageKind) > nSelectedPage ) 976 pNewPage = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind); 977 978 if( pNewPage ) 979 { 980 SdrPageView* pPV = mpDrawView->GetSdrPageView(); 981 982 String sPageText (pNewPage->GetLayoutName()); 983 sPageText.Erase(sPageText.SearchAscii(SD_LT_SEPARATOR)); 984 if (pPV 985 && pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() ) 986 && sPageText == maTabControl.GetPageText(nSelectedPage+1)) 987 { 988 // this slide is already visible 989 return sal_True; 990 } 991 } 992 } 993 else 994 { 995 OSL_ASSERT(mpFrameView!=NULL); 996 mpFrameView->SetSelectedPage(nSelectedPage); 997 998 if (GetDoc()->GetSdPageCount(mePageKind) > nSelectedPage) 999 pNewPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind); 1000 1001 if (mpActualPage == pNewPage) 1002 { 1003 SdrPageView* pPV = mpDrawView->GetSdrPageView(); 1004 1005 SdPage* pCurrentPage = dynamic_cast< SdPage* >( pPV->GetPage()); 1006 if (pPV 1007 && pNewPage == pCurrentPage 1008 && pNewPage->GetName() == maTabControl.GetPageText(nSelectedPage+1)) 1009 { 1010 // this slide is already visible 1011 return sal_True; 1012 } 1013 } 1014 } 1015 } 1016 1017 if( mpDrawView ) 1018 mpDrawView->SdrEndTextEdit(); 1019 1020 mpActualPage = NULL; 1021 1022 if (meEditMode == EM_PAGE) 1023 { 1024 mpActualPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind); 1025 } 1026 else 1027 { 1028 SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind); 1029 1030 // Passt die selektierte Seite zur MasterPage? 1031 sal_uInt16 nPageCount = GetDoc()->GetSdPageCount(mePageKind); 1032 for (sal_uInt16 i = 0; i < nPageCount; i++) 1033 { 1034 SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); 1035 if(pPage && pPage->IsSelected() && pMaster == &(pPage->TRG_GetMasterPage())) 1036 { 1037 mpActualPage = pPage; 1038 break; 1039 } 1040 } 1041 1042 if (!mpActualPage) 1043 { 1044 // Die erste Seite nehmen, welche zur MasterPage passt 1045 for (sal_uInt16 i = 0; i < nPageCount; i++) 1046 { 1047 SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); 1048 if(pPage && pMaster == &(pPage->TRG_GetMasterPage())) 1049 { 1050 mpActualPage = pPage; 1051 break; 1052 } 1053 } 1054 } 1055 } 1056 1057 for (sal_uInt16 i = 0; i < GetDoc()->GetSdPageCount(mePageKind); i++) 1058 { 1059 // Alle Seiten deselektieren 1060 GetDoc()->SetSelected( GetDoc()->GetSdPage(i, mePageKind), sal_False); 1061 } 1062 1063 if (!mpActualPage) 1064 { 1065 // Sofern es keine mpActualPage gibt, wird die erste genommen 1066 mpActualPage = GetDoc()->GetSdPage(0, mePageKind); 1067 } 1068 1069 // diese Seite auch selektieren (mpActualPage zeigt immer auf Zeichenseite, 1070 // nie auf eine Masterpage) 1071 GetDoc()->SetSelected(mpActualPage, sal_True); 1072 1073 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) ); 1074 if( !xSlideshow.is() || !xSlideshow->isRunning() || ( xSlideshow->getAnimationMode() != ANIMATIONMODE_SHOW ) ) 1075 { 1076 // VisArea zuziehen, um ggf. Objekte zu deaktivieren 1077 // !!! only if we are not in presentation mode (#96279) !!! 1078 OSL_ASSERT (GetViewShell()!=NULL); 1079 GetViewShell()->DisconnectAllClients(); 1080 VisAreaChanged(Rectangle(Point(), Size(1, 1))); 1081 } 1082 1083 if (meEditMode == EM_PAGE) 1084 { 1085 /********************************************************************** 1086 * PAGEMODE 1087 **********************************************************************/ 1088 GetDoc()->SetSelected(mpActualPage, sal_True); 1089 1090 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 1091 1092 if (pPageView) 1093 { 1094 mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() ); 1095 mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() ); 1096 mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() ); 1097 1098 if (mePageKind == PK_NOTES) 1099 { 1100 mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() ); 1101 } 1102 else if (mePageKind == PK_HANDOUT) 1103 { 1104 mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() ); 1105 } 1106 else 1107 { 1108 mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() ); 1109 } 1110 } 1111 1112 mpDrawView->HideSdrPage(); 1113 mpDrawView->ShowSdrPage(mpActualPage); 1114 GetViewShellBase().GetDrawController().FireSwitchCurrentPage(mpActualPage); 1115 1116 SdrPageView* pNewPageView = mpDrawView->GetSdrPageView(); 1117 1118 if (pNewPageView) 1119 { 1120 pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() ); 1121 pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() ); 1122 pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() ); 1123 1124 if (mePageKind == PK_NOTES) 1125 { 1126 pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() ); 1127 } 1128 else if (mePageKind == PK_HANDOUT) 1129 { 1130 pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() ); 1131 } 1132 else 1133 { 1134 pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() ); 1135 } 1136 } 1137 1138 maTabControl.SetCurPageId(nSelectedPage+1); 1139 String aPageName = mpActualPage->GetName(); 1140 1141 if (maTabControl.GetPageText(nSelectedPage+1) != aPageName) 1142 { 1143 maTabControl.SetPageText(nSelectedPage+1, aPageName); 1144 } 1145 } 1146 else 1147 { 1148 /********************************************************************** 1149 * MASTERPAGE 1150 **********************************************************************/ 1151 SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 1152 1153 if (pPageView) 1154 { 1155 mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() ); 1156 mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() ); 1157 mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() ); 1158 1159 if (mePageKind == PK_NOTES) 1160 { 1161 mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() ); 1162 } 1163 else if (mePageKind == PK_HANDOUT) 1164 { 1165 mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() ); 1166 } 1167 else 1168 { 1169 mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() ); 1170 } 1171 } 1172 1173 mpDrawView->HideSdrPage(); 1174 1175 SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind); 1176 1177 if( !pMaster ) // Falls es diese Page nicht geben sollte 1178 pMaster = GetDoc()->GetMasterSdPage(0, mePageKind); 1179 1180 sal_uInt16 nNum = pMaster->GetPageNum(); 1181 mpDrawView->ShowSdrPage(mpDrawView->GetModel()->GetMasterPage(nNum)); 1182 1183 GetViewShellBase().GetDrawController().FireSwitchCurrentPage(pMaster); 1184 1185 SdrPageView* pNewPageView = mpDrawView->GetSdrPageView(); 1186 1187 if (pNewPageView) 1188 { 1189 pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() ); 1190 pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() ); 1191 pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() ); 1192 1193 if (mePageKind == PK_NOTES) 1194 { 1195 pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() ); 1196 } 1197 else if (mePageKind == PK_HANDOUT) 1198 { 1199 pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() ); 1200 } 1201 else 1202 { 1203 pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() ); 1204 } 1205 } 1206 1207 String aLayoutName(pMaster->GetLayoutName()); 1208 aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR)); 1209 1210 maTabControl.SetCurPageId(nSelectedPage+1); 1211 1212 if (maTabControl.GetPageText(nSelectedPage+1) != aLayoutName) 1213 { 1214 maTabControl.SetPageText(nSelectedPage+1, aLayoutName); 1215 } 1216 1217 if( mePageKind == PK_HANDOUT ) 1218 { 1219 // set pages for all available handout presentation objects 1220 sd::ShapeList& rShapeList = pMaster->GetPresentationShapeList(); 1221 SdrObject* pObj = 0; 1222 1223 while( (pObj = rShapeList.getNextShape(pObj)) != 0 ) 1224 { 1225 if( pMaster->GetPresObjKind(pObj) == PRESOBJ_HANDOUT ) 1226 { 1227 // #i105146# We want no content to be displayed for PK_HANDOUT, 1228 // so just never set a page as content 1229 static_cast<SdrPageObj*>(pObj)->SetReferencedPage(0); 1230 } 1231 } 1232 } 1233 } 1234 1235 Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel(); 1236 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) ); 1237 VisAreaChanged(aVisAreaWin); 1238 mpDrawView->VisAreaChanged(GetActiveWindow()); 1239 1240 // Damit der Navigator (und das Effekte-Window) das mitbekommt (/-men) 1241 SfxBindings& rBindings = GetViewFrame()->GetBindings(); 1242 rBindings.Invalidate(SID_NAVIGATOR_PAGENAME, sal_True, sal_False); 1243 rBindings.Invalidate(SID_STATUS_PAGE, sal_True, sal_False); 1244 rBindings.Invalidate(SID_DELETE_MASTER_PAGE, sal_True, sal_False); 1245 rBindings.Invalidate(SID_DELETE_PAGE, sal_True, sal_False); 1246 rBindings.Invalidate(SID_ASSIGN_LAYOUT,sal_True,sal_False); 1247 rBindings.Invalidate(SID_INSERTPAGE,sal_True,sal_False); 1248 UpdatePreview( mpActualPage ); 1249 1250 mpDrawView->AdjustMarkHdl(); 1251 } 1252 1253 return (bOK); 1254 } 1255 1256 1257 /************************************************************************* 1258 |* 1259 |* Pruefen, ob ein Seitenwechsel erlaubt ist 1260 |* 1261 \************************************************************************/ 1262 1263 sal_Bool DrawViewShell::IsSwitchPageAllowed() const 1264 { 1265 bool bOK = true; 1266 1267 FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); 1268 if (pFormShell!=NULL && !pFormShell->PrepareClose (sal_False)) 1269 bOK = false; 1270 1271 return bOK; 1272 } 1273 1274 /************************************************************************* 1275 |* 1276 |* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert 1277 |* hat (z. B. durch Undo) 1278 |* 1279 \************************************************************************/ 1280 1281 void DrawViewShell::ResetActualLayer() 1282 { 1283 LayerTabBar* pLayerBar = GetLayerTabControl(); 1284 if (pLayerBar != NULL) 1285 { 1286 // remember old layer cound and current layer id 1287 // this is needed when one layer is renamed to 1288 // restore current layer 1289 sal_uInt16 nOldLayerCnt = pLayerBar->GetPageCount(); 1290 sal_uInt16 nOldLayerId = pLayerBar->GetCurPageId(); 1291 1292 /************************************************************* 1293 * Update fuer LayerTab 1294 *************************************************************/ 1295 pLayerBar->Clear(); 1296 1297 String aName; 1298 String aActiveLayer = mpDrawView->GetActiveLayer(); 1299 String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) ); 1300 String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) ); 1301 String aLayoutLayer( SdResId(STR_LAYER_LAYOUT) ); 1302 String aControlsLayer( SdResId(STR_LAYER_CONTROLS) ); 1303 String aMeasureLinesLayer( SdResId(STR_LAYER_MEASURELINES) ); 1304 sal_uInt16 nActiveLayer = SDRLAYER_NOTFOUND; 1305 SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin(); 1306 sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount(); 1307 1308 for ( sal_uInt16 nLayer = 0; nLayer < nLayerCnt; nLayer++ ) 1309 { 1310 aName = rLayerAdmin.GetLayer(nLayer)->GetName(); 1311 1312 if ( aName == aActiveLayer ) 1313 { 1314 nActiveLayer = nLayer; 1315 } 1316 1317 if ( aName != aBackgroundLayer ) 1318 { 1319 if (meEditMode == EM_MASTERPAGE) 1320 { 1321 // Layer der Page nicht auf MasterPage anzeigen 1322 if (aName != aLayoutLayer && 1323 aName != aControlsLayer && 1324 aName != aMeasureLinesLayer) 1325 { 1326 pLayerBar->InsertPage(nLayer+1, aName); 1327 1328 TabBarPageBits nBits = 0; 1329 SdrPageView* pPV = mpDrawView->GetSdrPageView(); 1330 1331 if (pPV && !pPV->IsLayerVisible(aName)) 1332 { 1333 // Unsichtbare Layer werden anders dargestellt 1334 nBits = TPB_SPECIAL; 1335 } 1336 1337 pLayerBar->SetPageBits(nLayer+1, nBits); 1338 } 1339 } 1340 else 1341 { 1342 // Layer der MasterPage nicht auf Page anzeigen 1343 if ( aName != aBackgroundObjLayer ) 1344 { 1345 pLayerBar->InsertPage(nLayer+1, aName); 1346 1347 TabBarPageBits nBits = 0; 1348 1349 if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName)) 1350 { 1351 // Unsichtbare Layer werden anders dargestellt 1352 nBits = TPB_SPECIAL; 1353 } 1354 1355 pLayerBar->SetPageBits(nLayer+1, nBits); 1356 } 1357 } 1358 } 1359 } 1360 1361 if ( nActiveLayer == SDRLAYER_NOTFOUND ) 1362 { 1363 if( nOldLayerCnt == pLayerBar->GetPageCount() ) 1364 { 1365 nActiveLayer = nOldLayerId - 1; 1366 } 1367 else 1368 { 1369 nActiveLayer = ( meEditMode == EM_MASTERPAGE ) ? 2 : 0; 1370 } 1371 1372 mpDrawView->SetActiveLayer( pLayerBar->GetPageText(nActiveLayer + 1) ); 1373 } 1374 1375 pLayerBar->SetCurPageId(nActiveLayer + 1); 1376 GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER ); 1377 GetViewFrame()->GetBindings().Invalidate( SID_DELETE_LAYER ); 1378 } 1379 } 1380 1381 /************************************************************************* 1382 |* 1383 |* Verzoegertes Close ausfuehren 1384 |* 1385 \************************************************************************/ 1386 1387 IMPL_LINK( DrawViewShell, CloseHdl, Timer*, pTimer ) 1388 { 1389 pTimer->Stop(); 1390 GetViewFrame()->GetBindings().Execute( SID_CLOSEWIN ); 1391 return 0L; 1392 } 1393 1394 /************************************************************************* 1395 |* 1396 |* AcceptDrop 1397 |* 1398 \************************************************************************/ 1399 1400 sal_Int8 DrawViewShell::AcceptDrop ( 1401 const AcceptDropEvent& rEvt, 1402 DropTargetHelper& rTargetHelper, 1403 ::sd::Window* pTargetWindow, 1404 sal_uInt16 nPage, 1405 sal_uInt16 nLayer ) 1406 { 1407 if( nPage != SDRPAGE_NOTFOUND ) 1408 nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum(); 1409 1410 if( SlideShow::IsRunning( GetViewShellBase() ) ) 1411 return DND_ACTION_NONE; 1412 1413 return mpDrawView->AcceptDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ); 1414 } 1415 1416 /************************************************************************* 1417 |* 1418 |* ExecuteDrop 1419 |* 1420 \************************************************************************/ 1421 1422 sal_Int8 DrawViewShell::ExecuteDrop ( 1423 const ExecuteDropEvent& rEvt, 1424 DropTargetHelper& rTargetHelper, 1425 ::sd::Window* pTargetWindow, 1426 sal_uInt16 nPage, 1427 sal_uInt16 nLayer) 1428 { 1429 if( nPage != SDRPAGE_NOTFOUND ) 1430 nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum(); 1431 1432 if( SlideShow::IsRunning( GetViewShellBase() ) ) 1433 return DND_ACTION_NONE; 1434 1435 Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START)); 1436 sal_Int8 nResult (mpDrawView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer )); 1437 Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END)); 1438 1439 return nResult; 1440 } 1441 1442 } // end of namespace sd 1443 1444 #ifdef _MSC_VER 1445 #if (_MSC_VER < 1400) 1446 #pragma optimize ( "", on ) 1447 #endif 1448 #endif 1449 1450