xref: /aoo42x/main/sd/source/ui/view/viewshe2.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sd.hxx"
30*cdf0e10cSrcweir #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
31*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/drawing/FillStyle.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/drawing/LineStyle.hpp>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include "ViewShell.hxx"
37*cdf0e10cSrcweir #include "ViewShellHint.hxx"
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include "ViewShellImplementation.hxx"
40*cdf0e10cSrcweir #include "FactoryIds.hxx"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #ifndef _SVXIDS_HRC
43*cdf0e10cSrcweir #include <svx/svxids.hrc>
44*cdf0e10cSrcweir #endif
45*cdf0e10cSrcweir #ifndef _SCRBAR_HXX //autogen
46*cdf0e10cSrcweir #include <vcl/scrbar.hxx>
47*cdf0e10cSrcweir #endif
48*cdf0e10cSrcweir #include <svx/svdpagv.hxx>
49*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
50*cdf0e10cSrcweir #include <sfx2/app.hxx>
51*cdf0e10cSrcweir #include <svx/ruler.hxx>
52*cdf0e10cSrcweir #include <editeng/outliner.hxx>
53*cdf0e10cSrcweir #include <svtools/ehdl.hxx>
54*cdf0e10cSrcweir #include <svx/svdoole2.hxx>
55*cdf0e10cSrcweir #include <svtools/sfxecode.hxx>
56*cdf0e10cSrcweir #include <svx/fmshell.hxx>
57*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
58*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
59*cdf0e10cSrcweir #include <unotools/moduleoptions.hxx>
60*cdf0e10cSrcweir #ifndef _SVX_DIALOGS_HRC
61*cdf0e10cSrcweir #include <svx/dialogs.hrc>
62*cdf0e10cSrcweir #endif
63*cdf0e10cSrcweir #include <sot/clsids.hxx>
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir #include "misc.hxx"
66*cdf0e10cSrcweir #include "strings.hrc"
67*cdf0e10cSrcweir #include "app.hrc"
68*cdf0e10cSrcweir #include "unokywds.hxx"
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir #include "sdundogr.hxx"
71*cdf0e10cSrcweir #include "FrameView.hxx"
72*cdf0e10cSrcweir #include "undopage.hxx"
73*cdf0e10cSrcweir #include "sdresid.hxx"
74*cdf0e10cSrcweir #include "drawdoc.hxx"
75*cdf0e10cSrcweir #include "View.hxx"
76*cdf0e10cSrcweir #include "fupoor.hxx"
77*cdf0e10cSrcweir #include "Client.hxx"
78*cdf0e10cSrcweir #include "DrawDocShell.hxx"
79*cdf0e10cSrcweir #include "fusearch.hxx"
80*cdf0e10cSrcweir #include "slideshow.hxx"
81*cdf0e10cSrcweir #include "sdpage.hxx"
82*cdf0e10cSrcweir #include "DrawViewShell.hxx"
83*cdf0e10cSrcweir #include "ViewShellBase.hxx"
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir #include "Window.hxx"
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
88*cdf0e10cSrcweir #include <svtools/soerr.hxx>
89*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir #ifdef _MSC_VER
92*cdf0e10cSrcweir #pragma optimize ( "", off )
93*cdf0e10cSrcweir #endif
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir using namespace com::sun::star;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir const String aEmptyStr;
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir namespace sd {
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir /*************************************************************************
102*cdf0e10cSrcweir |*
103*cdf0e10cSrcweir |* Scrollbar-Update: Thumbpos und VisibleSize anpassen
104*cdf0e10cSrcweir |*
105*cdf0e10cSrcweir \************************************************************************/
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir void ViewShell::UpdateScrollBars()
108*cdf0e10cSrcweir {
109*cdf0e10cSrcweir 	if (mpHorizontalScrollBar.get() != NULL)
110*cdf0e10cSrcweir 	{
111*cdf0e10cSrcweir 		long nW = (long)(mpContentWindow->GetVisibleWidth() * 32000);
112*cdf0e10cSrcweir 		long nX = (long)(mpContentWindow->GetVisibleX() * 32000);
113*cdf0e10cSrcweir 		mpHorizontalScrollBar->SetVisibleSize(nW);
114*cdf0e10cSrcweir 		mpHorizontalScrollBar->SetThumbPos(nX);
115*cdf0e10cSrcweir 		nW = 32000 - nW;
116*cdf0e10cSrcweir 		long nLine = (long) (mpContentWindow->GetScrlLineWidth() * nW);
117*cdf0e10cSrcweir 		long nPage = (long) (mpContentWindow->GetScrlPageWidth() * nW);
118*cdf0e10cSrcweir 		mpHorizontalScrollBar->SetLineSize(nLine);
119*cdf0e10cSrcweir 		mpHorizontalScrollBar->SetPageSize(nPage);
120*cdf0e10cSrcweir 	}
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 	if (mpVerticalScrollBar.get() != NULL)
123*cdf0e10cSrcweir 	{
124*cdf0e10cSrcweir 		long nH = (long)(mpContentWindow->GetVisibleHeight() * 32000);
125*cdf0e10cSrcweir 		long nY = (long)(mpContentWindow->GetVisibleY() * 32000);
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 		if(IsPageFlipMode()) // ie in zoom mode where no panning
128*cdf0e10cSrcweir 		{
129*cdf0e10cSrcweir 			SdPage* pPage = static_cast<DrawViewShell*>(this)->GetActualPage();
130*cdf0e10cSrcweir 			sal_uInt16 nCurPage = (pPage->GetPageNum() - 1) / 2;
131*cdf0e10cSrcweir 			sal_uInt16 nTotalPages = GetDoc()->GetSdPageCount(pPage->GetPageKind());
132*cdf0e10cSrcweir 			mpVerticalScrollBar->SetRange(Range(0,256*nTotalPages));
133*cdf0e10cSrcweir 			mpVerticalScrollBar->SetVisibleSize(256);
134*cdf0e10cSrcweir 			mpVerticalScrollBar->SetThumbPos(256*nCurPage);
135*cdf0e10cSrcweir 			mpVerticalScrollBar->SetLineSize(256);
136*cdf0e10cSrcweir 			mpVerticalScrollBar->SetPageSize(256);
137*cdf0e10cSrcweir 		}
138*cdf0e10cSrcweir 		else
139*cdf0e10cSrcweir 		{
140*cdf0e10cSrcweir 			mpVerticalScrollBar->SetRange(Range(0,32000));
141*cdf0e10cSrcweir 			mpVerticalScrollBar->SetVisibleSize(nH);
142*cdf0e10cSrcweir 			mpVerticalScrollBar->SetThumbPos(nY);
143*cdf0e10cSrcweir 			nH = 32000 - nH;
144*cdf0e10cSrcweir 			long nLine = (long) (mpContentWindow->GetScrlLineHeight() * nH);
145*cdf0e10cSrcweir 			long nPage = (long) (mpContentWindow->GetScrlPageHeight() * nH);
146*cdf0e10cSrcweir 			mpVerticalScrollBar->SetLineSize(nLine);
147*cdf0e10cSrcweir 			mpVerticalScrollBar->SetPageSize(nPage);
148*cdf0e10cSrcweir 		}
149*cdf0e10cSrcweir 	}
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	if (mbHasRulers)
152*cdf0e10cSrcweir 	{
153*cdf0e10cSrcweir 		UpdateHRuler();
154*cdf0e10cSrcweir 		UpdateVRuler();
155*cdf0e10cSrcweir 	}
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir }
158*cdf0e10cSrcweir /*************************************************************************
159*cdf0e10cSrcweir |*
160*cdf0e10cSrcweir |* Handling fuer horizontale Scrollbars
161*cdf0e10cSrcweir |*
162*cdf0e10cSrcweir \************************************************************************/
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir IMPL_LINK_INLINE_START(ViewShell, HScrollHdl, ScrollBar *, pHScroll )
165*cdf0e10cSrcweir {
166*cdf0e10cSrcweir 	return VirtHScrollHdl(pHScroll);
167*cdf0e10cSrcweir }
168*cdf0e10cSrcweir IMPL_LINK_INLINE_END(ViewShell, HScrollHdl, ScrollBar *, pHScroll )
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir /*************************************************************************
171*cdf0e10cSrcweir |*
172*cdf0e10cSrcweir |* virtueller Scroll-Handler fuer horizontale Scrollbars
173*cdf0e10cSrcweir |*
174*cdf0e10cSrcweir \************************************************************************/
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir long ViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
177*cdf0e10cSrcweir {
178*cdf0e10cSrcweir 	long nDelta = pHScroll->GetDelta();
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	if (nDelta != 0)
181*cdf0e10cSrcweir 	{
182*cdf0e10cSrcweir 		double fX = (double) pHScroll->GetThumbPos() / pHScroll->GetRange().Len();
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 		// alle Fenster der Spalte scrollen
185*cdf0e10cSrcweir         ::sd::View* pView = GetView();
186*cdf0e10cSrcweir         OutlinerView* pOLV = NULL;
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir         if (pView)
189*cdf0e10cSrcweir             pOLV = pView->GetTextEditOutlinerView();
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir         if (pOLV)
192*cdf0e10cSrcweir             pOLV->HideCursor();
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir         mpContentWindow->SetVisibleXY(fX, -1);
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir         Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
197*cdf0e10cSrcweir         Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
198*cdf0e10cSrcweir         aVisArea.SetPos(aVisAreaPos);
199*cdf0e10cSrcweir         GetDocSh()->SetVisArea(aVisArea);
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir         Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
202*cdf0e10cSrcweir         Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
203*cdf0e10cSrcweir         VisAreaChanged(aVisAreaWin);
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir         if (pView)
206*cdf0e10cSrcweir         {
207*cdf0e10cSrcweir             pView->VisAreaChanged(GetActiveWindow());
208*cdf0e10cSrcweir         }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir         if (pOLV)
211*cdf0e10cSrcweir             pOLV->ShowCursor();
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 		if (mbHasRulers)
214*cdf0e10cSrcweir 			UpdateHRuler();
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 	}
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 	return 0;
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir /*************************************************************************
222*cdf0e10cSrcweir |*
223*cdf0e10cSrcweir |* Handling fuer vertikale Scrollbars
224*cdf0e10cSrcweir |*
225*cdf0e10cSrcweir \************************************************************************/
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir IMPL_LINK_INLINE_START(ViewShell, VScrollHdl, ScrollBar *, pVScroll )
228*cdf0e10cSrcweir {
229*cdf0e10cSrcweir 	return VirtVScrollHdl(pVScroll);
230*cdf0e10cSrcweir }
231*cdf0e10cSrcweir IMPL_LINK_INLINE_END(ViewShell, VScrollHdl, ScrollBar *, pVScroll )
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir /*************************************************************************
234*cdf0e10cSrcweir |*
235*cdf0e10cSrcweir |* Handling fuer vertikale Scrollbars
236*cdf0e10cSrcweir |*
237*cdf0e10cSrcweir \************************************************************************/
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir long ViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
240*cdf0e10cSrcweir {
241*cdf0e10cSrcweir 	if(IsPageFlipMode())
242*cdf0e10cSrcweir 	{
243*cdf0e10cSrcweir 		SdPage* pPage = static_cast<DrawViewShell*>(this)->GetActualPage();
244*cdf0e10cSrcweir 		sal_uInt16 nCurPage = (pPage->GetPageNum() - 1) >> 1;
245*cdf0e10cSrcweir 		sal_uInt16 nNewPage = (sal_uInt16)pVScroll->GetThumbPos()/256;
246*cdf0e10cSrcweir 		if( nCurPage != nNewPage )
247*cdf0e10cSrcweir 			static_cast<DrawViewShell*>(this)->SwitchPage(nNewPage);
248*cdf0e10cSrcweir 	}
249*cdf0e10cSrcweir 	else //panning mode
250*cdf0e10cSrcweir 	{
251*cdf0e10cSrcweir 		double fY = (double) pVScroll->GetThumbPos() / pVScroll->GetRange().Len();
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir         ::sd::View* pView = GetView();
254*cdf0e10cSrcweir         OutlinerView* pOLV = NULL;
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir         if (pView)
257*cdf0e10cSrcweir             pOLV = pView->GetTextEditOutlinerView();
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir         if (pOLV)
260*cdf0e10cSrcweir             pOLV->HideCursor();
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir         mpContentWindow->SetVisibleXY(-1, fY);
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir         Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
265*cdf0e10cSrcweir         Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
266*cdf0e10cSrcweir         aVisArea.SetPos(aVisAreaPos);
267*cdf0e10cSrcweir         GetDocSh()->SetVisArea(aVisArea);
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir         Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
270*cdf0e10cSrcweir         Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
271*cdf0e10cSrcweir         VisAreaChanged(aVisAreaWin);
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir         if (pView)
274*cdf0e10cSrcweir         {
275*cdf0e10cSrcweir             pView->VisAreaChanged(GetActiveWindow());
276*cdf0e10cSrcweir         }
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir         if (pOLV)
279*cdf0e10cSrcweir             pOLV->ShowCursor();
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir 		if (mbHasRulers)
282*cdf0e10cSrcweir 			UpdateVRuler();
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 	}
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 	return 0;
287*cdf0e10cSrcweir }
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir SvxRuler* ViewShell::CreateHRuler(::sd::Window* , sal_Bool )
290*cdf0e10cSrcweir {
291*cdf0e10cSrcweir 	return NULL;
292*cdf0e10cSrcweir }
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir SvxRuler* ViewShell::CreateVRuler(::sd::Window* )
295*cdf0e10cSrcweir {
296*cdf0e10cSrcweir 	return NULL;
297*cdf0e10cSrcweir }
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir void ViewShell::UpdateHRuler()
300*cdf0e10cSrcweir {
301*cdf0e10cSrcweir }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir void ViewShell::UpdateVRuler()
304*cdf0e10cSrcweir {
305*cdf0e10cSrcweir }
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir long ViewShell::GetHCtrlWidth()
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir 	return 0;
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir /*************************************************************************
313*cdf0e10cSrcweir |*
314*cdf0e10cSrcweir |* Eine bestimmte Anzahl von Zeilen scrollen (wird beim automatischen
315*cdf0e10cSrcweir |* Scrollen (Zeichen/Draggen) verwendet)
316*cdf0e10cSrcweir |*
317*cdf0e10cSrcweir \************************************************************************/
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir void ViewShell::ScrollLines(long nLinesX, long nLinesY)
320*cdf0e10cSrcweir {
321*cdf0e10cSrcweir 	if ( nLinesX )
322*cdf0e10cSrcweir 	{
323*cdf0e10cSrcweir 		nLinesX *= mpHorizontalScrollBar->GetLineSize();
324*cdf0e10cSrcweir 	}
325*cdf0e10cSrcweir 	if ( nLinesY )
326*cdf0e10cSrcweir 	{
327*cdf0e10cSrcweir 		nLinesY *= mpVerticalScrollBar->GetLineSize();
328*cdf0e10cSrcweir 	}
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir 	Scroll(nLinesX, nLinesY);
331*cdf0e10cSrcweir }
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir /*************************************************************************
334*cdf0e10cSrcweir |*
335*cdf0e10cSrcweir |* Window um nScrollX, nScrollY scrollen
336*cdf0e10cSrcweir |*
337*cdf0e10cSrcweir \************************************************************************/
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir void ViewShell::Scroll(long nScrollX, long nScrollY)
340*cdf0e10cSrcweir {
341*cdf0e10cSrcweir 	if (nScrollX)
342*cdf0e10cSrcweir 	{
343*cdf0e10cSrcweir 		long nNewThumb = mpHorizontalScrollBar->GetThumbPos() + nScrollX;
344*cdf0e10cSrcweir 		mpHorizontalScrollBar->SetThumbPos(nNewThumb);
345*cdf0e10cSrcweir 	}
346*cdf0e10cSrcweir 	if (nScrollY)
347*cdf0e10cSrcweir 	{
348*cdf0e10cSrcweir 		long nNewThumb = mpVerticalScrollBar->GetThumbPos() + nScrollY;
349*cdf0e10cSrcweir 		mpVerticalScrollBar->SetThumbPos(nNewThumb);
350*cdf0e10cSrcweir 	}
351*cdf0e10cSrcweir 	double	fX = (double) mpHorizontalScrollBar->GetThumbPos() /
352*cdf0e10cSrcweir 							mpHorizontalScrollBar->GetRange().Len();
353*cdf0e10cSrcweir 	double	fY = (double) mpVerticalScrollBar->GetThumbPos() /
354*cdf0e10cSrcweir 							mpVerticalScrollBar->GetRange().Len();
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 	GetActiveWindow()->SetVisibleXY(fX, fY);
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 	Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
359*cdf0e10cSrcweir 	Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
360*cdf0e10cSrcweir 	aVisArea.SetPos(aVisAreaPos);
361*cdf0e10cSrcweir 	GetDocSh()->SetVisArea(aVisArea);
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 	Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
364*cdf0e10cSrcweir 	Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
365*cdf0e10cSrcweir 	VisAreaChanged(aVisAreaWin);
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir 	::sd::View* pView = GetView();
368*cdf0e10cSrcweir 	if (pView)
369*cdf0e10cSrcweir 	{
370*cdf0e10cSrcweir 		pView->VisAreaChanged(GetActiveWindow());
371*cdf0e10cSrcweir 	}
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 	if (mbHasRulers)
374*cdf0e10cSrcweir 	{
375*cdf0e10cSrcweir 		UpdateHRuler();
376*cdf0e10cSrcweir 		UpdateVRuler();
377*cdf0e10cSrcweir 	}
378*cdf0e10cSrcweir }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir /*************************************************************************
381*cdf0e10cSrcweir |*
382*cdf0e10cSrcweir |* Den Zoomfaktor fuer alle Split-Windows setzen
383*cdf0e10cSrcweir |*
384*cdf0e10cSrcweir \************************************************************************/
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir void ViewShell::SetZoom(long nZoom)
387*cdf0e10cSrcweir {
388*cdf0e10cSrcweir 	Fraction aUIScale(nZoom, 100);
389*cdf0e10cSrcweir 	aUIScale *= GetDoc()->GetUIScale();
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
392*cdf0e10cSrcweir         mpHorizontalRuler->SetZoom(aUIScale);
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir     if (mpVerticalRuler.get() != NULL)
395*cdf0e10cSrcweir         mpVerticalRuler->SetZoom(aUIScale);
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
398*cdf0e10cSrcweir     {
399*cdf0e10cSrcweir         mpContentWindow->SetZoomIntegral(nZoom);
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 		// #i74769# Here is a 2nd way (besides Window::Scroll) to set the visible prt
402*cdf0e10cSrcweir 		// of the window. It needs - like Scroll(SCROLL_CHILDREN) does - also to move
403*cdf0e10cSrcweir 		// the child windows. I am trying INVALIDATE_CHILDREN here which makes things better,
404*cdf0e10cSrcweir 		// but does not solve the problem completely. Neet to ask PL.
405*cdf0e10cSrcweir         mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
406*cdf0e10cSrcweir     }
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir 	Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
409*cdf0e10cSrcweir 	Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
410*cdf0e10cSrcweir 	VisAreaChanged(aVisAreaWin);
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir 	::sd::View* pView = GetView();
413*cdf0e10cSrcweir 	if (pView)
414*cdf0e10cSrcweir 	{
415*cdf0e10cSrcweir 		pView->VisAreaChanged(GetActiveWindow());
416*cdf0e10cSrcweir 	}
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir 	UpdateScrollBars();
419*cdf0e10cSrcweir }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir /*************************************************************************
422*cdf0e10cSrcweir |*
423*cdf0e10cSrcweir |* Zoomrechteck fuer aktives Fenster einstellen und alle Split-Windows
424*cdf0e10cSrcweir |* auf den gleichen Zoomfaktor setzen
425*cdf0e10cSrcweir |*
426*cdf0e10cSrcweir \************************************************************************/
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir void ViewShell::SetZoomRect(const Rectangle& rZoomRect)
429*cdf0e10cSrcweir {
430*cdf0e10cSrcweir 	long nZoom = GetActiveWindow()->SetZoomRect(rZoomRect);
431*cdf0e10cSrcweir 	Fraction aUIScale(nZoom, 100);
432*cdf0e10cSrcweir 	aUIScale *= GetDoc()->GetUIScale();
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir 	Point aPos = GetActiveWindow()->GetWinViewPos();
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
437*cdf0e10cSrcweir         mpHorizontalRuler->SetZoom(aUIScale);
438*cdf0e10cSrcweir 
439*cdf0e10cSrcweir     if (mpVerticalRuler.get() != NULL)
440*cdf0e10cSrcweir         mpVerticalRuler->SetZoom(aUIScale);
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
443*cdf0e10cSrcweir     {
444*cdf0e10cSrcweir         Point aNewPos = mpContentWindow->GetWinViewPos();
445*cdf0e10cSrcweir         aNewPos.X() = aPos.X();
446*cdf0e10cSrcweir         aNewPos.Y() = aPos.Y();
447*cdf0e10cSrcweir         mpContentWindow->SetZoomIntegral(nZoom);
448*cdf0e10cSrcweir         mpContentWindow->SetWinViewPos(aNewPos);
449*cdf0e10cSrcweir         mpContentWindow->UpdateMapOrigin();
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir 		// #i74769# see above
452*cdf0e10cSrcweir         mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
453*cdf0e10cSrcweir     }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 	Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
456*cdf0e10cSrcweir 	Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
457*cdf0e10cSrcweir 	VisAreaChanged(aVisAreaWin);
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir 	::sd::View* pView = GetView();
460*cdf0e10cSrcweir 	if (pView)
461*cdf0e10cSrcweir 	{
462*cdf0e10cSrcweir 		pView->VisAreaChanged(GetActiveWindow());
463*cdf0e10cSrcweir 	}
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir 	UpdateScrollBars();
466*cdf0e10cSrcweir }
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir /*************************************************************************
469*cdf0e10cSrcweir |*
470*cdf0e10cSrcweir |* Abbildungsparameter fuer alle Split-Windows initialisieren
471*cdf0e10cSrcweir |*
472*cdf0e10cSrcweir \************************************************************************/
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir void ViewShell::InitWindows(const Point& rViewOrigin, const Size& rViewSize,
475*cdf0e10cSrcweir 							  const Point& rWinPos, sal_Bool bUpdate)
476*cdf0e10cSrcweir {
477*cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
478*cdf0e10cSrcweir     {
479*cdf0e10cSrcweir         mpContentWindow->SetViewOrigin(rViewOrigin);
480*cdf0e10cSrcweir         mpContentWindow->SetViewSize(rViewSize);
481*cdf0e10cSrcweir         mpContentWindow->SetWinViewPos(rWinPos);
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir         if ( bUpdate )
484*cdf0e10cSrcweir         {
485*cdf0e10cSrcweir             mpContentWindow->UpdateMapOrigin();
486*cdf0e10cSrcweir             mpContentWindow->Invalidate();
487*cdf0e10cSrcweir         }
488*cdf0e10cSrcweir     }
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 	Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
491*cdf0e10cSrcweir 	Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
492*cdf0e10cSrcweir 	VisAreaChanged(aVisAreaWin);
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 	::sd::View* pView = GetView();
495*cdf0e10cSrcweir 	if (pView)
496*cdf0e10cSrcweir 	{
497*cdf0e10cSrcweir 		pView->VisAreaChanged(GetActiveWindow());
498*cdf0e10cSrcweir 	}
499*cdf0e10cSrcweir }
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir /*************************************************************************
502*cdf0e10cSrcweir |*
503*cdf0e10cSrcweir |* Alle Split-Windows unter dem uebergebenen Rechteck invalidieren
504*cdf0e10cSrcweir |*
505*cdf0e10cSrcweir \************************************************************************/
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir void ViewShell::InvalidateWindows()
508*cdf0e10cSrcweir {
509*cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
510*cdf0e10cSrcweir         mpContentWindow->Invalidate();
511*cdf0e10cSrcweir }
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir 
514*cdf0e10cSrcweir /*************************************************************************
515*cdf0e10cSrcweir |*
516*cdf0e10cSrcweir |* Auf allen Split-Windows ein Markierungsrechteck mit dem
517*cdf0e10cSrcweir |* uebergebenen Pen zeichnen
518*cdf0e10cSrcweir |*
519*cdf0e10cSrcweir \************************************************************************/
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir void ViewShell::DrawMarkRect(const Rectangle& rRect) const
522*cdf0e10cSrcweir {
523*cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
524*cdf0e10cSrcweir     {
525*cdf0e10cSrcweir         mpContentWindow->InvertTracking(rRect, SHOWTRACK_OBJECT | SHOWTRACK_WINDOW);
526*cdf0e10cSrcweir     }
527*cdf0e10cSrcweir }
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir /*************************************************************************
530*cdf0e10cSrcweir |*
531*cdf0e10cSrcweir |* Groesse und Raender aller Seiten setzen
532*cdf0e10cSrcweir |*
533*cdf0e10cSrcweir \************************************************************************/
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
536*cdf0e10cSrcweir 									   long nLeft, long nRight,
537*cdf0e10cSrcweir 									   long nUpper, long nLower, sal_Bool bScaleAll,
538*cdf0e10cSrcweir 									   Orientation eOrientation, sal_uInt16 nPaperBin,
539*cdf0e10cSrcweir 							           sal_Bool bBackgroundFullSize)
540*cdf0e10cSrcweir {
541*cdf0e10cSrcweir 	SdPage* pPage = 0;
542*cdf0e10cSrcweir 	SdUndoGroup* pUndoGroup = NULL;
543*cdf0e10cSrcweir 	pUndoGroup = new SdUndoGroup(GetDoc());
544*cdf0e10cSrcweir 	String aString(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
545*cdf0e10cSrcweir 	pUndoGroup->SetComment(aString);
546*cdf0e10cSrcweir     SfxViewShell* pViewShell = GetViewShell();
547*cdf0e10cSrcweir     OSL_ASSERT (pViewShell!=NULL);
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir 	sal_uInt16 i, nPageCnt = GetDoc()->GetMasterSdPageCount(ePageKind);
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir     Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_START));
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir 	for (i = 0; i < nPageCnt; i++)
554*cdf0e10cSrcweir 	{
555*cdf0e10cSrcweir 		/**********************************************************************
556*cdf0e10cSrcweir 		* Erst alle MasterPages bearbeiten
557*cdf0e10cSrcweir 		**********************************************************************/
558*cdf0e10cSrcweir 		pPage = GetDoc()->GetMasterSdPage(i, ePageKind);
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir 		SdUndoAction* pUndo = new SdPageFormatUndoAction(GetDoc(), pPage,
561*cdf0e10cSrcweir 							pPage->GetSize(),
562*cdf0e10cSrcweir 							pPage->GetLftBorder(), pPage->GetRgtBorder(),
563*cdf0e10cSrcweir 							pPage->GetUppBorder(), pPage->GetLwrBorder(),
564*cdf0e10cSrcweir 							pPage->IsScaleObjects(),
565*cdf0e10cSrcweir 							pPage->GetOrientation(),
566*cdf0e10cSrcweir 							pPage->GetPaperBin(),
567*cdf0e10cSrcweir 							pPage->IsBackgroundFullSize(),
568*cdf0e10cSrcweir 							rNewSize,
569*cdf0e10cSrcweir 							nLeft, nRight,
570*cdf0e10cSrcweir 							nUpper, nLower,
571*cdf0e10cSrcweir 							bScaleAll,
572*cdf0e10cSrcweir 							eOrientation,
573*cdf0e10cSrcweir 							nPaperBin,
574*cdf0e10cSrcweir 							bBackgroundFullSize);
575*cdf0e10cSrcweir 		pUndoGroup->AddAction(pUndo);
576*cdf0e10cSrcweir 
577*cdf0e10cSrcweir 		if (rNewSize.Width() > 0 ||
578*cdf0e10cSrcweir 			nLeft  >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0)
579*cdf0e10cSrcweir 		{
580*cdf0e10cSrcweir 			Rectangle aNewBorderRect(nLeft, nUpper, nRight, nLower);
581*cdf0e10cSrcweir 			pPage->ScaleObjects(rNewSize, aNewBorderRect, bScaleAll);
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir 			if (rNewSize.Width() > 0)
584*cdf0e10cSrcweir 				pPage->SetSize(rNewSize);
585*cdf0e10cSrcweir 		}
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir 		if( nLeft  >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0 )
588*cdf0e10cSrcweir 		{
589*cdf0e10cSrcweir 			pPage->SetBorder(nLeft, nUpper, nRight, nLower);
590*cdf0e10cSrcweir 		}
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir 		pPage->SetOrientation(eOrientation);
593*cdf0e10cSrcweir 		pPage->SetPaperBin( nPaperBin );
594*cdf0e10cSrcweir 		pPage->SetBackgroundFullSize( bBackgroundFullSize );
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir 		if ( ePageKind == PK_STANDARD )
597*cdf0e10cSrcweir 			GetDoc()->GetMasterSdPage(i, PK_NOTES)->CreateTitleAndLayout();
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir 		pPage->CreateTitleAndLayout();
600*cdf0e10cSrcweir 	}
601*cdf0e10cSrcweir 
602*cdf0e10cSrcweir 	nPageCnt = GetDoc()->GetSdPageCount(ePageKind);
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir 	for (i = 0; i < nPageCnt; i++)
605*cdf0e10cSrcweir 	{
606*cdf0e10cSrcweir 		/**********************************************************************
607*cdf0e10cSrcweir 		* Danach alle Pages bearbeiten
608*cdf0e10cSrcweir 		**********************************************************************/
609*cdf0e10cSrcweir 		pPage = GetDoc()->GetSdPage(i, ePageKind);
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir 		SdUndoAction* pUndo = new SdPageFormatUndoAction(GetDoc(), pPage,
612*cdf0e10cSrcweir 								pPage->GetSize(),
613*cdf0e10cSrcweir 								pPage->GetLftBorder(), pPage->GetRgtBorder(),
614*cdf0e10cSrcweir 								pPage->GetUppBorder(), pPage->GetLwrBorder(),
615*cdf0e10cSrcweir 								pPage->IsScaleObjects(),
616*cdf0e10cSrcweir 								pPage->GetOrientation(),
617*cdf0e10cSrcweir 								pPage->GetPaperBin(),
618*cdf0e10cSrcweir 								pPage->IsBackgroundFullSize(),
619*cdf0e10cSrcweir 								rNewSize,
620*cdf0e10cSrcweir 								nLeft, nRight,
621*cdf0e10cSrcweir 								nUpper, nLower,
622*cdf0e10cSrcweir 								bScaleAll,
623*cdf0e10cSrcweir 								eOrientation,
624*cdf0e10cSrcweir 								nPaperBin,
625*cdf0e10cSrcweir 								bBackgroundFullSize);
626*cdf0e10cSrcweir 		pUndoGroup->AddAction(pUndo);
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir 		if (rNewSize.Width() > 0 ||
629*cdf0e10cSrcweir 			nLeft  >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0)
630*cdf0e10cSrcweir 		{
631*cdf0e10cSrcweir 			Rectangle aNewBorderRect(nLeft, nUpper, nRight, nLower);
632*cdf0e10cSrcweir 			pPage->ScaleObjects(rNewSize, aNewBorderRect, bScaleAll);
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir 			if (rNewSize.Width() > 0)
635*cdf0e10cSrcweir 				pPage->SetSize(rNewSize);
636*cdf0e10cSrcweir 		}
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir 		if( nLeft  >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0 )
639*cdf0e10cSrcweir 		{
640*cdf0e10cSrcweir 			pPage->SetBorder(nLeft, nUpper, nRight, nLower);
641*cdf0e10cSrcweir 		}
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir 		pPage->SetOrientation(eOrientation);
644*cdf0e10cSrcweir 		pPage->SetPaperBin( nPaperBin );
645*cdf0e10cSrcweir 		pPage->SetBackgroundFullSize( bBackgroundFullSize );
646*cdf0e10cSrcweir 
647*cdf0e10cSrcweir 		if ( ePageKind == PK_STANDARD )
648*cdf0e10cSrcweir 		{
649*cdf0e10cSrcweir 			SdPage* pNotesPage = GetDoc()->GetSdPage(i, PK_NOTES);
650*cdf0e10cSrcweir 			pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
651*cdf0e10cSrcweir 		}
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir 		pPage->SetAutoLayout( pPage->GetAutoLayout() );
654*cdf0e10cSrcweir 	}
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir 	// Handoutseite an neues Format der Standardseiten anpassen
657*cdf0e10cSrcweir 	if( (ePageKind == PK_STANDARD) || (ePageKind == PK_HANDOUT) )
658*cdf0e10cSrcweir 		GetDoc()->GetSdPage(0, PK_HANDOUT)->CreateTitleAndLayout(sal_True);
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir 	// Undo Gruppe dem Undo Manager uebergeben
661*cdf0e10cSrcweir 	pViewShell->GetViewFrame()->GetObjectShell()
662*cdf0e10cSrcweir         ->GetUndoManager()->AddUndoAction(pUndoGroup);
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir 	long nWidth = pPage->GetSize().Width();
665*cdf0e10cSrcweir 	long nHeight = pPage->GetSize().Height();
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir 	Point aPageOrg = Point(nWidth, nHeight / 2);
668*cdf0e10cSrcweir 	Size aViewSize = Size(nWidth * 3, nHeight * 2);
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir 	InitWindows(aPageOrg, aViewSize, Point(-1, -1), sal_True);
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir 	Point aVisAreaPos;
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir 	if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
675*cdf0e10cSrcweir 	{
676*cdf0e10cSrcweir 		aVisAreaPos = GetDocSh()->GetVisArea(ASPECT_CONTENT).TopLeft();
677*cdf0e10cSrcweir 	}
678*cdf0e10cSrcweir 
679*cdf0e10cSrcweir 	::sd::View* pView = GetView();
680*cdf0e10cSrcweir 	if (pView)
681*cdf0e10cSrcweir 	{
682*cdf0e10cSrcweir 		pView->SetWorkArea(Rectangle(Point() - aVisAreaPos - aPageOrg, aViewSize));
683*cdf0e10cSrcweir 	}
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir 	UpdateScrollBars();
686*cdf0e10cSrcweir 
687*cdf0e10cSrcweir 	Point aNewOrigin(pPage->GetLftBorder(), pPage->GetUppBorder());
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir 	if (pView)
690*cdf0e10cSrcweir 	{
691*cdf0e10cSrcweir 		pView->GetSdrPageView()->SetPageOrigin(aNewOrigin);
692*cdf0e10cSrcweir 	}
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir 	pViewShell->GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir 	// auf (neue) Seitengroesse zoomen
697*cdf0e10cSrcweir 	pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE,
698*cdf0e10cSrcweir 			SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
699*cdf0e10cSrcweir 
700*cdf0e10cSrcweir     Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_END));
701*cdf0e10cSrcweir }
702*cdf0e10cSrcweir 
703*cdf0e10cSrcweir /*************************************************************************
704*cdf0e10cSrcweir |*
705*cdf0e10cSrcweir |* Zoom-Faktor fuer InPlace einstellen
706*cdf0e10cSrcweir |*
707*cdf0e10cSrcweir \************************************************************************/
708*cdf0e10cSrcweir 
709*cdf0e10cSrcweir void ViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction&)
710*cdf0e10cSrcweir {
711*cdf0e10cSrcweir 	long nZoom = (long)((double) rZoomX * 100);
712*cdf0e10cSrcweir 	SetZoom(nZoom);
713*cdf0e10cSrcweir }
714*cdf0e10cSrcweir 
715*cdf0e10cSrcweir 
716*cdf0e10cSrcweir /*************************************************************************
717*cdf0e10cSrcweir |*
718*cdf0e10cSrcweir |* Aktives Fenster setzen
719*cdf0e10cSrcweir |*
720*cdf0e10cSrcweir \************************************************************************/
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir void ViewShell::SetActiveWindow (::sd::Window* pWin)
723*cdf0e10cSrcweir {
724*cdf0e10cSrcweir     SfxViewShell* pViewShell = GetViewShell();
725*cdf0e10cSrcweir     OSL_ASSERT (pViewShell!=NULL);
726*cdf0e10cSrcweir 
727*cdf0e10cSrcweir     if (pViewShell->GetWindow() != pWin)
728*cdf0e10cSrcweir 	{
729*cdf0e10cSrcweir 		// #i31551# was wrong, it may have been a problem with the repaint at that time.
730*cdf0e10cSrcweir 		// For transparent form controls, it is necessary to have that flag set, all apps
731*cdf0e10cSrcweir 		// do set it. Enabling again.
732*cdf0e10cSrcweir 		if (pWin)
733*cdf0e10cSrcweir 		{
734*cdf0e10cSrcweir 			pWin->EnableChildTransparentMode();
735*cdf0e10cSrcweir 		}
736*cdf0e10cSrcweir 	}
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir     if (mpActiveWindow != pWin)
739*cdf0e10cSrcweir         mpActiveWindow = pWin;
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir     // The rest of this function is not guarded anymore against calling this
742*cdf0e10cSrcweir     // method with an already active window because the functions may still
743*cdf0e10cSrcweir     // point to the old window when the new one has already been assigned to
744*cdf0e10cSrcweir     // pWindow elsewhere.
745*cdf0e10cSrcweir     ::sd::View* pView = GetView();
746*cdf0e10cSrcweir     if (pView)
747*cdf0e10cSrcweir     {
748*cdf0e10cSrcweir         pView->SetActualWin(pWin);
749*cdf0e10cSrcweir     }
750*cdf0e10cSrcweir     if(HasCurrentFunction())
751*cdf0e10cSrcweir     {
752*cdf0e10cSrcweir         GetCurrentFunction()->SetWindow(pWin);
753*cdf0e10cSrcweir     }
754*cdf0e10cSrcweir }
755*cdf0e10cSrcweir 
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir 
758*cdf0e10cSrcweir /*************************************************************************
759*cdf0e10cSrcweir |*
760*cdf0e10cSrcweir |* RequestHelp event
761*cdf0e10cSrcweir |*
762*cdf0e10cSrcweir \************************************************************************/
763*cdf0e10cSrcweir 
764*cdf0e10cSrcweir sal_Bool ViewShell::RequestHelp(const HelpEvent& rHEvt, ::sd::Window*)
765*cdf0e10cSrcweir {
766*cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir 	if (rHEvt.GetMode())
769*cdf0e10cSrcweir 	{
770*cdf0e10cSrcweir 		if( GetView() )
771*cdf0e10cSrcweir 			bReturn = GetView()->getSmartTags().RequestHelp(rHEvt);
772*cdf0e10cSrcweir 
773*cdf0e10cSrcweir 		if(!bReturn && HasCurrentFunction())
774*cdf0e10cSrcweir 		{
775*cdf0e10cSrcweir 			bReturn = GetCurrentFunction()->RequestHelp(rHEvt);
776*cdf0e10cSrcweir 		}
777*cdf0e10cSrcweir 	}
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir 	return(bReturn);
780*cdf0e10cSrcweir }
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir 
783*cdf0e10cSrcweir 
784*cdf0e10cSrcweir 
785*cdf0e10cSrcweir FrameView* ViewShell::GetFrameView (void)
786*cdf0e10cSrcweir {
787*cdf0e10cSrcweir     return mpFrameView;
788*cdf0e10cSrcweir }
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir 
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir void ViewShell::SetFrameView (FrameView* pNewFrameView)
794*cdf0e10cSrcweir {
795*cdf0e10cSrcweir     mpFrameView = pNewFrameView;
796*cdf0e10cSrcweir     ReadFrameViewData (mpFrameView);
797*cdf0e10cSrcweir }
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir 
800*cdf0e10cSrcweir 
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir /*************************************************************************
803*cdf0e10cSrcweir |*
804*cdf0e10cSrcweir |* Read FrameViews data and set actual views data
805*cdf0e10cSrcweir |*
806*cdf0e10cSrcweir \************************************************************************/
807*cdf0e10cSrcweir 
808*cdf0e10cSrcweir void ViewShell::ReadFrameViewData(FrameView*)
809*cdf0e10cSrcweir {
810*cdf0e10cSrcweir }
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir 
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir /*************************************************************************
815*cdf0e10cSrcweir |*
816*cdf0e10cSrcweir |* Write actual views data to FrameView
817*cdf0e10cSrcweir |*
818*cdf0e10cSrcweir \************************************************************************/
819*cdf0e10cSrcweir 
820*cdf0e10cSrcweir void ViewShell::WriteFrameViewData()
821*cdf0e10cSrcweir {
822*cdf0e10cSrcweir }
823*cdf0e10cSrcweir 
824*cdf0e10cSrcweir /*************************************************************************
825*cdf0e10cSrcweir |*
826*cdf0e10cSrcweir |* OLE-Object aktivieren
827*cdf0e10cSrcweir |*
828*cdf0e10cSrcweir \************************************************************************/
829*cdf0e10cSrcweir 
830*cdf0e10cSrcweir sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
831*cdf0e10cSrcweir {
832*cdf0e10cSrcweir 	ErrCode aErrCode = 0;
833*cdf0e10cSrcweir 
834*cdf0e10cSrcweir 	SfxErrorContext aEC(ERRCTX_SO_DOVERB, GetActiveWindow(), RID_SO_ERRCTX);
835*cdf0e10cSrcweir 	sal_Bool bAbort = sal_False;
836*cdf0e10cSrcweir 	GetDocSh()->SetWaitCursor( sal_True );
837*cdf0e10cSrcweir     SfxViewShell* pViewShell = GetViewShell();
838*cdf0e10cSrcweir     OSL_ASSERT (pViewShell!=NULL);
839*cdf0e10cSrcweir     bool bChangeDefaultsForChart = false;
840*cdf0e10cSrcweir 
841*cdf0e10cSrcweir     uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
842*cdf0e10cSrcweir     if ( !xObj.is() )
843*cdf0e10cSrcweir 	{
844*cdf0e10cSrcweir 		/**********************************************************
845*cdf0e10cSrcweir 		* Leeres OLE-Objekt mit OLE-Objekt versehen
846*cdf0e10cSrcweir 		**********************************************************/
847*cdf0e10cSrcweir 		String aName = pObj->GetProgName();
848*cdf0e10cSrcweir         ::rtl::OUString aObjName;
849*cdf0e10cSrcweir         SvGlobalName aClass;
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir         if( aName.EqualsAscii( "StarChart" ) || aName.EqualsAscii("StarOrg") )
852*cdf0e10cSrcweir 		{
853*cdf0e10cSrcweir 			if( SvtModuleOptions().IsChart() )
854*cdf0e10cSrcweir             {
855*cdf0e10cSrcweir                 aClass = SvGlobalName( SO3_SCH_CLASSID );
856*cdf0e10cSrcweir                 bChangeDefaultsForChart = true;
857*cdf0e10cSrcweir             }
858*cdf0e10cSrcweir 		}
859*cdf0e10cSrcweir 		else if( aName.EqualsAscii( "StarCalc" ))
860*cdf0e10cSrcweir 		{
861*cdf0e10cSrcweir 			if( SvtModuleOptions().IsCalc() )
862*cdf0e10cSrcweir                 aClass = SvGlobalName( SO3_SC_CLASSID );
863*cdf0e10cSrcweir 		}
864*cdf0e10cSrcweir 		else if( aName.EqualsAscii( "StarMath" ))
865*cdf0e10cSrcweir 		{
866*cdf0e10cSrcweir 			if( SvtModuleOptions().IsMath() )
867*cdf0e10cSrcweir                 aClass = SvGlobalName( SO3_SM_CLASSID );
868*cdf0e10cSrcweir 		}
869*cdf0e10cSrcweir 
870*cdf0e10cSrcweir         if ( aClass != SvGlobalName() )
871*cdf0e10cSrcweir             xObj = GetDocSh()->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClass.GetByteSequence(), aObjName );
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir         if( !xObj.is() )
874*cdf0e10cSrcweir 		{
875*cdf0e10cSrcweir 			aName = String();
876*cdf0e10cSrcweir 
877*cdf0e10cSrcweir 			// Dialog "OLE-Objekt einfuegen" aufrufen
878*cdf0e10cSrcweir 			GetDocSh()->SetWaitCursor( sal_False );
879*cdf0e10cSrcweir 			pViewShell->GetViewFrame()->GetDispatcher()->Execute(
880*cdf0e10cSrcweir                 SID_INSERT_OBJECT,
881*cdf0e10cSrcweir                 SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
882*cdf0e10cSrcweir             xObj = pObj->GetObjRef();
883*cdf0e10cSrcweir 			GetDocSh()->SetWaitCursor( sal_True );
884*cdf0e10cSrcweir 
885*cdf0e10cSrcweir             if (!xObj.is())
886*cdf0e10cSrcweir 			{
887*cdf0e10cSrcweir 				bAbort = sal_True;
888*cdf0e10cSrcweir 			}
889*cdf0e10cSrcweir 		}
890*cdf0e10cSrcweir 
891*cdf0e10cSrcweir         if ( xObj.is() )
892*cdf0e10cSrcweir 		{
893*cdf0e10cSrcweir 			/******************************************************
894*cdf0e10cSrcweir 			* OLE-Objekt ist nicht mehr leer
895*cdf0e10cSrcweir 			******************************************************/
896*cdf0e10cSrcweir 			pObj->SetEmptyPresObj(sal_False);
897*cdf0e10cSrcweir 			pObj->SetOutlinerParaObject(NULL);
898*cdf0e10cSrcweir 			pObj->SetGraphic(NULL);
899*cdf0e10cSrcweir 
900*cdf0e10cSrcweir 			/******************************************************
901*cdf0e10cSrcweir 			* Das leere OLE-Objekt bekommt ein neues IPObj
902*cdf0e10cSrcweir 			******************************************************/
903*cdf0e10cSrcweir 			if (aName.Len())
904*cdf0e10cSrcweir 			{
905*cdf0e10cSrcweir                 pObj->SetObjRef(xObj);
906*cdf0e10cSrcweir 				pObj->SetName(aObjName);
907*cdf0e10cSrcweir     			pObj->SetPersistName(aObjName);
908*cdf0e10cSrcweir 			}
909*cdf0e10cSrcweir 			else
910*cdf0e10cSrcweir 			{
911*cdf0e10cSrcweir 				// Das Einfuegen hat der Dialog schon gemacht
912*cdf0e10cSrcweir                 pObj->SetObjRef(xObj);
913*cdf0e10cSrcweir 			}
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir 			Rectangle aRect = pObj->GetLogicRect();
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir 			if ( pObj->GetAspect() != embed::Aspects::MSOLE_ICON )
918*cdf0e10cSrcweir 			{
919*cdf0e10cSrcweir             	awt::Size aSz;
920*cdf0e10cSrcweir             	aSz.Width = aRect.GetWidth();
921*cdf0e10cSrcweir             	aSz.Height = aRect.GetHeight();
922*cdf0e10cSrcweir             	xObj->setVisualAreaSize( pObj->GetAspect(), aSz );
923*cdf0e10cSrcweir 			}
924*cdf0e10cSrcweir 
925*cdf0e10cSrcweir             GetViewShellBase().SetVerbs( xObj->getSupportedVerbs() );
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir 			nVerb = SVVERB_SHOW;
928*cdf0e10cSrcweir 		}
929*cdf0e10cSrcweir 		else
930*cdf0e10cSrcweir 		{
931*cdf0e10cSrcweir 			aErrCode = ERRCODE_SFX_OLEGENERAL;
932*cdf0e10cSrcweir 		}
933*cdf0e10cSrcweir 	}
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir 	if( aErrCode == 0 )
936*cdf0e10cSrcweir 	{
937*cdf0e10cSrcweir 		::sd::View* pView = GetView();
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir 		if (pView->IsTextEdit())
940*cdf0e10cSrcweir 		{
941*cdf0e10cSrcweir 			pView->SdrEndTextEdit();
942*cdf0e10cSrcweir 		}
943*cdf0e10cSrcweir 
944*cdf0e10cSrcweir         SfxInPlaceClient* pSdClient =
945*cdf0e10cSrcweir             static_cast<Client*>(pViewShell->FindIPClient(
946*cdf0e10cSrcweir                 pObj->GetObjRef(), GetActiveWindow()));
947*cdf0e10cSrcweir 
948*cdf0e10cSrcweir         if ( !pSdClient )
949*cdf0e10cSrcweir 		{
950*cdf0e10cSrcweir 			pSdClient = new Client(pObj, this, GetActiveWindow());
951*cdf0e10cSrcweir 		}
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir 		Rectangle aRect = pObj->GetLogicRect();
954*cdf0e10cSrcweir         Size aDrawSize = aRect.GetSize();
955*cdf0e10cSrcweir 
956*cdf0e10cSrcweir 		MapMode aMapMode( GetDoc()->GetScaleUnit() );
957*cdf0e10cSrcweir         Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode );
958*cdf0e10cSrcweir         if( pObj->IsChart() ) //charts never should be stretched see #i84323# for example
959*cdf0e10cSrcweir             aObjAreaSize = aDrawSize;
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir         Fraction aScaleWidth (aDrawSize.Width(),  aObjAreaSize.Width() );
962*cdf0e10cSrcweir         Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
963*cdf0e10cSrcweir         aScaleWidth.ReduceInaccurate(10);       // kompatibel zum SdrOle2Obj
964*cdf0e10cSrcweir         aScaleHeight.ReduceInaccurate(10);
965*cdf0e10cSrcweir         pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
966*cdf0e10cSrcweir 
967*cdf0e10cSrcweir         // sichtbarer Ausschnitt wird nur inplace veraendert!
968*cdf0e10cSrcweir         aRect.SetSize(aObjAreaSize);
969*cdf0e10cSrcweir 		// the object area size must be set after scaling, since it triggers the resizing
970*cdf0e10cSrcweir         pSdClient->SetObjArea(aRect);
971*cdf0e10cSrcweir 
972*cdf0e10cSrcweir         if( bChangeDefaultsForChart && xObj.is())
973*cdf0e10cSrcweir         {
974*cdf0e10cSrcweir             AdaptDefaultsForChart( xObj );
975*cdf0e10cSrcweir         }
976*cdf0e10cSrcweir 
977*cdf0e10cSrcweir         pSdClient->DoVerb(nVerb);   // ErrCode wird ggf. vom Sfx ausgegeben
978*cdf0e10cSrcweir 		pViewShell->GetViewFrame()->GetBindings().Invalidate(
979*cdf0e10cSrcweir             SID_NAVIGATOR_STATE, sal_True, sal_False);
980*cdf0e10cSrcweir 	}
981*cdf0e10cSrcweir 
982*cdf0e10cSrcweir 	GetDocSh()->SetWaitCursor( sal_False );
983*cdf0e10cSrcweir 
984*cdf0e10cSrcweir 	if (aErrCode != 0 && !bAbort)
985*cdf0e10cSrcweir 	{
986*cdf0e10cSrcweir 		ErrorHandler::HandleError(* new StringErrorInfo(aErrCode, String() ) );
987*cdf0e10cSrcweir 	}
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir 	return aErrCode == 0;
990*cdf0e10cSrcweir }
991*cdf0e10cSrcweir 
992*cdf0e10cSrcweir /*************************************************************************
993*cdf0e10cSrcweir |*
994*cdf0e10cSrcweir |* umschliessendes Rechteck aller (Split-)Fenster zurueckgeben.
995*cdf0e10cSrcweir |*
996*cdf0e10cSrcweir \************************************************************************/
997*cdf0e10cSrcweir 
998*cdf0e10cSrcweir const Rectangle& ViewShell::GetAllWindowRect()
999*cdf0e10cSrcweir {
1000*cdf0e10cSrcweir 	maAllWindowRectangle.SetPos(
1001*cdf0e10cSrcweir         mpContentWindow->OutputToScreenPixel(Point(0,0)));
1002*cdf0e10cSrcweir 	return maAllWindowRectangle;
1003*cdf0e10cSrcweir }
1004*cdf0e10cSrcweir 
1005*cdf0e10cSrcweir /*************************************************************************
1006*cdf0e10cSrcweir |*
1007*cdf0e10cSrcweir |* Read user data
1008*cdf0e10cSrcweir |*
1009*cdf0e10cSrcweir \************************************************************************/
1010*cdf0e10cSrcweir void ViewShell::ReadUserData(const String&)
1011*cdf0e10cSrcweir {
1012*cdf0e10cSrcweir 	// Auf an FrameView gemerkte VisArea zoomen
1013*cdf0e10cSrcweir 	GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_VISAREA,
1014*cdf0e10cSrcweir         SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
1015*cdf0e10cSrcweir }
1016*cdf0e10cSrcweir 
1017*cdf0e10cSrcweir /*************************************************************************
1018*cdf0e10cSrcweir |*
1019*cdf0e10cSrcweir |* Write user data
1020*cdf0e10cSrcweir |*
1021*cdf0e10cSrcweir \************************************************************************/
1022*cdf0e10cSrcweir 
1023*cdf0e10cSrcweir void ViewShell::WriteUserData(String&)
1024*cdf0e10cSrcweir {
1025*cdf0e10cSrcweir 	// Das Schreiben unserer Daten erfolgt stets in WriteFrameViewData()
1026*cdf0e10cSrcweir 	WriteFrameViewData();
1027*cdf0e10cSrcweir }
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir /*************************************************************************
1031*cdf0e10cSrcweir |*
1032*cdf0e10cSrcweir |* Lineale ein- / ausschalten
1033*cdf0e10cSrcweir |*
1034*cdf0e10cSrcweir \************************************************************************/
1035*cdf0e10cSrcweir 
1036*cdf0e10cSrcweir void ViewShell::SetRuler(sal_Bool bRuler)
1037*cdf0e10cSrcweir {
1038*cdf0e10cSrcweir     mbHasRulers = ( bRuler && !GetDocSh()->IsPreview() ); // no rulers on preview mode
1039*cdf0e10cSrcweir 
1040*cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
1041*cdf0e10cSrcweir     {
1042*cdf0e10cSrcweir         if (mbHasRulers)
1043*cdf0e10cSrcweir         {
1044*cdf0e10cSrcweir             mpHorizontalRuler->Show();
1045*cdf0e10cSrcweir         }
1046*cdf0e10cSrcweir         else
1047*cdf0e10cSrcweir         {
1048*cdf0e10cSrcweir             mpHorizontalRuler->Hide();
1049*cdf0e10cSrcweir         }
1050*cdf0e10cSrcweir     }
1051*cdf0e10cSrcweir 
1052*cdf0e10cSrcweir     if (mpVerticalRuler.get() != NULL)
1053*cdf0e10cSrcweir     {
1054*cdf0e10cSrcweir         if (mbHasRulers)
1055*cdf0e10cSrcweir         {
1056*cdf0e10cSrcweir             mpVerticalRuler->Show();
1057*cdf0e10cSrcweir         }
1058*cdf0e10cSrcweir         else
1059*cdf0e10cSrcweir         {
1060*cdf0e10cSrcweir             mpVerticalRuler->Hide();
1061*cdf0e10cSrcweir         }
1062*cdf0e10cSrcweir     }
1063*cdf0e10cSrcweir 
1064*cdf0e10cSrcweir     OSL_ASSERT(GetViewShell()!=NULL);
1065*cdf0e10cSrcweir     if (IsMainViewShell())
1066*cdf0e10cSrcweir         GetViewShell()->InvalidateBorder();
1067*cdf0e10cSrcweir }
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir /*************************************************************************
1070*cdf0e10cSrcweir |*
1071*cdf0e10cSrcweir |* AcceptDrop
1072*cdf0e10cSrcweir |*
1073*cdf0e10cSrcweir \************************************************************************/
1074*cdf0e10cSrcweir 
1075*cdf0e10cSrcweir sal_Int8 ViewShell::AcceptDrop (
1076*cdf0e10cSrcweir     const AcceptDropEvent& rEvt,
1077*cdf0e10cSrcweir     DropTargetHelper& rTargetHelper,
1078*cdf0e10cSrcweir     ::sd::Window* pTargetWindow,
1079*cdf0e10cSrcweir     sal_uInt16 nPage,
1080*cdf0e10cSrcweir     sal_uInt16 nLayer)
1081*cdf0e10cSrcweir {
1082*cdf0e10cSrcweir 	::sd::View* pView = GetView();
1083*cdf0e10cSrcweir 	return( pView ? pView->AcceptDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ) : DND_ACTION_NONE );
1084*cdf0e10cSrcweir }
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir /*************************************************************************
1087*cdf0e10cSrcweir |*
1088*cdf0e10cSrcweir |* ExecuteDrop
1089*cdf0e10cSrcweir |*
1090*cdf0e10cSrcweir \************************************************************************/
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir sal_Int8 ViewShell::ExecuteDrop (
1093*cdf0e10cSrcweir     const ExecuteDropEvent& rEvt,
1094*cdf0e10cSrcweir     DropTargetHelper& rTargetHelper,
1095*cdf0e10cSrcweir     ::sd::Window* pTargetWindow,
1096*cdf0e10cSrcweir     sal_uInt16 nPage,
1097*cdf0e10cSrcweir     sal_uInt16 nLayer)
1098*cdf0e10cSrcweir {
1099*cdf0e10cSrcweir 	::sd::View*	pView = GetView();
1100*cdf0e10cSrcweir 	return( pView ? pView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ) : DND_ACTION_NONE );
1101*cdf0e10cSrcweir }
1102*cdf0e10cSrcweir 
1103*cdf0e10cSrcweir #ifdef _MSC_VER
1104*cdf0e10cSrcweir #pragma optimize ( "", on )
1105*cdf0e10cSrcweir #endif
1106*cdf0e10cSrcweir 
1107*cdf0e10cSrcweir void ViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence <
1108*cdf0e10cSrcweir     ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse)
1109*cdf0e10cSrcweir {
1110*cdf0e10cSrcweir 	const sal_Int32 nIndex = rSequence.getLength();
1111*cdf0e10cSrcweir 	rSequence.realloc( nIndex + 1 );
1112*cdf0e10cSrcweir 
1113*cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
1114*cdf0e10cSrcweir     // Get the view id from the view shell in the center pane.  This will
1115*cdf0e10cSrcweir     // usually be the called view shell, but to be on the safe side we call
1116*cdf0e10cSrcweir     // the main view shell explicitly.
1117*cdf0e10cSrcweir     sal_uInt16 nViewID (IMPRESS_FACTORY_ID);
1118*cdf0e10cSrcweir     if (GetViewShellBase().GetMainViewShell().get() != NULL)
1119*cdf0e10cSrcweir         nViewID = GetViewShellBase().GetMainViewShell()->mpImpl->GetViewId();
1120*cdf0e10cSrcweir 	rSequence[nIndex].Name = rtl::OUString (
1121*cdf0e10cSrcweir         RTL_CONSTASCII_USTRINGPARAM( sUNO_View_ViewId ) );
1122*cdf0e10cSrcweir 	rtl::OUStringBuffer sBuffer (
1123*cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "view" ) ) );
1124*cdf0e10cSrcweir 	sBuffer.append( static_cast<sal_Int32>(nViewID));
1125*cdf0e10cSrcweir 	rSequence[nIndex].Value <<= sBuffer.makeStringAndClear();
1126*cdf0e10cSrcweir 
1127*cdf0e10cSrcweir 	mpFrameView->WriteUserDataSequence( rSequence, bBrowse );
1128*cdf0e10cSrcweir }
1129*cdf0e10cSrcweir 
1130*cdf0e10cSrcweir 
1131*cdf0e10cSrcweir void ViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
1132*cdf0e10cSrcweir {
1133*cdf0e10cSrcweir 	mpFrameView->ReadUserDataSequence( rSequence, bBrowse );
1134*cdf0e10cSrcweir }
1135*cdf0e10cSrcweir 
1136*cdf0e10cSrcweir void ViewShell::VisAreaChanged(const Rectangle& rRect)
1137*cdf0e10cSrcweir {
1138*cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
1139*cdf0e10cSrcweir 	GetViewShell()->VisAreaChanged(rRect);
1140*cdf0e10cSrcweir }
1141*cdf0e10cSrcweir 
1142*cdf0e10cSrcweir void ViewShell::SetWinViewPos(const Point& rWinPos, bool bUpdate)
1143*cdf0e10cSrcweir {
1144*cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
1145*cdf0e10cSrcweir     {
1146*cdf0e10cSrcweir         mpContentWindow->SetWinViewPos(rWinPos);
1147*cdf0e10cSrcweir 
1148*cdf0e10cSrcweir         if ( bUpdate )
1149*cdf0e10cSrcweir         {
1150*cdf0e10cSrcweir             mpContentWindow->UpdateMapOrigin();
1151*cdf0e10cSrcweir             mpContentWindow->Invalidate();
1152*cdf0e10cSrcweir         }
1153*cdf0e10cSrcweir     }
1154*cdf0e10cSrcweir 
1155*cdf0e10cSrcweir 	if (mbHasRulers)
1156*cdf0e10cSrcweir 	{
1157*cdf0e10cSrcweir 		UpdateHRuler();
1158*cdf0e10cSrcweir 		UpdateVRuler();
1159*cdf0e10cSrcweir 	}
1160*cdf0e10cSrcweir 
1161*cdf0e10cSrcweir 	UpdateScrollBars();
1162*cdf0e10cSrcweir 
1163*cdf0e10cSrcweir 	Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
1164*cdf0e10cSrcweir 	Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
1165*cdf0e10cSrcweir 	VisAreaChanged(aVisAreaWin);
1166*cdf0e10cSrcweir 
1167*cdf0e10cSrcweir 	::sd::View* pView = GetView();
1168*cdf0e10cSrcweir 	if (pView)
1169*cdf0e10cSrcweir 	{
1170*cdf0e10cSrcweir 		pView->VisAreaChanged(GetActiveWindow());
1171*cdf0e10cSrcweir 	}
1172*cdf0e10cSrcweir }
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir Point ViewShell::GetWinViewPos() const
1175*cdf0e10cSrcweir {
1176*cdf0e10cSrcweir 	return mpContentWindow->GetWinViewPos();
1177*cdf0e10cSrcweir }
1178*cdf0e10cSrcweir 
1179*cdf0e10cSrcweir Point ViewShell::GetViewOrigin() const
1180*cdf0e10cSrcweir {
1181*cdf0e10cSrcweir 	return mpContentWindow->GetViewOrigin();
1182*cdf0e10cSrcweir }
1183*cdf0e10cSrcweir 
1184*cdf0e10cSrcweir void ViewShell::AdaptDefaultsForChart(
1185*cdf0e10cSrcweir     const uno::Reference < embed::XEmbeddedObject > & xEmbObj )
1186*cdf0e10cSrcweir {
1187*cdf0e10cSrcweir     if( xEmbObj.is())
1188*cdf0e10cSrcweir     {
1189*cdf0e10cSrcweir         uno::Reference< chart2::XChartDocument > xChartDoc( xEmbObj->getComponent(), uno::UNO_QUERY );
1190*cdf0e10cSrcweir         OSL_ENSURE( xChartDoc.is(), "Trying to set chart property to non-chart OLE" );
1191*cdf0e10cSrcweir         if( !xChartDoc.is())
1192*cdf0e10cSrcweir             return;
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir         try
1195*cdf0e10cSrcweir         {
1196*cdf0e10cSrcweir             // set background to transparent (none)
1197*cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xPageProp( xChartDoc->getPageBackground());
1198*cdf0e10cSrcweir             if( xPageProp.is())
1199*cdf0e10cSrcweir                 xPageProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FillStyle")),
1200*cdf0e10cSrcweir                                              uno::makeAny( drawing::FillStyle_NONE ));
1201*cdf0e10cSrcweir             // set no border
1202*cdf0e10cSrcweir             if( xPageProp.is())
1203*cdf0e10cSrcweir                 xPageProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineStyle")),
1204*cdf0e10cSrcweir                                              uno::makeAny( drawing::LineStyle_NONE ));
1205*cdf0e10cSrcweir         }
1206*cdf0e10cSrcweir         catch( const uno::Exception & )
1207*cdf0e10cSrcweir         {
1208*cdf0e10cSrcweir             OSL_ENSURE( false, "Exception caught in AdaptDefaultsForChart" );
1209*cdf0e10cSrcweir         }
1210*cdf0e10cSrcweir     }
1211*cdf0e10cSrcweir }
1212*cdf0e10cSrcweir 
1213*cdf0e10cSrcweir } // end of namespace sd
1214