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