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 405 : void DrawViewShell::ModelHasChanged()
70 : {
71 405 : Invalidate();
72 : // that the navigator also gets an up to date state
73 405 : GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, true, false );
74 :
75 405 : SfxBoolItem aItem( SID_3D_STATE, true );
76 : GetViewFrame()->GetDispatcher()->Execute(
77 405 : SID_3D_STATE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, &aItem, 0L );
78 :
79 : // now initialize the TextEditOutliner which was newly created by the draw engine
80 405 : ::Outliner* pOutliner = mpDrawView->GetTextEditOutliner();
81 405 : if (pOutliner)
82 : {
83 0 : SfxStyleSheetPool* pSPool = (SfxStyleSheetPool*) GetDocSh()->GetStyleSheetPool();
84 0 : pOutliner->SetStyleSheetPool(pSPool);
85 405 : }
86 405 : }
87 :
88 934 : void DrawViewShell::Resize (void)
89 : {
90 934 : ViewShell::Resize();
91 :
92 934 : if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
93 : {
94 0 : SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
95 : }
96 :
97 934 : rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
98 934 : if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() )
99 : {
100 0 : xSlideshow->resize(maViewSize);
101 934 : }
102 934 : }
103 :
104 726 : void DrawViewShell::ArrangeGUIElements (void)
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 726 : int nScrollBarSize = GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
110 726 : maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
111 :
112 726 : Point aHPos = maViewPos;
113 726 : aHPos.Y() += maViewSize.Height();
114 :
115 726 : ViewShell::ArrangeGUIElements ();
116 :
117 726 : maTabControl.Hide();
118 :
119 : OSL_ASSERT (GetViewShell()!=NULL);
120 726 : Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
121 726 : bool bClientActive = false;
122 726 : if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
123 0 : bClientActive = true;
124 :
125 726 : bool bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace();
126 :
127 726 : if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
128 : {
129 : // with split, always resize first window
130 : //af pWindow = mpContentWindow.get();
131 726 : SfxRequest aReq(SID_SIZE_PAGE, SfxCallMode::SLOT, GetDoc()->GetItemPool());
132 726 : ExecuteSlot( aReq );
133 : }
134 726 : }
135 :
136 : /**
137 : * Apply data of the FrameView on the current view
138 : */
139 762 : void DrawViewShell::ReadFrameViewData(FrameView* pView)
140 : {
141 762 : ModifyGuard aGuard( GetDoc() );
142 :
143 : // this option has to be adjust at the model
144 762 : GetDoc()->SetPickThroughTransparentTextFrames(
145 1524 : SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
146 :
147 : // initialization of the Character-(Screen-) attribute
148 762 : if (HasRuler() != pView->HasRuler())
149 160 : SetRuler( pView->HasRuler() );
150 :
151 762 : if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
152 214 : mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
153 :
154 762 : if (mpDrawView->GetGridFine() != pView->GetGridFine())
155 214 : mpDrawView->SetGridFine( pView->GetGridFine() );
156 :
157 762 : if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
158 214 : mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
159 :
160 762 : if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
161 212 : mpDrawView->SetGridVisible( pView->IsGridVisible() );
162 :
163 762 : if (mpDrawView->IsGridFront() != pView->IsGridFront())
164 0 : mpDrawView->SetGridFront( pView->IsGridFront() );
165 :
166 762 : if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
167 0 : mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
168 :
169 762 : if (mpDrawView->IsGridSnap() != pView->IsGridSnap() )
170 0 : mpDrawView->SetGridSnap( pView->IsGridSnap() );
171 :
172 762 : if (mpDrawView->IsBordSnap() != pView->IsBordSnap() )
173 0 : mpDrawView->SetBordSnap( pView->IsBordSnap() );
174 :
175 762 : if (mpDrawView->IsHlplSnap() != pView->IsHlplSnap() )
176 160 : mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
177 :
178 762 : if (mpDrawView->IsOFrmSnap() != pView->IsOFrmSnap() )
179 160 : mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
180 :
181 762 : if (mpDrawView->IsOPntSnap() != pView->IsOPntSnap() )
182 0 : mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
183 :
184 762 : if (mpDrawView->IsOConSnap() != pView->IsOConSnap() )
185 212 : mpDrawView->SetOConSnap( pView->IsOConSnap() );
186 :
187 762 : if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
188 212 : mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
189 :
190 762 : if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
191 0 : mpDrawView->SetDragStripes( pView->IsDragStripes() );
192 :
193 762 : if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
194 0 : mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
195 :
196 762 : if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
197 212 : mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
198 :
199 762 : if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
200 212 : mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
201 :
202 762 : if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
203 0 : mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
204 :
205 762 : if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
206 0 : mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
207 :
208 762 : if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
209 0 : mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
210 :
211 762 : if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
212 0 : mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
213 :
214 762 : if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
215 0 : mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
216 :
217 762 : if (mpDrawView->IsOrtho() != pView->IsOrtho() )
218 0 : mpDrawView->SetOrtho( pView->IsOrtho() );
219 :
220 762 : if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
221 212 : mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
222 :
223 762 : if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
224 0 : mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
225 :
226 762 : if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
227 0 : mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
228 :
229 762 : if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit())
230 0 : mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
231 :
232 : // #i26631#
233 762 : if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
234 212 : mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
235 :
236 : // handle size: 9 pixels
237 762 : sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel();
238 762 : if( nTmp != 9 )
239 212 : mpDrawView->SetMarkHdlSizePixel( 9 );
240 :
241 762 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
242 762 : if (pPageView)
243 : {
244 550 : if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() )
245 0 : pPageView->SetVisibleLayers( pView->GetVisibleLayers() );
246 :
247 550 : if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() )
248 0 : pPageView->SetPrintableLayers( pView->GetPrintableLayers() );
249 :
250 550 : if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() )
251 0 : pPageView->SetLockedLayers( pView->GetLockedLayers() );
252 :
253 550 : if (mePageKind == PK_NOTES)
254 : {
255 0 : if (pPageView->GetHelpLines() != pView->GetNotesHelpLines())
256 0 : pPageView->SetHelpLines( pView->GetNotesHelpLines() );
257 : }
258 550 : else if (mePageKind == PK_HANDOUT)
259 : {
260 0 : if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines())
261 0 : pPageView->SetHelpLines( pView->GetHandoutHelpLines() );
262 : }
263 : else
264 : {
265 550 : if (pPageView->GetHelpLines() != pView->GetStandardHelpLines())
266 0 : pPageView->SetHelpLines( pView->GetStandardHelpLines() );
267 : }
268 : }
269 :
270 762 : if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() )
271 212 : mpDrawView->SetActiveLayer( pView->GetActiveLayer() );
272 :
273 762 : sal_uInt16 nSelectedPage = 0;
274 :
275 762 : if (mePageKind != PK_HANDOUT)
276 : {
277 762 : nSelectedPage = pView->GetSelectedPage();
278 : }
279 :
280 762 : EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind);
281 762 : bool bNewLayerMode = pView->IsLayerMode();
282 :
283 762 : 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 262 : mbIsLayerModeActive = false;
291 : }
292 :
293 762 : ChangeEditMode(eNewEditMode, bNewLayerMode);
294 762 : SwitchPage(nSelectedPage);
295 :
296 : // restore DrawMode for 'normal' window
297 762 : if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
298 0 : GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
299 :
300 762 : 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 762 : if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
308 212 : mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
309 762 : }
310 :
311 : /**
312 : * Apply data of the current view on the FrameView
313 : */
314 1324 : void DrawViewShell::WriteFrameViewData()
315 : {
316 : // store character-(screen-) attribute of FrameView
317 1324 : mpFrameView->SetRuler( HasRuler() );
318 1324 : mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
319 1324 : mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
320 1324 : mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
321 1324 : mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
322 1324 : mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
323 1324 : mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
324 1324 : mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
325 1324 : mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
326 1324 : mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
327 1324 : mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
328 1324 : mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
329 1324 : mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
330 1324 : mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
331 1324 : mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
332 1324 : mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
333 1324 : mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
334 1324 : mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
335 1324 : mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
336 1324 : mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
337 1324 : mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
338 1324 : mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
339 1324 : mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
340 1324 : mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
341 :
342 1324 : mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
343 1324 : mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
344 :
345 1324 : mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
346 :
347 1324 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
348 1324 : Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
349 1324 : mpFrameView->SetVisArea(aVisArea);
350 :
351 1324 : if( mePageKind == PK_HANDOUT )
352 0 : mpFrameView->SetSelectedPage(0);
353 : else
354 : {
355 1324 : mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
356 : }
357 :
358 1324 : mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
359 1324 : mpFrameView->SetLayerMode(IsLayerModeActive());
360 :
361 1324 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
362 :
363 1324 : if (pPageView)
364 : {
365 1324 : if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
366 0 : mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
367 :
368 1324 : if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
369 0 : mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
370 :
371 1324 : if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
372 0 : mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
373 :
374 1324 : if (mePageKind == PK_NOTES)
375 : {
376 0 : mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
377 : }
378 1324 : else if (mePageKind == PK_HANDOUT)
379 : {
380 0 : mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
381 : }
382 : else
383 : {
384 1324 : mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
385 : }
386 : }
387 :
388 1324 : if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
389 0 : mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
390 :
391 : // store DrawMode for 'normal' window
392 1324 : if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
393 0 : mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
394 1324 : }
395 :
396 614 : void DrawViewShell::PrePaint()
397 : {
398 614 : mpDrawView->PrePaint();
399 614 : }
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 477 : void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
408 : {
409 : // Fill var FillColor here to have it available on later call
410 477 : svtools::ColorConfig aColorConfig;
411 477 : Color aFillColor;
412 :
413 477 : 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 477 : GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
419 :
420 : // Set Application Background color for usage in SdrPaintView(s)
421 477 : 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 477 : GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
427 :
428 477 : mpDrawView->CompleteRedraw( pWin, vcl::Region( rRect ) );
429 :
430 477 : if( pWin )
431 : {
432 477 : if( GetDocSh()->GetDocShellFunction().is() )
433 0 : GetDocSh()->GetDocShellFunction()->Paint( rRect, pWin );
434 :
435 477 : if( HasCurrentFunction() )
436 477 : GetCurrentFunction()->Paint( rRect, pWin );
437 477 : }
438 477 : }
439 :
440 : /**
441 : * adjust zoom factor for InPlace
442 : */
443 0 : void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
444 : {
445 0 : ViewShell::SetZoomFactor(rZoomX, rZoomY);
446 0 : mbZoomOnPage = false;
447 0 : Point aOrigin = GetActiveWindow()->GetViewOrigin();
448 0 : GetActiveWindow()->SetWinViewPos(aOrigin);
449 0 : }
450 :
451 220 : void DrawViewShell::HidePage()
452 : {
453 220 : FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
454 220 : if (pFormShell != NULL)
455 8 : pFormShell->PrepareClose(false);
456 220 : }
457 :
458 214 : void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, bool bBrowse )
459 : {
460 214 : WriteFrameViewData();
461 :
462 214 : ViewShell::WriteUserDataSequence( rSequence, bBrowse );
463 :
464 214 : const sal_Int32 nIndex = rSequence.getLength();
465 214 : rSequence.realloc( nIndex + 1 );
466 214 : rSequence[nIndex].Name = sUNO_View_ZoomOnPage ;
467 214 : rSequence[nIndex].Value <<= mbZoomOnPage;
468 214 : }
469 :
470 212 : void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, bool bBrowse )
471 : {
472 212 : WriteFrameViewData();
473 :
474 212 : ViewShell::ReadUserDataSequence( rSequence, bBrowse );
475 :
476 212 : const sal_Int32 nLength = rSequence.getLength();
477 212 : const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
478 9116 : for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
479 : {
480 8904 : if ( pValue->Name == sUNO_View_ZoomOnPage )
481 : {
482 212 : bool bZoomPage = false;
483 212 : if( pValue->Value >>= bZoomPage )
484 : {
485 212 : mbZoomOnPage = bZoomPage;
486 : }
487 : }
488 : }
489 :
490 212 : if( mpFrameView->GetPageKind() != mePageKind )
491 : {
492 0 : mePageKind = mpFrameView->GetPageKind();
493 :
494 0 : if (mePageKind == PK_NOTES)
495 : {
496 0 : SetHelpId( SID_NOTESMODE );
497 0 : GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
498 0 : GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
499 : }
500 0 : else if (mePageKind == PK_HANDOUT)
501 : {
502 0 : SetHelpId( SID_HANDOUTMODE );
503 0 : GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
504 0 : GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
505 : }
506 : else
507 : {
508 0 : SetHelpId( SD_IF_SDDRAWVIEWSHELL );
509 0 : GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
510 0 : GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
511 : }
512 : }
513 :
514 212 : ReadFrameViewData( mpFrameView );
515 :
516 212 : if( !mbZoomOnPage )
517 : {
518 0 : const Rectangle aVisArea( mpFrameView->GetVisArea() );
519 :
520 0 : if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
521 : {
522 0 : GetDocSh()->SetVisArea(aVisArea);
523 : }
524 :
525 0 : VisAreaChanged(aVisArea);
526 :
527 0 : ::sd::View* pView = GetView();
528 :
529 0 : if (pView)
530 : {
531 0 : pView->VisAreaChanged(GetActiveWindow());
532 : }
533 :
534 0 : SetZoomRect(aVisArea);
535 : }
536 :
537 212 : ChangeEditMode (meEditMode, ! IsLayerModeActive());
538 212 : ResetActualLayer();
539 212 : }
540 :
541 1538 : void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
542 : {
543 1538 : ViewShell::VisAreaChanged( rRect );
544 :
545 1538 : DrawController& rController = GetViewShellBase().GetDrawController();
546 1538 : rController.FireVisAreaChanged (rRect);
547 1538 : }
548 :
549 : /** If there is a valid controller then create a new instance of
550 : <type>AccessibleDrawDocumentView</type>. Otherwise return an empty
551 : reference.
552 : */
553 : ::com::sun::star::uno::Reference<
554 : ::com::sun::star::accessibility::XAccessible>
555 6 : DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
556 : {
557 6 : if (GetViewShellBase().GetController() != NULL)
558 : {
559 : accessibility::AccessibleDrawDocumentView* pDocumentView =
560 : new accessibility::AccessibleDrawDocumentView (
561 : pWindow,
562 : this,
563 6 : GetViewShellBase().GetController(),
564 6 : pWindow->GetAccessibleParentWindow()->GetAccessible());
565 6 : pDocumentView->Init();
566 : return ::com::sun::star::uno::Reference<
567 : ::com::sun::star::accessibility::XAccessible>
568 : (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
569 6 : ::com::sun::star::uno::UNO_QUERY);
570 : }
571 :
572 : OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
573 0 : return ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>();
574 : }
575 :
576 0 : int DrawViewShell::GetActiveTabLayerIndex (void) const
577 : {
578 : const LayerTabBar* pBar
579 0 : = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
580 0 : if (pBar != NULL)
581 0 : return pBar->GetPagePos (pBar->GetCurPageId());
582 : else
583 0 : return -1;
584 : }
585 :
586 0 : void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
587 : {
588 0 : LayerTabBar* pBar = GetLayerTabControl ();
589 0 : if (pBar != NULL)
590 : {
591 : // Ignore invalid indices silently.
592 0 : if (nIndex>=0 && nIndex<pBar->GetPageCount())
593 : {
594 : // Tell the draw view and the tab control of the new active layer.
595 0 : mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
596 0 : pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
597 : boost::scoped_ptr<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView (
598 : *this,
599 0 : *GetView()));
600 0 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
601 0 : GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer );
602 : }
603 : }
604 0 : }
605 :
606 1616 : LayerTabBar* DrawViewShell::GetLayerTabControl (void)
607 : {
608 1616 : return mpLayerTabBar.get();
609 : }
610 :
611 0 : int DrawViewShell::GetTabLayerCount (void) const
612 : {
613 : const LayerTabBar* pBar
614 0 : = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
615 0 : if (pBar != NULL)
616 0 : return pBar->GetPageCount();
617 : else
618 0 : return 0;
619 : }
620 :
621 114 : } // end of namespace sd
622 :
623 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|