1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx>
31*cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx>
32*cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx>
33*cdf0e10cSrcweir #include <tools/gen.hxx>
34*cdf0e10cSrcweir #include <vcl/salbtype.hxx>
35*cdf0e10cSrcweir #include <vcl/outdev.hxx>
36*cdf0e10cSrcweir #include <vcl/window.hxx>
37*cdf0e10cSrcweir #include <svx/sdr/overlay/overlayobject.hxx>
38*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
39*cdf0e10cSrcweir #include <drawinglayer/processor2d/baseprocessor2d.hxx>
40*cdf0e10cSrcweir #include <svx/sdr/contact/objectcontacttools.hxx>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir using namespace com::sun::star;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir namespace sdr
49*cdf0e10cSrcweir {
50*cdf0e10cSrcweir 	namespace overlay
51*cdf0e10cSrcweir 	{
52*cdf0e10cSrcweir 		void OverlayManager::ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const
53*cdf0e10cSrcweir 		{
54*cdf0e10cSrcweir 			const sal_uInt32 nSize(maOverlayObjects.size());
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 			if(nSize)
57*cdf0e10cSrcweir 			{
58*cdf0e10cSrcweir 				const sal_uInt16 nOriginalAA(rDestinationDevice.GetAntialiasing());
59*cdf0e10cSrcweir 				const bool bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing());
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir 				// create processor
62*cdf0e10cSrcweir 				drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice(
63*cdf0e10cSrcweir 					rDestinationDevice,
64*cdf0e10cSrcweir 					getCurrentViewInformation2D());
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 				if(pProcessor)
67*cdf0e10cSrcweir 				{
68*cdf0e10cSrcweir 					for(OverlayObjectVector::const_iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
69*cdf0e10cSrcweir 					{
70*cdf0e10cSrcweir 						OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
71*cdf0e10cSrcweir 						const OverlayObject& rCandidate = **aIter;
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 						if(rCandidate.isVisible())
74*cdf0e10cSrcweir 						{
75*cdf0e10cSrcweir 							const drawinglayer::primitive2d::Primitive2DSequence& rSequence = rCandidate.getOverlayObjectPrimitive2DSequence();
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 							if(rSequence.hasElements())
78*cdf0e10cSrcweir 							{
79*cdf0e10cSrcweir 								if(rRange.overlaps(rCandidate.getBaseRange()))
80*cdf0e10cSrcweir 								{
81*cdf0e10cSrcweir 									if(bIsAntiAliasing && rCandidate.allowsAntiAliase())
82*cdf0e10cSrcweir 									{
83*cdf0e10cSrcweir 										rDestinationDevice.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW);
84*cdf0e10cSrcweir 									}
85*cdf0e10cSrcweir 									else
86*cdf0e10cSrcweir 									{
87*cdf0e10cSrcweir 										rDestinationDevice.SetAntialiasing(nOriginalAA & ~ANTIALIASING_ENABLE_B2DDRAW);
88*cdf0e10cSrcweir 									}
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 									pProcessor->process(rSequence);
91*cdf0e10cSrcweir 								}
92*cdf0e10cSrcweir 							}
93*cdf0e10cSrcweir 						}
94*cdf0e10cSrcweir 					}
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 					delete pProcessor;
97*cdf0e10cSrcweir 				}
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 				// restore AA settings
100*cdf0e10cSrcweir 				rDestinationDevice.SetAntialiasing(nOriginalAA);
101*cdf0e10cSrcweir 			}
102*cdf0e10cSrcweir 		}
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 		void OverlayManager::ImpStripeDefinitionChanged()
105*cdf0e10cSrcweir 		{
106*cdf0e10cSrcweir 			const sal_uInt32 nSize(maOverlayObjects.size());
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 			if(nSize)
109*cdf0e10cSrcweir 			{
110*cdf0e10cSrcweir 				for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
111*cdf0e10cSrcweir 				{
112*cdf0e10cSrcweir 					OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
113*cdf0e10cSrcweir 					OverlayObject& rCandidate = **aIter;
114*cdf0e10cSrcweir 					rCandidate.stripeDefinitionHasChanged();
115*cdf0e10cSrcweir 				}
116*cdf0e10cSrcweir 			}
117*cdf0e10cSrcweir 		}
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir         double OverlayManager::getDiscreteOne() const
120*cdf0e10cSrcweir         {
121*cdf0e10cSrcweir 			if(basegfx::fTools::equalZero(mfDiscreteOne))
122*cdf0e10cSrcweir             {
123*cdf0e10cSrcweir                 const basegfx::B2DVector aDiscreteInLogic(getOutputDevice().GetInverseViewTransformation() * basegfx::B2DVector(1.0, 0.0));
124*cdf0e10cSrcweir                 const_cast< OverlayManager* >(this)->mfDiscreteOne = aDiscreteInLogic.getLength();
125*cdf0e10cSrcweir             }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir             return mfDiscreteOne;
128*cdf0e10cSrcweir         }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 		OverlayManager::OverlayManager(
131*cdf0e10cSrcweir 			OutputDevice& rOutputDevice,
132*cdf0e10cSrcweir 			OverlayManager* pOldOverlayManager)
133*cdf0e10cSrcweir 		:	Scheduler(),
134*cdf0e10cSrcweir 			rmOutputDevice(rOutputDevice),
135*cdf0e10cSrcweir 			maOverlayObjects(),
136*cdf0e10cSrcweir 			maStripeColorA(Color(COL_BLACK)),
137*cdf0e10cSrcweir 			maStripeColorB(Color(COL_WHITE)),
138*cdf0e10cSrcweir 			mnStripeLengthPixel(5),
139*cdf0e10cSrcweir 			maDrawinglayerOpt(),
140*cdf0e10cSrcweir             maViewTransformation(),
141*cdf0e10cSrcweir 			maViewInformation2D(),
142*cdf0e10cSrcweir             mfDiscreteOne(0.0)
143*cdf0e10cSrcweir 		{
144*cdf0e10cSrcweir             // set Property 'ReducedDisplayQuality' to true to allow simpler interaction
145*cdf0e10cSrcweir             // visualisations
146*cdf0e10cSrcweir             static bool bUseReducedDisplayQualityForDrag(true);
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir             if(bUseReducedDisplayQualityForDrag)
149*cdf0e10cSrcweir             {
150*cdf0e10cSrcweir 			    uno::Sequence< beans::PropertyValue > xProperties(1);
151*cdf0e10cSrcweir 			    xProperties[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedDisplayQuality"));
152*cdf0e10cSrcweir 			    xProperties[0].Value <<= true;
153*cdf0e10cSrcweir                 maViewInformation2D = drawinglayer::geometry::ViewInformation2D(xProperties);
154*cdf0e10cSrcweir             }
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 			if(pOldOverlayManager)
157*cdf0e10cSrcweir 			{
158*cdf0e10cSrcweir 				// take over OverlayObjects from given OverlayManager. Copy
159*cdf0e10cSrcweir 				// the vector of pointers
160*cdf0e10cSrcweir 				maOverlayObjects = pOldOverlayManager->maOverlayObjects;
161*cdf0e10cSrcweir 				const sal_uInt32 nSize(maOverlayObjects.size());
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 				if(nSize)
164*cdf0e10cSrcweir 				{
165*cdf0e10cSrcweir 					for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
166*cdf0e10cSrcweir 					{
167*cdf0e10cSrcweir 						OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
168*cdf0e10cSrcweir 						OverlayObject& rCandidate = **aIter;
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 						// remove from old and add to new OverlayManager
171*cdf0e10cSrcweir 						pOldOverlayManager->impApplyRemoveActions(rCandidate);
172*cdf0e10cSrcweir 						impApplyAddActions(rCandidate);
173*cdf0e10cSrcweir 					}
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 					pOldOverlayManager->maOverlayObjects.clear();
176*cdf0e10cSrcweir 				}
177*cdf0e10cSrcweir 			}
178*cdf0e10cSrcweir 		}
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 		const drawinglayer::geometry::ViewInformation2D OverlayManager::getCurrentViewInformation2D() const
181*cdf0e10cSrcweir 		{
182*cdf0e10cSrcweir             if(getOutputDevice().GetViewTransformation() != maViewTransformation)
183*cdf0e10cSrcweir             {
184*cdf0e10cSrcweir 				basegfx::B2DRange aViewRange(maViewInformation2D.getViewport());
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 				if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType())
187*cdf0e10cSrcweir 				{
188*cdf0e10cSrcweir 					const Size aOutputSizePixel(getOutputDevice().GetOutputSizePixel());
189*cdf0e10cSrcweir 					aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
190*cdf0e10cSrcweir 			        aViewRange.transform(getOutputDevice().GetInverseViewTransformation());
191*cdf0e10cSrcweir 				}
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir                 OverlayManager* pThis = const_cast< OverlayManager* >(this);
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 				pThis->maViewTransformation = getOutputDevice().GetViewTransformation();
196*cdf0e10cSrcweir 				pThis->maViewInformation2D = drawinglayer::geometry::ViewInformation2D(
197*cdf0e10cSrcweir 					maViewInformation2D.getObjectTransformation(),
198*cdf0e10cSrcweir 					maViewTransformation,
199*cdf0e10cSrcweir 					aViewRange,
200*cdf0e10cSrcweir 					maViewInformation2D.getVisualizedPage(),
201*cdf0e10cSrcweir 					maViewInformation2D.getViewTime(),
202*cdf0e10cSrcweir 					maViewInformation2D.getExtendedInformationSequence());
203*cdf0e10cSrcweir 				pThis->mfDiscreteOne = 0.0;
204*cdf0e10cSrcweir             }
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 			return maViewInformation2D;
207*cdf0e10cSrcweir 		}
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 		void OverlayManager::impApplyRemoveActions(OverlayObject& rTarget)
210*cdf0e10cSrcweir 		{
211*cdf0e10cSrcweir 			// handle evtl. animation
212*cdf0e10cSrcweir 			if(rTarget.allowsAnimation())
213*cdf0e10cSrcweir 			{
214*cdf0e10cSrcweir 				// remove from event chain
215*cdf0e10cSrcweir 				RemoveEvent(&rTarget);
216*cdf0e10cSrcweir 			}
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 			// make invisible
219*cdf0e10cSrcweir 			invalidateRange(rTarget.getBaseRange());
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 			// clear manager
222*cdf0e10cSrcweir 			rTarget.mpOverlayManager = 0;
223*cdf0e10cSrcweir 		}
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 		void OverlayManager::impApplyAddActions(OverlayObject& rTarget)
226*cdf0e10cSrcweir 		{
227*cdf0e10cSrcweir 			// set manager
228*cdf0e10cSrcweir 			rTarget.mpOverlayManager = this;
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 			// make visible
231*cdf0e10cSrcweir 			invalidateRange(rTarget.getBaseRange());
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 			// handle evtl. animation
234*cdf0e10cSrcweir 			if(rTarget.allowsAnimation())
235*cdf0e10cSrcweir 			{
236*cdf0e10cSrcweir 				// Trigger at current time to get alive. This will do the
237*cdf0e10cSrcweir 				// object-specific next time calculation and hand over adding
238*cdf0e10cSrcweir 				// again to the scheduler to the animated object, too. This works for
239*cdf0e10cSrcweir 				// a paused or non-paused animator.
240*cdf0e10cSrcweir 				rTarget.Trigger(GetTime());
241*cdf0e10cSrcweir 			}
242*cdf0e10cSrcweir 		}
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir 		OverlayManager::~OverlayManager()
245*cdf0e10cSrcweir 		{
246*cdf0e10cSrcweir 			// The OverlayManager is not the owner of the OverlayObjects
247*cdf0e10cSrcweir 			// and thus will not delete them, but remove them. Profit here
248*cdf0e10cSrcweir 			// from knowing that all will be removed
249*cdf0e10cSrcweir 			const sal_uInt32 nSize(maOverlayObjects.size());
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 			if(nSize)
252*cdf0e10cSrcweir 			{
253*cdf0e10cSrcweir 				for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
254*cdf0e10cSrcweir 				{
255*cdf0e10cSrcweir 					OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
256*cdf0e10cSrcweir 					OverlayObject& rCandidate = **aIter;
257*cdf0e10cSrcweir 					impApplyRemoveActions(rCandidate);
258*cdf0e10cSrcweir 				}
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 				// erase vector
261*cdf0e10cSrcweir 				maOverlayObjects.clear();
262*cdf0e10cSrcweir 			}
263*cdf0e10cSrcweir 		}
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir 		void OverlayManager::completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice) const
266*cdf0e10cSrcweir 		{
267*cdf0e10cSrcweir 			if(!rRegion.IsEmpty() && maOverlayObjects.size())
268*cdf0e10cSrcweir 			{
269*cdf0e10cSrcweir 				// check for changed MapModes. That may influence the
270*cdf0e10cSrcweir 				// logical size of pixel based OverlayObjects (like BitmapHandles)
271*cdf0e10cSrcweir 				//ImpCheckMapModeChange();
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 				// paint members
274*cdf0e10cSrcweir 				const Rectangle aRegionBoundRect(rRegion.GetBoundRect());
275*cdf0e10cSrcweir 				const basegfx::B2DRange aRegionRange(
276*cdf0e10cSrcweir 					aRegionBoundRect.Left(), aRegionBoundRect.Top(),
277*cdf0e10cSrcweir 					aRegionBoundRect.Right(), aRegionBoundRect.Bottom());
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 				OutputDevice& rTarget = (pPreRenderDevice) ? *pPreRenderDevice : getOutputDevice();
280*cdf0e10cSrcweir 				ImpDrawMembers(aRegionRange, rTarget);
281*cdf0e10cSrcweir 			}
282*cdf0e10cSrcweir 		}
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 		void OverlayManager::flush()
285*cdf0e10cSrcweir 		{
286*cdf0e10cSrcweir 			// default has nothing to do
287*cdf0e10cSrcweir 		}
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir 		// #i68597# part of content gets copied, react on it
290*cdf0e10cSrcweir 		void OverlayManager::copyArea(const Point& /*rDestPt*/, const Point& /*rSrcPt*/, const Size& /*rSrcSize*/)
291*cdf0e10cSrcweir 		{
292*cdf0e10cSrcweir 			// unbuffered versions do nothing here
293*cdf0e10cSrcweir 		}
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 		void OverlayManager::restoreBackground(const Region& /*rRegion*/) const
296*cdf0e10cSrcweir 		{
297*cdf0e10cSrcweir 			// unbuffered versions do nothing here
298*cdf0e10cSrcweir 		}
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 		void OverlayManager::add(OverlayObject& rOverlayObject)
301*cdf0e10cSrcweir 		{
302*cdf0e10cSrcweir 			OSL_ENSURE(0 == rOverlayObject.mpOverlayManager, "OverlayObject is added twice to an OverlayManager (!)");
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir 			// add to the end of chain to preserve display order in paint
305*cdf0e10cSrcweir 			maOverlayObjects.push_back(&rOverlayObject);
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 			// execute add actions
308*cdf0e10cSrcweir 			impApplyAddActions(rOverlayObject);
309*cdf0e10cSrcweir 		}
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 		void OverlayManager::remove(OverlayObject& rOverlayObject)
312*cdf0e10cSrcweir 		{
313*cdf0e10cSrcweir 			OSL_ENSURE(rOverlayObject.mpOverlayManager == this, "OverlayObject is removed from wrong OverlayManager (!)");
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 			// execute remove actions
316*cdf0e10cSrcweir 			impApplyRemoveActions(rOverlayObject);
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir 			// remove from vector
319*cdf0e10cSrcweir 			const OverlayObjectVector::iterator aFindResult = ::std::find(maOverlayObjects.begin(), maOverlayObjects.end(), &rOverlayObject);
320*cdf0e10cSrcweir 			const bool bFound(aFindResult != maOverlayObjects.end());
321*cdf0e10cSrcweir 			OSL_ENSURE(bFound, "OverlayObject NOT found at OverlayManager (!)");
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir 			if(bFound)
324*cdf0e10cSrcweir 			{
325*cdf0e10cSrcweir 				maOverlayObjects.erase(aFindResult);
326*cdf0e10cSrcweir 			}
327*cdf0e10cSrcweir 		}
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 		void OverlayManager::invalidateRange(const basegfx::B2DRange& rRange)
330*cdf0e10cSrcweir 		{
331*cdf0e10cSrcweir 			if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType())
332*cdf0e10cSrcweir 			{
333*cdf0e10cSrcweir 				if(getDrawinglayerOpt().IsAntiAliasing())
334*cdf0e10cSrcweir 				{
335*cdf0e10cSrcweir 					// assume AA needs one pixel more and invalidate one pixel more
336*cdf0e10cSrcweir                     const double fDiscreteOne(getDiscreteOne());
337*cdf0e10cSrcweir 					const Rectangle aInvalidateRectangle(
338*cdf0e10cSrcweir 						(sal_Int32)floor(rRange.getMinX() - fDiscreteOne),
339*cdf0e10cSrcweir 						(sal_Int32)floor(rRange.getMinY() - fDiscreteOne),
340*cdf0e10cSrcweir 						(sal_Int32)ceil(rRange.getMaxX() + fDiscreteOne),
341*cdf0e10cSrcweir 						(sal_Int32)ceil(rRange.getMaxY() + fDiscreteOne));
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir 					// simply invalidate
344*cdf0e10cSrcweir 					((Window&)getOutputDevice()).Invalidate(aInvalidateRectangle, INVALIDATE_NOERASE);
345*cdf0e10cSrcweir 				}
346*cdf0e10cSrcweir 				else
347*cdf0e10cSrcweir 				{
348*cdf0e10cSrcweir 					// #i77674# transform to rectangle. Use floor/ceil to get all covered
349*cdf0e10cSrcweir 					// discrete pixels, see #i75163# and OverlayManagerBuffered::invalidateRange
350*cdf0e10cSrcweir 					const Rectangle aInvalidateRectangle(
351*cdf0e10cSrcweir 						(sal_Int32)floor(rRange.getMinX()), (sal_Int32)floor(rRange.getMinY()),
352*cdf0e10cSrcweir 						(sal_Int32)ceil(rRange.getMaxX()), (sal_Int32)ceil(rRange.getMaxY()));
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 					// simply invalidate
355*cdf0e10cSrcweir 					((Window&)getOutputDevice()).Invalidate(aInvalidateRectangle, INVALIDATE_NOERASE);
356*cdf0e10cSrcweir 				}
357*cdf0e10cSrcweir 			}
358*cdf0e10cSrcweir 		}
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 		// stripe support ColA
361*cdf0e10cSrcweir 		void OverlayManager::setStripeColorA(Color aNew)
362*cdf0e10cSrcweir 		{
363*cdf0e10cSrcweir 			if(aNew != maStripeColorA)
364*cdf0e10cSrcweir 			{
365*cdf0e10cSrcweir 				maStripeColorA = aNew;
366*cdf0e10cSrcweir 				ImpStripeDefinitionChanged();
367*cdf0e10cSrcweir 			}
368*cdf0e10cSrcweir 		}
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 		// stripe support ColB
371*cdf0e10cSrcweir 		void OverlayManager::setStripeColorB(Color aNew)
372*cdf0e10cSrcweir 		{
373*cdf0e10cSrcweir 			if(aNew != maStripeColorB)
374*cdf0e10cSrcweir 			{
375*cdf0e10cSrcweir 				maStripeColorB = aNew;
376*cdf0e10cSrcweir 				ImpStripeDefinitionChanged();
377*cdf0e10cSrcweir 			}
378*cdf0e10cSrcweir 		}
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 		// stripe support StripeLengthPixel
381*cdf0e10cSrcweir 		void OverlayManager::setStripeLengthPixel(sal_uInt32 nNew)
382*cdf0e10cSrcweir 		{
383*cdf0e10cSrcweir 			if(nNew != mnStripeLengthPixel)
384*cdf0e10cSrcweir 			{
385*cdf0e10cSrcweir 				mnStripeLengthPixel = nNew;
386*cdf0e10cSrcweir 				ImpStripeDefinitionChanged();
387*cdf0e10cSrcweir 			}
388*cdf0e10cSrcweir 		}
389*cdf0e10cSrcweir 	} // end of namespace overlay
390*cdf0e10cSrcweir } // end of namespace sdr
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
393*cdf0e10cSrcweir // eof
394