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