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