xref: /aoo41x/main/sd/source/ui/view/drviews5.cxx (revision 5b190011)
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 	ChangeEditMode(eNewEditMode, bNewLayerMode);
324 	SwitchPage(nSelectedPage);
325 
326 	// DrawMode fuer 'Normales' Fenster wiederherstellen
327 	if(GetActiveWindow()->GetDrawMode() != pView->GetDrawMode())
328 	  GetActiveWindow()->SetDrawMode(pView->GetDrawMode());
329 
330 	if ( mpDrawView->IsDesignMode() != pView->IsDesignMode() )
331 	{
332 		SfxBoolItem aDesignModeItem( SID_FM_DESIGN_MODE, pView->IsDesignMode() );
333 		GetViewFrame()->GetDispatcher()->Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aDesignModeItem, 0L );
334 	}
335 
336 	// Muss am Ende gerufen werden, da ein WriteFrameViewData() ausgeloest wird
337 	if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
338 		mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
339 }
340 
341 /*************************************************************************
342 |*
343 |* Daten der aktuellen View auf die FrameView uebertragen
344 |*
345 \************************************************************************/
346 
347 void DrawViewShell::WriteFrameViewData()
348 {
349 	// Zeichen-(Bildschirm-)Attribute an FrameView merken
350 	mpFrameView->SetRuler( HasRuler() );
351 	mpFrameView->SetGridCoarse( mpDrawView->GetGridCoarse() );
352 	mpFrameView->SetGridFine( mpDrawView->GetGridFine() );
353 	mpFrameView->SetSnapGridWidth(mpDrawView->GetSnapGridWidthX(), mpDrawView->GetSnapGridWidthY());
354 	mpFrameView->SetGridVisible( mpDrawView->IsGridVisible() );
355 	mpFrameView->SetGridFront( mpDrawView->IsGridFront() );
356 	mpFrameView->SetSnapAngle( mpDrawView->GetSnapAngle() );
357 	mpFrameView->SetGridSnap( mpDrawView->IsGridSnap() );
358 	mpFrameView->SetBordSnap( mpDrawView->IsBordSnap() );
359 	mpFrameView->SetHlplSnap( mpDrawView->IsHlplSnap() );
360 	mpFrameView->SetOFrmSnap( mpDrawView->IsOFrmSnap() );
361 	mpFrameView->SetOPntSnap( mpDrawView->IsOPntSnap() );
362 	mpFrameView->SetOConSnap( mpDrawView->IsOConSnap() );
363 	mpFrameView->SetHlplVisible( mpDrawView->IsHlplVisible() );
364 	mpFrameView->SetDragStripes( mpDrawView->IsDragStripes() );
365 	mpFrameView->SetPlusHandlesAlwaysVisible( mpDrawView->IsPlusHandlesAlwaysVisible() );
366 	mpFrameView->SetFrameDragSingles( mpDrawView->IsFrameDragSingles() );
367 	mpFrameView->SetMarkedHitMovesAlways( mpDrawView->IsMarkedHitMovesAlways() );
368 	mpFrameView->SetMoveOnlyDragging( mpDrawView->IsMoveOnlyDragging() );
369 	mpFrameView->SetNoDragXorPolys( mpDrawView->IsNoDragXorPolys() );
370 	mpFrameView->SetCrookNoContortion( mpDrawView->IsCrookNoContortion() );
371 	mpFrameView->SetBigOrtho( mpDrawView->IsBigOrtho() );
372 	mpFrameView->SetEliminatePolyPointLimitAngle( mpDrawView->GetEliminatePolyPointLimitAngle() );
373 	mpFrameView->SetEliminatePolyPoints( mpDrawView->IsEliminatePolyPoints() );
374 
375 	mpFrameView->SetSolidMarkHdl( mpDrawView->IsSolidMarkHdl() );
376 	mpFrameView->SetSolidDragging( mpDrawView->IsSolidDragging() );
377 	mpFrameView->SetQuickEdit( mpDrawView->IsQuickTextEditMode() );
378 
379 	mpFrameView->SetDesignMode( mpDrawView->IsDesignMode() );
380 
381 	Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
382 	Rectangle aVisArea = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
383 	mpFrameView->SetVisArea(aVisArea);
384 
385 	if( mePageKind == PK_HANDOUT )
386 		mpFrameView->SetSelectedPage(0);
387 	else
388 	{
389 		mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
390 	}
391 
392 	mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
393 	mpFrameView->SetLayerMode(IsLayerModeActive());
394 
395 	SdrPageView* pPageView = mpDrawView->GetSdrPageView();
396 
397 	if (pPageView)
398 	{
399 		if ( mpFrameView->GetVisibleLayers() != pPageView->GetVisibleLayers() )
400 			mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
401 
402 		if ( mpFrameView->GetPrintableLayers() != pPageView->GetPrintableLayers() )
403 			mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
404 
405 		if ( mpFrameView->GetLockedLayers() != pPageView->GetLockedLayers() )
406 			mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
407 
408 		if (mePageKind == PK_NOTES)
409 		{
410 			mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
411 		}
412 		else if (mePageKind == PK_HANDOUT)
413 		{
414 			mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
415 		}
416 		else
417 		{
418 			mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
419 		}
420 	}
421 
422 	if ( mpFrameView->GetActiveLayer() != mpDrawView->GetActiveLayer() )
423 		mpFrameView->SetActiveLayer( mpDrawView->GetActiveLayer() );
424 
425 	// DrawMode fuer 'Normales' Fenster merken
426 	if(mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode())
427 	  mpFrameView->SetDrawMode(GetActiveWindow()->GetDrawMode());
428 }
429 
430 
431 
432 /*************************************************************************
433 |*
434 |* PrePaint-Method
435 |*
436 \************************************************************************/
437 
438 void DrawViewShell::PrePaint()
439 {
440 	mpDrawView->PrePaint();
441 }
442 
443 /*************************************************************************
444 |*
445 |* Paint-Methode: das Ereignis wird vom Fenster pWin an
446 |* die Viewshell und die aktuelle Funktion weitergeleitet
447 |*
448 |* Anmerkung: pWin==NULL, wenn Paint() vom ShowWindow gerufen wird!
449 |*
450 \************************************************************************/
451 
452 void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
453 {
454 	// #103834# Fill var FillColor here to have it available on later call
455     svtools::ColorConfig aColorConfig;
456 	Color aFillColor;
457 
458     if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType())
459 	{
460         aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
461 	}
462     else
463 	{
464         aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
465 	}
466 
467 	/* #97517#	This is done before each text edit, so why not do it before every paint.
468 				The default language is only used if the outliner only contains one
469 				character in a symbol font */
470 	GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
471 
472 	// #103834# Set Application Background color for usage in SdrPaintView(s)
473 	mpDrawView->SetApplicationBackgroundColor(aFillColor);
474 
475 	/* #97517#	This is done before each text edit, so why not do it before every paint.
476 				The default language is only used if the outliner only contains one
477 				character in a symbol font */
478 	GetDoc()->GetDrawOutliner( NULL ).SetDefaultLanguage( Application::GetSettings().GetLanguage() );
479 
480 	mpDrawView->CompleteRedraw( pWin, Region( rRect ) );
481 
482 	if( pWin )
483 	{
484 		if( GetDocSh()->GetDocShellFunction().is() )
485 			GetDocSh()->GetDocShellFunction()->Paint( rRect, pWin );
486 
487 		if( HasCurrentFunction() )
488 			GetCurrentFunction()->Paint( rRect, pWin );
489 	}
490 }
491 
492 /*************************************************************************
493 |*
494 |* Zoom-Faktor fuer InPlace einstellen
495 |*
496 \************************************************************************/
497 
498 void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
499 {
500 	ViewShell::SetZoomFactor(rZoomX, rZoomY);
501 	mbZoomOnPage = sal_False;
502 	Point aOrigin = GetActiveWindow()->GetViewOrigin();
503 	GetActiveWindow()->SetWinViewPos(aOrigin);
504 }
505 
506 /*************************************************************************
507 |*
508 |* Optimale Groesse zurueckgeben
509 |*
510 \************************************************************************/
511 
512 Size DrawViewShell::GetOptimalSizePixel() const
513 {
514 	Size aSize;
515 
516 	SdrPageView* pPV = mpDrawView->GetSdrPageView();
517 	if (pPV)
518 	{
519 		SdPage* pPage = (SdPage*) pPV->GetPage();
520 
521 		if (pPage)
522 		{
523 			if (!mbZoomOnPage)
524 			{
525 				// Gegenwaertigen MapMode beruecksichtigen
526 				aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize() );
527 			}
528 			else
529 			{
530 				// 1:1 Darstellung
531 				MapMode aMapMode(MAP_100TH_MM);
532 				aSize = GetActiveWindow()->LogicToPixel( pPage->GetSize(), aMapMode );
533 				const_cast< DrawViewShell* >(this)->mbZoomOnPage = sal_True;
534 			}
535 		}
536 	}
537 
538 	return(aSize);
539 }
540 
541 
542 /*************************************************************************
543 |*
544 |* Seite wird gehided
545 |*
546 \************************************************************************/
547 
548 void DrawViewShell::HidePage()
549 {
550     FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
551     if (pFormShell != NULL)
552         pFormShell->PrepareClose (sal_False);
553 }
554 
555 
556 
557 void DrawViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
558 {
559 	WriteFrameViewData();
560 
561 	ViewShell::WriteUserDataSequence( rSequence, bBrowse );
562 
563 	const sal_Int32 nIndex = rSequence.getLength();
564 	rSequence.realloc( nIndex + 1 );
565 	rSequence[nIndex].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_View_ZoomOnPage ) );
566 	rSequence[nIndex].Value <<= (sal_Bool)mbZoomOnPage;
567 }
568 
569 void DrawViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
570 {
571 	WriteFrameViewData();
572 
573 	ViewShell::ReadUserDataSequence( rSequence, bBrowse );
574 
575 	const sal_Int32 nLength = rSequence.getLength();
576     const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
577     for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
578     {
579         if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_View_ZoomOnPage ) ) )
580 		{
581 			sal_Bool bZoomPage = sal_False;
582 			if( pValue->Value >>= bZoomPage )
583 			{
584 				mbZoomOnPage = bZoomPage;
585 			}
586 		}
587 	}
588 
589 	if( mpFrameView->GetPageKind() != mePageKind )
590 	{
591 		mePageKind = mpFrameView->GetPageKind();
592 
593 		if (mePageKind == PK_NOTES)
594 		{
595 			SetHelpId( SID_NOTESMODE );
596 			GetActiveWindow()->SetHelpId( CMD_SID_NOTESMODE );
597 			GetActiveWindow()->SetUniqueId( CMD_SID_NOTESMODE );
598 		}
599 		else if (mePageKind == PK_HANDOUT)
600 		{
601 			SetHelpId( SID_HANDOUTMODE );
602 			GetActiveWindow()->SetHelpId( CMD_SID_HANDOUTMODE );
603 			GetActiveWindow()->SetUniqueId( CMD_SID_HANDOUTMODE );
604 		}
605 		else
606 		{
607 			SetHelpId( SD_IF_SDDRAWVIEWSHELL );
608 			GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
609 			GetActiveWindow()->SetUniqueId( HID_SDDRAWVIEWSHELL );
610 		}
611 	}
612 
613 	ReadFrameViewData( mpFrameView );
614 
615 	if( !mbZoomOnPage )
616 	{
617 		const Rectangle aVisArea( mpFrameView->GetVisArea() );
618 
619 		if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
620 		{
621 			GetDocSh()->SetVisArea(aVisArea);
622 		}
623 
624 		VisAreaChanged(aVisArea);
625 
626 		::sd::View* pView = GetView();
627 
628 		if (pView)
629 		{
630 			pView->VisAreaChanged(GetActiveWindow());
631 		}
632 
633 		SetZoomRect(aVisArea);
634 	}
635 
636 	ChangeEditMode (meEditMode, ! IsLayerModeActive());
637 	ChangeEditMode (meEditMode, ! IsLayerModeActive());
638 }
639 
640 void DrawViewShell::VisAreaChanged(const Rectangle& rRect)
641 {
642 	ViewShell::VisAreaChanged( rRect );
643 
644 	DrawController& rController = GetViewShellBase().GetDrawController();
645     rController.FireVisAreaChanged (rRect);
646 }
647 
648 
649 
650 
651 /** If there is a valid controller then create a new instance of
652     <type>AccessibleDrawDocumentView</type>.  Otherwise delegate this call
653     to the base class to return a default object (probably an empty
654     reference).
655 */
656 ::com::sun::star::uno::Reference<
657     ::com::sun::star::accessibility::XAccessible>
658     DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
659 {
660     if (GetViewShellBase().GetController() != NULL)
661     {
662         accessibility::AccessibleDrawDocumentView* pDocumentView =
663             new accessibility::AccessibleDrawDocumentView (
664                 pWindow,
665                 this,
666                 GetViewShellBase().GetController(),
667                 pWindow->GetAccessibleParentWindow()->GetAccessible());
668         pDocumentView->Init();
669         return ::com::sun::star::uno::Reference<
670             ::com::sun::star::accessibility::XAccessible>
671             (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
672                 ::com::sun::star::uno::UNO_QUERY);
673     }
674     else
675     {
676         OSL_TRACE ("DrawViewShell::CreateAccessibleDocumentView: no controller");
677         return ViewShell::CreateAccessibleDocumentView (pWindow);
678     }
679 }
680 
681 
682 
683 
684 int DrawViewShell::GetActiveTabLayerIndex (void) const
685 {
686     const LayerTabBar* pBar
687         = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
688     if (pBar != NULL)
689         return pBar->GetPagePos (pBar->GetCurPageId());
690     else
691         return -1;
692 }
693 
694 
695 
696 
697 void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
698 {
699     LayerTabBar* pBar = GetLayerTabControl ();
700     if (pBar != NULL)
701     {
702         // Ignore invalid indices silently.
703         if (nIndex>=0 && nIndex<pBar->GetPageCount())
704         {
705             // Tell the draw view and the tab control of the new active layer.
706             mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
707             pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
708         }
709     }
710 }
711 
712 
713 
714 
715 TabControl* DrawViewShell::GetPageTabControl (void)
716 {
717     return &maTabControl;
718 }
719 
720 
721 
722 
723 LayerTabBar* DrawViewShell::GetLayerTabControl (void)
724 {
725     return mpLayerTabBar.get();
726 }
727 
728 
729 
730 
731 int DrawViewShell::GetTabLayerCount (void) const
732 {
733     const LayerTabBar* pBar
734         = const_cast<DrawViewShell*>(this)->GetLayerTabControl ();
735     if (pBar != NULL)
736         return pBar->GetPageCount();
737     else
738         return 0;
739 }
740 
741 
742 } // end of namespace sd
743