Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "DrawViewShell.hxx"
21 : #include "PresentationViewShell.hxx"
22 : #include <editeng/outliner.hxx>
23 : #include <svx/svxids.hrc>
24 : #include <sfx2/request.hxx>
25 : #include <sfx2/dispatch.hxx>
26 : #include <svx/svdpagv.hxx>
27 : #include <vcl/scrbar.hxx>
28 : #include <vcl/settings.hxx>
29 :
30 : #include <tools/poly.hxx>
31 : #include <svx/fmshell.hxx>
32 : #include <editeng/eeitem.hxx>
33 : #include <svtools/colorcfg.hxx>
34 : #include "AccessibleDrawDocumentView.hxx"
35 :
36 : #include <sfx2/viewfrm.hxx>
37 : #include "LayerTabBar.hxx"
38 :
39 : #include "strings.hrc"
40 : #include "res_bmp.hrc"
41 : #include "glob.hrc"
42 : #include "app.hrc"
43 : #include "helpids.h"
44 : #include "optsitem.hxx"
45 : #include "sdmod.hxx"
46 : #include "FrameView.hxx"
47 : #include "sdattr.hxx"
48 : #include "futext.hxx"
49 : #include "sdpage.hxx"
50 : #include "stlpool.hxx"
51 : #include "prntopts.hxx"
52 : #include "sdresid.hxx"
53 : #include "Window.hxx"
54 : #include "drawview.hxx"
55 : #include "drawdoc.hxx"
56 : #include "DrawDocShell.hxx"
57 : #include "Outliner.hxx"
58 : #include "Client.hxx"
59 : #include "slideshow.hxx"
60 : #include "unokywds.hxx"
61 : #include "SdUnoDrawView.hxx"
62 : #include "ViewShellBase.hxx"
63 : #include "FormShellManager.hxx"
64 : #include "DrawController.hxx"
65 : #include <boost/scoped_ptr.hpp>
66 :
67 : namespace sd {
68 :
69 212 : void DrawViewShell::ModelHasChanged()
70 : {
71 212 : Invalidate();
72 : // that the navigator also gets an up to date state
73 212 : GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, true, false );
74 :
75 212 : SfxBoolItem aItem( SID_3D_STATE, true );
76 : GetViewFrame()->GetDispatcher()->Execute(
77 212 : SID_3D_STATE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, &aItem, 0L );
78 :
79 : // now initialize the TextEditOutliner which was newly created by the draw engine
80 212 : ::Outliner* pOutliner = mpDrawView->GetTextEditOutliner();
81 212 : if (pOutliner)
82 : {
83 0 : SfxStyleSheetPool* pSPool = static_cast<SfxStyleSheetPool*>( GetDocSh()->GetStyleSheetPool() );
84 0 : pOutliner->SetStyleSheetPool(pSPool);
85 212 : }
86 212 : }
87 :
88 550 : void DrawViewShell::Resize()
89 : {
90 550 : ViewShell::Resize();
91 :
92 550 : if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
93 : {
94 0 : SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
95 : }
96 :
97 550 : rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
98 550 : if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() )
99 : {
100 0 : xSlideshow->resize(maViewSize);
101 550 : }
102 550 : }
103 :
104 427 : void DrawViewShell::ArrangeGUIElements()
105 : {
106 : // Retrieve the current size (thickness) of the scroll bars. That is
107 : // the width of the vertical and the height of the horizontal scroll
108 : // bar.
109 427 : int nScrollBarSize = GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
110 427 : maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
111 :
112 427 : Point aHPos = maViewPos;
113 427 : aHPos.Y() += maViewSize.Height();
114 :
115 427 : ViewShell::ArrangeGUIElements ();
116 :
117 427 : maTabControl->Hide();
118 :
119 : OSL_ASSERT (GetViewShell()!=NULL);
120 427 : Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
121 427 : bool bClientActive = false;
122 427 : if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
123 0 : bClientActive = true;
124 :
125 427 : bool bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace();
126 :
127 427 : if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
128 : {
129 : // with split, always resize first window
130 : //af pWindow = mpContentWindow.get();
131 427 : SfxRequest aReq(SID_SIZE_PAGE, SfxCallMode::SLOT, GetDoc()->GetItemPool());
132 427 : ExecuteSlot( aReq );
133 : }
134 427 : }
135 :
136 : /**
137 : * Apply data of the FrameView on the current view
138 : */
139 461 : void DrawViewShell::ReadFrameViewData(FrameView* pView)
140 : {
141 461 : ModifyGuard aGuard( GetDoc() );
142 :
143 : // this option has to be adjust at the model
144 461 : GetDoc()->SetPickThroughTransparentTextFrames(
145 922 : SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
146 :
147 : // initialization of the Character-(Screen-) attribute
148 461 : if (HasRuler() != pView->HasRuler())
149 86 : SetRuler( pView->HasRuler() );
150 :
151 461 : if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
152 134 : mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
153 :
154 461 : if (mpDrawView->GetGridFine() != pView->GetGridFine())
155 134 : mpDrawView->SetGridFine( pView->GetGridFine() );
156 :
157 461 : if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
158 134 : mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
159 :
160 461 : if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
161 133 : mpDrawView->SetGridVisible( pView->IsGridVisible() );
162 :
163 461 : if (mpDrawView->IsGridFront() != pView->IsGridFront())
164 0 : mpDrawView->SetGridFront( pView->IsGridFront() );
165 :
166 461 : if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
167 0 : mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
168 :
169 461 : if (mpDrawView->IsGridSnap() != pView->IsGridSnap() )
170 0 : mpDrawView->SetGridSnap( pView->IsGridSnap() );
171 :
172 461 : if (mpDrawView->IsBordSnap() != pView->IsBordSnap() )
173 0 : mpDrawView->SetBordSnap( pView->IsBordSnap() );
174 :
175 461 : if (mpDrawView->IsHlplSnap() != pView->IsHlplSnap() )
176 86 : mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
177 :
178 461 : if (mpDrawView->IsOFrmSnap() != pView->IsOFrmSnap() )
179 86 : mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
180 :
181 461 : if (mpDrawView->IsOPntSnap() != pView->IsOPntSnap() )
182 0 : mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
183 :
184 461 : if (mpDrawView->IsOConSnap() != pView->IsOConSnap() )
185 133 : mpDrawView->SetOConSnap( pView->IsOConSnap() );
186 :
187 461 : if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
188 133 : mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
189 :
190 461 : if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
191 0 : mpDrawView->SetDragStripes( pView->IsDragStripes() );
192 :
193 461 : if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
194 0 : mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
195 :
196 461 : if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
197 133 : mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
198 :
199 461 : if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
200 133 : mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
201 :
202 461 : if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
203 0 : mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
204 :
205 461 : if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
206 0 : mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
207 :
208 461 : if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
209 0 : mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
210 :
211 461 : if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
212 0 : mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
213 :
214 461 : if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
215 0 : mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
216 :
217 461 : if (mpDrawView->IsOrtho() != pView->IsOrtho() )
218 0 : mpDrawView->SetOrtho( pView->IsOrtho() );
219 :
220 461 : if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
221 133 : mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
222 :
223 461 : if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
224 0 : mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
225 :
226 461 : if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
227 0 : mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
228 :
229 461 : if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit())
230 0 : mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
231 :
232 : // #i26631#
233 461 : if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
234 133 : mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
235 :
236 : // handle size: 9 pixels
237 461 : sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel();
238 461 : if( nTmp != 9 )
239 133 : mpDrawView->SetMarkHdlSizePixel( 9 );
240 :
241 461 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
242 461 : if (pPageView)
243 : {
244 328 : if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() )
245 0 : pPageView->SetVisibleLayers( pView->GetVisibleLayers() );
246 :
247 328 : if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() )
248 0 : pPageView->SetPrintableLayers( pView->GetPrintableLayers() );
249 :
250 328 : if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() )
251 0 : pPageView->SetLockedLayers( pView->GetLockedLayers() );
252 :
253 328 : if (mePageKind == PK_NOTES)
254 : {
255 4 : if (pPageView->GetHelpLines() != pView->GetNotesHelpLines())
256 0 : pPageView->SetHelpLines( pView->GetNotesHelpLines() );
257 : }
258 324 : else if (mePageKind == PK_HANDOUT)
259 : {
260 4 : if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines())
261 0 : pPageView->SetHelpLines( pView->GetHandoutHelpLines() );
262 : }
263 : else
264 : {
265 320 : if (pPageView->GetHelpLines() != pView->GetStandardHelpLines())
266 0 : pPageView->SetHelpLines( pView->GetStandardHelpLines() );
267 : }
268 : }
269 :
270 461 : if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() )
271 133 : mpDrawView->SetActiveLayer( pView->GetActiveLayer() );
272 :
273 461 : sal_uInt16 nSelectedPage = 0;
274 :
275 461 : if (mePageKind != PK_HANDOUT)
276 : {
277 455 : nSelectedPage = pView->GetSelectedPage();
278 : }
279 :
280 461 : EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind);
281 461 : bool bNewLayerMode = pView->IsLayerMode();
282 :
283 461 : if(IsLayerModeActive() && bNewLayerMode)
284 : {
285 : // #i57936# Force mbIsLayerModeActive to false so that ChangeEditMode
286 : // below does something regarding LayerTabBar content refresh. That refresh
287 : // is only done when IsLayerModeActive changes. It needs to be done
288 : // since e.g. Layer vsisibility was changed above and this may need
289 : // a refresh to show the correct graphical representation
290 136 : mbIsLayerModeActive = false;
291 : }
292 :
293 461 : ChangeEditMode(eNewEditMode, bNewLayerMode);
294 461 : SwitchPage(nSelectedPage);
295 :
296 : // restore DrawMode for 'normal' window
297 461 : if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
298 0 : GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
299 :
300 461 : if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() )
301 : {
302 0 : SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() );
303 0 : GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, &aDesignModeItem, 0L );
304 : }
305 :
306 : // has to be called in the end, because it executes a WriteFrameViewData()
307 461 : if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
308 133 : mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
309 461 : }
310 :
311 : /**
312 : * Apply data of the current view on the FrameView
313 : */
314 774 : void DrawViewShell::WriteFrameViewData()
315 : {
316 : // store character-(screen-) attribute of FrameView
317 774 : mpFrameView->SetRuler( HasRuler() );
318 774 : mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
319 774 : mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
320 774 : mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
321 774 : mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
322 774 : mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
323 774 : mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
324 774 : mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
325 774 : mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
326 774 : mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
327 774 : mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
328 774 : mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
329 774 : mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
330 774 : mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
331 774 : mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
332 774 : mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
333 774 : mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
334 774 : mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
335 774 : mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
336 774 : mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
337 774 : mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
338 774 : mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
339 774 : mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
340 774 : mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
341 :
342 774 : mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
343 774 : mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
344 :
345 774 : mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
346 :
347 774 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
348 774 : Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
349 774 : mpFrameView->SetVisArea(aVisArea);
350 :
351 774 : if( mePageKind == PK_HANDOUT )
352 8 : mpFrameView->SetSelectedPage(0);
353 : else
354 : {
355 766 : mpFrameView->SetSelectedPage( maTabControl->GetCurPageId() - 1 );
356 : }
357 :
358 774 : mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
359 774 : mpFrameView->SetLayerMode(IsLayerModeActive());
360 :
361 774 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
362 :
363 774 : if (pPageView)
364 : {
365 774 : if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
366 0 : mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
367 :
368 774 : if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
369 0 : mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
370 :
371 774 : if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
372 0 : mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
373 :
374 774 : if (mePageKind == PK_NOTES)
375 : {
376 8 : mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
377 : }
378 766 : else if (mePageKind == PK_HANDOUT)
379 : {
380 8 : mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
381 : }
382 : else
383 : {
384 758 : mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
385 : }
386 : }
387 :
388 774 : if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
389 0 : mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
390 :
391 : // store DrawMode for 'normal' window
392 774 : if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
393 0 : mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
394 774 : }
395 :
396 984 : void DrawViewShell::PrePaint()
397 : {
398 984 : mpDrawView->PrePaint();
399 984 : }
400 :
401 : /**
402 : * The event is forwarded to the Viewshell and the current function by the
403 : * window pWin.
404 : *
405 : * Remark: pWin==NULL, if Paint() is called from ShowWindow!
406 : */
407 838 : void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
408 : {
409 : // Fill var FillColor here to have it available on later call
410 838 : svtools::ColorConfig aColorConfig;
411 838 : Color aFillColor;
412 :
413 838 : aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
414 :
415 : /* This is done before each text edit, so why not do it before every paint.
416 : The default language is only used if the outliner only contains one
417 : character in a symbol font */
418 838 : GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
419 :
420 : // Set Application Background color for usage in SdrPaintView(s)
421 838 : mpDrawView->SetApplicationBackgroundColor(aFillColor);
422 :
423 : /* This is done before each text edit, so why not do it before every paint.
424 : The default language is only used if the outliner only contains one
425 : character in a symbol font */
426 838 : GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
427 :
428 838 : mpDrawView->CompleteRedraw( pWin, vcl::Region( rRect ) );
429 838 : }
430 :
431 : /**
432 : * adjust zoom factor for InPlace
433 : */
434 0 : void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
435 : {
436 0 : ViewShell::SetZoomFactor(rZoomX, rZoomY);
437 0 : mbZoomOnPage = false;
438 0 : Point aOrigin = GetActiveWindow()->GetViewOrigin();
439 0 : GetActiveWindow()->SetWinViewPos(aOrigin);
440 0 : }
441 :
442 150 : void DrawViewShell::HidePage()
443 : {
444 150 : FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
445 150 : if (pFormShell != NULL)
446 15 : pFormShell->PrepareClose(false);
447 150 : }
448 :
449 112 : void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, bool bBrowse )
450 : {
451 112 : WriteFrameViewData();
452 :
453 112 : ViewShell::WriteUserDataSequence( rSequence, bBrowse );
454 :
455 112 : const sal_Int32 nIndex = rSequence.getLength();
456 112 : rSequence.realloc( nIndex + 1 );
457 112 : rSequence[nIndex].Name = sUNO_View_ZoomOnPage ;
458 112 : rSequence[nIndex].Value <<= mbZoomOnPage;
459 112 : }
460 :
461 126 : void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, bool bBrowse )
462 : {
463 126 : WriteFrameViewData();
464 :
465 126 : ViewShell::ReadUserDataSequence( rSequence, bBrowse );
466 :
467 126 : const sal_Int32 nLength = rSequence.getLength();
468 126 : const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
469 5418 : for (sal_Int32 i = 0 ; i < nLength; i++, pValue++ )
470 : {
471 5292 : if ( pValue->Name == sUNO_View_ZoomOnPage )
472 : {
473 126 : bool bZoomPage = false;
474 126 : if( pValue->Value >>= bZoomPage )
475 : {
476 126 : mbZoomOnPage = bZoomPage;
477 : }
478 : }
479 : }
480 :
481 126 : if( mpFrameView->GetPageKind() != mePageKind )
482 : {
483 0 : mePageKind = mpFrameView->GetPageKind();
484 :
485 0 : if (mePageKind == PK_NOTES)
486 : {
487 0 : SetHelpId( SID_NOTESMODE );
488 0 : GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
489 0 : GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
490 : }
491 0 : else if (mePageKind == PK_HANDOUT)
492 : {
493 0 : SetHelpId( SID_HANDOUTMODE );
494 0 : GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
495 0 : GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
496 : }
497 : else
498 : {
499 0 : SetHelpId( SD_IF_SDDRAWVIEWSHELL );
500 0 : GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
501 0 : GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
502 : }
503 : }
504 :
505 126 : ReadFrameViewData( mpFrameView );
506 :
507 126 : if( !mbZoomOnPage )
508 : {
509 0 : const Rectangle aVisArea( mpFrameView->GetVisArea() );
510 :
511 0 : if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
512 : {
513 0 : GetDocSh()->SetVisArea(aVisArea);
514 : }
515 :
516 0 : VisAreaChanged(aVisArea);
517 :
518 0 : ::sd::View* pView = GetView();
519 :
520 0 : if (pView)
521 : {
522 0 : pView->VisAreaChanged(GetActiveWindow());
523 : }
524 :
525 0 : SetZoomRect(aVisArea);
526 : }
527 :
528 126 : ChangeEditMode (meEditMode, ! IsLayerModeActive());
529 126 : ResetActualLayer();
530 126 : }
531 :
532 909 : void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
533 : {
534 909 : ViewShell::VisAreaChanged( rRect );
535 :
536 909 : DrawController& rController = GetViewShellBase().GetDrawController();
537 909 : rController.FireVisAreaChanged (rRect);
538 909 : }
539 :
540 : /** If there is a valid controller then create a new instance of
541 : <type>AccessibleDrawDocumentView</type>. Otherwise return an empty
542 : reference.
543 : */
544 : ::com::sun::star::uno::Reference<
545 : ::com::sun::star::accessibility::XAccessible>
546 3 : DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
547 : {
548 3 : if (GetViewShellBase().GetController() != NULL)
549 : {
550 : accessibility::AccessibleDrawDocumentView* pDocumentView =
551 : new accessibility::AccessibleDrawDocumentView (
552 : pWindow,
553 : this,
554 3 : GetViewShellBase().GetController(),
555 3 : pWindow->GetAccessibleParentWindow()->GetAccessible());
556 3 : pDocumentView->Init();
557 : return ::com::sun::star::uno::Reference<
558 : ::com::sun::star::accessibility::XAccessible>
559 : (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
560 3 : ::com::sun::star::uno::UNO_QUERY);
561 : }
562 :
563 : OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
564 0 : return ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>();
565 : }
566 :
567 0 : int DrawViewShell::GetActiveTabLayerIndex() const
568 : {
569 : const LayerTabBar* pBar
570 0 : = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
571 0 : if (pBar != NULL)
572 0 : return pBar->GetPagePos (pBar->GetCurPageId());
573 : else
574 0 : return -1;
575 : }
576 :
577 0 : void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
578 : {
579 0 : LayerTabBar* pBar = GetLayerTabControl ();
580 0 : if (pBar != NULL)
581 : {
582 : // Ignore invalid indices silently.
583 0 : if (nIndex>=0 && nIndex<pBar->GetPageCount())
584 : {
585 : // Tell the draw view and the tab control of the new active layer.
586 0 : mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
587 0 : pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
588 : boost::scoped_ptr<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView (
589 : *this,
590 0 : *GetView()));
591 0 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
592 0 : GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer );
593 : }
594 : }
595 0 : }
596 :
597 956 : LayerTabBar* DrawViewShell::GetLayerTabControl()
598 : {
599 956 : return mpLayerTabBar.get();
600 : }
601 :
602 0 : int DrawViewShell::GetTabLayerCount() const
603 : {
604 : const LayerTabBar* pBar
605 0 : = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
606 0 : if (pBar != NULL)
607 0 : return pBar->GetPageCount();
608 : else
609 0 : return 0;
610 : }
611 :
612 66 : } // end of namespace sd
613 :
614 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|