1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "DrawViewShell.hxx" 32*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 33*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 34*cdf0e10cSrcweir #ifndef _SVX_SIZEITEM 35*cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #include <svx/svdlayer.hxx> 38*cdf0e10cSrcweir #ifndef _SVX_ZOOMITEM 39*cdf0e10cSrcweir #include <svx/zoomitem.hxx> 40*cdf0e10cSrcweir #endif 41*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 42*cdf0e10cSrcweir #include <svl/ptitem.hxx> 43*cdf0e10cSrcweir #include <svl/stritem.hxx> 44*cdf0e10cSrcweir #include <sfx2/request.hxx> 45*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 46*cdf0e10cSrcweir #include <svx/svdopath.hxx> 47*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 48*cdf0e10cSrcweir #include <svx/zoomslideritem.hxx> 49*cdf0e10cSrcweir #include <svl/eitem.hxx> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #ifndef _SVX_DIALOGS_HRC 52*cdf0e10cSrcweir #include <svx/dialogs.hrc> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #include <svx/extrusionbar.hxx> 55*cdf0e10cSrcweir #include <svx/fontworkbar.hxx> 56*cdf0e10cSrcweir #include <svx/clipfmtitem.hxx> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 60*cdf0e10cSrcweir #include <svx/fmshell.hxx> 61*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 62*cdf0e10cSrcweir #include <svtools/cliplistener.hxx> 63*cdf0e10cSrcweir #include <svx/float3d.hxx> 64*cdf0e10cSrcweir #include "helpids.h" 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir #include "view/viewoverlaymanager.hxx" 67*cdf0e10cSrcweir #include "app.hrc" 68*cdf0e10cSrcweir #include "helpids.h" 69*cdf0e10cSrcweir #include "strings.hrc" 70*cdf0e10cSrcweir #include "res_bmp.hrc" 71*cdf0e10cSrcweir #include "sdpage.hxx" 72*cdf0e10cSrcweir #include "FrameView.hxx" 73*cdf0e10cSrcweir #include "drawdoc.hxx" 74*cdf0e10cSrcweir #include "sdresid.hxx" 75*cdf0e10cSrcweir #include "DrawDocShell.hxx" 76*cdf0e10cSrcweir #include "Window.hxx" 77*cdf0e10cSrcweir #include "fupoor.hxx" 78*cdf0e10cSrcweir #include "fusel.hxx" 79*cdf0e10cSrcweir #include "drawview.hxx" 80*cdf0e10cSrcweir #include "SdUnoDrawView.hxx" 81*cdf0e10cSrcweir #include "ViewShellBase.hxx" 82*cdf0e10cSrcweir #include "SdUnoDrawView.hxx" 83*cdf0e10cSrcweir #include "slideshow.hxx" 84*cdf0e10cSrcweir #include "ToolBarManager.hxx" 85*cdf0e10cSrcweir #include "annotationmanager.hxx" 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir using namespace ::rtl; 88*cdf0e10cSrcweir using namespace ::com::sun::star; 89*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir namespace { 92*cdf0e10cSrcweir static const ::rtl::OUString MASTER_VIEW_TOOL_BAR_NAME( 93*cdf0e10cSrcweir ::rtl::OUString::createFromAscii("masterviewtoolbar")); 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir namespace sd { 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir sal_Bool DrawViewShell::mbPipette = sal_False; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // ------------------------ 101*cdf0e10cSrcweir // - ScannerEventListener - 102*cdf0e10cSrcweir // ------------------------ 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir class ScannerEventListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener > 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir private: 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir DrawViewShell* mpParent; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir public: 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir ScannerEventListener( DrawViewShell* pParent ) : mpParent( pParent ) {}; 113*cdf0e10cSrcweir ~ScannerEventListener(); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir // XEventListener 116*cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEventObject ) throw (::com::sun::star::uno::RuntimeException); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir void ParentDestroyed() { mpParent = NULL; } 119*cdf0e10cSrcweir }; 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir ScannerEventListener::~ScannerEventListener() 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir void SAL_CALL ScannerEventListener::disposing( const ::com::sun::star::lang::EventObject& rEventObject ) throw (::com::sun::star::uno::RuntimeException) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir if( mpParent ) 132*cdf0e10cSrcweir mpParent->ScannerEvent( rEventObject ); 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir /************************************************************************* 136*cdf0e10cSrcweir |* 137*cdf0e10cSrcweir |* Standard-Konstruktor 138*cdf0e10cSrcweir |* 139*cdf0e10cSrcweir \************************************************************************/ 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument ) 142*cdf0e10cSrcweir : ViewShell (pFrame, pParentWindow, rViewShellBase) 143*cdf0e10cSrcweir , maTabControl(this, pParentWindow) 144*cdf0e10cSrcweir , mbIsInSwitchPage(false) 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir if (pFrameViewArgument != NULL) 147*cdf0e10cSrcweir mpFrameView = pFrameViewArgument; 148*cdf0e10cSrcweir else 149*cdf0e10cSrcweir mpFrameView = new FrameView(GetDoc()); 150*cdf0e10cSrcweir Construct(GetDocSh(), ePageKind); 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir /************************************************************************* 154*cdf0e10cSrcweir |* 155*cdf0e10cSrcweir |* Destruktor 156*cdf0e10cSrcweir |* 157*cdf0e10cSrcweir \************************************************************************/ 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir DrawViewShell::~DrawViewShell() 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir mpAnnotationManager.reset(); 162*cdf0e10cSrcweir mpViewOverlayManager.reset(); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir OSL_ASSERT (GetViewShell()!=NULL); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir if( mxScannerListener.is() ) 167*cdf0e10cSrcweir static_cast< ScannerEventListener* >( mxScannerListener.get() )->ParentDestroyed(); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir // #96642# Remove references to items within Svx3DWin 170*cdf0e10cSrcweir // (maybe do a listening sometime in Svx3DWin) 171*cdf0e10cSrcweir sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId(); 172*cdf0e10cSrcweir SfxChildWindow* pWindow = GetViewFrame() ? GetViewFrame()->GetChildWindow(nId) : NULL; 173*cdf0e10cSrcweir if(pWindow) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir Svx3DWin* p3DWin = static_cast< Svx3DWin* > (pWindow->GetWindow()); 176*cdf0e10cSrcweir if(p3DWin) 177*cdf0e10cSrcweir p3DWin->DocumentReload(); 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir EndListening (*GetDoc()); 181*cdf0e10cSrcweir EndListening (*GetDocSh()); 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir if( SlideShow::IsRunning(*this) ) 184*cdf0e10cSrcweir StopSlideShow(false); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir DisposeFunctions(); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir SdPage* pPage; 189*cdf0e10cSrcweir sal_uInt16 aPageCnt = GetDoc()->GetSdPageCount(mePageKind); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir for (sal_uInt16 i = 0; i < aPageCnt; i++) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir pPage = GetDoc()->GetSdPage(i, mePageKind); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir if (pPage == mpActualPage) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir GetDoc()->SetSelected(pPage, sal_True); 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir else 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir GetDoc()->SetSelected(pPage, sal_False); 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir if ( mpClipEvtLstnr ) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir mpClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_False ); 208*cdf0e10cSrcweir mpClipEvtLstnr->ClearCallbackLink(); // #103849# prevent callback if another thread is waiting 209*cdf0e10cSrcweir mpClipEvtLstnr->release(); 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir delete mpDrawView; 213*cdf0e10cSrcweir // Set mpView to NULL so that the destructor of the ViewShell base class 214*cdf0e10cSrcweir // does not access it. 215*cdf0e10cSrcweir mpView = mpDrawView = NULL; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir mpFrameView->Disconnect(); 218*cdf0e10cSrcweir delete [] mpSlotArray; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir /************************************************************************* 222*cdf0e10cSrcweir |* 223*cdf0e10cSrcweir |* gemeinsamer Initialisierungsanteil der beiden Konstruktoren 224*cdf0e10cSrcweir |* 225*cdf0e10cSrcweir \************************************************************************/ 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir mpActualPage = 0; 230*cdf0e10cSrcweir mbMousePosFreezed = sal_False; 231*cdf0e10cSrcweir mbReadOnly = GetDocSh()->IsReadOnly(); 232*cdf0e10cSrcweir mpSlotArray = 0; 233*cdf0e10cSrcweir mpClipEvtLstnr = 0; 234*cdf0e10cSrcweir mbPastePossible = sal_False; 235*cdf0e10cSrcweir mbIsLayerModeActive = false; 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir mpFrameView->Connect(); 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir OSL_ASSERT (GetViewShell()!=NULL); 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir // Array fuer Slot-/ImageMapping: 242*cdf0e10cSrcweir // Gerader Eintrag: Haupt-/ToolboxSlot 243*cdf0e10cSrcweir // Ungerader Eintrag: gemappter Slot 244*cdf0e10cSrcweir // Achtung: Anpassen von GetIdBySubId() !!! 245*cdf0e10cSrcweir // Reihenfolge (insbesondere Zoom) darf nicht geaendert werden !!! 246*cdf0e10cSrcweir mpSlotArray = new sal_uInt16[ SLOTARRAY_COUNT ]; 247*cdf0e10cSrcweir mpSlotArray[ 0 ] = SID_OBJECT_CHOOSE_MODE; 248*cdf0e10cSrcweir mpSlotArray[ 1 ] = SID_OBJECT_ROTATE; 249*cdf0e10cSrcweir mpSlotArray[ 2 ] = SID_OBJECT_ALIGN; 250*cdf0e10cSrcweir mpSlotArray[ 3 ] = SID_OBJECT_ALIGN_LEFT; 251*cdf0e10cSrcweir mpSlotArray[ 4 ] = SID_ZOOM_TOOLBOX; 252*cdf0e10cSrcweir mpSlotArray[ 5 ] = SID_ZOOM_TOOLBOX; 253*cdf0e10cSrcweir mpSlotArray[ 6 ] = SID_DRAWTBX_TEXT; 254*cdf0e10cSrcweir mpSlotArray[ 7 ] = SID_ATTR_CHAR; 255*cdf0e10cSrcweir mpSlotArray[ 8 ] = SID_DRAWTBX_RECTANGLES; 256*cdf0e10cSrcweir mpSlotArray[ 9 ] = SID_DRAW_RECT; 257*cdf0e10cSrcweir mpSlotArray[ 10 ] = SID_DRAWTBX_ELLIPSES; 258*cdf0e10cSrcweir mpSlotArray[ 11 ] = SID_DRAW_ELLIPSE; 259*cdf0e10cSrcweir mpSlotArray[ 12 ] = SID_DRAWTBX_LINES; 260*cdf0e10cSrcweir mpSlotArray[ 13 ] = SID_DRAW_FREELINE_NOFILL; 261*cdf0e10cSrcweir mpSlotArray[ 14 ] = SID_DRAWTBX_3D_OBJECTS; 262*cdf0e10cSrcweir mpSlotArray[ 15 ] = SID_3D_CUBE; 263*cdf0e10cSrcweir mpSlotArray[ 16 ] = SID_DRAWTBX_INSERT; 264*cdf0e10cSrcweir mpSlotArray[ 17 ] = SID_INSERT_DIAGRAM; 265*cdf0e10cSrcweir mpSlotArray[ 18 ] = SID_POSITION; 266*cdf0e10cSrcweir mpSlotArray[ 19 ] = SID_FRAME_TO_TOP; 267*cdf0e10cSrcweir mpSlotArray[ 20 ] = SID_DRAWTBX_CONNECTORS; 268*cdf0e10cSrcweir mpSlotArray[ 21 ] = SID_TOOL_CONNECTOR; 269*cdf0e10cSrcweir mpSlotArray[ 22 ] = SID_DRAWTBX_ARROWS; 270*cdf0e10cSrcweir mpSlotArray[ 23 ] = SID_LINE_ARROW_END; 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir SetPool( &GetDoc()->GetPool() ); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir GetDoc()->CreateFirstPages(); 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir mpDrawView = new DrawView(pDocSh, GetActiveWindow(), this); 277*cdf0e10cSrcweir mpView = mpDrawView; // Pointer der Basisklasse ViewShell 278*cdf0e10cSrcweir mpDrawView->SetSwapAsynchron(sal_True); // Asynchrones Laden von Graphiken 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir // We do not read the page kind from the frame view anymore so we have 281*cdf0e10cSrcweir // to set it in order to resync frame view and this view. 282*cdf0e10cSrcweir mpFrameView->SetPageKind(eInitialPageKind); 283*cdf0e10cSrcweir mePageKind = eInitialPageKind; 284*cdf0e10cSrcweir meEditMode = EM_PAGE; 285*cdf0e10cSrcweir DocumentType eDocType = GetDoc()->GetDocumentType(); // RTTI fasst hier noch nicht 286*cdf0e10cSrcweir switch (mePageKind) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir case PK_STANDARD: 289*cdf0e10cSrcweir meShellType = ST_IMPRESS; 290*cdf0e10cSrcweir break; 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir case PK_NOTES: 293*cdf0e10cSrcweir meShellType = ST_NOTES; 294*cdf0e10cSrcweir break; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir case PK_HANDOUT: 297*cdf0e10cSrcweir meShellType = ST_HANDOUT; 298*cdf0e10cSrcweir break; 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir Size aPageSize( GetDoc()->GetSdPage(0, mePageKind)->GetSize() ); 302*cdf0e10cSrcweir Point aPageOrg( aPageSize.Width(), aPageSize.Height() / 2); 303*cdf0e10cSrcweir Size aSize(aPageSize.Width() * 3, aPageSize.Height() * 2); 304*cdf0e10cSrcweir InitWindows(aPageOrg, aSize, Point(-1, -1)); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir Point aVisAreaPos; 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir if ( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir aVisAreaPos = pDocSh->GetVisArea(ASPECT_CONTENT).TopLeft(); 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir mpDrawView->SetWorkArea(Rectangle(Point() - aVisAreaPos - aPageOrg, aSize)); 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir // Objekte koennen max. so gross wie die ViewSize werden 316*cdf0e10cSrcweir GetDoc()->SetMaxObjSize(aSize); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir // Split-Handler fuer TabControls 319*cdf0e10cSrcweir maTabControl.SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) ); 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir // Damit der richtige EditMode von der FrameView komplett eingestellt 322*cdf0e10cSrcweir // werden kann, wird hier ein aktuell anderer gewaehlt (kleiner Trick) 323*cdf0e10cSrcweir if (mpFrameView->GetViewShEditMode(mePageKind) == EM_PAGE) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir meEditMode = EM_MASTERPAGE; 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir else 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir meEditMode = EM_PAGE; 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir // Einstellungen der FrameView uebernehmen 333*cdf0e10cSrcweir ReadFrameViewData(mpFrameView); 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir if( eDocType == DOCUMENT_TYPE_DRAW ) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir SetHelpId( SD_IF_SDGRAPHICVIEWSHELL ); 338*cdf0e10cSrcweir GetActiveWindow()->SetHelpId( HID_SDGRAPHICVIEWSHELL ); 339*cdf0e10cSrcweir GetActiveWindow()->SetUniqueId( HID_SDGRAPHICVIEWSHELL ); 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir else 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir if (mePageKind == PK_NOTES) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir SetHelpId( SID_NOTESMODE ); 346*cdf0e10cSrcweir GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE ); 347*cdf0e10cSrcweir GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE ); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir // AutoLayouts muessen erzeugt sein 350*cdf0e10cSrcweir GetDoc()->StopWorkStartupDelay(); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir SetHelpId( SID_HANDOUTMODE ); 355*cdf0e10cSrcweir GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE ); 356*cdf0e10cSrcweir GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE ); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir // AutoLayouts muessen erzeugt sein 359*cdf0e10cSrcweir GetDoc()->StopWorkStartupDelay(); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir else 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir SetHelpId( SD_IF_SDDRAWVIEWSHELL ); 364*cdf0e10cSrcweir GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL ); 365*cdf0e10cSrcweir GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL ); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir // Selektionsfunktion starten 370*cdf0e10cSrcweir SfxRequest aReq(SID_OBJECT_SELECT, 0, GetDoc()->GetItemPool()); 371*cdf0e10cSrcweir FuPermanent(aReq); 372*cdf0e10cSrcweir mpDrawView->SetFrameDragSingles(sal_True); 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir if (pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir mbZoomOnPage = sal_False; 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir else 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir mbZoomOnPage = sal_True; 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir mbIsRulerDrag = sal_False; 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir String aName( RTL_CONSTASCII_USTRINGPARAM("DrawViewShell")); 386*cdf0e10cSrcweir SetName (aName); 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir mnLockCount = 0UL; 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir if( xMgr.is() ) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir mxScannerManager = ::com::sun::star::uno::Reference< ::com::sun::star::scanner::XScannerManager >( 395*cdf0e10cSrcweir xMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.scanner.ScannerManager" ) ), 396*cdf0e10cSrcweir ::com::sun::star::uno::UNO_QUERY ); 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir if( mxScannerManager.is() ) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir mxScannerListener = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >( 401*cdf0e10cSrcweir static_cast< ::cppu::OWeakObject* >( new ScannerEventListener( this ) ), 402*cdf0e10cSrcweir ::com::sun::star::uno::UNO_QUERY ); 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir mpAnnotationManager.reset( new AnnotationManager( GetViewShellBase() ) ); 407*cdf0e10cSrcweir mpViewOverlayManager.reset( new ViewOverlayManager( GetViewShellBase() ) ); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir void DrawViewShell::Init (bool bIsMainViewShell) 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir ViewShell::Init(bIsMainViewShell); 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir StartListening (*GetDocSh()); 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir void DrawViewShell::Shutdown (void) 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir ViewShell::Shutdown(); 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir if(SlideShow::IsRunning( GetViewShellBase() ) ) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir // Turn off effects. 430*cdf0e10cSrcweir GetDrawView()->SetAnimationMode(SDR_ANIMATION_DISABLE); 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawSubController> DrawViewShell::CreateSubController (void) 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawSubController> xSubController; 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir if (IsMainViewShell()) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir // Create uno sub controller for the main view shell. 444*cdf0e10cSrcweir xSubController = css::uno::Reference<css::drawing::XDrawSubController>( 445*cdf0e10cSrcweir new SdUnoDrawView ( 446*cdf0e10cSrcweir GetViewShellBase().GetDrawController(), 447*cdf0e10cSrcweir *this, 448*cdf0e10cSrcweir *GetView())); 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir return xSubController; 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir bool DrawViewShell::RelocateToParentWindow (::Window* pParentWindow) 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir // DrawViewShells can not be relocated to a new parent window at the 460*cdf0e10cSrcweir // moment, so return <FALSE/> except when the given parent window is the 461*cdf0e10cSrcweir // parent window that is already in use. 462*cdf0e10cSrcweir return pParentWindow==GetParentWindow(); 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir /************************************************************************* 469*cdf0e10cSrcweir |* 470*cdf0e10cSrcweir |* pruefe ob linienzuege gezeichnet werden muessen 471*cdf0e10cSrcweir |* 472*cdf0e10cSrcweir \************************************************************************/ 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir /* 475*cdf0e10cSrcweir linienzuege werden ueber makros als folge von 476*cdf0e10cSrcweir MoveTo (x, y) 477*cdf0e10cSrcweir LineTo (x, y) [oder BezierTo (x, y)] 478*cdf0e10cSrcweir LineTo (x, y) 479*cdf0e10cSrcweir : 480*cdf0e10cSrcweir dargestellt. einen endbefehl fuer die linienzuege 481*cdf0e10cSrcweir gibt es nicht, also muessen alle befehle in den 482*cdf0e10cSrcweir requests nach LineTo (BezierTo) abgetestet und die 483*cdf0e10cSrcweir punktparameter gesammelt werden. 484*cdf0e10cSrcweir der erste nicht-LineTo fuehrt dann dazu, dass aus 485*cdf0e10cSrcweir den gesammelten punkten der linienzug erzeugt wird 486*cdf0e10cSrcweir */ 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir void DrawViewShell::CheckLineTo(SfxRequest& rReq) 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir (void)rReq; 491*cdf0e10cSrcweir #ifdef DBG_UTIL 492*cdf0e10cSrcweir if(rReq.IsAPI()) 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir if(SID_LINETO == rReq.GetSlot() || SID_BEZIERTO == rReq.GetSlot() || SID_MOVETO == rReq.GetSlot() ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir DBG_ERROR("DrawViewShell::CheckLineTo: slots SID_LINETO, SID_BEZIERTO, SID_MOVETO no longer supported."); 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir #endif 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir rReq.Ignore (); 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir /************************************************************************* 505*cdf0e10cSrcweir |* 506*cdf0e10cSrcweir |* veraendere die seitemparameter, wenn SID_PAGESIZE oder SID_PAGEMARGIN 507*cdf0e10cSrcweir |* 508*cdf0e10cSrcweir \************************************************************************/ 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir void DrawViewShell::SetupPage (Size &rSize, 511*cdf0e10cSrcweir long nLeft, 512*cdf0e10cSrcweir long nRight, 513*cdf0e10cSrcweir long nUpper, 514*cdf0e10cSrcweir long nLower, 515*cdf0e10cSrcweir sal_Bool bSize, 516*cdf0e10cSrcweir sal_Bool bMargin, 517*cdf0e10cSrcweir sal_Bool bScaleAll) 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir sal_uInt16 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind); 520*cdf0e10cSrcweir sal_uInt16 i; 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir for (i = 0; i < nPageCnt; i++) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir /********************************************************************** 525*cdf0e10cSrcweir * Erst alle MasterPages bearbeiten 526*cdf0e10cSrcweir **********************************************************************/ 527*cdf0e10cSrcweir SdPage *pPage = GetDoc()->GetMasterSdPage(i, mePageKind); 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir if( pPage ) 530*cdf0e10cSrcweir { 531*cdf0e10cSrcweir if( bSize ) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir Rectangle aBorderRect(nLeft, nUpper, nRight, nLower); 534*cdf0e10cSrcweir pPage->ScaleObjects(rSize, aBorderRect, bScaleAll); 535*cdf0e10cSrcweir pPage->SetSize(rSize); 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir if( bMargin ) 539*cdf0e10cSrcweir { 540*cdf0e10cSrcweir pPage->SetLftBorder(nLeft); 541*cdf0e10cSrcweir pPage->SetRgtBorder(nRight); 542*cdf0e10cSrcweir pPage->SetUppBorder(nUpper); 543*cdf0e10cSrcweir pPage->SetLwrBorder(nLower); 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir if ( mePageKind == PK_STANDARD ) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir GetDoc()->GetMasterSdPage(i, PK_NOTES)->CreateTitleAndLayout(); 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir pPage->CreateTitleAndLayout(); 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir nPageCnt = GetDoc()->GetSdPageCount(mePageKind); 556*cdf0e10cSrcweir 557*cdf0e10cSrcweir for (i = 0; i < nPageCnt; i++) 558*cdf0e10cSrcweir { 559*cdf0e10cSrcweir /********************************************************************** 560*cdf0e10cSrcweir * Danach alle Pages bearbeiten 561*cdf0e10cSrcweir **********************************************************************/ 562*cdf0e10cSrcweir SdPage *pPage = GetDoc()->GetSdPage(i, mePageKind); 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir if( pPage ) 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir if( bSize ) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir Rectangle aBorderRect(nLeft, nUpper, nRight, nLower); 569*cdf0e10cSrcweir pPage->ScaleObjects(rSize, aBorderRect, bScaleAll); 570*cdf0e10cSrcweir pPage->SetSize(rSize); 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir if( bMargin ) 573*cdf0e10cSrcweir { 574*cdf0e10cSrcweir pPage->SetLftBorder(nLeft); 575*cdf0e10cSrcweir pPage->SetRgtBorder(nRight); 576*cdf0e10cSrcweir pPage->SetUppBorder(nUpper); 577*cdf0e10cSrcweir pPage->SetLwrBorder(nLower); 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir if ( mePageKind == PK_STANDARD ) 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir SdPage* pNotesPage = GetDoc()->GetSdPage(i, PK_NOTES); 583*cdf0e10cSrcweir pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() ); 584*cdf0e10cSrcweir } 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir pPage->SetAutoLayout( pPage->GetAutoLayout() ); 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir if ( mePageKind == PK_STANDARD ) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir SdPage* pHandoutPage = GetDoc()->GetSdPage(0, PK_HANDOUT); 593*cdf0e10cSrcweir pHandoutPage->CreateTitleAndLayout(sal_True); 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir long nWidth = mpActualPage->GetSize().Width(); 597*cdf0e10cSrcweir long nHeight = mpActualPage->GetSize().Height(); 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir Point aPageOrg(nWidth, nHeight / 2); 600*cdf0e10cSrcweir Size aSize( nWidth * 3, nHeight * 2); 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir InitWindows(aPageOrg, aSize, Point(-1, -1), sal_True); 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir Point aVisAreaPos; 605*cdf0e10cSrcweir 606*cdf0e10cSrcweir if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir aVisAreaPos = GetDocSh()->GetVisArea(ASPECT_CONTENT).TopLeft(); 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir GetView()->SetWorkArea(Rectangle(Point() - aVisAreaPos - aPageOrg, aSize)); 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir UpdateScrollBars(); 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir Point aNewOrigin(mpActualPage->GetLftBorder(), mpActualPage->GetUppBorder()); 616*cdf0e10cSrcweir GetView()->GetSdrPageView()->SetPageOrigin(aNewOrigin); 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET); 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir // auf (neue) Seitengroesse zoomen 621*cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE, 622*cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir /************************************************************************* 626*cdf0e10cSrcweir |* 627*cdf0e10cSrcweir |* Statuswerte der Statusbar zurueckgeben 628*cdf0e10cSrcweir |* 629*cdf0e10cSrcweir \************************************************************************/ 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir // Zoom-Item 634*cdf0e10cSrcweir // Hier sollte der entsprechende Wert (Optimal ?, Seitenbreite oder 635*cdf0e10cSrcweir // Seite) mit Hilfe des ZoomItems weitergegeben werden !!! 636*cdf0e10cSrcweir if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOM ) ) 637*cdf0e10cSrcweir { 638*cdf0e10cSrcweir if (GetDocSh()->IsUIActive() || (SlideShow::IsRunning(GetViewShellBase())) ) 639*cdf0e10cSrcweir { 640*cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_ZOOM ); 641*cdf0e10cSrcweir } 642*cdf0e10cSrcweir else 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir SvxZoomItem* pZoomItem; 645*cdf0e10cSrcweir sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom(); 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir if( mbZoomOnPage ) 648*cdf0e10cSrcweir pZoomItem = new SvxZoomItem( SVX_ZOOM_WHOLEPAGE, nZoom ); 649*cdf0e10cSrcweir else 650*cdf0e10cSrcweir pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nZoom ); 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir // Bereich einschraenken 653*cdf0e10cSrcweir sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL; 654*cdf0e10cSrcweir SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) ) 657*cdf0e10cSrcweir // || ( mpDrawView->GetMarkedObjectList().GetMarkCount() == 0 ) ) 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL; 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir pZoomItem->SetValueSet( nZoomValues ); 663*cdf0e10cSrcweir rSet.Put( *pZoomItem ); 664*cdf0e10cSrcweir delete pZoomItem; 665*cdf0e10cSrcweir } 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) ) 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) ); 670*cdf0e10cSrcweir if (GetDocSh()->IsUIActive() || (xSlideshow.is() && xSlideshow->isRunning()) || !GetActiveWindow() ) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_ZOOMSLIDER ); 673*cdf0e10cSrcweir } 674*cdf0e10cSrcweir else 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir sd::Window * pActiveWindow = GetActiveWindow(); 677*cdf0e10cSrcweir SvxZoomSliderItem aZoomItem( (sal_uInt16) pActiveWindow->GetZoom(), (sal_uInt16)pActiveWindow->GetMinZoom(), (sal_uInt16)pActiveWindow->GetMaxZoom() ) ; 678*cdf0e10cSrcweir 679*cdf0e10cSrcweir SdrPageView* pPageView = mpDrawView->GetSdrPageView(); 680*cdf0e10cSrcweir if( pPageView ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir Point aPagePos(0, 0); 683*cdf0e10cSrcweir Size aPageSize = pPageView->GetPage()->GetSize(); 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir aPagePos.X() += aPageSize.Width() / 2; 686*cdf0e10cSrcweir aPageSize.Width() = (long) (aPageSize.Width() * 1.03); 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir aPagePos.Y() += aPageSize.Height() / 2; 689*cdf0e10cSrcweir aPageSize.Height() = (long) (aPageSize.Height() * 1.03); 690*cdf0e10cSrcweir aPagePos.Y() -= aPageSize.Height() / 2; 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir aPagePos.X() -= aPageSize.Width() / 2; 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir Rectangle aFullPageZoomRect( aPagePos, aPageSize ); 695*cdf0e10cSrcweir aZoomItem.AddSnappingPoint( pActiveWindow->GetZoomForRect( aFullPageZoomRect ) ); 696*cdf0e10cSrcweir } 697*cdf0e10cSrcweir aZoomItem.AddSnappingPoint(100); 698*cdf0e10cSrcweir rSet.Put( aZoomItem ); 699*cdf0e10cSrcweir } 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir Point aPos = GetActiveWindow()->PixelToLogic(maMousePos); 703*cdf0e10cSrcweir mpDrawView->GetSdrPageView()->LogicToPagePos(aPos); 704*cdf0e10cSrcweir Fraction aUIScale(GetDoc()->GetUIScale()); 705*cdf0e10cSrcweir aPos.X() = Fraction(aPos.X()) / aUIScale; 706*cdf0e10cSrcweir aPos.Y() = Fraction(aPos.Y()) / aUIScale; 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir // Position- und Groesse-Items 709*cdf0e10cSrcweir if ( mpDrawView->IsAction() ) 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir Rectangle aRect; 712*cdf0e10cSrcweir mpDrawView->TakeActionRect( aRect ); 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir if ( aRect.IsEmpty() ) 715*cdf0e10cSrcweir rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) ); 716*cdf0e10cSrcweir else 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir mpDrawView->GetSdrPageView()->LogicToPagePos(aRect); 719*cdf0e10cSrcweir aPos = aRect.TopLeft(); 720*cdf0e10cSrcweir aPos.X() = Fraction(aPos.X()) / aUIScale; 721*cdf0e10cSrcweir aPos.Y() = Fraction(aPos.Y()) / aUIScale; 722*cdf0e10cSrcweir rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) ); 723*cdf0e10cSrcweir Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ); 724*cdf0e10cSrcweir aSize.Height() = Fraction(aSize.Height()) / aUIScale; 725*cdf0e10cSrcweir aSize.Width() = Fraction(aSize.Width()) / aUIScale; 726*cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) ); 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir else 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir if ( mpDrawView->AreObjectsMarked() ) 732*cdf0e10cSrcweir { 733*cdf0e10cSrcweir Rectangle aRect = mpDrawView->GetAllMarkedRect(); 734*cdf0e10cSrcweir mpDrawView->GetSdrPageView()->LogicToPagePos(aRect); 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir // Show the position of the selected shape(s) 737*cdf0e10cSrcweir Point aShapePosition (aRect.TopLeft()); 738*cdf0e10cSrcweir aShapePosition.X() = Fraction(aShapePosition.X()) / aUIScale; 739*cdf0e10cSrcweir aShapePosition.Y() = Fraction(aShapePosition.Y()) / aUIScale; 740*cdf0e10cSrcweir rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition)); 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ); 743*cdf0e10cSrcweir aSize.Height() = Fraction(aSize.Height()) / aUIScale; 744*cdf0e10cSrcweir aSize.Width() = Fraction(aSize.Width()) / aUIScale; 745*cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) ); 746*cdf0e10cSrcweir } 747*cdf0e10cSrcweir else 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) ); 750*cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) ); 751*cdf0e10cSrcweir } 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir // Display of current page and layer. 755*cdf0e10cSrcweir if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_PAGE ) ) 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir // Allways show the slide/page number. 758*cdf0e10cSrcweir String aString (SdResId( STR_SD_PAGE )); 759*cdf0e10cSrcweir aString += sal_Unicode(' '); 760*cdf0e10cSrcweir aString += UniString::CreateFromInt32( maTabControl.GetCurPageId() ); 761*cdf0e10cSrcweir aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " )); 762*cdf0e10cSrcweir aString += UniString::CreateFromInt32( GetDoc()->GetSdPageCount( mePageKind ) ); 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir // If in layer mode additionally show the layer that contains all 765*cdf0e10cSrcweir // selected shapes of the page. If the shapes are distributed on 766*cdf0e10cSrcweir // more than one layer, no layer name is shown. 767*cdf0e10cSrcweir if (IsLayerModeActive()) 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin(); 770*cdf0e10cSrcweir SdrLayerID nLayer = 0, nOldLayer = 0; 771*cdf0e10cSrcweir SdrLayer* pLayer = NULL; 772*cdf0e10cSrcweir SdrObject* pObj = NULL; 773*cdf0e10cSrcweir const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 774*cdf0e10cSrcweir sal_uLong nMarkCount = rMarkList.GetMarkCount(); 775*cdf0e10cSrcweir FASTBOOL bOneLayer = sal_True; 776*cdf0e10cSrcweir 777*cdf0e10cSrcweir // Use the first ten selected shapes as a (hopefully 778*cdf0e10cSrcweir // representative) sample of all shapes of the current page. 779*cdf0e10cSrcweir // Detect whether they belong to the same layer. 780*cdf0e10cSrcweir for( sal_uLong j = 0; j < nMarkCount && bOneLayer && j < 10; j++ ) 781*cdf0e10cSrcweir { 782*cdf0e10cSrcweir pObj = rMarkList.GetMark( j )->GetMarkedSdrObj(); 783*cdf0e10cSrcweir if( pObj ) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir nLayer = pObj->GetLayer(); 786*cdf0e10cSrcweir 787*cdf0e10cSrcweir if( j != 0 && nLayer != nOldLayer ) 788*cdf0e10cSrcweir bOneLayer = sal_False; 789*cdf0e10cSrcweir 790*cdf0e10cSrcweir nOldLayer = nLayer; 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir } 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir // Append the layer name to the current page number. 795*cdf0e10cSrcweir if( bOneLayer && nMarkCount ) 796*cdf0e10cSrcweir { 797*cdf0e10cSrcweir pLayer = rLayerAdmin.GetLayerPerID( nLayer ); 798*cdf0e10cSrcweir if( pLayer ) 799*cdf0e10cSrcweir { 800*cdf0e10cSrcweir aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" )); 801*cdf0e10cSrcweir aString += pLayer->GetName(); 802*cdf0e10cSrcweir aString += sal_Unicode(')'); 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir } 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir rSet.Put (SfxStringItem (SID_STATUS_PAGE, aString)); 808*cdf0e10cSrcweir } 809*cdf0e10cSrcweir // Layout 810*cdf0e10cSrcweir if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_LAYOUT ) ) 811*cdf0e10cSrcweir { 812*cdf0e10cSrcweir String aString = mpActualPage->GetLayoutName(); 813*cdf0e10cSrcweir aString.Erase( aString.SearchAscii( SD_LT_SEPARATOR ) ); 814*cdf0e10cSrcweir rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aString ) ); 815*cdf0e10cSrcweir } 816*cdf0e10cSrcweir } 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir void DrawViewShell::Notify (SfxBroadcaster&, const SfxHint& rHint) 821*cdf0e10cSrcweir { 822*cdf0e10cSrcweir const SfxSimpleHint* pSimple = dynamic_cast< const SfxSimpleHint* >(&rHint); 823*cdf0e10cSrcweir if (pSimple!=NULL && pSimple->GetId()==SFX_HINT_MODECHANGED) 824*cdf0e10cSrcweir { 825*cdf0e10cSrcweir // Change to selection when turning on read-only mode. 826*cdf0e10cSrcweir if(GetDocSh()->IsReadOnly() && dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) ) 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir SfxRequest aReq(SID_OBJECT_SELECT, 0, GetDoc()->GetItemPool()); 829*cdf0e10cSrcweir FuPermanent(aReq); 830*cdf0e10cSrcweir } 831*cdf0e10cSrcweir 832*cdf0e10cSrcweir // Turn on design mode when document is not read-only. 833*cdf0e10cSrcweir if (GetDocSh()->IsReadOnly() != mbReadOnly ) 834*cdf0e10cSrcweir { 835*cdf0e10cSrcweir mbReadOnly = GetDocSh()->IsReadOnly(); 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir SfxBoolItem aItem( SID_FM_DESIGN_MODE, !mbReadOnly ); 838*cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, 839*cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir } 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir } 844*cdf0e10cSrcweir 845*cdf0e10cSrcweir void DrawViewShell::ExecuteAnnotation (SfxRequest& rRequest) 846*cdf0e10cSrcweir { 847*cdf0e10cSrcweir if( mpAnnotationManager.get() ) 848*cdf0e10cSrcweir mpAnnotationManager->ExecuteAnnotation( rRequest ); 849*cdf0e10cSrcweir } 850*cdf0e10cSrcweir 851*cdf0e10cSrcweir // -------------------------------------------------------------------- 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) 854*cdf0e10cSrcweir { 855*cdf0e10cSrcweir if( mpAnnotationManager.get() ) 856*cdf0e10cSrcweir mpAnnotationManager->GetAnnotationState( rItemSet ); 857*cdf0e10cSrcweir } 858*cdf0e10cSrcweir 859*cdf0e10cSrcweir 860*cdf0e10cSrcweir } // end of namespace sd 861