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