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 if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
)
87 SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT
) );
90 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
91 if( xSlideshow
.is() && xSlideshow
->isRunning() && !xSlideshow
->isFullScreen() )
93 xSlideshow
->resize(maViewSize
);
97 void DrawViewShell::ArrangeGUIElements()
99 // Retrieve the current size (thickness) of the scroll bars. That is
100 // the width of the vertical and the height of the horizontal scroll
102 int nScrollBarSize
= GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
103 maScrBarWH
= Size (nScrollBarSize
, nScrollBarSize
);
105 ViewShell::ArrangeGUIElements ();
107 maTabControl
->Hide();
109 OSL_ASSERT (GetViewShell()!=nullptr);
110 Client
* pIPClient
= static_cast<Client
*>(GetViewShell()->GetIPClient());
111 bool bClientActive
= false;
112 if ( pIPClient
&& pIPClient
->IsObjectInPlaceActive() )
113 bClientActive
= true;
115 bool bInPlaceActive
= GetViewFrame()->GetFrame().IsInPlace();
117 if ( mbZoomOnPage
&& !bInPlaceActive
&& !bClientActive
)
119 // with split, always resize first window
120 //af pWindow = mpContentWindow.get();
121 SfxRequest
aReq(SID_SIZE_PAGE
, SfxCallMode::SLOT
, GetDoc()->GetItemPool());
127 * Apply data of the FrameView on the current view
129 void DrawViewShell::ReadFrameViewData(FrameView
* pView
)
131 ModifyGuard
aGuard( GetDoc() );
133 // this option has to be adjust at the model
134 GetDoc()->SetPickThroughTransparentTextFrames(
135 SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
137 // initialization of the Character-(Screen-) attribute
138 if (HasRuler() != pView
->HasRuler())
139 SetRuler( pView
->HasRuler() );
141 if (mpDrawView
->GetGridCoarse() != pView
->GetGridCoarse())
142 mpDrawView
->SetGridCoarse( pView
->GetGridCoarse() );
144 if (mpDrawView
->GetGridFine() != pView
->GetGridFine())
145 mpDrawView
->SetGridFine( pView
->GetGridFine() );
147 if (mpDrawView
->GetSnapGridWidthX() != pView
->GetSnapGridWidthX() || mpDrawView
->GetSnapGridWidthY() != pView
->GetSnapGridWidthY())
148 mpDrawView
->SetSnapGridWidth(pView
->GetSnapGridWidthX(), pView
->GetSnapGridWidthY());
150 if (mpDrawView
->IsGridVisible() != pView
->IsGridVisible())
151 mpDrawView
->SetGridVisible( pView
->IsGridVisible() );
153 if (mpDrawView
->IsGridFront() != pView
->IsGridFront())
154 mpDrawView
->SetGridFront( pView
->IsGridFront() );
156 if (mpDrawView
->GetSnapAngle() != pView
->GetSnapAngle())
157 mpDrawView
->SetSnapAngle( pView
->GetSnapAngle() );
159 if (mpDrawView
->IsGridSnap() != pView
->IsGridSnap() )
160 mpDrawView
->SetGridSnap( pView
->IsGridSnap() );
162 if (mpDrawView
->IsBordSnap() != pView
->IsBordSnap() )
163 mpDrawView
->SetBordSnap( pView
->IsBordSnap() );
165 if (mpDrawView
->IsHlplSnap() != pView
->IsHlplSnap() )
166 mpDrawView
->SetHlplSnap( pView
->IsHlplSnap() );
168 if (mpDrawView
->IsOFrmSnap() != pView
->IsOFrmSnap() )
169 mpDrawView
->SetOFrmSnap( pView
->IsOFrmSnap() );
171 if (mpDrawView
->IsOPntSnap() != pView
->IsOPntSnap() )
172 mpDrawView
->SetOPntSnap( pView
->IsOPntSnap() );
174 if (mpDrawView
->IsOConSnap() != pView
->IsOConSnap() )
175 mpDrawView
->SetOConSnap( pView
->IsOConSnap() );
177 if (mpDrawView
->IsHlplVisible() != pView
->IsHlplVisible() )
178 mpDrawView
->SetHlplVisible( pView
->IsHlplVisible() );
180 if (mpDrawView
->IsDragStripes() != pView
->IsDragStripes() )
181 mpDrawView
->SetDragStripes( pView
->IsDragStripes() );
183 if (mpDrawView
->IsPlusHandlesAlwaysVisible() != pView
->IsPlusHandlesAlwaysVisible() )
184 mpDrawView
->SetPlusHandlesAlwaysVisible( pView
->IsPlusHandlesAlwaysVisible() );
186 if (mpDrawView
->GetSnapMagneticPixel() != pView
->GetSnapMagneticPixel() )
187 mpDrawView
->SetSnapMagneticPixel( pView
->GetSnapMagneticPixel() );
189 if (mpDrawView
->IsMarkedHitMovesAlways() != pView
->IsMarkedHitMovesAlways() )
190 mpDrawView
->SetMarkedHitMovesAlways( pView
->IsMarkedHitMovesAlways() );
192 if (mpDrawView
->IsMoveOnlyDragging() != pView
->IsMoveOnlyDragging() )
193 mpDrawView
->SetMoveOnlyDragging( pView
->IsMoveOnlyDragging() );
195 if (mpDrawView
->IsNoDragXorPolys() != pView
->IsNoDragXorPolys() )
196 mpDrawView
->SetNoDragXorPolys( pView
->IsNoDragXorPolys() );
198 if (mpDrawView
->IsCrookNoContortion() != pView
->IsCrookNoContortion() )
199 mpDrawView
->SetCrookNoContortion( pView
->IsCrookNoContortion() );
201 if (mpDrawView
->IsAngleSnapEnabled() != pView
->IsAngleSnapEnabled() )
202 mpDrawView
->SetAngleSnapEnabled( pView
->IsAngleSnapEnabled() );
204 if (mpDrawView
->IsBigOrtho() != pView
->IsBigOrtho() )
205 mpDrawView
->SetBigOrtho( pView
->IsBigOrtho() );
207 if (mpDrawView
->IsOrtho() != pView
->IsOrtho() )
208 mpDrawView
->SetOrtho( pView
->IsOrtho() );
210 if (mpDrawView
->GetEliminatePolyPointLimitAngle() != pView
->GetEliminatePolyPointLimitAngle() )
211 mpDrawView
->SetEliminatePolyPointLimitAngle( pView
->GetEliminatePolyPointLimitAngle() );
213 if (mpDrawView
->IsEliminatePolyPoints() != pView
->IsEliminatePolyPoints() )
214 mpDrawView
->SetEliminatePolyPoints( pView
->IsEliminatePolyPoints() );
216 if (mpDrawView
->IsSolidDragging() != pView
->IsSolidDragging() )
217 mpDrawView
->SetSolidDragging( pView
->IsSolidDragging() );
219 if (mpDrawView
->IsQuickTextEditMode() != pView
->IsQuickEdit())
220 mpDrawView
->SetQuickTextEditMode( pView
->IsQuickEdit() );
223 if (mpDrawView
->IsMasterPagePaintCaching() != pView
->IsMasterPagePaintCaching())
224 mpDrawView
->SetMasterPagePaintCaching( pView
->IsMasterPagePaintCaching() );
226 // handle size: 9 pixels
227 sal_uInt16 nTmp
= mpDrawView
->GetMarkHdlSizePixel();
229 mpDrawView
->SetMarkHdlSizePixel( 9 );
231 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
234 if ( pPageView
->GetVisibleLayers() != pView
->GetVisibleLayers() )
235 pPageView
->SetVisibleLayers( pView
->GetVisibleLayers() );
237 if ( pPageView
->GetPrintableLayers() != pView
->GetPrintableLayers() )
238 pPageView
->SetPrintableLayers( pView
->GetPrintableLayers() );
240 if ( pPageView
->GetLockedLayers() != pView
->GetLockedLayers() )
241 pPageView
->SetLockedLayers( pView
->GetLockedLayers() );
243 if (mePageKind
== PageKind::Notes
)
245 if (pPageView
->GetHelpLines() != pView
->GetNotesHelpLines())
246 pPageView
->SetHelpLines( pView
->GetNotesHelpLines() );
248 else if (mePageKind
== PageKind::Handout
)
250 if (pPageView
->GetHelpLines() != pView
->GetHandoutHelpLines())
251 pPageView
->SetHelpLines( pView
->GetHandoutHelpLines() );
255 if (pPageView
->GetHelpLines() != pView
->GetStandardHelpLines())
256 pPageView
->SetHelpLines( pView
->GetStandardHelpLines() );
260 if ( mpDrawView
->GetActiveLayer() != pView
->GetActiveLayer() )
261 mpDrawView
->SetActiveLayer( pView
->GetActiveLayer() );
263 sal_uInt16 nSelectedPage
= 0;
265 if (mePageKind
!= PageKind::Handout
)
267 nSelectedPage
= pView
->GetSelectedPage();
270 EditMode eNewEditMode
= pView
->GetViewShEditMode(/*mePageKind*/);
271 bool bNewLayerMode
= pView
->IsLayerMode();
273 if(IsLayerModeActive() && bNewLayerMode
)
275 // #i57936# Force mbIsLayerModeActive to false so that ChangeEditMode
276 // below does something regarding LayerTabBar content refresh. That refresh
277 // is only done when IsLayerModeActive changes. It needs to be done
278 // since e.g. Layer visibility was changed above and this may need
279 // a refresh to show the correct graphical representation
280 mbIsLayerModeActive
= false;
283 ChangeEditMode(eNewEditMode
, bNewLayerMode
);
284 SwitchPage(nSelectedPage
);
286 // restore DrawMode for 'normal' window
287 if(GetActiveWindow()->GetDrawMode() != pView
->GetDrawMode())
288 GetActiveWindow()->SetDrawMode(pView
->GetDrawMode());
290 if ( mpDrawView
->IsDesignMode() != pView
->IsDesignMode() )
292 SfxBoolItem
aDesignModeItem( SID_FM_DESIGN_MODE
, pView
->IsDesignMode() );
293 GetViewFrame()->GetDispatcher()->ExecuteList(SID_FM_DESIGN_MODE
,
294 SfxCallMode::SYNCHRON
| SfxCallMode::RECORD
,
295 { &aDesignModeItem
});
298 // has to be called in the end, because it executes a WriteFrameViewData()
299 if (mpDrawView
->IsFrameDragSingles() != pView
->IsFrameDragSingles() )
300 mpDrawView
->SetFrameDragSingles( pView
->IsFrameDragSingles() );
304 * Apply data of the current view on the FrameView
306 void DrawViewShell::WriteFrameViewData()
308 // store character-(screen-) attribute of FrameView
309 mpFrameView
->SetRuler( HasRuler() );
310 mpFrameView
->SetGridCoarse( mpDrawView
->GetGridCoarse() );
311 mpFrameView
->SetGridFine( mpDrawView
->GetGridFine() );
312 mpFrameView
->SetSnapGridWidth(mpDrawView
->GetSnapGridWidthX(), mpDrawView
->GetSnapGridWidthY());
313 mpFrameView
->SetGridVisible( mpDrawView
->IsGridVisible() );
314 mpFrameView
->SetGridFront( mpDrawView
->IsGridFront() );
315 mpFrameView
->SetSnapAngle( mpDrawView
->GetSnapAngle() );
316 mpFrameView
->SetGridSnap( mpDrawView
->IsGridSnap() );
317 mpFrameView
->SetBordSnap( mpDrawView
->IsBordSnap() );
318 mpFrameView
->SetHlplSnap( mpDrawView
->IsHlplSnap() );
319 mpFrameView
->SetOFrmSnap( mpDrawView
->IsOFrmSnap() );
320 mpFrameView
->SetOPntSnap( mpDrawView
->IsOPntSnap() );
321 mpFrameView
->SetOConSnap( mpDrawView
->IsOConSnap() );
322 mpFrameView
->SetHlplVisible( mpDrawView
->IsHlplVisible() );
323 mpFrameView
->SetDragStripes( mpDrawView
->IsDragStripes() );
324 mpFrameView
->SetPlusHandlesAlwaysVisible( mpDrawView
->IsPlusHandlesAlwaysVisible() );
325 mpFrameView
->SetFrameDragSingles( mpDrawView
->IsFrameDragSingles() );
326 mpFrameView
->SetMarkedHitMovesAlways( mpDrawView
->IsMarkedHitMovesAlways() );
327 mpFrameView
->SetMoveOnlyDragging( mpDrawView
->IsMoveOnlyDragging() );
328 mpFrameView
->SetNoDragXorPolys( mpDrawView
->IsNoDragXorPolys() );
329 mpFrameView
->SetCrookNoContortion( mpDrawView
->IsCrookNoContortion() );
330 mpFrameView
->SetBigOrtho( mpDrawView
->IsBigOrtho() );
331 mpFrameView
->SetEliminatePolyPointLimitAngle( mpDrawView
->GetEliminatePolyPointLimitAngle() );
332 mpFrameView
->SetEliminatePolyPoints( mpDrawView
->IsEliminatePolyPoints() );
334 mpFrameView
->SetSolidDragging( mpDrawView
->IsSolidDragging() );
335 mpFrameView
->SetQuickEdit( mpDrawView
->IsQuickTextEditMode() );
337 mpFrameView
->SetDesignMode( mpDrawView
->IsDesignMode() );
339 Size aVisSizePixel
= GetActiveWindow()->GetOutputSizePixel();
340 ::tools::Rectangle aVisArea
= GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), aVisSizePixel
) );
341 if (comphelper::LibreOfficeKit::isActive())
343 // aVisArea is nonsensical in the LOK case, use the slide size
344 aVisArea
= ::tools::Rectangle(Point(), getCurrentPage()->GetSize());
347 mpFrameView
->SetVisArea(aVisArea
);
349 if( mePageKind
== PageKind::Handout
)
350 mpFrameView
->SetSelectedPage(0);
353 mpFrameView
->SetSelectedPage( maTabControl
->GetCurPagePos() );
356 mpFrameView
->SetViewShEditMode(meEditMode
);
357 mpFrameView
->SetLayerMode(IsLayerModeActive());
359 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
363 if ( mpFrameView
->GetVisibleLayers() != pPageView
->GetVisibleLayers() )
364 mpFrameView
->SetVisibleLayers( pPageView
->GetVisibleLayers() );
366 if ( mpFrameView
->GetPrintableLayers() != pPageView
->GetPrintableLayers() )
367 mpFrameView
->SetPrintableLayers( pPageView
->GetPrintableLayers() );
369 if ( mpFrameView
->GetLockedLayers() != pPageView
->GetLockedLayers() )
370 mpFrameView
->SetLockedLayers( pPageView
->GetLockedLayers() );
372 if (mePageKind
== PageKind::Notes
)
374 mpFrameView
->SetNotesHelpLines( pPageView
->GetHelpLines() );
376 else if (mePageKind
== PageKind::Handout
)
378 mpFrameView
->SetHandoutHelpLines( pPageView
->GetHelpLines() );
382 mpFrameView
->SetStandardHelpLines( pPageView
->GetHelpLines() );
386 if ( mpFrameView
->GetActiveLayer() != mpDrawView
->GetActiveLayer() )
387 mpFrameView
->SetActiveLayer( mpDrawView
->GetActiveLayer() );
389 // store DrawMode for 'normal' window
390 if(mpFrameView
->GetDrawMode() != GetActiveWindow()->GetDrawMode())
391 mpFrameView
->SetDrawMode(GetActiveWindow()->GetDrawMode());
394 void DrawViewShell::PrePaint()
396 mpDrawView
->PrePaint();
400 * The event is forwarded to the Viewshell and the current function by the
403 * Remark: pWin==NULL, if Paint() is called from ShowWindow!
405 void DrawViewShell::Paint(const ::tools::Rectangle
& rRect
, ::sd::Window
* pWin
)
407 /* This is done before each text edit, so why not do it before every paint.
408 The default language is only used if the outliner only contains one
409 character in a symbol font */
410 GetDoc()->GetDrawOutliner().SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE
) );
412 // Set Application Background color for usage in SdrPaintView(s)
413 mpDrawView
->SetApplicationBackgroundColor( mnAppBackgroundColor
);
415 /* This is done before each text edit, so why not do it before every paint.
416 The default language is only used if the outliner only contains one
417 character in a symbol font */
418 GetDoc()->GetDrawOutliner().SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
420 mpDrawView
->CompleteRedraw( pWin
, vcl::Region( rRect
) );
424 * adjust zoom factor for InPlace
426 void DrawViewShell::SetZoomFactor(const Fraction
& rZoomX
, const Fraction
& rZoomY
)
428 ViewShell::SetZoomFactor(rZoomX
, rZoomY
);
429 mbZoomOnPage
= false;
430 Point aOrigin
= GetActiveWindow()->GetViewOrigin();
431 GetActiveWindow()->SetWinViewPos(aOrigin
);
434 void DrawViewShell::HidePage()
436 FmFormShell
* pFormShell
= GetViewShellBase().GetFormShellManager()->GetFormShell();
437 if (pFormShell
!= nullptr)
438 pFormShell
->PrepareClose(false);
441 void DrawViewShell::WriteUserDataSequence ( css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
)
443 WriteFrameViewData();
445 ViewShell::WriteUserDataSequence( rSequence
);
447 const sal_Int32 nIndex
= rSequence
.getLength();
448 rSequence
.realloc( nIndex
+ 1 );
449 rSequence
[nIndex
].Name
= sUNO_View_ZoomOnPage
;
450 rSequence
[nIndex
].Value
<<= mbZoomOnPage
;
452 // Common SdrModel processing
453 GetDocSh()->GetDoc()->WriteUserDataSequence(rSequence
);
456 void DrawViewShell::ReadUserDataSequence ( const css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
)
458 WriteFrameViewData();
460 ViewShell::ReadUserDataSequence( rSequence
);
462 for (const css::beans::PropertyValue
& rValue
: rSequence
)
464 if ( rValue
.Name
== sUNO_View_ZoomOnPage
)
466 bool bZoomPage
= false;
467 if( rValue
.Value
>>= bZoomPage
)
469 mbZoomOnPage
= bZoomPage
;
472 // Fallback to common SdrModel processing
473 else GetDocSh()->GetDoc()->ReadUserDataSequenceValue(&rValue
);
476 // The parameter rSequence contains the config-items from
477 // <config:config-item-set config:name="ooo:view-settings">. Determine, whether
478 // they contain "VisibleLayers", "PrintableLayers" and "LockedLayers". If not, it
479 // is a foreign document or a new document after transition period and the corresponding
480 // information were read from <draw:layer-set>. In that case we need to bring
481 // the information from model to view.
482 bool bHasVisiPrnLockSettings(false);
483 for ( auto & rPropertyValue
: rSequence
)
485 if ( rPropertyValue
.Name
== sUNO_View_VisibleLayers
486 || rPropertyValue
.Name
== sUNO_View_PrintableLayers
487 || rPropertyValue
.Name
== sUNO_View_LockedLayers
)
489 bHasVisiPrnLockSettings
= true;
493 if ( !bHasVisiPrnLockSettings
)
495 const SdrLayerAdmin
& rLayerAdmin
= GetDocSh()->GetDoc()->GetLayerAdmin();
496 SdrLayerIDSet aSdrLayerIDSet
;
497 rLayerAdmin
.getVisibleLayersODF( aSdrLayerIDSet
);
498 mpFrameView
-> SetVisibleLayers( aSdrLayerIDSet
);
499 rLayerAdmin
.getPrintableLayersODF( aSdrLayerIDSet
);
500 mpFrameView
-> SetPrintableLayers( aSdrLayerIDSet
);
501 rLayerAdmin
.getLockedLayersODF( aSdrLayerIDSet
);
502 mpFrameView
-> SetLockedLayers( aSdrLayerIDSet
);
506 // tdf#129898 repair layer "DrawnInSlideshow", which was wrongly written
507 // in LO 6.2 to 6.4. The ODF defaults were corrected when reading draw:layer-set, but
508 // not in reading config settings, because there the name is not known.
509 const SdrLayerAdmin
& rLayerAdmin
= GetDocSh()->GetDoc()->GetLayerAdmin();
510 if (rLayerAdmin
.GetLayer("DrawnInSlideshow"))
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
);
523 if( mpFrameView
->GetPageKind() != mePageKind
)
525 mePageKind
= mpFrameView
->GetPageKind();
527 if (mePageKind
== PageKind::Notes
)
529 GetActiveWindow()->SetHelpId( CMD_SID_NOTES_MODE
);
531 else if (mePageKind
== PageKind::Handout
)
533 GetActiveWindow()->SetHelpId( CMD_SID_HANDOUT_MASTER_MODE
);
537 GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL
);
541 ReadFrameViewData( mpFrameView
);
545 const ::tools::Rectangle
aVisArea( mpFrameView
->GetVisArea() );
547 if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
)
549 GetDocSh()->SetVisArea(aVisArea
);
552 VisAreaChanged(aVisArea
);
554 ::sd::View
* pView
= GetView();
558 pView
->VisAreaChanged(GetActiveWindow());
561 SetZoomRect(aVisArea
);
563 ChangeEditMode (meEditMode
, ! IsLayerModeActive());
567 void DrawViewShell::VisAreaChanged(const ::tools::Rectangle
& rRect
)
569 ViewShell::VisAreaChanged( rRect
);
571 DrawController
& rController
= GetViewShellBase().GetDrawController();
572 rController
.FireVisAreaChanged (rRect
);
575 /** If there is a valid controller then create a new instance of
576 <type>AccessibleDrawDocumentView</type>. Otherwise return an empty
579 css::uno::Reference
<css::accessibility::XAccessible
>
580 DrawViewShell::CreateAccessibleDocumentView (::sd::Window
* pWindow
)
582 if (GetViewShellBase().GetController() != nullptr)
584 accessibility::AccessibleDrawDocumentView
* pDocumentView
=
585 new accessibility::AccessibleDrawDocumentView (
588 GetViewShellBase().GetController(),
589 pWindow
->GetAccessibleParentWindow()->GetAccessible());
590 pDocumentView
->Init();
591 return css::uno::Reference
<css::accessibility::XAccessible
>
592 (static_cast< css::uno::XWeak
*>(pDocumentView
),
593 css::uno::UNO_QUERY
);
596 SAL_WARN("sd", "DrawViewShell::CreateAccessibleDocumentView: no controller");
597 return css::uno::Reference
< css::accessibility::XAccessible
>();
600 int DrawViewShell::GetActiveTabLayerIndex() const
602 const LayerTabBar
* pBar
603 = const_cast<DrawViewShell
*>(this)->GetLayerTabControl ();
605 return pBar
->GetPagePos (pBar
->GetCurPageId());
610 void DrawViewShell::SetActiveTabLayerIndex (int nIndex
)
612 LayerTabBar
* pBar
= GetLayerTabControl ();
616 // Ignore invalid indices silently.
617 if (nIndex
>=0 && nIndex
<pBar
->GetPageCount())
619 // Tell the draw view and the tab control of the new active layer.
620 mpDrawView
->SetActiveLayer (pBar
->GetLayerName (pBar
->GetPageId (static_cast<sal_uInt16
>(nIndex
))));
621 pBar
->SetCurPageId (pBar
->GetPageId (static_cast<sal_uInt16
>(nIndex
)));
622 rtl::Reference
<SdUnoDrawView
> pUnoDrawView(new SdUnoDrawView (
625 css::uno::Reference
< css::drawing::XLayer
> rLayer
= pUnoDrawView
->getActiveLayer();
626 GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer
);
630 LayerTabBar
* DrawViewShell::GetLayerTabControl()
632 return mpLayerTabBar
.get();
635 int DrawViewShell::GetTabLayerCount() const
637 const LayerTabBar
* pBar
638 = const_cast<DrawViewShell
*>(this)->GetLayerTabControl ();
640 return pBar
->GetPageCount();
645 } // end of namespace sd
647 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */