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
= GetViewFrame()->GetFrame().IsInPlace();
119 if ( mbZoomOnPage
&& !bInPlaceActive
&& !bClientActive
)
121 // with split, always resize first window
122 //af pWindow = mpContentWindow.get();
123 SfxRequest
aReq(SID_SIZE_PAGE
, SfxCallMode::SLOT
, GetDoc()->GetItemPool());
129 * Apply data of the FrameView on the current view
131 void DrawViewShell::ReadFrameViewData(FrameView
* pView
)
133 ModifyGuard
aGuard( GetDoc() );
135 // this option has to be adjust at the model
136 GetDoc()->SetPickThroughTransparentTextFrames(
137 SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
139 // initialization of the Character-(Screen-) attribute
140 if (HasRuler() != pView
->HasRuler())
141 SetRuler( pView
->HasRuler() );
143 if (mpDrawView
->GetGridCoarse() != pView
->GetGridCoarse())
144 mpDrawView
->SetGridCoarse( pView
->GetGridCoarse() );
146 if (mpDrawView
->GetGridFine() != pView
->GetGridFine())
147 mpDrawView
->SetGridFine( pView
->GetGridFine() );
149 if (mpDrawView
->GetSnapGridWidthX() != pView
->GetSnapGridWidthX() || mpDrawView
->GetSnapGridWidthY() != pView
->GetSnapGridWidthY())
150 mpDrawView
->SetSnapGridWidth(pView
->GetSnapGridWidthX(), pView
->GetSnapGridWidthY());
152 if (mpDrawView
->IsGridVisible() != pView
->IsGridVisible())
153 mpDrawView
->SetGridVisible( pView
->IsGridVisible() );
155 if (mpDrawView
->IsGridFront() != pView
->IsGridFront())
156 mpDrawView
->SetGridFront( pView
->IsGridFront() );
158 if (mpDrawView
->GetSnapAngle() != pView
->GetSnapAngle())
159 mpDrawView
->SetSnapAngle( pView
->GetSnapAngle() );
161 if (mpDrawView
->IsGridSnap() != pView
->IsGridSnap() )
162 mpDrawView
->SetGridSnap( pView
->IsGridSnap() );
164 if (mpDrawView
->IsBordSnap() != pView
->IsBordSnap() )
165 mpDrawView
->SetBordSnap( pView
->IsBordSnap() );
167 if (mpDrawView
->IsHlplSnap() != pView
->IsHlplSnap() )
168 mpDrawView
->SetHlplSnap( pView
->IsHlplSnap() );
170 if (mpDrawView
->IsOFrmSnap() != pView
->IsOFrmSnap() )
171 mpDrawView
->SetOFrmSnap( pView
->IsOFrmSnap() );
173 if (mpDrawView
->IsOPntSnap() != pView
->IsOPntSnap() )
174 mpDrawView
->SetOPntSnap( pView
->IsOPntSnap() );
176 if (mpDrawView
->IsOConSnap() != pView
->IsOConSnap() )
177 mpDrawView
->SetOConSnap( pView
->IsOConSnap() );
179 if (mpDrawView
->IsHlplVisible() != pView
->IsHlplVisible() )
180 mpDrawView
->SetHlplVisible( pView
->IsHlplVisible() );
182 if (mpDrawView
->IsDragStripes() != pView
->IsDragStripes() )
183 mpDrawView
->SetDragStripes( pView
->IsDragStripes() );
185 if (mpDrawView
->IsPlusHandlesAlwaysVisible() != pView
->IsPlusHandlesAlwaysVisible() )
186 mpDrawView
->SetPlusHandlesAlwaysVisible( pView
->IsPlusHandlesAlwaysVisible() );
188 if (mpDrawView
->GetSnapMagneticPixel() != pView
->GetSnapMagneticPixel() )
189 mpDrawView
->SetSnapMagneticPixel( pView
->GetSnapMagneticPixel() );
191 if (mpDrawView
->IsMarkedHitMovesAlways() != pView
->IsMarkedHitMovesAlways() )
192 mpDrawView
->SetMarkedHitMovesAlways( pView
->IsMarkedHitMovesAlways() );
194 if (mpDrawView
->IsMoveOnlyDragging() != pView
->IsMoveOnlyDragging() )
195 mpDrawView
->SetMoveOnlyDragging( pView
->IsMoveOnlyDragging() );
197 if (mpDrawView
->IsNoDragXorPolys() != pView
->IsNoDragXorPolys() )
198 mpDrawView
->SetNoDragXorPolys( pView
->IsNoDragXorPolys() );
200 if (mpDrawView
->IsCrookNoContortion() != pView
->IsCrookNoContortion() )
201 mpDrawView
->SetCrookNoContortion( pView
->IsCrookNoContortion() );
203 if (mpDrawView
->IsAngleSnapEnabled() != pView
->IsAngleSnapEnabled() )
204 mpDrawView
->SetAngleSnapEnabled( pView
->IsAngleSnapEnabled() );
206 if (mpDrawView
->IsBigOrtho() != pView
->IsBigOrtho() )
207 mpDrawView
->SetBigOrtho( pView
->IsBigOrtho() );
209 if (mpDrawView
->IsOrtho() != pView
->IsOrtho() )
210 mpDrawView
->SetOrtho( pView
->IsOrtho() );
212 if (mpDrawView
->GetEliminatePolyPointLimitAngle() != pView
->GetEliminatePolyPointLimitAngle() )
213 mpDrawView
->SetEliminatePolyPointLimitAngle( pView
->GetEliminatePolyPointLimitAngle() );
215 if (mpDrawView
->IsEliminatePolyPoints() != pView
->IsEliminatePolyPoints() )
216 mpDrawView
->SetEliminatePolyPoints( pView
->IsEliminatePolyPoints() );
218 if (mpDrawView
->IsSolidDragging() != pView
->IsSolidDragging() )
219 mpDrawView
->SetSolidDragging( pView
->IsSolidDragging() );
221 if (mpDrawView
->IsQuickTextEditMode() != pView
->IsQuickEdit())
222 mpDrawView
->SetQuickTextEditMode( pView
->IsQuickEdit() );
225 if (mpDrawView
->IsMasterPagePaintCaching() != pView
->IsMasterPagePaintCaching())
226 mpDrawView
->SetMasterPagePaintCaching( pView
->IsMasterPagePaintCaching() );
228 if (mpDrawView
->GetDragThresholdPixels() != pView
->GetDragThresholdPixels())
229 mpDrawView
->SetDragThresholdPixels( pView
->GetDragThresholdPixels() );
231 // handle size: 9 pixels
232 sal_uInt16 nTmp
= mpDrawView
->GetMarkHdlSizePixel();
234 mpDrawView
->SetMarkHdlSizePixel( 9 );
236 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
239 if ( pPageView
->GetVisibleLayers() != pView
->GetVisibleLayers() )
240 pPageView
->SetVisibleLayers( pView
->GetVisibleLayers() );
242 if ( pPageView
->GetPrintableLayers() != pView
->GetPrintableLayers() )
243 pPageView
->SetPrintableLayers( pView
->GetPrintableLayers() );
245 if ( pPageView
->GetLockedLayers() != pView
->GetLockedLayers() )
246 pPageView
->SetLockedLayers( pView
->GetLockedLayers() );
248 if (mePageKind
== PageKind::Notes
)
250 if (pPageView
->GetHelpLines() != pView
->GetNotesHelpLines())
251 pPageView
->SetHelpLines( pView
->GetNotesHelpLines() );
253 else if (mePageKind
== PageKind::Handout
)
255 if (pPageView
->GetHelpLines() != pView
->GetHandoutHelpLines())
256 pPageView
->SetHelpLines( pView
->GetHandoutHelpLines() );
260 if (pPageView
->GetHelpLines() != pView
->GetStandardHelpLines())
261 pPageView
->SetHelpLines( pView
->GetStandardHelpLines() );
265 if ( mpDrawView
->GetActiveLayer() != pView
->GetActiveLayer() )
266 mpDrawView
->SetActiveLayer( pView
->GetActiveLayer() );
268 sal_uInt16 nSelectedPage
= 0;
270 if (mePageKind
!= PageKind::Handout
)
272 nSelectedPage
= pView
->GetSelectedPage();
275 EditMode eNewEditMode
= pView
->GetViewShEditMode(/*mePageKind*/);
276 bool bNewLayerMode
= pView
->IsLayerMode();
278 if(IsLayerModeActive() && bNewLayerMode
)
280 // #i57936# Force mbIsLayerModeActive to false so that ChangeEditMode
281 // below does something regarding LayerTabBar content refresh. That refresh
282 // is only done when IsLayerModeActive changes. It needs to be done
283 // since e.g. Layer visibility was changed above and this may need
284 // a refresh to show the correct graphical representation
285 mbIsLayerModeActive
= false;
288 ChangeEditMode(eNewEditMode
, bNewLayerMode
);
289 SwitchPage(nSelectedPage
);
291 // restore DrawMode for 'normal' window
292 if(GetActiveWindow()->GetOutDev()->GetDrawMode() != pView
->GetDrawMode())
293 GetActiveWindow()->GetOutDev()->SetDrawMode(pView
->GetDrawMode());
295 if ( mpDrawView
->IsDesignMode() != pView
->IsDesignMode() )
297 SfxBoolItem
aDesignModeItem( SID_FM_DESIGN_MODE
, pView
->IsDesignMode() );
298 GetViewFrame()->GetDispatcher()->ExecuteList(SID_FM_DESIGN_MODE
,
299 SfxCallMode::SYNCHRON
| SfxCallMode::RECORD
,
300 { &aDesignModeItem
});
303 // has to be called in the end, because it executes a WriteFrameViewData()
304 if (mpDrawView
->IsFrameDragSingles() != pView
->IsFrameDragSingles() )
305 mpDrawView
->SetFrameDragSingles( pView
->IsFrameDragSingles() );
309 * Apply data of the current view on the FrameView
311 void DrawViewShell::WriteFrameViewData()
313 // store character-(screen-) attribute of FrameView
314 mpFrameView
->SetRuler( HasRuler() );
315 mpFrameView
->SetGridCoarse( mpDrawView
->GetGridCoarse() );
316 mpFrameView
->SetGridFine( mpDrawView
->GetGridFine() );
317 mpFrameView
->SetSnapGridWidth(mpDrawView
->GetSnapGridWidthX(), mpDrawView
->GetSnapGridWidthY());
318 mpFrameView
->SetGridVisible( mpDrawView
->IsGridVisible() );
319 mpFrameView
->SetGridFront( mpDrawView
->IsGridFront() );
320 mpFrameView
->SetSnapAngle( mpDrawView
->GetSnapAngle() );
321 mpFrameView
->SetGridSnap( mpDrawView
->IsGridSnap() );
322 mpFrameView
->SetBordSnap( mpDrawView
->IsBordSnap() );
323 mpFrameView
->SetHlplSnap( mpDrawView
->IsHlplSnap() );
324 mpFrameView
->SetOFrmSnap( mpDrawView
->IsOFrmSnap() );
325 mpFrameView
->SetOPntSnap( mpDrawView
->IsOPntSnap() );
326 mpFrameView
->SetOConSnap( mpDrawView
->IsOConSnap() );
327 mpFrameView
->SetHlplVisible( mpDrawView
->IsHlplVisible() );
328 mpFrameView
->SetDragStripes( mpDrawView
->IsDragStripes() );
329 mpFrameView
->SetPlusHandlesAlwaysVisible( mpDrawView
->IsPlusHandlesAlwaysVisible() );
330 mpFrameView
->SetFrameDragSingles( mpDrawView
->IsFrameDragSingles() );
331 mpFrameView
->SetMarkedHitMovesAlways( mpDrawView
->IsMarkedHitMovesAlways() );
332 mpFrameView
->SetMoveOnlyDragging( mpDrawView
->IsMoveOnlyDragging() );
333 mpFrameView
->SetNoDragXorPolys( mpDrawView
->IsNoDragXorPolys() );
334 mpFrameView
->SetCrookNoContortion( mpDrawView
->IsCrookNoContortion() );
335 mpFrameView
->SetBigOrtho( mpDrawView
->IsBigOrtho() );
336 mpFrameView
->SetEliminatePolyPointLimitAngle( mpDrawView
->GetEliminatePolyPointLimitAngle() );
337 mpFrameView
->SetEliminatePolyPoints( mpDrawView
->IsEliminatePolyPoints() );
339 mpFrameView
->SetSolidDragging( mpDrawView
->IsSolidDragging() );
340 mpFrameView
->SetQuickEdit( mpDrawView
->IsQuickTextEditMode() );
342 mpFrameView
->SetDesignMode( mpDrawView
->IsDesignMode() );
344 Size aVisSizePixel
= GetActiveWindow()->GetOutputSizePixel();
345 ::tools::Rectangle aVisArea
= GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), aVisSizePixel
) );
346 if (comphelper::LibreOfficeKit::isActive())
348 // aVisArea is nonsensical in the LOK case, use the slide size
349 aVisArea
= ::tools::Rectangle(Point(), getCurrentPage()->GetSize());
352 mpFrameView
->SetVisArea(aVisArea
);
354 if( mePageKind
== PageKind::Handout
)
355 mpFrameView
->SetSelectedPage(0);
358 mpFrameView
->SetSelectedPage( maTabControl
->GetCurPagePos() );
361 mpFrameView
->SetViewShEditMode(meEditMode
);
362 mpFrameView
->SetLayerMode(IsLayerModeActive());
364 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
368 if ( mpFrameView
->GetVisibleLayers() != pPageView
->GetVisibleLayers() )
369 mpFrameView
->SetVisibleLayers( pPageView
->GetVisibleLayers() );
371 if ( mpFrameView
->GetPrintableLayers() != pPageView
->GetPrintableLayers() )
372 mpFrameView
->SetPrintableLayers( pPageView
->GetPrintableLayers() );
374 if ( mpFrameView
->GetLockedLayers() != pPageView
->GetLockedLayers() )
375 mpFrameView
->SetLockedLayers( pPageView
->GetLockedLayers() );
377 if (mePageKind
== PageKind::Notes
)
379 mpFrameView
->SetNotesHelpLines( pPageView
->GetHelpLines() );
381 else if (mePageKind
== PageKind::Handout
)
383 mpFrameView
->SetHandoutHelpLines( pPageView
->GetHelpLines() );
387 mpFrameView
->SetStandardHelpLines( pPageView
->GetHelpLines() );
391 if ( mpFrameView
->GetActiveLayer() != mpDrawView
->GetActiveLayer() )
392 mpFrameView
->SetActiveLayer( mpDrawView
->GetActiveLayer() );
394 // store DrawMode for 'normal' window
395 if(mpFrameView
->GetDrawMode() != GetActiveWindow()->GetOutDev()->GetDrawMode())
396 mpFrameView
->SetDrawMode(GetActiveWindow()->GetOutDev()->GetDrawMode());
399 void DrawViewShell::PrePaint()
401 mpDrawView
->PrePaint();
405 * The event is forwarded to the Viewshell and the current function by the
408 * Remark: pWin==NULL, if Paint() is called from ShowWindow!
410 void DrawViewShell::Paint(const ::tools::Rectangle
& rRect
, ::sd::Window
* pWin
)
412 /* This is done before each text edit, so why not do it before every paint.
413 The default language is only used if the outliner only contains one
414 character in a symbol font */
415 GetDoc()->GetDrawOutliner().SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE
) );
417 // Set Application Background color for usage in SdrPaintView(s)
418 mpDrawView
->SetApplicationBackgroundColor( GetViewOptions().mnAppBackgroundColor
);
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 GetDoc()->GetDrawOutliner().SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
425 mpDrawView
->CompleteRedraw( pWin
->GetOutDev(), vcl::Region( rRect
) );
429 * adjust zoom factor for InPlace
431 void DrawViewShell::SetZoomFactor(const Fraction
& rZoomX
, const Fraction
& rZoomY
)
433 ViewShell::SetZoomFactor(rZoomX
, rZoomY
);
434 mbZoomOnPage
= false;
435 Point aOrigin
= GetActiveWindow()->GetViewOrigin();
436 GetActiveWindow()->SetWinViewPos(aOrigin
);
439 void DrawViewShell::HidePage()
441 FmFormShell
* pFormShell
= GetViewShellBase().GetFormShellManager()->GetFormShell();
442 if (pFormShell
!= nullptr)
443 pFormShell
->PrepareClose(false);
446 void DrawViewShell::WriteUserDataSequence ( css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
)
448 WriteFrameViewData();
450 ViewShell::WriteUserDataSequence( rSequence
);
452 const sal_Int32 nIndex
= rSequence
.getLength();
453 rSequence
.realloc( nIndex
+ 1 );
454 auto pSequence
= rSequence
.getArray();
455 pSequence
[nIndex
].Name
= sUNO_View_ZoomOnPage
;
456 pSequence
[nIndex
].Value
<<= mbZoomOnPage
;
458 // Common SdrModel processing
459 GetDocSh()->GetDoc()->WriteUserDataSequence(rSequence
);
462 void DrawViewShell::ReadUserDataSequence ( const css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
)
464 WriteFrameViewData();
466 ViewShell::ReadUserDataSequence( rSequence
);
468 for (const css::beans::PropertyValue
& rValue
: rSequence
)
470 if ( rValue
.Name
== sUNO_View_ZoomOnPage
)
472 bool bZoomPage
= false;
473 if( rValue
.Value
>>= bZoomPage
)
475 mbZoomOnPage
= bZoomPage
;
478 // Fallback to common SdrModel processing
479 else GetDocSh()->GetDoc()->ReadUserDataSequenceValue(&rValue
);
482 // The parameter rSequence contains the config-items from
483 // <config:config-item-set config:name="ooo:view-settings">. Determine, whether
484 // they contain "VisibleLayers", "PrintableLayers" and "LockedLayers". If not, it
485 // is a foreign document or a new document after transition period and the corresponding
486 // information were read from <draw:layer-set>. In that case we need to bring
487 // the information from model to view.
488 bool bHasVisiPrnLockSettings(false);
489 for ( auto & rPropertyValue
: rSequence
)
491 if ( rPropertyValue
.Name
== sUNO_View_VisibleLayers
492 || rPropertyValue
.Name
== sUNO_View_PrintableLayers
493 || rPropertyValue
.Name
== sUNO_View_LockedLayers
)
495 bHasVisiPrnLockSettings
= true;
499 if ( !bHasVisiPrnLockSettings
)
501 const SdrLayerAdmin
& rLayerAdmin
= GetDocSh()->GetDoc()->GetLayerAdmin();
502 SdrLayerIDSet aSdrLayerIDSet
;
503 rLayerAdmin
.getVisibleLayersODF( aSdrLayerIDSet
);
504 mpFrameView
-> SetVisibleLayers( aSdrLayerIDSet
);
505 rLayerAdmin
.getPrintableLayersODF( aSdrLayerIDSet
);
506 mpFrameView
-> SetPrintableLayers( aSdrLayerIDSet
);
507 rLayerAdmin
.getLockedLayersODF( aSdrLayerIDSet
);
508 mpFrameView
-> SetLockedLayers( aSdrLayerIDSet
);
512 // tdf#129898 repair layer "DrawnInSlideshow", which was wrongly written
513 // in LO 6.2 to 6.4. The ODF defaults were corrected when reading draw:layer-set, but
514 // not in reading config settings, because there the name is not known.
515 const SdrLayerAdmin
& rLayerAdmin
= GetDocSh()->GetDoc()->GetLayerAdmin();
516 if (rLayerAdmin
.GetLayer("DrawnInSlideshow"))
518 SdrLayerIDSet aSdrLayerIDSet
;
519 rLayerAdmin
.getVisibleLayersODF( aSdrLayerIDSet
);
520 mpFrameView
-> SetVisibleLayers( aSdrLayerIDSet
);
521 rLayerAdmin
.getPrintableLayersODF( aSdrLayerIDSet
);
522 mpFrameView
-> SetPrintableLayers( aSdrLayerIDSet
);
523 rLayerAdmin
.getLockedLayersODF( aSdrLayerIDSet
);
524 mpFrameView
-> SetLockedLayers( aSdrLayerIDSet
);
529 if( mpFrameView
->GetPageKind() != mePageKind
)
531 mePageKind
= mpFrameView
->GetPageKind();
533 if (mePageKind
== PageKind::Notes
)
535 GetActiveWindow()->SetHelpId( CMD_SID_NOTES_MODE
);
537 else if (mePageKind
== PageKind::Handout
)
539 GetActiveWindow()->SetHelpId( CMD_SID_HANDOUT_MASTER_MODE
);
543 GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL
);
547 ReadFrameViewData( mpFrameView
);
551 const ::tools::Rectangle
aVisArea( mpFrameView
->GetVisArea() );
553 // tdf#151621 Do not set if the embedded object is opening in a new window.
554 if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
555 && GetDocSh()->IsInPlaceActive())
557 GetDocSh()->SetVisArea(aVisArea
);
560 VisAreaChanged(aVisArea
);
562 ::sd::View
* pView
= GetView();
566 pView
->VisAreaChanged(GetActiveWindow()->GetOutDev());
569 SetZoomRect(aVisArea
);
571 ChangeEditMode (meEditMode
, ! IsLayerModeActive());
575 void DrawViewShell::VisAreaChanged(const ::tools::Rectangle
& rRect
)
577 ViewShell::VisAreaChanged( rRect
);
579 DrawController
& rController
= *GetViewShellBase().GetDrawController();
580 rController
.FireVisAreaChanged (rRect
);
583 /** If there is a valid controller then create a new instance of
584 <type>AccessibleDrawDocumentView</type>. Otherwise return an empty
587 css::uno::Reference
<css::accessibility::XAccessible
>
588 DrawViewShell::CreateAccessibleDocumentView (::sd::Window
* pWindow
)
590 if (GetViewShellBase().GetController() != nullptr)
592 rtl::Reference
<accessibility::AccessibleDrawDocumentView
> pDocumentView
=
593 new accessibility::AccessibleDrawDocumentView (
596 GetViewShellBase().GetController(),
597 pWindow
->GetAccessibleParentWindow()->GetAccessible());
598 pDocumentView
->Init();
599 return pDocumentView
;
602 SAL_WARN("sd", "DrawViewShell::CreateAccessibleDocumentView: no controller");
603 return css::uno::Reference
< css::accessibility::XAccessible
>();
606 int DrawViewShell::GetActiveTabLayerIndex() const
608 const LayerTabBar
* pBar
609 = const_cast<DrawViewShell
*>(this)->GetLayerTabControl ();
611 return pBar
->GetPagePos (pBar
->GetCurPageId());
616 void DrawViewShell::SetActiveTabLayerIndex (int nIndex
)
618 LayerTabBar
* pBar
= GetLayerTabControl ();
622 // Ignore invalid indices silently.
623 if (nIndex
>=0 && nIndex
<pBar
->GetPageCount())
625 // Tell the draw view and the tab control of the new active layer.
626 mpDrawView
->SetActiveLayer (pBar
->GetLayerName (pBar
->GetPageId (static_cast<sal_uInt16
>(nIndex
))));
627 pBar
->SetCurPageId (pBar
->GetPageId (static_cast<sal_uInt16
>(nIndex
)));
628 rtl::Reference
<SdUnoDrawView
> pUnoDrawView(new SdUnoDrawView (
631 css::uno::Reference
< css::drawing::XLayer
> rLayer
= pUnoDrawView
->getActiveLayer();
632 GetViewShellBase().GetDrawController()->fireChangeLayer( &rLayer
);
636 LayerTabBar
* DrawViewShell::GetLayerTabControl()
638 return mpLayerTabBar
.get();
641 int DrawViewShell::GetTabLayerCount() const
643 const LayerTabBar
* pBar
644 = const_cast<DrawViewShell
*>(this)->GetLayerTabControl ();
646 return pBar
->GetPageCount();
651 } // end of namespace sd
653 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */