merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / view / drviews5.cxx
blob25ded252a398fd8a940544b822eb1bb4cbde1eba
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviews5.cxx,v $
10 * $Revision: 1.55 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "DrawViewShell.hxx"
35 #include "PresentationViewShell.hxx"
36 #include <svx/outliner.hxx>
37 #ifndef _SVXIDS_HXX
38 #include <svx/svxids.hrc>
39 #endif
40 #include <sfx2/request.hxx>
41 #include <sfx2/dispatch.hxx>
42 #include <svx/svdpagv.hxx>
43 #include <vcl/scrbar.hxx>
44 #include <tools/poly.hxx>
45 #include <svx/fmshell.hxx>
46 #include <svx/eeitem.hxx>
47 #include <svtools/colorcfg.hxx>
48 #include "AccessibleDrawDocumentView.hxx"
50 #include <sfx2/viewfrm.hxx>
51 #include "LayerTabBar.hxx"
53 #include "strings.hrc"
54 #include "res_bmp.hrc"
55 #include "glob.hrc"
56 #include "app.hrc"
58 #include "optsitem.hxx"
59 #include "app.hxx"
60 #include "FrameView.hxx"
61 #include "sdattr.hxx"
62 #include "futext.hxx"
63 #include "sdpage.hxx"
64 #include "stlpool.hxx"
65 #include "prntopts.hxx"
66 #include "sdresid.hxx"
67 #include "Window.hxx"
68 #include "drawview.hxx"
69 #include "drawdoc.hxx"
70 #include "DrawDocShell.hxx"
71 #include "Outliner.hxx"
72 #include "Client.hxx"
73 #include "slideshow.hxx"
74 #include "unokywds.hxx"
75 #include "SdUnoDrawView.hxx"
76 #include "ViewShellBase.hxx"
77 #include "FormShellManager.hxx"
78 #include "LayerDialogContent.hxx"
79 #include "DrawController.hxx"
81 namespace sd {
83 static const int TABCONTROL_INITIAL_SIZE = 350;
84 static const int PAPER_SHADOW_EXT_PIXEL = 2;
87 /*************************************************************************
89 |* Wird gerufen, wenn sich das Model aendert
91 \************************************************************************/
93 void DrawViewShell::ModelHasChanged()
95 Invalidate();
96 // Damit der Navigator auch einen aktuellen Status bekommt
97 GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, TRUE, FALSE );
99 //Update3DWindow();
100 SfxBoolItem aItem( SID_3D_STATE, TRUE );
101 GetViewFrame()->GetDispatcher()->Execute(
102 SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
104 // jetzt den von der Drawing Engine neu erzeugten TextEditOutliner
105 // initialisieren
106 ::Outliner* pOutliner = mpDrawView->GetTextEditOutliner();
107 if (pOutliner)
109 SfxStyleSheetPool* pSPool = (SfxStyleSheetPool*) GetDocSh()->GetStyleSheetPool();
110 pOutliner->SetStyleSheetPool(pSPool);
117 void DrawViewShell::Resize (void)
119 ViewShell::Resize();
121 if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
123 SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
126 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
127 if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() )
129 xSlideshow->resize(maViewSize);
136 void DrawViewShell::ArrangeGUIElements (void)
138 // Retrieve the current size (thickness) of the scroll bars. That is
139 // the width of the vertical and the height of the horizontal scroll
140 // bar.
141 int nScrollBarSize =
142 GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
143 maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
145 Point aHPos = maViewPos;
146 aHPos.Y() += maViewSize.Height();
149 ViewShell::ArrangeGUIElements ();
151 maTabControl.Hide();
153 OSL_ASSERT (GetViewShell()!=NULL);
154 Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
155 BOOL bClientActive = FALSE;
156 if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
157 bClientActive = TRUE;
159 BOOL bInPlaceActive = GetViewFrame()->GetFrame()->IsInPlace();
161 if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
163 // bei Split immer erstes Fenster resizen
164 //af pWindow = mpContentWindow.get();
165 SfxRequest aReq(SID_SIZE_PAGE, 0, GetDoc()->GetItemPool());
166 ExecuteSlot( aReq );
170 /*************************************************************************
172 |* Daten der FrameView auf die aktuelle View uebertragen
174 \************************************************************************/
176 void DrawViewShell::ReadFrameViewData(FrameView* pView)
178 ModifyGuard aGuard( GetDoc() );
180 // Diese Option wird am Model eingestellt
181 GetDoc()->SetPickThroughTransparentTextFrames(
182 SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
184 // Initialisierungen der Zeichen-(Bildschirm-)Attribute
185 if (HasRuler() != pView->HasRuler())
186 SetRuler( pView->HasRuler() );
188 if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
189 mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
191 if (mpDrawView->GetGridFine() != pView->GetGridFine())
192 mpDrawView->SetGridFine( pView->GetGridFine() );
194 if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
195 mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
197 if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
198 mpDrawView->SetGridVisible( pView->IsGridVisible() );
200 if (mpDrawView->IsGridFront() != pView->IsGridFront())
201 mpDrawView->SetGridFront( pView->IsGridFront() );
203 if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
204 mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
206 if (mpDrawView->IsGridSnap() != pView->IsGridSnap() )
207 mpDrawView->SetGridSnap( pView->IsGridSnap() );
209 if (mpDrawView->IsBordSnap() != pView->IsBordSnap() )
210 mpDrawView->SetBordSnap( pView->IsBordSnap() );
212 if (mpDrawView->IsHlplSnap() != pView->IsHlplSnap() )
213 mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
215 if (mpDrawView->IsOFrmSnap() != pView->IsOFrmSnap() )
216 mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
218 if (mpDrawView->IsOPntSnap() != pView->IsOPntSnap() )
219 mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
221 if (mpDrawView->IsOConSnap() != pView->IsOConSnap() )
222 mpDrawView->SetOConSnap( pView->IsOConSnap() );
224 if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
225 mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
227 if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
228 mpDrawView->SetDragStripes( pView->IsDragStripes() );
230 if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
231 mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
233 if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
234 mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
236 if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
237 mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
239 if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
240 mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
242 // mpDrawView->SetSlantButShear( pView->IsSlantButShear() );
244 if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
245 mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
247 if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
248 mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
250 if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
251 mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
253 if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
254 mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
256 if (mpDrawView->IsOrtho() != pView->IsOrtho() )
257 mpDrawView->SetOrtho( pView->IsOrtho() );
259 if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
260 mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
262 if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
263 mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
265 if (mpDrawView->IsSolidMarkHdl() != pView->IsSolidMarkHdl() )
266 mpDrawView->SetSolidMarkHdl( pView->IsSolidMarkHdl() );
268 if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
269 mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
271 if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit())
272 mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
274 // #i26631#
275 if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
276 mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
278 // Definition:
279 // grosse Handles: 9
280 // kleine Handles: 7
281 USHORT nTmp = mpDrawView->GetMarkHdlSizePixel();
282 //DBG_ASSERT(nTmp != 7, "HandleSize != 7 oder 9");
283 if( nTmp == 9 && !pView->IsBigHandles() )
284 mpDrawView->SetMarkHdlSizePixel( 7 );
285 else if( nTmp == 7 && pView->IsBigHandles() )
286 mpDrawView->SetMarkHdlSizePixel( 9 );
289 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
290 if (pPageView)
292 if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() )
293 pPageView->SetVisibleLayers( pView->GetVisibleLayers() );
295 if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() )
296 pPageView->SetPrintableLayers( pView->GetPrintableLayers() );
298 if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() )
299 pPageView->SetLockedLayers( pView->GetLockedLayers() );
301 if (mePageKind == PK_NOTES)
303 if (pPageView->GetHelpLines() != pView->GetNotesHelpLines())
304 pPageView->SetHelpLines( pView->GetNotesHelpLines() );
306 else if (mePageKind == PK_HANDOUT)
308 if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines())
309 pPageView->SetHelpLines( pView->GetHandoutHelpLines() );
311 else
313 if (pPageView->GetHelpLines() != pView->GetStandardHelpLines())
314 pPageView->SetHelpLines( pView->GetStandardHelpLines() );
318 if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() )
319 mpDrawView->SetActiveLayer( pView->GetActiveLayer() );
321 USHORT nSelectedPage = 0;
323 if (mePageKind != PK_HANDOUT)
325 nSelectedPage = pView->GetSelectedPage();
328 EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind);
329 BOOL bNewLayerMode = pView->IsLayerMode();
330 ChangeEditMode(eNewEditMode, bNewLayerMode);
331 SwitchPage(nSelectedPage);
333 // DrawMode fuer 'Normales' Fenster wiederherstellen
334 if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
335 GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
337 if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() )
339 SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() );
340 GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aDesignModeItem, 0L );
343 // Muss am Ende gerufen werden, da ein WriteFrameViewData() ausgeloest wird
344 if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
345 mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
348 /*************************************************************************
350 |* Daten der aktuellen View auf die FrameView uebertragen
352 \************************************************************************/
354 void DrawViewShell::WriteFrameViewData()
356 // Zeichen-(Bildschirm-)Attribute an FrameView merken
357 mpFrameView->SetRuler( HasRuler() );
358 mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
359 mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
360 mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
361 mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
362 mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
363 mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
364 mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
365 mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
366 mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
367 mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
368 mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
369 mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
370 mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
371 mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
372 mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
373 mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
374 mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
375 mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
376 mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
377 mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
378 mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
379 mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
380 mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
382 mpFrameView->SetSolidMarkHdl( mpDrawView->IsSolidMarkHdl() );
383 mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
384 mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
386 mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
388 Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
389 Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
390 mpFrameView->SetVisArea(aVisArea);
392 if( mePageKind == PK_HANDOUT )
393 mpFrameView->SetSelectedPage(0);
394 else
396 mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
399 mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
400 mpFrameView->SetLayerMode(IsLayerModeActive());
402 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
404 if (pPageView)
406 if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
407 mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
409 if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
410 mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
412 if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
413 mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
415 if (mePageKind == PK_NOTES)
417 mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
419 else if (mePageKind == PK_HANDOUT)
421 mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
423 else
425 mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
429 if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
430 mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
432 // DrawMode fuer 'Normales' Fenster merken
433 if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
434 mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
439 /*************************************************************************
441 |* PrePaint-Method
443 \************************************************************************/
445 void DrawViewShell::PrePaint()
447 mpDrawView->PrePaint();
450 /*************************************************************************
452 |* Paint-Methode: das Ereignis wird vom Fenster pWin an
453 |* die Viewshell und die aktuelle Funktion weitergeleitet
455 |* Anmerkung: pWin==NULL, wenn Paint() vom ShowWindow gerufen wird!
457 \************************************************************************/
459 void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
461 // #103834# Fill var FillColor here to have it available on later call
462 svtools::ColorConfig aColorConfig;
463 Color aFillColor;
465 if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType())
467 aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
469 else
471 aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
474 /* #97517# This is done before each text edit, so why not do it before every paint.
475 The default language is only used if the outliner only contains one
476 character in a symbol font */
477 GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
479 // #103834# Set Application Background color for usage in SdrPaintView(s)
480 mpDrawView->SetApplicationBackgroundColor(aFillColor);
482 /* #97517# This is done before each text edit, so why not do it before every paint.
483 The default language is only used if the outliner only contains one
484 character in a symbol font */
485 GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguage() );
487 mpDrawView->CompleteRedraw( pWin, Region( rRect ) );
489 if( pWin )
491 if( GetDocSh()->GetDocShellFunction().is() )
492 GetDocSh()->GetDocShellFunction()->Paint( rRect, pWin );
494 if( HasCurrentFunction() )
495 GetCurrentFunction()->Paint( rRect, pWin );
499 /*************************************************************************
501 |* Zoom-Faktor fuer InPlace einstellen
503 \************************************************************************/
505 void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
507 ViewShell::SetZoomFactor(rZoomX, rZoomY);
508 mbZoomOnPage = FALSE;
509 Point aOrigin = GetActiveWindow()->GetViewOrigin();
510 GetActiveWindow()->SetWinViewPos(aOrigin);
513 /*************************************************************************
515 |* Optimale Groesse zurueckgeben
517 \************************************************************************/
519 Size DrawViewShell::GetOptimalSizePixel() const
521 Size aSize;
523 SdrPageView* pPV = mpDrawView->GetSdrPageView();
524 if (pPV)
526 SdPage* pPage = (SdPage*) pPV->GetPage();
528 if (pPage)
530 if (!mbZoomOnPage)
532 // Gegenwaertigen MapMode beruecksichtigen
533 aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize() );
535 else
537 // 1:1 Darstellung
538 MapMode aMapMode(MAP_100TH_MM);
539 aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize(), aMapMode );
540 const_cast< DrawViewShell* >(this)->mbZoomOnPage = TRUE;
545 return(aSize);
549 /*************************************************************************
551 |* Seite wird gehided
553 \************************************************************************/
555 void DrawViewShell::HidePage()
557 FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
558 if (pFormShell != NULL)
559 pFormShell->PrepareClose (FALSE);
564 void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
566 WriteFrameViewData();
568 ViewShell::WriteUserDataSequence( rSequence, bBrowse );
570 const sal_Int32 nIndex = rSequence.getLength();
571 rSequence.realloc( nIndex + 1 );
572 rSequence[nIndex].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_View_ZoomOnPage ) );
573 rSequence[nIndex].Value <<= (sal_Bool)mbZoomOnPage;
576 void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
578 WriteFrameViewData();
580 ViewShell::ReadUserDataSequence( rSequence, bBrowse );
582 const sal_Int32 nLength = rSequence.getLength();
583 const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
584 for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
586 if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ZoomOnPage ) ) )
588 sal_Bool bZoomPage = sal_False;
589 if( pValue->Value >>= bZoomPage )
591 mbZoomOnPage = bZoomPage;
596 if( mpFrameView->GetPageKind() != mePageKind )
598 mePageKind = mpFrameView->GetPageKind();
600 if (mePageKind == PK_NOTES)
602 SetHelpId( SID_NOTESMODE );
603 GetActiveWindow()->SetHelpId( SID_NOTESMODE );
604 GetActiveWindow()->SetUniqueId( SID_NOTESMODE );
606 else if (mePageKind == PK_HANDOUT)
608 SetHelpId( SID_HANDOUTMODE );
609 GetActiveWindow()->SetHelpId( SID_HANDOUTMODE );
610 GetActiveWindow()->SetUniqueId( SID_HANDOUTMODE );
612 else
614 SetHelpId( SD_IF_SDDRAWVIEWSHELL );
615 GetActiveWindow()->SetHelpId( SD_IF_SDDRAWVIEWSHELL );
616 GetActiveWindow()->SetUniqueId( SD_IF_SDDRAWVIEWSHELL );
620 ReadFrameViewData( mpFrameView );
622 if( !mbZoomOnPage )
624 const Rectangle aVisArea( mpFrameView->GetVisArea() );
626 if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !aVisArea.IsEmpty() )
628 GetDocSh()->SetVisArea(aVisArea);
631 VisAreaChanged(aVisArea);
633 ::sd::View* pView = GetView();
635 if (pView)
637 pView->VisAreaChanged(GetActiveWindow());
640 SetZoomRect(aVisArea);
643 ChangeEditMode (meEditMode, ! IsLayerModeActive());
644 ChangeEditMode (meEditMode, ! IsLayerModeActive());
647 void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
649 ViewShell::VisAreaChanged( rRect );
651 DrawController& rController = GetViewShellBase().GetDrawController();
652 rController.FireVisAreaChanged (rRect);
658 /** If there is a valid controller then create a new instance of
659 <type>AccessibleDrawDocumentView</type>. Otherwise delegate this call
660 to the base class to return a default object (probably an empty
661 reference).
663 ::com::sun::star::uno::Reference<
664 ::com::sun::star::accessibility::XAccessible>
665 DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
667 if (GetViewShellBase().GetController() != NULL)
669 accessibility::AccessibleDrawDocumentView* pDocumentView =
670 new accessibility::AccessibleDrawDocumentView (
671 pWindow,
672 this,
673 GetViewShellBase().GetController(),
674 pWindow->GetAccessibleParentWindow()->GetAccessible());
675 pDocumentView->Init();
676 return ::com::sun::star::uno::Reference<
677 ::com::sun::star::accessibility::XAccessible>
678 (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
679 ::com::sun::star::uno::UNO_QUERY);
681 else
683 OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
684 return ViewShell::CreateAccessibleDocumentView (pWindow);
691 int DrawViewShell::GetActiveTabLayerIndex (void) const
693 const LayerTabBar* pBar
694 = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
695 if (pBar != NULL)
696 return pBar->GetPagePos (pBar->GetCurPageId());
697 else
698 return -1;
704 void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
706 LayerTabBar* pBar = GetLayerTabControl ();
707 if (pBar != NULL)
709 // Ignore invalid indices silently.
710 if (nIndex>=0 && nIndex<pBar->GetPageCount())
712 // Tell the draw view and the tab control of the new active layer.
713 mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((USHORT)nIndex)));
714 pBar->SetCurPageId (pBar->GetPageId ((USHORT)nIndex));
722 TabControl* DrawViewShell::GetPageTabControl (void)
724 return &maTabControl;
730 LayerTabBar* DrawViewShell::GetLayerTabControl (void)
732 return mpLayerTabBar.get();
738 int DrawViewShell::GetTabLayerCount (void) const
740 const LayerTabBar* pBar
741 = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
742 if (pBar != NULL)
743 return pBar->GetPageCount();
744 else
745 return 0;
749 } // end of namespace sd