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