1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <DrawViewShell.hxx>
21 #include <editeng/outliner.hxx>
22 #include <svx/svxids.hrc>
23 #include <sfx2/request.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <svx/svdpagv.hxx>
26 #include <svx/svdoutl.hxx>
28 #include <vcl/settings.hxx>
29 #include <vcl/svapp.hxx>
30 #include <sdcommands.h>
31 #include <sal/log.hxx>
33 #include <svx/fmshell.hxx>
34 #include <editeng/eeitem.hxx>
35 #include <AccessibleDrawDocumentView.hxx>
37 #include <sfx2/viewfrm.hxx>
38 #include <LayerTabBar.hxx>
42 #include <optsitem.hxx>
44 #include <FrameView.hxx>
46 #include <drawview.hxx>
47 #include <drawdoc.hxx>
48 #include <DrawDocShell.hxx>
50 #include <slideshow.hxx>
51 #include <unokywds.hxx>
53 #include <SdUnoDrawView.hxx>
54 #include <ViewShellBase.hxx>
55 #include <FormShellManager.hxx>
56 #include <DrawController.hxx>
58 #include <comphelper/lok.hxx>
62 void DrawViewShell::ModelHasChanged()
65 // that the navigator also gets an up to date state
66 GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE
, true );
68 SfxBoolItem
aItem( SID_3D_STATE
, true );
69 GetViewFrame()->GetDispatcher()->ExecuteList(
70 SID_3D_STATE
, SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
, { &aItem
});
72 // now initialize the TextEditOutliner which was newly created by the draw engine
73 ::Outliner
* pOutliner
= mpDrawView
->GetTextEditOutliner();
76 SfxStyleSheetPool
* pSPool
= static_cast<SfxStyleSheetPool
*>( GetDocSh()->GetStyleSheetPool() );
77 pOutliner
->SetStyleSheetPool(pSPool
);
81 void DrawViewShell::Resize()
85 // tdf#151621 Do not set if the embedded object is opening in a new window.
86 if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
87 && GetDocSh()->IsInPlaceActive())
89 SetZoomRect(GetDocSh()->GetVisArea(ASPECT_CONTENT
));
92 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
93 if( xSlideshow
.is() && xSlideshow
->isRunning() && !xSlideshow
->isFullScreen() )
95 xSlideshow
->resize(maViewSize
);
99 void DrawViewShell::ArrangeGUIElements()
101 // Retrieve the current size (thickness) of the scroll bars. That is
102 // the width of the vertical and the height of the horizontal scroll
104 int nScrollBarSize
= GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
105 maScrBarWH
= Size (nScrollBarSize
, nScrollBarSize
);
107 ViewShell::ArrangeGUIElements ();
109 maTabControl
->Hide();
111 OSL_ASSERT (GetViewShell()!=nullptr);
112 Client
* pIPClient
= static_cast<Client
*>(GetViewShell()->GetIPClient());
113 bool bClientActive
= false;
114 if ( pIPClient
&& pIPClient
->IsObjectInPlaceActive() )
115 bClientActive
= true;
117 bool bInPlaceActive
= false;
118 if (SfxViewFrame
* pViewFrame
= GetViewFrame())
119 bInPlaceActive
= pViewFrame
->GetFrame().IsInPlace();
121 if ( mbZoomOnPage
&& !bInPlaceActive
&& !bClientActive
)
123 // with split, always resize first window
124 //af pWindow = mpContentWindow.get();
125 SfxRequest
aReq(SID_SIZE_PAGE
, SfxCallMode::SLOT
, GetDoc()->GetItemPool());
131 * Apply data of the FrameView on the current view
133 void DrawViewShell::ReadFrameViewData(FrameView
* pView
)
135 ModifyGuard
aGuard( GetDoc() );
137 // this option has to be adjust at the model
138 GetDoc()->SetPickThroughTransparentTextFrames(
139 SdModule::get()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
141 // initialization of the Character-(Screen-) attribute
142 if (HasRuler() != pView
->HasRuler())
143 SetRuler( pView
->HasRuler() );
145 if (mpDrawView
->GetGridCoarse() != pView
->GetGridCoarse())
146 mpDrawView
->SetGridCoarse( pView
->GetGridCoarse() );
148 if (mpDrawView
->GetGridFine() != pView
->GetGridFine())
149 mpDrawView
->SetGridFine( pView
->GetGridFine() );
151 if (mpDrawView
->GetSnapGridWidthX() != pView
->GetSnapGridWidthX() || mpDrawView
->GetSnapGridWidthY() != pView
->GetSnapGridWidthY())
152 mpDrawView
->SetSnapGridWidth(pView
->GetSnapGridWidthX(), pView
->GetSnapGridWidthY());
154 if (mpDrawView
->IsGridVisible() != pView
->IsGridVisible())
155 mpDrawView
->SetGridVisible( pView
->IsGridVisible() );
157 if (mpDrawView
->IsGridFront() != pView
->IsGridFront())
158 mpDrawView
->SetGridFront( pView
->IsGridFront() );
160 if (mpDrawView
->GetSnapAngle() != pView
->GetSnapAngle())
161 mpDrawView
->SetSnapAngle( pView
->GetSnapAngle() );
163 if (mpDrawView
->IsGridSnap() != pView
->IsGridSnap() )
164 mpDrawView
->SetGridSnap( pView
->IsGridSnap() );
166 if (mpDrawView
->IsBordSnap() != pView
->IsBordSnap() )
167 mpDrawView
->SetBordSnap( pView
->IsBordSnap() );
169 if (mpDrawView
->IsHlplSnap() != pView
->IsHlplSnap() )
170 mpDrawView
->SetHlplSnap( pView
->IsHlplSnap() );
172 if (mpDrawView
->IsOFrmSnap() != pView
->IsOFrmSnap() )
173 mpDrawView
->SetOFrmSnap( pView
->IsOFrmSnap() );
175 if (mpDrawView
->IsOPntSnap() != pView
->IsOPntSnap() )
176 mpDrawView
->SetOPntSnap( pView
->IsOPntSnap() );
178 if (mpDrawView
->IsOConSnap() != pView
->IsOConSnap() )
179 mpDrawView
->SetOConSnap( pView
->IsOConSnap() );
181 if (mpDrawView
->IsHlplVisible() != pView
->IsHlplVisible() )
182 mpDrawView
->SetHlplVisible( pView
->IsHlplVisible() );
184 if (mpDrawView
->IsDragStripes() != pView
->IsDragStripes() )
185 mpDrawView
->SetDragStripes( pView
->IsDragStripes() );
187 if (mpDrawView
->IsPlusHandlesAlwaysVisible() != pView
->IsPlusHandlesAlwaysVisible() )
188 mpDrawView
->SetPlusHandlesAlwaysVisible( pView
->IsPlusHandlesAlwaysVisible() );
190 if (mpDrawView
->GetSnapMagneticPixel() != pView
->GetSnapMagneticPixel() )
191 mpDrawView
->SetSnapMagneticPixel( pView
->GetSnapMagneticPixel() );
193 if (mpDrawView
->IsMarkedHitMovesAlways() != pView
->IsMarkedHitMovesAlways() )
194 mpDrawView
->SetMarkedHitMovesAlways( pView
->IsMarkedHitMovesAlways() );
196 if (mpDrawView
->IsMoveOnlyDragging() != pView
->IsMoveOnlyDragging() )
197 mpDrawView
->SetMoveOnlyDragging( pView
->IsMoveOnlyDragging() );
199 if (mpDrawView
->IsNoDragXorPolys() != pView
->IsNoDragXorPolys() )
200 mpDrawView
->SetNoDragXorPolys( pView
->IsNoDragXorPolys() );
202 if (mpDrawView
->IsCrookNoContortion() != pView
->IsCrookNoContortion() )
203 mpDrawView
->SetCrookNoContortion( pView
->IsCrookNoContortion() );
205 if (mpDrawView
->IsAngleSnapEnabled() != pView
->IsAngleSnapEnabled() )
206 mpDrawView
->SetAngleSnapEnabled( pView
->IsAngleSnapEnabled() );
208 if (mpDrawView
->IsBigOrtho() != pView
->IsBigOrtho() )
209 mpDrawView
->SetBigOrtho( pView
->IsBigOrtho() );
211 if (mpDrawView
->IsOrtho() != pView
->IsOrtho() )
212 mpDrawView
->SetOrtho( pView
->IsOrtho() );
214 if (mpDrawView
->GetEliminatePolyPointLimitAngle() != pView
->GetEliminatePolyPointLimitAngle() )
215 mpDrawView
->SetEliminatePolyPointLimitAngle( pView
->GetEliminatePolyPointLimitAngle() );
217 if (mpDrawView
->IsEliminatePolyPoints() != pView
->IsEliminatePolyPoints() )
218 mpDrawView
->SetEliminatePolyPoints( pView
->IsEliminatePolyPoints() );
220 if (mpDrawView
->IsSolidDragging() != pView
->IsSolidDragging() )
221 mpDrawView
->SetSolidDragging( pView
->IsSolidDragging() );
223 if (mpDrawView
->IsQuickTextEditMode() != pView
->IsQuickEdit())
224 mpDrawView
->SetQuickTextEditMode( pView
->IsQuickEdit() );
227 if (mpDrawView
->IsMasterPagePaintCaching() != pView
->IsMasterPagePaintCaching())
228 mpDrawView
->SetMasterPagePaintCaching( pView
->IsMasterPagePaintCaching() );
230 if (mpDrawView
->GetDragThresholdPixels() != pView
->GetDragThresholdPixels())
231 mpDrawView
->SetDragThresholdPixels( pView
->GetDragThresholdPixels() );
233 // handle size: 9 pixels
234 sal_uInt16 nTmp
= mpDrawView
->GetMarkHdlSizePixel();
236 mpDrawView
->SetMarkHdlSizePixel( 9 );
238 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
241 if ( pPageView
->GetVisibleLayers() != pView
->GetVisibleLayers() )
242 pPageView
->SetVisibleLayers( pView
->GetVisibleLayers() );
244 if ( pPageView
->GetPrintableLayers() != pView
->GetPrintableLayers() )
245 pPageView
->SetPrintableLayers( pView
->GetPrintableLayers() );
247 if ( pPageView
->GetLockedLayers() != pView
->GetLockedLayers() )
248 pPageView
->SetLockedLayers( pView
->GetLockedLayers() );
250 if (mePageKind
== PageKind::Notes
)
252 if (pPageView
->GetHelpLines() != pView
->GetNotesHelpLines())
253 pPageView
->SetHelpLines( pView
->GetNotesHelpLines() );
255 else if (mePageKind
== PageKind::Handout
)
257 if (pPageView
->GetHelpLines() != pView
->GetHandoutHelpLines())
258 pPageView
->SetHelpLines( pView
->GetHandoutHelpLines() );
262 if (pPageView
->GetHelpLines() != pView
->GetStandardHelpLines())
263 pPageView
->SetHelpLines( pView
->GetStandardHelpLines() );
267 if ( mpDrawView
->GetActiveLayer() != pView
->GetActiveLayer() )
268 mpDrawView
->SetActiveLayer( pView
->GetActiveLayer() );
270 sal_uInt16 nSelectedPage
= 0;
272 if (mePageKind
!= PageKind::Handout
)
274 nSelectedPage
= pView
->GetSelectedPage();
277 EditMode eNewEditMode
= pView
->GetViewShEditMode(/*mePageKind*/);
278 bool bNewLayerMode
= pView
->IsLayerMode();
280 if(IsLayerModeActive() && bNewLayerMode
)
282 // #i57936# Force mbIsLayerModeActive to false so that ChangeEditMode
283 // below does something regarding LayerTabBar content refresh. That refresh
284 // is only done when IsLayerModeActive changes. It needs to be done
285 // since e.g. Layer visibility was changed above and this may need
286 // a refresh to show the correct graphical representation
287 mbIsLayerModeActive
= false;
290 ChangeEditMode(eNewEditMode
, bNewLayerMode
);
291 SwitchPage(nSelectedPage
);
293 // restore DrawMode for 'normal' window
294 if(GetActiveWindow()->GetOutDev()->GetDrawMode() != pView
->GetDrawMode())
295 GetActiveWindow()->GetOutDev()->SetDrawMode(pView
->GetDrawMode());
297 if ( mpDrawView
->IsDesignMode() != pView
->IsDesignMode() )
299 SfxBoolItem
aDesignModeItem( SID_FM_DESIGN_MODE
, pView
->IsDesignMode() );
300 GetViewFrame()->GetDispatcher()->ExecuteList(SID_FM_DESIGN_MODE
,
301 SfxCallMode::SYNCHRON
| SfxCallMode::RECORD
,
302 { &aDesignModeItem
});
305 // has to be called in the end, because it executes a WriteFrameViewData()
306 if (mpDrawView
->IsFrameDragSingles() != pView
->IsFrameDragSingles() )
307 mpDrawView
->SetFrameDragSingles( pView
->IsFrameDragSingles() );
311 * Apply data of the current view on the FrameView
313 void DrawViewShell::WriteFrameViewData()
315 // store character-(screen-) attribute of FrameView
316 mpFrameView
->SetRuler( HasRuler() );
317 mpFrameView
->SetGridCoarse( mpDrawView
->GetGridCoarse() );
318 mpFrameView
->SetGridFine( mpDrawView
->GetGridFine() );
319 mpFrameView
->SetSnapGridWidth(mpDrawView
->GetSnapGridWidthX(), mpDrawView
->GetSnapGridWidthY());
321 // In LOK, Grid isn't implemented, and it appears in the slide thumbnails
322 // Remove this when Grid is implemented and/or thumbnails are fixed to no longer
324 if (comphelper::LibreOfficeKit::isActive())
325 mpFrameView
->SetGridVisible( false );
327 mpFrameView
->SetGridVisible( mpDrawView
->IsGridVisible() );
329 mpFrameView
->SetGridFront( mpDrawView
->IsGridFront() );
330 mpFrameView
->SetSnapAngle( mpDrawView
->GetSnapAngle() );
331 mpFrameView
->SetGridSnap( mpDrawView
->IsGridSnap() );
332 mpFrameView
->SetBordSnap( mpDrawView
->IsBordSnap() );
333 mpFrameView
->SetHlplSnap( mpDrawView
->IsHlplSnap() );
334 mpFrameView
->SetOFrmSnap( mpDrawView
->IsOFrmSnap() );
335 mpFrameView
->SetOPntSnap( mpDrawView
->IsOPntSnap() );
336 mpFrameView
->SetOConSnap( mpDrawView
->IsOConSnap() );
337 mpFrameView
->SetHlplVisible( mpDrawView
->IsHlplVisible() );
338 mpFrameView
->SetDragStripes( mpDrawView
->IsDragStripes() );
339 mpFrameView
->SetPlusHandlesAlwaysVisible( mpDrawView
->IsPlusHandlesAlwaysVisible() );
340 mpFrameView
->SetFrameDragSingles( mpDrawView
->IsFrameDragSingles() );
341 mpFrameView
->SetMarkedHitMovesAlways( mpDrawView
->IsMarkedHitMovesAlways() );
342 mpFrameView
->SetMoveOnlyDragging( mpDrawView
->IsMoveOnlyDragging() );
343 mpFrameView
->SetNoDragXorPolys( mpDrawView
->IsNoDragXorPolys() );
344 mpFrameView
->SetCrookNoContortion( mpDrawView
->IsCrookNoContortion() );
345 mpFrameView
->SetBigOrtho( mpDrawView
->IsBigOrtho() );
346 mpFrameView
->SetEliminatePolyPointLimitAngle( mpDrawView
->GetEliminatePolyPointLimitAngle() );
347 mpFrameView
->SetEliminatePolyPoints( mpDrawView
->IsEliminatePolyPoints() );
349 mpFrameView
->SetSolidDragging( mpDrawView
->IsSolidDragging() );
350 mpFrameView
->SetQuickEdit( mpDrawView
->IsQuickTextEditMode() );
352 mpFrameView
->SetDesignMode( mpDrawView
->IsDesignMode() );
354 Size aVisSizePixel
= GetActiveWindow()->GetOutputSizePixel();
355 ::tools::Rectangle aVisArea
= GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), aVisSizePixel
) );
356 if (comphelper::LibreOfficeKit::isActive())
358 // aVisArea is nonsensical in the LOK case, use the slide size
359 aVisArea
= ::tools::Rectangle(Point(), getCurrentPage()->GetSize());
362 mpFrameView
->SetVisArea(aVisArea
);
364 if( mePageKind
== PageKind::Handout
)
365 mpFrameView
->SetSelectedPage(0);
368 mpFrameView
->SetSelectedPage( maTabControl
->GetCurPagePos() );
371 mpFrameView
->SetViewShEditMode(meEditMode
);
372 mpFrameView
->SetLayerMode(IsLayerModeActive());
374 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
378 if ( mpFrameView
->GetVisibleLayers() != pPageView
->GetVisibleLayers() )
379 mpFrameView
->SetVisibleLayers( pPageView
->GetVisibleLayers() );
381 if ( mpFrameView
->GetPrintableLayers() != pPageView
->GetPrintableLayers() )
382 mpFrameView
->SetPrintableLayers( pPageView
->GetPrintableLayers() );
384 if ( mpFrameView
->GetLockedLayers() != pPageView
->GetLockedLayers() )
385 mpFrameView
->SetLockedLayers( pPageView
->GetLockedLayers() );
387 if (mePageKind
== PageKind::Notes
)
389 mpFrameView
->SetNotesHelpLines( pPageView
->GetHelpLines() );
391 else if (mePageKind
== PageKind::Handout
)
393 mpFrameView
->SetHandoutHelpLines( pPageView
->GetHelpLines() );
397 mpFrameView
->SetStandardHelpLines( pPageView
->GetHelpLines() );
401 if ( mpFrameView
->GetActiveLayer() != mpDrawView
->GetActiveLayer() )
402 mpFrameView
->SetActiveLayer( mpDrawView
->GetActiveLayer() );
404 // store DrawMode for 'normal' window
405 if(mpFrameView
->GetDrawMode() != GetActiveWindow()->GetOutDev()->GetDrawMode())
406 mpFrameView
->SetDrawMode(GetActiveWindow()->GetOutDev()->GetDrawMode());
409 void DrawViewShell::PrePaint()
411 mpDrawView
->PrePaint();
415 * The event is forwarded to the Viewshell and the current function by the
418 * Remark: pWin==NULL, if Paint() is called from ShowWindow!
420 void DrawViewShell::Paint(const ::tools::Rectangle
& rRect
, ::sd::Window
* pWin
)
422 /* This is done before each text edit, so why not do it before every paint.
423 The default language is only used if the outliner only contains one
424 character in a symbol font */
425 GetDoc()->GetDrawOutliner().SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE
) );
427 // Set Application Background color for usage in SdrPaintView(s)
428 mpDrawView
->SetApplicationBackgroundColor( GetViewOptions().mnAppBackgroundColor
);
430 /* This is done before each text edit, so why not do it before every paint.
431 The default language is only used if the outliner only contains one
432 character in a symbol font */
433 GetDoc()->GetDrawOutliner().SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
435 mpDrawView
->CompleteRedraw( pWin
->GetOutDev(), vcl::Region( rRect
) );
439 * adjust zoom factor for InPlace
441 void DrawViewShell::SetZoomFactor(const Fraction
& rZoomX
, const Fraction
& rZoomY
)
443 ViewShell::SetZoomFactor(rZoomX
, rZoomY
);
444 mbZoomOnPage
= false;
445 Point aOrigin
= GetActiveWindow()->GetViewOrigin();
446 GetActiveWindow()->SetWinViewPos(aOrigin
);
449 void DrawViewShell::HidePage()
451 FmFormShell
* pFormShell
= GetViewShellBase().GetFormShellManager()->GetFormShell();
452 if (pFormShell
!= nullptr)
453 pFormShell
->PrepareClose(false);
456 void DrawViewShell::WriteUserDataSequence ( css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
)
458 WriteFrameViewData();
460 ViewShell::WriteUserDataSequence( rSequence
);
462 const sal_Int32 nIndex
= rSequence
.getLength();
463 rSequence
.realloc( nIndex
+ 1 );
464 auto pSequence
= rSequence
.getArray();
465 pSequence
[nIndex
].Name
= sUNO_View_ZoomOnPage
;
466 pSequence
[nIndex
].Value
<<= mbZoomOnPage
;
468 // Common SdrModel processing
469 GetDocSh()->GetDoc()->WriteUserDataSequence(rSequence
);
472 void DrawViewShell::ReadUserDataSequence ( const css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
)
474 WriteFrameViewData();
476 ViewShell::ReadUserDataSequence( rSequence
);
478 for (const css::beans::PropertyValue
& rValue
: rSequence
)
480 if ( rValue
.Name
== sUNO_View_ZoomOnPage
)
482 bool bZoomPage
= false;
483 if( rValue
.Value
>>= bZoomPage
)
485 mbZoomOnPage
= bZoomPage
;
488 // Fallback to common SdrModel processing
489 else GetDocSh()->GetDoc()->ReadUserDataSequenceValue(&rValue
);
492 // The parameter rSequence contains the config-items from
493 // <config:config-item-set config:name="ooo:view-settings">. Determine, whether
494 // they contain "VisibleLayers", "PrintableLayers" and "LockedLayers". If not, it
495 // is a foreign document or a new document after transition period and the corresponding
496 // information were read from <draw:layer-set>. In that case we need to bring
497 // the information from model to view.
498 bool bHasVisiPrnLockSettings(false);
499 for ( auto & rPropertyValue
: rSequence
)
501 if ( rPropertyValue
.Name
== sUNO_View_VisibleLayers
502 || rPropertyValue
.Name
== sUNO_View_PrintableLayers
503 || rPropertyValue
.Name
== sUNO_View_LockedLayers
)
505 bHasVisiPrnLockSettings
= true;
509 if ( !bHasVisiPrnLockSettings
)
511 const SdrLayerAdmin
& rLayerAdmin
= GetDocSh()->GetDoc()->GetLayerAdmin();
512 SdrLayerIDSet aSdrLayerIDSet
;
513 rLayerAdmin
.getVisibleLayersODF( aSdrLayerIDSet
);
514 mpFrameView
-> SetVisibleLayers( aSdrLayerIDSet
);
515 rLayerAdmin
.getPrintableLayersODF( aSdrLayerIDSet
);
516 mpFrameView
-> SetPrintableLayers( aSdrLayerIDSet
);
517 rLayerAdmin
.getLockedLayersODF( aSdrLayerIDSet
);
518 mpFrameView
-> SetLockedLayers( aSdrLayerIDSet
);
522 // tdf#129898 repair layer "DrawnInSlideshow", which was wrongly written
523 // in LO 6.2 to 6.4. The ODF defaults were corrected when reading draw:layer-set, but
524 // not in reading config settings, because there the name is not known.
525 const SdrLayerAdmin
& rLayerAdmin
= GetDocSh()->GetDoc()->GetLayerAdmin();
526 if (rLayerAdmin
.GetLayer(u
"DrawnInSlideshow"_ustr
))
528 SdrLayerIDSet aSdrLayerIDSet
;
529 rLayerAdmin
.getVisibleLayersODF( aSdrLayerIDSet
);
530 mpFrameView
-> SetVisibleLayers( aSdrLayerIDSet
);
531 rLayerAdmin
.getPrintableLayersODF( aSdrLayerIDSet
);
532 mpFrameView
-> SetPrintableLayers( aSdrLayerIDSet
);
533 rLayerAdmin
.getLockedLayersODF( aSdrLayerIDSet
);
534 mpFrameView
-> SetLockedLayers( aSdrLayerIDSet
);
539 if( mpFrameView
->GetPageKind() != mePageKind
)
541 mePageKind
= mpFrameView
->GetPageKind();
543 if (mePageKind
== PageKind::Notes
)
545 GetActiveWindow()->SetHelpId( CMD_SID_NOTES_MODE
);
547 else if (mePageKind
== PageKind::Handout
)
549 GetActiveWindow()->SetHelpId( CMD_SID_HANDOUT_MASTER_MODE
);
553 GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL
);
557 ReadFrameViewData( mpFrameView
);
561 const ::tools::Rectangle
aVisArea( mpFrameView
->GetVisArea() );
563 // tdf#151621 Do not set if the embedded object is opening in a new window.
564 if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
565 && GetDocSh()->IsInPlaceActive())
567 GetDocSh()->SetVisArea(aVisArea
);
570 VisAreaChanged(aVisArea
);
572 ::sd::View
* pView
= GetView();
576 pView
->VisAreaChanged(GetActiveWindow()->GetOutDev());
579 SetZoomRect(aVisArea
);
581 ChangeEditMode (meEditMode
, ! IsLayerModeActive());
585 void DrawViewShell::VisAreaChanged(const ::tools::Rectangle
& rRect
)
587 ViewShell::VisAreaChanged( rRect
);
589 DrawController
& rController
= *GetViewShellBase().GetDrawController();
590 rController
.FireVisAreaChanged (rRect
);
593 /** If there is a valid controller then create a new instance of
594 <type>AccessibleDrawDocumentView</type>. Otherwise return an empty
597 css::uno::Reference
<css::accessibility::XAccessible
>
598 DrawViewShell::CreateAccessibleDocumentView (::sd::Window
* pWindow
)
600 if (GetViewShellBase().GetController() != nullptr)
602 rtl::Reference
<accessibility::AccessibleDrawDocumentView
> pDocumentView
=
603 new accessibility::AccessibleDrawDocumentView (
606 GetViewShellBase().GetController(),
607 pWindow
->GetAccessibleParentWindow()->GetAccessible());
608 pDocumentView
->Init();
609 return pDocumentView
;
612 SAL_WARN("sd", "DrawViewShell::CreateAccessibleDocumentView: no controller");
613 return css::uno::Reference
< css::accessibility::XAccessible
>();
616 int DrawViewShell::GetActiveTabLayerIndex() const
618 const LayerTabBar
* pBar
619 = const_cast<DrawViewShell
*>(this)->GetLayerTabControl ();
621 return pBar
->GetPagePos (pBar
->GetCurPageId());
626 void DrawViewShell::SetActiveTabLayerIndex (int nIndex
)
628 LayerTabBar
* pBar
= GetLayerTabControl ();
632 // Ignore invalid indices silently.
633 if (nIndex
>=0 && nIndex
<pBar
->GetPageCount())
635 // Tell the draw view and the tab control of the new active layer.
636 mpDrawView
->SetActiveLayer (pBar
->GetLayerName (pBar
->GetPageId (static_cast<sal_uInt16
>(nIndex
))));
637 pBar
->SetCurPageId (pBar
->GetPageId (static_cast<sal_uInt16
>(nIndex
)));
638 rtl::Reference
<SdUnoDrawView
> pUnoDrawView(new SdUnoDrawView (
641 css::uno::Reference
< css::drawing::XLayer
> rLayer
= pUnoDrawView
->getActiveLayer();
642 GetViewShellBase().GetDrawController()->fireChangeLayer( &rLayer
);
646 LayerTabBar
* DrawViewShell::GetLayerTabControl()
648 return mpLayerTabBar
.get();
651 int DrawViewShell::GetTabLayerCount() const
653 const LayerTabBar
* pBar
654 = const_cast<DrawViewShell
*>(this)->GetLayerTabControl ();
656 return pBar
->GetPageCount();
661 } // end of namespace sd
663 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */