xref: /aoo42x/main/svx/source/svdraw/svdpntv.cxx (revision e6f63103)
1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew 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 #include <svx/sdr/contact/objectcontact.hxx>
73cdf0e10cSrcweir #include <svx/sdr/animation/objectanimator.hxx>
74cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx>
759f63b866SArmin Le Grand #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
769f63b866SArmin Le Grand #include <basegfx/matrix/b2dhommatrixtools.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 
ImplEncirclementOverlay(const SdrPaintView & rView,const basegfx::B2DPoint & rStartPos)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 
~ImplEncirclementOverlay()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 
SetSecondPosition(const basegfx::B2DPoint & rNewPosition)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 
FindPaintWindow(const OutputDevice & rOut) const142cdf0e10cSrcweir 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 
GetPaintWindow(sal_uInt32 nIndex) const155cdf0e10cSrcweir 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 
AppendPaintWindow(SdrPaintWindow & rNew)165cdf0e10cSrcweir void SdrPaintView::AppendPaintWindow(SdrPaintWindow& rNew)
166cdf0e10cSrcweir {
167cdf0e10cSrcweir 	maPaintWindows.push_back(&rNew);
168cdf0e10cSrcweir }
169cdf0e10cSrcweir 
RemovePaintWindow(SdrPaintWindow & rOld)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 
GetFirstOutputDevice() const185cdf0e10cSrcweir 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 
SvxViewHint(HintType eHintType)199cdf0e10cSrcweir SvxViewHint::SvxViewHint (HintType eHintType)
200cdf0e10cSrcweir     : meHintType(eHintType)
201cdf0e10cSrcweir {
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
GetHintType(void) const204cdf0e10cSrcweir SvxViewHint::HintType SvxViewHint::GetHintType (void) const
205cdf0e10cSrcweir {
206cdf0e10cSrcweir     return meHintType;
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 
2109f63b866SArmin Le Grand ////////////////////////////////////////////////////////////////////////////////////////////////////
2119f63b866SArmin Le Grand 
convertMetafileToBitmapEx(const GDIMetaFile & rMtf,const basegfx::B2DRange & rTargetRange,const sal_uInt32 nMaximumQuadraticPixels)2129f63b866SArmin Le Grand BitmapEx convertMetafileToBitmapEx(
2139f63b866SArmin Le Grand     const GDIMetaFile& rMtf,
2149f63b866SArmin Le Grand     const basegfx::B2DRange& rTargetRange,
2159f63b866SArmin Le Grand     const sal_uInt32 nMaximumQuadraticPixels)
2169f63b866SArmin Le Grand {
2179f63b866SArmin Le Grand     BitmapEx aBitmapEx;
2189f63b866SArmin Le Grand 
2199f63b866SArmin Le Grand     if(rMtf.GetActionCount())
2209f63b866SArmin Le Grand     {
2219f63b866SArmin Le Grand 		const drawinglayer::primitive2d::Primitive2DReference aMtf(
2229f63b866SArmin Le Grand 			new drawinglayer::primitive2d::MetafilePrimitive2D(
2239f63b866SArmin Le Grand 				basegfx::tools::createScaleTranslateB2DHomMatrix(
2249f63b866SArmin Le Grand                     rTargetRange.getRange(),
2259f63b866SArmin Le Grand                     rTargetRange.getMinimum()),
2269f63b866SArmin Le Grand 				rMtf));
2279f63b866SArmin Le Grand         aBitmapEx = convertPrimitive2DSequenceToBitmapEx(
2289f63b866SArmin Le Grand     		drawinglayer::primitive2d::Primitive2DSequence(&aMtf, 1),
2299f63b866SArmin Le Grand             rTargetRange,
2309f63b866SArmin Le Grand             nMaximumQuadraticPixels);
2319f63b866SArmin Le Grand     }
2329f63b866SArmin Le Grand 
2339f63b866SArmin Le Grand     return aBitmapEx;
2349f63b866SArmin Le Grand }
2359f63b866SArmin Le Grand 
236cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
237cdf0e10cSrcweir 
238cdf0e10cSrcweir TYPEINIT2(SdrPaintView,SfxListener,SfxRepeatTarget);
239cdf0e10cSrcweir 
240cdf0e10cSrcweir DBG_NAME(SdrPaintView);
241cdf0e10cSrcweir 
ImpClearVars()242cdf0e10cSrcweir void SdrPaintView::ImpClearVars()
243cdf0e10cSrcweir {
244cdf0e10cSrcweir #ifdef DBG_UTIL
245cdf0e10cSrcweir 	pItemBrowser=NULL;
246cdf0e10cSrcweir #endif
247cdf0e10cSrcweir 	bPageVisible=sal_True;
248cdf0e10cSrcweir 	bPageBorderVisible=sal_True;
249cdf0e10cSrcweir 	bBordVisible=sal_True;
250cdf0e10cSrcweir 	bGridVisible=sal_True;
251cdf0e10cSrcweir 	bGridFront	=sal_False;
252cdf0e10cSrcweir 	bHlplVisible=sal_True;
253cdf0e10cSrcweir 	bHlplFront	=sal_True;
254cdf0e10cSrcweir 	bGlueVisible=sal_False;
255cdf0e10cSrcweir 	bGlueVisible2=sal_False;
256cdf0e10cSrcweir 	bGlueVisible3=sal_False;
257cdf0e10cSrcweir 	bGlueVisible4=sal_False;
258cdf0e10cSrcweir 	bSwapAsynchron=sal_False;
259cdf0e10cSrcweir 	bPrintPreview=sal_False;
260cdf0e10cSrcweir 	mbPreviewRenderer=sal_False;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	eAnimationMode = SDR_ANIMATION_ANIMATE;
263cdf0e10cSrcweir     bAnimationPause = sal_False;
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 	nHitTolPix=2;
266cdf0e10cSrcweir 	nMinMovPix=3;
267cdf0e10cSrcweir 	nHitTolLog=0;
268cdf0e10cSrcweir 	nMinMovLog=0;
269cdf0e10cSrcweir 	pActualOutDev=NULL;
270cdf0e10cSrcweir 	pDragWin=NULL;
271cdf0e10cSrcweir 	bRestoreColors=sal_True;
272cdf0e10cSrcweir 	pDefaultStyleSheet=NULL;
273cdf0e10cSrcweir 	bSomeObjChgdFlag=sal_False;
274cdf0e10cSrcweir     nGraphicManagerDrawMode = GRFMGR_DRAW_STANDARD;
275cdf0e10cSrcweir 	aComeBackTimer.SetTimeout(1);
276cdf0e10cSrcweir 	aComeBackTimer.SetTimeoutHdl(LINK(this,SdrPaintView,ImpComeBackHdl));
277cdf0e10cSrcweir 	String aNam;	// System::GetUserName() just return an empty string
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 	if (pMod)
280cdf0e10cSrcweir 		SetDefaultStyleSheet(pMod->GetDefaultStyleSheet(), sal_True);
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	aNam.ToUpperAscii();
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 	maGridColor = Color( COL_BLACK );
285cdf0e10cSrcweir 	BrkEncirclement();
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
SdrPaintView(SdrModel * pModel1,OutputDevice * pOut)288cdf0e10cSrcweir SdrPaintView::SdrPaintView(SdrModel* pModel1, OutputDevice* pOut)
289cdf0e10cSrcweir :	mpEncirclementOverlay(0L),
290cdf0e10cSrcweir 	mpPageView(0L),
291cdf0e10cSrcweir 	aDefaultAttr(pModel1->GetItemPool()),
292cdf0e10cSrcweir 	mbBufferedOutputAllowed(false),
293cdf0e10cSrcweir 	mbBufferedOverlayAllowed(false),
294cdf0e10cSrcweir 	mbPagePaintingAllowed(true),
295cdf0e10cSrcweir     mbHideOle(false),
296cdf0e10cSrcweir     mbHideChart(false),
297cdf0e10cSrcweir     mbHideDraw(false),
298cdf0e10cSrcweir     mbHideFormControl(false)
299cdf0e10cSrcweir {
300cdf0e10cSrcweir 	DBG_CTOR(SdrPaintView,NULL);
301cdf0e10cSrcweir 	pMod=pModel1;
302cdf0e10cSrcweir 	ImpClearVars();
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 	if(pOut)
305cdf0e10cSrcweir 	{
306cdf0e10cSrcweir 		AddWindowToPaintView(pOut);
307cdf0e10cSrcweir 	}
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 	// Flag zur Visualisierung von Gruppen
310cdf0e10cSrcweir 	bVisualizeEnteredGroup = sal_True;
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 	maColorConfig.AddListener(this);
313cdf0e10cSrcweir 	onChangeColorConfig();
314cdf0e10cSrcweir }
315cdf0e10cSrcweir 
~SdrPaintView()316cdf0e10cSrcweir SdrPaintView::~SdrPaintView()
317cdf0e10cSrcweir {
318cdf0e10cSrcweir 	DBG_DTOR(SdrPaintView,NULL);
319cdf0e10cSrcweir 	if (pDefaultStyleSheet)
320cdf0e10cSrcweir 		EndListening(*pDefaultStyleSheet);
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 	maColorConfig.RemoveListener(this);
323cdf0e10cSrcweir 	ClearPageView();
324cdf0e10cSrcweir 
325cdf0e10cSrcweir #ifdef DBG_UTIL
326cdf0e10cSrcweir 	if(pItemBrowser)
327cdf0e10cSrcweir 	{
328cdf0e10cSrcweir 		delete pItemBrowser;
329cdf0e10cSrcweir 	}
330cdf0e10cSrcweir #endif
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	// delete existing SdrPaintWindows
333cdf0e10cSrcweir 	while(!maPaintWindows.empty())
334cdf0e10cSrcweir 	{
335cdf0e10cSrcweir 		delete maPaintWindows.back();
336cdf0e10cSrcweir 		maPaintWindows.pop_back();
337cdf0e10cSrcweir 	}
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 	// #114409#-3 Migrate HelpLine
340cdf0e10cSrcweir 	BrkEncirclement();
341cdf0e10cSrcweir }
342cdf0e10cSrcweir 
343cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
344cdf0e10cSrcweir 
Notify(SfxBroadcaster & rBC,const SfxHint & rHint)345cdf0e10cSrcweir void __EXPORT SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir 	//If the stylesheet has been destroyed
348cdf0e10cSrcweir     if (&rBC == pDefaultStyleSheet)
349cdf0e10cSrcweir     {
350cdf0e10cSrcweir         if (rHint.ISA(SfxSimpleHint) && ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
351cdf0e10cSrcweir             pDefaultStyleSheet = NULL;
352cdf0e10cSrcweir         return;
353cdf0e10cSrcweir     }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 	sal_Bool bObjChg=!bSomeObjChgdFlag; // sal_True= auswerten fuer ComeBack-Timer
356cdf0e10cSrcweir 	if (bObjChg) {
357cdf0e10cSrcweir 		SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
358cdf0e10cSrcweir 		if (pSdrHint!=NULL) {
359cdf0e10cSrcweir 			SdrHintKind eKind=pSdrHint->GetKind();
360cdf0e10cSrcweir 			if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED) {
361cdf0e10cSrcweir 				if (bObjChg) {
362cdf0e10cSrcweir 					bSomeObjChgdFlag=sal_True;
363cdf0e10cSrcweir 					aComeBackTimer.Start();
364cdf0e10cSrcweir 				}
365cdf0e10cSrcweir 			}
366cdf0e10cSrcweir 			if (eKind==HINT_PAGEORDERCHG) {
367cdf0e10cSrcweir 				const SdrPage* pPg=pSdrHint->GetPage();
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 				if(pPg && !pPg->IsInserted())
370cdf0e10cSrcweir 				{
371cdf0e10cSrcweir 					if(mpPageView && mpPageView->GetPage() == pPg)
372cdf0e10cSrcweir 					{
373cdf0e10cSrcweir 						HideSdrPage();
374cdf0e10cSrcweir 					}
375cdf0e10cSrcweir 				}
376cdf0e10cSrcweir 			}
377cdf0e10cSrcweir 		}
378cdf0e10cSrcweir 	}
379cdf0e10cSrcweir }
380cdf0e10cSrcweir 
ConfigurationChanged(::utl::ConfigurationBroadcaster *,sal_uInt32)381cdf0e10cSrcweir void SdrPaintView::ConfigurationChanged( ::utl::ConfigurationBroadcaster* , sal_uInt32 )
382cdf0e10cSrcweir {
383cdf0e10cSrcweir 	onChangeColorConfig();
384cdf0e10cSrcweir 	InvalidateAllWin();
385cdf0e10cSrcweir }
386cdf0e10cSrcweir 
387cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
388cdf0e10cSrcweir 
IMPL_LINK_INLINE_START(SdrPaintView,ImpComeBackHdl,Timer *,EMPTYARG)389cdf0e10cSrcweir IMPL_LINK_INLINE_START(SdrPaintView,ImpComeBackHdl,Timer*,EMPTYARG)
390cdf0e10cSrcweir {
391cdf0e10cSrcweir 	if (bSomeObjChgdFlag) {
392cdf0e10cSrcweir 		bSomeObjChgdFlag=sal_False;
393cdf0e10cSrcweir 		ModelHasChanged();
394cdf0e10cSrcweir 	}
395cdf0e10cSrcweir 	return 0;
396cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SdrPaintView,ImpComeBackHdl,Timer *,pTimer)397cdf0e10cSrcweir IMPL_LINK_INLINE_END(SdrPaintView,ImpComeBackHdl,Timer*,pTimer)
398cdf0e10cSrcweir 
399cdf0e10cSrcweir void SdrPaintView::FlushComeBackTimer() const
400cdf0e10cSrcweir {
401cdf0e10cSrcweir 	if (bSomeObjChgdFlag) {
402cdf0e10cSrcweir 		// casting auf nonconst
403cdf0e10cSrcweir 		((SdrPaintView*)this)->ImpComeBackHdl(&((SdrPaintView*)this)->aComeBackTimer);
404cdf0e10cSrcweir 		((SdrPaintView*)this)->aComeBackTimer.Stop();
405cdf0e10cSrcweir 	}
406cdf0e10cSrcweir }
407cdf0e10cSrcweir 
ModelHasChanged()408cdf0e10cSrcweir void SdrPaintView::ModelHasChanged()
409cdf0e10cSrcweir {
410cdf0e10cSrcweir 	// Auch alle PageViews benachrichtigen
411cdf0e10cSrcweir 	if(mpPageView && !mpPageView->GetPage()->IsInserted())
412cdf0e10cSrcweir 	{
413cdf0e10cSrcweir 		HideSdrPage();
414cdf0e10cSrcweir 	}
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 	// test mpPageView here again, HideSdrPage() may have invalidated it.
417cdf0e10cSrcweir 	if(mpPageView)
418cdf0e10cSrcweir 	{
419cdf0e10cSrcweir 		mpPageView->ModelHasChanged();
420cdf0e10cSrcweir 	}
421cdf0e10cSrcweir 
422cdf0e10cSrcweir #ifdef DBG_UTIL
423cdf0e10cSrcweir 	if(pItemBrowser)
424cdf0e10cSrcweir 	{
425cdf0e10cSrcweir 		pItemBrowser->SetDirty();
426cdf0e10cSrcweir 	}
427cdf0e10cSrcweir #endif
428cdf0e10cSrcweir }
429cdf0e10cSrcweir 
430cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
431cdf0e10cSrcweir 
IsAction() const432cdf0e10cSrcweir sal_Bool SdrPaintView::IsAction() const
433cdf0e10cSrcweir {
434cdf0e10cSrcweir 	return IsEncirclement();
435cdf0e10cSrcweir }
436cdf0e10cSrcweir 
MovAction(const Point & rPnt)437cdf0e10cSrcweir void SdrPaintView::MovAction(const Point& rPnt)
438cdf0e10cSrcweir {
439cdf0e10cSrcweir 	if (IsEncirclement())
440cdf0e10cSrcweir 	{
441cdf0e10cSrcweir 		MovEncirclement(rPnt);
442cdf0e10cSrcweir 	}
443cdf0e10cSrcweir }
444cdf0e10cSrcweir 
EndAction()445cdf0e10cSrcweir void SdrPaintView::EndAction()
446cdf0e10cSrcweir {
447cdf0e10cSrcweir 	if(IsEncirclement())
448cdf0e10cSrcweir 	{
449cdf0e10cSrcweir 		EndEncirclement();
450cdf0e10cSrcweir 	}
451cdf0e10cSrcweir }
452cdf0e10cSrcweir 
BckAction()453cdf0e10cSrcweir void SdrPaintView::BckAction()
454cdf0e10cSrcweir {
455cdf0e10cSrcweir 	BrkEncirclement();
456cdf0e10cSrcweir }
457cdf0e10cSrcweir 
BrkAction()458cdf0e10cSrcweir void SdrPaintView::BrkAction()
459cdf0e10cSrcweir {
460cdf0e10cSrcweir 	BrkEncirclement();
461cdf0e10cSrcweir }
462cdf0e10cSrcweir 
TakeActionRect(Rectangle & rRect) const463cdf0e10cSrcweir void SdrPaintView::TakeActionRect(Rectangle& rRect) const
464cdf0e10cSrcweir {
465cdf0e10cSrcweir 	if(IsEncirclement())
466cdf0e10cSrcweir 	{
467cdf0e10cSrcweir 		rRect = Rectangle(aDragStat.GetStart(),aDragStat.GetNow());
468cdf0e10cSrcweir 	}
469cdf0e10cSrcweir }
470cdf0e10cSrcweir 
471cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
472cdf0e10cSrcweir // info about TextEdit. Default is sal_False.
IsTextEdit() const473cdf0e10cSrcweir bool SdrPaintView::IsTextEdit() const
474cdf0e10cSrcweir {
475cdf0e10cSrcweir 	return false;
476cdf0e10cSrcweir }
477cdf0e10cSrcweir 
478cdf0e10cSrcweir // info about TextEditPageView. Default is 0L.
GetTextEditPageView() const479cdf0e10cSrcweir SdrPageView* SdrPaintView::GetTextEditPageView() const
480cdf0e10cSrcweir {
481cdf0e10cSrcweir 	return 0L;
482cdf0e10cSrcweir }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
485cdf0e10cSrcweir 
ImpGetMinMovLogic(short nMinMov,const OutputDevice * pOut) const486cdf0e10cSrcweir sal_uInt16 SdrPaintView::ImpGetMinMovLogic(short nMinMov, const OutputDevice* pOut) const
487cdf0e10cSrcweir {
488cdf0e10cSrcweir 	if (nMinMov>=0) return sal_uInt16(nMinMov);
489cdf0e10cSrcweir 	if (pOut==NULL)
490cdf0e10cSrcweir 	{
491cdf0e10cSrcweir 		pOut = GetFirstOutputDevice();
492cdf0e10cSrcweir 	}
493cdf0e10cSrcweir 	if (pOut!=NULL) {
494cdf0e10cSrcweir 		return short(-pOut->PixelToLogic(Size(nMinMov,0)).Width());
495cdf0e10cSrcweir 	} else {
496cdf0e10cSrcweir 		return 0;
497cdf0e10cSrcweir 	}
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
ImpGetHitTolLogic(short nHitTol,const OutputDevice * pOut) const500cdf0e10cSrcweir sal_uInt16 SdrPaintView::ImpGetHitTolLogic(short nHitTol, const OutputDevice* pOut) const
501cdf0e10cSrcweir {
502cdf0e10cSrcweir 	if (nHitTol>=0) return sal_uInt16(nHitTol);
503cdf0e10cSrcweir 	if (pOut==NULL)
504cdf0e10cSrcweir 	{
505cdf0e10cSrcweir 		pOut = GetFirstOutputDevice();
506cdf0e10cSrcweir 	}
507cdf0e10cSrcweir 	if (pOut!=NULL) {
508cdf0e10cSrcweir 		return short(-pOut->PixelToLogic(Size(nHitTol,0)).Width());
509cdf0e10cSrcweir 	} else {
510cdf0e10cSrcweir 		return 0;
511cdf0e10cSrcweir 	}
512cdf0e10cSrcweir }
513cdf0e10cSrcweir 
TheresNewMapMode()514cdf0e10cSrcweir void SdrPaintView::TheresNewMapMode()
515cdf0e10cSrcweir {
516cdf0e10cSrcweir 	if (pActualOutDev!=NULL) {
517cdf0e10cSrcweir 		nHitTolLog=(sal_uInt16)((OutputDevice*)pActualOutDev)->PixelToLogic(Size(nHitTolPix,0)).Width();
518cdf0e10cSrcweir 		nMinMovLog=(sal_uInt16)((OutputDevice*)pActualOutDev)->PixelToLogic(Size(nMinMovPix,0)).Width();
519cdf0e10cSrcweir 	}
520cdf0e10cSrcweir }
521cdf0e10cSrcweir 
SetActualWin(const OutputDevice * pWin)522cdf0e10cSrcweir void SdrPaintView::SetActualWin(const OutputDevice* pWin)
523cdf0e10cSrcweir {
524cdf0e10cSrcweir 	pActualOutDev=pWin;
525cdf0e10cSrcweir 	TheresNewMapMode();
526cdf0e10cSrcweir }
527cdf0e10cSrcweir 
528cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
529cdf0e10cSrcweir 
BegEncirclement(const Point & rPnt)530cdf0e10cSrcweir void SdrPaintView::BegEncirclement(const Point& rPnt)
531cdf0e10cSrcweir {
532cdf0e10cSrcweir 	BrkAction();
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 	DBG_ASSERT(0L == mpEncirclementOverlay, "SdrSnapView::BegSetPageOrg: There exists a ImplPageOriginOverlay (!)");
535cdf0e10cSrcweir 	basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
536cdf0e10cSrcweir 	mpEncirclementOverlay = new ImplEncirclementOverlay(*this, aStartPos);
537cdf0e10cSrcweir 
538cdf0e10cSrcweir 	aDragStat.Reset(rPnt);
539cdf0e10cSrcweir 	aDragStat.SetMinMove(ImpGetMinMovLogic(-2,0L));
540cdf0e10cSrcweir 	aDragStat.NextPoint();
541cdf0e10cSrcweir }
542cdf0e10cSrcweir 
MovEncirclement(const Point & rPnt)543cdf0e10cSrcweir void SdrPaintView::MovEncirclement(const Point& rPnt)
544cdf0e10cSrcweir {
545cdf0e10cSrcweir 	if(IsEncirclement() && aDragStat.CheckMinMoved(rPnt))
546cdf0e10cSrcweir 	{
547cdf0e10cSrcweir 		aDragStat.NextMove(rPnt);
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 		DBG_ASSERT(mpEncirclementOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
550cdf0e10cSrcweir 		basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
551cdf0e10cSrcweir 		mpEncirclementOverlay->SetSecondPosition(aNewPos);
552cdf0e10cSrcweir 	}
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
EndEncirclement(sal_Bool bNoJustify)555cdf0e10cSrcweir Rectangle SdrPaintView::EndEncirclement(sal_Bool bNoJustify)
556cdf0e10cSrcweir {
557cdf0e10cSrcweir 	Rectangle aRetval;
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 	if(IsEncirclement())
560cdf0e10cSrcweir 	{
561cdf0e10cSrcweir 		if(aDragStat.IsMinMoved())
562cdf0e10cSrcweir 		{
563cdf0e10cSrcweir 			aRetval = Rectangle(aDragStat.GetStart(), aDragStat.GetNow());
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 			if(!bNoJustify)
566cdf0e10cSrcweir 			{
567cdf0e10cSrcweir 				aRetval.Justify();
568cdf0e10cSrcweir 			}
569cdf0e10cSrcweir 		}
570cdf0e10cSrcweir 
571cdf0e10cSrcweir 		// cleanup
572cdf0e10cSrcweir 		BrkEncirclement();
573cdf0e10cSrcweir 	}
574cdf0e10cSrcweir 
575cdf0e10cSrcweir 	return aRetval;
576cdf0e10cSrcweir }
577cdf0e10cSrcweir 
BrkEncirclement()578cdf0e10cSrcweir void SdrPaintView::BrkEncirclement()
579cdf0e10cSrcweir {
580cdf0e10cSrcweir 	if(IsEncirclement())
581cdf0e10cSrcweir 	{
582cdf0e10cSrcweir 		DBG_ASSERT(mpEncirclementOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
583cdf0e10cSrcweir 		delete mpEncirclementOverlay;
584cdf0e10cSrcweir 		mpEncirclementOverlay = 0L;
585cdf0e10cSrcweir 	}
586cdf0e10cSrcweir }
587cdf0e10cSrcweir 
588cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
589cdf0e10cSrcweir 
ClearPageView()590cdf0e10cSrcweir void SdrPaintView::ClearPageView()
591cdf0e10cSrcweir {
592cdf0e10cSrcweir 	BrkAction();
593cdf0e10cSrcweir 
594cdf0e10cSrcweir 	if(mpPageView)
595cdf0e10cSrcweir 	{
596cdf0e10cSrcweir 		InvalidateAllWin();
597cdf0e10cSrcweir 		delete mpPageView;
598cdf0e10cSrcweir 		mpPageView = 0L;
599cdf0e10cSrcweir 	}
600cdf0e10cSrcweir }
601cdf0e10cSrcweir 
ShowSdrPage(SdrPage * pPage)602cdf0e10cSrcweir SdrPageView* SdrPaintView::ShowSdrPage(SdrPage* pPage)
603cdf0e10cSrcweir {
604cdf0e10cSrcweir 	if(pPage && (!mpPageView || mpPageView->GetPage() != pPage))
605cdf0e10cSrcweir 	{
606cdf0e10cSrcweir 		if(mpPageView)
607cdf0e10cSrcweir 		{
608cdf0e10cSrcweir 			InvalidateAllWin();
609cdf0e10cSrcweir 			delete mpPageView;
610cdf0e10cSrcweir 		}
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 		mpPageView = new SdrPageView(pPage, *((SdrView*)this));
613cdf0e10cSrcweir 		mpPageView->Show();
614cdf0e10cSrcweir 	}
615cdf0e10cSrcweir 
616cdf0e10cSrcweir 	return mpPageView;
617cdf0e10cSrcweir }
618cdf0e10cSrcweir 
HideSdrPage()619cdf0e10cSrcweir void SdrPaintView::HideSdrPage()
620cdf0e10cSrcweir {
621cdf0e10cSrcweir 	if(mpPageView)
622cdf0e10cSrcweir 	{
623cdf0e10cSrcweir 		mpPageView->Hide();
624cdf0e10cSrcweir 		delete mpPageView;
625cdf0e10cSrcweir 		mpPageView = 0L;
626cdf0e10cSrcweir 	}
627cdf0e10cSrcweir }
628cdf0e10cSrcweir 
AddWindowToPaintView(OutputDevice * pNewWin)629cdf0e10cSrcweir void SdrPaintView::AddWindowToPaintView(OutputDevice* pNewWin)
630cdf0e10cSrcweir {
631cdf0e10cSrcweir 	DBG_ASSERT(pNewWin, "SdrPaintView::AddWindowToPaintView: No OutputDevice(!)");
632cdf0e10cSrcweir 	SdrPaintWindow* pNewPaintWindow = new SdrPaintWindow(*this, *pNewWin);
633cdf0e10cSrcweir 	AppendPaintWindow(*pNewPaintWindow);
634cdf0e10cSrcweir 
635cdf0e10cSrcweir 	if(mpPageView)
636cdf0e10cSrcweir 	{
637cdf0e10cSrcweir 		mpPageView->AddPaintWindowToPageView(*pNewPaintWindow);
638cdf0e10cSrcweir 	}
639cdf0e10cSrcweir 
640cdf0e10cSrcweir #ifdef DBG_UTIL
641cdf0e10cSrcweir 	if (pItemBrowser!=NULL)
642cdf0e10cSrcweir 		pItemBrowser->ForceParent();
643cdf0e10cSrcweir #endif
644cdf0e10cSrcweir }
645cdf0e10cSrcweir 
DeleteWindowFromPaintView(OutputDevice * pOldWin)646cdf0e10cSrcweir void SdrPaintView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
647cdf0e10cSrcweir {
648cdf0e10cSrcweir 	DBG_ASSERT(pOldWin, "SdrPaintView::DeleteWindowFromPaintView: No OutputDevice(!)");
649cdf0e10cSrcweir 	SdrPaintWindow* pCandidate = FindPaintWindow(*pOldWin);
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 	if(pCandidate)
652cdf0e10cSrcweir 	{
653cdf0e10cSrcweir 		if(mpPageView)
654cdf0e10cSrcweir 		{
655cdf0e10cSrcweir 			mpPageView->RemovePaintWindowFromPageView(*pCandidate);
656cdf0e10cSrcweir 		}
657cdf0e10cSrcweir 
658cdf0e10cSrcweir 		RemovePaintWindow(*pCandidate);
659cdf0e10cSrcweir 		delete pCandidate;
660cdf0e10cSrcweir 	}
661cdf0e10cSrcweir 
662cdf0e10cSrcweir #ifdef DBG_UTIL
663cdf0e10cSrcweir 	if (pItemBrowser!=NULL)
664cdf0e10cSrcweir 		pItemBrowser->ForceParent();
665cdf0e10cSrcweir #endif
666cdf0e10cSrcweir }
667cdf0e10cSrcweir 
SetLayerVisible(const XubString & rName,sal_Bool bShow)668cdf0e10cSrcweir void SdrPaintView::SetLayerVisible(const XubString& rName, sal_Bool bShow)
669cdf0e10cSrcweir {
670cdf0e10cSrcweir 	if(mpPageView)
671cdf0e10cSrcweir 	{
672cdf0e10cSrcweir 		mpPageView->SetLayerVisible(rName,bShow);
673cdf0e10cSrcweir 	}
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 	InvalidateAllWin();
676cdf0e10cSrcweir }
677cdf0e10cSrcweir 
IsLayerVisible(const XubString & rName) const678cdf0e10cSrcweir bool SdrPaintView::IsLayerVisible(const XubString& rName) const
679cdf0e10cSrcweir {
680cdf0e10cSrcweir 	if(mpPageView)
681cdf0e10cSrcweir 	{
682cdf0e10cSrcweir 		return mpPageView->IsLayerVisible(rName);
683cdf0e10cSrcweir 	}
684cdf0e10cSrcweir 
685cdf0e10cSrcweir 	return false;
686cdf0e10cSrcweir }
687cdf0e10cSrcweir 
SetAllLayersVisible(sal_Bool bShow)688cdf0e10cSrcweir void SdrPaintView::SetAllLayersVisible(sal_Bool bShow)
689cdf0e10cSrcweir {
690cdf0e10cSrcweir 	if(mpPageView)
691cdf0e10cSrcweir 	{
692cdf0e10cSrcweir 		mpPageView->SetAllLayersVisible(bShow);
693cdf0e10cSrcweir 	}
694cdf0e10cSrcweir 
695cdf0e10cSrcweir 	InvalidateAllWin();
696cdf0e10cSrcweir }
697cdf0e10cSrcweir 
SetLayerLocked(const XubString & rName,sal_Bool bLock)698cdf0e10cSrcweir void SdrPaintView::SetLayerLocked(const XubString& rName, sal_Bool bLock)
699cdf0e10cSrcweir {
700cdf0e10cSrcweir 	if(mpPageView)
701cdf0e10cSrcweir 	{
702cdf0e10cSrcweir 		mpPageView->SetLayerLocked(rName,bLock);
703cdf0e10cSrcweir 	}
704cdf0e10cSrcweir }
705cdf0e10cSrcweir 
IsLayerLocked(const XubString & rName) const706cdf0e10cSrcweir bool SdrPaintView::IsLayerLocked(const XubString& rName) const
707cdf0e10cSrcweir {
708cdf0e10cSrcweir 	if(mpPageView)
709cdf0e10cSrcweir 	{
710cdf0e10cSrcweir 		return mpPageView->IsLayerLocked(rName);
711cdf0e10cSrcweir 	}
712cdf0e10cSrcweir 
713cdf0e10cSrcweir 	return false;
714cdf0e10cSrcweir }
715cdf0e10cSrcweir 
SetAllLayersLocked(sal_Bool bLock)716cdf0e10cSrcweir void SdrPaintView::SetAllLayersLocked(sal_Bool bLock)
717cdf0e10cSrcweir {
718cdf0e10cSrcweir 	if(mpPageView)
719cdf0e10cSrcweir 	{
720cdf0e10cSrcweir 		mpPageView->SetAllLayersLocked(bLock);
721cdf0e10cSrcweir 	}
722cdf0e10cSrcweir }
723cdf0e10cSrcweir 
SetLayerPrintable(const XubString & rName,sal_Bool bPrn)724cdf0e10cSrcweir void SdrPaintView::SetLayerPrintable(const XubString& rName, sal_Bool bPrn)
725cdf0e10cSrcweir {
726cdf0e10cSrcweir 	if(mpPageView)
727cdf0e10cSrcweir 	{
728cdf0e10cSrcweir 		mpPageView->SetLayerPrintable(rName,bPrn);
729cdf0e10cSrcweir 	}
730cdf0e10cSrcweir }
731cdf0e10cSrcweir 
IsLayerPrintable(const XubString & rName) const732cdf0e10cSrcweir bool SdrPaintView::IsLayerPrintable(const XubString& rName) const
733cdf0e10cSrcweir {
734cdf0e10cSrcweir 	if(mpPageView)
735cdf0e10cSrcweir 	{
736cdf0e10cSrcweir 		return mpPageView->IsLayerPrintable(rName);
737cdf0e10cSrcweir 	}
738cdf0e10cSrcweir 
739cdf0e10cSrcweir 	return false;
740cdf0e10cSrcweir }
741cdf0e10cSrcweir 
SetAllLayersPrintable(sal_Bool bPrn)742cdf0e10cSrcweir void SdrPaintView::SetAllLayersPrintable(sal_Bool bPrn)
743cdf0e10cSrcweir {
744cdf0e10cSrcweir 	if(mpPageView)
745cdf0e10cSrcweir 	{
746cdf0e10cSrcweir 		mpPageView->SetAllLayersPrintable(bPrn);
747cdf0e10cSrcweir 	}
748cdf0e10cSrcweir }
749cdf0e10cSrcweir 
PrePaint()750cdf0e10cSrcweir void SdrPaintView::PrePaint()
751cdf0e10cSrcweir {
752cdf0e10cSrcweir 	if(mpPageView)
753cdf0e10cSrcweir 	{
754cdf0e10cSrcweir 		mpPageView->PrePaint();
755cdf0e10cSrcweir 	}
756cdf0e10cSrcweir }
757cdf0e10cSrcweir 
PostPaint()758cdf0e10cSrcweir void SdrPaintView::PostPaint()
759cdf0e10cSrcweir {
760cdf0e10cSrcweir 	if(mpPageView)
761cdf0e10cSrcweir 	{
762cdf0e10cSrcweir 		mpPageView->PostPaint();
763cdf0e10cSrcweir 	}
764cdf0e10cSrcweir }
765cdf0e10cSrcweir 
766cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
767cdf0e10cSrcweir // #define SVX_REPAINT_TIMER_TEST
768cdf0e10cSrcweir 
CompleteRedraw(OutputDevice * pOut,const Region & rReg,sdr::contact::ViewObjectContactRedirector * pRedirector)769cdf0e10cSrcweir void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector)
770cdf0e10cSrcweir {
771cdf0e10cSrcweir #ifdef SVX_REPAINT_TIMER_TEST
772cdf0e10cSrcweir #define REMEMBERED_TIMES_COUNT	(10)
773cdf0e10cSrcweir 	static bool bDoTimerTest(false);
774cdf0e10cSrcweir 	static bool bTimesInited(false);
775cdf0e10cSrcweir 	static sal_uInt32 nRepeatCount(10L);
776cdf0e10cSrcweir 	static double fLastTimes[REMEMBERED_TIMES_COUNT];
777cdf0e10cSrcweir 	const sal_uInt32 nStartTime(Time::GetSystemTicks());
778cdf0e10cSrcweir 	sal_uInt32 count(1L);
779cdf0e10cSrcweir 	sal_uInt32 a;
780cdf0e10cSrcweir 
781cdf0e10cSrcweir 	if(bDoTimerTest)
782cdf0e10cSrcweir 	{
783cdf0e10cSrcweir 		count = nRepeatCount;
784cdf0e10cSrcweir 	}
785cdf0e10cSrcweir 
786cdf0e10cSrcweir 	for(a = 0L; a < count; a++)
787cdf0e10cSrcweir 	{
788cdf0e10cSrcweir #endif // SVX_REPAINT_TIMER_TEST
789cdf0e10cSrcweir 
790cdf0e10cSrcweir 	// #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
791cdf0e10cSrcweir 	// rReg may be made more granular (fine) with using it. Normally, rReg
792cdf0e10cSrcweir 	// does come from Window::Paint() anyways and thus is based on a single
793cdf0e10cSrcweir 	// rectangle which was derived from exactly that repaint region
794cdf0e10cSrcweir 	Region aOptimizedRepaintRegion(rReg);
795cdf0e10cSrcweir 
796cdf0e10cSrcweir 	if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType())
797cdf0e10cSrcweir 	{
798cdf0e10cSrcweir 		Window* pWindow = (Window*)pOut;
799cdf0e10cSrcweir 
800cdf0e10cSrcweir 		if(pWindow->IsInPaint())
801cdf0e10cSrcweir 		{
802cdf0e10cSrcweir 			if(!pWindow->GetPaintRegion().IsEmpty())
803cdf0e10cSrcweir 			{
804cdf0e10cSrcweir 				aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
805cdf0e10cSrcweir 
806cdf0e10cSrcweir #ifdef DBG_UTIL
807cdf0e10cSrcweir 				// #i74769# test-paint repaint region
808cdf0e10cSrcweir 				static bool bDoPaintForVisualControl(false);
809cdf0e10cSrcweir 
810*e6f63103SArmin Le Grand                 if(bDoPaintForVisualControl)
811*e6f63103SArmin Le Grand 				{
812*e6f63103SArmin Le Grand                     RectangleVector aRectangles;
813*e6f63103SArmin Le Grand                     aOptimizedRepaintRegion.GetRegionRectangles(aRectangles);
814*e6f63103SArmin Le Grand 
815*e6f63103SArmin Le Grand                     pWindow->SetLineColor(COL_LIGHTGREEN);
816*e6f63103SArmin Le Grand                     pWindow->SetFillColor();
817*e6f63103SArmin Le Grand 
818*e6f63103SArmin Le Grand                     for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
819*e6f63103SArmin Le Grand                     {
820*e6f63103SArmin Le Grand                         pWindow->DrawRect(*aRectIter);
821*e6f63103SArmin Le Grand                     }
822*e6f63103SArmin Le Grand 
823*e6f63103SArmin Le Grand 					//RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
824*e6f63103SArmin Le Grand 					//Rectangle aRegionRectangle;
825*e6f63103SArmin Le Grand 					//
826*e6f63103SArmin Le Grand 					//while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
827*e6f63103SArmin Le Grand 					//{
828*e6f63103SArmin Le Grand 					//	pWindow->SetLineColor(COL_LIGHTGREEN);
829*e6f63103SArmin Le Grand 					//	pWindow->SetFillColor();
830*e6f63103SArmin Le Grand 					//	pWindow->DrawRect(aRegionRectangle);
831*e6f63103SArmin Le Grand 					//}
832*e6f63103SArmin Le Grand                     //
833*e6f63103SArmin Le Grand 					//aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
834cdf0e10cSrcweir 				}
835cdf0e10cSrcweir #endif
836cdf0e10cSrcweir 			}
837cdf0e10cSrcweir 		}
838cdf0e10cSrcweir 	}
839cdf0e10cSrcweir 
840cdf0e10cSrcweir 	SdrPaintWindow* pPaintWindow = BeginCompleteRedraw(pOut);
841cdf0e10cSrcweir 	OSL_ENSURE(pPaintWindow, "SdrPaintView::CompleteRedraw: No OutDev (!)");
842cdf0e10cSrcweir 
843cdf0e10cSrcweir 	DoCompleteRedraw(*pPaintWindow, aOptimizedRepaintRegion, pRedirector);
844cdf0e10cSrcweir 	EndCompleteRedraw(*pPaintWindow, true);
845cdf0e10cSrcweir 
846cdf0e10cSrcweir #ifdef SVX_REPAINT_TIMER_TEST
847cdf0e10cSrcweir 	}
848cdf0e10cSrcweir 
849cdf0e10cSrcweir 	if(bDoTimerTest)
850cdf0e10cSrcweir 	{
851cdf0e10cSrcweir 		const sal_uInt32 nStopTime(Time::GetSystemTicks());
852cdf0e10cSrcweir 		const sal_uInt32 nNeededTime(nStopTime - nStartTime);
853cdf0e10cSrcweir 		const double fTimePerPaint((double)nNeededTime / (double)nRepeatCount);
854cdf0e10cSrcweir 
855cdf0e10cSrcweir 		if(!bTimesInited)
856cdf0e10cSrcweir 		{
857cdf0e10cSrcweir 			for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
858cdf0e10cSrcweir 			{
859cdf0e10cSrcweir 				fLastTimes[a] = fTimePerPaint;
860cdf0e10cSrcweir 			}
861cdf0e10cSrcweir 
862cdf0e10cSrcweir 			bTimesInited = true;
863cdf0e10cSrcweir 		}
864cdf0e10cSrcweir 		else
865cdf0e10cSrcweir 		{
866cdf0e10cSrcweir 			for(a = 1L; a < REMEMBERED_TIMES_COUNT; a++)
867cdf0e10cSrcweir 			{
868cdf0e10cSrcweir 				fLastTimes[a - 1L] = fLastTimes[a];
869cdf0e10cSrcweir 			}
870cdf0e10cSrcweir 
871cdf0e10cSrcweir 			fLastTimes[REMEMBERED_TIMES_COUNT - 1L] = fTimePerPaint;
872cdf0e10cSrcweir 		}
873cdf0e10cSrcweir 
874cdf0e10cSrcweir 		double fAddedTimes(0.0);
875cdf0e10cSrcweir 
876cdf0e10cSrcweir 		for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
877cdf0e10cSrcweir 		{
878cdf0e10cSrcweir 			fAddedTimes += fLastTimes[a];
879cdf0e10cSrcweir 		}
880cdf0e10cSrcweir 
881cdf0e10cSrcweir 		const double fAverageTimePerPaint(fAddedTimes / (double)REMEMBERED_TIMES_COUNT);
882cdf0e10cSrcweir 
883cdf0e10cSrcweir 		fprintf(stderr, "-----------(start result)----------\n");
884cdf0e10cSrcweir 		fprintf(stderr, "StartTime : %u, StopTime: %u, NeededTime: %u, TimePerPaint: %f\n", nStartTime, nStopTime, nNeededTime, fTimePerPaint);
885cdf0e10cSrcweir 		fprintf(stderr, "Remembered times: ");
886cdf0e10cSrcweir 
887cdf0e10cSrcweir 		for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
888cdf0e10cSrcweir 		{
889cdf0e10cSrcweir 			fprintf(stderr, "%d: %f ", a, fLastTimes[a]);
890cdf0e10cSrcweir 		}
891cdf0e10cSrcweir 
892cdf0e10cSrcweir 		fprintf(stderr, "\n");
893cdf0e10cSrcweir 		fprintf(stderr, "AverageTimePerPaint: %f\n", fAverageTimePerPaint);
894cdf0e10cSrcweir 		fprintf(stderr, "-----------(stop result)----------\n");
895cdf0e10cSrcweir 	}
896cdf0e10cSrcweir #endif // SVX_REPAINT_TIMER_TEST
897cdf0e10cSrcweir }
898cdf0e10cSrcweir 
899cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
900cdf0e10cSrcweir // #i72889#
901cdf0e10cSrcweir 
BeginCompleteRedraw(OutputDevice * pOut)902cdf0e10cSrcweir SdrPaintWindow* SdrPaintView::BeginCompleteRedraw(OutputDevice* pOut)
903cdf0e10cSrcweir {
904cdf0e10cSrcweir 	OSL_ENSURE(pOut, "SdrPaintView::BeginCompleteRedraw: No OutDev (!)");
905cdf0e10cSrcweir 	SdrPaintWindow* pPaintWindow = FindPaintWindow(*pOut);
906cdf0e10cSrcweir 
907cdf0e10cSrcweir 	if(pPaintWindow)
908cdf0e10cSrcweir 	{
909cdf0e10cSrcweir 		// draw preprocessing, only for known devices
910cdf0e10cSrcweir 		// prepare PreRendering
911cdf0e10cSrcweir 		pPaintWindow->PreparePreRenderDevice();
912cdf0e10cSrcweir 	}
913cdf0e10cSrcweir 	else
914cdf0e10cSrcweir 	{
915cdf0e10cSrcweir 		// None of the known OutputDevices is the target of this paint, use
916cdf0e10cSrcweir 		// a temporary SdrPaintWindow for this Redraw.
917cdf0e10cSrcweir 		pPaintWindow = new SdrPaintWindow(*this, *pOut);
918cdf0e10cSrcweir 		pPaintWindow->setTemporaryTarget(true);
919cdf0e10cSrcweir 	}
920cdf0e10cSrcweir 
921cdf0e10cSrcweir 	return pPaintWindow;
922cdf0e10cSrcweir }
923cdf0e10cSrcweir 
DoCompleteRedraw(SdrPaintWindow & rPaintWindow,const Region & rReg,sdr::contact::ViewObjectContactRedirector * pRedirector)924cdf0e10cSrcweir void SdrPaintView::DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector)
925cdf0e10cSrcweir {
926cdf0e10cSrcweir 	// redraw all PageViews with the target. This may expand the RedrawRegion
927cdf0e10cSrcweir 	// at the PaintWindow, plus taking care of FormLayer expansion
928cdf0e10cSrcweir 	if(mpPageView)
929cdf0e10cSrcweir 	{
930cdf0e10cSrcweir 		mpPageView->CompleteRedraw(rPaintWindow, rReg, pRedirector);
931cdf0e10cSrcweir 	}
932cdf0e10cSrcweir }
933cdf0e10cSrcweir 
EndCompleteRedraw(SdrPaintWindow & rPaintWindow,bool bPaintFormLayer)934cdf0e10cSrcweir void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer)
935cdf0e10cSrcweir {
936cdf0e10cSrcweir 	if(rPaintWindow.getTemporaryTarget())
937cdf0e10cSrcweir 	{
938cdf0e10cSrcweir 		// get rid of temp target again
939cdf0e10cSrcweir 		delete (&rPaintWindow);
940cdf0e10cSrcweir 	}
941cdf0e10cSrcweir 	else
942cdf0e10cSrcweir 	{
943cdf0e10cSrcweir 		// draw postprocessing, only for known devices
944cdf0e10cSrcweir 		// it is necessary to always paint FormLayer
945cdf0e10cSrcweir         if(bPaintFormLayer)
946cdf0e10cSrcweir         {
947cdf0e10cSrcweir 		    ImpFormLayerDrawing(rPaintWindow);
948cdf0e10cSrcweir         }
949cdf0e10cSrcweir 
950cdf0e10cSrcweir 		// look for active TextEdit. As long as this cannot be painted to a VDev,
951cdf0e10cSrcweir 		// it cannot get part of buffering. In that case, output evtl. prerender
952cdf0e10cSrcweir 		// early and paint text edit to window.
953a56bd57bSArmin Le Grand 		if(IsTextEdit() && GetSdrPageView())
954cdf0e10cSrcweir 		{
955a56bd57bSArmin Le Grand 			static_cast< SdrView* >(this)->TextEditDrawing(rPaintWindow);
956cdf0e10cSrcweir 		}
957cdf0e10cSrcweir 
958a56bd57bSArmin Le Grand 		// draw Overlay, also to PreRender device if exists
959a56bd57bSArmin Le Grand 		rPaintWindow.DrawOverlay(rPaintWindow.GetRedrawRegion());
960a56bd57bSArmin Le Grand 
961a56bd57bSArmin Le Grand 		// output PreRendering
962a56bd57bSArmin Le Grand 		rPaintWindow.OutputPreRenderDevice(rPaintWindow.GetRedrawRegion());
963cdf0e10cSrcweir 	}
964cdf0e10cSrcweir }
965cdf0e10cSrcweir 
966cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
967cdf0e10cSrcweir 
BeginDrawLayers(OutputDevice * pOut,const Region & rReg,bool bDisableIntersect)968cdf0e10cSrcweir SdrPaintWindow* SdrPaintView::BeginDrawLayers(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect)
969cdf0e10cSrcweir {
970cdf0e10cSrcweir 	// #i74769# use BeginCompleteRedraw() as common base
971cdf0e10cSrcweir 	SdrPaintWindow* pPaintWindow = BeginCompleteRedraw(pOut);
972cdf0e10cSrcweir 	OSL_ENSURE(pPaintWindow, "SdrPaintView::BeginDrawLayers: No SdrPaintWindow (!)");
973cdf0e10cSrcweir 
974cdf0e10cSrcweir 	if(mpPageView)
975cdf0e10cSrcweir 	{
976cdf0e10cSrcweir 		SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(*pPaintWindow);
977cdf0e10cSrcweir 
978cdf0e10cSrcweir 		if(pKnownTarget)
979cdf0e10cSrcweir 		{
980cdf0e10cSrcweir 			// #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
981cdf0e10cSrcweir 			// rReg may be made more granular (fine) with using it. Normally, rReg
982cdf0e10cSrcweir 			// does come from Window::Paint() anyways and thus is based on a single
983cdf0e10cSrcweir 			// rectangle which was derived from exactly that repaint region
984cdf0e10cSrcweir 			Region aOptimizedRepaintRegion(rReg);
985cdf0e10cSrcweir 
986cdf0e10cSrcweir 			// #i76114# Intersecting the region with the Window's paint region is disabled
987cdf0e10cSrcweir 			// for print preview in Calc, because the intersection can be empty (if the paint
988cdf0e10cSrcweir 			// region is outside of the table area of the page), and then no clip region
989cdf0e10cSrcweir 			// would be set.
990cdf0e10cSrcweir 			if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType() && !bDisableIntersect)
991cdf0e10cSrcweir 			{
992cdf0e10cSrcweir 				Window* pWindow = (Window*)pOut;
993cdf0e10cSrcweir 
994cdf0e10cSrcweir 				if(pWindow->IsInPaint())
995cdf0e10cSrcweir 				{
996cdf0e10cSrcweir 					if(!pWindow->GetPaintRegion().IsEmpty())
997cdf0e10cSrcweir 					{
998cdf0e10cSrcweir 						aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir #ifdef DBG_UTIL
1001cdf0e10cSrcweir 						// #i74769# test-paint repaint region
1002cdf0e10cSrcweir 						static bool bDoPaintForVisualControl(false);
1003*e6f63103SArmin Le Grand 
1004*e6f63103SArmin Le Grand                         if(bDoPaintForVisualControl)
1005cdf0e10cSrcweir 						{
1006*e6f63103SArmin Le Grand                             RectangleVector aRectangles;
1007*e6f63103SArmin Le Grand                             aOptimizedRepaintRegion.GetRegionRectangles(aRectangles);
1008*e6f63103SArmin Le Grand 
1009*e6f63103SArmin Le Grand                             pWindow->SetLineColor(COL_LIGHTGREEN);
1010*e6f63103SArmin Le Grand                             pWindow->SetFillColor();
1011*e6f63103SArmin Le Grand 
1012*e6f63103SArmin Le Grand                             for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
1013*e6f63103SArmin Le Grand                             {
1014*e6f63103SArmin Le Grand                                 pWindow->DrawRect(*aRectIter);
1015*e6f63103SArmin Le Grand                             }
1016*e6f63103SArmin Le Grand 
1017*e6f63103SArmin Le Grand 							//RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
1018*e6f63103SArmin Le Grand 							//Rectangle aRegionRectangle;
1019*e6f63103SArmin Le Grand 							//
1020*e6f63103SArmin Le Grand 							//while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
1021*e6f63103SArmin Le Grand 							//{
1022*e6f63103SArmin Le Grand 							//	pWindow->SetLineColor(COL_LIGHTGREEN);
1023*e6f63103SArmin Le Grand 							//	pWindow->SetFillColor();
1024*e6f63103SArmin Le Grand 							//	pWindow->DrawRect(aRegionRectangle);
1025*e6f63103SArmin Le Grand 							//}
1026*e6f63103SArmin Le Grand                             //
1027*e6f63103SArmin Le Grand 							//aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
1028cdf0e10cSrcweir 						}
1029cdf0e10cSrcweir #endif
1030cdf0e10cSrcweir 					}
1031cdf0e10cSrcweir 				}
1032cdf0e10cSrcweir 			}
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir 			// prepare redraw
1035cdf0e10cSrcweir 			pKnownTarget->PrepareRedraw(aOptimizedRepaintRegion);
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir 			// remember prepared SdrPageWindow
1038cdf0e10cSrcweir 			mpPageView->setPreparedPageWindow(pKnownTarget);
1039cdf0e10cSrcweir 		}
1040cdf0e10cSrcweir 	}
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir 	return pPaintWindow;
1043cdf0e10cSrcweir }
1044cdf0e10cSrcweir 
EndDrawLayers(SdrPaintWindow & rPaintWindow,bool bPaintFormLayer)1045cdf0e10cSrcweir void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer)
1046cdf0e10cSrcweir {
1047cdf0e10cSrcweir 	// #i74769# use EndCompleteRedraw() as common base
1048cdf0e10cSrcweir 	EndCompleteRedraw(rPaintWindow, bPaintFormLayer);
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 	if(mpPageView)
1051cdf0e10cSrcweir 	{
1052cdf0e10cSrcweir 		// forget prepared SdrPageWindow
1053cdf0e10cSrcweir 		mpPageView->setPreparedPageWindow(0);
1054cdf0e10cSrcweir 	}
1055cdf0e10cSrcweir }
1056cdf0e10cSrcweir 
1057cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1058cdf0e10cSrcweir 
ImpFormLayerDrawing(SdrPaintWindow & rPaintWindow) const1059cdf0e10cSrcweir void SdrPaintView::ImpFormLayerDrawing(SdrPaintWindow& rPaintWindow) const
1060cdf0e10cSrcweir {
1061cdf0e10cSrcweir 	if(mpPageView)
1062cdf0e10cSrcweir 	{
1063cdf0e10cSrcweir 		SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(rPaintWindow);
1064cdf0e10cSrcweir 
1065cdf0e10cSrcweir 		if(pKnownTarget)
1066cdf0e10cSrcweir 		{
1067cdf0e10cSrcweir 			const SdrModel& rModel = *(GetModel());
1068cdf0e10cSrcweir 			const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
1069cdf0e10cSrcweir 			const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir 			// BUFFERED use GetTargetOutputDevice() now, it may be targeted to VDevs, too
1072cdf0e10cSrcweir 			// need to set PreparedPageWindow to make DrawLayer use the correct ObjectContact
1073cdf0e10cSrcweir 			mpPageView->setPreparedPageWindow(pKnownTarget);
1074cdf0e10cSrcweir 			mpPageView->DrawLayer(nControlLayerId, &rPaintWindow.GetTargetOutputDevice());
1075cdf0e10cSrcweir 			mpPageView->setPreparedPageWindow(0);
1076cdf0e10cSrcweir 		}
1077cdf0e10cSrcweir 	}
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1081cdf0e10cSrcweir 
KeyInput(const KeyEvent &,Window *)1082cdf0e10cSrcweir sal_Bool SdrPaintView::KeyInput(const KeyEvent& /*rKEvt*/, Window* /*pWin*/)
1083cdf0e10cSrcweir {
1084cdf0e10cSrcweir 	return sal_False;
1085cdf0e10cSrcweir }
1086cdf0e10cSrcweir 
GlueInvalidate() const1087cdf0e10cSrcweir void SdrPaintView::GlueInvalidate() const
1088cdf0e10cSrcweir {
1089cdf0e10cSrcweir 	const sal_uInt32 nWindowCount(PaintWindowCount());
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir 	for(sal_uInt32 nWinNum(0L); nWinNum < nWindowCount; nWinNum++)
1092cdf0e10cSrcweir 	{
1093cdf0e10cSrcweir 		SdrPaintWindow* pPaintWindow = GetPaintWindow(nWinNum);
1094cdf0e10cSrcweir 
1095cdf0e10cSrcweir 		if(pPaintWindow->OutputToWindow())
1096cdf0e10cSrcweir 		{
1097cdf0e10cSrcweir 			OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir 			if(mpPageView)
1100cdf0e10cSrcweir 			{
1101cdf0e10cSrcweir 				const SdrObjList* pOL=mpPageView->GetObjList();
1102cdf0e10cSrcweir 				sal_uIntPtr nObjAnz=pOL->GetObjCount();
1103cdf0e10cSrcweir 				for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
1104cdf0e10cSrcweir 					const SdrObject* pObj=pOL->GetObj(nObjNum);
1105cdf0e10cSrcweir 					const SdrGluePointList* pGPL=pObj->GetGluePointList();
1106cdf0e10cSrcweir 					if (pGPL!=NULL && pGPL->GetCount()!=0) {
1107cdf0e10cSrcweir 						pGPL->Invalidate((Window&)rOutDev, pObj);
1108cdf0e10cSrcweir 					}
1109cdf0e10cSrcweir 				}
1110cdf0e10cSrcweir 			}
1111cdf0e10cSrcweir 		}
1112cdf0e10cSrcweir 	}
1113cdf0e10cSrcweir }
1114cdf0e10cSrcweir 
InvalidateAllWin()1115cdf0e10cSrcweir void SdrPaintView::InvalidateAllWin()
1116cdf0e10cSrcweir {
1117cdf0e10cSrcweir 	const sal_uInt32 nWindowCount(PaintWindowCount());
1118cdf0e10cSrcweir 
1119cdf0e10cSrcweir 	for(sal_uInt32 a(0L); a < nWindowCount; a++)
1120cdf0e10cSrcweir 	{
1121cdf0e10cSrcweir 		SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir 		if(pPaintWindow->OutputToWindow())
1124cdf0e10cSrcweir 		{
1125cdf0e10cSrcweir 			InvalidateOneWin((Window&)pPaintWindow->GetOutputDevice());
1126cdf0e10cSrcweir 		}
1127cdf0e10cSrcweir 	}
1128cdf0e10cSrcweir }
1129cdf0e10cSrcweir 
InvalidateAllWin(const Rectangle & rRect,sal_Bool bPlus1Pix)1130cdf0e10cSrcweir void SdrPaintView::InvalidateAllWin(const Rectangle& rRect, sal_Bool bPlus1Pix)
1131cdf0e10cSrcweir {
1132cdf0e10cSrcweir 	const sal_uInt32 nWindowCount(PaintWindowCount());
1133cdf0e10cSrcweir 
1134cdf0e10cSrcweir 	for(sal_uInt32 a(0L); a < nWindowCount; a++)
1135cdf0e10cSrcweir 	{
1136cdf0e10cSrcweir 		SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
1137cdf0e10cSrcweir 
1138cdf0e10cSrcweir 		if(pPaintWindow->OutputToWindow())
1139cdf0e10cSrcweir 		{
1140cdf0e10cSrcweir 			OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
1141cdf0e10cSrcweir 			Rectangle aRect(rRect);
1142cdf0e10cSrcweir 
1143cdf0e10cSrcweir 			if(bPlus1Pix)
1144cdf0e10cSrcweir 			{
1145cdf0e10cSrcweir 				Size aPixSiz(1,1);
1146cdf0e10cSrcweir 				Size aSiz(rOutDev.PixelToLogic(aPixSiz));
1147cdf0e10cSrcweir 				aRect.Left	()-=aSiz.Width();
1148cdf0e10cSrcweir 				aRect.Top	()-=aSiz.Height();
1149cdf0e10cSrcweir 				aRect.Right ()+=aSiz.Width();
1150cdf0e10cSrcweir 				aRect.Bottom()+=aSiz.Height();
1151cdf0e10cSrcweir 			}
1152cdf0e10cSrcweir 
1153cdf0e10cSrcweir 			Point aOrg(rOutDev.GetMapMode().GetOrigin());
1154cdf0e10cSrcweir 			aOrg.X()=-aOrg.X(); aOrg.Y()=-aOrg.Y();
1155cdf0e10cSrcweir 			Rectangle aOutRect(aOrg, rOutDev.GetOutputSize());
1156cdf0e10cSrcweir 
1157cdf0e10cSrcweir 			if (aRect.IsOver(aOutRect))
1158cdf0e10cSrcweir 			{
1159cdf0e10cSrcweir 				InvalidateOneWin((Window&)rOutDev, aRect);
1160cdf0e10cSrcweir 			}
1161cdf0e10cSrcweir 		}
1162cdf0e10cSrcweir 	}
1163cdf0e10cSrcweir }
1164cdf0e10cSrcweir 
InvalidateOneWin(Window & rWin)1165cdf0e10cSrcweir void SdrPaintView::InvalidateOneWin(Window& rWin)
1166cdf0e10cSrcweir {
1167cdf0e10cSrcweir 	// #111096#
1168cdf0e10cSrcweir 	// do not erase background, that causes flicker (!)
1169cdf0e10cSrcweir 	rWin.Invalidate(INVALIDATE_NOERASE);
1170cdf0e10cSrcweir }
1171cdf0e10cSrcweir 
InvalidateOneWin(Window & rWin,const Rectangle & rRect)1172cdf0e10cSrcweir void SdrPaintView::InvalidateOneWin(Window& rWin, const Rectangle& rRect)
1173cdf0e10cSrcweir {
1174cdf0e10cSrcweir 	// #111096#
1175cdf0e10cSrcweir 	// do not erase background, that causes flicker (!)
1176cdf0e10cSrcweir 	rWin.Invalidate(rRect, INVALIDATE_NOERASE);
1177cdf0e10cSrcweir }
1178cdf0e10cSrcweir 
LeaveOneGroup()1179cdf0e10cSrcweir void SdrPaintView::LeaveOneGroup()
1180cdf0e10cSrcweir {
1181cdf0e10cSrcweir 	if(mpPageView)
1182cdf0e10cSrcweir 	{
1183cdf0e10cSrcweir 		mpPageView->LeaveOneGroup();
1184cdf0e10cSrcweir 	}
1185cdf0e10cSrcweir }
1186cdf0e10cSrcweir 
LeaveAllGroup()1187cdf0e10cSrcweir void SdrPaintView::LeaveAllGroup()
1188cdf0e10cSrcweir {
1189cdf0e10cSrcweir 	if(mpPageView)
1190cdf0e10cSrcweir 	{
1191cdf0e10cSrcweir 		mpPageView->LeaveAllGroup();
1192cdf0e10cSrcweir 	}
1193cdf0e10cSrcweir }
1194cdf0e10cSrcweir 
IsGroupEntered() const1195cdf0e10cSrcweir bool SdrPaintView::IsGroupEntered() const
1196cdf0e10cSrcweir {
1197cdf0e10cSrcweir 	if(mpPageView)
1198cdf0e10cSrcweir 	{
1199cdf0e10cSrcweir 		return (mpPageView->GetEnteredLevel() != 0);
1200cdf0e10cSrcweir 	}
1201cdf0e10cSrcweir 
1202cdf0e10cSrcweir 	return false;
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir 
SetNotPersistDefaultAttr(const SfxItemSet & rAttr,sal_Bool)1205cdf0e10cSrcweir void SdrPaintView::SetNotPersistDefaultAttr(const SfxItemSet& rAttr, sal_Bool /*bReplaceAll*/)
1206cdf0e10cSrcweir {
1207cdf0e10cSrcweir 	// bReplaceAll hat hier keinerlei Wirkung
1208cdf0e10cSrcweir 	sal_Bool bMeasure=ISA(SdrView) && ((SdrView*)this)->IsMeasureTool();
1209cdf0e10cSrcweir 	const SfxPoolItem *pPoolItem=NULL;
1210cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_LAYERID,sal_True,&pPoolItem)==SFX_ITEM_SET) {
1211cdf0e10cSrcweir 		SdrLayerID nLayerId=((const SdrLayerIdItem*)pPoolItem)->GetValue();
1212cdf0e10cSrcweir 		const SdrLayer* pLayer=pMod->GetLayerAdmin().GetLayerPerID(nLayerId);
1213cdf0e10cSrcweir 		if (pLayer!=NULL) {
1214cdf0e10cSrcweir 			if (bMeasure) aMeasureLayer=pLayer->GetName();
1215cdf0e10cSrcweir 			else aAktLayer=pLayer->GetName();
1216cdf0e10cSrcweir 		}
1217cdf0e10cSrcweir 	}
1218cdf0e10cSrcweir 	if (rAttr.GetItemState(SDRATTR_LAYERNAME,sal_True,&pPoolItem)==SFX_ITEM_SET) {
1219cdf0e10cSrcweir 		if (bMeasure) aMeasureLayer=((const SdrLayerNameItem*)pPoolItem)->GetValue();
1220cdf0e10cSrcweir 		else aAktLayer=((const SdrLayerNameItem*)pPoolItem)->GetValue();
1221cdf0e10cSrcweir 	}
1222cdf0e10cSrcweir }
1223cdf0e10cSrcweir 
MergeNotPersistDefaultAttr(SfxItemSet & rAttr,sal_Bool) const1224cdf0e10cSrcweir void SdrPaintView::MergeNotPersistDefaultAttr(SfxItemSet& rAttr, sal_Bool /*bOnlyHardAttr*/) const
1225cdf0e10cSrcweir {
1226cdf0e10cSrcweir 	// bOnlyHardAttr hat hier keinerlei Wirkung
1227cdf0e10cSrcweir 	sal_Bool bMeasure=ISA(SdrView) && ((SdrView*)this)->IsMeasureTool();
1228cdf0e10cSrcweir 	const XubString& aNam=bMeasure?aMeasureLayer:aAktLayer;
1229cdf0e10cSrcweir 	rAttr.Put(SdrLayerNameItem(aNam));
1230cdf0e10cSrcweir 	SdrLayerID nLayer=pMod->GetLayerAdmin().GetLayerID(aNam,sal_True);
1231cdf0e10cSrcweir 	if (nLayer!=SDRLAYER_NOTFOUND) {
1232cdf0e10cSrcweir 		rAttr.Put(SdrLayerIdItem(nLayer));
1233cdf0e10cSrcweir 	}
1234cdf0e10cSrcweir }
1235cdf0e10cSrcweir 
SetDefaultAttr(const SfxItemSet & rAttr,sal_Bool bReplaceAll)1236cdf0e10cSrcweir void SdrPaintView::SetDefaultAttr(const SfxItemSet& rAttr, sal_Bool bReplaceAll)
1237cdf0e10cSrcweir {
1238cdf0e10cSrcweir #ifdef DBG_UTIL
1239cdf0e10cSrcweir 	{
1240cdf0e10cSrcweir 		sal_Bool bHasEEFeatureItems=sal_False;
1241cdf0e10cSrcweir 		SfxItemIter aIter(rAttr);
1242cdf0e10cSrcweir 		const SfxPoolItem* pItem=aIter.FirstItem();
1243cdf0e10cSrcweir 		while (!bHasEEFeatureItems && pItem!=NULL) {
1244cdf0e10cSrcweir 			if (!IsInvalidItem(pItem)) {
1245cdf0e10cSrcweir 				sal_uInt16 nW=pItem->Which();
1246cdf0e10cSrcweir 				if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END) bHasEEFeatureItems=sal_True;
1247cdf0e10cSrcweir 			}
1248cdf0e10cSrcweir 			pItem=aIter.NextItem();
1249cdf0e10cSrcweir 		}
1250cdf0e10cSrcweir 
1251cdf0e10cSrcweir 		if(bHasEEFeatureItems)
1252cdf0e10cSrcweir 		{
1253cdf0e10cSrcweir 			String aMessage;
1254cdf0e10cSrcweir 			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.");
1255cdf0e10cSrcweir 			InfoBox(NULL, aMessage).Execute();
1256cdf0e10cSrcweir 		}
1257cdf0e10cSrcweir 	}
1258cdf0e10cSrcweir #endif
1259cdf0e10cSrcweir 	if (bReplaceAll) aDefaultAttr.Set(rAttr);
1260cdf0e10cSrcweir 	else aDefaultAttr.Put(rAttr,sal_False); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
1261cdf0e10cSrcweir 	SetNotPersistDefaultAttr(rAttr,bReplaceAll);
1262cdf0e10cSrcweir #ifdef DBG_UTIL
1263cdf0e10cSrcweir 	if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1264cdf0e10cSrcweir #endif
1265cdf0e10cSrcweir }
1266cdf0e10cSrcweir 
SetDefaultStyleSheet(SfxStyleSheet * pStyleSheet,sal_Bool bDontRemoveHardAttr)1267cdf0e10cSrcweir void SdrPaintView::SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
1268cdf0e10cSrcweir {
1269cdf0e10cSrcweir 	if (pDefaultStyleSheet)
1270cdf0e10cSrcweir         EndListening(*pDefaultStyleSheet);
1271cdf0e10cSrcweir     pDefaultStyleSheet=pStyleSheet;
1272cdf0e10cSrcweir     if (pDefaultStyleSheet)
1273cdf0e10cSrcweir         StartListening(*pDefaultStyleSheet);
1274cdf0e10cSrcweir 
1275cdf0e10cSrcweir 	if (pStyleSheet!=NULL && !bDontRemoveHardAttr) {
1276cdf0e10cSrcweir 		SfxWhichIter aIter(pStyleSheet->GetItemSet());
1277cdf0e10cSrcweir 		sal_uInt16 nWhich=aIter.FirstWhich();
1278cdf0e10cSrcweir 		while (nWhich!=0) {
1279cdf0e10cSrcweir 			if (pStyleSheet->GetItemSet().GetItemState(nWhich,sal_True)==SFX_ITEM_SET) {
1280cdf0e10cSrcweir 				aDefaultAttr.ClearItem(nWhich);
1281cdf0e10cSrcweir 			}
1282cdf0e10cSrcweir 			nWhich=aIter.NextWhich();
1283cdf0e10cSrcweir 		}
1284cdf0e10cSrcweir 	}
1285cdf0e10cSrcweir #ifdef DBG_UTIL
1286cdf0e10cSrcweir 	if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1287cdf0e10cSrcweir #endif
1288cdf0e10cSrcweir }
1289cdf0e10cSrcweir 
1290cdf0e10cSrcweir /* new interface src537 */
GetAttributes(SfxItemSet & rTargetSet,sal_Bool bOnlyHardAttr) const1291cdf0e10cSrcweir sal_Bool SdrPaintView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
1292cdf0e10cSrcweir {
1293cdf0e10cSrcweir 	if(bOnlyHardAttr || !pDefaultStyleSheet)
1294cdf0e10cSrcweir 	{
1295cdf0e10cSrcweir 		rTargetSet.Put(aDefaultAttr, sal_False);
1296cdf0e10cSrcweir 	}
1297cdf0e10cSrcweir 	else
1298cdf0e10cSrcweir 	{
1299cdf0e10cSrcweir 		// sonst DefStyleSheet dazumergen
1300cdf0e10cSrcweir 		rTargetSet.Put(pDefaultStyleSheet->GetItemSet(), sal_False);
1301cdf0e10cSrcweir 		rTargetSet.Put(aDefaultAttr, sal_False);
1302cdf0e10cSrcweir 	}
1303cdf0e10cSrcweir 	MergeNotPersistDefaultAttr(rTargetSet, bOnlyHardAttr);
1304cdf0e10cSrcweir 	return sal_True;
1305cdf0e10cSrcweir }
1306cdf0e10cSrcweir 
SetAttributes(const SfxItemSet & rSet,sal_Bool bReplaceAll)1307cdf0e10cSrcweir sal_Bool SdrPaintView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
1308cdf0e10cSrcweir {
1309cdf0e10cSrcweir 	SetDefaultAttr(rSet,bReplaceAll);
1310cdf0e10cSrcweir 	return sal_True;
1311cdf0e10cSrcweir }
1312cdf0e10cSrcweir 
GetStyleSheet() const1313cdf0e10cSrcweir SfxStyleSheet* SdrPaintView::GetStyleSheet() const // SfxStyleSheet* SdrPaintView::GetStyleSheet(sal_Bool& rOk) const
1314cdf0e10cSrcweir {
1315cdf0e10cSrcweir 	//rOk=sal_True;
1316cdf0e10cSrcweir 	return GetDefaultStyleSheet();
1317cdf0e10cSrcweir }
1318cdf0e10cSrcweir 
SetStyleSheet(SfxStyleSheet * pStyleSheet,sal_Bool bDontRemoveHardAttr)1319cdf0e10cSrcweir sal_Bool SdrPaintView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
1320cdf0e10cSrcweir {
1321cdf0e10cSrcweir 	SetDefaultStyleSheet(pStyleSheet,bDontRemoveHardAttr);
1322cdf0e10cSrcweir 	return sal_True;
1323cdf0e10cSrcweir }
1324cdf0e10cSrcweir 
1325cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir #ifdef DBG_UTIL
ShowItemBrowser(sal_Bool bShow)1328cdf0e10cSrcweir void SdrPaintView::ShowItemBrowser(sal_Bool bShow)
1329cdf0e10cSrcweir {
1330cdf0e10cSrcweir 	if (bShow) {
1331cdf0e10cSrcweir 		if (pItemBrowser==NULL) {
1332cdf0e10cSrcweir 			pItemBrowser=new SdrItemBrowser(*(SdrView*)this);
1333cdf0e10cSrcweir 			pItemBrowser->SetFloatingMode(sal_True);
1334cdf0e10cSrcweir 		}
1335cdf0e10cSrcweir 		pItemBrowser->Show();
1336cdf0e10cSrcweir 		pItemBrowser->GrabFocus();
1337cdf0e10cSrcweir 	} else {
1338cdf0e10cSrcweir 		if (pItemBrowser!=NULL) {
1339cdf0e10cSrcweir 			pItemBrowser->Hide();
1340cdf0e10cSrcweir 			delete pItemBrowser;
1341cdf0e10cSrcweir 			pItemBrowser=NULL;
1342cdf0e10cSrcweir 		}
1343cdf0e10cSrcweir 	}
1344cdf0e10cSrcweir }
1345cdf0e10cSrcweir #endif
1346cdf0e10cSrcweir 
MakeVisible(const Rectangle & rRect,Window & rWin)1347cdf0e10cSrcweir void SdrPaintView::MakeVisible(const Rectangle& rRect, Window& rWin)
1348cdf0e10cSrcweir {
1349cdf0e10cSrcweir 	MapMode aMap(rWin.GetMapMode());
1350cdf0e10cSrcweir 	Size aActualSize(rWin.GetOutputSize());
1351cdf0e10cSrcweir 
1352cdf0e10cSrcweir 	if( aActualSize.Height() > 0 && aActualSize.Width() > 0 )
1353cdf0e10cSrcweir 	{
1354cdf0e10cSrcweir 		Size aNewSize(rRect.GetSize());
1355cdf0e10cSrcweir 		sal_Bool bNewScale=sal_False;
1356cdf0e10cSrcweir 		sal_Bool bNeedMoreX=aNewSize.Width()>aActualSize.Width();
1357cdf0e10cSrcweir 		sal_Bool bNeedMoreY=aNewSize.Height()>aActualSize.Height();
1358cdf0e10cSrcweir 		if (bNeedMoreX || bNeedMoreY)
1359cdf0e10cSrcweir 		{
1360cdf0e10cSrcweir 			bNewScale=sal_True;
1361cdf0e10cSrcweir 			// Neuen MapMode (Size+Org) setzen und dabei alles invalidieren
1362cdf0e10cSrcweir 			Fraction aXFact(aNewSize.Width(),aActualSize.Width());
1363cdf0e10cSrcweir 			Fraction aYFact(aNewSize.Height(),aActualSize.Height());
1364cdf0e10cSrcweir 			if (aYFact>aXFact) aXFact=aYFact;
1365cdf0e10cSrcweir 			aXFact*=aMap.GetScaleX();
1366cdf0e10cSrcweir 			aXFact.ReduceInaccurate(10); // Um Ueberlaeufe und BigInt-Mapping zu vermeiden
1367cdf0e10cSrcweir 			aMap.SetScaleX(aXFact);
1368cdf0e10cSrcweir 			aMap.SetScaleY(aYFact);
1369cdf0e10cSrcweir 			rWin.SetMapMode(aMap);
1370cdf0e10cSrcweir 			aActualSize=rWin.GetOutputSize();
1371cdf0e10cSrcweir 		}
1372cdf0e10cSrcweir 		Point aOrg(aMap.GetOrigin());
1373cdf0e10cSrcweir 		long dx=0,dy=0;
1374cdf0e10cSrcweir 		long l=-aOrg.X();
1375cdf0e10cSrcweir 		long r=-aOrg.X()+aActualSize.Width()-1;
1376cdf0e10cSrcweir 		long o=-aOrg.Y();
1377cdf0e10cSrcweir 		long u=-aOrg.Y()+aActualSize.Height()-1;
1378cdf0e10cSrcweir 		if (l>rRect.Left()) dx=rRect.Left()-l;
1379cdf0e10cSrcweir 		else if (r<rRect.Right()) dx=rRect.Right()-r;
1380cdf0e10cSrcweir 		if (o>rRect.Top()) dy=rRect.Top()-o;
1381cdf0e10cSrcweir 		else if (u<rRect.Bottom()) dy=rRect.Bottom()-u;
1382cdf0e10cSrcweir 		aMap.SetOrigin(Point(aOrg.X()-dx,aOrg.Y()-dy));
1383cdf0e10cSrcweir 		if (!bNewScale) {
1384cdf0e10cSrcweir 			if (dx!=0 || dy!=0) {
1385cdf0e10cSrcweir 				rWin.Scroll(-dx,-dy);
1386cdf0e10cSrcweir 				rWin.SetMapMode(aMap);
1387cdf0e10cSrcweir 				rWin.Update();
1388cdf0e10cSrcweir 			}
1389cdf0e10cSrcweir 		} else {
1390cdf0e10cSrcweir 			rWin.SetMapMode(aMap);
1391cdf0e10cSrcweir 			InvalidateOneWin(rWin);
1392cdf0e10cSrcweir 		}
1393cdf0e10cSrcweir 	}
1394cdf0e10cSrcweir }
1395cdf0e10cSrcweir 
DoConnect(SdrOle2Obj *)1396cdf0e10cSrcweir void SdrPaintView::DoConnect(SdrOle2Obj* /*pOleObj*/)
1397cdf0e10cSrcweir {
1398cdf0e10cSrcweir }
1399cdf0e10cSrcweir 
SetAnimationEnabled(sal_Bool bEnable)1400cdf0e10cSrcweir void SdrPaintView::SetAnimationEnabled( sal_Bool bEnable )
1401cdf0e10cSrcweir {
1402cdf0e10cSrcweir 	SetAnimationMode( bEnable ? SDR_ANIMATION_ANIMATE : SDR_ANIMATION_DISABLE );
1403cdf0e10cSrcweir }
1404cdf0e10cSrcweir 
SetAnimationPause(bool bSet)1405cdf0e10cSrcweir void SdrPaintView::SetAnimationPause( bool bSet )
1406cdf0e10cSrcweir {
1407cdf0e10cSrcweir 	if((bool)bAnimationPause != bSet)
1408cdf0e10cSrcweir 	{
1409cdf0e10cSrcweir 		bAnimationPause = bSet;
1410cdf0e10cSrcweir 
1411cdf0e10cSrcweir 		if(mpPageView)
1412cdf0e10cSrcweir 		{
1413cdf0e10cSrcweir 			for(sal_uInt32 b(0L); b < mpPageView->PageWindowCount(); b++)
1414cdf0e10cSrcweir 			{
1415cdf0e10cSrcweir 				const SdrPageWindow& rPageWindow = *(mpPageView->GetPageWindow(b));
1416cdf0e10cSrcweir 				sdr::contact::ObjectContact& rObjectContact = rPageWindow.GetObjectContact();
1417cdf0e10cSrcweir 				sdr::animation::primitiveAnimator& rAnimator = rObjectContact.getPrimitiveAnimator();
1418cdf0e10cSrcweir 
1419cdf0e10cSrcweir 				if(rAnimator.IsPaused() != bSet)
1420cdf0e10cSrcweir 				{
1421cdf0e10cSrcweir 					rAnimator.SetPaused(bSet);
1422cdf0e10cSrcweir 				}
1423cdf0e10cSrcweir 			}
1424cdf0e10cSrcweir 		}
1425cdf0e10cSrcweir 	}
1426cdf0e10cSrcweir }
1427cdf0e10cSrcweir 
SetAnimationMode(const SdrAnimationMode eMode)1428cdf0e10cSrcweir void SdrPaintView::SetAnimationMode( const SdrAnimationMode eMode )
1429cdf0e10cSrcweir {
1430cdf0e10cSrcweir 	eAnimationMode = eMode;
1431cdf0e10cSrcweir }
1432cdf0e10cSrcweir 
VisAreaChanged(const OutputDevice * pOut)1433cdf0e10cSrcweir void SdrPaintView::VisAreaChanged(const OutputDevice* pOut)
1434cdf0e10cSrcweir {
1435cdf0e10cSrcweir 	if(mpPageView)
1436cdf0e10cSrcweir 	{
1437cdf0e10cSrcweir 		if (pOut)
1438cdf0e10cSrcweir 		{
1439cdf0e10cSrcweir 			SdrPageWindow* pWindow = mpPageView->FindPageWindow(*((OutputDevice*)pOut));
1440cdf0e10cSrcweir 
1441cdf0e10cSrcweir 			if(pWindow)
1442cdf0e10cSrcweir 			{
1443cdf0e10cSrcweir 				VisAreaChanged(*pWindow);
1444cdf0e10cSrcweir 			}
1445cdf0e10cSrcweir 		}
1446cdf0e10cSrcweir 		else
1447cdf0e10cSrcweir 		{
1448cdf0e10cSrcweir 			for(sal_uInt32 a(0L); a < mpPageView->PageWindowCount(); a++)
1449cdf0e10cSrcweir 			{
1450cdf0e10cSrcweir 				VisAreaChanged(*mpPageView->GetPageWindow(a));
1451cdf0e10cSrcweir 			}
1452cdf0e10cSrcweir 		}
1453cdf0e10cSrcweir 	}
1454cdf0e10cSrcweir }
1455cdf0e10cSrcweir 
VisAreaChanged(const SdrPageWindow &)1456cdf0e10cSrcweir void SdrPaintView::VisAreaChanged(const SdrPageWindow& /*rWindow*/)
1457cdf0e10cSrcweir {
1458cdf0e10cSrcweir     // notify SfxListener
1459cdf0e10cSrcweir     Broadcast(SvxViewHint(SvxViewHint::SVX_HINT_VIEWCHANGED));
1460cdf0e10cSrcweir }
1461cdf0e10cSrcweir 
getColorConfig() const1462cdf0e10cSrcweir const svtools::ColorConfig& SdrPaintView::getColorConfig() const
1463cdf0e10cSrcweir {
1464cdf0e10cSrcweir 	return maColorConfig;
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir 
onChangeColorConfig()1467cdf0e10cSrcweir void SdrPaintView::onChangeColorConfig()
1468cdf0e10cSrcweir {
1469cdf0e10cSrcweir     SetGridColor( Color( maColorConfig.GetColorValue( svtools::DRAWGRID ).nColor ) );
1470cdf0e10cSrcweir }
1471cdf0e10cSrcweir 
SetGridColor(Color aColor)1472cdf0e10cSrcweir void SdrPaintView::SetGridColor( Color aColor )
1473cdf0e10cSrcweir {
1474cdf0e10cSrcweir 	maGridColor = aColor;
1475cdf0e10cSrcweir }
1476cdf0e10cSrcweir 
GetGridColor() const1477cdf0e10cSrcweir Color SdrPaintView::GetGridColor() const
1478cdf0e10cSrcweir {
1479cdf0e10cSrcweir 	return maGridColor;
1480cdf0e10cSrcweir }
1481cdf0e10cSrcweir 
1482cdf0e10cSrcweir // #103834# Set background color for svx at SdrPageViews
SetApplicationBackgroundColor(Color aBackgroundColor)1483cdf0e10cSrcweir void SdrPaintView::SetApplicationBackgroundColor(Color aBackgroundColor)
1484cdf0e10cSrcweir {
1485cdf0e10cSrcweir 	if(mpPageView)
1486cdf0e10cSrcweir 	{
1487cdf0e10cSrcweir 		mpPageView->SetApplicationBackgroundColor(aBackgroundColor);
1488cdf0e10cSrcweir 	}
1489cdf0e10cSrcweir }
1490cdf0e10cSrcweir 
1491cdf0e10cSrcweir // #103911# Set document color for svx at SdrPageViews
SetApplicationDocumentColor(Color aDocumentColor)1492cdf0e10cSrcweir void SdrPaintView::SetApplicationDocumentColor(Color aDocumentColor)
1493cdf0e10cSrcweir {
1494cdf0e10cSrcweir 	if(mpPageView)
1495cdf0e10cSrcweir 	{
1496cdf0e10cSrcweir 		mpPageView->SetApplicationDocumentColor(aDocumentColor);
1497cdf0e10cSrcweir 	}
1498cdf0e10cSrcweir }
1499cdf0e10cSrcweir 
1500cdf0e10cSrcweir // #114898#
IsBufferedOutputAllowed() const1501cdf0e10cSrcweir bool SdrPaintView::IsBufferedOutputAllowed() const
1502cdf0e10cSrcweir {
1503cdf0e10cSrcweir 	return (mbBufferedOutputAllowed && maDrawinglayerOpt.IsPaintBuffer());
1504cdf0e10cSrcweir }
1505cdf0e10cSrcweir 
1506cdf0e10cSrcweir // #114898#
SetBufferedOutputAllowed(bool bNew)1507cdf0e10cSrcweir void SdrPaintView::SetBufferedOutputAllowed(bool bNew)
1508cdf0e10cSrcweir {
1509cdf0e10cSrcweir 	if(bNew != (bool)mbBufferedOutputAllowed)
1510cdf0e10cSrcweir 	{
1511cdf0e10cSrcweir 		mbBufferedOutputAllowed = bNew;
1512cdf0e10cSrcweir 	}
1513cdf0e10cSrcweir }
1514cdf0e10cSrcweir 
IsBufferedOverlayAllowed() const1515cdf0e10cSrcweir bool SdrPaintView::IsBufferedOverlayAllowed() const
1516cdf0e10cSrcweir {
1517cdf0e10cSrcweir 	return (mbBufferedOverlayAllowed && maDrawinglayerOpt.IsOverlayBuffer());
1518cdf0e10cSrcweir }
1519cdf0e10cSrcweir 
SetBufferedOverlayAllowed(bool bNew)1520cdf0e10cSrcweir void SdrPaintView::SetBufferedOverlayAllowed(bool bNew)
1521cdf0e10cSrcweir {
1522cdf0e10cSrcweir 	if(bNew != (bool)mbBufferedOverlayAllowed)
1523cdf0e10cSrcweir 	{
1524cdf0e10cSrcweir 		mbBufferedOverlayAllowed = bNew;
1525cdf0e10cSrcweir 	}
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir 
IsPagePaintingAllowed() const1528cdf0e10cSrcweir sal_Bool SdrPaintView::IsPagePaintingAllowed() const
1529cdf0e10cSrcweir {
1530cdf0e10cSrcweir 	return mbPagePaintingAllowed;
1531cdf0e10cSrcweir }
1532cdf0e10cSrcweir 
SetPagePaintingAllowed(bool bNew)1533cdf0e10cSrcweir void SdrPaintView::SetPagePaintingAllowed(bool bNew)
1534cdf0e10cSrcweir {
1535cdf0e10cSrcweir 	if(bNew != (bool)mbPagePaintingAllowed)
1536cdf0e10cSrcweir 	{
1537cdf0e10cSrcweir 		mbPagePaintingAllowed = bNew;
1538cdf0e10cSrcweir 	}
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir 
1541cdf0e10cSrcweir // #i38135# Sets the timer for Object animations and restarts.
SetAnimationTimer(sal_uInt32 nTime)1542cdf0e10cSrcweir void SdrPaintView::SetAnimationTimer(sal_uInt32 nTime)
1543cdf0e10cSrcweir {
1544cdf0e10cSrcweir 	if(mpPageView)
1545cdf0e10cSrcweir 	{
1546cdf0e10cSrcweir 		// first, reset all timers at all windows to 0L
1547cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < mpPageView->PageWindowCount(); a++)
1548cdf0e10cSrcweir 		{
1549cdf0e10cSrcweir 			const SdrPageWindow& rPageWindow = *mpPageView->GetPageWindow(a);
1550cdf0e10cSrcweir 			sdr::contact::ObjectContact& rObjectContact = rPageWindow.GetObjectContact();
1551cdf0e10cSrcweir 			sdr::animation::primitiveAnimator& rAnimator = rObjectContact.getPrimitiveAnimator();
1552cdf0e10cSrcweir 			rAnimator.SetTime(nTime);
1553cdf0e10cSrcweir 		}
1554cdf0e10cSrcweir 	}
1555cdf0e10cSrcweir }
1556cdf0e10cSrcweir 
1557cdf0e10cSrcweir // eof
1558