xref: /AOO41X/main/svx/source/sdr/contact/objectcontactofpageview.cxx (revision a7185797e047c8f52864528f1019933e924bbbe5)
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
10cdf0e10cSrcweir  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
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 <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 <basegfx/matrix/b2dhommatrix.hxx>
39cdf0e10cSrcweir #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
40cdf0e10cSrcweir #include <com/sun/star/rendering/XSpriteCanvas.hpp>
41*a7185797SArmin Le Grand #include <drawinglayer/processor2d/processor2dtools.hxx>
42cdf0e10cSrcweir #include <svx/unoapi.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
45cdf0e10cSrcweir 
46cdf0e10cSrcweir using namespace com::sun::star;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
49cdf0e10cSrcweir 
50cdf0e10cSrcweir namespace sdr
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 	namespace contact
53cdf0e10cSrcweir 	{
54cdf0e10cSrcweir 		// internal access to SdrPage of SdrPageView
55cdf0e10cSrcweir 		SdrPage* ObjectContactOfPageView::GetSdrPage() const
56cdf0e10cSrcweir 		{
57cdf0e10cSrcweir 			return GetPageWindow().GetPageView().GetPage();
58cdf0e10cSrcweir 		}
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 		ObjectContactOfPageView::ObjectContactOfPageView(SdrPageWindow& rPageWindow)
61cdf0e10cSrcweir 		:	ObjectContact(),
62cdf0e10cSrcweir 			mrPageWindow(rPageWindow)
63cdf0e10cSrcweir 		{
64cdf0e10cSrcweir 			// init PreviewRenderer flag
65cdf0e10cSrcweir 			setPreviewRenderer(((SdrPaintView&)rPageWindow.GetPageView().GetView()).IsPreviewRenderer());
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 			// init timer
68cdf0e10cSrcweir 			SetTimeout(1);
69cdf0e10cSrcweir 			Stop();
70cdf0e10cSrcweir 		}
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 		ObjectContactOfPageView::~ObjectContactOfPageView()
73cdf0e10cSrcweir 		{
74cdf0e10cSrcweir 			// execute missing LazyInvalidates and stop timer
75cdf0e10cSrcweir 			Timeout();
76cdf0e10cSrcweir 		}
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 		// LazyInvalidate request. Take action.
79cdf0e10cSrcweir 		void ObjectContactOfPageView::setLazyInvalidate(ViewObjectContact& /*rVOC*/)
80cdf0e10cSrcweir 		{
81cdf0e10cSrcweir 			// do NOT call parent, but remember that something is to do by
82cdf0e10cSrcweir 			// starting the LazyInvalidateTimer
83cdf0e10cSrcweir 			Start();
84cdf0e10cSrcweir 		}
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 		// call this to support evtl. preparations for repaint
87cdf0e10cSrcweir 		void ObjectContactOfPageView::PrepareProcessDisplay()
88cdf0e10cSrcweir 		{
89cdf0e10cSrcweir 			if(IsActive())
90cdf0e10cSrcweir 			{
91cdf0e10cSrcweir 				static bool bInvalidateDuringPaint(true);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 				if(bInvalidateDuringPaint)
94cdf0e10cSrcweir 				{
95cdf0e10cSrcweir 					// there are still non-triggered LazyInvalidate events, trigger these
96cdf0e10cSrcweir 					Timeout();
97cdf0e10cSrcweir 				}
98cdf0e10cSrcweir 			}
99cdf0e10cSrcweir 		}
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 		// From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
102cdf0e10cSrcweir 		void ObjectContactOfPageView::Timeout()
103cdf0e10cSrcweir 		{
104cdf0e10cSrcweir 			// stop the timer
105cdf0e10cSrcweir 			Stop();
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 			// invalidate all LazyInvalidate VOCs new situations
108cdf0e10cSrcweir 			const sal_uInt32 nVOCCount(getViewObjectContactCount());
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 			for(sal_uInt32 a(0); a < nVOCCount; a++)
111cdf0e10cSrcweir 			{
112cdf0e10cSrcweir 				ViewObjectContact* pCandidate = getViewObjectContact(a);
113cdf0e10cSrcweir 				pCandidate->triggerLazyInvalidate();
114cdf0e10cSrcweir 			}
115cdf0e10cSrcweir 		}
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 		// Process the whole displaying
118cdf0e10cSrcweir 		void ObjectContactOfPageView::ProcessDisplay(DisplayInfo& rDisplayInfo)
119cdf0e10cSrcweir 		{
120cdf0e10cSrcweir 			const SdrPage* pStartPage = GetSdrPage();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 			if(pStartPage && !rDisplayInfo.GetProcessLayers().IsEmpty())
123cdf0e10cSrcweir 			{
124cdf0e10cSrcweir 				const ViewContact& rDrawPageVC = pStartPage->GetViewContact();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 				if(rDrawPageVC.GetObjectCount())
127cdf0e10cSrcweir 				{
128cdf0e10cSrcweir 					DoProcessDisplay(rDisplayInfo);
129cdf0e10cSrcweir 				}
130cdf0e10cSrcweir 			}
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 			// after paint take care of the evtl. scheduled asynchronious commands.
133cdf0e10cSrcweir 			// Do this by resetting the timer contained there. Thus, after the paint
134cdf0e10cSrcweir 			// that timer will be triggered and the events will be executed.
135cdf0e10cSrcweir 			if(HasEventHandler())
136cdf0e10cSrcweir 			{
137cdf0e10cSrcweir 				sdr::event::TimerEventHandler& rEventHandler = GetEventHandler();
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 				if(!rEventHandler.IsEmpty())
140cdf0e10cSrcweir 				{
141cdf0e10cSrcweir 					rEventHandler.Restart();
142cdf0e10cSrcweir 				}
143cdf0e10cSrcweir 			}
144cdf0e10cSrcweir 		}
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 		// Process the whole displaying. Only use given DsiplayInfo, do not access other
147cdf0e10cSrcweir 		// OutputDevices then the given ones.
148cdf0e10cSrcweir 		void ObjectContactOfPageView::DoProcessDisplay(DisplayInfo& rDisplayInfo)
149cdf0e10cSrcweir 		{
150cdf0e10cSrcweir 			// visualize entered group when that feature is switched on and it's not
151cdf0e10cSrcweir 			// a print output. #i29129# No ghosted display for printing.
152cdf0e10cSrcweir 			sal_Bool bVisualizeEnteredGroup(DoVisualizeEnteredGroup() && !isOutputToPrinter());
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 			// Visualize entered groups: Set to ghosted as default
155cdf0e10cSrcweir 			// start. Do this only for the DrawPage, not for MasterPages
156cdf0e10cSrcweir 			if(bVisualizeEnteredGroup)
157cdf0e10cSrcweir 			{
158cdf0e10cSrcweir 				rDisplayInfo.SetGhostedDrawMode();
159cdf0e10cSrcweir 			}
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 			// #114359# save old and set clip region
162cdf0e10cSrcweir 			OutputDevice* pOutDev = TryToGetOutputDevice();
163cdf0e10cSrcweir 			OSL_ENSURE(0 != pOutDev, "ObjectContactOfPageView without OutDev, someone has overloaded TryToGetOutputDevice wrong (!)");
164cdf0e10cSrcweir 			sal_Bool bClipRegionPushed(sal_False);
165cdf0e10cSrcweir 			const Region& rRedrawArea(rDisplayInfo.GetRedrawArea());
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 			if(!rRedrawArea.IsEmpty())
168cdf0e10cSrcweir 			{
169cdf0e10cSrcweir 				bClipRegionPushed = sal_True;
170cdf0e10cSrcweir 				pOutDev->Push(PUSH_CLIPREGION);
171cdf0e10cSrcweir 				pOutDev->IntersectClipRegion(rRedrawArea);
172cdf0e10cSrcweir 			}
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 			// Get start node and process DrawPage contents
175cdf0e10cSrcweir 			const ViewObjectContact& rDrawPageVOContact = GetSdrPage()->GetViewContact().GetViewObjectContact(*this);
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 			// update current ViewInformation2D at the ObjectContact
178cdf0e10cSrcweir 			const double fCurrentTime(getPrimitiveAnimator().GetTime());
179cdf0e10cSrcweir 			OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice();
180cdf0e10cSrcweir             basegfx::B2DRange aViewRange;
1815f27b83cSArmin Le Grand             basegfx::B2DHomMatrix aViewTransformation;
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());
2315f27b83cSArmin Le Grand 
2325f27b83cSArmin Le Grand                 // for metafile, leave ViewTransformation empty, but for pixel renderer
2335f27b83cSArmin Le Grand                 // get it from OutputDevice
2345f27b83cSArmin Le Grand                 aViewTransformation = rTargetOutDev.GetViewTransformation();
235cdf0e10cSrcweir 			}
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 			// update local ViewInformation2D
238cdf0e10cSrcweir 			const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
239cdf0e10cSrcweir 				basegfx::B2DHomMatrix(),
2405f27b83cSArmin Le Grand 				aViewTransformation,
241cdf0e10cSrcweir 				aViewRange,
242cdf0e10cSrcweir 				GetXDrawPageForSdrPage(GetSdrPage()),
243cdf0e10cSrcweir 				fCurrentTime,
244cdf0e10cSrcweir 				uno::Sequence<beans::PropertyValue>());
245cdf0e10cSrcweir 			updateViewInformation2D(aNewViewInformation2D);
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 			// get whole Primitive2DSequence; this will already make use of updated ViewInformation2D
248cdf0e10cSrcweir 			// and may use the MapMode from the Target OutDev in the DisplayInfo
249cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence(rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo));
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 			// if there is something to show, use a primitive processor to render it. There
252cdf0e10cSrcweir 			// is a choice between VCL and Canvas processors currently. The decision is made in
253*a7185797SArmin Le Grand 			// createProcessor2DFromOutputDevice and takes into accout things like the
254cdf0e10cSrcweir 			// Target is a MetaFile, a VDev or something else. The Canvas renderer is triggered
255cdf0e10cSrcweir 			// currently using the shown boolean. Canvas is not yet the default.
256cdf0e10cSrcweir 			if(xPrimitiveSequence.hasElements())
257cdf0e10cSrcweir 			{
258cdf0e10cSrcweir 				// prepare OutputDevice (historical stuff, maybe soon removed)
259cdf0e10cSrcweir 				rDisplayInfo.ClearGhostedDrawMode(); // reset, else the VCL-paint with the processor will not do the right thing
260cdf0e10cSrcweir 				pOutDev->SetLayoutMode(0); // reset, default is no BiDi/RTL
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 				// create renderer
263*a7185797SArmin Le Grand                 drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
264*a7185797SArmin Le Grand                     rTargetOutDev,
265*a7185797SArmin Le Grand                     getViewInformation2D());
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 				if(pProcessor2D)
268cdf0e10cSrcweir 				{
269cdf0e10cSrcweir 					pProcessor2D->process(xPrimitiveSequence);
270cdf0e10cSrcweir 					delete pProcessor2D;
271cdf0e10cSrcweir 				}
272cdf0e10cSrcweir 			}
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 			// #114359# restore old ClipReghion
275cdf0e10cSrcweir 			if(bClipRegionPushed)
276cdf0e10cSrcweir 			{
277cdf0e10cSrcweir 				pOutDev->Pop();
278cdf0e10cSrcweir 			}
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 			// Visualize entered groups: Reset to original DrawMode
281cdf0e10cSrcweir 			if(bVisualizeEnteredGroup)
282cdf0e10cSrcweir 			{
283cdf0e10cSrcweir 				rDisplayInfo.ClearGhostedDrawMode();
284cdf0e10cSrcweir 			}
285cdf0e10cSrcweir 		}
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 		// test if visualizing of entered groups is switched on at all
288cdf0e10cSrcweir 		bool ObjectContactOfPageView::DoVisualizeEnteredGroup() const
289cdf0e10cSrcweir 		{
290cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
291cdf0e10cSrcweir 			return rView.DoVisualizeEnteredGroup();
292cdf0e10cSrcweir 		}
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 		// get active group's (the entered group) ViewContact
295cdf0e10cSrcweir 		const ViewContact* ObjectContactOfPageView::getActiveViewContact() const
296cdf0e10cSrcweir 		{
297cdf0e10cSrcweir 			SdrObjList* pActiveGroupList = GetPageWindow().GetPageView().GetObjList();
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 			if(pActiveGroupList)
300cdf0e10cSrcweir 			{
301cdf0e10cSrcweir 				if(pActiveGroupList->ISA(SdrPage))
302cdf0e10cSrcweir 				{
303cdf0e10cSrcweir 					// It's a Page itself
304cdf0e10cSrcweir 					return &(((SdrPage*)pActiveGroupList)->GetViewContact());
305cdf0e10cSrcweir 				}
306cdf0e10cSrcweir 				else if(pActiveGroupList->GetOwnerObj())
307cdf0e10cSrcweir 				{
308cdf0e10cSrcweir 					// Group object
309cdf0e10cSrcweir 					return &(pActiveGroupList->GetOwnerObj()->GetViewContact());
310cdf0e10cSrcweir 				}
311cdf0e10cSrcweir 			}
312cdf0e10cSrcweir 			else if(GetSdrPage())
313cdf0e10cSrcweir 			{
314cdf0e10cSrcweir 				// use page of associated SdrPageView
315cdf0e10cSrcweir 				return &(GetSdrPage()->GetViewContact());
316cdf0e10cSrcweir 			}
317cdf0e10cSrcweir 
318cdf0e10cSrcweir 			return 0;
319cdf0e10cSrcweir 		}
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 		// Invalidate given rectangle at the window/output which is represented by
322cdf0e10cSrcweir 		// this ObjectContact.
323cdf0e10cSrcweir 		void ObjectContactOfPageView::InvalidatePartOfView(const basegfx::B2DRange& rRange) const
324cdf0e10cSrcweir 		{
325cdf0e10cSrcweir 			// invalidate at associated PageWindow
326cdf0e10cSrcweir             GetPageWindow().InvalidatePageWindow(rRange);
327cdf0e10cSrcweir 		}
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 		// Get info if given Rectangle is visible in this view
330cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsAreaVisible(const basegfx::B2DRange& rRange) const
331cdf0e10cSrcweir 		{
332cdf0e10cSrcweir 			// compare with the visible rectangle
333cdf0e10cSrcweir 			if(rRange.isEmpty())
334cdf0e10cSrcweir 			{
335cdf0e10cSrcweir 				// no range -> not visible
336cdf0e10cSrcweir 				return false;
337cdf0e10cSrcweir 			}
338cdf0e10cSrcweir 			else
339cdf0e10cSrcweir 			{
340cdf0e10cSrcweir 				const OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice();
341cdf0e10cSrcweir 				const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel());
342cdf0e10cSrcweir 				basegfx::B2DRange aLogicViewRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 				aLogicViewRange.transform(rTargetOutDev.GetInverseViewTransformation());
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 				if(!aLogicViewRange.isEmpty() && !aLogicViewRange.overlaps(rRange))
347cdf0e10cSrcweir 				{
348cdf0e10cSrcweir 					return false;
349cdf0e10cSrcweir 				}
350cdf0e10cSrcweir 			}
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 			// call parent
353cdf0e10cSrcweir 			return ObjectContact::IsAreaVisible(rRange);
354cdf0e10cSrcweir 		}
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 		// Get info about the need to visualize GluePoints
357cdf0e10cSrcweir 		bool ObjectContactOfPageView::AreGluePointsVisible() const
358cdf0e10cSrcweir 		{
359cdf0e10cSrcweir 			return GetPageWindow().GetPageView().GetView().ImpIsGlueVisible();
360cdf0e10cSrcweir 		}
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 		// check if text animation is allowed.
363cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsTextAnimationAllowed() const
364cdf0e10cSrcweir 		{
365cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
366cdf0e10cSrcweir 			const SvtAccessibilityOptions& rOpt = rView.getAccessibilityOptions();
367cdf0e10cSrcweir 			return rOpt.GetIsAllowAnimatedText();
368cdf0e10cSrcweir 		}
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 		// check if graphic animation is allowed.
371cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsGraphicAnimationAllowed() const
372cdf0e10cSrcweir 		{
373cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
374cdf0e10cSrcweir 			const SvtAccessibilityOptions& rOpt = rView.getAccessibilityOptions();
375cdf0e10cSrcweir 			return rOpt.GetIsAllowAnimatedGraphics();
376cdf0e10cSrcweir 		}
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 		// check if asynchronious graphis loading is allowed. Default is sal_False.
379cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsAsynchronGraphicsLoadingAllowed() const
380cdf0e10cSrcweir 		{
381cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
382cdf0e10cSrcweir 			return rView.IsSwapAsynchron();
383cdf0e10cSrcweir 		}
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 		// check if buffering of MasterPages is allowed. Default is sal_False.
386cdf0e10cSrcweir 		bool ObjectContactOfPageView::IsMasterPageBufferingAllowed() const
387cdf0e10cSrcweir 		{
388cdf0e10cSrcweir 			SdrView& rView = GetPageWindow().GetPageView().GetView();
389cdf0e10cSrcweir 			return rView.IsMasterPagePaintCaching();
390cdf0e10cSrcweir 		}
391cdf0e10cSrcweir 
392cdf0e10cSrcweir 		// print?
393cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToPrinter() const
394cdf0e10cSrcweir 		{
395cdf0e10cSrcweir 			return (OUTDEV_PRINTER == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
396cdf0e10cSrcweir 		}
397cdf0e10cSrcweir 
398cdf0e10cSrcweir 		// window?
399cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToWindow() const
400cdf0e10cSrcweir 		{
401cdf0e10cSrcweir 			return (OUTDEV_WINDOW == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
402cdf0e10cSrcweir 		}
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 		// VirtualDevice?
405cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToVirtualDevice() const
406cdf0e10cSrcweir 		{
407cdf0e10cSrcweir 			return (OUTDEV_VIRDEV == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
408cdf0e10cSrcweir 		}
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 		// recording MetaFile?
411cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToRecordingMetaFile() const
412cdf0e10cSrcweir 		{
413cdf0e10cSrcweir 			GDIMetaFile* pMetaFile = mrPageWindow.GetPaintWindow().GetOutputDevice().GetConnectMetaFile();
414cdf0e10cSrcweir 			return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
415cdf0e10cSrcweir 		}
416cdf0e10cSrcweir 
417cdf0e10cSrcweir 		// pdf export?
418cdf0e10cSrcweir 		bool ObjectContactOfPageView::isOutputToPDFFile() const
419cdf0e10cSrcweir 		{
420cdf0e10cSrcweir             return (0 != mrPageWindow.GetPaintWindow().GetOutputDevice().GetPDFWriter());
421cdf0e10cSrcweir 		}
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 		// gray display mode
424cdf0e10cSrcweir 		bool ObjectContactOfPageView::isDrawModeGray() const
425cdf0e10cSrcweir 		{
426cdf0e10cSrcweir 			const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
427cdf0e10cSrcweir 			return (nDrawMode == (DRAWMODE_GRAYLINE|DRAWMODE_GRAYFILL|DRAWMODE_BLACKTEXT|DRAWMODE_GRAYBITMAP|DRAWMODE_GRAYGRADIENT));
428cdf0e10cSrcweir 		}
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 		// gray display mode
431cdf0e10cSrcweir 		bool ObjectContactOfPageView::isDrawModeBlackWhite() const
432cdf0e10cSrcweir 		{
433cdf0e10cSrcweir 			const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
434cdf0e10cSrcweir 			return (nDrawMode == (DRAWMODE_BLACKLINE|DRAWMODE_BLACKTEXT|DRAWMODE_WHITEFILL|DRAWMODE_GRAYBITMAP|DRAWMODE_WHITEGRADIENT));
435cdf0e10cSrcweir 		}
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 		// high contrast display mode
438cdf0e10cSrcweir 		bool ObjectContactOfPageView::isDrawModeHighContrast() const
439cdf0e10cSrcweir 		{
440cdf0e10cSrcweir 			const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
441cdf0e10cSrcweir 			return (nDrawMode == (DRAWMODE_SETTINGSLINE|DRAWMODE_SETTINGSFILL|DRAWMODE_SETTINGSTEXT|DRAWMODE_SETTINGSGRADIENT));
442cdf0e10cSrcweir 		}
443cdf0e10cSrcweir 
444cdf0e10cSrcweir         // access to SdrPageView
445cdf0e10cSrcweir 		SdrPageView* ObjectContactOfPageView::TryToGetSdrPageView() const
446cdf0e10cSrcweir         {
447cdf0e10cSrcweir             return &(mrPageWindow.GetPageView());
448cdf0e10cSrcweir         }
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 
451cdf0e10cSrcweir 		// access to OutputDevice
452cdf0e10cSrcweir 		OutputDevice* ObjectContactOfPageView::TryToGetOutputDevice() const
453cdf0e10cSrcweir 		{
454cdf0e10cSrcweir 			SdrPreRenderDevice* pPreRenderDevice = mrPageWindow.GetPaintWindow().GetPreRenderDevice();
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 			if(pPreRenderDevice)
457cdf0e10cSrcweir 			{
458cdf0e10cSrcweir 				return &(pPreRenderDevice->GetPreRenderDevice());
459cdf0e10cSrcweir 			}
460cdf0e10cSrcweir 			else
461cdf0e10cSrcweir 			{
462cdf0e10cSrcweir 				return &(mrPageWindow.GetPaintWindow().GetOutputDevice());
463cdf0e10cSrcweir 			}
464cdf0e10cSrcweir 		}
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 		// set all UNO controls displayed in the view to design/alive mode
467cdf0e10cSrcweir         void ObjectContactOfPageView::SetUNOControlsDesignMode( bool _bDesignMode ) const
468cdf0e10cSrcweir         {
469cdf0e10cSrcweir             const sal_uInt32 nCount(getViewObjectContactCount());
470cdf0e10cSrcweir 
471cdf0e10cSrcweir 			for(sal_uInt32 a(0); a < nCount; a++)
472cdf0e10cSrcweir             {
473cdf0e10cSrcweir                 const ViewObjectContact* pVOC = getViewObjectContact(a);
474cdf0e10cSrcweir 				const ViewObjectContactOfUnoControl* pUnoObjectVOC = dynamic_cast< const ViewObjectContactOfUnoControl* >(pVOC);
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 				if(pUnoObjectVOC)
477cdf0e10cSrcweir 				{
478cdf0e10cSrcweir 	                pUnoObjectVOC->setControlDesignMode(_bDesignMode);
479cdf0e10cSrcweir 				}
480cdf0e10cSrcweir             }
481cdf0e10cSrcweir         }
482cdf0e10cSrcweir 	} // end of namespace contact
483cdf0e10cSrcweir } // end of namespace sdr
484cdf0e10cSrcweir 
485cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
486cdf0e10cSrcweir // eof
487