xref: /AOO41X/main/svx/source/sdr/contact/objectcontactofpageview.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofpageview.hxx>
27cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontactofunocontrol.hxx>
28cdf0e10cSrcweir #include <svx/svdpagv.hxx>
29cdf0e10cSrcweir #include <svx/svdpage.hxx>
30cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
31cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontact.hxx>
32cdf0e10cSrcweir #include <svx/svdview.hxx>
33cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx>
34cdf0e10cSrcweir #include <svx/sdr/animation/objectanimator.hxx>
35cdf0e10cSrcweir #include <svx/sdr/event/eventhandler.hxx>
36cdf0e10cSrcweir #include <svx/sdrpagewindow.hxx>
37cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx>
38cdf0e10cSrcweir #include <drawinglayer/processor2d/vclprocessor2d.hxx>
39cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
40cdf0e10cSrcweir #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
41cdf0e10cSrcweir #include <svx/sdr/contact/objectcontacttools.hxx>
42cdf0e10cSrcweir #include <com/sun/star/rendering/XSpriteCanvas.hpp>
43cdf0e10cSrcweir #include <svx/unoapi.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
46cdf0e10cSrcweir 
47cdf0e10cSrcweir using namespace com::sun::star;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace sdr
52cdf0e10cSrcweir {
53cdf0e10cSrcweir 	namespace contact
54cdf0e10cSrcweir 	{
55cdf0e10cSrcweir 		// internal access to SdrPage of SdrPageView
56cdf0e10cSrcweir 		SdrPage* ObjectContactOfPageView::GetSdrPage() const
57cdf0e10cSrcweir 		{
58cdf0e10cSrcweir 			return GetPageWindow().GetPageView().GetPage();
59cdf0e10cSrcweir 		}
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 		ObjectContactOfPageView::ObjectContactOfPageView(SdrPageWindow& rPageWindow)
62cdf0e10cSrcweir 		:	ObjectContact(),
63cdf0e10cSrcweir 			mrPageWindow(rPageWindow)
64cdf0e10cSrcweir 		{
65cdf0e10cSrcweir 			// init PreviewRenderer flag
66cdf0e10cSrcweir 			setPreviewRenderer(((SdrPaintView&)rPageWindow.GetPageView().GetView()).IsPreviewRenderer());
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 			// init timer
69cdf0e10cSrcweir 			SetTimeout(1);
70cdf0e10cSrcweir 			Stop();
71cdf0e10cSrcweir 		}
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 		ObjectContactOfPageView::~ObjectContactOfPageView()
74cdf0e10cSrcweir 		{
75cdf0e10cSrcweir 			// execute missing LazyInvalidates and stop timer
76cdf0e10cSrcweir 			Timeout();
77cdf0e10cSrcweir 		}
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 		// LazyInvalidate request. Take action.
80cdf0e10cSrcweir 		void ObjectContactOfPageView::setLazyInvalidate(ViewObjectContact& /*rVOC*/)
81cdf0e10cSrcweir 		{
82cdf0e10cSrcweir 			// do NOT call parent, but remember that something is to do by
83cdf0e10cSrcweir 			// starting the LazyInvalidateTimer
84cdf0e10cSrcweir 			Start();
85cdf0e10cSrcweir 		}
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 		// call this to support evtl. preparations for repaint
88cdf0e10cSrcweir 		void ObjectContactOfPageView::PrepareProcessDisplay()
89cdf0e10cSrcweir 		{
90cdf0e10cSrcweir 			if(IsActive())
91cdf0e10cSrcweir 			{
92cdf0e10cSrcweir 				static bool bInvalidateDuringPaint(true);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 				if(bInvalidateDuringPaint)
95cdf0e10cSrcweir 				{
96cdf0e10cSrcweir 					// there are still non-triggered LazyInvalidate events, trigger these
97cdf0e10cSrcweir 					Timeout();
98cdf0e10cSrcweir 				}
99cdf0e10cSrcweir 			}
100cdf0e10cSrcweir 		}
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 		// From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
103cdf0e10cSrcweir 		void ObjectContactOfPageView::Timeout()
104cdf0e10cSrcweir 		{
105cdf0e10cSrcweir 			// stop the timer
106cdf0e10cSrcweir 			Stop();
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 			// invalidate all LazyInvalidate VOCs new situations
109cdf0e10cSrcweir 			const sal_uInt32 nVOCCount(getViewObjectContactCount());
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 			for(sal_uInt32 a(0); a < nVOCCount; a++)
112cdf0e10cSrcweir 			{
113cdf0e10cSrcweir 				ViewObjectContact* pCandidate = getViewObjectContact(a);
114cdf0e10cSrcweir 				pCandidate->triggerLazyInvalidate();
115cdf0e10cSrcweir 			}
116cdf0e10cSrcweir 		}
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 		// Process the whole displaying
119cdf0e10cSrcweir 		void ObjectContactOfPageView::ProcessDisplay(DisplayInfo& rDisplayInfo)
120cdf0e10cSrcweir 		{
121cdf0e10cSrcweir 			const SdrPage* pStartPage = GetSdrPage();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 			if(pStartPage && !rDisplayInfo.GetProcessLayers().IsEmpty())
124cdf0e10cSrcweir 			{
125cdf0e10cSrcweir 				const ViewContact& rDrawPageVC = pStartPage->GetViewContact();
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 				if(rDrawPageVC.GetObjectCount())
128cdf0e10cSrcweir 				{
129cdf0e10cSrcweir 					DoProcessDisplay(rDisplayInfo);
130cdf0e10cSrcweir 				}
131cdf0e10cSrcweir 			}
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 			// after paint take care of the evtl. scheduled asynchronious commands.
134cdf0e10cSrcweir 			// Do this by resetting the timer contained there. Thus, after the paint
135cdf0e10cSrcweir 			// that timer will be triggered and the events will be executed.
136cdf0e10cSrcweir 			if(HasEventHandler())
137cdf0e10cSrcweir 			{
138cdf0e10cSrcweir 				sdr::event::TimerEventHandler& rEventHandler = GetEventHandler();
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 				if(!rEventHandler.IsEmpty())
141cdf0e10cSrcweir 				{
142cdf0e10cSrcweir 					rEventHandler.Restart();
143cdf0e10cSrcweir 				}
144cdf0e10cSrcweir 			}
145cdf0e10cSrcweir 		}
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 		// Process the whole displaying. Only use given DsiplayInfo, do not access other
148cdf0e10cSrcweir 		// OutputDevices then the given ones.
149cdf0e10cSrcweir 		void ObjectContactOfPageView::DoProcessDisplay(DisplayInfo& rDisplayInfo)
150cdf0e10cSrcweir 		{
151cdf0e10cSrcweir 			// visualize entered group when that feature is switched on and it's not
152cdf0e10cSrcweir 			// a print output. #i29129# No ghosted display for printing.
153cdf0e10cSrcweir 			sal_Bool bVisualizeEnteredGroup(DoVisualizeEnteredGroup() && !isOutputToPrinter());
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 			// Visualize entered groups: Set to ghosted as default
156cdf0e10cSrcweir 			// start. Do this only for the DrawPage, not for MasterPages
157cdf0e10cSrcweir 			if(bVisualizeEnteredGroup)
158cdf0e10cSrcweir 			{
159cdf0e10cSrcweir 				rDisplayInfo.SetGhostedDrawMode();
160cdf0e10cSrcweir 			}
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 			// #114359# save old and set clip region
163cdf0e10cSrcweir 			OutputDevice* pOutDev = TryToGetOutputDevice();
164cdf0e10cSrcweir 			OSL_ENSURE(0 != pOutDev, "ObjectContactOfPageView without OutDev, someone has overloaded TryToGetOutputDevice wrong (!)");
165cdf0e10cSrcweir 			sal_Bool bClipRegionPushed(sal_False);
166cdf0e10cSrcweir 			const Region& rRedrawArea(rDisplayInfo.GetRedrawArea());
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 			if(!rRedrawArea.IsEmpty())
169cdf0e10cSrcweir 			{
170cdf0e10cSrcweir 				bClipRegionPushed = sal_True;
171cdf0e10cSrcweir 				pOutDev->Push(PUSH_CLIPREGION);
172cdf0e10cSrcweir 				pOutDev->IntersectClipRegion(rRedrawArea);
173cdf0e10cSrcweir 			}
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 			// Get start node and process DrawPage contents
176cdf0e10cSrcweir 			const ViewObjectContact& rDrawPageVOContact = GetSdrPage()->GetViewContact().GetViewObjectContact(*this);
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 			// update current ViewInformation2D at the ObjectContact
179cdf0e10cSrcweir 			const double fCurrentTime(getPrimitiveAnimator().GetTime());
180cdf0e10cSrcweir 			OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice();
181cdf0e10cSrcweir             basegfx::B2DRange aViewRange;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 			// create ViewRange
184cdf0e10cSrcweir             if(isOutputToRecordingMetaFile())
185cdf0e10cSrcweir             {
186cdf0e10cSrcweir                 if(isOutputToPDFFile() || isOutputToPrinter())
187cdf0e10cSrcweir                 {
188cdf0e10cSrcweir                     // #i98402# if it's a PDF export, set the ClipRegion as ViewRange. This is
189cdf0e10cSrcweir                     // mainly because SW does not use DrawingLayer Page-Oriented and if not doing this,
190cdf0e10cSrcweir                     // all existing objects will be collected as primitives and processed.
191cdf0e10cSrcweir                     // OD 2009-03-05 #i99876# perform the same also for SW on printing.
192cdf0e10cSrcweir                     const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect());
193cdf0e10cSrcweir 
194cdf0e10cSrcweir                     aViewRange = basegfx::B2DRange(
195cdf0e10cSrcweir                         aLogicClipRectangle.Left(), aLogicClipRectangle.Top(),
196cdf0e10cSrcweir 						aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom());
197cdf0e10cSrcweir                 }
198cdf0e10cSrcweir             }
199cdf0e10cSrcweir             else
200cdf0e10cSrcweir 			{
201cdf0e10cSrcweir 				// use visible pixels, but transform to world coordinates
202cdf0e10cSrcweir 				const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel());
203cdf0e10cSrcweir 				aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 				// if a clip region is set, use it
206cdf0e10cSrcweir 				if(!rDisplayInfo.GetRedrawArea().IsEmpty())
207cdf0e10cSrcweir 				{
208cdf0e10cSrcweir 					// get logic clip range and create discrete one
209cdf0e10cSrcweir 					const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect());
210cdf0e10cSrcweir 					basegfx::B2DRange aLogicClipRange(
211cdf0e10cSrcweir 						aLogicClipRectangle.Left(), aLogicClipRectangle.Top(),
212cdf0e10cSrcweir 						aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom());
213cdf0e10cSrcweir 					basegfx::B2DRange aDiscreteClipRange(aLogicClipRange);
214cdf0e10cSrcweir 					aDiscreteClipRange.transform(rTargetOutDev.GetViewTransformation());
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 					// align the discrete one to discrete boundaries (pixel bounds). Also
217cdf0e10cSrcweir 					// expand X and Y max by one due to Rectangle definition source
218cdf0e10cSrcweir 					aDiscreteClipRange.expand(basegfx::B2DTuple(
219cdf0e10cSrcweir 						floor(aDiscreteClipRange.getMinX()),
220cdf0e10cSrcweir 						floor(aDiscreteClipRange.getMinY())));
221cdf0e10cSrcweir 					aDiscreteClipRange.expand(basegfx::B2DTuple(
222cdf0e10cSrcweir 						1.0 + ceil(aDiscreteClipRange.getMaxX()),
223cdf0e10cSrcweir 						1.0 + ceil(aDiscreteClipRange.getMaxY())));
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 					// intersect current ViewRange with ClipRange
226cdf0e10cSrcweir 					aViewRange.intersect(aDiscreteClipRange);
227cdf0e10cSrcweir 				}
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 				// transform to world coordinates
230cdf0e10cSrcweir                 aViewRange.transform(rTargetOutDev.GetInverseViewTransformation());
231cdf0e10cSrcweir 			}
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 			// update local ViewInformation2D
234cdf0e10cSrcweir 			const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
235cdf0e10cSrcweir 				basegfx::B2DHomMatrix(),
236cdf0e10cSrcweir 				rTargetOutDev.GetViewTransformation(),
237cdf0e10cSrcweir 				aViewRange,
238cdf0e10cSrcweir 				GetXDrawPageForSdrPage(GetSdrPage()),
239cdf0e10cSrcweir 				fCurrentTime,
240cdf0e10cSrcweir 				uno::Sequence<beans::PropertyValue>());
241cdf0e10cSrcweir 			updateViewInformation2D(aNewViewInformation2D);
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 			// get whole Primitive2DSequence; this will already make use of updated ViewInformation2D
244cdf0e10cSrcweir 			// and may use the MapMode from the Target OutDev in the DisplayInfo
245cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence(rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo));
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 			// if there is something to show, use a primitive processor to render it. There
248cdf0e10cSrcweir 			// is a choice between VCL and Canvas processors currently. The decision is made in
249cdf0e10cSrcweir 			// createBaseProcessor2DFromOutputDevice and takes into accout things like the
250cdf0e10cSrcweir 			// Target is a MetaFile, a VDev or something else. The Canvas renderer is triggered
251cdf0e10cSrcweir 			// currently using the shown boolean. Canvas is not yet the default.
252cdf0e10cSrcweir 			if(xPrimitiveSequence.hasElements())
253cdf0e10cSrcweir 			{
254cdf0e10cSrcweir 				// prepare OutputDevice (historical stuff, maybe soon removed)
255cdf0e10cSrcweir 				rDisplayInfo.ClearGhostedDrawMode(); // reset, else the VCL-paint with the processor will not do the right thing
256cdf0e10cSrcweir 				pOutDev->SetLayoutMode(0); // reset, default is no BiDi/RTL
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 				// create renderer
259cdf0e10cSrcweir                 drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = createBaseProcessor2DFromOutputDevice(
260cdf0e10cSrcweir                     rTargetOutDev, getViewInformation2D());
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 				if(pProcessor2D)
263cdf0e10cSrcweir 				{
264cdf0e10cSrcweir 					pProcessor2D->process(xPrimitiveSequence);
265cdf0e10cSrcweir 					delete pProcessor2D;
266cdf0e10cSrcweir 				}
267cdf0e10cSrcweir 			}
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 			// #114359# restore old ClipReghion
270cdf0e10cSrcweir 			if(bClipRegionPushed)
271cdf0e10cSrcweir 			{
272cdf0e10cSrcweir 				pOutDev->Pop();
273cdf0e10cSrcweir 			}
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 			// Visualize entered groups: Reset to original DrawMode
276cdf0e10cSrcweir 			if(bVisualizeEnteredGroup)
277cdf0e10cSrcweir 			{
278cdf0e10cSrcweir 				rDisplayInfo.ClearGhostedDrawMode();
279cdf0e10cSrcweir 			}
280cdf0e10cSrcweir 		}
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 		// test if visualizing of entered groups is switched on at all
283cdf0e10cSrcweir 		bool ObjectContactOfPageView::DoVisualizeEnteredGroup() const
284cdf0e10cSrcweir 		{
285cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
286cdf0e10cSrcweir 			return rView.DoVisualizeEnteredGroup();
287cdf0e10cSrcweir 		}
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 		// get active group's (the entered group) ViewContact
290cdf0e10cSrcweir 		const ViewContact* ObjectContactOfPageView::getActiveViewContact() const
291cdf0e10cSrcweir 		{
292cdf0e10cSrcweir 			SdrObjList* pActiveGroupList = GetPageWindow().GetPageView().GetObjList();
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 			if(pActiveGroupList)
295cdf0e10cSrcweir 			{
296cdf0e10cSrcweir 				if(pActiveGroupList->ISA(SdrPage))
297cdf0e10cSrcweir 				{
298cdf0e10cSrcweir 					// It's a Page itself
299cdf0e10cSrcweir 					return &(((SdrPage*)pActiveGroupList)->GetViewContact());
300cdf0e10cSrcweir 				}
301cdf0e10cSrcweir 				else if(pActiveGroupList->GetOwnerObj())
302cdf0e10cSrcweir 				{
303cdf0e10cSrcweir 					// Group object
304cdf0e10cSrcweir 					return &(pActiveGroupList->GetOwnerObj()->GetViewContact());
305cdf0e10cSrcweir 				}
306cdf0e10cSrcweir 			}
307cdf0e10cSrcweir 			else if(GetSdrPage())
308cdf0e10cSrcweir 			{
309cdf0e10cSrcweir 				// use page of associated SdrPageView
310cdf0e10cSrcweir 				return &(GetSdrPage()->GetViewContact());
311cdf0e10cSrcweir 			}
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 			return 0;
314cdf0e10cSrcweir 		}
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 		// Invalidate given rectangle at the window/output which is represented by
317cdf0e10cSrcweir 		// this ObjectContact.
318cdf0e10cSrcweir 		void ObjectContactOfPageView::InvalidatePartOfView(const basegfx::B2DRange& rRange) const
319cdf0e10cSrcweir 		{
320cdf0e10cSrcweir 			// invalidate at associated PageWindow
321cdf0e10cSrcweir             GetPageWindow().InvalidatePageWindow(rRange);
322cdf0e10cSrcweir 		}
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 		// Get info if given Rectangle is visible in this view
325cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsAreaVisible(const basegfx::B2DRange& rRange) const
326cdf0e10cSrcweir 		{
327cdf0e10cSrcweir 			// compare with the visible rectangle
328cdf0e10cSrcweir 			if(rRange.isEmpty())
329cdf0e10cSrcweir 			{
330cdf0e10cSrcweir 				// no range -> not visible
331cdf0e10cSrcweir 				return false;
332cdf0e10cSrcweir 			}
333cdf0e10cSrcweir 			else
334cdf0e10cSrcweir 			{
335cdf0e10cSrcweir 				const OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice();
336cdf0e10cSrcweir 				const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel());
337cdf0e10cSrcweir 				basegfx::B2DRange aLogicViewRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 				aLogicViewRange.transform(rTargetOutDev.GetInverseViewTransformation());
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 				if(!aLogicViewRange.isEmpty() && !aLogicViewRange.overlaps(rRange))
342cdf0e10cSrcweir 				{
343cdf0e10cSrcweir 					return false;
344cdf0e10cSrcweir 				}
345cdf0e10cSrcweir 			}
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 			// call parent
348cdf0e10cSrcweir 			return ObjectContact::IsAreaVisible(rRange);
349cdf0e10cSrcweir 		}
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 		// Get info about the need to visualize GluePoints
352cdf0e10cSrcweir 		bool ObjectContactOfPageView::AreGluePointsVisible() const
353cdf0e10cSrcweir 		{
354cdf0e10cSrcweir 			return GetPageWindow().GetPageView().GetView().ImpIsGlueVisible();
355cdf0e10cSrcweir 		}
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 		// check if text animation is allowed.
358cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsTextAnimationAllowed() const
359cdf0e10cSrcweir 		{
360cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
361cdf0e10cSrcweir 			const SvtAccessibilityOptions& rOpt = rView.getAccessibilityOptions();
362cdf0e10cSrcweir 			return rOpt.GetIsAllowAnimatedText();
363cdf0e10cSrcweir 		}
364cdf0e10cSrcweir 
365cdf0e10cSrcweir 		// check if graphic animation is allowed.
366cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsGraphicAnimationAllowed() const
367cdf0e10cSrcweir 		{
368cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
369cdf0e10cSrcweir 			const SvtAccessibilityOptions& rOpt = rView.getAccessibilityOptions();
370cdf0e10cSrcweir 			return rOpt.GetIsAllowAnimatedGraphics();
371cdf0e10cSrcweir 		}
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 		// check if asynchronious graphis loading is allowed. Default is sal_False.
374cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsAsynchronGraphicsLoadingAllowed() const
375cdf0e10cSrcweir 		{
376cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
377cdf0e10cSrcweir 			return rView.IsSwapAsynchron();
378cdf0e10cSrcweir 		}
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 		// check if buffering of MasterPages is allowed. Default is sal_False.
381cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsMasterPageBufferingAllowed() const
382cdf0e10cSrcweir 		{
383cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
384cdf0e10cSrcweir 			return rView.IsMasterPagePaintCaching();
385cdf0e10cSrcweir 		}
386cdf0e10cSrcweir 
387cdf0e10cSrcweir 		// print?
388cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToPrinter() const
389cdf0e10cSrcweir 		{
390cdf0e10cSrcweir 			return (OUTDEV_PRINTER == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
391cdf0e10cSrcweir 		}
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 		// window?
394cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToWindow() const
395cdf0e10cSrcweir 		{
396cdf0e10cSrcweir 			return (OUTDEV_WINDOW == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
397cdf0e10cSrcweir 		}
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 		// VirtualDevice?
400cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToVirtualDevice() const
401cdf0e10cSrcweir 		{
402cdf0e10cSrcweir 			return (OUTDEV_VIRDEV == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
403cdf0e10cSrcweir 		}
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 		// recording MetaFile?
406cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToRecordingMetaFile() const
407cdf0e10cSrcweir 		{
408cdf0e10cSrcweir 			GDIMetaFile* pMetaFile = mrPageWindow.GetPaintWindow().GetOutputDevice().GetConnectMetaFile();
409cdf0e10cSrcweir 			return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
410cdf0e10cSrcweir 		}
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 		// pdf export?
413cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToPDFFile() const
414cdf0e10cSrcweir 		{
415cdf0e10cSrcweir             return (0 != mrPageWindow.GetPaintWindow().GetOutputDevice().GetPDFWriter());
416cdf0e10cSrcweir 		}
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 		// gray display mode
419cdf0e10cSrcweir 		bool ObjectContactOfPageView::isDrawModeGray() const
420cdf0e10cSrcweir 		{
421cdf0e10cSrcweir 			const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
422cdf0e10cSrcweir 			return (nDrawMode == (DRAWMODE_GRAYLINE|DRAWMODE_GRAYFILL|DRAWMODE_BLACKTEXT|DRAWMODE_GRAYBITMAP|DRAWMODE_GRAYGRADIENT));
423cdf0e10cSrcweir 		}
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 		// gray display mode
426cdf0e10cSrcweir 		bool ObjectContactOfPageView::isDrawModeBlackWhite() const
427cdf0e10cSrcweir 		{
428cdf0e10cSrcweir 			const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
429cdf0e10cSrcweir 			return (nDrawMode == (DRAWMODE_BLACKLINE|DRAWMODE_BLACKTEXT|DRAWMODE_WHITEFILL|DRAWMODE_GRAYBITMAP|DRAWMODE_WHITEGRADIENT));
430cdf0e10cSrcweir 		}
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 		// high contrast display mode
433cdf0e10cSrcweir 		bool ObjectContactOfPageView::isDrawModeHighContrast() const
434cdf0e10cSrcweir 		{
435cdf0e10cSrcweir 			const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
436cdf0e10cSrcweir 			return (nDrawMode == (DRAWMODE_SETTINGSLINE|DRAWMODE_SETTINGSFILL|DRAWMODE_SETTINGSTEXT|DRAWMODE_SETTINGSGRADIENT));
437cdf0e10cSrcweir 		}
438cdf0e10cSrcweir 
439cdf0e10cSrcweir         // access to SdrPageView
440cdf0e10cSrcweir 		SdrPageView* ObjectContactOfPageView::TryToGetSdrPageView() const
441cdf0e10cSrcweir         {
442cdf0e10cSrcweir             return &(mrPageWindow.GetPageView());
443cdf0e10cSrcweir         }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 
446cdf0e10cSrcweir 		// access to OutputDevice
447cdf0e10cSrcweir 		OutputDevice* ObjectContactOfPageView::TryToGetOutputDevice() const
448cdf0e10cSrcweir 		{
449cdf0e10cSrcweir 			SdrPreRenderDevice* pPreRenderDevice = mrPageWindow.GetPaintWindow().GetPreRenderDevice();
450cdf0e10cSrcweir 
451cdf0e10cSrcweir 			if(pPreRenderDevice)
452cdf0e10cSrcweir 			{
453cdf0e10cSrcweir 				return &(pPreRenderDevice->GetPreRenderDevice());
454cdf0e10cSrcweir 			}
455cdf0e10cSrcweir 			else
456cdf0e10cSrcweir 			{
457cdf0e10cSrcweir 				return &(mrPageWindow.GetPaintWindow().GetOutputDevice());
458cdf0e10cSrcweir 			}
459cdf0e10cSrcweir 		}
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 		// set all UNO controls displayed in the view to design/alive mode
462cdf0e10cSrcweir         void ObjectContactOfPageView::SetUNOControlsDesignMode( bool _bDesignMode ) const
463cdf0e10cSrcweir         {
464cdf0e10cSrcweir             const sal_uInt32 nCount(getViewObjectContactCount());
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 			for(sal_uInt32 a(0); a < nCount; a++)
467cdf0e10cSrcweir             {
468cdf0e10cSrcweir                 const ViewObjectContact* pVOC = getViewObjectContact(a);
469cdf0e10cSrcweir 				const ViewObjectContactOfUnoControl* pUnoObjectVOC = dynamic_cast< const ViewObjectContactOfUnoControl* >(pVOC);
470cdf0e10cSrcweir 
471cdf0e10cSrcweir 				if(pUnoObjectVOC)
472cdf0e10cSrcweir 				{
473cdf0e10cSrcweir 	                pUnoObjectVOC->setControlDesignMode(_bDesignMode);
474cdf0e10cSrcweir 				}
475cdf0e10cSrcweir             }
476cdf0e10cSrcweir         }
477cdf0e10cSrcweir 	} // end of namespace contact
478cdf0e10cSrcweir } // end of namespace sdr
479cdf0e10cSrcweir 
480cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
481cdf0e10cSrcweir // eof
482