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