xref: /AOO41X/main/svx/source/svdraw/svdpntv.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
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 <com/sun/star/awt/XWindow.hpp>
27cdf0e10cSrcweir #include <svx/svdpntv.hxx>
28cdf0e10cSrcweir #include <vcl/msgbox.hxx>
29cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx>
30cdf0e10cSrcweir #include <svtools/grfmgr.hxx>
31cdf0e10cSrcweir #include <svx/svdmodel.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #ifdef DBG_UTIL
34cdf0e10cSrcweir #include <svdibrow.hxx>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #include <svx/svdpage.hxx>
37cdf0e10cSrcweir #include <svx/svdpagv.hxx>
38cdf0e10cSrcweir #include <svl/smplhint.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <svx/svdpntv.hxx>
41cdf0e10cSrcweir #include <editeng/editdata.hxx>
42cdf0e10cSrcweir #include <svx/svdmrkv.hxx>
43cdf0e10cSrcweir #include <svx/svdpagv.hxx>
44cdf0e10cSrcweir #include <svx/svdpage.hxx>
45cdf0e10cSrcweir #include <svx/svdmodel.hxx>
46cdf0e10cSrcweir #include <svx/svdundo.hxx>
47cdf0e10cSrcweir #include <svx/svdview.hxx>
48cdf0e10cSrcweir #include <svx/svdglue.hxx>
49cdf0e10cSrcweir #include <svx/svdobj.hxx>
50cdf0e10cSrcweir #include <svx/svdograf.hxx>
51cdf0e10cSrcweir #include <svx/svdattrx.hxx>
52cdf0e10cSrcweir #include "svdibrow.hxx"
53cdf0e10cSrcweir #include "svx/svditer.hxx"
54cdf0e10cSrcweir #include <svx/svdouno.hxx>
55cdf0e10cSrcweir #include <svx/sdr/overlay/overlayobjectlist.hxx>
56cdf0e10cSrcweir #include <svx/sdr/overlay/overlayrollingrectangle.hxx>
57cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx>
58cdf0e10cSrcweir #include <svx/svdglue.hxx>
59cdf0e10cSrcweir #include <svx/svdobj.hxx>
60cdf0e10cSrcweir #include <svx/svdview.hxx>
61cdf0e10cSrcweir #include <svx/sxlayitm.hxx>
62cdf0e10cSrcweir #include <svl/itemiter.hxx>
63cdf0e10cSrcweir #include <editeng/eeitem.hxx>
64cdf0e10cSrcweir #include <svl/whiter.hxx>
65cdf0e10cSrcweir #include <svl/style.hxx>
66cdf0e10cSrcweir #include <svx/sdrpagewindow.hxx>
67cdf0e10cSrcweir #include <svx/svdouno.hxx>
68cdf0e10cSrcweir #include <vcl/svapp.hxx>
69cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
70cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
71cdf0e10cSrcweir #include <com/sun/star/awt/XControl.hpp>
72cdf0e10cSrcweir 
73cdf0e10cSrcweir // #i38135#
74cdf0e10cSrcweir #include <svx/sdr/contact/objectcontact.hxx>
75cdf0e10cSrcweir #include <svx/sdr/animation/objectanimator.hxx>
76cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx>
77cdf0e10cSrcweir 
78cdf0e10cSrcweir using namespace ::rtl;
79cdf0e10cSrcweir using namespace ::com::sun::star;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
82cdf0e10cSrcweir // #114409#-3 Migrate Encirclement
83cdf0e10cSrcweir class ImplEncirclementOverlay
84cdf0e10cSrcweir {
85cdf0e10cSrcweir 	// The OverlayObjects
86cdf0e10cSrcweir 	::sdr::overlay::OverlayObjectList				maObjects;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	// The remembered second position in logical coodinates
89cdf0e10cSrcweir 	basegfx::B2DPoint								maSecondPosition;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir public:
92cdf0e10cSrcweir 	ImplEncirclementOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos);
93cdf0e10cSrcweir 	~ImplEncirclementOverlay();
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	void SetSecondPosition(const basegfx::B2DPoint& rNewPosition);
96cdf0e10cSrcweir };
97cdf0e10cSrcweir 
98cdf0e10cSrcweir ImplEncirclementOverlay::ImplEncirclementOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos)
99cdf0e10cSrcweir :	maSecondPosition(rStartPos)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir 	for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
102cdf0e10cSrcweir 	{
103cdf0e10cSrcweir 		SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
104cdf0e10cSrcweir 		::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 		if(pTargetOverlay)
107cdf0e10cSrcweir 		{
108cdf0e10cSrcweir 			::sdr::overlay::OverlayRollingRectangleStriped* aNew = new ::sdr::overlay::OverlayRollingRectangleStriped(
109cdf0e10cSrcweir 				rStartPos, rStartPos, false);
110cdf0e10cSrcweir 			pTargetOverlay->add(*aNew);
111cdf0e10cSrcweir 			maObjects.append(*aNew);
112cdf0e10cSrcweir 		}
113cdf0e10cSrcweir 	}
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir ImplEncirclementOverlay::~ImplEncirclementOverlay()
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	// The OverlayObjects are cleared using the destructor of OverlayObjectList.
119cdf0e10cSrcweir 	// That destructor calls clear() at the list which removes all objects from the
120cdf0e10cSrcweir 	// OverlayManager and deletes them.
121cdf0e10cSrcweir }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir void ImplEncirclementOverlay::SetSecondPosition(const basegfx::B2DPoint& rNewPosition)
124cdf0e10cSrcweir {
125cdf0e10cSrcweir 	if(rNewPosition != maSecondPosition)
126cdf0e10cSrcweir 	{
127cdf0e10cSrcweir 		// apply to OverlayObjects
128cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < maObjects.count(); a++)
129cdf0e10cSrcweir 		{
130cdf0e10cSrcweir 			::sdr::overlay::OverlayRollingRectangleStriped& rCandidate = (::sdr::overlay::OverlayRollingRectangleStriped&)maObjects.getOverlayObject(a);
131cdf0e10cSrcweir 			rCandidate.setSecondPosition(rNewPosition);
132cdf0e10cSrcweir 		}
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 		// remember new position
135cdf0e10cSrcweir 		maSecondPosition = rNewPosition;
136cdf0e10cSrcweir 	}
137cdf0e10cSrcweir }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
140cdf0e10cSrcweir // interface to SdrPaintWindow
141cdf0e10cSrcweir 
142cdf0e10cSrcweir SdrPaintWindow* SdrPaintView::FindPaintWindow(const OutputDevice& rOut) const
143cdf0e10cSrcweir {
144cdf0e10cSrcweir 	for(SdrPaintWindowVector::const_iterator a = maPaintWindows.begin(); a != maPaintWindows.end(); a++)
145cdf0e10cSrcweir 	{
146cdf0e10cSrcweir 		if(&((*a)->GetOutputDevice()) == &rOut)
147cdf0e10cSrcweir 		{
148cdf0e10cSrcweir 			return *a;
149cdf0e10cSrcweir 		}
150cdf0e10cSrcweir 	}
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	return 0L;
153cdf0e10cSrcweir }
154cdf0e10cSrcweir 
155cdf0e10cSrcweir SdrPaintWindow* SdrPaintView::GetPaintWindow(sal_uInt32 nIndex) const
156cdf0e10cSrcweir {
157cdf0e10cSrcweir 	if(nIndex < maPaintWindows.size())
158cdf0e10cSrcweir 	{
159cdf0e10cSrcweir 		return maPaintWindows[nIndex];
160cdf0e10cSrcweir 	}
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	return 0L;
163cdf0e10cSrcweir }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir void SdrPaintView::AppendPaintWindow(SdrPaintWindow& rNew)
166cdf0e10cSrcweir {
167cdf0e10cSrcweir 	maPaintWindows.push_back(&rNew);
168cdf0e10cSrcweir }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir SdrPaintWindow* SdrPaintView::RemovePaintWindow(SdrPaintWindow& rOld)
171cdf0e10cSrcweir {
172cdf0e10cSrcweir 	SdrPaintWindow* pRetval = 0L;
173cdf0e10cSrcweir 	const SdrPaintWindowVector::iterator aFindResult = ::std::find(maPaintWindows.begin(), maPaintWindows.end(), &rOld);
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	if(aFindResult != maPaintWindows.end())
176cdf0e10cSrcweir 	{
177cdf0e10cSrcweir 		// remember return value, aFindResult is no longer valid after deletion
178cdf0e10cSrcweir 		pRetval = *aFindResult;
179cdf0e10cSrcweir 		maPaintWindows.erase(aFindResult);
180cdf0e10cSrcweir 	}
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	return pRetval;
183cdf0e10cSrcweir }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir OutputDevice* SdrPaintView::GetFirstOutputDevice() const
186cdf0e10cSrcweir {
187cdf0e10cSrcweir 	if(PaintWindowCount())
188cdf0e10cSrcweir 	{
189cdf0e10cSrcweir 		return &(GetPaintWindow(0)->GetOutputDevice());
190cdf0e10cSrcweir 	}
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	return 0L;
193cdf0e10cSrcweir }
194cdf0e10cSrcweir 
195cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
196cdf0e10cSrcweir 
197cdf0e10cSrcweir TYPEINIT1( SvxViewHint, SfxHint );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir SvxViewHint::SvxViewHint (HintType eHintType)
200cdf0e10cSrcweir     : meHintType(eHintType)
201cdf0e10cSrcweir {
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir SvxViewHint::HintType SvxViewHint::GetHintType (void) const
205cdf0e10cSrcweir {
206cdf0e10cSrcweir     return meHintType;
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 
210cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
211cdf0e10cSrcweir 
212cdf0e10cSrcweir TYPEINIT2(SdrPaintView,SfxListener,SfxRepeatTarget);
213cdf0e10cSrcweir 
214cdf0e10cSrcweir DBG_NAME(SdrPaintView);
215cdf0e10cSrcweir 
216cdf0e10cSrcweir void SdrPaintView::ImpClearVars()
217cdf0e10cSrcweir {
218cdf0e10cSrcweir #ifdef DBG_UTIL
219cdf0e10cSrcweir 	pItemBrowser=NULL;
220cdf0e10cSrcweir #endif
221cdf0e10cSrcweir 	bPageVisible=sal_True;
222cdf0e10cSrcweir 	bPageBorderVisible=sal_True;
223cdf0e10cSrcweir 	bBordVisible=sal_True;
224cdf0e10cSrcweir 	bGridVisible=sal_True;
225cdf0e10cSrcweir 	bGridFront	=sal_False;
226cdf0e10cSrcweir 	bHlplVisible=sal_True;
227cdf0e10cSrcweir 	bHlplFront	=sal_True;
228cdf0e10cSrcweir 	bGlueVisible=sal_False;
229cdf0e10cSrcweir 	bGlueVisible2=sal_False;
230cdf0e10cSrcweir 	bGlueVisible3=sal_False;
231cdf0e10cSrcweir 	bGlueVisible4=sal_False;
232cdf0e10cSrcweir 	bSwapAsynchron=sal_False;
233cdf0e10cSrcweir 	bPrintPreview=sal_False;
234cdf0e10cSrcweir 	mbPreviewRenderer=sal_False;
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 	eAnimationMode = SDR_ANIMATION_ANIMATE;
237cdf0e10cSrcweir     bAnimationPause = sal_False;
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 	nHitTolPix=2;
240cdf0e10cSrcweir 	nMinMovPix=3;
241cdf0e10cSrcweir 	nHitTolLog=0;
242cdf0e10cSrcweir 	nMinMovLog=0;
243cdf0e10cSrcweir 	pActualOutDev=NULL;
244cdf0e10cSrcweir 	pDragWin=NULL;
245cdf0e10cSrcweir 	bRestoreColors=sal_True;
246cdf0e10cSrcweir 	pDefaultStyleSheet=NULL;
247cdf0e10cSrcweir 	bSomeObjChgdFlag=sal_False;
248cdf0e10cSrcweir     nGraphicManagerDrawMode = GRFMGR_DRAW_STANDARD;
249cdf0e10cSrcweir 	aComeBackTimer.SetTimeout(1);
250cdf0e10cSrcweir 	aComeBackTimer.SetTimeoutHdl(LINK(this,SdrPaintView,ImpComeBackHdl));
251cdf0e10cSrcweir 	String aNam;	// System::GetUserName() just return an empty string
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	if (pMod)
254cdf0e10cSrcweir 		SetDefaultStyleSheet(pMod->GetDefaultStyleSheet(), sal_True);
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	aNam.ToUpperAscii();
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 	maGridColor = Color( COL_BLACK );
259cdf0e10cSrcweir 	BrkEncirclement();
260cdf0e10cSrcweir }
261cdf0e10cSrcweir 
262cdf0e10cSrcweir SdrPaintView::SdrPaintView(SdrModel* pModel1, OutputDevice* pOut)
263cdf0e10cSrcweir :	mpEncirclementOverlay(0L),
264cdf0e10cSrcweir 	mpPageView(0L),
265cdf0e10cSrcweir 	aDefaultAttr(pModel1->GetItemPool()),
266cdf0e10cSrcweir 	mbBufferedOutputAllowed(false),
267cdf0e10cSrcweir 	mbBufferedOverlayAllowed(false),
268cdf0e10cSrcweir 	mbPagePaintingAllowed(true),
269cdf0e10cSrcweir     mbHideOle(false),
270cdf0e10cSrcweir     mbHideChart(false),
271cdf0e10cSrcweir     mbHideDraw(false),
272cdf0e10cSrcweir     mbHideFormControl(false)
273cdf0e10cSrcweir {
274cdf0e10cSrcweir 	DBG_CTOR(SdrPaintView,NULL);
275cdf0e10cSrcweir 	pMod=pModel1;
276cdf0e10cSrcweir 	ImpClearVars();
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	if(pOut)
279cdf0e10cSrcweir 	{
280cdf0e10cSrcweir 		AddWindowToPaintView(pOut);
281cdf0e10cSrcweir 	}
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	// Flag zur Visualisierung von Gruppen
284cdf0e10cSrcweir 	bVisualizeEnteredGroup = sal_True;
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 	maColorConfig.AddListener(this);
287cdf0e10cSrcweir 	onChangeColorConfig();
288cdf0e10cSrcweir }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir SdrPaintView::~SdrPaintView()
291cdf0e10cSrcweir {
292cdf0e10cSrcweir 	DBG_DTOR(SdrPaintView,NULL);
293cdf0e10cSrcweir 	if (pDefaultStyleSheet)
294cdf0e10cSrcweir 		EndListening(*pDefaultStyleSheet);
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	maColorConfig.RemoveListener(this);
297cdf0e10cSrcweir 	ClearPageView();
298cdf0e10cSrcweir 
299cdf0e10cSrcweir #ifdef DBG_UTIL
300cdf0e10cSrcweir 	if(pItemBrowser)
301cdf0e10cSrcweir 	{
302cdf0e10cSrcweir 		delete pItemBrowser;
303cdf0e10cSrcweir 	}
304cdf0e10cSrcweir #endif
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 	// delete existing SdrPaintWindows
307cdf0e10cSrcweir 	while(!maPaintWindows.empty())
308cdf0e10cSrcweir 	{
309cdf0e10cSrcweir 		delete maPaintWindows.back();
310cdf0e10cSrcweir 		maPaintWindows.pop_back();
311cdf0e10cSrcweir 	}
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 	// #114409#-3 Migrate HelpLine
314cdf0e10cSrcweir 	BrkEncirclement();
315cdf0e10cSrcweir }
316cdf0e10cSrcweir 
317cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
318cdf0e10cSrcweir 
319cdf0e10cSrcweir void __EXPORT SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
320cdf0e10cSrcweir {
321cdf0e10cSrcweir 	//If the stylesheet has been destroyed
322cdf0e10cSrcweir     if (&rBC == pDefaultStyleSheet)
323cdf0e10cSrcweir     {
324cdf0e10cSrcweir         if (rHint.ISA(SfxSimpleHint) && ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
325cdf0e10cSrcweir             pDefaultStyleSheet = NULL;
326cdf0e10cSrcweir         return;
327cdf0e10cSrcweir     }
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 	sal_Bool bObjChg=!bSomeObjChgdFlag; // sal_True= auswerten fuer ComeBack-Timer
330cdf0e10cSrcweir 	if (bObjChg) {
331cdf0e10cSrcweir 		SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
332cdf0e10cSrcweir 		if (pSdrHint!=NULL) {
333cdf0e10cSrcweir 			SdrHintKind eKind=pSdrHint->GetKind();
334cdf0e10cSrcweir 			if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED) {
335cdf0e10cSrcweir 				if (bObjChg) {
336cdf0e10cSrcweir 					bSomeObjChgdFlag=sal_True;
337cdf0e10cSrcweir 					aComeBackTimer.Start();
338cdf0e10cSrcweir 				}
339cdf0e10cSrcweir 			}
340cdf0e10cSrcweir 			if (eKind==HINT_PAGEORDERCHG) {
341cdf0e10cSrcweir 				const SdrPage* pPg=pSdrHint->GetPage();
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 				if(pPg && !pPg->IsInserted())
344cdf0e10cSrcweir 				{
345cdf0e10cSrcweir 					if(mpPageView && mpPageView->GetPage() == pPg)
346cdf0e10cSrcweir 					{
347cdf0e10cSrcweir 						HideSdrPage();
348cdf0e10cSrcweir 					}
349cdf0e10cSrcweir 				}
350cdf0e10cSrcweir 			}
351cdf0e10cSrcweir 		}
352cdf0e10cSrcweir 	}
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir void SdrPaintView::ConfigurationChanged( ::utl::ConfigurationBroadcaster* , sal_uInt32 )
356cdf0e10cSrcweir {
357cdf0e10cSrcweir 	onChangeColorConfig();
358cdf0e10cSrcweir 	InvalidateAllWin();
359cdf0e10cSrcweir }
360cdf0e10cSrcweir 
361cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
362cdf0e10cSrcweir 
363cdf0e10cSrcweir IMPL_LINK_INLINE_START(SdrPaintView,ImpComeBackHdl,Timer*,EMPTYARG)
364cdf0e10cSrcweir {
365cdf0e10cSrcweir 	if (bSomeObjChgdFlag) {
366cdf0e10cSrcweir 		bSomeObjChgdFlag=sal_False;
367cdf0e10cSrcweir 		ModelHasChanged();
368cdf0e10cSrcweir 	}
369cdf0e10cSrcweir 	return 0;
370cdf0e10cSrcweir }
371cdf0e10cSrcweir IMPL_LINK_INLINE_END(SdrPaintView,ImpComeBackHdl,Timer*,pTimer)
372cdf0e10cSrcweir 
373cdf0e10cSrcweir void SdrPaintView::FlushComeBackTimer() const
374cdf0e10cSrcweir {
375cdf0e10cSrcweir 	if (bSomeObjChgdFlag) {
376cdf0e10cSrcweir 		// casting auf nonconst
377cdf0e10cSrcweir 		((SdrPaintView*)this)->ImpComeBackHdl(&((SdrPaintView*)this)->aComeBackTimer);
378cdf0e10cSrcweir 		((SdrPaintView*)this)->aComeBackTimer.Stop();
379cdf0e10cSrcweir 	}
380cdf0e10cSrcweir }
381cdf0e10cSrcweir 
382cdf0e10cSrcweir void SdrPaintView::ModelHasChanged()
383cdf0e10cSrcweir {
384cdf0e10cSrcweir 	// Auch alle PageViews benachrichtigen
385cdf0e10cSrcweir 	if(mpPageView && !mpPageView->GetPage()->IsInserted())
386cdf0e10cSrcweir 	{
387cdf0e10cSrcweir 		HideSdrPage();
388cdf0e10cSrcweir 	}
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 	// test mpPageView here again, HideSdrPage() may have invalidated it.
391cdf0e10cSrcweir 	if(mpPageView)
392cdf0e10cSrcweir 	{
393cdf0e10cSrcweir 		mpPageView->ModelHasChanged();
394cdf0e10cSrcweir 	}
395cdf0e10cSrcweir 
396cdf0e10cSrcweir #ifdef DBG_UTIL
397cdf0e10cSrcweir 	if(pItemBrowser)
398cdf0e10cSrcweir 	{
399cdf0e10cSrcweir 		pItemBrowser->SetDirty();
400cdf0e10cSrcweir 	}
401cdf0e10cSrcweir #endif
402cdf0e10cSrcweir }
403cdf0e10cSrcweir 
404cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
405cdf0e10cSrcweir 
406cdf0e10cSrcweir sal_Bool SdrPaintView::IsAction() const
407cdf0e10cSrcweir {
408cdf0e10cSrcweir 	return IsEncirclement();
409cdf0e10cSrcweir }
410cdf0e10cSrcweir 
411cdf0e10cSrcweir void SdrPaintView::MovAction(const Point& rPnt)
412cdf0e10cSrcweir {
413cdf0e10cSrcweir 	if (IsEncirclement())
414cdf0e10cSrcweir 	{
415cdf0e10cSrcweir 		MovEncirclement(rPnt);
416cdf0e10cSrcweir 	}
417cdf0e10cSrcweir }
418cdf0e10cSrcweir 
419cdf0e10cSrcweir void SdrPaintView::EndAction()
420cdf0e10cSrcweir {
421cdf0e10cSrcweir 	if(IsEncirclement())
422cdf0e10cSrcweir 	{
423cdf0e10cSrcweir 		EndEncirclement();
424cdf0e10cSrcweir 	}
425cdf0e10cSrcweir }
426cdf0e10cSrcweir 
427cdf0e10cSrcweir void SdrPaintView::BckAction()
428cdf0e10cSrcweir {
429cdf0e10cSrcweir 	BrkEncirclement();
430cdf0e10cSrcweir }
431cdf0e10cSrcweir 
432cdf0e10cSrcweir void SdrPaintView::BrkAction()
433cdf0e10cSrcweir {
434cdf0e10cSrcweir 	BrkEncirclement();
435cdf0e10cSrcweir }
436cdf0e10cSrcweir 
437cdf0e10cSrcweir void SdrPaintView::TakeActionRect(Rectangle& rRect) const
438cdf0e10cSrcweir {
439cdf0e10cSrcweir 	if(IsEncirclement())
440cdf0e10cSrcweir 	{
441cdf0e10cSrcweir 		rRect = Rectangle(aDragStat.GetStart(),aDragStat.GetNow());
442cdf0e10cSrcweir 	}
443cdf0e10cSrcweir }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
446cdf0e10cSrcweir // info about TextEdit. Default is sal_False.
447cdf0e10cSrcweir bool SdrPaintView::IsTextEdit() const
448cdf0e10cSrcweir {
449cdf0e10cSrcweir 	return false;
450cdf0e10cSrcweir }
451cdf0e10cSrcweir 
452cdf0e10cSrcweir // info about TextEditPageView. Default is 0L.
453cdf0e10cSrcweir SdrPageView* SdrPaintView::GetTextEditPageView() const
454cdf0e10cSrcweir {
455cdf0e10cSrcweir 	return 0L;
456cdf0e10cSrcweir }
457cdf0e10cSrcweir 
458cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
459cdf0e10cSrcweir 
460cdf0e10cSrcweir sal_uInt16 SdrPaintView::ImpGetMinMovLogic(short nMinMov, const OutputDevice* pOut) const
461cdf0e10cSrcweir {
462cdf0e10cSrcweir 	if (nMinMov>=0) return sal_uInt16(nMinMov);
463cdf0e10cSrcweir 	if (pOut==NULL)
464cdf0e10cSrcweir 	{
465cdf0e10cSrcweir 		pOut = GetFirstOutputDevice();
466cdf0e10cSrcweir 	}
467cdf0e10cSrcweir 	if (pOut!=NULL) {
468cdf0e10cSrcweir 		return short(-pOut->PixelToLogic(Size(nMinMov,0)).Width());
469cdf0e10cSrcweir 	} else {
470cdf0e10cSrcweir 		return 0;
471cdf0e10cSrcweir 	}
472cdf0e10cSrcweir }
473cdf0e10cSrcweir 
474cdf0e10cSrcweir sal_uInt16 SdrPaintView::ImpGetHitTolLogic(short nHitTol, const OutputDevice* pOut) const
475cdf0e10cSrcweir {
476cdf0e10cSrcweir 	if (nHitTol>=0) return sal_uInt16(nHitTol);
477cdf0e10cSrcweir 	if (pOut==NULL)
478cdf0e10cSrcweir 	{
479cdf0e10cSrcweir 		pOut = GetFirstOutputDevice();
480cdf0e10cSrcweir 	}
481cdf0e10cSrcweir 	if (pOut!=NULL) {
482cdf0e10cSrcweir 		return short(-pOut->PixelToLogic(Size(nHitTol,0)).Width());
483cdf0e10cSrcweir 	} else {
484cdf0e10cSrcweir 		return 0;
485cdf0e10cSrcweir 	}
486cdf0e10cSrcweir }
487cdf0e10cSrcweir 
488cdf0e10cSrcweir void SdrPaintView::TheresNewMapMode()
489cdf0e10cSrcweir {
490cdf0e10cSrcweir 	if (pActualOutDev!=NULL) {
491cdf0e10cSrcweir 		nHitTolLog=(sal_uInt16)((OutputDevice*)pActualOutDev)->PixelToLogic(Size(nHitTolPix,0)).Width();
492cdf0e10cSrcweir 		nMinMovLog=(sal_uInt16)((OutputDevice*)pActualOutDev)->PixelToLogic(Size(nMinMovPix,0)).Width();
493cdf0e10cSrcweir 	}
494cdf0e10cSrcweir }
495cdf0e10cSrcweir 
496cdf0e10cSrcweir void SdrPaintView::SetActualWin(const OutputDevice* pWin)
497cdf0e10cSrcweir {
498cdf0e10cSrcweir 	pActualOutDev=pWin;
499cdf0e10cSrcweir 	TheresNewMapMode();
500cdf0e10cSrcweir }
501cdf0e10cSrcweir 
502cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
503cdf0e10cSrcweir 
504cdf0e10cSrcweir void SdrPaintView::BegEncirclement(const Point& rPnt)
505cdf0e10cSrcweir {
506cdf0e10cSrcweir 	BrkAction();
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 	DBG_ASSERT(0L == mpEncirclementOverlay, "SdrSnapView::BegSetPageOrg: There exists a ImplPageOriginOverlay (!)");
509cdf0e10cSrcweir 	basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
510cdf0e10cSrcweir 	mpEncirclementOverlay = new ImplEncirclementOverlay(*this, aStartPos);
511cdf0e10cSrcweir 
512cdf0e10cSrcweir 	aDragStat.Reset(rPnt);
513cdf0e10cSrcweir 	aDragStat.SetMinMove(ImpGetMinMovLogic(-2,0L));
514cdf0e10cSrcweir 	aDragStat.NextPoint();
515cdf0e10cSrcweir }
516cdf0e10cSrcweir 
517cdf0e10cSrcweir void SdrPaintView::MovEncirclement(const Point& rPnt)
518cdf0e10cSrcweir {
519cdf0e10cSrcweir 	if(IsEncirclement() && aDragStat.CheckMinMoved(rPnt))
520cdf0e10cSrcweir 	{
521cdf0e10cSrcweir 		aDragStat.NextMove(rPnt);
522cdf0e10cSrcweir 
523cdf0e10cSrcweir 		DBG_ASSERT(mpEncirclementOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
524cdf0e10cSrcweir 		basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
525cdf0e10cSrcweir 		mpEncirclementOverlay->SetSecondPosition(aNewPos);
526cdf0e10cSrcweir 	}
527cdf0e10cSrcweir }
528cdf0e10cSrcweir 
529cdf0e10cSrcweir Rectangle SdrPaintView::EndEncirclement(sal_Bool bNoJustify)
530cdf0e10cSrcweir {
531cdf0e10cSrcweir 	Rectangle aRetval;
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 	if(IsEncirclement())
534cdf0e10cSrcweir 	{
535cdf0e10cSrcweir 		if(aDragStat.IsMinMoved())
536cdf0e10cSrcweir 		{
537cdf0e10cSrcweir 			aRetval = Rectangle(aDragStat.GetStart(), aDragStat.GetNow());
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 			if(!bNoJustify)
540cdf0e10cSrcweir 			{
541cdf0e10cSrcweir 				aRetval.Justify();
542cdf0e10cSrcweir 			}
543cdf0e10cSrcweir 		}
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 		// cleanup
546cdf0e10cSrcweir 		BrkEncirclement();
547cdf0e10cSrcweir 	}
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 	return aRetval;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir 
552cdf0e10cSrcweir void SdrPaintView::BrkEncirclement()
553cdf0e10cSrcweir {
554cdf0e10cSrcweir 	if(IsEncirclement())
555cdf0e10cSrcweir 	{
556cdf0e10cSrcweir 		DBG_ASSERT(mpEncirclementOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
557cdf0e10cSrcweir 		delete mpEncirclementOverlay;
558cdf0e10cSrcweir 		mpEncirclementOverlay = 0L;
559cdf0e10cSrcweir 	}
560cdf0e10cSrcweir }
561cdf0e10cSrcweir 
562cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
563cdf0e10cSrcweir 
564cdf0e10cSrcweir void SdrPaintView::ClearPageView()
565cdf0e10cSrcweir {
566cdf0e10cSrcweir 	BrkAction();
567cdf0e10cSrcweir 
568cdf0e10cSrcweir 	if(mpPageView)
569cdf0e10cSrcweir 	{
570cdf0e10cSrcweir 		InvalidateAllWin();
571cdf0e10cSrcweir 		delete mpPageView;
572cdf0e10cSrcweir 		mpPageView = 0L;
573cdf0e10cSrcweir 	}
574cdf0e10cSrcweir }
575cdf0e10cSrcweir 
576cdf0e10cSrcweir SdrPageView* SdrPaintView::ShowSdrPage(SdrPage* pPage)
577cdf0e10cSrcweir {
578cdf0e10cSrcweir 	if(pPage && (!mpPageView || mpPageView->GetPage() != pPage))
579cdf0e10cSrcweir 	{
580cdf0e10cSrcweir 		if(mpPageView)
581cdf0e10cSrcweir 		{
582cdf0e10cSrcweir 			InvalidateAllWin();
583cdf0e10cSrcweir 			delete mpPageView;
584cdf0e10cSrcweir 		}
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 		mpPageView = new SdrPageView(pPage, *((SdrView*)this));
587cdf0e10cSrcweir 		mpPageView->Show();
588cdf0e10cSrcweir 	}
589cdf0e10cSrcweir 
590cdf0e10cSrcweir 	return mpPageView;
591cdf0e10cSrcweir }
592cdf0e10cSrcweir 
593cdf0e10cSrcweir void SdrPaintView::HideSdrPage()
594cdf0e10cSrcweir {
595cdf0e10cSrcweir 	if(mpPageView)
596cdf0e10cSrcweir 	{
597cdf0e10cSrcweir 		mpPageView->Hide();
598cdf0e10cSrcweir 		delete mpPageView;
599cdf0e10cSrcweir 		mpPageView = 0L;
600cdf0e10cSrcweir 	}
601cdf0e10cSrcweir }
602cdf0e10cSrcweir 
603cdf0e10cSrcweir void SdrPaintView::AddWindowToPaintView(OutputDevice* pNewWin)
604cdf0e10cSrcweir {
605cdf0e10cSrcweir 	DBG_ASSERT(pNewWin, "SdrPaintView::AddWindowToPaintView: No OutputDevice(!)");
606cdf0e10cSrcweir 	SdrPaintWindow* pNewPaintWindow = new SdrPaintWindow(*this, *pNewWin);
607cdf0e10cSrcweir 	AppendPaintWindow(*pNewPaintWindow);
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 	if(mpPageView)
610cdf0e10cSrcweir 	{
611cdf0e10cSrcweir 		mpPageView->AddPaintWindowToPageView(*pNewPaintWindow);
612cdf0e10cSrcweir 	}
613cdf0e10cSrcweir 
614cdf0e10cSrcweir #ifdef DBG_UTIL
615cdf0e10cSrcweir 	if (pItemBrowser!=NULL)
616cdf0e10cSrcweir 		pItemBrowser->ForceParent();
617cdf0e10cSrcweir #endif
618cdf0e10cSrcweir }
619cdf0e10cSrcweir 
620cdf0e10cSrcweir void SdrPaintView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
621cdf0e10cSrcweir {
622cdf0e10cSrcweir 	DBG_ASSERT(pOldWin, "SdrPaintView::DeleteWindowFromPaintView: No OutputDevice(!)");
623cdf0e10cSrcweir 	SdrPaintWindow* pCandidate = FindPaintWindow(*pOldWin);
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 	if(pCandidate)
626cdf0e10cSrcweir 	{
627cdf0e10cSrcweir 		if(mpPageView)
628cdf0e10cSrcweir 		{
629cdf0e10cSrcweir 			mpPageView->RemovePaintWindowFromPageView(*pCandidate);
630cdf0e10cSrcweir 		}
631cdf0e10cSrcweir 
632cdf0e10cSrcweir 		RemovePaintWindow(*pCandidate);
633cdf0e10cSrcweir 		delete pCandidate;
634cdf0e10cSrcweir 	}
635cdf0e10cSrcweir 
636cdf0e10cSrcweir #ifdef DBG_UTIL
637cdf0e10cSrcweir 	if (pItemBrowser!=NULL)
638cdf0e10cSrcweir 		pItemBrowser->ForceParent();
639cdf0e10cSrcweir #endif
640cdf0e10cSrcweir }
641cdf0e10cSrcweir 
642cdf0e10cSrcweir void SdrPaintView::SetLayerVisible(const XubString& rName, sal_Bool bShow)
643cdf0e10cSrcweir {
644cdf0e10cSrcweir 	if(mpPageView)
645cdf0e10cSrcweir 	{
646cdf0e10cSrcweir 		mpPageView->SetLayerVisible(rName,bShow);
647cdf0e10cSrcweir 	}
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 	InvalidateAllWin();
650cdf0e10cSrcweir }
651cdf0e10cSrcweir 
652cdf0e10cSrcweir bool SdrPaintView::IsLayerVisible(const XubString& rName) const
653cdf0e10cSrcweir {
654cdf0e10cSrcweir 	if(mpPageView)
655cdf0e10cSrcweir 	{
656cdf0e10cSrcweir 		return mpPageView->IsLayerVisible(rName);
657cdf0e10cSrcweir 	}
658cdf0e10cSrcweir 
659cdf0e10cSrcweir 	return false;
660cdf0e10cSrcweir }
661cdf0e10cSrcweir 
662cdf0e10cSrcweir void SdrPaintView::SetAllLayersVisible(sal_Bool bShow)
663cdf0e10cSrcweir {
664cdf0e10cSrcweir 	if(mpPageView)
665cdf0e10cSrcweir 	{
666cdf0e10cSrcweir 		mpPageView->SetAllLayersVisible(bShow);
667cdf0e10cSrcweir 	}
668cdf0e10cSrcweir 
669cdf0e10cSrcweir 	InvalidateAllWin();
670cdf0e10cSrcweir }
671cdf0e10cSrcweir 
672cdf0e10cSrcweir void SdrPaintView::SetLayerLocked(const XubString& rName, sal_Bool bLock)
673cdf0e10cSrcweir {
674cdf0e10cSrcweir 	if(mpPageView)
675cdf0e10cSrcweir 	{
676cdf0e10cSrcweir 		mpPageView->SetLayerLocked(rName,bLock);
677cdf0e10cSrcweir 	}
678cdf0e10cSrcweir }
679cdf0e10cSrcweir 
680cdf0e10cSrcweir bool SdrPaintView::IsLayerLocked(const XubString& rName) const
681cdf0e10cSrcweir {
682cdf0e10cSrcweir 	if(mpPageView)
683cdf0e10cSrcweir 	{
684cdf0e10cSrcweir 		return mpPageView->IsLayerLocked(rName);
685cdf0e10cSrcweir 	}
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 	return false;
688cdf0e10cSrcweir }
689cdf0e10cSrcweir 
690cdf0e10cSrcweir void SdrPaintView::SetAllLayersLocked(sal_Bool bLock)
691cdf0e10cSrcweir {
692cdf0e10cSrcweir 	if(mpPageView)
693cdf0e10cSrcweir 	{
694cdf0e10cSrcweir 		mpPageView->SetAllLayersLocked(bLock);
695cdf0e10cSrcweir 	}
696cdf0e10cSrcweir }
697cdf0e10cSrcweir 
698cdf0e10cSrcweir void SdrPaintView::SetLayerPrintable(const XubString& rName, sal_Bool bPrn)
699cdf0e10cSrcweir {
700cdf0e10cSrcweir 	if(mpPageView)
701cdf0e10cSrcweir 	{
702cdf0e10cSrcweir 		mpPageView->SetLayerPrintable(rName,bPrn);
703cdf0e10cSrcweir 	}
704cdf0e10cSrcweir }
705cdf0e10cSrcweir 
706cdf0e10cSrcweir bool SdrPaintView::IsLayerPrintable(const XubString& rName) const
707cdf0e10cSrcweir {
708cdf0e10cSrcweir 	if(mpPageView)
709cdf0e10cSrcweir 	{
710cdf0e10cSrcweir 		return mpPageView->IsLayerPrintable(rName);
711cdf0e10cSrcweir 	}
712cdf0e10cSrcweir 
713cdf0e10cSrcweir 	return false;
714cdf0e10cSrcweir }
715cdf0e10cSrcweir 
716cdf0e10cSrcweir void SdrPaintView::SetAllLayersPrintable(sal_Bool bPrn)
717cdf0e10cSrcweir {
718cdf0e10cSrcweir 	if(mpPageView)
719cdf0e10cSrcweir 	{
720cdf0e10cSrcweir 		mpPageView->SetAllLayersPrintable(bPrn);
721cdf0e10cSrcweir 	}
722cdf0e10cSrcweir }
723cdf0e10cSrcweir 
724cdf0e10cSrcweir void SdrPaintView::PrePaint()
725cdf0e10cSrcweir {
726cdf0e10cSrcweir 	if(mpPageView)
727cdf0e10cSrcweir 	{
728cdf0e10cSrcweir 		mpPageView->PrePaint();
729cdf0e10cSrcweir 	}
730cdf0e10cSrcweir }
731cdf0e10cSrcweir 
732cdf0e10cSrcweir void SdrPaintView::PostPaint()
733cdf0e10cSrcweir {
734cdf0e10cSrcweir 	if(mpPageView)
735cdf0e10cSrcweir 	{
736cdf0e10cSrcweir 		mpPageView->PostPaint();
737cdf0e10cSrcweir 	}
738cdf0e10cSrcweir }
739cdf0e10cSrcweir 
740cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
741cdf0e10cSrcweir // #define SVX_REPAINT_TIMER_TEST
742cdf0e10cSrcweir 
743cdf0e10cSrcweir void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector)
744cdf0e10cSrcweir {
745cdf0e10cSrcweir #ifdef SVX_REPAINT_TIMER_TEST
746cdf0e10cSrcweir #define REMEMBERED_TIMES_COUNT	(10)
747cdf0e10cSrcweir 	static bool bDoTimerTest(false);
748cdf0e10cSrcweir 	static bool bTimesInited(false);
749cdf0e10cSrcweir 	static sal_uInt32 nRepeatCount(10L);
750cdf0e10cSrcweir 	static double fLastTimes[REMEMBERED_TIMES_COUNT];
751cdf0e10cSrcweir 	const sal_uInt32 nStartTime(Time::GetSystemTicks());
752cdf0e10cSrcweir 	sal_uInt32 count(1L);
753cdf0e10cSrcweir 	sal_uInt32 a;
754cdf0e10cSrcweir 
755cdf0e10cSrcweir 	if(bDoTimerTest)
756cdf0e10cSrcweir 	{
757cdf0e10cSrcweir 		count = nRepeatCount;
758cdf0e10cSrcweir 	}
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 	for(a = 0L; a < count; a++)
761cdf0e10cSrcweir 	{
762cdf0e10cSrcweir #endif // SVX_REPAINT_TIMER_TEST
763cdf0e10cSrcweir 
764cdf0e10cSrcweir 	// #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
765cdf0e10cSrcweir 	// rReg may be made more granular (fine) with using it. Normally, rReg
766cdf0e10cSrcweir 	// does come from Window::Paint() anyways and thus is based on a single
767cdf0e10cSrcweir 	// rectangle which was derived from exactly that repaint region
768cdf0e10cSrcweir 	Region aOptimizedRepaintRegion(rReg);
769cdf0e10cSrcweir 
770cdf0e10cSrcweir 	if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType())
771cdf0e10cSrcweir 	{
772cdf0e10cSrcweir 		Window* pWindow = (Window*)pOut;
773cdf0e10cSrcweir 
774cdf0e10cSrcweir 		if(pWindow->IsInPaint())
775cdf0e10cSrcweir 		{
776cdf0e10cSrcweir 			if(!pWindow->GetPaintRegion().IsEmpty())
777cdf0e10cSrcweir 			{
778cdf0e10cSrcweir 				aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
779cdf0e10cSrcweir 
780cdf0e10cSrcweir #ifdef DBG_UTIL
781cdf0e10cSrcweir 				// #i74769# test-paint repaint region
782cdf0e10cSrcweir 				static bool bDoPaintForVisualControl(false);
783cdf0e10cSrcweir 				if(bDoPaintForVisualControl)
784cdf0e10cSrcweir 				{
785cdf0e10cSrcweir 					RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
786cdf0e10cSrcweir 					Rectangle aRegionRectangle;
787cdf0e10cSrcweir 
788cdf0e10cSrcweir 					while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
789cdf0e10cSrcweir 					{
790cdf0e10cSrcweir 						pWindow->SetLineColor(COL_LIGHTGREEN);
791cdf0e10cSrcweir 						pWindow->SetFillColor();
792cdf0e10cSrcweir 						pWindow->DrawRect(aRegionRectangle);
793cdf0e10cSrcweir 					}
794cdf0e10cSrcweir 
795cdf0e10cSrcweir 					aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
796cdf0e10cSrcweir 				}
797cdf0e10cSrcweir #endif
798cdf0e10cSrcweir 			}
799cdf0e10cSrcweir 		}
800cdf0e10cSrcweir 	}
801cdf0e10cSrcweir 
802cdf0e10cSrcweir 	SdrPaintWindow* pPaintWindow = BeginCompleteRedraw(pOut);
803cdf0e10cSrcweir 	OSL_ENSURE(pPaintWindow, "SdrPaintView::CompleteRedraw: No OutDev (!)");
804cdf0e10cSrcweir 
805cdf0e10cSrcweir 	DoCompleteRedraw(*pPaintWindow, aOptimizedRepaintRegion, pRedirector);
806cdf0e10cSrcweir 	EndCompleteRedraw(*pPaintWindow, true);
807cdf0e10cSrcweir 
808cdf0e10cSrcweir #ifdef SVX_REPAINT_TIMER_TEST
809cdf0e10cSrcweir 	}
810cdf0e10cSrcweir 
811cdf0e10cSrcweir 	if(bDoTimerTest)
812cdf0e10cSrcweir 	{
813cdf0e10cSrcweir 		const sal_uInt32 nStopTime(Time::GetSystemTicks());
814cdf0e10cSrcweir 		const sal_uInt32 nNeededTime(nStopTime - nStartTime);
815cdf0e10cSrcweir 		const double fTimePerPaint((double)nNeededTime / (double)nRepeatCount);
816cdf0e10cSrcweir 
817cdf0e10cSrcweir 		if(!bTimesInited)
818cdf0e10cSrcweir 		{
819cdf0e10cSrcweir 			for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
820cdf0e10cSrcweir 			{
821cdf0e10cSrcweir 				fLastTimes[a] = fTimePerPaint;
822cdf0e10cSrcweir 			}
823cdf0e10cSrcweir 
824cdf0e10cSrcweir 			bTimesInited = true;
825cdf0e10cSrcweir 		}
826cdf0e10cSrcweir 		else
827cdf0e10cSrcweir 		{
828cdf0e10cSrcweir 			for(a = 1L; a < REMEMBERED_TIMES_COUNT; a++)
829cdf0e10cSrcweir 			{
830cdf0e10cSrcweir 				fLastTimes[a - 1L] = fLastTimes[a];
831cdf0e10cSrcweir 			}
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 			fLastTimes[REMEMBERED_TIMES_COUNT - 1L] = fTimePerPaint;
834cdf0e10cSrcweir 		}
835cdf0e10cSrcweir 
836cdf0e10cSrcweir 		double fAddedTimes(0.0);
837cdf0e10cSrcweir 
838cdf0e10cSrcweir 		for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
839cdf0e10cSrcweir 		{
840cdf0e10cSrcweir 			fAddedTimes += fLastTimes[a];
841cdf0e10cSrcweir 		}
842cdf0e10cSrcweir 
843cdf0e10cSrcweir 		const double fAverageTimePerPaint(fAddedTimes / (double)REMEMBERED_TIMES_COUNT);
844cdf0e10cSrcweir 
845cdf0e10cSrcweir 		fprintf(stderr, "-----------(start result)----------\n");
846cdf0e10cSrcweir 		fprintf(stderr, "StartTime : %u, StopTime: %u, NeededTime: %u, TimePerPaint: %f\n", nStartTime, nStopTime, nNeededTime, fTimePerPaint);
847cdf0e10cSrcweir 		fprintf(stderr, "Remembered times: ");
848cdf0e10cSrcweir 
849cdf0e10cSrcweir 		for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
850cdf0e10cSrcweir 		{
851cdf0e10cSrcweir 			fprintf(stderr, "%d: %f ", a, fLastTimes[a]);
852cdf0e10cSrcweir 		}
853cdf0e10cSrcweir 
854cdf0e10cSrcweir 		fprintf(stderr, "\n");
855cdf0e10cSrcweir 		fprintf(stderr, "AverageTimePerPaint: %f\n", fAverageTimePerPaint);
856cdf0e10cSrcweir 		fprintf(stderr, "-----------(stop result)----------\n");
857cdf0e10cSrcweir 	}
858cdf0e10cSrcweir #endif // SVX_REPAINT_TIMER_TEST
859cdf0e10cSrcweir }
860cdf0e10cSrcweir 
861cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
862cdf0e10cSrcweir // #i72889#
863cdf0e10cSrcweir 
864cdf0e10cSrcweir SdrPaintWindow* SdrPaintView::BeginCompleteRedraw(OutputDevice* pOut)
865cdf0e10cSrcweir {
866cdf0e10cSrcweir 	OSL_ENSURE(pOut, "SdrPaintView::BeginCompleteRedraw: No OutDev (!)");
867cdf0e10cSrcweir 	SdrPaintWindow* pPaintWindow = FindPaintWindow(*pOut);
868cdf0e10cSrcweir 
869cdf0e10cSrcweir 	if(pPaintWindow)
870cdf0e10cSrcweir 	{
871cdf0e10cSrcweir 		// draw preprocessing, only for known devices
872cdf0e10cSrcweir 		// prepare PreRendering
873cdf0e10cSrcweir 		pPaintWindow->PreparePreRenderDevice();
874cdf0e10cSrcweir 	}
875cdf0e10cSrcweir 	else
876cdf0e10cSrcweir 	{
877cdf0e10cSrcweir 		// None of the known OutputDevices is the target of this paint, use
878cdf0e10cSrcweir 		// a temporary SdrPaintWindow for this Redraw.
879cdf0e10cSrcweir 		pPaintWindow = new SdrPaintWindow(*this, *pOut);
880cdf0e10cSrcweir 		pPaintWindow->setTemporaryTarget(true);
881cdf0e10cSrcweir 	}
882cdf0e10cSrcweir 
883cdf0e10cSrcweir 	return pPaintWindow;
884cdf0e10cSrcweir }
885cdf0e10cSrcweir 
886cdf0e10cSrcweir void SdrPaintView::DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector)
887cdf0e10cSrcweir {
888cdf0e10cSrcweir 	// redraw all PageViews with the target. This may expand the RedrawRegion
889cdf0e10cSrcweir 	// at the PaintWindow, plus taking care of FormLayer expansion
890cdf0e10cSrcweir 	if(mpPageView)
891cdf0e10cSrcweir 	{
892cdf0e10cSrcweir 		mpPageView->CompleteRedraw(rPaintWindow, rReg, pRedirector);
893cdf0e10cSrcweir 	}
894cdf0e10cSrcweir }
895cdf0e10cSrcweir 
896cdf0e10cSrcweir void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer)
897cdf0e10cSrcweir {
898cdf0e10cSrcweir 	if(rPaintWindow.getTemporaryTarget())
899cdf0e10cSrcweir 	{
900cdf0e10cSrcweir 		// get rid of temp target again
901cdf0e10cSrcweir 		delete (&rPaintWindow);
902cdf0e10cSrcweir 	}
903cdf0e10cSrcweir 	else
904cdf0e10cSrcweir 	{
905cdf0e10cSrcweir 		// draw postprocessing, only for known devices
906cdf0e10cSrcweir 		// it is necessary to always paint FormLayer
907cdf0e10cSrcweir         if(bPaintFormLayer)
908cdf0e10cSrcweir         {
909cdf0e10cSrcweir 		    ImpFormLayerDrawing(rPaintWindow);
910cdf0e10cSrcweir         }
911cdf0e10cSrcweir 
912cdf0e10cSrcweir 		// look for active TextEdit. As long as this cannot be painted to a VDev,
913cdf0e10cSrcweir 		// it cannot get part of buffering. In that case, output evtl. prerender
914cdf0e10cSrcweir 		// early and paint text edit to window.
915cdf0e10cSrcweir 		const bool bTextEditActive(IsTextEdit() && GetTextEditPageView());
916cdf0e10cSrcweir 
917cdf0e10cSrcweir 		if(bTextEditActive)
918cdf0e10cSrcweir 		{
919cdf0e10cSrcweir 			// output PreRendering and destroy it so that it is not used for FormLayer
920cdf0e10cSrcweir 			// or overlay
921cdf0e10cSrcweir 			rPaintWindow.OutputPreRenderDevice(rPaintWindow.GetRedrawRegion());
922cdf0e10cSrcweir 
923cdf0e10cSrcweir 			// draw old text edit stuff before overlay to have it as part of the background
924cdf0e10cSrcweir 			// ATM. This will be changed to have the text editing on the overlay, bit it
925cdf0e10cSrcweir 			// is not an easy thing to do, see BegTextEdit and the OutlinerView stuff used...
926cdf0e10cSrcweir 			if(bTextEditActive)
927cdf0e10cSrcweir 			{
928cdf0e10cSrcweir 				ImpTextEditDrawing(rPaintWindow);
929cdf0e10cSrcweir 			}
930cdf0e10cSrcweir 
931cdf0e10cSrcweir 			// draw Overlay directly to window. This will save the contents of the window
932cdf0e10cSrcweir 			// in the RedrawRegion to the overlay background buffer, too.
933cdf0e10cSrcweir 			// This may lead to problems when reading from the screen is slow from the
934cdf0e10cSrcweir 			// graphics driver/graphiccard combination.
935cdf0e10cSrcweir 			rPaintWindow.DrawOverlay(rPaintWindow.GetRedrawRegion(), false);
936cdf0e10cSrcweir 		}
937cdf0e10cSrcweir 		else
938cdf0e10cSrcweir 		{
939cdf0e10cSrcweir 			// draw Overlay, also to PreRender device if exists
940cdf0e10cSrcweir 			rPaintWindow.DrawOverlay(rPaintWindow.GetRedrawRegion(), true);
941cdf0e10cSrcweir 
942cdf0e10cSrcweir 			// output PreRendering
943cdf0e10cSrcweir 			rPaintWindow.OutputPreRenderDevice(rPaintWindow.GetRedrawRegion());
944cdf0e10cSrcweir 		}
945cdf0e10cSrcweir 	}
946cdf0e10cSrcweir }
947cdf0e10cSrcweir 
948cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
949cdf0e10cSrcweir 
950cdf0e10cSrcweir SdrPaintWindow* SdrPaintView::BeginDrawLayers(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect)
951cdf0e10cSrcweir {
952cdf0e10cSrcweir 	// #i74769# use BeginCompleteRedraw() as common base
953cdf0e10cSrcweir 	SdrPaintWindow* pPaintWindow = BeginCompleteRedraw(pOut);
954cdf0e10cSrcweir 	OSL_ENSURE(pPaintWindow, "SdrPaintView::BeginDrawLayers: No SdrPaintWindow (!)");
955cdf0e10cSrcweir 
956cdf0e10cSrcweir 	if(mpPageView)
957cdf0e10cSrcweir 	{
958cdf0e10cSrcweir 		SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(*pPaintWindow);
959cdf0e10cSrcweir 
960cdf0e10cSrcweir 		if(pKnownTarget)
961cdf0e10cSrcweir 		{
962cdf0e10cSrcweir 			// #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
963cdf0e10cSrcweir 			// rReg may be made more granular (fine) with using it. Normally, rReg
964cdf0e10cSrcweir 			// does come from Window::Paint() anyways and thus is based on a single
965cdf0e10cSrcweir 			// rectangle which was derived from exactly that repaint region
966cdf0e10cSrcweir 			Region aOptimizedRepaintRegion(rReg);
967cdf0e10cSrcweir 
968cdf0e10cSrcweir 			// #i76114# Intersecting the region with the Window's paint region is disabled
969cdf0e10cSrcweir 			// for print preview in Calc, because the intersection can be empty (if the paint
970cdf0e10cSrcweir 			// region is outside of the table area of the page), and then no clip region
971cdf0e10cSrcweir 			// would be set.
972cdf0e10cSrcweir 			if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType() && !bDisableIntersect)
973cdf0e10cSrcweir 			{
974cdf0e10cSrcweir 				Window* pWindow = (Window*)pOut;
975cdf0e10cSrcweir 
976cdf0e10cSrcweir 				if(pWindow->IsInPaint())
977cdf0e10cSrcweir 				{
978cdf0e10cSrcweir 					if(!pWindow->GetPaintRegion().IsEmpty())
979cdf0e10cSrcweir 					{
980cdf0e10cSrcweir 						aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
981cdf0e10cSrcweir 
982cdf0e10cSrcweir #ifdef DBG_UTIL
983cdf0e10cSrcweir 						// #i74769# test-paint repaint region
984cdf0e10cSrcweir 						static bool bDoPaintForVisualControl(false);
985cdf0e10cSrcweir 						if(bDoPaintForVisualControl)
986cdf0e10cSrcweir 						{
987cdf0e10cSrcweir 							RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
988cdf0e10cSrcweir 							Rectangle aRegionRectangle;
989cdf0e10cSrcweir 
990cdf0e10cSrcweir 							while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
991cdf0e10cSrcweir 							{
992cdf0e10cSrcweir 								pWindow->SetLineColor(COL_LIGHTGREEN);
993cdf0e10cSrcweir 								pWindow->SetFillColor();
994cdf0e10cSrcweir 								pWindow->DrawRect(aRegionRectangle);
995cdf0e10cSrcweir 							}
996cdf0e10cSrcweir 
997cdf0e10cSrcweir 							aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
998cdf0e10cSrcweir 						}
999cdf0e10cSrcweir #endif
1000cdf0e10cSrcweir 					}
1001cdf0e10cSrcweir 				}
1002cdf0e10cSrcweir 			}
1003cdf0e10cSrcweir 
1004cdf0e10cSrcweir 			// prepare redraw
1005cdf0e10cSrcweir 			pKnownTarget->PrepareRedraw(aOptimizedRepaintRegion);
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir 			// remember prepared SdrPageWindow
1008cdf0e10cSrcweir 			mpPageView->setPreparedPageWindow(pKnownTarget);
1009cdf0e10cSrcweir 		}
1010cdf0e10cSrcweir 	}
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir 	return pPaintWindow;
1013cdf0e10cSrcweir }
1014cdf0e10cSrcweir 
1015cdf0e10cSrcweir void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer)
1016cdf0e10cSrcweir {
1017cdf0e10cSrcweir 	// #i74769# use EndCompleteRedraw() as common base
1018cdf0e10cSrcweir 	EndCompleteRedraw(rPaintWindow, bPaintFormLayer);
1019cdf0e10cSrcweir 
1020cdf0e10cSrcweir 	if(mpPageView)
1021cdf0e10cSrcweir 	{
1022cdf0e10cSrcweir 		// forget prepared SdrPageWindow
1023cdf0e10cSrcweir 		mpPageView->setPreparedPageWindow(0);
1024cdf0e10cSrcweir 	}
1025cdf0e10cSrcweir }
1026cdf0e10cSrcweir 
1027cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1028cdf0e10cSrcweir 
1029cdf0e10cSrcweir void SdrPaintView::ImpTextEditDrawing(SdrPaintWindow& rPaintWindow) const
1030cdf0e10cSrcweir {
1031cdf0e10cSrcweir 	// draw old text edit stuff
1032cdf0e10cSrcweir 	if(IsTextEdit())
1033cdf0e10cSrcweir 	{
1034cdf0e10cSrcweir 		SdrPageView* pPageView = GetTextEditPageView();
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir 		if(pPageView)
1037cdf0e10cSrcweir 		{
1038cdf0e10cSrcweir 			// paint TextEdit directly to the destination OutDev
1039cdf0e10cSrcweir 			const Region& rRedrawRegion = rPaintWindow.GetRedrawRegion();
1040cdf0e10cSrcweir 			const Rectangle aCheckRect(rRedrawRegion.GetBoundRect());
1041cdf0e10cSrcweir 			pPageView->PaintOutlinerView(&rPaintWindow.GetOutputDevice(), aCheckRect);
1042cdf0e10cSrcweir 		}
1043cdf0e10cSrcweir 	}
1044cdf0e10cSrcweir }
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir void SdrPaintView::ImpFormLayerDrawing(SdrPaintWindow& rPaintWindow) const
1047cdf0e10cSrcweir {
1048cdf0e10cSrcweir 	if(mpPageView)
1049cdf0e10cSrcweir 	{
1050cdf0e10cSrcweir 		SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(rPaintWindow);
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir 		if(pKnownTarget)
1053cdf0e10cSrcweir 		{
1054cdf0e10cSrcweir 			const SdrModel& rModel = *(GetModel());
1055cdf0e10cSrcweir 			const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
1056cdf0e10cSrcweir 			const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir 			// BUFFERED use GetTargetOutputDevice() now, it may be targeted to VDevs, too
1059cdf0e10cSrcweir 			// need to set PreparedPageWindow to make DrawLayer use the correct ObjectContact
1060cdf0e10cSrcweir 			mpPageView->setPreparedPageWindow(pKnownTarget);
1061cdf0e10cSrcweir 			mpPageView->DrawLayer(nControlLayerId, &rPaintWindow.GetTargetOutputDevice());
1062cdf0e10cSrcweir 			mpPageView->setPreparedPageWindow(0);
1063cdf0e10cSrcweir 		}
1064cdf0e10cSrcweir 	}
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir 
1067cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1068cdf0e10cSrcweir 
1069cdf0e10cSrcweir sal_Bool SdrPaintView::KeyInput(const KeyEvent& /*rKEvt*/, Window* /*pWin*/)
1070cdf0e10cSrcweir {
1071cdf0e10cSrcweir 	return sal_False;
1072cdf0e10cSrcweir }
1073cdf0e10cSrcweir 
1074cdf0e10cSrcweir void SdrPaintView::GlueInvalidate() const
1075cdf0e10cSrcweir {
1076cdf0e10cSrcweir 	const sal_uInt32 nWindowCount(PaintWindowCount());
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir 	for(sal_uInt32 nWinNum(0L); nWinNum < nWindowCount; nWinNum++)
1079cdf0e10cSrcweir 	{
1080cdf0e10cSrcweir 		SdrPaintWindow* pPaintWindow = GetPaintWindow(nWinNum);
1081cdf0e10cSrcweir 
1082cdf0e10cSrcweir 		if(pPaintWindow->OutputToWindow())
1083cdf0e10cSrcweir 		{
1084cdf0e10cSrcweir 			OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir 			if(mpPageView)
1087cdf0e10cSrcweir 			{
1088cdf0e10cSrcweir 				const SdrObjList* pOL=mpPageView->GetObjList();
1089cdf0e10cSrcweir 				sal_uIntPtr nObjAnz=pOL->GetObjCount();
1090cdf0e10cSrcweir 				for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
1091cdf0e10cSrcweir 					const SdrObject* pObj=pOL->GetObj(nObjNum);
1092cdf0e10cSrcweir 					const SdrGluePointList* pGPL=pObj->GetGluePointList();
1093cdf0e10cSrcweir 					if (pGPL!=NULL && pGPL->GetCount()!=0) {
1094cdf0e10cSrcweir 						pGPL->Invalidate((Window&)rOutDev, pObj);
1095cdf0e10cSrcweir 					}
1096cdf0e10cSrcweir 				}
1097cdf0e10cSrcweir 			}
1098cdf0e10cSrcweir 		}
1099cdf0e10cSrcweir 	}
1100cdf0e10cSrcweir }
1101cdf0e10cSrcweir 
1102cdf0e10cSrcweir void SdrPaintView::InvalidateAllWin()
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir 	const sal_uInt32 nWindowCount(PaintWindowCount());
1105cdf0e10cSrcweir 
1106cdf0e10cSrcweir 	for(sal_uInt32 a(0L); a < nWindowCount; a++)
1107cdf0e10cSrcweir 	{
1108cdf0e10cSrcweir 		SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir 		if(pPaintWindow->OutputToWindow())
1111cdf0e10cSrcweir 		{
1112cdf0e10cSrcweir 			InvalidateOneWin((Window&)pPaintWindow->GetOutputDevice());
1113cdf0e10cSrcweir 		}
1114cdf0e10cSrcweir 	}
1115cdf0e10cSrcweir }
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir void SdrPaintView::InvalidateAllWin(const Rectangle& rRect, sal_Bool bPlus1Pix)
1118cdf0e10cSrcweir {
1119cdf0e10cSrcweir 	const sal_uInt32 nWindowCount(PaintWindowCount());
1120cdf0e10cSrcweir 
1121cdf0e10cSrcweir 	for(sal_uInt32 a(0L); a < nWindowCount; a++)
1122cdf0e10cSrcweir 	{
1123cdf0e10cSrcweir 		SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir 		if(pPaintWindow->OutputToWindow())
1126cdf0e10cSrcweir 		{
1127cdf0e10cSrcweir 			OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
1128cdf0e10cSrcweir 			Rectangle aRect(rRect);
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir 			if(bPlus1Pix)
1131cdf0e10cSrcweir 			{
1132cdf0e10cSrcweir 				Size aPixSiz(1,1);
1133cdf0e10cSrcweir 				Size aSiz(rOutDev.PixelToLogic(aPixSiz));
1134cdf0e10cSrcweir 				aRect.Left	()-=aSiz.Width();
1135cdf0e10cSrcweir 				aRect.Top	()-=aSiz.Height();
1136cdf0e10cSrcweir 				aRect.Right ()+=aSiz.Width();
1137cdf0e10cSrcweir 				aRect.Bottom()+=aSiz.Height();
1138cdf0e10cSrcweir 			}
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir 			Point aOrg(rOutDev.GetMapMode().GetOrigin());
1141cdf0e10cSrcweir 			aOrg.X()=-aOrg.X(); aOrg.Y()=-aOrg.Y();
1142cdf0e10cSrcweir 			Rectangle aOutRect(aOrg, rOutDev.GetOutputSize());
1143cdf0e10cSrcweir 
1144cdf0e10cSrcweir 			if (aRect.IsOver(aOutRect))
1145cdf0e10cSrcweir 			{
1146cdf0e10cSrcweir 				InvalidateOneWin((Window&)rOutDev, aRect);
1147cdf0e10cSrcweir 			}
1148cdf0e10cSrcweir 		}
1149cdf0e10cSrcweir 	}
1150cdf0e10cSrcweir }
1151cdf0e10cSrcweir 
1152cdf0e10cSrcweir void SdrPaintView::InvalidateOneWin(Window& rWin)
1153cdf0e10cSrcweir {
1154cdf0e10cSrcweir 	// #111096#
1155cdf0e10cSrcweir 	// do not erase background, that causes flicker (!)
1156cdf0e10cSrcweir 	rWin.Invalidate(INVALIDATE_NOERASE);
1157cdf0e10cSrcweir }
1158cdf0e10cSrcweir 
1159cdf0e10cSrcweir void SdrPaintView::InvalidateOneWin(Window& rWin, const Rectangle& rRect)
1160cdf0e10cSrcweir {
1161cdf0e10cSrcweir 	// #111096#
1162cdf0e10cSrcweir 	// do not erase background, that causes flicker (!)
1163cdf0e10cSrcweir 	rWin.Invalidate(rRect, INVALIDATE_NOERASE);
1164cdf0e10cSrcweir }
1165cdf0e10cSrcweir 
1166cdf0e10cSrcweir void SdrPaintView::LeaveOneGroup()
1167cdf0e10cSrcweir {
1168cdf0e10cSrcweir 	if(mpPageView)
1169cdf0e10cSrcweir 	{
1170cdf0e10cSrcweir 		mpPageView->LeaveOneGroup();
1171cdf0e10cSrcweir 	}
1172cdf0e10cSrcweir }
1173cdf0e10cSrcweir 
1174cdf0e10cSrcweir void SdrPaintView::LeaveAllGroup()
1175cdf0e10cSrcweir {
1176cdf0e10cSrcweir 	if(mpPageView)
1177cdf0e10cSrcweir 	{
1178cdf0e10cSrcweir 		mpPageView->LeaveAllGroup();
1179cdf0e10cSrcweir 	}
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir bool SdrPaintView::IsGroupEntered() const
1183cdf0e10cSrcweir {
1184cdf0e10cSrcweir 	if(mpPageView)
1185cdf0e10cSrcweir 	{
1186cdf0e10cSrcweir 		return (mpPageView->GetEnteredLevel() != 0);
1187cdf0e10cSrcweir 	}
1188cdf0e10cSrcweir 
1189cdf0e10cSrcweir 	return false;
1190cdf0e10cSrcweir }
1191cdf0e10cSrcweir 
1192cdf0e10cSrcweir void SdrPaintView::SetNotPersistDefaultAttr(const SfxItemSet& rAttr, sal_Bool /*bReplaceAll*/)
1193cdf0e10cSrcweir {
1194cdf0e10cSrcweir 	// bReplaceAll hat hier keinerlei Wirkung
1195cdf0e10cSrcweir 	sal_Bool bMeasure=ISA(SdrView) && ((SdrView*)this)->IsMeasureTool();
1196cdf0e10cSrcweir 	const SfxPoolItem *pPoolItem=NULL;
1197cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_LAYERID,sal_True,&pPoolItem)==SFX_ITEM_SET) {
1198cdf0e10cSrcweir 		SdrLayerID nLayerId=((const SdrLayerIdItem*)pPoolItem)->GetValue();
1199cdf0e10cSrcweir 		const SdrLayer* pLayer=pMod->GetLayerAdmin().GetLayerPerID(nLayerId);
1200cdf0e10cSrcweir 		if (pLayer!=NULL) {
1201cdf0e10cSrcweir 			if (bMeasure) aMeasureLayer=pLayer->GetName();
1202cdf0e10cSrcweir 			else aAktLayer=pLayer->GetName();
1203cdf0e10cSrcweir 		}
1204cdf0e10cSrcweir 	}
1205cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_LAYERNAME,sal_True,&pPoolItem)==SFX_ITEM_SET) {
1206cdf0e10cSrcweir 		if (bMeasure) aMeasureLayer=((const SdrLayerNameItem*)pPoolItem)->GetValue();
1207cdf0e10cSrcweir 		else aAktLayer=((const SdrLayerNameItem*)pPoolItem)->GetValue();
1208cdf0e10cSrcweir 	}
1209cdf0e10cSrcweir }
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir void SdrPaintView::MergeNotPersistDefaultAttr(SfxItemSet& rAttr, sal_Bool /*bOnlyHardAttr*/) const
1212cdf0e10cSrcweir {
1213cdf0e10cSrcweir 	// bOnlyHardAttr hat hier keinerlei Wirkung
1214cdf0e10cSrcweir 	sal_Bool bMeasure=ISA(SdrView) && ((SdrView*)this)->IsMeasureTool();
1215cdf0e10cSrcweir 	const XubString& aNam=bMeasure?aMeasureLayer:aAktLayer;
1216cdf0e10cSrcweir 	rAttr.Put(SdrLayerNameItem(aNam));
1217cdf0e10cSrcweir 	SdrLayerID nLayer=pMod->GetLayerAdmin().GetLayerID(aNam,sal_True);
1218cdf0e10cSrcweir 	if (nLayer!=SDRLAYER_NOTFOUND) {
1219cdf0e10cSrcweir 		rAttr.Put(SdrLayerIdItem(nLayer));
1220cdf0e10cSrcweir 	}
1221cdf0e10cSrcweir }
1222cdf0e10cSrcweir 
1223cdf0e10cSrcweir void SdrPaintView::SetDefaultAttr(const SfxItemSet& rAttr, sal_Bool bReplaceAll)
1224cdf0e10cSrcweir {
1225cdf0e10cSrcweir #ifdef DBG_UTIL
1226cdf0e10cSrcweir 	{
1227cdf0e10cSrcweir 		sal_Bool bHasEEFeatureItems=sal_False;
1228cdf0e10cSrcweir 		SfxItemIter aIter(rAttr);
1229cdf0e10cSrcweir 		const SfxPoolItem* pItem=aIter.FirstItem();
1230cdf0e10cSrcweir 		while (!bHasEEFeatureItems && pItem!=NULL) {
1231cdf0e10cSrcweir 			if (!IsInvalidItem(pItem)) {
1232cdf0e10cSrcweir 				sal_uInt16 nW=pItem->Which();
1233cdf0e10cSrcweir 				if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END) bHasEEFeatureItems=sal_True;
1234cdf0e10cSrcweir 			}
1235cdf0e10cSrcweir 			pItem=aIter.NextItem();
1236cdf0e10cSrcweir 		}
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir 		if(bHasEEFeatureItems)
1239cdf0e10cSrcweir 		{
1240cdf0e10cSrcweir 			String aMessage;
1241cdf0e10cSrcweir 			aMessage.AppendAscii("SdrPaintView::SetDefaultAttr(): Das setzen von EE_FEATURE-Items an der SdrView macht keinen Sinn! Es fuehrt nur zu Overhead und nicht mehr lesbaren Dokumenten.");
1242cdf0e10cSrcweir 			InfoBox(NULL, aMessage).Execute();
1243cdf0e10cSrcweir 		}
1244cdf0e10cSrcweir 	}
1245cdf0e10cSrcweir #endif
1246cdf0e10cSrcweir 	if (bReplaceAll) aDefaultAttr.Set(rAttr);
1247cdf0e10cSrcweir 	else aDefaultAttr.Put(rAttr,sal_False); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
1248cdf0e10cSrcweir 	SetNotPersistDefaultAttr(rAttr,bReplaceAll);
1249cdf0e10cSrcweir #ifdef DBG_UTIL
1250cdf0e10cSrcweir 	if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1251cdf0e10cSrcweir #endif
1252cdf0e10cSrcweir }
1253cdf0e10cSrcweir 
1254cdf0e10cSrcweir void SdrPaintView::SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
1255cdf0e10cSrcweir {
1256cdf0e10cSrcweir 	if (pDefaultStyleSheet)
1257cdf0e10cSrcweir         EndListening(*pDefaultStyleSheet);
1258cdf0e10cSrcweir     pDefaultStyleSheet=pStyleSheet;
1259cdf0e10cSrcweir     if (pDefaultStyleSheet)
1260cdf0e10cSrcweir         StartListening(*pDefaultStyleSheet);
1261cdf0e10cSrcweir 
1262cdf0e10cSrcweir 	if (pStyleSheet!=NULL && !bDontRemoveHardAttr) {
1263cdf0e10cSrcweir 		SfxWhichIter aIter(pStyleSheet->GetItemSet());
1264cdf0e10cSrcweir 		sal_uInt16 nWhich=aIter.FirstWhich();
1265cdf0e10cSrcweir 		while (nWhich!=0) {
1266cdf0e10cSrcweir 			if (pStyleSheet->GetItemSet().GetItemState(nWhich,sal_True)==SFX_ITEM_SET) {
1267cdf0e10cSrcweir 				aDefaultAttr.ClearItem(nWhich);
1268cdf0e10cSrcweir 			}
1269cdf0e10cSrcweir 			nWhich=aIter.NextWhich();
1270cdf0e10cSrcweir 		}
1271cdf0e10cSrcweir 	}
1272cdf0e10cSrcweir #ifdef DBG_UTIL
1273cdf0e10cSrcweir 	if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1274cdf0e10cSrcweir #endif
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir 
1277cdf0e10cSrcweir /* new interface src537 */
1278cdf0e10cSrcweir sal_Bool SdrPaintView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
1279cdf0e10cSrcweir {
1280cdf0e10cSrcweir 	if(bOnlyHardAttr || !pDefaultStyleSheet)
1281cdf0e10cSrcweir 	{
1282cdf0e10cSrcweir 		rTargetSet.Put(aDefaultAttr, sal_False);
1283cdf0e10cSrcweir 	}
1284cdf0e10cSrcweir 	else
1285cdf0e10cSrcweir 	{
1286cdf0e10cSrcweir 		// sonst DefStyleSheet dazumergen
1287cdf0e10cSrcweir 		rTargetSet.Put(pDefaultStyleSheet->GetItemSet(), sal_False);
1288cdf0e10cSrcweir 		rTargetSet.Put(aDefaultAttr, sal_False);
1289cdf0e10cSrcweir 	}
1290cdf0e10cSrcweir 	MergeNotPersistDefaultAttr(rTargetSet, bOnlyHardAttr);
1291cdf0e10cSrcweir 	return sal_True;
1292cdf0e10cSrcweir }
1293cdf0e10cSrcweir 
1294cdf0e10cSrcweir sal_Bool SdrPaintView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
1295cdf0e10cSrcweir {
1296cdf0e10cSrcweir 	SetDefaultAttr(rSet,bReplaceAll);
1297cdf0e10cSrcweir 	return sal_True;
1298cdf0e10cSrcweir }
1299cdf0e10cSrcweir 
1300cdf0e10cSrcweir SfxStyleSheet* SdrPaintView::GetStyleSheet() const // SfxStyleSheet* SdrPaintView::GetStyleSheet(sal_Bool& rOk) const
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir 	//rOk=sal_True;
1303cdf0e10cSrcweir 	return GetDefaultStyleSheet();
1304cdf0e10cSrcweir }
1305cdf0e10cSrcweir 
1306cdf0e10cSrcweir sal_Bool SdrPaintView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
1307cdf0e10cSrcweir {
1308cdf0e10cSrcweir 	SetDefaultStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1309cdf0e10cSrcweir 	return sal_True;
1310cdf0e10cSrcweir }
1311cdf0e10cSrcweir 
1312cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1313cdf0e10cSrcweir 
1314cdf0e10cSrcweir #ifdef DBG_UTIL
1315cdf0e10cSrcweir void SdrPaintView::ShowItemBrowser(sal_Bool bShow)
1316cdf0e10cSrcweir {
1317cdf0e10cSrcweir 	if (bShow) {
1318cdf0e10cSrcweir 		if (pItemBrowser==NULL) {
1319cdf0e10cSrcweir 			pItemBrowser=new SdrItemBrowser(*(SdrView*)this);
1320cdf0e10cSrcweir 			pItemBrowser->SetFloatingMode(sal_True);
1321cdf0e10cSrcweir 		}
1322cdf0e10cSrcweir 		pItemBrowser->Show();
1323cdf0e10cSrcweir 		pItemBrowser->GrabFocus();
1324cdf0e10cSrcweir 	} else {
1325cdf0e10cSrcweir 		if (pItemBrowser!=NULL) {
1326cdf0e10cSrcweir 			pItemBrowser->Hide();
1327cdf0e10cSrcweir 			delete pItemBrowser;
1328cdf0e10cSrcweir 			pItemBrowser=NULL;
1329cdf0e10cSrcweir 		}
1330cdf0e10cSrcweir 	}
1331cdf0e10cSrcweir }
1332cdf0e10cSrcweir #endif
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir void SdrPaintView::MakeVisible(const Rectangle& rRect, Window& rWin)
1335cdf0e10cSrcweir {
1336cdf0e10cSrcweir 	MapMode aMap(rWin.GetMapMode());
1337cdf0e10cSrcweir 	Size aActualSize(rWin.GetOutputSize());
1338cdf0e10cSrcweir 
1339cdf0e10cSrcweir 	if( aActualSize.Height() > 0 && aActualSize.Width() > 0 )
1340cdf0e10cSrcweir 	{
1341cdf0e10cSrcweir 		Size aNewSize(rRect.GetSize());
1342cdf0e10cSrcweir 		sal_Bool bNewScale=sal_False;
1343cdf0e10cSrcweir 		sal_Bool bNeedMoreX=aNewSize.Width()>aActualSize.Width();
1344cdf0e10cSrcweir 		sal_Bool bNeedMoreY=aNewSize.Height()>aActualSize.Height();
1345cdf0e10cSrcweir 		if (bNeedMoreX || bNeedMoreY)
1346cdf0e10cSrcweir 		{
1347cdf0e10cSrcweir 			bNewScale=sal_True;
1348cdf0e10cSrcweir 			// Neuen MapMode (Size+Org) setzen und dabei alles invalidieren
1349cdf0e10cSrcweir 			Fraction aXFact(aNewSize.Width(),aActualSize.Width());
1350cdf0e10cSrcweir 			Fraction aYFact(aNewSize.Height(),aActualSize.Height());
1351cdf0e10cSrcweir 			if (aYFact>aXFact) aXFact=aYFact;
1352cdf0e10cSrcweir 			aXFact*=aMap.GetScaleX();
1353cdf0e10cSrcweir 			aXFact.ReduceInaccurate(10); // Um Ueberlaeufe und BigInt-Mapping zu vermeiden
1354cdf0e10cSrcweir 			aMap.SetScaleX(aXFact);
1355cdf0e10cSrcweir 			aMap.SetScaleY(aYFact);
1356cdf0e10cSrcweir 			rWin.SetMapMode(aMap);
1357cdf0e10cSrcweir 			aActualSize=rWin.GetOutputSize();
1358cdf0e10cSrcweir 		}
1359cdf0e10cSrcweir 		Point aOrg(aMap.GetOrigin());
1360cdf0e10cSrcweir 		long dx=0,dy=0;
1361cdf0e10cSrcweir 		long l=-aOrg.X();
1362cdf0e10cSrcweir 		long r=-aOrg.X()+aActualSize.Width()-1;
1363cdf0e10cSrcweir 		long o=-aOrg.Y();
1364cdf0e10cSrcweir 		long u=-aOrg.Y()+aActualSize.Height()-1;
1365cdf0e10cSrcweir 		if (l>rRect.Left()) dx=rRect.Left()-l;
1366cdf0e10cSrcweir 		else if (r<rRect.Right()) dx=rRect.Right()-r;
1367cdf0e10cSrcweir 		if (o>rRect.Top()) dy=rRect.Top()-o;
1368cdf0e10cSrcweir 		else if (u<rRect.Bottom()) dy=rRect.Bottom()-u;
1369cdf0e10cSrcweir 		aMap.SetOrigin(Point(aOrg.X()-dx,aOrg.Y()-dy));
1370cdf0e10cSrcweir 		if (!bNewScale) {
1371cdf0e10cSrcweir 			if (dx!=0 || dy!=0) {
1372cdf0e10cSrcweir 				rWin.Scroll(-dx,-dy);
1373cdf0e10cSrcweir 				rWin.SetMapMode(aMap);
1374cdf0e10cSrcweir 				rWin.Update();
1375cdf0e10cSrcweir 			}
1376cdf0e10cSrcweir 		} else {
1377cdf0e10cSrcweir 			rWin.SetMapMode(aMap);
1378cdf0e10cSrcweir 			InvalidateOneWin(rWin);
1379cdf0e10cSrcweir 		}
1380cdf0e10cSrcweir 	}
1381cdf0e10cSrcweir }
1382cdf0e10cSrcweir 
1383cdf0e10cSrcweir void SdrPaintView::DoConnect(SdrOle2Obj* /*pOleObj*/)
1384cdf0e10cSrcweir {
1385cdf0e10cSrcweir }
1386cdf0e10cSrcweir 
1387cdf0e10cSrcweir void SdrPaintView::SetAnimationEnabled( sal_Bool bEnable )
1388cdf0e10cSrcweir {
1389cdf0e10cSrcweir 	SetAnimationMode( bEnable ? SDR_ANIMATION_ANIMATE : SDR_ANIMATION_DISABLE );
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir 
1392cdf0e10cSrcweir void SdrPaintView::SetAnimationPause( bool bSet )
1393cdf0e10cSrcweir {
1394cdf0e10cSrcweir 	if((bool)bAnimationPause != bSet)
1395cdf0e10cSrcweir 	{
1396cdf0e10cSrcweir 		bAnimationPause = bSet;
1397cdf0e10cSrcweir 
1398cdf0e10cSrcweir 		if(mpPageView)
1399cdf0e10cSrcweir 		{
1400cdf0e10cSrcweir 			for(sal_uInt32 b(0L); b < mpPageView->PageWindowCount(); b++)
1401cdf0e10cSrcweir 			{
1402cdf0e10cSrcweir 				const SdrPageWindow& rPageWindow = *(mpPageView->GetPageWindow(b));
1403cdf0e10cSrcweir 				sdr::contact::ObjectContact& rObjectContact = rPageWindow.GetObjectContact();
1404cdf0e10cSrcweir 				sdr::animation::primitiveAnimator& rAnimator = rObjectContact.getPrimitiveAnimator();
1405cdf0e10cSrcweir 
1406cdf0e10cSrcweir 				if(rAnimator.IsPaused() != bSet)
1407cdf0e10cSrcweir 				{
1408cdf0e10cSrcweir 					rAnimator.SetPaused(bSet);
1409cdf0e10cSrcweir 				}
1410cdf0e10cSrcweir 			}
1411cdf0e10cSrcweir 		}
1412cdf0e10cSrcweir 	}
1413cdf0e10cSrcweir }
1414cdf0e10cSrcweir 
1415cdf0e10cSrcweir void SdrPaintView::SetAnimationMode( const SdrAnimationMode eMode )
1416cdf0e10cSrcweir {
1417cdf0e10cSrcweir 	eAnimationMode = eMode;
1418cdf0e10cSrcweir }
1419cdf0e10cSrcweir 
1420cdf0e10cSrcweir void SdrPaintView::VisAreaChanged(const OutputDevice* pOut)
1421cdf0e10cSrcweir {
1422cdf0e10cSrcweir 	if(mpPageView)
1423cdf0e10cSrcweir 	{
1424cdf0e10cSrcweir 		if (pOut)
1425cdf0e10cSrcweir 		{
1426cdf0e10cSrcweir 			SdrPageWindow* pWindow = mpPageView->FindPageWindow(*((OutputDevice*)pOut));
1427cdf0e10cSrcweir 
1428cdf0e10cSrcweir 			if(pWindow)
1429cdf0e10cSrcweir 			{
1430cdf0e10cSrcweir 				VisAreaChanged(*pWindow);
1431cdf0e10cSrcweir 			}
1432cdf0e10cSrcweir 		}
1433cdf0e10cSrcweir 		else
1434cdf0e10cSrcweir 		{
1435cdf0e10cSrcweir 			for(sal_uInt32 a(0L); a < mpPageView->PageWindowCount(); a++)
1436cdf0e10cSrcweir 			{
1437cdf0e10cSrcweir 				VisAreaChanged(*mpPageView->GetPageWindow(a));
1438cdf0e10cSrcweir 			}
1439cdf0e10cSrcweir 		}
1440cdf0e10cSrcweir 	}
1441cdf0e10cSrcweir }
1442cdf0e10cSrcweir 
1443cdf0e10cSrcweir void SdrPaintView::VisAreaChanged(const SdrPageWindow& /*rWindow*/)
1444cdf0e10cSrcweir {
1445cdf0e10cSrcweir     // notify SfxListener
1446cdf0e10cSrcweir     Broadcast(SvxViewHint(SvxViewHint::SVX_HINT_VIEWCHANGED));
1447cdf0e10cSrcweir }
1448cdf0e10cSrcweir 
1449cdf0e10cSrcweir const svtools::ColorConfig& SdrPaintView::getColorConfig() const
1450cdf0e10cSrcweir {
1451cdf0e10cSrcweir 	return maColorConfig;
1452cdf0e10cSrcweir }
1453cdf0e10cSrcweir 
1454cdf0e10cSrcweir void SdrPaintView::onChangeColorConfig()
1455cdf0e10cSrcweir {
1456cdf0e10cSrcweir     SetGridColor( Color( maColorConfig.GetColorValue( svtools::DRAWGRID ).nColor ) );
1457cdf0e10cSrcweir }
1458cdf0e10cSrcweir 
1459cdf0e10cSrcweir void SdrPaintView::SetGridColor( Color aColor )
1460cdf0e10cSrcweir {
1461cdf0e10cSrcweir 	maGridColor = aColor;
1462cdf0e10cSrcweir }
1463cdf0e10cSrcweir 
1464cdf0e10cSrcweir Color SdrPaintView::GetGridColor() const
1465cdf0e10cSrcweir {
1466cdf0e10cSrcweir 	return maGridColor;
1467cdf0e10cSrcweir }
1468cdf0e10cSrcweir 
1469cdf0e10cSrcweir // #103834# Set background color for svx at SdrPageViews
1470cdf0e10cSrcweir void SdrPaintView::SetApplicationBackgroundColor(Color aBackgroundColor)
1471cdf0e10cSrcweir {
1472cdf0e10cSrcweir 	if(mpPageView)
1473cdf0e10cSrcweir 	{
1474cdf0e10cSrcweir 		mpPageView->SetApplicationBackgroundColor(aBackgroundColor);
1475cdf0e10cSrcweir 	}
1476cdf0e10cSrcweir }
1477cdf0e10cSrcweir 
1478cdf0e10cSrcweir // #103911# Set document color for svx at SdrPageViews
1479cdf0e10cSrcweir void SdrPaintView::SetApplicationDocumentColor(Color aDocumentColor)
1480cdf0e10cSrcweir {
1481cdf0e10cSrcweir 	if(mpPageView)
1482cdf0e10cSrcweir 	{
1483cdf0e10cSrcweir 		mpPageView->SetApplicationDocumentColor(aDocumentColor);
1484cdf0e10cSrcweir 	}
1485cdf0e10cSrcweir }
1486cdf0e10cSrcweir 
1487cdf0e10cSrcweir // #114898#
1488cdf0e10cSrcweir bool SdrPaintView::IsBufferedOutputAllowed() const
1489cdf0e10cSrcweir {
1490cdf0e10cSrcweir 	return (mbBufferedOutputAllowed && maDrawinglayerOpt.IsPaintBuffer());
1491cdf0e10cSrcweir }
1492cdf0e10cSrcweir 
1493cdf0e10cSrcweir // #114898#
1494cdf0e10cSrcweir void SdrPaintView::SetBufferedOutputAllowed(bool bNew)
1495cdf0e10cSrcweir {
1496cdf0e10cSrcweir 	if(bNew != (bool)mbBufferedOutputAllowed)
1497cdf0e10cSrcweir 	{
1498cdf0e10cSrcweir 		mbBufferedOutputAllowed = bNew;
1499cdf0e10cSrcweir 	}
1500cdf0e10cSrcweir }
1501cdf0e10cSrcweir 
1502cdf0e10cSrcweir bool SdrPaintView::IsBufferedOverlayAllowed() const
1503cdf0e10cSrcweir {
1504cdf0e10cSrcweir 	return (mbBufferedOverlayAllowed && maDrawinglayerOpt.IsOverlayBuffer());
1505cdf0e10cSrcweir }
1506cdf0e10cSrcweir 
1507cdf0e10cSrcweir void SdrPaintView::SetBufferedOverlayAllowed(bool bNew)
1508cdf0e10cSrcweir {
1509cdf0e10cSrcweir 	if(bNew != (bool)mbBufferedOverlayAllowed)
1510cdf0e10cSrcweir 	{
1511cdf0e10cSrcweir 		mbBufferedOverlayAllowed = bNew;
1512cdf0e10cSrcweir 	}
1513cdf0e10cSrcweir }
1514cdf0e10cSrcweir 
1515cdf0e10cSrcweir sal_Bool SdrPaintView::IsPagePaintingAllowed() const
1516cdf0e10cSrcweir {
1517cdf0e10cSrcweir 	return mbPagePaintingAllowed;
1518cdf0e10cSrcweir }
1519cdf0e10cSrcweir 
1520cdf0e10cSrcweir void SdrPaintView::SetPagePaintingAllowed(bool bNew)
1521cdf0e10cSrcweir {
1522cdf0e10cSrcweir 	if(bNew != (bool)mbPagePaintingAllowed)
1523cdf0e10cSrcweir 	{
1524cdf0e10cSrcweir 		mbPagePaintingAllowed = bNew;
1525cdf0e10cSrcweir 	}
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir 
1528cdf0e10cSrcweir // #i38135# Sets the timer for Object animations and restarts.
1529cdf0e10cSrcweir void SdrPaintView::SetAnimationTimer(sal_uInt32 nTime)
1530cdf0e10cSrcweir {
1531cdf0e10cSrcweir 	if(mpPageView)
1532cdf0e10cSrcweir 	{
1533cdf0e10cSrcweir 		// first, reset all timers at all windows to 0L
1534cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < mpPageView->PageWindowCount(); a++)
1535cdf0e10cSrcweir 		{
1536cdf0e10cSrcweir 			const SdrPageWindow& rPageWindow = *mpPageView->GetPageWindow(a);
1537cdf0e10cSrcweir 			sdr::contact::ObjectContact& rObjectContact = rPageWindow.GetObjectContact();
1538cdf0e10cSrcweir 			sdr::animation::primitiveAnimator& rAnimator = rObjectContact.getPrimitiveAnimator();
1539cdf0e10cSrcweir 			rAnimator.SetTime(nTime);
1540cdf0e10cSrcweir 		}
1541cdf0e10cSrcweir 	}
1542cdf0e10cSrcweir }
1543cdf0e10cSrcweir 
1544cdf0e10cSrcweir // eof
1545