xref: /trunk/main/sd/source/ui/view/drviews5.cxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #include "DrawViewShell.hxx"
28 #include "PresentationViewShell.hxx"
29 #include <editeng/outliner.hxx>
30 #ifndef _SVXIDS_HXX
31 #include <svx/svxids.hrc>
32 #endif
33 #include <sfx2/request.hxx>
34 #include <sfx2/dispatch.hxx>
35 #include <svx/svdpagv.hxx>
36 #include <vcl/scrbar.hxx>
37 #include <tools/poly.hxx>
38 #include <svx/fmshell.hxx>
39 #include <editeng/eeitem.hxx>
40 #include <svtools/colorcfg.hxx>
41 #include "AccessibleDrawDocumentView.hxx"
42 
43 #include <sfx2/viewfrm.hxx>
44 #include "LayerTabBar.hxx"
45 
46 #include "strings.hrc"
47 #include "res_bmp.hrc"
48 #include "glob.hrc"
49 #include "app.hrc"
50 #include "helpids.h"
51 #include "optsitem.hxx"
52 #include "app.hxx"
53 #include "FrameView.hxx"
54 #include "sdattr.hxx"
55 #include "futext.hxx"
56 #include "sdpage.hxx"
57 #include "stlpool.hxx"
58 #include "prntopts.hxx"
59 #include "sdresid.hxx"
60 #include "Window.hxx"
61 #include "drawview.hxx"
62 #include "drawdoc.hxx"
63 #include "DrawDocShell.hxx"
64 #include "Outliner.hxx"
65 #include "Client.hxx"
66 #include "slideshow.hxx"
67 #include "unokywds.hxx"
68 #include "SdUnoDrawView.hxx"
69 #include "ViewShellBase.hxx"
70 #include "FormShellManager.hxx"
71 #include "LayerDialogContent.hxx"
72 #include "DrawController.hxx"
73 
74 namespace sd {
75 
76 static const int TABCONTROL_INITIAL_SIZE = 350;
77 static const int PAPER_SHADOW_EXT_PIXEL = 2;
78 
79 
80 /*************************************************************************
81 |*
82 |* Wird gerufen, wenn sich das Model aendert
83 |*
84 \************************************************************************/
85 
86 void DrawViewShell::ModelHasChanged()
87 {
88     Invalidate();
89     // Damit der Navigator auch einen aktuellen Status bekommt
90     GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False );
91 
92     //Update3DWindow();
93     SfxBoolItem aItem( SID_3D_STATE, sal_True );
94     GetViewFrame()->GetDispatcher()->Execute(
95         SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
96 
97     // jetzt den von der Drawing Engine neu erzeugten TextEditOutliner
98     // initialisieren
99     ::Outliner* pOutliner     = mpDrawView->GetTextEditOutliner();
100     if (pOutliner)
101     {
102         SfxStyleSheetPool* pSPool = (SfxStyleSheetPool*) GetDocSh()->GetStyleSheetPool();
103         pOutliner->SetStyleSheetPool(pSPool);
104     }
105 }
106 
107 
108 
109 
110 void DrawViewShell::Resize (void)
111 {
112     ViewShell::Resize();
113 
114     if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
115     {
116         SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
117     }
118 
119     rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
120     if( xSlideshow.is() && xSlideshow->isRunning() && !xSlideshow->isFullScreen() )
121     {
122         xSlideshow->resize(maViewSize);
123     }
124 }
125 
126 
127 
128 
129 void DrawViewShell::ArrangeGUIElements (void)
130 {
131     // Retrieve the current size (thickness) of the scroll bars.  That is
132     // the width of the vertical and the height of the horizontal scroll
133     // bar.
134     int nScrollBarSize =
135         GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
136     maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
137 
138     Point aHPos = maViewPos;
139     aHPos.Y() += maViewSize.Height();
140 
141 
142     ViewShell::ArrangeGUIElements ();
143 
144     maTabControl.Hide();
145 
146     OSL_ASSERT (GetViewShell()!=NULL);
147     Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
148     sal_Bool bClientActive = sal_False;
149     if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
150         bClientActive = sal_True;
151 
152     sal_Bool bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace();
153 
154     if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
155     {
156         // bei Split immer erstes Fenster resizen
157         //af pWindow = mpContentWindow.get();
158         SfxRequest aReq(SID_SIZE_PAGE, 0, GetDoc()->GetItemPool());
159         ExecuteSlot( aReq );
160     }
161 }
162 
163 /*************************************************************************
164 |*
165 |* Daten der FrameView auf die aktuelle View uebertragen
166 |*
167 \************************************************************************/
168 
169 void DrawViewShell::ReadFrameViewData(FrameView* pView)
170 {
171     ModifyGuard aGuard( GetDoc() );
172 
173     // Diese Option wird am Model eingestellt
174     GetDoc()->SetPickThroughTransparentTextFrames(
175              SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
176 
177     // Initialisierungen der Zeichen-(Bildschirm-)Attribute
178     if (HasRuler() != pView->HasRuler())
179         SetRuler( pView->HasRuler() );
180 
181     if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
182         mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
183 
184     if (mpDrawView->GetGridFine() != pView->GetGridFine())
185         mpDrawView->SetGridFine( pView->GetGridFine() );
186 
187     if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
188         mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
189 
190     if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
191         mpDrawView->SetGridVisible( pView->IsGridVisible() );
192 
193     if (mpDrawView->IsGridFront() != pView->IsGridFront())
194         mpDrawView->SetGridFront( pView->IsGridFront() );
195 
196     if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
197         mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
198 
199     if (mpDrawView->IsGridSnap() !=  pView->IsGridSnap() )
200         mpDrawView->SetGridSnap( pView->IsGridSnap() );
201 
202     if (mpDrawView->IsBordSnap() !=  pView->IsBordSnap() )
203         mpDrawView->SetBordSnap( pView->IsBordSnap() );
204 
205     if (mpDrawView->IsHlplSnap() !=  pView->IsHlplSnap() )
206         mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
207 
208     if (mpDrawView->IsOFrmSnap() !=  pView->IsOFrmSnap() )
209         mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
210 
211     if (mpDrawView->IsOPntSnap() !=  pView->IsOPntSnap() )
212         mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
213 
214     if (mpDrawView->IsOConSnap() !=  pView->IsOConSnap() )
215         mpDrawView->SetOConSnap( pView->IsOConSnap() );
216 
217     if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
218         mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
219 
220     if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
221         mpDrawView->SetDragStripes( pView->IsDragStripes() );
222 
223     if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
224         mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
225 
226     if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
227         mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
228 
229     if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
230         mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
231 
232     if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
233         mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
234 
235 //    mpDrawView->SetSlantButShear( pView->IsSlantButShear() );
236 
237     if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
238         mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
239 
240     if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
241         mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
242 
243     if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
244         mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
245 
246     if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
247         mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
248 
249     if (mpDrawView->IsOrtho() != pView->IsOrtho() )
250         mpDrawView->SetOrtho( pView->IsOrtho() );
251 
252     if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
253         mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
254 
255     if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
256         mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
257 
258     if (mpDrawView->IsSolidMarkHdl() != pView->IsSolidMarkHdl() )
259         mpDrawView->SetSolidMarkHdl( pView->IsSolidMarkHdl() );
260 
261     if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
262         mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
263 
264     if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit())
265         mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
266 
267     // #i26631#
268     if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
269         mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
270 
271     // Definition:
272     //  grosse Handles: 9
273     //  kleine Handles: 7
274     sal_uInt16 nTmp = mpDrawView->GetMarkHdlSizePixel();
275     //DBG_ASSERT(nTmp != 7, "HandleSize != 7 oder 9");
276     if( nTmp == 9 && !pView->IsBigHandles() )
277         mpDrawView->SetMarkHdlSizePixel( 7 );
278     else if( nTmp == 7 && pView->IsBigHandles() )
279         mpDrawView->SetMarkHdlSizePixel( 9 );
280 
281 
282     SdrPageView* pPageView = mpDrawView->GetSdrPageView();
283     if (pPageView)
284     {
285         if ( pPageView->GetVisibleLayers() != pView->GetVisibleLayers() )
286             pPageView->SetVisibleLayers( pView->GetVisibleLayers() );
287 
288         if ( pPageView->GetPrintableLayers() != pView->GetPrintableLayers() )
289             pPageView->SetPrintableLayers( pView->GetPrintableLayers() );
290 
291         if ( pPageView->GetLockedLayers() != pView->GetLockedLayers() )
292             pPageView->SetLockedLayers( pView->GetLockedLayers() );
293 
294         if (mePageKind == PK_NOTES)
295         {
296             if (pPageView->GetHelpLines() != pView->GetNotesHelpLines())
297                 pPageView->SetHelpLines( pView->GetNotesHelpLines() );
298         }
299         else if (mePageKind == PK_HANDOUT)
300         {
301             if (pPageView->GetHelpLines() != pView->GetHandoutHelpLines())
302                 pPageView->SetHelpLines( pView->GetHandoutHelpLines() );
303         }
304         else
305         {
306             if (pPageView->GetHelpLines() != pView->GetStandardHelpLines())
307                 pPageView->SetHelpLines( pView->GetStandardHelpLines() );
308         }
309     }
310 
311     if ( mpDrawView->GetActiveLayer() != pView->GetActiveLayer() )
312         mpDrawView->SetActiveLayer( pView->GetActiveLayer() );
313 
314     sal_uInt16 nSelectedPage = 0;
315 
316     if (mePageKind != PK_HANDOUT)
317     {
318         nSelectedPage = pView->GetSelectedPage();
319     }
320 
321     EditMode eNewEditMode = pView->GetViewShEditMode(mePageKind);
322     sal_Bool bNewLayerMode = pView->IsLayerMode();
323 
324     if(IsLayerModeActive() && bNewLayerMode)
325     {
326         // #57936# Force mbIsLayerModeActive to false so that ChangeEditMode
327         // below does something regarding LayerTabBar content refresh. That refresh
328         // is only done when IsLayerModeActive changes. It needs to be done
329         // since e.g. Layer vsisibility was changed above and this may need
330         // a refresh to show the correct graphical representation
331         mbIsLayerModeActive = false;
332     }
333 
334     ChangeEditMode(eNewEditMode, bNewLayerMode);
335     SwitchPage(nSelectedPage);
336 
337     // DrawMode fuer 'Normales' Fenster wiederherstellen
338     if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
339       GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
340 
341     if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() )
342     {
343         SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() );
344         GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aDesignModeItem, 0L );
345     }
346 
347     // Muss am Ende gerufen werden, da ein WriteFrameViewData() ausgeloest wird
348     if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
349         mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
350 }
351 
352 /*************************************************************************
353 |*
354 |* Daten der aktuellen View auf die FrameView uebertragen
355 |*
356 \************************************************************************/
357 
358 void DrawViewShell::WriteFrameViewData()
359 {
360     // Zeichen-(Bildschirm-)Attribute an FrameView merken
361     mpFrameView->SetRuler( HasRuler() );
362     mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
363     mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
364     mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
365     mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
366     mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
367     mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
368     mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
369     mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
370     mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
371     mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
372     mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
373     mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
374     mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
375     mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
376     mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
377     mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
378     mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
379     mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
380     mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
381     mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
382     mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
383     mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
384     mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
385 
386     mpFrameView->SetSolidMarkHdl( mpDrawView->IsSolidMarkHdl() );
387     mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
388     mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
389 
390     mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
391 
392     Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
393     Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
394     mpFrameView->SetVisArea(aVisArea);
395 
396     if( mePageKind == PK_HANDOUT )
397         mpFrameView->SetSelectedPage(0);
398     else
399     {
400         mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
401     }
402 
403     mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
404     mpFrameView->SetLayerMode(IsLayerModeActive());
405 
406     SdrPageView* pPageView = mpDrawView->GetSdrPageView();
407 
408     if (pPageView)
409     {
410         if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
411             mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
412 
413         if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
414             mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
415 
416         if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
417             mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
418 
419         if (mePageKind == PK_NOTES)
420         {
421             mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
422         }
423         else if (mePageKind == PK_HANDOUT)
424         {
425             mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
426         }
427         else
428         {
429             mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
430         }
431     }
432 
433     if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
434         mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
435 
436     // DrawMode fuer 'Normales' Fenster merken
437     if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
438       mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
439 }
440 
441 
442 
443 /*************************************************************************
444 |*
445 |* PrePaint-Method
446 |*
447 \************************************************************************/
448 
449 void DrawViewShell::PrePaint()
450 {
451     mpDrawView->PrePaint();
452 }
453 
454 /*************************************************************************
455 |*
456 |* Paint-Methode: das Ereignis wird vom Fenster pWin an
457 |* die Viewshell und die aktuelle Funktion weitergeleitet
458 |*
459 |* Anmerkung: pWin==NULL, wenn Paint() vom ShowWindow gerufen wird!
460 |*
461 \************************************************************************/
462 
463 void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
464 {
465     // #103834# Fill var FillColor here to have it available on later call
466     svtools::ColorConfig aColorConfig;
467     Color aFillColor;
468 
469     if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType())
470     {
471         aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
472     }
473     else
474     {
475         aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
476     }
477 
478     /* #97517#  This is done before each text edit, so why not do it before every paint.
479                 The default language is only used if the outliner only contains one
480                 character in a symbol font */
481     GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
482 
483     // #103834# Set Application Background color for usage in SdrPaintView(s)
484     mpDrawView->SetApplicationBackgroundColor(aFillColor);
485 
486     /* #97517#  This is done before each text edit, so why not do it before every paint.
487                 The default language is only used if the outliner only contains one
488                 character in a symbol font */
489     GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguage() );
490 
491     mpDrawView->CompleteRedraw( pWin, Region( rRect ) );
492 
493     if( pWin )
494     {
495         if( GetDocSh()->GetDocShellFunction().is() )
496             GetDocSh()->GetDocShellFunction()->Paint( rRect, pWin );
497 
498         if( HasCurrentFunction() )
499             GetCurrentFunction()->Paint( rRect, pWin );
500     }
501 }
502 
503 /*************************************************************************
504 |*
505 |* Zoom-Faktor fuer InPlace einstellen
506 |*
507 \************************************************************************/
508 
509 void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
510 {
511     ViewShell::SetZoomFactor(rZoomX, rZoomY);
512     mbZoomOnPage = sal_False;
513     Point aOrigin = GetActiveWindow()->GetViewOrigin();
514     GetActiveWindow()->SetWinViewPos(aOrigin);
515 }
516 
517 /*************************************************************************
518 |*
519 |* Optimale Groesse zurueckgeben
520 |*
521 \************************************************************************/
522 
523 Size DrawViewShell::GetOptimalSizePixel() const
524 {
525     Size aSize;
526 
527     SdrPageView* pPV = mpDrawView->GetSdrPageView();
528     if (pPV)
529     {
530         SdPage* pPage = (SdPage*) pPV->GetPage();
531 
532         if (pPage)
533         {
534             if (!mbZoomOnPage)
535             {
536                 // Gegenwaertigen MapMode beruecksichtigen
537                 aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize() );
538             }
539             else
540             {
541                 // 1:1 Darstellung
542                 MapMode aMapMode(MAP_100TH_MM);
543                 aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize(), aMapMode );
544                 const_cast< DrawViewShell* >(this)->mbZoomOnPage = sal_True;
545             }
546         }
547     }
548 
549     return(aSize);
550 }
551 
552 
553 /*************************************************************************
554 |*
555 |* Seite wird gehided
556 |*
557 \************************************************************************/
558 
559 void DrawViewShell::HidePage()
560 {
561     FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
562     if (pFormShell != NULL)
563         pFormShell->PrepareClose (sal_False);
564 }
565 
566 
567 
568 void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
569 {
570     WriteFrameViewData();
571 
572     ViewShell::WriteUserDataSequence( rSequence, bBrowse );
573 
574     const sal_Int32 nIndex = rSequence.getLength();
575     rSequence.realloc( nIndex + 1 );
576     rSequence[nIndex].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_View_ZoomOnPage ) );
577     rSequence[nIndex].Value <<= (sal_Bool)mbZoomOnPage;
578 }
579 
580 void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
581 {
582     WriteFrameViewData();
583 
584     ViewShell::ReadUserDataSequence( rSequence, bBrowse );
585 
586     const sal_Int32 nLength = rSequence.getLength();
587     const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
588     for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
589     {
590         if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ZoomOnPage ) ) )
591         {
592             sal_Bool bZoomPage = sal_False;
593             if( pValue->Value >>= bZoomPage )
594             {
595                 mbZoomOnPage = bZoomPage;
596             }
597         }
598     }
599 
600     if( mpFrameView->GetPageKind() != mePageKind )
601     {
602         mePageKind = mpFrameView->GetPageKind();
603 
604         if (mePageKind == PK_NOTES)
605         {
606             SetHelpId( SID_NOTESMODE );
607             GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
608             GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
609         }
610         else if (mePageKind == PK_HANDOUT)
611         {
612             SetHelpId( SID_HANDOUTMODE );
613             GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
614             GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
615         }
616         else
617         {
618             SetHelpId( SD_IF_SDDRAWVIEWSHELL );
619             GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
620             GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
621         }
622     }
623 
624     ReadFrameViewData( mpFrameView );
625 
626     if( !mbZoomOnPage )
627     {
628         const Rectangle aVisArea( mpFrameView->GetVisArea() );
629 
630         if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
631         {
632             GetDocSh()->SetVisArea(aVisArea);
633         }
634 
635         VisAreaChanged(aVisArea);
636 
637         ::sd::View* pView = GetView();
638 
639         if (pView)
640         {
641             pView->VisAreaChanged(GetActiveWindow());
642         }
643 
644         SetZoomRect(aVisArea);
645     }
646 
647     ChangeEditMode (meEditMode, ! IsLayerModeActive());
648     ChangeEditMode (meEditMode, ! IsLayerModeActive());
649 }
650 
651 void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
652 {
653     ViewShell::VisAreaChanged( rRect );
654 
655     DrawController& rController = GetViewShellBase().GetDrawController();
656     rController.FireVisAreaChanged (rRect);
657 }
658 
659 
660 
661 
662 /** If there is a valid controller then create a new instance of
663     <type>AccessibleDrawDocumentView</type>.  Otherwise delegate this call
664     to the base class to return a default object (probably an empty
665     reference).
666 */
667 ::com::sun::star::uno::Reference<
668     ::com::sun::star::accessibility::XAccessible>
669     DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
670 {
671     if (GetViewShellBase().GetController() != NULL)
672     {
673         accessibility::AccessibleDrawDocumentView* pDocumentView =
674             new accessibility::AccessibleDrawDocumentView (
675                 pWindow,
676                 this,
677                 GetViewShellBase().GetController(),
678                 pWindow->GetAccessibleParentWindow()->GetAccessible());
679         pDocumentView->Init();
680         return ::com::sun::star::uno::Reference<
681             ::com::sun::star::accessibility::XAccessible>
682             (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
683                 ::com::sun::star::uno::UNO_QUERY);
684     }
685     else
686     {
687         OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
688         return ViewShell::CreateAccessibleDocumentView (pWindow);
689     }
690 }
691 
692 
693 
694 
695 int DrawViewShell::GetActiveTabLayerIndex (void) const
696 {
697     const LayerTabBar* pBar
698         = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
699     if (pBar != NULL)
700         return pBar->GetPagePos (pBar->GetCurPageId());
701     else
702         return -1;
703 }
704 
705 
706 
707 
708 void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
709 {
710     LayerTabBar* pBar = GetLayerTabControl ();
711     if (pBar != NULL)
712     {
713         // Ignore invalid indices silently.
714         if (nIndex>=0 && nIndex<pBar->GetPageCount())
715         {
716             // Tell the draw view and the tab control of the new active layer.
717             mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
718             pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
719         SdUnoDrawView* pUnoDrawView = new SdUnoDrawView (
720             GetViewShellBase().GetDrawController(),
721             *this,
722             *GetView());
723         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
724         GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer );
725         delete pUnoDrawView;
726         }
727     }
728 }
729 
730 
731 
732 
733 TabControl* DrawViewShell::GetPageTabControl (void)
734 {
735     return &maTabControl;
736 }
737 
738 
739 
740 
741 LayerTabBar* DrawViewShell::GetLayerTabControl (void)
742 {
743     return mpLayerTabBar.get();
744 }
745 
746 
747 
748 
749 int DrawViewShell::GetTabLayerCount (void) const
750 {
751     const LayerTabBar* pBar
752         = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
753     if (pBar != NULL)
754         return pBar->GetPageCount();
755     else
756         return 0;
757 }
758 
759 
760 } // end of namespace sd
761