1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew 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 { 151cdf0e10cSrcweir ViewShell::Deactivate(bIsMDIActivate); 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 396cdf0e10cSrcweir meEditMode = eEMode; 397cdf0e10cSrcweir mbIsLayerModeActive = bIsLayerModeActive; 398cdf0e10cSrcweir 399cdf0e10cSrcweir // Determine whether to show the master view toolbar. The master 400cdf0e10cSrcweir // page mode has to be active and the shell must not be a handout 401cdf0e10cSrcweir // view. 402cdf0e10cSrcweir bool bShowMasterViewToolbar (meEditMode == EM_MASTERPAGE 403cdf0e10cSrcweir && GetShellType() != ViewShell::ST_HANDOUT); 404cdf0e10cSrcweir 405cdf0e10cSrcweir // If the master view toolbar is not shown we hide it before 406cdf0e10cSrcweir // switching the edit mode. 407cdf0e10cSrcweir if (::sd::ViewShell::mpImpl->mbIsInitialized 408cdf0e10cSrcweir && IsMainViewShell() 409cdf0e10cSrcweir && ! bShowMasterViewToolbar) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::TBG_MASTER_MODE); 412cdf0e10cSrcweir } 413cdf0e10cSrcweir 414cdf0e10cSrcweir if (meEditMode == EM_PAGE) 415cdf0e10cSrcweir { 416cdf0e10cSrcweir /****************************************************************** 417cdf0e10cSrcweir * PAGEMODE 418cdf0e10cSrcweir ******************************************************************/ 419cdf0e10cSrcweir 420cdf0e10cSrcweir maTabControl.Clear(); 421cdf0e10cSrcweir 422cdf0e10cSrcweir SdPage* pPage; 423cdf0e10cSrcweir String aPageName; 424cdf0e10cSrcweir sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); 425cdf0e10cSrcweir 426cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nPageCnt; i++) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir pPage = GetDoc()->GetSdPage(i, mePageKind); 429cdf0e10cSrcweir aPageName = pPage->GetName(); 430cdf0e10cSrcweir maTabControl.InsertPage(i + 1, aPageName); 431cdf0e10cSrcweir 432cdf0e10cSrcweir if ( pPage->IsSelected() && nActualPageNum == 0 ) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir nActualPageNum = i; 435cdf0e10cSrcweir } 436cdf0e10cSrcweir } 437cdf0e10cSrcweir 438cdf0e10cSrcweir maTabControl.SetCurPageId(nActualPageNum + 1); 439cdf0e10cSrcweir 440cdf0e10cSrcweir SwitchPage(nActualPageNum); 441cdf0e10cSrcweir } 442cdf0e10cSrcweir else 443cdf0e10cSrcweir { 444cdf0e10cSrcweir /****************************************************************** 445cdf0e10cSrcweir * MASTERPAGE 446cdf0e10cSrcweir ******************************************************************/ 447cdf0e10cSrcweir GetViewFrame()->SetChildWindow( 448cdf0e10cSrcweir AnimationChildWindow::GetChildWindowId(), sal_False ); 449cdf0e10cSrcweir 450cdf0e10cSrcweir if (!mpActualPage) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir // Sofern es keine mpActualPage gibt, wird die erste genommen 453cdf0e10cSrcweir mpActualPage = GetDoc()->GetSdPage(0, mePageKind); 454cdf0e10cSrcweir } 455cdf0e10cSrcweir 456cdf0e10cSrcweir maTabControl.Clear(); 457cdf0e10cSrcweir sal_uInt16 nActualMasterPageNum = 0; 458cdf0e10cSrcweir sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); 459cdf0e10cSrcweir 460cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nMasterPageCnt; i++) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind); 463cdf0e10cSrcweir String aLayoutName(pMaster->GetLayoutName()); 464cdf0e10cSrcweir aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR)); 465cdf0e10cSrcweir 466cdf0e10cSrcweir maTabControl.InsertPage(i + 1, aLayoutName); 467cdf0e10cSrcweir 468cdf0e10cSrcweir if (&(mpActualPage->TRG_GetMasterPage()) == pMaster) 469cdf0e10cSrcweir { 470cdf0e10cSrcweir nActualMasterPageNum = i; 471cdf0e10cSrcweir } 472cdf0e10cSrcweir } 473cdf0e10cSrcweir 474cdf0e10cSrcweir maTabControl.SetCurPageId(nActualMasterPageNum + 1); 475cdf0e10cSrcweir SwitchPage(nActualMasterPageNum); 476cdf0e10cSrcweir } 477cdf0e10cSrcweir 478cdf0e10cSrcweir // If the master view toolbar is to be shown we turn it on after the 479cdf0e10cSrcweir // edit mode has been changed. 480cdf0e10cSrcweir if (::sd::ViewShell::mpImpl->mbIsInitialized 481cdf0e10cSrcweir && IsMainViewShell() 482cdf0e10cSrcweir && bShowMasterViewToolbar) 483cdf0e10cSrcweir { 484cdf0e10cSrcweir GetViewShellBase().GetToolBarManager()->SetToolBar( 485cdf0e10cSrcweir ToolBarManager::TBG_MASTER_MODE, 486cdf0e10cSrcweir ToolBarManager::msMasterViewToolBar); 487cdf0e10cSrcweir } 488cdf0e10cSrcweir 489cdf0e10cSrcweir if ( ! mbIsLayerModeActive) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir maTabControl.Show(); 492cdf0e10cSrcweir // Set the tab control only for draw pages. For master page 493cdf0e10cSrcweir // this has been done already above. 494cdf0e10cSrcweir if (meEditMode == EM_PAGE) 495cdf0e10cSrcweir maTabControl.SetCurPageId (nActualPageNum + 1); 496cdf0e10cSrcweir } 497cdf0e10cSrcweir /*AF: The LayerDialogChildWindow is not used anymore (I hope). 498cdf0e10cSrcweir if (GetViewFrame()->KnowsChildWindow( 499cdf0e10cSrcweir LayerDialogChildWindow::GetChildWindowId())) 500cdf0e10cSrcweir { 501cdf0e10cSrcweir GetViewFrame()->SetChildWindow( 502cdf0e10cSrcweir LayerDialogChildWindow::GetChildWindowId(), 503cdf0e10cSrcweir IsLayerModeActive()); 504cdf0e10cSrcweir } 505cdf0e10cSrcweir */ 506cdf0e10cSrcweir ResetActualLayer(); 507cdf0e10cSrcweir 508cdf0e10cSrcweir Invalidate( SID_PAGEMODE ); 509cdf0e10cSrcweir Invalidate( SID_LAYERMODE ); 510cdf0e10cSrcweir Invalidate( SID_MASTERPAGE ); 511cdf0e10cSrcweir Invalidate( SID_DELETE_MASTER_PAGE ); 512cdf0e10cSrcweir Invalidate( SID_DELETE_PAGE ); 513cdf0e10cSrcweir Invalidate( SID_SLIDE_MASTERPAGE ); 514cdf0e10cSrcweir Invalidate( SID_TITLE_MASTERPAGE ); 515cdf0e10cSrcweir Invalidate( SID_NOTES_MASTERPAGE ); 516cdf0e10cSrcweir Invalidate( SID_HANDOUT_MASTERPAGE ); 517cdf0e10cSrcweir } 518cdf0e10cSrcweir } 519cdf0e10cSrcweir 520cdf0e10cSrcweir 521cdf0e10cSrcweir 522cdf0e10cSrcweir 523cdf0e10cSrcweir bool DrawViewShell::IsLayerModeActive (void) const 524cdf0e10cSrcweir { 525cdf0e10cSrcweir return mbIsLayerModeActive; 526cdf0e10cSrcweir } 527cdf0e10cSrcweir 528cdf0e10cSrcweir 529cdf0e10cSrcweir 530cdf0e10cSrcweir 531cdf0e10cSrcweir /************************************************************************* 532cdf0e10cSrcweir |* 533cdf0e10cSrcweir |* Groesse des TabControls und der ModeButtons zurueckgeben 534cdf0e10cSrcweir |* 535cdf0e10cSrcweir \************************************************************************/ 536cdf0e10cSrcweir 537cdf0e10cSrcweir long DrawViewShell::GetHCtrlWidth() 538cdf0e10cSrcweir { 539cdf0e10cSrcweir // return maTabControl.GetSizePixel().Width(); 540cdf0e10cSrcweir return 0; 541cdf0e10cSrcweir } 542cdf0e10cSrcweir 543cdf0e10cSrcweir 544cdf0e10cSrcweir /************************************************************************* 545cdf0e10cSrcweir |* 546cdf0e10cSrcweir |* Horizontales Lineal erzeugen 547cdf0e10cSrcweir |* 548cdf0e10cSrcweir \************************************************************************/ 549cdf0e10cSrcweir 550cdf0e10cSrcweir SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin, sal_Bool bIsFirst) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir Ruler* pRuler; 553cdf0e10cSrcweir WinBits aWBits; 554cdf0e10cSrcweir sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT; 555cdf0e10cSrcweir 556cdf0e10cSrcweir if ( bIsFirst ) 557cdf0e10cSrcweir { 558cdf0e10cSrcweir aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER | WB_EXTRAFIELD; 559cdf0e10cSrcweir nFlags |= ( SVXRULER_SUPPORT_SET_NULLOFFSET | 560cdf0e10cSrcweir SVXRULER_SUPPORT_TABS | 561cdf0e10cSrcweir SVXRULER_SUPPORT_PARAGRAPH_MARGINS ); // Neu 562cdf0e10cSrcweir } 563cdf0e10cSrcweir else 564cdf0e10cSrcweir aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER; 565cdf0e10cSrcweir 566cdf0e10cSrcweir pRuler = new Ruler (*this, GetParentWindow(), pWin, nFlags, 567cdf0e10cSrcweir GetViewFrame()->GetBindings(), aWBits); 568cdf0e10cSrcweir pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit()); 569cdf0e10cSrcweir 570cdf0e10cSrcweir // Metric ... 571cdf0e10cSrcweir sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit(); 572cdf0e10cSrcweir 573cdf0e10cSrcweir if( nMetric == 0xffff ) 574cdf0e10cSrcweir nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit(); 575cdf0e10cSrcweir 576cdf0e10cSrcweir pRuler->SetUnit( FieldUnit( nMetric ) ); 577cdf0e10cSrcweir 578cdf0e10cSrcweir // ... und auch DefTab am Lineal einstellen 579cdf0e10cSrcweir pRuler->SetDefTabDist( GetDoc()->GetDefaultTabulator() ); // Neu 580cdf0e10cSrcweir 581cdf0e10cSrcweir Fraction aUIScale(pWin->GetMapMode().GetScaleX()); 582cdf0e10cSrcweir aUIScale *= GetDoc()->GetUIScale(); 583cdf0e10cSrcweir pRuler->SetZoom(aUIScale); 584cdf0e10cSrcweir 585cdf0e10cSrcweir return pRuler; 586cdf0e10cSrcweir } 587cdf0e10cSrcweir 588cdf0e10cSrcweir /************************************************************************* 589cdf0e10cSrcweir |* 590cdf0e10cSrcweir |* Vertikales Lineal erzeugen 591cdf0e10cSrcweir |* 592cdf0e10cSrcweir \************************************************************************/ 593cdf0e10cSrcweir 594cdf0e10cSrcweir SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin) 595cdf0e10cSrcweir { 596cdf0e10cSrcweir Ruler* pRuler; 597cdf0e10cSrcweir WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER; 598cdf0e10cSrcweir sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT; 599cdf0e10cSrcweir 600cdf0e10cSrcweir pRuler = new Ruler(*this, GetParentWindow(), pWin, nFlags, 601cdf0e10cSrcweir GetViewFrame()->GetBindings(), aWBits); 602cdf0e10cSrcweir pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit()); 603cdf0e10cSrcweir 604cdf0e10cSrcweir // #96629# Metric same as HRuler, use document setting 605cdf0e10cSrcweir sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit(); 606cdf0e10cSrcweir 607cdf0e10cSrcweir if( nMetric == 0xffff ) 608cdf0e10cSrcweir nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit(); 609cdf0e10cSrcweir 610cdf0e10cSrcweir pRuler->SetUnit( FieldUnit( nMetric ) ); 611cdf0e10cSrcweir 612cdf0e10cSrcweir Fraction aUIScale(pWin->GetMapMode().GetScaleY()); 613cdf0e10cSrcweir aUIScale *= GetDoc()->GetUIScale(); 614cdf0e10cSrcweir pRuler->SetZoom(aUIScale); 615cdf0e10cSrcweir 616cdf0e10cSrcweir return pRuler; 617cdf0e10cSrcweir } 618cdf0e10cSrcweir 619cdf0e10cSrcweir /************************************************************************* 620cdf0e10cSrcweir |* 621cdf0e10cSrcweir |* Horizontales Lineal aktualisieren 622cdf0e10cSrcweir |* 623cdf0e10cSrcweir \************************************************************************/ 624cdf0e10cSrcweir 625cdf0e10cSrcweir void DrawViewShell::UpdateHRuler() 626cdf0e10cSrcweir { 627cdf0e10cSrcweir Invalidate( SID_ATTR_LONG_LRSPACE ); 628cdf0e10cSrcweir Invalidate( SID_RULER_PAGE_POS ); 629cdf0e10cSrcweir Invalidate( SID_RULER_OBJECT ); 630cdf0e10cSrcweir Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT ); 631cdf0e10cSrcweir 632cdf0e10cSrcweir if (mpHorizontalRuler.get() != NULL) 633cdf0e10cSrcweir mpHorizontalRuler->ForceUpdate(); 634cdf0e10cSrcweir } 635cdf0e10cSrcweir 636cdf0e10cSrcweir /************************************************************************* 637cdf0e10cSrcweir |* 638cdf0e10cSrcweir |* Vertikales Lineal aktualisieren 639cdf0e10cSrcweir |* 640cdf0e10cSrcweir \************************************************************************/ 641cdf0e10cSrcweir 642cdf0e10cSrcweir void DrawViewShell::UpdateVRuler() 643cdf0e10cSrcweir { 644cdf0e10cSrcweir Invalidate( SID_ATTR_LONG_LRSPACE ); 645cdf0e10cSrcweir Invalidate( SID_RULER_PAGE_POS ); 646cdf0e10cSrcweir Invalidate( SID_RULER_OBJECT ); 647cdf0e10cSrcweir 648cdf0e10cSrcweir if (mpVerticalRuler.get() != NULL) 649cdf0e10cSrcweir mpVerticalRuler->ForceUpdate(); 650cdf0e10cSrcweir } 651cdf0e10cSrcweir 652cdf0e10cSrcweir /************************************************************************* 653cdf0e10cSrcweir |* 654cdf0e10cSrcweir |* Metrik setzen 655cdf0e10cSrcweir |* 656cdf0e10cSrcweir \************************************************************************/ 657cdf0e10cSrcweir 658cdf0e10cSrcweir void DrawViewShell::SetUIUnit(FieldUnit eUnit) 659cdf0e10cSrcweir { 660cdf0e10cSrcweir ViewShell::SetUIUnit(eUnit); 661cdf0e10cSrcweir } 662cdf0e10cSrcweir 663cdf0e10cSrcweir /************************************************************************* 664cdf0e10cSrcweir |* 665cdf0e10cSrcweir |* TabControl nach Splitteraenderung aktualisieren 666cdf0e10cSrcweir |* 667cdf0e10cSrcweir \************************************************************************/ 668cdf0e10cSrcweir 669cdf0e10cSrcweir IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab ) 670cdf0e10cSrcweir { 671cdf0e10cSrcweir const long int nMax = maViewSize.Width() - maScrBarWH.Width() 672cdf0e10cSrcweir - maTabControl.GetPosPixel().X() ; 673cdf0e10cSrcweir 674cdf0e10cSrcweir Size aTabSize = maTabControl.GetSizePixel(); 675cdf0e10cSrcweir aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1)); 676cdf0e10cSrcweir 677cdf0e10cSrcweir maTabControl.SetSizePixel(aTabSize); 678cdf0e10cSrcweir GetLayerTabControl()->SetSizePixel(aTabSize); 679cdf0e10cSrcweir 680cdf0e10cSrcweir Point aPos = maTabControl.GetPosPixel(); 681cdf0e10cSrcweir aPos.X() += aTabSize.Width(); 682cdf0e10cSrcweir 683cdf0e10cSrcweir Size aScrSize(nMax - aTabSize.Width(), maScrBarWH.Height()); 684cdf0e10cSrcweir mpHorizontalScrollBar->SetPosSizePixel(aPos, aScrSize); 685cdf0e10cSrcweir 686cdf0e10cSrcweir return 0; 687cdf0e10cSrcweir } 688cdf0e10cSrcweir 689cdf0e10cSrcweir /// inherited from sd::ViewShell 690cdf0e10cSrcweir SdPage* DrawViewShell::getCurrentPage() const 691cdf0e10cSrcweir { 692cdf0e10cSrcweir const sal_Int32 nPageCount = (meEditMode == EM_PAGE)? 693cdf0e10cSrcweir GetDoc()->GetSdPageCount(mePageKind): 694cdf0e10cSrcweir GetDoc()->GetMasterSdPageCount(mePageKind); 695cdf0e10cSrcweir 696cdf0e10cSrcweir sal_Int32 nCurrentPage = maTabControl.GetCurPageId() - 1; 697cdf0e10cSrcweir DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" ); 698cdf0e10cSrcweir if( (nPageCount < 0) || (nCurrentPage>=nPageCount) ) 699cdf0e10cSrcweir nCurrentPage = 0; // play safe here 700cdf0e10cSrcweir 701cdf0e10cSrcweir if (meEditMode == EM_PAGE) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir return GetDoc()->GetSdPage((sal_uInt16)nCurrentPage, mePageKind); 704cdf0e10cSrcweir } 705cdf0e10cSrcweir else // EM_MASTERPAGE 706cdf0e10cSrcweir { 707cdf0e10cSrcweir return GetDoc()->GetMasterSdPage((sal_uInt16)nCurrentPage, mePageKind); 708cdf0e10cSrcweir } 709cdf0e10cSrcweir } 710cdf0e10cSrcweir 711cdf0e10cSrcweir /************************************************************************* 712cdf0e10cSrcweir |* 713cdf0e10cSrcweir |* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert 714cdf0e10cSrcweir |* hat (z. B. durch Undo) 715cdf0e10cSrcweir |* 716cdf0e10cSrcweir \************************************************************************/ 717cdf0e10cSrcweir 718cdf0e10cSrcweir void DrawViewShell::ResetActualPage() 719cdf0e10cSrcweir { 720cdf0e10cSrcweir sal_uInt16 nCurrentPage = maTabControl.GetCurPageId() - 1; 721cdf0e10cSrcweir sal_uInt16 nPageCount = (meEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind); 722cdf0e10cSrcweir if (nPageCount > 0) 723cdf0e10cSrcweir nCurrentPage = Min((sal_uInt16)(nPageCount - 1), nCurrentPage); 724cdf0e10cSrcweir else 725cdf0e10cSrcweir nCurrentPage = 0; 726cdf0e10cSrcweir 727cdf0e10cSrcweir if (meEditMode == EM_PAGE) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir 730cdf0e10cSrcweir // Update fuer TabControl 731cdf0e10cSrcweir maTabControl.Clear(); 732cdf0e10cSrcweir 733cdf0e10cSrcweir SdPage* pPage = NULL; 734cdf0e10cSrcweir String aPageName; 735cdf0e10cSrcweir 736cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nPageCount; i++) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir pPage = GetDoc()->GetSdPage(i, mePageKind); 739cdf0e10cSrcweir aPageName = pPage->GetName(); 740cdf0e10cSrcweir maTabControl.InsertPage(i + 1, aPageName); 741cdf0e10cSrcweir 742cdf0e10cSrcweir // Selektionskennungen der Seiten korrigieren 743cdf0e10cSrcweir GetDoc()->SetSelected(pPage, i == nCurrentPage); 744cdf0e10cSrcweir } 745cdf0e10cSrcweir 746cdf0e10cSrcweir maTabControl.SetCurPageId(nCurrentPage + 1); 747cdf0e10cSrcweir } 748cdf0e10cSrcweir else // EM_MASTERPAGE 749cdf0e10cSrcweir { 750cdf0e10cSrcweir SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind); 751cdf0e10cSrcweir maTabControl.Clear(); 752cdf0e10cSrcweir sal_uInt16 nActualMasterPageNum = 0; 753cdf0e10cSrcweir 754cdf0e10cSrcweir sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); 755cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nMasterPageCnt; i++) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind); 758cdf0e10cSrcweir String aLayoutName(pMaster->GetLayoutName()); 759cdf0e10cSrcweir aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR)); 760cdf0e10cSrcweir maTabControl.InsertPage(i + 1, aLayoutName); 761cdf0e10cSrcweir 762cdf0e10cSrcweir if (pActualPage == pMaster) 763cdf0e10cSrcweir nActualMasterPageNum = i; 764cdf0e10cSrcweir } 765cdf0e10cSrcweir 766cdf0e10cSrcweir maTabControl.SetCurPageId(nActualMasterPageNum + 1); 767cdf0e10cSrcweir SwitchPage(nActualMasterPageNum); 768cdf0e10cSrcweir } 769cdf0e10cSrcweir 770cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHPAGE, 771cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 772cdf0e10cSrcweir } 773cdf0e10cSrcweir 774cdf0e10cSrcweir /************************************************************************* 775cdf0e10cSrcweir |* 776cdf0e10cSrcweir |* Verb auf OLE-Objekt anwenden 777cdf0e10cSrcweir |* 778cdf0e10cSrcweir \************************************************************************/ 779cdf0e10cSrcweir 780cdf0e10cSrcweir 781cdf0e10cSrcweir ErrCode DrawViewShell::DoVerb(long nVerb) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir if ( mpDrawView->AreObjectsMarked() ) 784cdf0e10cSrcweir { 785cdf0e10cSrcweir const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 786cdf0e10cSrcweir 787cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 788cdf0e10cSrcweir { 789cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 790cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 791cdf0e10cSrcweir 792cdf0e10cSrcweir sal_uInt32 nInv = pObj->GetObjInventor(); 793cdf0e10cSrcweir sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); 794cdf0e10cSrcweir 795cdf0e10cSrcweir if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir ActivateObject( (SdrOle2Obj*) pObj, nVerb); 798cdf0e10cSrcweir } 799cdf0e10cSrcweir #ifdef STARIMAGE_AVAILABLE 800cdf0e10cSrcweir else if (nInv = SdrInventor && nSdrObjKind == OBJ_GRAF && 801cdf0e10cSrcweir ((SdrGrafObj*) pObj)->GetGraphicType() == GRAPHIC_BITMAP && 802cdf0e10cSrcweir SFX_APP()->HasFeature(SFX_FEATURE_SIMAGE)) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir SdrGrafObj* pSdrGrafObj = (SdrGrafObj*) pObj; 805cdf0e10cSrcweir short nOK = RET_YES; 806cdf0e10cSrcweir 807cdf0e10cSrcweir if ( pSdrGrafObj->GetFileName().Len() ) 808cdf0e10cSrcweir { 809cdf0e10cSrcweir // Graphik ist gelinkt, soll der Link aufgehoben werden? 810cdf0e10cSrcweir QueryBox aBox(pWindow, WB_YES_NO | WB_DEF_YES, 811cdf0e10cSrcweir String( SdResId(STR_REMOVE_LINK) ) ); 812cdf0e10cSrcweir nOK = aBox.Execute(); 813cdf0e10cSrcweir 814cdf0e10cSrcweir if (nOK == RET_YES) 815cdf0e10cSrcweir { 816cdf0e10cSrcweir // Link aufheben (File- und Filtername zuruecksetzen) 817cdf0e10cSrcweir pSdrGrafObj->SetGraphicLink(String(), String()); 818cdf0e10cSrcweir } 819cdf0e10cSrcweir } 820cdf0e10cSrcweir 821cdf0e10cSrcweir if (nOK == RET_YES) 822cdf0e10cSrcweir { 823cdf0e10cSrcweir /************************************************************** 824cdf0e10cSrcweir * OLE-Objekt erzeugen, StarImage starten 825cdf0e10cSrcweir * Grafik-Objekt loeschen (durch OLE-Objekt ersetzt) 826cdf0e10cSrcweir **************************************************************/ 827cdf0e10cSrcweir //HMHmpDrView->HideMarkHdl(); 828cdf0e10cSrcweir 829cdf0e10cSrcweir SvStorageRef aStor = new SvStorage(String()); 830cdf0e10cSrcweir SvInPlaceObjectRef aNewIPObj = &((SvFactory*)SvInPlaceObject::ClassFactory()) 831cdf0e10cSrcweir ->CreateAndInit(SimModuleDummy::GetID(SOFFICE_FILEFORMAT_CURRENT), aStor); 832cdf0e10cSrcweir if ( aNewIPObj.Is() ) 833cdf0e10cSrcweir { 834cdf0e10cSrcweir SdrGrafObj* pTempSdrGrafObj = (SdrGrafObj*) pSdrGrafObj->Clone (); 835cdf0e10cSrcweir 836cdf0e10cSrcweir SvEmbeddedInfoObject * pInfo; 837cdf0e10cSrcweir pInfo = GetViewFrame()->GetObjectShell()-> 838cdf0e10cSrcweir InsertObject( aNewIPObj, String() ); 839cdf0e10cSrcweir 840cdf0e10cSrcweir String aName; 841cdf0e10cSrcweir if (pInfo) 842cdf0e10cSrcweir { 843cdf0e10cSrcweir aName = pInfo->GetObjName(); 844cdf0e10cSrcweir } 845cdf0e10cSrcweir 846cdf0e10cSrcweir Rectangle aRect = pObj->GetLogicRect(); 847cdf0e10cSrcweir SdrOle2Obj* pSdrOle2Obj = new SdrOle2Obj( aNewIPObj, 848cdf0e10cSrcweir aName, aRect ); 849cdf0e10cSrcweir 850cdf0e10cSrcweir SdrPageView* pPV = mpDrawView->GetSdrPageView(); 851cdf0e10cSrcweir 852cdf0e10cSrcweir pPV->GetObjList()->InsertObject( pSdrOle2Obj ); 853cdf0e10cSrcweir mpDrawView->ReplaceObjectAtView( pObj, *pPV, pTempSdrGrafObj ); 854cdf0e10cSrcweir 855cdf0e10cSrcweir pSdrOle2Obj->SetLogicRect(aRect); 856cdf0e10cSrcweir aNewIPObj->SetVisAreaSize(aRect.GetSize()); 857cdf0e10cSrcweir 858cdf0e10cSrcweir SimDLL::Update(aNewIPObj, pTempSdrGrafObj->GetGraphic(), pWindow); 859cdf0e10cSrcweir ActivateObject(pSdrOle2Obj, SVVERB_SHOW); 860cdf0e10cSrcweir 861cdf0e10cSrcweir Client* pClient = (Client*) GetIPClient(); 862cdf0e10cSrcweir 863cdf0e10cSrcweir if (pClient) 864cdf0e10cSrcweir pClient->SetSdrGrafObj( pTempSdrGrafObj ); 865cdf0e10cSrcweir } 866cdf0e10cSrcweir } 867cdf0e10cSrcweir } 868cdf0e10cSrcweir #endif 869cdf0e10cSrcweir } 870cdf0e10cSrcweir } 871cdf0e10cSrcweir 872cdf0e10cSrcweir return 0; 873cdf0e10cSrcweir } 874cdf0e10cSrcweir 875cdf0e10cSrcweir 876cdf0e10cSrcweir /************************************************************************* 877cdf0e10cSrcweir |* 878cdf0e10cSrcweir |* OLE-Object aktivieren 879cdf0e10cSrcweir |* 880cdf0e10cSrcweir \************************************************************************/ 881cdf0e10cSrcweir 882cdf0e10cSrcweir sal_Bool DrawViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) 883cdf0e10cSrcweir { 884cdf0e10cSrcweir sal_Bool bActivated = sal_False; 885cdf0e10cSrcweir 886cdf0e10cSrcweir if ( !GetDocSh()->IsUIActive() ) 887cdf0e10cSrcweir { 888cdf0e10cSrcweir ToolBarManager::UpdateLock aLock (GetViewShellBase().GetToolBarManager()); 889cdf0e10cSrcweir 890cdf0e10cSrcweir bActivated = ViewShell::ActivateObject(pObj, nVerb); 891cdf0e10cSrcweir 892cdf0e10cSrcweir OSL_ASSERT(GetViewShell()!=NULL); 893cdf0e10cSrcweir Client* pClient = static_cast<Client*>(GetViewShell()->GetIPClient()); 894cdf0e10cSrcweir if (pClient) 895cdf0e10cSrcweir pClient->SetSdrGrafObj(NULL); 896cdf0e10cSrcweir } 897cdf0e10cSrcweir 898cdf0e10cSrcweir return(bActivated); 899cdf0e10cSrcweir } 900cdf0e10cSrcweir 901cdf0e10cSrcweir /************************************************************************* 902cdf0e10cSrcweir |* 903cdf0e10cSrcweir |* Auf gewuenschte Seite schalten 904cdf0e10cSrcweir |* Der Parameter nSelectedPage bezieht sich auf den aktuellen EditMode 905cdf0e10cSrcweir |* 906cdf0e10cSrcweir \************************************************************************/ 907cdf0e10cSrcweir 908cdf0e10cSrcweir void LclResetFlag (bool& rbFlag) {rbFlag = false;} 909cdf0e10cSrcweir 910cdf0e10cSrcweir sal_Bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) 911cdf0e10cSrcweir { 912cdf0e10cSrcweir /** Under some circumstances there are nested calls to SwitchPage() and 913cdf0e10cSrcweir may crash the application (activation of form controls when the 914cdf0e10cSrcweir shell of the edit view is not on top of the shell stack, see issue 915cdf0e10cSrcweir 83888 for details.) Therefore the nested calls are ignored (they 916cdf0e10cSrcweir would jump to the wrong page anyway.) 917cdf0e10cSrcweir */ 918cdf0e10cSrcweir if (mbIsInSwitchPage) 919cdf0e10cSrcweir return sal_False; 920cdf0e10cSrcweir mbIsInSwitchPage = true; 921cdf0e10cSrcweir comphelper::ScopeGuard aGuard (::boost::bind(LclResetFlag, ::boost::ref(mbIsInSwitchPage))); 922cdf0e10cSrcweir 923cdf0e10cSrcweir if (GetActiveWindow()->IsInPaint()) 924cdf0e10cSrcweir { 925cdf0e10cSrcweir // Switching the current page while a Paint is being executed is 926cdf0e10cSrcweir // dangerous. So, post it for later execution and return. 927cdf0e10cSrcweir maAsynchronousSwitchPageCall.Post(::boost::bind( 928cdf0e10cSrcweir ::std::mem_fun(&DrawViewShell::SwitchPage), 929cdf0e10cSrcweir this, 930cdf0e10cSrcweir nSelectedPage)); 931cdf0e10cSrcweir return sal_False; 932cdf0e10cSrcweir } 933cdf0e10cSrcweir 934cdf0e10cSrcweir sal_Bool bOK = sal_False; 935cdf0e10cSrcweir 936cdf0e10cSrcweir // With the current implementation of FuSlideShow there is a problem 937cdf0e10cSrcweir // when it dsplays the show in a window: When the show is stopped it 938cdf0e10cSrcweir // returns at one point in time SDRPAGE_NOTFOUND as current page index. 939cdf0e10cSrcweir // Because FuSlideShow is currently being rewritten this bug is fixed 940cdf0e10cSrcweir // here. 941cdf0e10cSrcweir // This is not as bad a hack as it may look because making SwitchPage() 942cdf0e10cSrcweir // more robust with respect to invalid page numbers is a good thing 943cdf0e10cSrcweir // anyway. 944cdf0e10cSrcweir if (nSelectedPage == SDRPAGE_NOTFOUND) 945cdf0e10cSrcweir { 946cdf0e10cSrcweir nSelectedPage = 0; 947cdf0e10cSrcweir } 948cdf0e10cSrcweir else 949cdf0e10cSrcweir { 950cdf0e10cSrcweir // Make sure that the given page index points to an existing page. Move 951cdf0e10cSrcweir // the index into the valid range if necessary. 952cdf0e10cSrcweir sal_uInt16 nPageCount = (meEditMode == EM_PAGE) 953cdf0e10cSrcweir ? GetDoc()->GetSdPageCount(mePageKind) 954cdf0e10cSrcweir : GetDoc()->GetMasterSdPageCount(mePageKind); 955cdf0e10cSrcweir if (nSelectedPage >= nPageCount) 956cdf0e10cSrcweir nSelectedPage = nPageCount-1; 957cdf0e10cSrcweir } 958cdf0e10cSrcweir 959cdf0e10cSrcweir if (IsSwitchPageAllowed()) 960cdf0e10cSrcweir { 961cdf0e10cSrcweir ModifyGuard aGuard2( GetDoc() ); 962cdf0e10cSrcweir 963cdf0e10cSrcweir bOK = sal_True; 964cdf0e10cSrcweir 965cdf0e10cSrcweir if (mpActualPage) 966cdf0e10cSrcweir { 967cdf0e10cSrcweir SdPage* pNewPage = NULL; 968cdf0e10cSrcweir 969cdf0e10cSrcweir if (meEditMode == EM_MASTERPAGE) 970cdf0e10cSrcweir { 971cdf0e10cSrcweir if( GetDoc()->GetMasterSdPageCount(mePageKind) > nSelectedPage ) 972cdf0e10cSrcweir pNewPage = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind); 973cdf0e10cSrcweir 974cdf0e10cSrcweir if( pNewPage ) 975cdf0e10cSrcweir { 976cdf0e10cSrcweir SdrPageView* pPV = mpDrawView->GetSdrPageView(); 977cdf0e10cSrcweir 978cdf0e10cSrcweir String sPageText (pNewPage->GetLayoutName()); 979cdf0e10cSrcweir sPageText.Erase(sPageText.SearchAscii(SD_LT_SEPARATOR)); 980cdf0e10cSrcweir if (pPV 981cdf0e10cSrcweir && pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() ) 982cdf0e10cSrcweir && sPageText == maTabControl.GetPageText(nSelectedPage+1)) 983cdf0e10cSrcweir { 984cdf0e10cSrcweir // this slide is already visible 985cdf0e10cSrcweir return sal_True; 986cdf0e10cSrcweir } 987cdf0e10cSrcweir } 988cdf0e10cSrcweir } 989cdf0e10cSrcweir else 990cdf0e10cSrcweir { 991cdf0e10cSrcweir OSL_ASSERT(mpFrameView!=NULL); 992cdf0e10cSrcweir mpFrameView->SetSelectedPage(nSelectedPage); 993cdf0e10cSrcweir 994cdf0e10cSrcweir if (GetDoc()->GetSdPageCount(mePageKind) > nSelectedPage) 995cdf0e10cSrcweir pNewPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind); 996cdf0e10cSrcweir 997cdf0e10cSrcweir if (mpActualPage == pNewPage) 998cdf0e10cSrcweir { 999cdf0e10cSrcweir SdrPageView* pPV = mpDrawView->GetSdrPageView(); 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir SdPage* pCurrentPage = dynamic_cast< SdPage* >( pPV->GetPage()); 1002cdf0e10cSrcweir if (pPV 1003cdf0e10cSrcweir && pNewPage == pCurrentPage 1004cdf0e10cSrcweir && pNewPage->GetName() == maTabControl.GetPageText(nSelectedPage+1)) 1005cdf0e10cSrcweir { 1006cdf0e10cSrcweir // this slide is already visible 1007cdf0e10cSrcweir return sal_True; 1008cdf0e10cSrcweir } 1009cdf0e10cSrcweir } 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir if( mpDrawView ) 1014cdf0e10cSrcweir mpDrawView->SdrEndTextEdit(); 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir mpActualPage = NULL; 1017cdf0e10cSrcweir 1018cdf0e10cSrcweir if (meEditMode == EM_PAGE) 1019cdf0e10cSrcweir { 1020cdf0e10cSrcweir mpActualPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind); 1021cdf0e10cSrcweir } 1022cdf0e10cSrcweir else 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind); 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir // Passt die selektierte Seite zur MasterPage? 1027cdf0e10cSrcweir sal_uInt16 nPageCount = GetDoc()->GetSdPageCount(mePageKind); 1028cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nPageCount; i++) 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); 1031cdf0e10cSrcweir if(pPage && pPage->IsSelected() && pMaster == &(pPage->TRG_GetMasterPage())) 1032cdf0e10cSrcweir { 1033cdf0e10cSrcweir mpActualPage = pPage; 1034cdf0e10cSrcweir break; 1035cdf0e10cSrcweir } 1036cdf0e10cSrcweir } 1037cdf0e10cSrcweir 1038cdf0e10cSrcweir if (!mpActualPage) 1039cdf0e10cSrcweir { 1040cdf0e10cSrcweir // Die erste Seite nehmen, welche zur MasterPage passt 1041cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nPageCount; i++) 1042cdf0e10cSrcweir { 1043cdf0e10cSrcweir SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); 1044cdf0e10cSrcweir if(pPage && pMaster == &(pPage->TRG_GetMasterPage())) 1045cdf0e10cSrcweir { 1046cdf0e10cSrcweir mpActualPage = pPage; 1047cdf0e10cSrcweir break; 1048cdf0e10cSrcweir } 1049cdf0e10cSrcweir } 1050cdf0e10cSrcweir } 1051cdf0e10cSrcweir } 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir for (sal_uInt16 i = 0; i < GetDoc()->GetSdPageCount(mePageKind); i++) 1054cdf0e10cSrcweir { 1055cdf0e10cSrcweir // Alle Seiten deselektieren 1056cdf0e10cSrcweir GetDoc()->SetSelected( GetDoc()->GetSdPage(i, mePageKind), sal_False); 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir 1059cdf0e10cSrcweir if (!mpActualPage) 1060cdf0e10cSrcweir { 1061cdf0e10cSrcweir // Sofern es keine mpActualPage gibt, wird die erste genommen 1062cdf0e10cSrcweir mpActualPage = GetDoc()->GetSdPage(0, mePageKind); 1063cdf0e10cSrcweir } 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir // diese Seite auch selektieren (mpActualPage zeigt immer auf Zeichenseite, 1066cdf0e10cSrcweir // nie auf eine Masterpage) 1067cdf0e10cSrcweir GetDoc()->SetSelected(mpActualPage, sal_True); 1068cdf0e10cSrcweir 1069cdf0e10cSrcweir rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) ); 1070cdf0e10cSrcweir if( !xSlideshow.is() || !xSlideshow->isRunning() || ( xSlideshow->getAnimationMode() != ANIMATIONMODE_SHOW ) ) 1071cdf0e10cSrcweir { 1072cdf0e10cSrcweir // VisArea zuziehen, um ggf. Objekte zu deaktivieren 1073cdf0e10cSrcweir // !!! only if we are not in presentation mode (#96279) !!! 1074cdf0e10cSrcweir OSL_ASSERT (GetViewShell()!=NULL); 1075cdf0e10cSrcweir GetViewShell()->DisconnectAllClients(); 1076cdf0e10cSrcweir VisAreaChanged(Rectangle(Point(), Size(1, 1))); 1077cdf0e10cSrcweir } 1078cdf0e10cSrcweir 1079cdf0e10cSrcweir if (meEditMode == EM_PAGE) 1080cdf0e10cSrcweir { 1081cdf0e10cSrcweir /********************************************************************** 1082cdf0e10cSrcweir * PAGEMODE 1083cdf0e10cSrcweir **********************************************************************/ 1084cdf0e10cSrcweir GetDoc()->SetSelected(mpActualPage, sal_True); 1085cdf0e10cSrcweir 1086cdf0e10cSrcweir SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir if (pPageView) 1089cdf0e10cSrcweir { 1090cdf0e10cSrcweir mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() ); 1091cdf0e10cSrcweir mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() ); 1092cdf0e10cSrcweir mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() ); 1093cdf0e10cSrcweir 1094cdf0e10cSrcweir if (mePageKind == PK_NOTES) 1095cdf0e10cSrcweir { 1096cdf0e10cSrcweir mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() ); 1097cdf0e10cSrcweir } 1098cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT) 1099cdf0e10cSrcweir { 1100cdf0e10cSrcweir mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() ); 1101cdf0e10cSrcweir } 1102cdf0e10cSrcweir else 1103cdf0e10cSrcweir { 1104cdf0e10cSrcweir mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() ); 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir } 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir mpDrawView->HideSdrPage(); 1109cdf0e10cSrcweir mpDrawView->ShowSdrPage(mpActualPage); 1110cdf0e10cSrcweir GetViewShellBase().GetDrawController().FireSwitchCurrentPage(mpActualPage); 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir SdrPageView* pNewPageView = mpDrawView->GetSdrPageView(); 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir if (pNewPageView) 1115cdf0e10cSrcweir { 1116cdf0e10cSrcweir pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() ); 1117cdf0e10cSrcweir pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() ); 1118cdf0e10cSrcweir pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() ); 1119cdf0e10cSrcweir 1120cdf0e10cSrcweir if (mePageKind == PK_NOTES) 1121cdf0e10cSrcweir { 1122cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() ); 1123cdf0e10cSrcweir } 1124cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT) 1125cdf0e10cSrcweir { 1126cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() ); 1127cdf0e10cSrcweir } 1128cdf0e10cSrcweir else 1129cdf0e10cSrcweir { 1130cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() ); 1131cdf0e10cSrcweir } 1132cdf0e10cSrcweir } 1133cdf0e10cSrcweir 1134cdf0e10cSrcweir maTabControl.SetCurPageId(nSelectedPage+1); 1135cdf0e10cSrcweir String aPageName = mpActualPage->GetName(); 1136cdf0e10cSrcweir 1137cdf0e10cSrcweir if (maTabControl.GetPageText(nSelectedPage+1) != aPageName) 1138cdf0e10cSrcweir { 1139cdf0e10cSrcweir maTabControl.SetPageText(nSelectedPage+1, aPageName); 1140cdf0e10cSrcweir } 1141cdf0e10cSrcweir } 1142cdf0e10cSrcweir else 1143cdf0e10cSrcweir { 1144cdf0e10cSrcweir /********************************************************************** 1145cdf0e10cSrcweir * MASTERPAGE 1146cdf0e10cSrcweir **********************************************************************/ 1147cdf0e10cSrcweir SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir if (pPageView) 1150cdf0e10cSrcweir { 1151cdf0e10cSrcweir mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() ); 1152cdf0e10cSrcweir mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() ); 1153cdf0e10cSrcweir mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() ); 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir if (mePageKind == PK_NOTES) 1156cdf0e10cSrcweir { 1157cdf0e10cSrcweir mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() ); 1158cdf0e10cSrcweir } 1159cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT) 1160cdf0e10cSrcweir { 1161cdf0e10cSrcweir mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() ); 1162cdf0e10cSrcweir } 1163cdf0e10cSrcweir else 1164cdf0e10cSrcweir { 1165cdf0e10cSrcweir mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() ); 1166cdf0e10cSrcweir } 1167cdf0e10cSrcweir } 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir mpDrawView->HideSdrPage(); 1170cdf0e10cSrcweir 1171cdf0e10cSrcweir SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind); 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir if( !pMaster ) // Falls es diese Page nicht geben sollte 1174cdf0e10cSrcweir pMaster = GetDoc()->GetMasterSdPage(0, mePageKind); 1175cdf0e10cSrcweir 1176cdf0e10cSrcweir sal_uInt16 nNum = pMaster->GetPageNum(); 1177cdf0e10cSrcweir mpDrawView->ShowSdrPage(mpDrawView->GetModel()->GetMasterPage(nNum)); 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir GetViewShellBase().GetDrawController().FireSwitchCurrentPage(pMaster); 1180cdf0e10cSrcweir 1181cdf0e10cSrcweir SdrPageView* pNewPageView = mpDrawView->GetSdrPageView(); 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir if (pNewPageView) 1184cdf0e10cSrcweir { 1185cdf0e10cSrcweir pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() ); 1186cdf0e10cSrcweir pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() ); 1187cdf0e10cSrcweir pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() ); 1188cdf0e10cSrcweir 1189cdf0e10cSrcweir if (mePageKind == PK_NOTES) 1190cdf0e10cSrcweir { 1191cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() ); 1192cdf0e10cSrcweir } 1193cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT) 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() ); 1196cdf0e10cSrcweir } 1197cdf0e10cSrcweir else 1198cdf0e10cSrcweir { 1199cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() ); 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir } 1202cdf0e10cSrcweir 1203cdf0e10cSrcweir String aLayoutName(pMaster->GetLayoutName()); 1204cdf0e10cSrcweir aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR)); 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir maTabControl.SetCurPageId(nSelectedPage+1); 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir if (maTabControl.GetPageText(nSelectedPage+1) != aLayoutName) 1209cdf0e10cSrcweir { 1210cdf0e10cSrcweir maTabControl.SetPageText(nSelectedPage+1, aLayoutName); 1211cdf0e10cSrcweir } 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir if( mePageKind == PK_HANDOUT ) 1214cdf0e10cSrcweir { 1215cdf0e10cSrcweir // set pages for all available handout presentation objects 1216cdf0e10cSrcweir sd::ShapeList& rShapeList = pMaster->GetPresentationShapeList(); 1217cdf0e10cSrcweir SdrObject* pObj = 0; 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir while( (pObj = rShapeList.getNextShape(pObj)) != 0 ) 1220cdf0e10cSrcweir { 1221cdf0e10cSrcweir if( pMaster->GetPresObjKind(pObj) == PRESOBJ_HANDOUT ) 1222cdf0e10cSrcweir { 1223cdf0e10cSrcweir // #i105146# We want no content to be displayed for PK_HANDOUT, 1224cdf0e10cSrcweir // so just never set a page as content 1225cdf0e10cSrcweir static_cast<SdrPageObj*>(pObj)->SetReferencedPage(0); 1226cdf0e10cSrcweir } 1227cdf0e10cSrcweir } 1228cdf0e10cSrcweir } 1229cdf0e10cSrcweir } 1230cdf0e10cSrcweir 1231cdf0e10cSrcweir Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel(); 1232cdf0e10cSrcweir Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) ); 1233cdf0e10cSrcweir VisAreaChanged(aVisAreaWin); 1234cdf0e10cSrcweir mpDrawView->VisAreaChanged(GetActiveWindow()); 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir // Damit der Navigator (und das Effekte-Window) das mitbekommt (/-men) 1237cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 1238cdf0e10cSrcweir rBindings.Invalidate(SID_NAVIGATOR_PAGENAME, sal_True, sal_False); 1239cdf0e10cSrcweir rBindings.Invalidate(SID_STATUS_PAGE, sal_True, sal_False); 1240cdf0e10cSrcweir rBindings.Invalidate(SID_DELETE_MASTER_PAGE, sal_True, sal_False); 1241cdf0e10cSrcweir rBindings.Invalidate(SID_DELETE_PAGE, sal_True, sal_False); 1242cdf0e10cSrcweir rBindings.Invalidate(SID_ASSIGN_LAYOUT,sal_True,sal_False); 1243cdf0e10cSrcweir rBindings.Invalidate(SID_INSERTPAGE,sal_True,sal_False); 1244cdf0e10cSrcweir UpdatePreview( mpActualPage ); 1245cdf0e10cSrcweir 1246cdf0e10cSrcweir mpDrawView->AdjustMarkHdl(); 1247cdf0e10cSrcweir } 1248cdf0e10cSrcweir 1249cdf0e10cSrcweir return (bOK); 1250cdf0e10cSrcweir } 1251cdf0e10cSrcweir 1252cdf0e10cSrcweir 1253cdf0e10cSrcweir /************************************************************************* 1254cdf0e10cSrcweir |* 1255cdf0e10cSrcweir |* Pruefen, ob ein Seitenwechsel erlaubt ist 1256cdf0e10cSrcweir |* 1257cdf0e10cSrcweir \************************************************************************/ 1258cdf0e10cSrcweir 1259cdf0e10cSrcweir sal_Bool DrawViewShell::IsSwitchPageAllowed() const 1260cdf0e10cSrcweir { 1261cdf0e10cSrcweir bool bOK = true; 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); 1264cdf0e10cSrcweir if (pFormShell!=NULL && !pFormShell->PrepareClose (sal_False)) 1265cdf0e10cSrcweir bOK = false; 1266cdf0e10cSrcweir 1267cdf0e10cSrcweir return bOK; 1268cdf0e10cSrcweir } 1269cdf0e10cSrcweir 1270cdf0e10cSrcweir /************************************************************************* 1271cdf0e10cSrcweir |* 1272cdf0e10cSrcweir |* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert 1273cdf0e10cSrcweir |* hat (z. B. durch Undo) 1274cdf0e10cSrcweir |* 1275cdf0e10cSrcweir \************************************************************************/ 1276cdf0e10cSrcweir 1277cdf0e10cSrcweir void DrawViewShell::ResetActualLayer() 1278cdf0e10cSrcweir { 1279cdf0e10cSrcweir LayerTabBar* pLayerBar = GetLayerTabControl(); 1280cdf0e10cSrcweir if (pLayerBar != NULL) 1281cdf0e10cSrcweir { 1282cdf0e10cSrcweir // remember old layer cound and current layer id 1283cdf0e10cSrcweir // this is needed when one layer is renamed to 1284cdf0e10cSrcweir // restore current layer 1285cdf0e10cSrcweir sal_uInt16 nOldLayerCnt = pLayerBar->GetPageCount(); 1286cdf0e10cSrcweir sal_uInt16 nOldLayerId = pLayerBar->GetCurPageId(); 1287cdf0e10cSrcweir 1288cdf0e10cSrcweir /************************************************************* 1289cdf0e10cSrcweir * Update fuer LayerTab 1290cdf0e10cSrcweir *************************************************************/ 1291cdf0e10cSrcweir pLayerBar->Clear(); 1292cdf0e10cSrcweir 1293cdf0e10cSrcweir String aName; 1294cdf0e10cSrcweir String aActiveLayer = mpDrawView->GetActiveLayer(); 1295cdf0e10cSrcweir String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) ); 1296cdf0e10cSrcweir String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) ); 1297cdf0e10cSrcweir String aLayoutLayer( SdResId(STR_LAYER_LAYOUT) ); 1298cdf0e10cSrcweir String aControlsLayer( SdResId(STR_LAYER_CONTROLS) ); 1299cdf0e10cSrcweir String aMeasureLinesLayer( SdResId(STR_LAYER_MEASURELINES) ); 1300cdf0e10cSrcweir sal_uInt16 nActiveLayer = SDRLAYER_NOTFOUND; 1301cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin(); 1302cdf0e10cSrcweir sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount(); 1303cdf0e10cSrcweir 1304cdf0e10cSrcweir for ( sal_uInt16 nLayer = 0; nLayer < nLayerCnt; nLayer++ ) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir aName = rLayerAdmin.GetLayer(nLayer)->GetName(); 1307cdf0e10cSrcweir 1308cdf0e10cSrcweir if ( aName == aActiveLayer ) 1309cdf0e10cSrcweir { 1310cdf0e10cSrcweir nActiveLayer = nLayer; 1311cdf0e10cSrcweir } 1312cdf0e10cSrcweir 1313cdf0e10cSrcweir if ( aName != aBackgroundLayer ) 1314cdf0e10cSrcweir { 1315cdf0e10cSrcweir if (meEditMode == EM_MASTERPAGE) 1316cdf0e10cSrcweir { 1317cdf0e10cSrcweir // Layer der Page nicht auf MasterPage anzeigen 1318cdf0e10cSrcweir if (aName != aLayoutLayer && 1319cdf0e10cSrcweir aName != aControlsLayer && 1320cdf0e10cSrcweir aName != aMeasureLinesLayer) 1321cdf0e10cSrcweir { 1322cdf0e10cSrcweir pLayerBar->InsertPage(nLayer+1, aName); 1323cdf0e10cSrcweir 1324cdf0e10cSrcweir TabBarPageBits nBits = 0; 1325cdf0e10cSrcweir SdrPageView* pPV = mpDrawView->GetSdrPageView(); 1326cdf0e10cSrcweir 1327cdf0e10cSrcweir if (pPV && !pPV->IsLayerVisible(aName)) 1328cdf0e10cSrcweir { 1329cdf0e10cSrcweir // Unsichtbare Layer werden anders dargestellt 1330cdf0e10cSrcweir nBits = TPB_SPECIAL; 1331cdf0e10cSrcweir } 1332cdf0e10cSrcweir 1333cdf0e10cSrcweir pLayerBar->SetPageBits(nLayer+1, nBits); 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir } 1336cdf0e10cSrcweir else 1337cdf0e10cSrcweir { 1338cdf0e10cSrcweir // Layer der MasterPage nicht auf Page anzeigen 1339cdf0e10cSrcweir if ( aName != aBackgroundObjLayer ) 1340cdf0e10cSrcweir { 1341cdf0e10cSrcweir pLayerBar->InsertPage(nLayer+1, aName); 1342cdf0e10cSrcweir 1343cdf0e10cSrcweir TabBarPageBits nBits = 0; 1344cdf0e10cSrcweir 1345cdf0e10cSrcweir if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName)) 1346cdf0e10cSrcweir { 1347cdf0e10cSrcweir // Unsichtbare Layer werden anders dargestellt 1348cdf0e10cSrcweir nBits = TPB_SPECIAL; 1349cdf0e10cSrcweir } 1350cdf0e10cSrcweir 1351cdf0e10cSrcweir pLayerBar->SetPageBits(nLayer+1, nBits); 1352cdf0e10cSrcweir } 1353cdf0e10cSrcweir } 1354cdf0e10cSrcweir } 1355cdf0e10cSrcweir } 1356cdf0e10cSrcweir 1357cdf0e10cSrcweir if ( nActiveLayer == SDRLAYER_NOTFOUND ) 1358cdf0e10cSrcweir { 1359cdf0e10cSrcweir if( nOldLayerCnt == pLayerBar->GetPageCount() ) 1360cdf0e10cSrcweir { 1361cdf0e10cSrcweir nActiveLayer = nOldLayerId - 1; 1362cdf0e10cSrcweir } 1363cdf0e10cSrcweir else 1364cdf0e10cSrcweir { 1365cdf0e10cSrcweir nActiveLayer = ( meEditMode == EM_MASTERPAGE ) ? 2 : 0; 1366cdf0e10cSrcweir } 1367cdf0e10cSrcweir 1368cdf0e10cSrcweir mpDrawView->SetActiveLayer( pLayerBar->GetPageText(nActiveLayer + 1) ); 1369cdf0e10cSrcweir } 1370cdf0e10cSrcweir 1371cdf0e10cSrcweir pLayerBar->SetCurPageId(nActiveLayer + 1); 1372cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER ); 1373cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( SID_DELETE_LAYER ); 1374cdf0e10cSrcweir } 1375cdf0e10cSrcweir } 1376cdf0e10cSrcweir 1377cdf0e10cSrcweir /************************************************************************* 1378cdf0e10cSrcweir |* 1379cdf0e10cSrcweir |* Verzoegertes Close ausfuehren 1380cdf0e10cSrcweir |* 1381cdf0e10cSrcweir \************************************************************************/ 1382cdf0e10cSrcweir 1383cdf0e10cSrcweir IMPL_LINK( DrawViewShell, CloseHdl, Timer*, pTimer ) 1384cdf0e10cSrcweir { 1385cdf0e10cSrcweir pTimer->Stop(); 1386cdf0e10cSrcweir GetViewFrame()->GetBindings().Execute( SID_CLOSEWIN ); 1387cdf0e10cSrcweir return 0L; 1388cdf0e10cSrcweir } 1389cdf0e10cSrcweir 1390cdf0e10cSrcweir /************************************************************************* 1391cdf0e10cSrcweir |* 1392cdf0e10cSrcweir |* AcceptDrop 1393cdf0e10cSrcweir |* 1394cdf0e10cSrcweir \************************************************************************/ 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir sal_Int8 DrawViewShell::AcceptDrop ( 1397cdf0e10cSrcweir const AcceptDropEvent& rEvt, 1398cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 1399cdf0e10cSrcweir ::sd::Window* pTargetWindow, 1400cdf0e10cSrcweir sal_uInt16 nPage, 1401cdf0e10cSrcweir sal_uInt16 nLayer ) 1402cdf0e10cSrcweir { 1403cdf0e10cSrcweir if( nPage != SDRPAGE_NOTFOUND ) 1404cdf0e10cSrcweir nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum(); 1405cdf0e10cSrcweir 1406cdf0e10cSrcweir if( SlideShow::IsRunning( GetViewShellBase() ) ) 1407cdf0e10cSrcweir return DND_ACTION_NONE; 1408cdf0e10cSrcweir 1409cdf0e10cSrcweir return mpDrawView->AcceptDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ); 1410cdf0e10cSrcweir } 1411cdf0e10cSrcweir 1412cdf0e10cSrcweir /************************************************************************* 1413cdf0e10cSrcweir |* 1414cdf0e10cSrcweir |* ExecuteDrop 1415cdf0e10cSrcweir |* 1416cdf0e10cSrcweir \************************************************************************/ 1417cdf0e10cSrcweir 1418cdf0e10cSrcweir sal_Int8 DrawViewShell::ExecuteDrop ( 1419cdf0e10cSrcweir const ExecuteDropEvent& rEvt, 1420cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 1421cdf0e10cSrcweir ::sd::Window* pTargetWindow, 1422cdf0e10cSrcweir sal_uInt16 nPage, 1423cdf0e10cSrcweir sal_uInt16 nLayer) 1424cdf0e10cSrcweir { 1425cdf0e10cSrcweir if( nPage != SDRPAGE_NOTFOUND ) 1426cdf0e10cSrcweir nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum(); 1427cdf0e10cSrcweir 1428cdf0e10cSrcweir if( SlideShow::IsRunning( GetViewShellBase() ) ) 1429cdf0e10cSrcweir return DND_ACTION_NONE; 1430cdf0e10cSrcweir 1431cdf0e10cSrcweir Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START)); 1432cdf0e10cSrcweir sal_Int8 nResult (mpDrawView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer )); 1433cdf0e10cSrcweir Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END)); 1434cdf0e10cSrcweir 1435cdf0e10cSrcweir return nResult; 1436cdf0e10cSrcweir } 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir } // end of namespace sd 1439cdf0e10cSrcweir 1440cdf0e10cSrcweir #ifdef _MSC_VER 1441cdf0e10cSrcweir #if (_MSC_VER < 1400) 1442cdf0e10cSrcweir #pragma optimize ( "", on ) 1443cdf0e10cSrcweir #endif 1444cdf0e10cSrcweir #endif 1445cdf0e10cSrcweir 1446