xref: /trunk/main/svx/source/sdr/contact/objectcontactofpageview.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
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>
41a7185797SArmin 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
GetSdrPage() const55cdf0e10cSrcweir         SdrPage* ObjectContactOfPageView::GetSdrPage() const
56cdf0e10cSrcweir         {
57cdf0e10cSrcweir             return GetPageWindow().GetPageView().GetPage();
58cdf0e10cSrcweir         }
59cdf0e10cSrcweir 
ObjectContactOfPageView(SdrPageWindow & rPageWindow)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 
~ObjectContactOfPageView()72cdf0e10cSrcweir         ObjectContactOfPageView::~ObjectContactOfPageView()
73cdf0e10cSrcweir         {
74cdf0e10cSrcweir             // execute missing LazyInvalidates and stop timer
75cdf0e10cSrcweir             Timeout();
76cdf0e10cSrcweir         }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         // LazyInvalidate request. Take action.
setLazyInvalidate(ViewObjectContact &)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
PrepareProcessDisplay()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
Timeout()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
ProcessDisplay(DisplayInfo & rDisplayInfo)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.
DoProcessDisplay(DisplayInfo & rDisplayInfo)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;
181cdf0e10cSrcweir 
182cdf0e10cSrcweir             // create ViewRange
183cdf0e10cSrcweir             if(isOutputToRecordingMetaFile())
184cdf0e10cSrcweir             {
185cdf0e10cSrcweir                 if(isOutputToPDFFile() || isOutputToPrinter())
186cdf0e10cSrcweir                 {
187cdf0e10cSrcweir                     // #i98402# if it's a PDF export, set the ClipRegion as ViewRange. This is
188cdf0e10cSrcweir                     // mainly because SW does not use DrawingLayer Page-Oriented and if not doing this,
189cdf0e10cSrcweir                     // all existing objects will be collected as primitives and processed.
190cdf0e10cSrcweir                     // OD 2009-03-05 #i99876# perform the same also for SW on printing.
191cdf0e10cSrcweir                     const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect());
192cdf0e10cSrcweir 
193cdf0e10cSrcweir                     aViewRange = basegfx::B2DRange(
194cdf0e10cSrcweir                         aLogicClipRectangle.Left(), aLogicClipRectangle.Top(),
195cdf0e10cSrcweir                         aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom());
196cdf0e10cSrcweir                 }
197cdf0e10cSrcweir             }
198cdf0e10cSrcweir             else
199cdf0e10cSrcweir             {
200cdf0e10cSrcweir                 // use visible pixels, but transform to world coordinates
201cdf0e10cSrcweir                 const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel());
202cdf0e10cSrcweir                 aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
203cdf0e10cSrcweir 
204cdf0e10cSrcweir                 // if a clip region is set, use it
205cdf0e10cSrcweir                 if(!rDisplayInfo.GetRedrawArea().IsEmpty())
206cdf0e10cSrcweir                 {
207cdf0e10cSrcweir                     // get logic clip range and create discrete one
208cdf0e10cSrcweir                     const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect());
209cdf0e10cSrcweir                     basegfx::B2DRange aLogicClipRange(
210cdf0e10cSrcweir                         aLogicClipRectangle.Left(), aLogicClipRectangle.Top(),
211cdf0e10cSrcweir                         aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom());
212cdf0e10cSrcweir                     basegfx::B2DRange aDiscreteClipRange(aLogicClipRange);
213cdf0e10cSrcweir                     aDiscreteClipRange.transform(rTargetOutDev.GetViewTransformation());
214cdf0e10cSrcweir 
215cdf0e10cSrcweir                     // align the discrete one to discrete boundaries (pixel bounds). Also
216cdf0e10cSrcweir                     // expand X and Y max by one due to Rectangle definition source
217cdf0e10cSrcweir                     aDiscreteClipRange.expand(basegfx::B2DTuple(
218cdf0e10cSrcweir                         floor(aDiscreteClipRange.getMinX()),
219cdf0e10cSrcweir                         floor(aDiscreteClipRange.getMinY())));
220cdf0e10cSrcweir                     aDiscreteClipRange.expand(basegfx::B2DTuple(
221cdf0e10cSrcweir                         1.0 + ceil(aDiscreteClipRange.getMaxX()),
222cdf0e10cSrcweir                         1.0 + ceil(aDiscreteClipRange.getMaxY())));
223cdf0e10cSrcweir 
224cdf0e10cSrcweir                     // intersect current ViewRange with ClipRange
225cdf0e10cSrcweir                     aViewRange.intersect(aDiscreteClipRange);
226cdf0e10cSrcweir                 }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir                 // transform to world coordinates
229cdf0e10cSrcweir                 aViewRange.transform(rTargetOutDev.GetInverseViewTransformation());
230cdf0e10cSrcweir             }
231cdf0e10cSrcweir 
232cdf0e10cSrcweir             // update local ViewInformation2D
233cdf0e10cSrcweir             const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
234cdf0e10cSrcweir                 basegfx::B2DHomMatrix(),
235cf95e506SArmin Le Grand                 rTargetOutDev.GetViewTransformation(),
236cdf0e10cSrcweir                 aViewRange,
237cdf0e10cSrcweir                 GetXDrawPageForSdrPage(GetSdrPage()),
238cdf0e10cSrcweir                 fCurrentTime,
239cdf0e10cSrcweir                 uno::Sequence<beans::PropertyValue>());
240cdf0e10cSrcweir             updateViewInformation2D(aNewViewInformation2D);
241cdf0e10cSrcweir 
242cdf0e10cSrcweir             // get whole Primitive2DSequence; this will already make use of updated ViewInformation2D
243cdf0e10cSrcweir             // and may use the MapMode from the Target OutDev in the DisplayInfo
244cdf0e10cSrcweir             drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence(rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo));
245cdf0e10cSrcweir 
246cdf0e10cSrcweir             // if there is something to show, use a primitive processor to render it. There
247cdf0e10cSrcweir             // is a choice between VCL and Canvas processors currently. The decision is made in
248*582f2a02SJohn Bampton             // createProcessor2DFromOutputDevice and takes into account things like the
249cdf0e10cSrcweir             // Target is a MetaFile, a VDev or something else. The Canvas renderer is triggered
250cdf0e10cSrcweir             // currently using the shown boolean. Canvas is not yet the default.
251cdf0e10cSrcweir             if(xPrimitiveSequence.hasElements())
252cdf0e10cSrcweir             {
253cdf0e10cSrcweir                 // prepare OutputDevice (historical stuff, maybe soon removed)
254cdf0e10cSrcweir                 rDisplayInfo.ClearGhostedDrawMode(); // reset, else the VCL-paint with the processor will not do the right thing
255cdf0e10cSrcweir                 pOutDev->SetLayoutMode(0); // reset, default is no BiDi/RTL
256cdf0e10cSrcweir 
257cdf0e10cSrcweir                 // create renderer
258a7185797SArmin Le Grand                 drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
259a7185797SArmin Le Grand                     rTargetOutDev,
260a7185797SArmin Le Grand                     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
DoVisualizeEnteredGroup() const283cdf0e10cSrcweir         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
getActiveViewContact() const290cdf0e10cSrcweir         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.
InvalidatePartOfView(const basegfx::B2DRange & rRange) const318cdf0e10cSrcweir         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
IsAreaVisible(const basegfx::B2DRange & rRange) const325cdf0e10cSrcweir         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
AreGluePointsVisible() const352cdf0e10cSrcweir         bool ObjectContactOfPageView::AreGluePointsVisible() const
353cdf0e10cSrcweir         {
354cdf0e10cSrcweir             return GetPageWindow().GetPageView().GetView().ImpIsGlueVisible();
355cdf0e10cSrcweir         }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir         // check if text animation is allowed.
IsTextAnimationAllowed() const358cdf0e10cSrcweir         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.
IsGraphicAnimationAllowed() const366cdf0e10cSrcweir         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.
IsAsynchronGraphicsLoadingAllowed() const374cdf0e10cSrcweir         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.
IsMasterPageBufferingAllowed() const381cdf0e10cSrcweir         bool ObjectContactOfPageView::IsMasterPageBufferingAllowed() const
382cdf0e10cSrcweir         {
383cdf0e10cSrcweir             SdrView& rView = GetPageWindow().GetPageView().GetView();
384cdf0e10cSrcweir             return rView.IsMasterPagePaintCaching();
385cdf0e10cSrcweir         }
386cdf0e10cSrcweir 
387cdf0e10cSrcweir         // print?
isOutputToPrinter() const388cdf0e10cSrcweir         bool ObjectContactOfPageView::isOutputToPrinter() const
389cdf0e10cSrcweir         {
390cdf0e10cSrcweir             return (OUTDEV_PRINTER == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
391cdf0e10cSrcweir         }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir         // window?
isOutputToWindow() const394cdf0e10cSrcweir         bool ObjectContactOfPageView::isOutputToWindow() const
395cdf0e10cSrcweir         {
396cdf0e10cSrcweir             return (OUTDEV_WINDOW == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
397cdf0e10cSrcweir         }
398cdf0e10cSrcweir 
399cdf0e10cSrcweir         // VirtualDevice?
isOutputToVirtualDevice() const400cdf0e10cSrcweir         bool ObjectContactOfPageView::isOutputToVirtualDevice() const
401cdf0e10cSrcweir         {
402cdf0e10cSrcweir             return (OUTDEV_VIRDEV == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
403cdf0e10cSrcweir         }
404cdf0e10cSrcweir 
405cdf0e10cSrcweir         // recording MetaFile?
isOutputToRecordingMetaFile() const406cdf0e10cSrcweir         bool ObjectContactOfPageView::isOutputToRecordingMetaFile() const
407cdf0e10cSrcweir         {
408cdf0e10cSrcweir             GDIMetaFile* pMetaFile = mrPageWindow.GetPaintWindow().GetOutputDevice().GetConnectMetaFile();
409cdf0e10cSrcweir             return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
410cdf0e10cSrcweir         }
411cdf0e10cSrcweir 
412cdf0e10cSrcweir         // pdf export?
isOutputToPDFFile() const413cdf0e10cSrcweir         bool ObjectContactOfPageView::isOutputToPDFFile() const
414cdf0e10cSrcweir         {
415cdf0e10cSrcweir             return (0 != mrPageWindow.GetPaintWindow().GetOutputDevice().GetPDFWriter());
416cdf0e10cSrcweir         }
417cdf0e10cSrcweir 
418cdf0e10cSrcweir         // gray display mode
isDrawModeGray() const419cdf0e10cSrcweir         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
isDrawModeBlackWhite() const426cdf0e10cSrcweir         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
isDrawModeHighContrast() const433cdf0e10cSrcweir         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
TryToGetSdrPageView() const440cdf0e10cSrcweir         SdrPageView* ObjectContactOfPageView::TryToGetSdrPageView() const
441cdf0e10cSrcweir         {
442cdf0e10cSrcweir             return &(mrPageWindow.GetPageView());
443cdf0e10cSrcweir         }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 
446cdf0e10cSrcweir         // access to OutputDevice
TryToGetOutputDevice() const447cdf0e10cSrcweir         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
SetUNOControlsDesignMode(bool _bDesignMode) const462cdf0e10cSrcweir         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