bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / view / drviews5.cxx
blob030c676bc3dbf974caac668c184c34587698cc66
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "PresentationViewShell.hxx"
22 #include <editeng/outliner.hxx>
23 #include <svx/svxids.hrc>
24 #include <sfx2/request.hxx>
25 #include <sfx2/dispatch.hxx>
26 #include <svx/svdpagv.hxx>
27 #include <vcl/scrbar.hxx>
28 #include <vcl/settings.hxx>
30 #include <tools/poly.hxx>
31 #include <svx/fmshell.hxx>
32 #include <editeng/eeitem.hxx>
33 #include <svtools/colorcfg.hxx>
34 #include "AccessibleDrawDocumentView.hxx"
36 #include <sfx2/viewfrm.hxx>
37 #include "LayerTabBar.hxx"
39 #include "strings.hrc"
40 #include "res_bmp.hrc"
41 #include "glob.hrc"
42 #include "app.hrc"
43 #include "helpids.h"
44 #include "optsitem.hxx"
45 #include "sdmod.hxx"
46 #include "FrameView.hxx"
47 #include "sdattr.hxx"
48 #include "futext.hxx"
49 #include "sdpage.hxx"
50 #include "stlpool.hxx"
51 #include "prntopts.hxx"
52 #include "sdresid.hxx"
53 #include "Window.hxx"
54 #include "drawview.hxx"
55 #include "drawdoc.hxx"
56 #include "DrawDocShell.hxx"
57 #include "Outliner.hxx"
58 #include "Client.hxx"
59 #include "slideshow.hxx"
60 #include "unokywds.hxx"
61 #include "SdUnoDrawView.hxx"
62 #include "ViewShellBase.hxx"
63 #include "FormShellManager.hxx"
64 #include "DrawController.hxx"
65 #include <boost/scoped_ptr.hpp>
67 namespace sd {
69 void DrawViewShell::ModelHasChanged()
71 Invalidate();
72 // that the navigator also gets an up to date state
73 GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, true, false );
75 SfxBoolItem aItem( SID_3D_STATE, true );
76 GetViewFrame()->GetDispatcher()->Execute(
77 SID_3D_STATE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, &aItem, 0L );
79 // now initialize the TextEditOutliner which was newly created by the draw engine
80 ::Outliner* pOutliner = mpDrawView->GetTextEditOutliner();
81 if (pOutliner)
83 SfxStyleSheetPool* pSPool = static_cast<SfxStyleSheetPool*>( GetDocSh()->GetStyleSheetPool() );
84 pOutliner->SetStyleSheetPool(pSPool);
88 void DrawViewShell::Resize()
90 ViewShell::Resize();
92 if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
94 SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
97 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
98 if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() )
100 xSlideshow->resize(maViewSize);
104 void DrawViewShell::ArrangeGUIElements()
106 // Retrieve the current size (thickness) of the scroll bars. That is
107 // the width of the vertical and the height of the horizontal scroll
108 // bar.
109 int nScrollBarSize = GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
110 maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
112 Point aHPos = maViewPos;
113 aHPos.Y() += maViewSize.Height();
115 ViewShell::ArrangeGUIElements ();
117 maTabControl->Hide();
119 OSL_ASSERT (GetViewShell()!=NULL);
120 Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
121 bool bClientActive = false;
122 if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
123 bClientActive = true;
125 bool bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace();
127 if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
129 // with split, always resize first window
130 //af pWindow = mpContentWindow.get();
131 SfxRequest aReq(SID_SIZE_PAGE, SfxCallMode::SLOT, GetDoc()->GetItemPool());
132 ExecuteSlot( aReq );
137 * Apply data of the FrameView on the current view
139 void DrawViewShell::ReadFrameViewData(FrameView* pView)
141 ModifyGuard aGuard( GetDoc() );
143 // this option has to be adjust at the model
144 GetDoc()->SetPickThroughTransparentTextFrames(
145 SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
147 // initialization of the Character-(Screen-) attribute
148 if (HasRuler() != pView->HasRuler())
149 SetRuler( pView->HasRuler() );
151 if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
152 mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
154 if (mpDrawView->GetGridFine() != pView->GetGridFine())
155 mpDrawView->SetGridFine( pView->GetGridFine() );
157 if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
158 mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
160 if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
161 mpDrawView->SetGridVisible( pView->IsGridVisible() );
163 if (mpDrawView->IsGridFront() != pView->IsGridFront())
164 mpDrawView->SetGridFront( pView->IsGridFront() );
166 if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
167 mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
169 if (mpDrawView->IsGridSnap() != pView->IsGridSnap() )
170 mpDrawView->SetGridSnap( pView->IsGridSnap() );
172 if (mpDrawView->IsBordSnap() != pView->IsBordSnap() )
173 mpDrawView->SetBordSnap( pView->IsBordSnap() );
175 if (mpDrawView->IsHlplSnap() != pView->IsHlplSnap() )
176 mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
178 if (mpDrawView->IsOFrmSnap() != pView->IsOFrmSnap() )
179 mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
181 if (mpDrawView->IsOPntSnap() != pView->IsOPntSnap() )
182 mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
184 if (mpDrawView->IsOConSnap() != pView->IsOConSnap() )
185 mpDrawView->SetOConSnap( pView->IsOConSnap() );
187 if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
188 mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
190 if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
191 mpDrawView->SetDragStripes( pView->IsDragStripes() );
193 if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
194 mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
196 if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
197 mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
199 if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
200 mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
202 if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
203 mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
205 if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
206 mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
208 if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
209 mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
211 if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
212 mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
214 if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
215 mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
217 if (mpDrawView->IsOrtho() != pView->IsOrtho() )
218 mpDrawView->SetOrtho( pView->IsOrtho() );
220 if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
221 mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
223 if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
224 mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
226 if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
227 mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
229 if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit())
230 mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
232 // #i26631#
233 if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
234 mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
236 // handle size: 9 pixels
237 sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel();
238 if( nTmp != 9 )
239 mpDrawView->SetMarkHdlSizePixel( 9 );
241 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
242 if (pPageView)
244 if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() )
245 pPageView->SetVisibleLayers( pView->GetVisibleLayers() );
247 if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() )
248 pPageView->SetPrintableLayers( pView->GetPrintableLayers() );
250 if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() )
251 pPageView->SetLockedLayers( pView->GetLockedLayers() );
253 if (mePageKind == PK_NOTES)
255 if (pPageView->GetHelpLines() != pView->GetNotesHelpLines())
256 pPageView->SetHelpLines( pView->GetNotesHelpLines() );
258 else if (mePageKind == PK_HANDOUT)
260 if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines())
261 pPageView->SetHelpLines( pView->GetHandoutHelpLines() );
263 else
265 if (pPageView->GetHelpLines() != pView->GetStandardHelpLines())
266 pPageView->SetHelpLines( pView->GetStandardHelpLines() );
270 if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() )
271 mpDrawView->SetActiveLayer( pView->GetActiveLayer() );
273 sal_uInt16 nSelectedPage = 0;
275 if (mePageKind != PK_HANDOUT)
277 nSelectedPage = pView->GetSelectedPage();
280 EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind);
281 bool bNewLayerMode = pView->IsLayerMode();
283 if(IsLayerModeActive() && bNewLayerMode)
285 // #i57936# Force mbIsLayerModeActive to false so that ChangeEditMode
286 // below does something regarding LayerTabBar content refresh. That refresh
287 // is only done when IsLayerModeActive changes. It needs to be done
288 // since e.g. Layer vsisibility was changed above and this may need
289 // a refresh to show the correct graphical representation
290 mbIsLayerModeActive = false;
293 ChangeEditMode(eNewEditMode, bNewLayerMode);
294 SwitchPage(nSelectedPage);
296 // restore DrawMode for 'normal' window
297 if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
298 GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
300 if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() )
302 SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() );
303 GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, &aDesignModeItem, 0L );
306 // has to be called in the end, because it executes a WriteFrameViewData()
307 if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
308 mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
312 * Apply data of the current view on the FrameView
314 void DrawViewShell::WriteFrameViewData()
316 // store character-(screen-) attribute of FrameView
317 mpFrameView->SetRuler( HasRuler() );
318 mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
319 mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
320 mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
321 mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
322 mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
323 mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
324 mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
325 mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
326 mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
327 mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
328 mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
329 mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
330 mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
331 mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
332 mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
333 mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
334 mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
335 mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
336 mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
337 mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
338 mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
339 mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
340 mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
342 mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
343 mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
345 mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
347 Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
348 Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
349 mpFrameView->SetVisArea(aVisArea);
351 if( mePageKind == PK_HANDOUT )
352 mpFrameView->SetSelectedPage(0);
353 else
355 mpFrameView->SetSelectedPage( maTabControl->GetCurPageId() - 1 );
358 mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
359 mpFrameView->SetLayerMode(IsLayerModeActive());
361 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
363 if (pPageView)
365 if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
366 mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
368 if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
369 mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
371 if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
372 mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
374 if (mePageKind == PK_NOTES)
376 mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
378 else if (mePageKind == PK_HANDOUT)
380 mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
382 else
384 mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
388 if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
389 mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
391 // store DrawMode for 'normal' window
392 if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
393 mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
396 void DrawViewShell::PrePaint()
398 mpDrawView->PrePaint();
402 * The event is forwarded to the Viewshell and the current function by the
403 * window pWin.
405 * Remark: pWin==NULL, if Paint() is called from ShowWindow!
407 void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
409 // Fill var FillColor here to have it available on later call
410 svtools::ColorConfig aColorConfig;
411 Color aFillColor;
413 aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
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( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
420 // Set Application Background color for usage in SdrPaintView(s)
421 mpDrawView->SetApplicationBackgroundColor(aFillColor);
423 /* This is done before each text edit, so why not do it before every paint.
424 The default language is only used if the outliner only contains one
425 character in a symbol font */
426 GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
428 mpDrawView->CompleteRedraw( pWin, vcl::Region( rRect ) );
432 * adjust zoom factor for InPlace
434 void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
436 ViewShell::SetZoomFactor(rZoomX, rZoomY);
437 mbZoomOnPage = false;
438 Point aOrigin = GetActiveWindow()->GetViewOrigin();
439 GetActiveWindow()->SetWinViewPos(aOrigin);
442 void DrawViewShell::HidePage()
444 FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
445 if (pFormShell != NULL)
446 pFormShell->PrepareClose(false);
449 void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, bool bBrowse )
451 WriteFrameViewData();
453 ViewShell::WriteUserDataSequence( rSequence, bBrowse );
455 const sal_Int32 nIndex = rSequence.getLength();
456 rSequence.realloc( nIndex + 1 );
457 rSequence[nIndex].Name = sUNO_View_ZoomOnPage ;
458 rSequence[nIndex].Value <<= mbZoomOnPage;
461 void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, bool bBrowse )
463 WriteFrameViewData();
465 ViewShell::ReadUserDataSequence( rSequence, bBrowse );
467 const sal_Int32 nLength = rSequence.getLength();
468 const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
469 for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
471 if ( pValue->Name == sUNO_View_ZoomOnPage )
473 bool bZoomPage = false;
474 if( pValue->Value >>= bZoomPage )
476 mbZoomOnPage = bZoomPage;
481 if( mpFrameView->GetPageKind() != mePageKind )
483 mePageKind = mpFrameView->GetPageKind();
485 if (mePageKind == PK_NOTES)
487 SetHelpId( SID_NOTESMODE );
488 GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
489 GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
491 else if (mePageKind == PK_HANDOUT)
493 SetHelpId( SID_HANDOUTMODE );
494 GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
495 GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
497 else
499 SetHelpId( SD_IF_SDDRAWVIEWSHELL );
500 GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
501 GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
505 ReadFrameViewData( mpFrameView );
507 if( !mbZoomOnPage )
509 const Rectangle aVisArea( mpFrameView->GetVisArea() );
511 if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
513 GetDocSh()->SetVisArea(aVisArea);
516 VisAreaChanged(aVisArea);
518 ::sd::View* pView = GetView();
520 if (pView)
522 pView->VisAreaChanged(GetActiveWindow());
525 SetZoomRect(aVisArea);
528 ChangeEditMode (meEditMode, ! IsLayerModeActive());
529 ResetActualLayer();
532 void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
534 ViewShell::VisAreaChanged( rRect );
536 DrawController& rController = GetViewShellBase().GetDrawController();
537 rController.FireVisAreaChanged (rRect);
540 /** If there is a valid controller then create a new instance of
541 <type>AccessibleDrawDocumentView</type>. Otherwise return an empty
542 reference.
544 ::com::sun::star::uno::Reference<
545 ::com::sun::star::accessibility::XAccessible>
546 DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
548 if (GetViewShellBase().GetController() != NULL)
550 accessibility::AccessibleDrawDocumentView* pDocumentView =
551 new accessibility::AccessibleDrawDocumentView (
552 pWindow,
553 this,
554 GetViewShellBase().GetController(),
555 pWindow->GetAccessibleParentWindow()->GetAccessible());
556 pDocumentView->Init();
557 return ::com::sun::star::uno::Reference<
558 ::com::sun::star::accessibility::XAccessible>
559 (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
560 ::com::sun::star::uno::UNO_QUERY);
563 OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
564 return ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>();
567 int DrawViewShell::GetActiveTabLayerIndex() const
569 const LayerTabBar* pBar
570 = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
571 if (pBar != NULL)
572 return pBar->GetPagePos (pBar->GetCurPageId());
573 else
574 return -1;
577 void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
579 LayerTabBar* pBar = GetLayerTabControl ();
580 if (pBar != NULL)
582 // Ignore invalid indices silently.
583 if (nIndex>=0 && nIndex<pBar->GetPageCount())
585 // Tell the draw view and the tab control of the new active layer.
586 mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
587 pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
588 boost::scoped_ptr<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView (
589 *this,
590 *GetView()));
591 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
592 GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer );
597 LayerTabBar* DrawViewShell::GetLayerTabControl()
599 return mpLayerTabBar.get();
602 int DrawViewShell::GetTabLayerCount() const
604 const LayerTabBar* pBar
605 = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
606 if (pBar != NULL)
607 return pBar->GetPageCount();
608 else
609 return 0;
612 } // end of namespace sd
614 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */