xref: /AOO41X/main/svx/source/svdraw/svdpagv.cxx (revision a56bd57b6589a8d3cc2cdff6932c7993d643327b)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <svx/svdpagv.hxx>
27cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
28cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
29cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
30cdf0e10cSrcweir #include <svx/svdoutl.hxx>
31cdf0e10cSrcweir #include <svx/xpoly.hxx>
32cdf0e10cSrcweir #include <svx/svdouno.hxx>
33cdf0e10cSrcweir #include <svx/svdpage.hxx>
34cdf0e10cSrcweir #include <svx/svdview.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <svx/svdedxv.hxx>
37cdf0e10cSrcweir #include <svx/svdpagv.hxx>
38cdf0e10cSrcweir #include <svx/svdoutl.hxx>
39cdf0e10cSrcweir #include <svx/svdpagv.hxx>
40cdf0e10cSrcweir #include <editeng/outliner.hxx>
41cdf0e10cSrcweir #include <svx/svdetc.hxx>
42cdf0e10cSrcweir #include <svx/svdobj.hxx>
43cdf0e10cSrcweir #include <svx/svdouno.hxx>
44cdf0e10cSrcweir #include <svx/svdpage.hxx>
45cdf0e10cSrcweir #include <svx/svdview.hxx>
46cdf0e10cSrcweir #include "svx/svditer.hxx"
47cdf0e10cSrcweir #include <svx/svdogrp.hxx>
48cdf0e10cSrcweir #include <svx/svdtypes.hxx>
49cdf0e10cSrcweir #include <svx/svdoole2.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir // #110094#
52cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofpageview.hxx>
53cdf0e10cSrcweir #include <svx/svdogrp.hxx>
54cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontactredirector.hxx>
55cdf0e10cSrcweir #include <svx/fmview.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir // for search on vector
58cdf0e10cSrcweir #include <algorithm>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir using namespace ::rtl;
61cdf0e10cSrcweir using namespace ::com::sun::star;
62cdf0e10cSrcweir #include <svx/sdrpagewindow.hxx>
63cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx>
64cdf0e10cSrcweir 
65cdf0e10cSrcweir TYPEINIT1(SdrPageView, SfxListener);
66cdf0e10cSrcweir DBG_NAME(SdrPageView);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
69cdf0e10cSrcweir // interface to SdrPageWindow
70cdf0e10cSrcweir 
FindPageWindow(SdrPaintWindow & rPaintWindow) const71cdf0e10cSrcweir SdrPageWindow* SdrPageView::FindPageWindow(SdrPaintWindow& rPaintWindow) const
72cdf0e10cSrcweir {
73cdf0e10cSrcweir 	for(SdrPageWindowVector::const_iterator a = maPageWindows.begin(); a != maPageWindows.end(); a++)
74cdf0e10cSrcweir 	{
75cdf0e10cSrcweir 		if(&((*a)->GetPaintWindow()) == &rPaintWindow)
76cdf0e10cSrcweir 		{
77cdf0e10cSrcweir 			return *a;
78cdf0e10cSrcweir 		}
79cdf0e10cSrcweir 	}
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	return 0L;
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
FindPatchedPageWindow(const OutputDevice & _rOutDev) const84cdf0e10cSrcweir const SdrPageWindow* SdrPageView::FindPatchedPageWindow( const OutputDevice& _rOutDev ) const
85cdf0e10cSrcweir {
86cdf0e10cSrcweir 	for (   SdrPageWindowVector::const_iterator loop = maPageWindows.begin();
87cdf0e10cSrcweir             loop != maPageWindows.end();
88cdf0e10cSrcweir             ++loop
89cdf0e10cSrcweir         )
90cdf0e10cSrcweir 	{
91cdf0e10cSrcweir         const SdrPageWindow& rPageWindow( *(*loop) );
92cdf0e10cSrcweir         const SdrPaintWindow& rPaintWindow( rPageWindow.GetOriginalPaintWindow() ? *rPageWindow.GetOriginalPaintWindow() : rPageWindow.GetPaintWindow() );
93cdf0e10cSrcweir         if ( &rPaintWindow.GetOutputDevice() == &_rOutDev )
94cdf0e10cSrcweir         {
95cdf0e10cSrcweir             return &rPageWindow;
96cdf0e10cSrcweir         }
97cdf0e10cSrcweir 	}
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	return NULL;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
FindPageWindow(const OutputDevice & rOutDev) const102cdf0e10cSrcweir SdrPageWindow* SdrPageView::FindPageWindow(const OutputDevice& rOutDev) const
103cdf0e10cSrcweir {
104cdf0e10cSrcweir 	for(SdrPageWindowVector::const_iterator a = maPageWindows.begin(); a != maPageWindows.end(); a++)
105cdf0e10cSrcweir 	{
106cdf0e10cSrcweir 		if(&((*a)->GetPaintWindow().GetOutputDevice()) == &rOutDev)
107cdf0e10cSrcweir 		{
108cdf0e10cSrcweir 			return *a;
109cdf0e10cSrcweir 		}
110cdf0e10cSrcweir 	}
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	return 0L;
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
GetPageWindow(sal_uInt32 nIndex) const115cdf0e10cSrcweir SdrPageWindow* SdrPageView::GetPageWindow(sal_uInt32 nIndex) const
116cdf0e10cSrcweir {
117cdf0e10cSrcweir 	// #126416#
118cdf0e10cSrcweir 	if(nIndex < maPageWindows.size())
119cdf0e10cSrcweir 	{
120cdf0e10cSrcweir 		return maPageWindows[nIndex];
121cdf0e10cSrcweir 	}
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	return 0L;
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
ClearPageWindows()126cdf0e10cSrcweir void SdrPageView::ClearPageWindows()
127cdf0e10cSrcweir {
128cdf0e10cSrcweir 	// #126416#
129cdf0e10cSrcweir 	for(SdrPageWindowVector::const_iterator a = maPageWindows.begin(); a != maPageWindows.end(); a++)
130cdf0e10cSrcweir 	{
131cdf0e10cSrcweir 		delete *a;
132cdf0e10cSrcweir 	}
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	maPageWindows.clear();
135cdf0e10cSrcweir }
136cdf0e10cSrcweir 
AppendPageWindow(SdrPageWindow & rNew)137cdf0e10cSrcweir void SdrPageView::AppendPageWindow(SdrPageWindow& rNew)
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	maPageWindows.push_back(&rNew);
140cdf0e10cSrcweir }
141cdf0e10cSrcweir 
RemovePageWindow(sal_uInt32 nPos)142cdf0e10cSrcweir SdrPageWindow* SdrPageView::RemovePageWindow(sal_uInt32 nPos)
143cdf0e10cSrcweir {
144cdf0e10cSrcweir 	if(nPos < maPageWindows.size())
145cdf0e10cSrcweir 	{
146cdf0e10cSrcweir 		SdrPageWindowVector::iterator aAccess = maPageWindows.begin() + nPos;
147cdf0e10cSrcweir 		// #114376# remember return value
148cdf0e10cSrcweir 		SdrPageWindow* pErasedSdrPageWindow = *aAccess;
149cdf0e10cSrcweir 		maPageWindows.erase(aAccess);
150cdf0e10cSrcweir 		return pErasedSdrPageWindow;
151cdf0e10cSrcweir 	}
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	return 0L;
154cdf0e10cSrcweir }
155cdf0e10cSrcweir 
RemovePageWindow(SdrPageWindow & rOld)156cdf0e10cSrcweir SdrPageWindow* SdrPageView::RemovePageWindow(SdrPageWindow& rOld)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir 	const SdrPageWindowVector::iterator aFindResult = ::std::find(maPageWindows.begin(), maPageWindows.end(), &rOld);
159cdf0e10cSrcweir 
160cdf0e10cSrcweir 	if(aFindResult != maPageWindows.end())
161cdf0e10cSrcweir 	{
162cdf0e10cSrcweir 		// #114376# remember return value
163cdf0e10cSrcweir 		SdrPageWindow* pSdrPageWindow = *aFindResult;
164cdf0e10cSrcweir 		maPageWindows.erase(aFindResult);
165cdf0e10cSrcweir 		return pSdrPageWindow;
166cdf0e10cSrcweir 	}
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	return 0L;
169cdf0e10cSrcweir }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
172cdf0e10cSrcweir 
SdrPageView(SdrPage * pPage1,SdrView & rNewView)173cdf0e10cSrcweir SdrPageView::SdrPageView(SdrPage* pPage1, SdrView& rNewView)
174cdf0e10cSrcweir :	mrView(rNewView),
175cdf0e10cSrcweir 	// #103911# col_auto color lets the view takes the default SvxColorConfig entry
176cdf0e10cSrcweir 	maDocumentColor( COL_AUTO ),
177cdf0e10cSrcweir 	maBackgroundColor(COL_AUTO ), // #i48367# also react on autocolor
178cdf0e10cSrcweir 	mpPreparedPageWindow(0) // #i72752#
179cdf0e10cSrcweir {
180cdf0e10cSrcweir 	DBG_CTOR(SdrPageView,NULL);
181cdf0e10cSrcweir 	mpPage = pPage1;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	if(mpPage)
184cdf0e10cSrcweir 	{
185cdf0e10cSrcweir 		aPgOrg.X()=mpPage->GetLftBorder();
186cdf0e10cSrcweir 		aPgOrg.Y()=mpPage->GetUppBorder();
187cdf0e10cSrcweir 	}
188cdf0e10cSrcweir 	mbHasMarked = sal_False;
189cdf0e10cSrcweir 	aLayerVisi.SetAll();
190cdf0e10cSrcweir 	aLayerPrn.SetAll();
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	mbVisible = sal_False;
193cdf0e10cSrcweir 	pAktList = NULL;
194cdf0e10cSrcweir 	pAktGroup = NULL;
195cdf0e10cSrcweir 	SetAktGroupAndList(NULL, mpPage);
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	StartListening(*rNewView.GetModel());
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	for(sal_uInt32 a(0L); a < rNewView.PaintWindowCount(); a++)
200cdf0e10cSrcweir 	{
201cdf0e10cSrcweir 		AddPaintWindowToPageView(*rNewView.GetPaintWindow(a));
202cdf0e10cSrcweir 	}
203cdf0e10cSrcweir }
204cdf0e10cSrcweir 
~SdrPageView()205cdf0e10cSrcweir SdrPageView::~SdrPageView()
206cdf0e10cSrcweir {
207cdf0e10cSrcweir 	DBG_DTOR(SdrPageView,NULL);
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 	// cleanup window vector
210cdf0e10cSrcweir 	ClearPageWindows();
211cdf0e10cSrcweir }
212cdf0e10cSrcweir 
CreateNewPageWindowEntry(SdrPaintWindow & rPaintWindow)213cdf0e10cSrcweir SdrPageWindow& SdrPageView::CreateNewPageWindowEntry(SdrPaintWindow& rPaintWindow)
214cdf0e10cSrcweir {
215cdf0e10cSrcweir 	// MIB 3.7.08: Das WinRec muss sofort in die Liste eingetragen werden,
216cdf0e10cSrcweir 	// weil sich das InsertControlContainer darauf verlaesst
217cdf0e10cSrcweir 	//SdrPageViewWinRec* pRec = new SdrPageViewWinRec( *this, pOut );
218cdf0e10cSrcweir 	//pWinList->Insert(pRec);
219cdf0e10cSrcweir 	SdrPageWindow& rWindow = *(new SdrPageWindow(*this, rPaintWindow));
220cdf0e10cSrcweir 	AppendPageWindow(rWindow);
221cdf0e10cSrcweir 
222cdf0e10cSrcweir 	return rWindow;
223cdf0e10cSrcweir }
224cdf0e10cSrcweir 
AddPaintWindowToPageView(SdrPaintWindow & rPaintWindow)225cdf0e10cSrcweir void SdrPageView::AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow)
226cdf0e10cSrcweir {
227cdf0e10cSrcweir 	if(!FindPageWindow(rPaintWindow))
228cdf0e10cSrcweir 	{
229cdf0e10cSrcweir 		CreateNewPageWindowEntry(rPaintWindow);
230cdf0e10cSrcweir 	}
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
RemovePaintWindowFromPageView(SdrPaintWindow & rPaintWindow)233cdf0e10cSrcweir void SdrPageView::RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir 	SdrPageWindow* pCandidate = FindPageWindow(rPaintWindow);
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 	if(pCandidate)
238cdf0e10cSrcweir 	{
239cdf0e10cSrcweir 		pCandidate = RemovePageWindow(*pCandidate);
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 		if(pCandidate)
242cdf0e10cSrcweir 		{
243cdf0e10cSrcweir 			delete pCandidate;
244cdf0e10cSrcweir 		}
245cdf0e10cSrcweir 	}
246cdf0e10cSrcweir }
247cdf0e10cSrcweir 
GetControlContainer(const OutputDevice & _rDevice) const248cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > SdrPageView::GetControlContainer( const OutputDevice& _rDevice ) const
249cdf0e10cSrcweir {
250cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > xReturn;
251cdf0e10cSrcweir 	const SdrPageWindow* pCandidate = FindPatchedPageWindow( _rDevice );
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	if ( pCandidate )
254cdf0e10cSrcweir         xReturn = pCandidate->GetControlContainer( true );
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	return xReturn;
257cdf0e10cSrcweir }
258cdf0e10cSrcweir 
Notify(SfxBroadcaster &,const SfxHint &)259cdf0e10cSrcweir void __EXPORT SdrPageView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
260cdf0e10cSrcweir {
261cdf0e10cSrcweir     // not really interested in
262cdf0e10cSrcweir }
263cdf0e10cSrcweir 
ModelHasChanged()264cdf0e10cSrcweir void SdrPageView::ModelHasChanged()
265cdf0e10cSrcweir {
266cdf0e10cSrcweir 	if (GetAktGroup()!=NULL) CheckAktGroup();
267cdf0e10cSrcweir }
268cdf0e10cSrcweir 
IsReadOnly() const269cdf0e10cSrcweir sal_Bool SdrPageView::IsReadOnly() const
270cdf0e10cSrcweir {
271cdf0e10cSrcweir 	return (0L == GetPage() || GetView().GetModel()->IsReadOnly() || GetPage()->IsReadOnly() || GetObjList()->IsReadOnly());
272cdf0e10cSrcweir }
273cdf0e10cSrcweir 
Show()274cdf0e10cSrcweir void SdrPageView::Show()
275cdf0e10cSrcweir {
276cdf0e10cSrcweir 	if(!IsVisible())
277cdf0e10cSrcweir 	{
278cdf0e10cSrcweir 		mbVisible = sal_True;
279cdf0e10cSrcweir 		InvalidateAllWin();
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < GetView().PaintWindowCount(); a++)
282cdf0e10cSrcweir 		{
283cdf0e10cSrcweir 			AddPaintWindowToPageView(*GetView().GetPaintWindow(a));
284cdf0e10cSrcweir 		}
285cdf0e10cSrcweir 	}
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
Hide()288cdf0e10cSrcweir void SdrPageView::Hide()
289cdf0e10cSrcweir {
290cdf0e10cSrcweir 	if(IsVisible())
291cdf0e10cSrcweir 	{
292cdf0e10cSrcweir 		InvalidateAllWin();
293cdf0e10cSrcweir 		mbVisible = sal_False;
294cdf0e10cSrcweir 		ClearPageWindows();
295cdf0e10cSrcweir 	}
296cdf0e10cSrcweir }
297cdf0e10cSrcweir 
GetPageRect() const298cdf0e10cSrcweir Rectangle SdrPageView::GetPageRect() const
299cdf0e10cSrcweir {
300cdf0e10cSrcweir 	if (GetPage()==NULL) return Rectangle();
301cdf0e10cSrcweir 	return Rectangle(Point(),Size(GetPage()->GetWdt()+1,GetPage()->GetHgt()+1));
302cdf0e10cSrcweir }
303cdf0e10cSrcweir 
InvalidateAllWin()304cdf0e10cSrcweir void SdrPageView::InvalidateAllWin()
305cdf0e10cSrcweir {
306cdf0e10cSrcweir 	if(IsVisible() && GetPage())
307cdf0e10cSrcweir 	{
308cdf0e10cSrcweir 		Rectangle aRect(Point(0,0),Size(GetPage()->GetWdt()+1,GetPage()->GetHgt()+1));
309cdf0e10cSrcweir 		aRect.Union(GetPage()->GetAllObjBoundRect());
310cdf0e10cSrcweir 		GetView().InvalidateAllWin(aRect);
311cdf0e10cSrcweir 	}
312cdf0e10cSrcweir }
313cdf0e10cSrcweir 
InvalidateAllWin(const Rectangle & rRect,sal_Bool bPlus1Pix)314cdf0e10cSrcweir void SdrPageView::InvalidateAllWin(const Rectangle& rRect, sal_Bool bPlus1Pix)
315cdf0e10cSrcweir {
316cdf0e10cSrcweir 	if(IsVisible())
317cdf0e10cSrcweir 	{
318cdf0e10cSrcweir 		GetView().InvalidateAllWin(rRect, bPlus1Pix);
319cdf0e10cSrcweir 	}
320cdf0e10cSrcweir }
321cdf0e10cSrcweir 
322cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
323cdf0e10cSrcweir 
PrePaint()324cdf0e10cSrcweir void SdrPageView::PrePaint()
325cdf0e10cSrcweir {
326cdf0e10cSrcweir 	const sal_uInt32 nCount(PageWindowCount());
327cdf0e10cSrcweir 
328cdf0e10cSrcweir     for(sal_uInt32 a(0); a < nCount; a++)
329cdf0e10cSrcweir     {
330cdf0e10cSrcweir         SdrPageWindow* pCandidate = GetPageWindow(a);
331cdf0e10cSrcweir 
332cdf0e10cSrcweir         if(pCandidate)
333cdf0e10cSrcweir         {
334cdf0e10cSrcweir             pCandidate->PrePaint();
335cdf0e10cSrcweir         }
336cdf0e10cSrcweir     }
337cdf0e10cSrcweir }
338cdf0e10cSrcweir 
PostPaint()339cdf0e10cSrcweir void SdrPageView::PostPaint()
340cdf0e10cSrcweir {
341cdf0e10cSrcweir 	const sal_uInt32 nCount(PageWindowCount());
342cdf0e10cSrcweir 
343cdf0e10cSrcweir     for(sal_uInt32 a(0); a < nCount; a++)
344cdf0e10cSrcweir     {
345cdf0e10cSrcweir         SdrPageWindow* pCandidate = GetPageWindow(a);
346cdf0e10cSrcweir 
347cdf0e10cSrcweir         if(pCandidate)
348cdf0e10cSrcweir         {
349cdf0e10cSrcweir             pCandidate->PostPaint();
350cdf0e10cSrcweir         }
351cdf0e10cSrcweir     }
352cdf0e10cSrcweir }
353cdf0e10cSrcweir 
CompleteRedraw(SdrPaintWindow & rPaintWindow,const Region & rReg,sdr::contact::ViewObjectContactRedirector * pRedirector) const354cdf0e10cSrcweir void SdrPageView::CompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector) const
355cdf0e10cSrcweir {
356cdf0e10cSrcweir 	if(GetPage())
357cdf0e10cSrcweir 	{
358cdf0e10cSrcweir 		SdrPageWindow* pPageWindow = FindPageWindow(rPaintWindow);
359cdf0e10cSrcweir 		sal_Bool bIsTempTarget(sal_False);
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 		if(!pPageWindow)
362cdf0e10cSrcweir 		{
363cdf0e10cSrcweir 			// create temp PageWindow
364cdf0e10cSrcweir 			pPageWindow = new SdrPageWindow(*((SdrPageView*)this), rPaintWindow);
365cdf0e10cSrcweir 			bIsTempTarget = sal_True;
366cdf0e10cSrcweir 		}
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 		// do the redraw
369cdf0e10cSrcweir 		pPageWindow->PrepareRedraw(rReg);
370cdf0e10cSrcweir 		pPageWindow->RedrawAll(pRedirector);
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 		// get rid of temp PageWindow
373cdf0e10cSrcweir 		if(bIsTempTarget)
374cdf0e10cSrcweir 		{
375cdf0e10cSrcweir 			delete pPageWindow;
376cdf0e10cSrcweir 			pPageWindow = 0L;
377cdf0e10cSrcweir 		}
378cdf0e10cSrcweir 	}
379cdf0e10cSrcweir }
380cdf0e10cSrcweir 
381cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
382cdf0e10cSrcweir // #i74769# use SdrPaintWindow directly
383cdf0e10cSrcweir 
setPreparedPageWindow(SdrPageWindow * pKnownTarget)384cdf0e10cSrcweir void SdrPageView::setPreparedPageWindow(SdrPageWindow* pKnownTarget)
385cdf0e10cSrcweir {
386cdf0e10cSrcweir 	// #i72752# remember prepared SdrPageWindow
387cdf0e10cSrcweir 	mpPreparedPageWindow = pKnownTarget;
388cdf0e10cSrcweir }
389cdf0e10cSrcweir 
DrawLayer(SdrLayerID nID,OutputDevice * pGivenTarget,sdr::contact::ViewObjectContactRedirector * pRedirector) const390cdf0e10cSrcweir void SdrPageView::DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector) const
391cdf0e10cSrcweir {
392cdf0e10cSrcweir 	if(GetPage())
393cdf0e10cSrcweir 	{
394cdf0e10cSrcweir 		if(pGivenTarget)
395cdf0e10cSrcweir 		{
396cdf0e10cSrcweir 			const SdrPageWindow* pKnownTarget = FindPageWindow(*pGivenTarget);
397cdf0e10cSrcweir 
398cdf0e10cSrcweir 			if(pKnownTarget)
399cdf0e10cSrcweir 			{
400cdf0e10cSrcweir 				// paint known target
401cdf0e10cSrcweir 				pKnownTarget->RedrawLayer(&nID, pRedirector);
402cdf0e10cSrcweir 			}
403cdf0e10cSrcweir 			else
404cdf0e10cSrcweir 			{
405cdf0e10cSrcweir 				// #i72752# DrawLayer() uses a OutputDevice different from BeginDrawLayer. This happens
406cdf0e10cSrcweir 				// e.g. when SW paints a single text line in text edit mode. Try to use it
407cdf0e10cSrcweir 				SdrPageWindow* pPreparedTarget = mpPreparedPageWindow;
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 				if(pPreparedTarget)
410cdf0e10cSrcweir 				{
411cdf0e10cSrcweir 					// if we have a prepared target, do not use a new SdrPageWindow since this
412cdf0e10cSrcweir 					// works but is expensive. Just use a temporary PaintWindow
413cdf0e10cSrcweir 					SdrPaintWindow aTemporaryPaintWindow(mrView, *pGivenTarget);
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 					// Copy existing paint region to use the same as prepared in BeginDrawLayer
416cdf0e10cSrcweir 					SdrPaintWindow& rExistingPaintWindow = pPreparedTarget->GetPaintWindow();
417cdf0e10cSrcweir 					const Region& rExistingRegion = rExistingPaintWindow.GetRedrawRegion();
418cdf0e10cSrcweir 					aTemporaryPaintWindow.SetRedrawRegion(rExistingRegion);
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 					// patch the ExistingPageWindow
421cdf0e10cSrcweir 					pPreparedTarget->patchPaintWindow(aTemporaryPaintWindow);
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 					// redraw the layer
424cdf0e10cSrcweir 					pPreparedTarget->RedrawLayer(&nID, pRedirector);
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 					// restore the ExistingPageWindow
427cdf0e10cSrcweir 					pPreparedTarget->unpatchPaintWindow();
428cdf0e10cSrcweir 				}
429cdf0e10cSrcweir 				else
430cdf0e10cSrcweir 				{
431cdf0e10cSrcweir 					OSL_ENSURE(false, "SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), this should never be needed (!)");
432cdf0e10cSrcweir 
433cdf0e10cSrcweir 					// None of the known OutputDevices is the target of this paint, use
434cdf0e10cSrcweir 					// a temporary SdrPageWindow for this Redraw.
435cdf0e10cSrcweir 					SdrPaintWindow aTemporaryPaintWindow(mrView, *pGivenTarget);
436cdf0e10cSrcweir 					SdrPageWindow aTemporaryPageWindow(*((SdrPageView*)this), aTemporaryPaintWindow);
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 					// #i72752#
439cdf0e10cSrcweir 					// Copy existing paint region if other PageWindows exist, this was created by
440cdf0e10cSrcweir 					// PrepareRedraw() from BeginDrawLayer(). Needs to be used e.g. when suddenly SW
441cdf0e10cSrcweir 					// paints into an unknown device other than the view was created for (e.g. VirtualDevice)
442cdf0e10cSrcweir 					if(PageWindowCount())
443cdf0e10cSrcweir 					{
444cdf0e10cSrcweir 						SdrPageWindow* pExistingPageWindow = GetPageWindow(0L);
445cdf0e10cSrcweir 						SdrPaintWindow& rExistingPaintWindow = pExistingPageWindow->GetPaintWindow();
446cdf0e10cSrcweir 						const Region& rExistingRegion = rExistingPaintWindow.GetRedrawRegion();
447cdf0e10cSrcweir 						aTemporaryPaintWindow.SetRedrawRegion(rExistingRegion);
448cdf0e10cSrcweir 					}
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 					aTemporaryPageWindow.RedrawLayer(&nID, pRedirector);
451cdf0e10cSrcweir 				}
452cdf0e10cSrcweir 			}
453cdf0e10cSrcweir 		}
454cdf0e10cSrcweir 		else
455cdf0e10cSrcweir 		{
456cdf0e10cSrcweir 			// paint in all known windows
457cdf0e10cSrcweir 			for(sal_uInt32 a(0L); a < PageWindowCount(); a++)
458cdf0e10cSrcweir 			{
459cdf0e10cSrcweir 				SdrPageWindow* pTarget = GetPageWindow(a);
460cdf0e10cSrcweir 				pTarget->RedrawLayer(&nID, pRedirector);
461cdf0e10cSrcweir 			}
462cdf0e10cSrcweir 		}
463cdf0e10cSrcweir 	}
464cdf0e10cSrcweir }
465cdf0e10cSrcweir 
SetDesignMode(bool _bDesignMode) const466cdf0e10cSrcweir void SdrPageView::SetDesignMode( bool _bDesignMode ) const
467cdf0e10cSrcweir {
468cdf0e10cSrcweir     for ( sal_uInt32 i = 0L; i < PageWindowCount(); ++i )
469cdf0e10cSrcweir     {
470cdf0e10cSrcweir         const SdrPageWindow& rPageViewWindow = *GetPageWindow(i);
471cdf0e10cSrcweir         rPageViewWindow.SetDesignMode( _bDesignMode );
472cdf0e10cSrcweir     }
473cdf0e10cSrcweir }
474cdf0e10cSrcweir 
475cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
476cdf0e10cSrcweir 
477cdf0e10cSrcweir #ifdef OS2
478cdf0e10cSrcweir #define RGBCOLOR(r,g,b) ((sal_uIntPtr)(((sal_uInt8)(b) | ((sal_uInt16)(g)<<8)) | (((sal_uIntPtr)(sal_uInt8)(r))<<16)))
479cdf0e10cSrcweir #endif
480cdf0e10cSrcweir 
DrawPageViewGrid(OutputDevice & rOut,const Rectangle & rRect,Color aColor)481cdf0e10cSrcweir void SdrPageView::DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, Color aColor)
482cdf0e10cSrcweir {
483cdf0e10cSrcweir 	if (GetPage()==NULL)
484cdf0e10cSrcweir 		return;
485cdf0e10cSrcweir 
486cdf0e10cSrcweir 	long nx1=GetView().aGridBig.Width();
487cdf0e10cSrcweir 	long nx2=GetView().aGridFin.Width();
488cdf0e10cSrcweir 	long ny1=GetView().aGridBig.Height();
489cdf0e10cSrcweir 	long ny2=GetView().aGridFin.Height();
490cdf0e10cSrcweir 
491cdf0e10cSrcweir 	if (nx1==0) nx1=nx2;
492cdf0e10cSrcweir 	if (nx2==0) nx2=nx1;
493cdf0e10cSrcweir 	if (ny1==0) ny1=ny2;
494cdf0e10cSrcweir 	if (ny2==0) ny2=ny1;
495cdf0e10cSrcweir 	if (nx1==0) { nx1=ny1; nx2=ny2; }
496cdf0e10cSrcweir 	if (ny1==0) { ny1=nx1; ny2=nx2; }
497cdf0e10cSrcweir 	if (nx1<0) nx1=-nx1;
498cdf0e10cSrcweir 	if (nx2<0) nx2=-nx2;
499cdf0e10cSrcweir 	if (ny1<0) ny1=-ny1;
500cdf0e10cSrcweir 	if (ny2<0) ny2=-ny2;
501cdf0e10cSrcweir 
502cdf0e10cSrcweir 	if (nx1!=0)
503cdf0e10cSrcweir 	{
504cdf0e10cSrcweir 		// no more global output size, use window size instead to decide grid sizes
505cdf0e10cSrcweir 		long nScreenWdt = rOut.GetOutputSizePixel().Width();
506cdf0e10cSrcweir 		// old: long nScreenWdt=System::GetDesktopRectPixel().GetWidth();
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 		// Grid bei kleinen Zoomstufen etwas erweitern
509cdf0e10cSrcweir 		//Size a1PixSiz(rOut.PixelToLogic(Size(1,1)));
510cdf0e10cSrcweir 		long nMinDotPix=2;
511cdf0e10cSrcweir 		long nMinLinPix=4;
512cdf0e10cSrcweir 
513cdf0e10cSrcweir 		if (nScreenWdt>=1600)
514cdf0e10cSrcweir 		{
515cdf0e10cSrcweir 			nMinDotPix=4;
516cdf0e10cSrcweir 			nMinLinPix=8;
517cdf0e10cSrcweir 		}
518cdf0e10cSrcweir 		else if (nScreenWdt>=1024)
519cdf0e10cSrcweir 		{
520cdf0e10cSrcweir 			nMinDotPix=3;
521cdf0e10cSrcweir 			nMinLinPix=6;
522cdf0e10cSrcweir 		}
523cdf0e10cSrcweir 		else
524cdf0e10cSrcweir 		{ // z.B. 640x480
525cdf0e10cSrcweir 			nMinDotPix=2;
526cdf0e10cSrcweir 			nMinLinPix=4;
527cdf0e10cSrcweir 		}
528cdf0e10cSrcweir 		Size aMinDotDist(rOut.PixelToLogic(Size(nMinDotPix,nMinDotPix)));
529cdf0e10cSrcweir 		//Size a3PixSiz(rOut.PixelToLogic(Size(2,2)));
530cdf0e10cSrcweir 		Size aMinLinDist(rOut.PixelToLogic(Size(nMinLinPix,nMinLinPix)));
531cdf0e10cSrcweir 		FASTBOOL bHoriSolid=nx2<aMinDotDist.Width();
532cdf0e10cSrcweir 		FASTBOOL bVertSolid=ny2<aMinDotDist.Height();
533cdf0e10cSrcweir 		// Linienabstand vergroessern (mind. 4 Pixel)
534cdf0e10cSrcweir 		// Vergroesserung: *2 *5 *10 *20 *50 *100 ...
535cdf0e10cSrcweir 		int nTgl=0;
536cdf0e10cSrcweir 		long nVal0=nx1;
537cdf0e10cSrcweir 		while (nx1<aMinLinDist.Width())
538cdf0e10cSrcweir 		{
539cdf0e10cSrcweir 			long a=nx1;
540cdf0e10cSrcweir 
541cdf0e10cSrcweir 			if (nTgl==0) nx1*=2;
542cdf0e10cSrcweir 			if (nTgl==1) nx1=nVal0*5; // => nx1*=2.5
543cdf0e10cSrcweir 			if (nTgl==2) nx1*=2;
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 			nVal0=a;
546cdf0e10cSrcweir 			nTgl++; if (nTgl>=3) nTgl=0;
547cdf0e10cSrcweir 		}
548cdf0e10cSrcweir 		nTgl=0;
549cdf0e10cSrcweir 		nVal0=ny1;
550cdf0e10cSrcweir 		while (ny1<aMinLinDist.Height())
551cdf0e10cSrcweir 		{
552cdf0e10cSrcweir 			long a=ny1;
553cdf0e10cSrcweir 
554cdf0e10cSrcweir 			if (nTgl==0) ny1*=2;
555cdf0e10cSrcweir 			if (nTgl==1) ny1=nVal0*5; // => ny1*=2.5
556cdf0e10cSrcweir 			if (nTgl==2) ny1*=2;
557cdf0e10cSrcweir 
558cdf0e10cSrcweir 			nVal0=a;
559cdf0e10cSrcweir 			nTgl++;
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 			if (nTgl>=3) nTgl=0;
562cdf0e10cSrcweir 		}
563cdf0e10cSrcweir 		// Keine Zwischenpunkte, wenn...
564cdf0e10cSrcweir 		//if (nx2<a2PixSiz.Width()) nx2=nx1;
565cdf0e10cSrcweir 		//if (ny2<a2PixSiz.Height()) ny2=ny1;
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 		FASTBOOL bHoriFine=nx2<nx1;
568cdf0e10cSrcweir 		FASTBOOL bVertFine=ny2<ny1;
569cdf0e10cSrcweir 		FASTBOOL bHoriLines=bHoriSolid || bHoriFine || !bVertFine;
570cdf0e10cSrcweir 		FASTBOOL bVertLines=bVertSolid || bVertFine;
571cdf0e10cSrcweir 
572cdf0e10cSrcweir 		Color aColorMerk( rOut.GetLineColor() );
573cdf0e10cSrcweir 		rOut.SetLineColor( aColor );
574cdf0e10cSrcweir 
575cdf0e10cSrcweir 		bool bMap0=rOut.IsMapModeEnabled();
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 		long nWrX=0;//aWriterPageOffset.X();
578cdf0e10cSrcweir 		long nWrY=0;//aWriterPageOffset.Y();
579cdf0e10cSrcweir 		Point aOrg(aPgOrg);
580cdf0e10cSrcweir 		long x1=GetPage()->GetLftBorder()+1+nWrX;
581cdf0e10cSrcweir 		long x2=GetPage()->GetWdt()-GetPage()->GetRgtBorder()-1+nWrY;
582cdf0e10cSrcweir 		long y1=GetPage()->GetUppBorder()+1+nWrX;
583cdf0e10cSrcweir 		long y2=GetPage()->GetHgt()-GetPage()->GetLwrBorder()-1+nWrY;
584cdf0e10cSrcweir 		const SdrPageGridFrameList* pFrames=GetPage()->GetGridFrameList(this,NULL);
585cdf0e10cSrcweir 		//sal_uInt16 nBufSiz=1024; // 4k Buffer = max. 512 Punkte
586cdf0e10cSrcweir 		// #90353# long* pBuf = NULL;
587cdf0e10cSrcweir 		sal_uInt16 nGridPaintAnz=1;
588cdf0e10cSrcweir 		if (pFrames!=NULL) nGridPaintAnz=pFrames->GetCount();
589cdf0e10cSrcweir 		for (sal_uInt16 nGridPaintNum=0; nGridPaintNum<nGridPaintAnz; nGridPaintNum++) {
590cdf0e10cSrcweir 			if (pFrames!=NULL) {
591cdf0e10cSrcweir 				const SdrPageGridFrame& rGF=(*pFrames)[nGridPaintNum];
592cdf0e10cSrcweir 				nWrX=rGF.GetPaperRect().Left();
593cdf0e10cSrcweir 				nWrY=rGF.GetPaperRect().Top();
594cdf0e10cSrcweir 				x1=rGF.GetUserArea().Left();
595cdf0e10cSrcweir 				x2=rGF.GetUserArea().Right();
596cdf0e10cSrcweir 				y1=rGF.GetUserArea().Top();
597cdf0e10cSrcweir 				y2=rGF.GetUserArea().Bottom();
598cdf0e10cSrcweir 				aOrg=rGF.GetUserArea().TopLeft();
599cdf0e10cSrcweir 				aOrg-=rGF.GetPaperRect().TopLeft();
600cdf0e10cSrcweir 			}
601cdf0e10cSrcweir 			if (!rRect.IsEmpty()) {
602cdf0e10cSrcweir 				Size a1PixSiz(rOut.PixelToLogic(Size(1,1)));
603cdf0e10cSrcweir 				long nX1Pix=a1PixSiz.Width();  // 1 Pixel Toleranz drauf
604cdf0e10cSrcweir 				long nY1Pix=a1PixSiz.Height();
605cdf0e10cSrcweir 				if (x1<rRect.Left()  -nX1Pix) x1=rRect.Left()  -nX1Pix;
606cdf0e10cSrcweir 				if (x2>rRect.Right() +nX1Pix) x2=rRect.Right() +nX1Pix;
607cdf0e10cSrcweir 				if (y1<rRect.Top()	 -nY1Pix) y1=rRect.Top()   -nY1Pix;
608cdf0e10cSrcweir 				if (y2>rRect.Bottom()+nY1Pix) y2=rRect.Bottom()+nY1Pix;
609cdf0e10cSrcweir 			}
610cdf0e10cSrcweir 			Point aPnt;
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 			long xBigOrg=aOrg.X()+nWrX;
613cdf0e10cSrcweir 			while (xBigOrg>=x1) xBigOrg-=nx1;
614cdf0e10cSrcweir 			while (xBigOrg<x1) xBigOrg+=nx1;
615cdf0e10cSrcweir 			long xFinOrg=xBigOrg;
616cdf0e10cSrcweir 			while (xFinOrg>=x1) xFinOrg-=nx2;
617cdf0e10cSrcweir 			while (xFinOrg<x1) xFinOrg+=nx2;
618cdf0e10cSrcweir 
619cdf0e10cSrcweir 			long yBigOrg=aOrg.Y()+nWrY;
620cdf0e10cSrcweir 			while (yBigOrg>=y1) yBigOrg-=ny1;
621cdf0e10cSrcweir 			while (yBigOrg<y1) yBigOrg+=ny1;
622cdf0e10cSrcweir 			long yFinOrg=yBigOrg;
623cdf0e10cSrcweir 			while (yFinOrg>=y1) yFinOrg-=ny2;
624cdf0e10cSrcweir 			while (yFinOrg<y1) yFinOrg+=ny2;
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 			if( x1 <= x2 && y1 <= y2 )
627cdf0e10cSrcweir 			{
628cdf0e10cSrcweir 				if( bHoriLines )
629cdf0e10cSrcweir 				{
630cdf0e10cSrcweir 					sal_uIntPtr nGridFlags = ( bHoriSolid ? GRID_HORZLINES : GRID_DOTS );
631cdf0e10cSrcweir 					sal_uInt16 nSteps = sal_uInt16(nx1 / nx2);
632cdf0e10cSrcweir 					sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((nx1 * 1000L)/ nSteps) - (nx2 * 1000L) ) : 0;
633cdf0e10cSrcweir 					sal_uInt32 nStepOffset = 0;
634cdf0e10cSrcweir 					sal_uInt16 nPointOffset = 0;
635cdf0e10cSrcweir 
636cdf0e10cSrcweir 					for(sal_uInt16 a=0;a<nSteps;a++)
637cdf0e10cSrcweir 					{
638cdf0e10cSrcweir 						// Zeichnen
639cdf0e10cSrcweir 						rOut.DrawGrid(
640cdf0e10cSrcweir 							Rectangle( xFinOrg + (a * nx2) + nPointOffset, yBigOrg, x2, y2 ),
641cdf0e10cSrcweir 							Size( nx1, ny1 ), nGridFlags );
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 						// Schritt machen
644cdf0e10cSrcweir 						nStepOffset += nRestPerStepMul1000;
645cdf0e10cSrcweir 						while(nStepOffset >= 1000)
646cdf0e10cSrcweir 						{
647cdf0e10cSrcweir 							nStepOffset -= 1000;
648cdf0e10cSrcweir 							nPointOffset++;
649cdf0e10cSrcweir 						}
650cdf0e10cSrcweir 					}
651cdf0e10cSrcweir 				}
652cdf0e10cSrcweir 
653cdf0e10cSrcweir 				if( bVertLines )
654cdf0e10cSrcweir 				{
655cdf0e10cSrcweir 					sal_uIntPtr nGridFlags = ( bVertSolid ? GRID_VERTLINES : GRID_DOTS );
656cdf0e10cSrcweir 					sal_uInt16 nSteps = sal_uInt16(ny1 / ny2);
657cdf0e10cSrcweir 					sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((ny1 * 1000L)/ nSteps) - (ny2 * 1000L) ) : 0;
658cdf0e10cSrcweir 					sal_uInt32 nStepOffset = 0;
659cdf0e10cSrcweir 					sal_uInt16 nPointOffset = 0;
660cdf0e10cSrcweir 
661cdf0e10cSrcweir 					for(sal_uInt16 a=0;a<nSteps;a++)
662cdf0e10cSrcweir 					{
663cdf0e10cSrcweir 						// Zeichnen
664cdf0e10cSrcweir 						rOut.DrawGrid(
665cdf0e10cSrcweir 							Rectangle( xBigOrg, yFinOrg + (a * ny2) + nPointOffset, x2, y2 ),
666cdf0e10cSrcweir 							Size( nx1, ny1 ), nGridFlags );
667cdf0e10cSrcweir 
668cdf0e10cSrcweir 						// Schritt machen
669cdf0e10cSrcweir 						nStepOffset += nRestPerStepMul1000;
670cdf0e10cSrcweir 						while(nStepOffset >= 1000)
671cdf0e10cSrcweir 						{
672cdf0e10cSrcweir 							nStepOffset -= 1000;
673cdf0e10cSrcweir 							nPointOffset++;
674cdf0e10cSrcweir 						}
675cdf0e10cSrcweir 					}
676cdf0e10cSrcweir 
677cdf0e10cSrcweir 					// rOut.DrawGrid( Rectangle( xo + xBigOrg, yo + yFinOrg, x2, y2 ), Size( nx1, ny2 ), nGridFlags );
678cdf0e10cSrcweir 				}
679cdf0e10cSrcweir 			}
680cdf0e10cSrcweir 		}
681cdf0e10cSrcweir 
682cdf0e10cSrcweir 		rOut.EnableMapMode(bMap0);
683cdf0e10cSrcweir 		rOut.SetLineColor(aColorMerk);
684cdf0e10cSrcweir 	}
685cdf0e10cSrcweir }
686cdf0e10cSrcweir 
AdjHdl()687cdf0e10cSrcweir void SdrPageView::AdjHdl()
688cdf0e10cSrcweir {
689cdf0e10cSrcweir 	GetView().AdjustMarkHdl();
690cdf0e10cSrcweir }
691cdf0e10cSrcweir 
SetLayer(const XubString & rName,SetOfByte & rBS,sal_Bool bJa)692cdf0e10cSrcweir void SdrPageView::SetLayer(const XubString& rName, SetOfByte& rBS, sal_Bool bJa)
693cdf0e10cSrcweir {
694cdf0e10cSrcweir 	if(!GetPage())
695cdf0e10cSrcweir 		return;
696cdf0e10cSrcweir 
697cdf0e10cSrcweir 	SdrLayerID nID = GetPage()->GetLayerAdmin().GetLayerID(rName, sal_True);
698cdf0e10cSrcweir 
699cdf0e10cSrcweir 	if(SDRLAYER_NOTFOUND != nID)
700cdf0e10cSrcweir 		rBS.Set(nID, bJa);
701cdf0e10cSrcweir }
702cdf0e10cSrcweir 
IsLayer(const XubString & rName,const SetOfByte & rBS) const703cdf0e10cSrcweir sal_Bool SdrPageView::IsLayer(const XubString& rName, const SetOfByte& rBS) const
704cdf0e10cSrcweir {
705cdf0e10cSrcweir 	if(!GetPage())
706cdf0e10cSrcweir 		return sal_False;
707cdf0e10cSrcweir 
708cdf0e10cSrcweir 	sal_Bool bRet(sal_False);
709cdf0e10cSrcweir 
710cdf0e10cSrcweir 	if(rName.Len())
711cdf0e10cSrcweir 	{
712cdf0e10cSrcweir 		SdrLayerID nId = GetPage()->GetLayerAdmin().GetLayerID(rName, sal_True);
713cdf0e10cSrcweir 
714cdf0e10cSrcweir 		if(SDRLAYER_NOTFOUND != nId)
715cdf0e10cSrcweir 		{
716cdf0e10cSrcweir 			bRet = rBS.IsSet(nId);
717cdf0e10cSrcweir 		}
718cdf0e10cSrcweir 	}
719cdf0e10cSrcweir 
720cdf0e10cSrcweir 	return bRet;
721cdf0e10cSrcweir }
722cdf0e10cSrcweir 
SetAllLayers(SetOfByte & rB,sal_Bool bJa)723cdf0e10cSrcweir void SdrPageView::SetAllLayers(SetOfByte& rB, sal_Bool bJa)
724cdf0e10cSrcweir {
725cdf0e10cSrcweir 	if(bJa)
726cdf0e10cSrcweir 	{
727cdf0e10cSrcweir 		rB.SetAll();
728cdf0e10cSrcweir 		rB.Clear(SDRLAYER_NOTFOUND);
729cdf0e10cSrcweir 	}
730cdf0e10cSrcweir 	else
731cdf0e10cSrcweir 	{
732cdf0e10cSrcweir 		rB.ClearAll();
733cdf0e10cSrcweir 	}
734cdf0e10cSrcweir }
735cdf0e10cSrcweir 
IsObjMarkable(SdrObject * pObj) const736cdf0e10cSrcweir sal_Bool SdrPageView::IsObjMarkable(SdrObject* pObj) const
737cdf0e10cSrcweir {
738cdf0e10cSrcweir 	if(pObj)
739cdf0e10cSrcweir 	{
740cdf0e10cSrcweir 		// Vom Markieren ausgeschlossen?
741cdf0e10cSrcweir 		if(pObj->IsMarkProtect())
742cdf0e10cSrcweir 		{
743cdf0e10cSrcweir 			return sal_False;
744cdf0e10cSrcweir 		}
745cdf0e10cSrcweir 
746cdf0e10cSrcweir 		// only visible are markable
747cdf0e10cSrcweir 		if( !pObj->IsVisible() )
748cdf0e10cSrcweir 		{
749cdf0e10cSrcweir 			return sal_False;
750cdf0e10cSrcweir 		}
751cdf0e10cSrcweir 
752cdf0e10cSrcweir 		// #112440#
753cdf0e10cSrcweir 		if(pObj->ISA(SdrObjGroup))
754cdf0e10cSrcweir 		{
755cdf0e10cSrcweir 			// If object is a Group object, visibility depends evtl. on
756cdf0e10cSrcweir 			// multiple layers. If one object is markable, Group is markable.
757cdf0e10cSrcweir 			SdrObjList* pObjList = ((SdrObjGroup*)pObj)->GetSubList();
758cdf0e10cSrcweir 
759cdf0e10cSrcweir 			if(pObjList && pObjList->GetObjCount())
760cdf0e10cSrcweir 			{
761cdf0e10cSrcweir 				sal_Bool bGroupIsMarkable(sal_False);
762cdf0e10cSrcweir 
763cdf0e10cSrcweir 				for(sal_uInt32 a(0L); !bGroupIsMarkable && a < pObjList->GetObjCount(); a++)
764cdf0e10cSrcweir 				{
765cdf0e10cSrcweir 					SdrObject* pCandidate = pObjList->GetObj(a);
766cdf0e10cSrcweir 
767cdf0e10cSrcweir 					// call recursively
768cdf0e10cSrcweir 					if(IsObjMarkable(pCandidate))
769cdf0e10cSrcweir 					{
770cdf0e10cSrcweir 						bGroupIsMarkable = sal_True;
771cdf0e10cSrcweir 					}
772cdf0e10cSrcweir 				}
773cdf0e10cSrcweir 
774cdf0e10cSrcweir 				return bGroupIsMarkable;
775cdf0e10cSrcweir 			}
776cdf0e10cSrcweir 			else
777cdf0e10cSrcweir 			{
778cdf0e10cSrcweir 				// #i43302#
779cdf0e10cSrcweir 				// Allow empty groups to be selected to be able to delete them
780cdf0e10cSrcweir 				return sal_True;
781cdf0e10cSrcweir 			}
782cdf0e10cSrcweir 		}
783cdf0e10cSrcweir 		else
784cdf0e10cSrcweir 		{
785cdf0e10cSrcweir 			// Der Layer muss sichtbar und darf nicht gesperrt sein
786cdf0e10cSrcweir 			SdrLayerID nL = pObj->GetLayer();
787cdf0e10cSrcweir 			return (aLayerVisi.IsSet(sal_uInt8(nL)) && !aLayerLock.IsSet(sal_uInt8(nL)));
788cdf0e10cSrcweir 		}
789cdf0e10cSrcweir 	}
790cdf0e10cSrcweir 
791cdf0e10cSrcweir 	return sal_False;
792cdf0e10cSrcweir }
793cdf0e10cSrcweir 
SetPageOrigin(const Point & rOrg)794cdf0e10cSrcweir void SdrPageView::SetPageOrigin(const Point& rOrg)
795cdf0e10cSrcweir {
796cdf0e10cSrcweir 	if (rOrg!=aPgOrg) {
797cdf0e10cSrcweir 		aPgOrg=rOrg;
798cdf0e10cSrcweir 		if (GetView().IsGridVisible()) {
799cdf0e10cSrcweir 			InvalidateAllWin();
800cdf0e10cSrcweir 		}
801cdf0e10cSrcweir 	}
802cdf0e10cSrcweir }
803cdf0e10cSrcweir 
ImpInvalidateHelpLineArea(sal_uInt16 nNum) const804cdf0e10cSrcweir void SdrPageView::ImpInvalidateHelpLineArea(sal_uInt16 nNum) const
805cdf0e10cSrcweir {
806cdf0e10cSrcweir 	if (GetView().IsHlplVisible() && nNum<aHelpLines.GetCount()) {
807cdf0e10cSrcweir 		const SdrHelpLine& rHL=aHelpLines[nNum];
808cdf0e10cSrcweir 
809cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < GetView().PaintWindowCount(); a++)
810cdf0e10cSrcweir 		{
811cdf0e10cSrcweir 			SdrPaintWindow* pCandidate = GetView().GetPaintWindow(a);
812cdf0e10cSrcweir 
813cdf0e10cSrcweir 			if(pCandidate->OutputToWindow())
814cdf0e10cSrcweir 			{
815cdf0e10cSrcweir 				OutputDevice& rOutDev = pCandidate->GetOutputDevice();
816cdf0e10cSrcweir 				Rectangle aR(rHL.GetBoundRect(rOutDev));
817cdf0e10cSrcweir 				Size aSiz(rOutDev.PixelToLogic(Size(1,1)));
818cdf0e10cSrcweir 				aR.Left() -= aSiz.Width();
819cdf0e10cSrcweir 				aR.Right() += aSiz.Width();
820cdf0e10cSrcweir 				aR.Top() -= aSiz.Height();
821cdf0e10cSrcweir 				aR.Bottom() += aSiz.Height();
822cdf0e10cSrcweir 				((SdrView&)GetView()).InvalidateOneWin((Window&)rOutDev, aR);
823cdf0e10cSrcweir 			}
824cdf0e10cSrcweir 		}
825cdf0e10cSrcweir 	}
826cdf0e10cSrcweir }
827cdf0e10cSrcweir 
SetHelpLines(const SdrHelpLineList & rHLL)828cdf0e10cSrcweir void SdrPageView::SetHelpLines(const SdrHelpLineList& rHLL)
829cdf0e10cSrcweir {
830cdf0e10cSrcweir 	aHelpLines=rHLL;
831cdf0e10cSrcweir 	InvalidateAllWin();
832cdf0e10cSrcweir }
833cdf0e10cSrcweir 
SetHelpLine(sal_uInt16 nNum,const SdrHelpLine & rNewHelpLine)834cdf0e10cSrcweir void SdrPageView::SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine)
835cdf0e10cSrcweir {
836cdf0e10cSrcweir 	if (nNum<aHelpLines.GetCount() && aHelpLines[nNum]!=rNewHelpLine) {
837cdf0e10cSrcweir 		FASTBOOL bNeedRedraw=sal_True;
838cdf0e10cSrcweir 		if (aHelpLines[nNum].GetKind()==rNewHelpLine.GetKind()) {
839cdf0e10cSrcweir 			switch (rNewHelpLine.GetKind()) {
840cdf0e10cSrcweir 				case SDRHELPLINE_VERTICAL  : if (aHelpLines[nNum].GetPos().X()==rNewHelpLine.GetPos().X()) bNeedRedraw=sal_False; break;
841cdf0e10cSrcweir 				case SDRHELPLINE_HORIZONTAL: if (aHelpLines[nNum].GetPos().Y()==rNewHelpLine.GetPos().Y()) bNeedRedraw=sal_False; break;
842cdf0e10cSrcweir 				default: break;
843cdf0e10cSrcweir 			} // switch
844cdf0e10cSrcweir 		}
845cdf0e10cSrcweir 		if (bNeedRedraw) ImpInvalidateHelpLineArea(nNum);
846cdf0e10cSrcweir 		aHelpLines[nNum]=rNewHelpLine;
847cdf0e10cSrcweir 		if (bNeedRedraw) ImpInvalidateHelpLineArea(nNum);
848cdf0e10cSrcweir 	}
849cdf0e10cSrcweir }
850cdf0e10cSrcweir 
DeleteHelpLine(sal_uInt16 nNum)851cdf0e10cSrcweir void SdrPageView::DeleteHelpLine(sal_uInt16 nNum)
852cdf0e10cSrcweir {
853cdf0e10cSrcweir 	if (nNum<aHelpLines.GetCount()) {
854cdf0e10cSrcweir 		ImpInvalidateHelpLineArea(nNum);
855cdf0e10cSrcweir 		aHelpLines.Delete(nNum);
856cdf0e10cSrcweir 	}
857cdf0e10cSrcweir }
858cdf0e10cSrcweir 
InsertHelpLine(const SdrHelpLine & rHL,sal_uInt16 nNum)859cdf0e10cSrcweir void SdrPageView::InsertHelpLine(const SdrHelpLine& rHL, sal_uInt16 nNum)
860cdf0e10cSrcweir {
861cdf0e10cSrcweir 	if (nNum>aHelpLines.GetCount()) nNum=aHelpLines.GetCount();
862cdf0e10cSrcweir 	aHelpLines.Insert(rHL,nNum);
863cdf0e10cSrcweir 	if (GetView().IsHlplVisible()) {
864cdf0e10cSrcweir 		if (GetView().IsHlplFront()) {
865cdf0e10cSrcweir 			// Hier optimieren ...
866cdf0e10cSrcweir 			ImpInvalidateHelpLineArea(nNum);
867cdf0e10cSrcweir 		 } else {
868cdf0e10cSrcweir 			ImpInvalidateHelpLineArea(nNum);
869cdf0e10cSrcweir 		}
870cdf0e10cSrcweir 	}
871cdf0e10cSrcweir }
872cdf0e10cSrcweir 
873cdf0e10cSrcweir // Betretene Gruppe und Liste setzen
SetAktGroupAndList(SdrObject * pNewGroup,SdrObjList * pNewList)874cdf0e10cSrcweir void SdrPageView::SetAktGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList)
875cdf0e10cSrcweir {
876cdf0e10cSrcweir 	if(pAktGroup != pNewGroup)
877cdf0e10cSrcweir 	{
878cdf0e10cSrcweir 		pAktGroup = pNewGroup;
879cdf0e10cSrcweir 	}
880cdf0e10cSrcweir 	if(pAktList != pNewList)
881cdf0e10cSrcweir 	{
882cdf0e10cSrcweir 		pAktList = pNewList;
883cdf0e10cSrcweir 	}
884cdf0e10cSrcweir }
885cdf0e10cSrcweir 
EnterGroup(SdrObject * pObj)886cdf0e10cSrcweir sal_Bool SdrPageView::EnterGroup(SdrObject* pObj)
887cdf0e10cSrcweir {
888cdf0e10cSrcweir 	sal_Bool bRet(sal_False);
889cdf0e10cSrcweir 
890cdf0e10cSrcweir 	if(pObj && pObj->IsGroupObject())
891cdf0e10cSrcweir 	{
892cdf0e10cSrcweir 		sal_Bool bGlueInvalidate(GetView().ImpIsGlueVisible());
893cdf0e10cSrcweir 
894cdf0e10cSrcweir 		if(bGlueInvalidate)
895cdf0e10cSrcweir 		{
896cdf0e10cSrcweir 			GetView().GlueInvalidate();
897cdf0e10cSrcweir 		}
898cdf0e10cSrcweir 
899cdf0e10cSrcweir 		// deselect all
900cdf0e10cSrcweir 		GetView().UnmarkAll();
901cdf0e10cSrcweir 
902cdf0e10cSrcweir 		// set current group and list
903cdf0e10cSrcweir 		SdrObjList* pNewObjList = pObj->GetSubList();
904cdf0e10cSrcweir 		SetAktGroupAndList(pObj, pNewObjList);
905cdf0e10cSrcweir 
906cdf0e10cSrcweir 		// select contained object if only one object is contained,
907cdf0e10cSrcweir 		// else select nothing and let the user decide what to do next
908cdf0e10cSrcweir 		if(pNewObjList && pNewObjList->GetObjCount() == 1)
909cdf0e10cSrcweir 		{
910cdf0e10cSrcweir 			SdrObject* pFirstObject = pNewObjList->GetObj(0L);
911cdf0e10cSrcweir 
912cdf0e10cSrcweir 			if(GetView().GetSdrPageView())
913cdf0e10cSrcweir 			{
914cdf0e10cSrcweir 				GetView().MarkObj(pFirstObject, GetView().GetSdrPageView());
915cdf0e10cSrcweir 			}
916cdf0e10cSrcweir 		}
917cdf0e10cSrcweir 
918cdf0e10cSrcweir 		// build new handles
919cdf0e10cSrcweir 		GetView().AdjustMarkHdl();
920cdf0e10cSrcweir 
921cdf0e10cSrcweir 		// invalidate only when view wants to visualize group entering
922cdf0e10cSrcweir 		if(GetView().DoVisualizeEnteredGroup())
923cdf0e10cSrcweir 		{
924cdf0e10cSrcweir 			InvalidateAllWin();
925cdf0e10cSrcweir 		}
926cdf0e10cSrcweir 
927cdf0e10cSrcweir 		if (bGlueInvalidate)
928cdf0e10cSrcweir 		{
929cdf0e10cSrcweir 			GetView().GlueInvalidate();
930cdf0e10cSrcweir 		}
931cdf0e10cSrcweir 
932cdf0e10cSrcweir 		bRet = sal_True;
933cdf0e10cSrcweir 	}
934cdf0e10cSrcweir 
935cdf0e10cSrcweir 	return bRet;
936cdf0e10cSrcweir }
937cdf0e10cSrcweir 
LeaveOneGroup()938cdf0e10cSrcweir void SdrPageView::LeaveOneGroup()
939cdf0e10cSrcweir {
940cdf0e10cSrcweir 	if(GetAktGroup())
941cdf0e10cSrcweir 	{
942cdf0e10cSrcweir 		sal_Bool bGlueInvalidate = (GetView().ImpIsGlueVisible());
943cdf0e10cSrcweir 
944cdf0e10cSrcweir 		if(bGlueInvalidate)
945cdf0e10cSrcweir 			GetView().GlueInvalidate();
946cdf0e10cSrcweir 
947cdf0e10cSrcweir 		SdrObject* pLastGroup = GetAktGroup();
948cdf0e10cSrcweir 		SdrObject* pParentGroup = GetAktGroup()->GetUpGroup();
949cdf0e10cSrcweir 		SdrObjList* pParentList = GetPage();
950cdf0e10cSrcweir 
951cdf0e10cSrcweir 		if(pParentGroup)
952cdf0e10cSrcweir 			pParentList = pParentGroup->GetSubList();
953cdf0e10cSrcweir 
954cdf0e10cSrcweir 		// Alles deselektieren
955cdf0e10cSrcweir 		GetView().UnmarkAll();
956cdf0e10cSrcweir 
957cdf0e10cSrcweir 		// Zuweisungen, pAktGroup und pAktList muessen gesetzt sein
958cdf0e10cSrcweir 		SetAktGroupAndList(pParentGroup, pParentList);
959cdf0e10cSrcweir 
960cdf0e10cSrcweir 		// gerade verlassene Gruppe selektieren
961cdf0e10cSrcweir 		if(pLastGroup)
962cdf0e10cSrcweir 			if(GetView().GetSdrPageView())
963cdf0e10cSrcweir 				GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
964cdf0e10cSrcweir 
965cdf0e10cSrcweir 		GetView().AdjustMarkHdl();
966cdf0e10cSrcweir 
967cdf0e10cSrcweir 		// invalidate only when view wants to visualize group entering
968cdf0e10cSrcweir 		if(GetView().DoVisualizeEnteredGroup())
969cdf0e10cSrcweir 			InvalidateAllWin();
970cdf0e10cSrcweir 
971cdf0e10cSrcweir 		if(bGlueInvalidate)
972cdf0e10cSrcweir 			GetView().GlueInvalidate();
973cdf0e10cSrcweir 	}
974cdf0e10cSrcweir }
975cdf0e10cSrcweir 
LeaveAllGroup()976cdf0e10cSrcweir void SdrPageView::LeaveAllGroup()
977cdf0e10cSrcweir {
978cdf0e10cSrcweir 	if(GetAktGroup())
979cdf0e10cSrcweir 	{
980cdf0e10cSrcweir 		sal_Bool bGlueInvalidate = (GetView().ImpIsGlueVisible());
981cdf0e10cSrcweir 
982cdf0e10cSrcweir 		if(bGlueInvalidate)
983cdf0e10cSrcweir 			GetView().GlueInvalidate();
984cdf0e10cSrcweir 
985cdf0e10cSrcweir 		SdrObject* pLastGroup = GetAktGroup();
986cdf0e10cSrcweir 
987cdf0e10cSrcweir 		// Alles deselektieren
988cdf0e10cSrcweir 		GetView().UnmarkAll();
989cdf0e10cSrcweir 
990cdf0e10cSrcweir 		// Zuweisungen, pAktGroup und pAktList muessen gesetzt sein
991cdf0e10cSrcweir 		SetAktGroupAndList(NULL, GetPage());
992cdf0e10cSrcweir 
993cdf0e10cSrcweir 		// Oberste letzte Gruppe finden und selektieren
994cdf0e10cSrcweir 		if(pLastGroup)
995cdf0e10cSrcweir 		{
996cdf0e10cSrcweir 			while(pLastGroup->GetUpGroup())
997cdf0e10cSrcweir 				pLastGroup = pLastGroup->GetUpGroup();
998cdf0e10cSrcweir 
999cdf0e10cSrcweir 			if(GetView().GetSdrPageView())
1000cdf0e10cSrcweir 				GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
1001cdf0e10cSrcweir 		}
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir 		GetView().AdjustMarkHdl();
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir 		// invalidate only when view wants to visualize group entering
1006cdf0e10cSrcweir 		if(GetView().DoVisualizeEnteredGroup())
1007cdf0e10cSrcweir 			InvalidateAllWin();
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir 		if(bGlueInvalidate)
1010cdf0e10cSrcweir 			GetView().GlueInvalidate();
1011cdf0e10cSrcweir 	}
1012cdf0e10cSrcweir }
1013cdf0e10cSrcweir 
GetEnteredLevel() const1014cdf0e10cSrcweir sal_uInt16 SdrPageView::GetEnteredLevel() const
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir 	sal_uInt16 nAnz=0;
1017cdf0e10cSrcweir 	SdrObject* pGrp=GetAktGroup();
1018cdf0e10cSrcweir 	while (pGrp!=NULL) {
1019cdf0e10cSrcweir 		nAnz++;
1020cdf0e10cSrcweir 		pGrp=pGrp->GetUpGroup();
1021cdf0e10cSrcweir 	}
1022cdf0e10cSrcweir 	return nAnz;
1023cdf0e10cSrcweir }
1024cdf0e10cSrcweir 
GetActualGroupName() const1025cdf0e10cSrcweir XubString SdrPageView::GetActualGroupName() const
1026cdf0e10cSrcweir {
1027cdf0e10cSrcweir 	if(GetAktGroup())
1028cdf0e10cSrcweir 	{
1029cdf0e10cSrcweir 		XubString aStr(GetAktGroup()->GetName());
1030cdf0e10cSrcweir 
1031cdf0e10cSrcweir 		if(!aStr.Len())
1032cdf0e10cSrcweir 			aStr += sal_Unicode('?');
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir 		return aStr;
1035cdf0e10cSrcweir 	}
1036cdf0e10cSrcweir 	else
1037cdf0e10cSrcweir 		return String();
1038cdf0e10cSrcweir }
1039cdf0e10cSrcweir 
GetActualPathName(sal_Unicode cSep) const1040cdf0e10cSrcweir XubString SdrPageView::GetActualPathName(sal_Unicode cSep) const
1041cdf0e10cSrcweir {
1042cdf0e10cSrcweir 	XubString aStr;
1043cdf0e10cSrcweir 	sal_Bool bNamFnd(sal_False);
1044cdf0e10cSrcweir 	SdrObject* pGrp = GetAktGroup();
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir 	while(pGrp)
1047cdf0e10cSrcweir 	{
1048cdf0e10cSrcweir 		XubString aStr1(pGrp->GetName());
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 		if(!aStr1.Len())
1051cdf0e10cSrcweir 			aStr1 += sal_Unicode('?');
1052cdf0e10cSrcweir 		else
1053cdf0e10cSrcweir 			bNamFnd = sal_True;
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir 		aStr += aStr1;
1056cdf0e10cSrcweir 		pGrp = pGrp->GetUpGroup();
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir 		if(pGrp)
1059cdf0e10cSrcweir 			aStr += cSep;
1060cdf0e10cSrcweir 	}
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir 	if(!bNamFnd && GetAktGroup())
1063cdf0e10cSrcweir 	{
1064cdf0e10cSrcweir 		aStr = String();
1065cdf0e10cSrcweir 		aStr += sal_Unicode('(');
1066cdf0e10cSrcweir 		aStr += String::CreateFromInt32( GetEnteredLevel() );
1067cdf0e10cSrcweir 		aStr += sal_Unicode(')');
1068cdf0e10cSrcweir 	}
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir 	return aStr;
1071cdf0e10cSrcweir }
1072cdf0e10cSrcweir 
CheckAktGroup()1073cdf0e10cSrcweir void SdrPageView::CheckAktGroup()
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir 	SdrObject* pGrp=GetAktGroup();
1076cdf0e10cSrcweir 	while (pGrp!=NULL &&
1077cdf0e10cSrcweir 		   (!pGrp->IsInserted() || pGrp->GetObjList()==NULL ||
1078cdf0e10cSrcweir 			pGrp->GetPage()==NULL || pGrp->GetModel()==NULL)) { // irgendwas daneben?
1079cdf0e10cSrcweir 		pGrp=pGrp->GetUpGroup();
1080cdf0e10cSrcweir 	}
1081cdf0e10cSrcweir 	if (pGrp!=GetAktGroup()) {
1082cdf0e10cSrcweir 		if (pGrp!=NULL) EnterGroup(pGrp);
1083cdf0e10cSrcweir 		else LeaveAllGroup();
1084cdf0e10cSrcweir 	}
1085cdf0e10cSrcweir }
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir // #103834# Set background color for svx at SdrPageViews
SetApplicationBackgroundColor(Color aBackgroundColor)1088cdf0e10cSrcweir void SdrPageView::SetApplicationBackgroundColor(Color aBackgroundColor)
1089cdf0e10cSrcweir {
1090cdf0e10cSrcweir 	maBackgroundColor = aBackgroundColor;
1091cdf0e10cSrcweir }
1092cdf0e10cSrcweir 
1093cdf0e10cSrcweir // #109585#
GetApplicationBackgroundColor() const1094cdf0e10cSrcweir Color SdrPageView::GetApplicationBackgroundColor() const
1095cdf0e10cSrcweir {
1096cdf0e10cSrcweir 	return maBackgroundColor;
1097cdf0e10cSrcweir }
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir // #103911# Set document color for svx at SdrPageViews
SetApplicationDocumentColor(Color aDocumentColor)1100cdf0e10cSrcweir void SdrPageView::SetApplicationDocumentColor(Color aDocumentColor)
1101cdf0e10cSrcweir {
1102cdf0e10cSrcweir 	maDocumentColor = aDocumentColor;
1103cdf0e10cSrcweir }
1104cdf0e10cSrcweir 
GetApplicationDocumentColor() const1105cdf0e10cSrcweir Color SdrPageView::GetApplicationDocumentColor() const
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir 	return maDocumentColor;
1108cdf0e10cSrcweir }
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1111cdf0e10cSrcweir // eof
1112