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