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 "PresentationViewShell.hxx"
32 : : #include <editeng/outliner.hxx>
33 : : #include <svx/svxids.hrc>
34 : : #include <sfx2/request.hxx>
35 : : #include <sfx2/dispatch.hxx>
36 : : #include <svx/svdpagv.hxx>
37 : : #include <vcl/scrbar.hxx>
38 : : #include <tools/poly.hxx>
39 : : #include <svx/fmshell.hxx>
40 : : #include <editeng/eeitem.hxx>
41 : : #include <svtools/colorcfg.hxx>
42 : : #include "AccessibleDrawDocumentView.hxx"
43 : :
44 : : #include <sfx2/viewfrm.hxx>
45 : : #include "LayerTabBar.hxx"
46 : :
47 : : #include "strings.hrc"
48 : : #include "res_bmp.hrc"
49 : : #include "glob.hrc"
50 : : #include "app.hrc"
51 : : #include "helpids.h"
52 : : #include "optsitem.hxx"
53 : : #include "app.hxx"
54 : : #include "FrameView.hxx"
55 : : #include "sdattr.hxx"
56 : : #include "futext.hxx"
57 : : #include "sdpage.hxx"
58 : : #include "stlpool.hxx"
59 : : #include "prntopts.hxx"
60 : : #include "sdresid.hxx"
61 : : #include "Window.hxx"
62 : : #include "drawview.hxx"
63 : : #include "drawdoc.hxx"
64 : : #include "DrawDocShell.hxx"
65 : : #include "Outliner.hxx"
66 : : #include "Client.hxx"
67 : : #include "slideshow.hxx"
68 : : #include "unokywds.hxx"
69 : : #include "SdUnoDrawView.hxx"
70 : : #include "ViewShellBase.hxx"
71 : : #include "FormShellManager.hxx"
72 : : #include "LayerDialogContent.hxx"
73 : : #include "DrawController.hxx"
74 : :
75 : : namespace sd {
76 : :
77 : : static const int TABCONTROL_INITIAL_SIZE = 350;
78 : : static const int PAPER_SHADOW_EXT_PIXEL = 2;
79 : :
80 : :
81 : : /*************************************************************************
82 : : |*
83 : : |* Wird gerufen, wenn sich das Model aendert
84 : : |*
85 : : \************************************************************************/
86 : :
87 : 317 : void DrawViewShell::ModelHasChanged()
88 : : {
89 [ + - ]: 317 : Invalidate();
90 : : // Damit der Navigator auch einen aktuellen Status bekommt
91 [ + - ][ + - ]: 317 : GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
92 : :
93 [ + - ]: 317 : SfxBoolItem aItem( SID_3D_STATE, sal_True );
94 : : GetViewFrame()->GetDispatcher()->Execute(
95 [ + - ][ + - ]: 317 : SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
96 : :
97 : : // jetzt den von der Drawing Engine neu erzeugten TextEditOutliner
98 : : // initialisieren
99 : 317 : ::Outliner* pOutliner = mpDrawView->GetTextEditOutliner();
100 [ - + ]: 317 : if (pOutliner)
101 : : {
102 [ # # ][ # # ]: 0 : SfxStyleSheetPool* pSPool = (SfxStyleSheetPool*) GetDocSh()->GetStyleSheetPool();
103 [ # # ]: 0 : pOutliner->SetStyleSheetPool(pSPool);
104 [ + - ]: 317 : }
105 : 317 : }
106 : :
107 : :
108 : :
109 : :
110 : 577 : void DrawViewShell::Resize (void)
111 : : {
112 [ + - ]: 577 : ViewShell::Resize();
113 : :
114 [ + - ][ - + ]: 577 : if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
115 : : {
116 [ # # ][ # # ]: 0 : SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
[ # # ]
117 : : }
118 : :
119 [ + - ][ + - ]: 577 : rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
120 [ + - ][ + - ]: 577 : if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() )
[ - + ][ # # ]
[ # # ][ - + ]
121 : : {
122 [ # # ]: 0 : xSlideshow->resize(maViewSize);
123 : 577 : }
124 : 577 : }
125 : :
126 : :
127 : :
128 : :
129 : 447 : void DrawViewShell::ArrangeGUIElements (void)
130 : : {
131 : : // Retrieve the current size (thickness) of the scroll bars. That is
132 : : // the width of the vertical and the height of the horizontal scroll
133 : : // bar.
134 : : int nScrollBarSize =
135 : 447 : GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
136 : 447 : maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
137 : :
138 : 447 : Point aHPos = maViewPos;
139 : 447 : aHPos.Y() += maViewSize.Height();
140 : :
141 : :
142 [ + - ]: 447 : ViewShell::ArrangeGUIElements ();
143 : :
144 [ + - ]: 447 : maTabControl.Hide();
145 : :
146 : : OSL_ASSERT (GetViewShell()!=NULL);
147 [ + - ][ + - ]: 447 : Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
148 : 447 : sal_Bool bClientActive = sal_False;
149 [ - + ][ # # ]: 447 : if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
[ # # ][ - + ]
150 : 0 : bClientActive = sal_True;
151 : :
152 [ + - ][ + - ]: 447 : sal_Bool bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace();
[ + - ]
153 : :
154 [ + - ][ + - ]: 447 : if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
[ + - ]
155 : : {
156 : : // bei Split immer erstes Fenster resizen
157 : : //af pWindow = mpContentWindow.get();
158 [ + - ][ + - ]: 447 : SfxRequest aReq(SID_SIZE_PAGE, 0, GetDoc()->GetItemPool());
159 [ + - ][ + - ]: 447 : ExecuteSlot( aReq );
160 : : }
161 : 447 : }
162 : :
163 : : /*************************************************************************
164 : : |*
165 : : |* Daten der FrameView auf die aktuelle View uebertragen
166 : : |*
167 : : \************************************************************************/
168 : :
169 : 535 : void DrawViewShell::ReadFrameViewData(FrameView* pView)
170 : : {
171 [ + - ][ + - ]: 535 : ModifyGuard aGuard( GetDoc() );
172 : :
173 : : // Diese Option wird am Model eingestellt
174 [ + - ]: 535 : GetDoc()->SetPickThroughTransparentTextFrames(
175 [ + - ][ + - ]: 1070 : SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
[ + - ][ + - ]
176 : :
177 : : // Initialisierungen der Zeichen-(Bildschirm-)Attribute
178 [ + + ][ + - ]: 535 : if (HasRuler() != pView->HasRuler())
179 [ + - ]: 104 : SetRuler( pView->HasRuler() );
180 : :
181 [ + + ]: 535 : if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
182 : 130 : mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
183 : :
184 [ + + ]: 535 : if (mpDrawView->GetGridFine() != pView->GetGridFine())
185 [ + - ]: 130 : mpDrawView->SetGridFine( pView->GetGridFine() );
186 : :
187 [ + - ][ + + ]: 535 : if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
[ + - ][ - + ]
[ + + ]
188 [ + - ]: 130 : mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
189 : :
190 [ + + ]: 535 : if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
191 [ + - ]: 130 : mpDrawView->SetGridVisible( pView->IsGridVisible() );
192 : :
193 [ - + ]: 535 : if (mpDrawView->IsGridFront() != pView->IsGridFront())
194 [ # # ]: 0 : mpDrawView->SetGridFront( pView->IsGridFront() );
195 : :
196 [ - + ]: 535 : if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
197 : 0 : mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
198 : :
199 [ - + ]: 535 : if (mpDrawView->IsGridSnap() != pView->IsGridSnap() )
200 : 0 : mpDrawView->SetGridSnap( pView->IsGridSnap() );
201 : :
202 [ - + ]: 535 : if (mpDrawView->IsBordSnap() != pView->IsBordSnap() )
203 : 0 : mpDrawView->SetBordSnap( pView->IsBordSnap() );
204 : :
205 [ + + ]: 535 : if (mpDrawView->IsHlplSnap() != pView->IsHlplSnap() )
206 : 104 : mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
207 : :
208 [ + + ]: 535 : if (mpDrawView->IsOFrmSnap() != pView->IsOFrmSnap() )
209 : 104 : mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
210 : :
211 [ - + ]: 535 : if (mpDrawView->IsOPntSnap() != pView->IsOPntSnap() )
212 : 0 : mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
213 : :
214 [ + + ]: 535 : if (mpDrawView->IsOConSnap() != pView->IsOConSnap() )
215 : 130 : mpDrawView->SetOConSnap( pView->IsOConSnap() );
216 : :
217 [ + + ]: 535 : if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
218 [ + - ]: 130 : mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
219 : :
220 [ - + ]: 535 : if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
221 [ # # ]: 0 : mpDrawView->SetDragStripes( pView->IsDragStripes() );
222 : :
223 [ - + ]: 535 : if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
224 [ # # ]: 0 : mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
225 : :
226 [ + + ]: 535 : if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
227 : 130 : mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
228 : :
229 [ + + ]: 535 : if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
230 : 130 : mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
231 : :
232 [ - + ]: 535 : if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
233 : 0 : mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
234 : :
235 [ - + ]: 535 : if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
236 [ # # ]: 0 : mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
237 : :
238 [ - + ]: 535 : if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
239 : 0 : mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
240 : :
241 [ - + ]: 535 : if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
242 : 0 : mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
243 : :
244 [ - + ]: 535 : if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
245 : 0 : mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
246 : :
247 [ - + ]: 535 : if (mpDrawView->IsOrtho() != pView->IsOrtho() )
248 : 0 : mpDrawView->SetOrtho( pView->IsOrtho() );
249 : :
250 [ + + ]: 535 : if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
251 : 130 : mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
252 : :
253 [ - + ]: 535 : if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
254 : 0 : mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
255 : :
256 [ + - ][ + - ]: 535 : if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
[ - + ]
257 [ # # ][ # # ]: 0 : mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
258 : :
259 [ - + ]: 535 : if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit())
260 : 0 : mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
261 : :
262 : : // #i26631#
263 [ + + ]: 535 : if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
264 [ + - ]: 130 : mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
265 : :
266 : : // handle size: 9 pixels
267 [ + - ]: 535 : sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel();
268 [ + + ]: 535 : if( nTmp != 9 )
269 [ + - ]: 130 : mpDrawView->SetMarkHdlSizePixel( 9 );
270 : :
271 : :
272 : 535 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
273 [ + + ]: 535 : if (pPageView)
274 : : {
275 [ - + ]: 405 : if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() )
276 [ # # ]: 0 : pPageView->SetVisibleLayers( pView->GetVisibleLayers() );
277 : :
278 [ - + ]: 405 : if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() )
279 : 0 : pPageView->SetPrintableLayers( pView->GetPrintableLayers() );
280 : :
281 [ - + ]: 405 : if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() )
282 : 0 : pPageView->SetLockedLayers( pView->GetLockedLayers() );
283 : :
284 [ - + ]: 405 : if (mePageKind == PK_NOTES)
285 : : {
286 [ # # ][ # # ]: 0 : if (pPageView->GetHelpLines() != pView->GetNotesHelpLines())
287 [ # # ]: 0 : pPageView->SetHelpLines( pView->GetNotesHelpLines() );
288 : : }
289 [ - + ]: 405 : else if (mePageKind == PK_HANDOUT)
290 : : {
291 [ # # ][ # # ]: 0 : if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines())
292 [ # # ]: 0 : pPageView->SetHelpLines( pView->GetHandoutHelpLines() );
293 : : }
294 : : else
295 : : {
296 [ + - ][ - + ]: 405 : if (pPageView->GetHelpLines() != pView->GetStandardHelpLines())
297 [ # # ]: 0 : pPageView->SetHelpLines( pView->GetStandardHelpLines() );
298 : : }
299 : : }
300 : :
301 [ + - ][ + + ]: 535 : if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() )
302 [ + - ]: 130 : mpDrawView->SetActiveLayer( pView->GetActiveLayer() );
303 : :
304 : 535 : sal_uInt16 nSelectedPage = 0;
305 : :
306 [ + - ]: 535 : if (mePageKind != PK_HANDOUT)
307 : : {
308 [ + - ]: 535 : nSelectedPage = pView->GetSelectedPage();
309 : : }
310 : :
311 [ + - ]: 535 : EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind);
312 : 535 : sal_Bool bNewLayerMode = pView->IsLayerMode();
313 [ + - ]: 535 : ChangeEditMode(eNewEditMode, bNewLayerMode);
314 [ + - ]: 535 : SwitchPage(nSelectedPage);
315 : :
316 : : // DrawMode fuer 'Normales' Fenster wiederherstellen
317 [ + - ][ - + ]: 535 : if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
318 [ # # ][ # # ]: 0 : GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
319 : :
320 [ - + ]: 535 : if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() )
321 : : {
322 [ # # ]: 0 : SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() );
323 [ # # ][ # # ]: 0 : GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aDesignModeItem, 0L );
[ # # ]
324 : : }
325 : :
326 : : // Muss am Ende gerufen werden, da ein WriteFrameViewData() ausgeloest wird
327 [ + + ]: 535 : if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
328 [ + - ][ + - ]: 535 : mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
329 : 535 : }
330 : :
331 : : /*************************************************************************
332 : : |*
333 : : |* Daten der aktuellen View auf die FrameView uebertragen
334 : : |*
335 : : \************************************************************************/
336 : :
337 : 939 : void DrawViewShell::WriteFrameViewData()
338 : : {
339 : : // Zeichen-(Bildschirm-)Attribute an FrameView merken
340 [ + - ]: 939 : mpFrameView->SetRuler( HasRuler() );
341 : 939 : mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
342 [ + - ]: 939 : mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
343 [ + - ]: 939 : mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
344 [ + - ]: 939 : mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
345 [ + - ]: 939 : mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
346 : 939 : mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
347 : 939 : mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
348 : 939 : mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
349 : 939 : mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
350 : 939 : mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
351 : 939 : mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
352 : 939 : mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
353 [ + - ]: 939 : mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
354 [ + - ]: 939 : mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
355 [ + - ]: 939 : mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
356 [ + - ]: 939 : mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
357 : 939 : mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
358 : 939 : mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
359 [ + - ]: 939 : mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
360 : 939 : mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
361 : 939 : mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
362 : 939 : mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
363 : 939 : mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
364 : :
365 [ + - ][ + - ]: 939 : mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
366 : 939 : mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
367 : :
368 [ + - ]: 939 : mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
369 : :
370 [ + - ]: 939 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
371 [ + - ][ + - ]: 939 : Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
[ + - ]
372 : 939 : mpFrameView->SetVisArea(aVisArea);
373 : :
374 [ - + ]: 939 : if( mePageKind == PK_HANDOUT )
375 [ # # ]: 0 : mpFrameView->SetSelectedPage(0);
376 : : else
377 : : {
378 [ + - ]: 939 : mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
379 : : }
380 : :
381 [ + - ]: 939 : mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
382 [ + - ]: 939 : mpFrameView->SetLayerMode(IsLayerModeActive());
383 : :
384 : 939 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
385 : :
386 [ + - ]: 939 : if (pPageView)
387 : : {
388 [ - + ]: 939 : if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
389 : 0 : mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
390 : :
391 [ - + ]: 939 : if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
392 : 0 : mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
393 : :
394 [ - + ]: 939 : if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
395 : 0 : mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
396 : :
397 [ - + ]: 939 : if (mePageKind == PK_NOTES)
398 : : {
399 [ # # ]: 0 : mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
400 : : }
401 [ - + ]: 939 : else if (mePageKind == PK_HANDOUT)
402 : : {
403 [ # # ]: 0 : mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
404 : : }
405 : : else
406 : : {
407 [ + - ]: 939 : mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
408 : : }
409 : : }
410 : :
411 [ + - ][ - + ]: 939 : if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
412 [ # # ]: 0 : mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
413 : :
414 : : // DrawMode fuer 'Normales' Fenster merken
415 [ + - ][ - + ]: 939 : if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
416 [ # # ]: 0 : mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
417 : 939 : }
418 : :
419 : :
420 : :
421 : : /*************************************************************************
422 : : |*
423 : : |* PrePaint-Method
424 : : |*
425 : : \************************************************************************/
426 : :
427 : 1339 : void DrawViewShell::PrePaint()
428 : : {
429 : 1339 : mpDrawView->PrePaint();
430 : 1339 : }
431 : :
432 : : /*************************************************************************
433 : : |*
434 : : |* Paint-Methode: das Ereignis wird vom Fenster pWin an
435 : : |* die Viewshell und die aktuelle Funktion weitergeleitet
436 : : |*
437 : : |* Anmerkung: pWin==NULL, wenn Paint() vom ShowWindow gerufen wird!
438 : : |*
439 : : \************************************************************************/
440 : :
441 : 972 : void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
442 : : {
443 : : // Fill var FillColor here to have it available on later call
444 [ + - ]: 972 : svtools::ColorConfig aColorConfig;
445 : 972 : Color aFillColor;
446 : :
447 [ + + ][ + - ]: 972 : if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType())
448 : : {
449 [ + - ]: 97 : aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
450 : : }
451 : : else
452 : : {
453 [ + - ]: 875 : aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
454 : : }
455 : :
456 : : /* This is done before each text edit, so why not do it before every paint.
457 : : The default language is only used if the outliner only contains one
458 : : character in a symbol font */
459 [ + - ][ + - ]: 972 : GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
[ + - ][ + - ]
[ + - ]
460 : :
461 : : // Set Application Background color for usage in SdrPaintView(s)
462 [ + - ]: 972 : mpDrawView->SetApplicationBackgroundColor(aFillColor);
463 : :
464 : : /* This is done before each text edit, so why not do it before every paint.
465 : : The default language is only used if the outliner only contains one
466 : : character in a symbol font */
467 [ + - ][ + - ]: 972 : GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguage() );
[ + - ][ + - ]
[ + - ]
468 : :
469 [ + - ][ + - ]: 972 : mpDrawView->CompleteRedraw( pWin, Region( rRect ) );
[ + - ]
470 : :
471 [ + - ]: 972 : if( pWin )
472 : : {
473 [ + - ][ + - ]: 972 : if( GetDocSh()->GetDocShellFunction().is() )
[ + - ][ - + ]
474 [ # # ][ # # ]: 0 : GetDocSh()->GetDocShellFunction()->Paint( rRect, pWin );
[ # # ][ # # ]
475 : :
476 [ + - ][ + - ]: 972 : if( HasCurrentFunction() )
477 [ + - ][ + - ]: 972 : GetCurrentFunction()->Paint( rRect, pWin );
[ + - ]
478 [ + - ]: 972 : }
479 : 972 : }
480 : :
481 : : /*************************************************************************
482 : : |*
483 : : |* Zoom-Faktor fuer InPlace einstellen
484 : : |*
485 : : \************************************************************************/
486 : :
487 : 0 : void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
488 : : {
489 [ # # ]: 0 : ViewShell::SetZoomFactor(rZoomX, rZoomY);
490 : 0 : mbZoomOnPage = sal_False;
491 [ # # ][ # # ]: 0 : Point aOrigin = GetActiveWindow()->GetViewOrigin();
492 [ # # ][ # # ]: 0 : GetActiveWindow()->SetWinViewPos(aOrigin);
493 : 0 : }
494 : :
495 : : /*************************************************************************
496 : : |*
497 : : |* Optimale Groesse zurueckgeben
498 : : |*
499 : : \************************************************************************/
500 : :
501 : 0 : Size DrawViewShell::GetOptimalSizePixel() const
502 : : {
503 : 0 : Size aSize;
504 : :
505 : 0 : SdrPageView* pPV = mpDrawView->GetSdrPageView();
506 [ # # ]: 0 : if (pPV)
507 : : {
508 : 0 : SdPage* pPage = (SdPage*) pPV->GetPage();
509 : :
510 [ # # ]: 0 : if (pPage)
511 : : {
512 [ # # ]: 0 : if (!mbZoomOnPage)
513 : : {
514 : : // Gegenwaertigen MapMode beruecksichtigen
515 [ # # ][ # # ]: 0 : aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize() );
516 : : }
517 : : else
518 : : {
519 : : // 1:1 Darstellung
520 [ # # ]: 0 : MapMode aMapMode(MAP_100TH_MM);
521 [ # # ][ # # ]: 0 : aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize(), aMapMode );
[ # # ]
522 [ # # ]: 0 : const_cast< DrawViewShell* >(this)->mbZoomOnPage = sal_True;
523 : : }
524 : : }
525 : : }
526 : :
527 : 0 : return(aSize);
528 : : }
529 : :
530 : :
531 : : /*************************************************************************
532 : : |*
533 : : |* Seite wird gehided
534 : : |*
535 : : \************************************************************************/
536 : :
537 : 143 : void DrawViewShell::HidePage()
538 : : {
539 [ + - ]: 143 : FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
540 [ + + ]: 143 : if (pFormShell != NULL)
541 : 13 : pFormShell->PrepareClose (sal_False);
542 : 143 : }
543 : :
544 : :
545 : :
546 : 134 : void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
547 : : {
548 : 134 : WriteFrameViewData();
549 : :
550 : 134 : ViewShell::WriteUserDataSequence( rSequence, bBrowse );
551 : :
552 : 134 : const sal_Int32 nIndex = rSequence.getLength();
553 : 134 : rSequence.realloc( nIndex + 1 );
554 : 134 : rSequence[nIndex].Name = sUNO_View_ZoomOnPage ;
555 [ + - ][ + - ]: 134 : rSequence[nIndex].Value <<= (sal_Bool)mbZoomOnPage;
556 : 134 : }
557 : :
558 : 130 : void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
559 : : {
560 : 130 : WriteFrameViewData();
561 : :
562 : 130 : ViewShell::ReadUserDataSequence( rSequence, bBrowse );
563 : :
564 : 130 : const sal_Int32 nLength = rSequence.getLength();
565 : 130 : const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
566 [ + + ]: 5590 : for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
567 : : {
568 [ + + ]: 5460 : if ( pValue->Name == sUNO_View_ZoomOnPage )
569 : : {
570 : 130 : sal_Bool bZoomPage = sal_False;
571 [ + - ]: 130 : if( pValue->Value >>= bZoomPage )
572 : : {
573 : 130 : mbZoomOnPage = bZoomPage;
574 : : }
575 : : }
576 : : }
577 : :
578 [ - + ]: 130 : if( mpFrameView->GetPageKind() != mePageKind )
579 : : {
580 : 0 : mePageKind = mpFrameView->GetPageKind();
581 : :
582 [ # # ]: 0 : if (mePageKind == PK_NOTES)
583 : : {
584 : 0 : SetHelpId( SID_NOTESMODE );
585 [ # # ][ # # ]: 0 : GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
586 [ # # ][ # # ]: 0 : GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
587 : : }
588 [ # # ]: 0 : else if (mePageKind == PK_HANDOUT)
589 : : {
590 : 0 : SetHelpId( SID_HANDOUTMODE );
591 [ # # ][ # # ]: 0 : GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
592 [ # # ][ # # ]: 0 : GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
593 : : }
594 : : else
595 : : {
596 : 0 : SetHelpId( SD_IF_SDDRAWVIEWSHELL );
597 [ # # ][ # # ]: 0 : GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
598 [ # # ][ # # ]: 0 : GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
599 : : }
600 : : }
601 : :
602 : 130 : ReadFrameViewData( mpFrameView );
603 : :
604 [ - + ]: 130 : if( !mbZoomOnPage )
605 : : {
606 : 0 : const Rectangle aVisArea( mpFrameView->GetVisArea() );
607 : :
608 [ # # ][ # # ]: 0 : if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
609 : : {
610 [ # # ][ # # ]: 0 : GetDocSh()->SetVisArea(aVisArea);
611 : : }
612 : :
613 [ # # ]: 0 : VisAreaChanged(aVisArea);
614 : :
615 : 0 : ::sd::View* pView = GetView();
616 : :
617 [ # # ]: 0 : if (pView)
618 : : {
619 [ # # ][ # # ]: 0 : pView->VisAreaChanged(GetActiveWindow());
620 : : }
621 : :
622 [ # # ]: 0 : SetZoomRect(aVisArea);
623 : : }
624 : :
625 : 130 : ChangeEditMode (meEditMode, ! IsLayerModeActive());
626 : 130 : ChangeEditMode (meEditMode, ! IsLayerModeActive());
627 : 130 : ResetActualLayer();
628 : 130 : }
629 : :
630 : 903 : void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
631 : : {
632 : 903 : ViewShell::VisAreaChanged( rRect );
633 : :
634 : 903 : DrawController& rController = GetViewShellBase().GetDrawController();
635 : 903 : rController.FireVisAreaChanged (rRect);
636 : 903 : }
637 : :
638 : :
639 : :
640 : :
641 : : /** If there is a valid controller then create a new instance of
642 : : <type>AccessibleDrawDocumentView</type>. Otherwise return an empty
643 : : reference.
644 : : */
645 : : ::com::sun::star::uno::Reference<
646 : : ::com::sun::star::accessibility::XAccessible>
647 : 6 : DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
648 : : {
649 [ + - ][ + - ]: 6 : if (GetViewShellBase().GetController() != NULL)
650 : : {
651 : : accessibility::AccessibleDrawDocumentView* pDocumentView =
652 : : new accessibility::AccessibleDrawDocumentView (
653 : : pWindow,
654 : : this,
655 : 6 : GetViewShellBase().GetController(),
656 [ + - ][ + - ]: 6 : pWindow->GetAccessibleParentWindow()->GetAccessible());
[ + - ]
657 : 6 : pDocumentView->Init();
658 : : return ::com::sun::star::uno::Reference<
659 : : ::com::sun::star::accessibility::XAccessible>
660 : : (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
661 : 6 : ::com::sun::star::uno::UNO_QUERY);
662 : : }
663 : :
664 : : OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
665 : 6 : return ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>();
666 : : }
667 : :
668 : :
669 : :
670 : :
671 : 0 : int DrawViewShell::GetActiveTabLayerIndex (void) const
672 : : {
673 : : const LayerTabBar* pBar
674 : 0 : = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
675 [ # # ]: 0 : if (pBar != NULL)
676 : 0 : return pBar->GetPagePos (pBar->GetCurPageId());
677 : : else
678 : 0 : return -1;
679 : : }
680 : :
681 : :
682 : :
683 : :
684 : 0 : void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
685 : : {
686 : 0 : LayerTabBar* pBar = GetLayerTabControl ();
687 [ # # ]: 0 : if (pBar != NULL)
688 : : {
689 : : // Ignore invalid indices silently.
690 [ # # ][ # # ]: 0 : if (nIndex>=0 && nIndex<pBar->GetPageCount())
[ # # ]
691 : : {
692 : : // Tell the draw view and the tab control of the new active layer.
693 [ # # ]: 0 : mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
694 : 0 : pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
695 : : }
696 : : }
697 : 0 : }
698 : :
699 : :
700 : :
701 : :
702 : 0 : TabControl* DrawViewShell::GetPageTabControl (void)
703 : : {
704 : 0 : return &maTabControl;
705 : : }
706 : :
707 : :
708 : :
709 : :
710 : 706 : LayerTabBar* DrawViewShell::GetLayerTabControl (void)
711 : : {
712 : 706 : return mpLayerTabBar.get();
713 : : }
714 : :
715 : :
716 : :
717 : :
718 : 0 : int DrawViewShell::GetTabLayerCount (void) const
719 : : {
720 : : const LayerTabBar* pBar
721 : 0 : = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
722 [ # # ]: 0 : if (pBar != NULL)
723 : 0 : return pBar->GetPageCount();
724 : : else
725 : 0 : return 0;
726 : : }
727 : :
728 : :
729 : : } // end of namespace sd
730 : :
731 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|