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 
31*cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontactofpageobj.hxx>
32*cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofpageobj.hxx>
33*cdf0e10cSrcweir #include <svx/svdopage.hxx>
34*cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
35*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
36*cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
37*cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
38*cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
39*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
40*cdf0e10cSrcweir #include <svx/svdpage.hxx>
41*cdf0e10cSrcweir #include <svx/unoapi.hxx>
42*cdf0e10cSrcweir #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
43*cdf0e10cSrcweir #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir using namespace com::sun::star;
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace sdr
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir     namespace contact
54*cdf0e10cSrcweir     {
55*cdf0e10cSrcweir         class PagePrimitiveExtractor : public ObjectContactOfPagePainter, public Timer
56*cdf0e10cSrcweir 	    {
57*cdf0e10cSrcweir 	    private:
58*cdf0e10cSrcweir 		    // the ViewObjectContactOfPageObj using this painter
59*cdf0e10cSrcweir 		    ViewObjectContactOfPageObj&			mrViewObjectContactOfPageObj;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir 	    public:
62*cdf0e10cSrcweir 		    // basic constructor/destructor
63*cdf0e10cSrcweir 		    PagePrimitiveExtractor(ViewObjectContactOfPageObj& rVOC);
64*cdf0e10cSrcweir 		    virtual ~PagePrimitiveExtractor();
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 		    // LazyInvalidate request. Supported here to not automatically
67*cdf0e10cSrcweir 		    // invalidate the second interaction state all the time at the
68*cdf0e10cSrcweir 		    // original OC
69*cdf0e10cSrcweir 		    virtual void setLazyInvalidate(ViewObjectContact& rVOC);
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 		    // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
72*cdf0e10cSrcweir 		    virtual void Timeout();
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 		    // get primitive visualization
75*cdf0e10cSrcweir 		    drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceForPage(const DisplayInfo& rDisplayInfo);
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 		    // Own reaction on changes which will be forwarded to the OC of the owner-VOC
78*cdf0e10cSrcweir 		    virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir             // forward access to SdrPageView of ViewObjectContactOfPageObj
81*cdf0e10cSrcweir 		    virtual bool isOutputToPrinter() const;
82*cdf0e10cSrcweir 		    virtual bool isOutputToWindow() const;
83*cdf0e10cSrcweir 		    virtual bool isOutputToVirtualDevice() const;
84*cdf0e10cSrcweir 		    virtual bool isOutputToRecordingMetaFile() const;
85*cdf0e10cSrcweir 			virtual bool isOutputToPDFFile() const;
86*cdf0e10cSrcweir 		    virtual bool isDrawModeGray() const;
87*cdf0e10cSrcweir 		    virtual bool isDrawModeBlackWhite() const;
88*cdf0e10cSrcweir 		    virtual bool isDrawModeHighContrast() const;
89*cdf0e10cSrcweir 		    virtual SdrPageView* TryToGetSdrPageView() const;
90*cdf0e10cSrcweir 		    virtual OutputDevice* TryToGetOutputDevice() const;
91*cdf0e10cSrcweir 	    };
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	    PagePrimitiveExtractor::PagePrimitiveExtractor(
94*cdf0e10cSrcweir 		    ViewObjectContactOfPageObj& rVOC)
95*cdf0e10cSrcweir 	    :	ObjectContactOfPagePainter(0, rVOC.GetObjectContact()),
96*cdf0e10cSrcweir 		    mrViewObjectContactOfPageObj(rVOC)
97*cdf0e10cSrcweir 	    {
98*cdf0e10cSrcweir 		    // make this renderer a preview renderer
99*cdf0e10cSrcweir 		    setPreviewRenderer(true);
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 		    // init timer
102*cdf0e10cSrcweir 		    SetTimeout(1);
103*cdf0e10cSrcweir 		    Stop();
104*cdf0e10cSrcweir 	    }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 	    PagePrimitiveExtractor::~PagePrimitiveExtractor()
107*cdf0e10cSrcweir 	    {
108*cdf0e10cSrcweir 		    // execute missing LazyInvalidates and stop timer
109*cdf0e10cSrcweir 		    Timeout();
110*cdf0e10cSrcweir 	    }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	    void PagePrimitiveExtractor::setLazyInvalidate(ViewObjectContact& /*rVOC*/)
113*cdf0e10cSrcweir 	    {
114*cdf0e10cSrcweir 		    // do NOT call parent, but remember that something is to do by
115*cdf0e10cSrcweir 		    // starting the LazyInvalidateTimer
116*cdf0e10cSrcweir 		    Start();
117*cdf0e10cSrcweir 	    }
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 	    // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
120*cdf0e10cSrcweir 	    void PagePrimitiveExtractor::Timeout()
121*cdf0e10cSrcweir 	    {
122*cdf0e10cSrcweir 		    // stop the timer
123*cdf0e10cSrcweir 		    Stop();
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 		    // invalidate all LazyInvalidate VOCs new situations
126*cdf0e10cSrcweir 		    const sal_uInt32 nVOCCount(getViewObjectContactCount());
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 		    for(sal_uInt32 a(0); a < nVOCCount; a++)
129*cdf0e10cSrcweir 		    {
130*cdf0e10cSrcweir 			    ViewObjectContact* pCandidate = getViewObjectContact(a);
131*cdf0e10cSrcweir 			    pCandidate->triggerLazyInvalidate();
132*cdf0e10cSrcweir 		    }
133*cdf0e10cSrcweir 	    }
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 	    drawinglayer::primitive2d::Primitive2DSequence PagePrimitiveExtractor::createPrimitive2DSequenceForPage(const DisplayInfo& /*rDisplayInfo*/)
136*cdf0e10cSrcweir 	    {
137*cdf0e10cSrcweir 		    drawinglayer::primitive2d::Primitive2DSequence xRetval;
138*cdf0e10cSrcweir 		    const SdrPage* pStartPage = GetStartPage();
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 		    if(pStartPage)
141*cdf0e10cSrcweir 		    {
142*cdf0e10cSrcweir                 // update own ViewInformation2D for visualized page
143*cdf0e10cSrcweir 			    const drawinglayer::geometry::ViewInformation2D& rOriginalViewInformation = mrViewObjectContactOfPageObj.GetObjectContact().getViewInformation2D();
144*cdf0e10cSrcweir                 const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
145*cdf0e10cSrcweir 				    rOriginalViewInformation.getObjectTransformation(),
146*cdf0e10cSrcweir 				    rOriginalViewInformation.getViewTransformation(),
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir                     // #i101075# use empty range for page content here to force
149*cdf0e10cSrcweir                     // the content not to be physically clipped in any way. This
150*cdf0e10cSrcweir                     // would be possible, but would require the internal transformation
151*cdf0e10cSrcweir                     // which maps between the page visualisation object and the page
152*cdf0e10cSrcweir                     // content, including the aspect ratios (for details see in
153*cdf0e10cSrcweir                     // PagePreviewPrimitive2D::create2DDecomposition)
154*cdf0e10cSrcweir                     basegfx::B2DRange(),
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir                     GetXDrawPageForSdrPage(const_cast< SdrPage* >(pStartPage)),
157*cdf0e10cSrcweir 				    0.0, // no time; page previews are not animated
158*cdf0e10cSrcweir 				    rOriginalViewInformation.getExtendedInformationSequence());
159*cdf0e10cSrcweir 			    updateViewInformation2D(aNewViewInformation2D);
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 			    // create copy of DisplayInfo to set PagePainting
162*cdf0e10cSrcweir 			    DisplayInfo aDisplayInfo;
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 			    // get page's VOC
165*cdf0e10cSrcweir 			    ViewObjectContact& rDrawPageVOContact = pStartPage->GetViewContact().GetViewObjectContact(*this);
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 			    // get whole Primitive2DSequence
168*cdf0e10cSrcweir 			    xRetval = rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo);
169*cdf0e10cSrcweir 		    }
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 		    return xRetval;
172*cdf0e10cSrcweir 	    }
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 	    void PagePrimitiveExtractor::InvalidatePartOfView(const basegfx::B2DRange& rRange) const
175*cdf0e10cSrcweir 	    {
176*cdf0e10cSrcweir 		    // an invalidate is called at this view, this needs to be translated to an invalidate
177*cdf0e10cSrcweir 		    // for the using VOC. Coordinates are in page coordinate system.
178*cdf0e10cSrcweir 		    const SdrPage* pStartPage = GetStartPage();
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 		    if(pStartPage && !rRange.isEmpty())
181*cdf0e10cSrcweir 		    {
182*cdf0e10cSrcweir 			    const basegfx::B2DRange aPageRange(0.0, 0.0, (double)pStartPage->GetWdt(), (double)pStartPage->GetHgt());
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 			    if(rRange.overlaps(aPageRange))
185*cdf0e10cSrcweir 			    {
186*cdf0e10cSrcweir 				    // if object on the page is inside or overlapping with page, create ActionChanged() for
187*cdf0e10cSrcweir 				    // involved VOC
188*cdf0e10cSrcweir 				    mrViewObjectContactOfPageObj.ActionChanged();
189*cdf0e10cSrcweir 			    }
190*cdf0e10cSrcweir 		    }
191*cdf0e10cSrcweir 	    }
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir         // forward access to SdrPageView to VOCOfPageObj
194*cdf0e10cSrcweir 	    bool PagePrimitiveExtractor::isOutputToPrinter() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPrinter(); }
195*cdf0e10cSrcweir 	    bool PagePrimitiveExtractor::isOutputToWindow() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToWindow(); }
196*cdf0e10cSrcweir 	    bool PagePrimitiveExtractor::isOutputToVirtualDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToVirtualDevice(); }
197*cdf0e10cSrcweir 	    bool PagePrimitiveExtractor::isOutputToRecordingMetaFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToRecordingMetaFile(); }
198*cdf0e10cSrcweir 		bool PagePrimitiveExtractor::isOutputToPDFFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPDFFile(); }
199*cdf0e10cSrcweir 	    bool PagePrimitiveExtractor::isDrawModeGray() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeGray(); }
200*cdf0e10cSrcweir 	    bool PagePrimitiveExtractor::isDrawModeBlackWhite() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeBlackWhite(); }
201*cdf0e10cSrcweir 	    bool PagePrimitiveExtractor::isDrawModeHighContrast() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeHighContrast(); }
202*cdf0e10cSrcweir 	    SdrPageView* PagePrimitiveExtractor::TryToGetSdrPageView() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetSdrPageView(); }
203*cdf0e10cSrcweir 	    OutputDevice* PagePrimitiveExtractor::TryToGetOutputDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetOutputDevice(); }
204*cdf0e10cSrcweir 	} // end of namespace contact
205*cdf0e10cSrcweir } // end of namespace sdr
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir namespace sdr
210*cdf0e10cSrcweir {
211*cdf0e10cSrcweir 	namespace contact
212*cdf0e10cSrcweir 	{
213*cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
214*cdf0e10cSrcweir 		{
215*cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
216*cdf0e10cSrcweir 			const SdrPageObj& rPageObject((static_cast< ViewContactOfPageObj& >(GetViewContact())).GetPageObj());
217*cdf0e10cSrcweir 			const SdrPage* pPage = rPageObject.GetReferencedPage();
218*cdf0e10cSrcweir 			const svtools::ColorConfig aColorConfig;
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir             // get PageObject's geometry
221*cdf0e10cSrcweir             basegfx::B2DHomMatrix aPageObjectTransform;
222*cdf0e10cSrcweir 			{
223*cdf0e10cSrcweir 				const Rectangle aPageObjectModelData(rPageObject.GetLastBoundRect());
224*cdf0e10cSrcweir 				const basegfx::B2DRange aPageObjectBound(
225*cdf0e10cSrcweir 					aPageObjectModelData.Left(), aPageObjectModelData.Top(),
226*cdf0e10cSrcweir 					aPageObjectModelData.Right(), aPageObjectModelData.Bottom());
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 				aPageObjectTransform.set(0, 0, aPageObjectBound.getWidth());
229*cdf0e10cSrcweir 				aPageObjectTransform.set(1, 1, aPageObjectBound.getHeight());
230*cdf0e10cSrcweir 				aPageObjectTransform.set(0, 2, aPageObjectBound.getMinX());
231*cdf0e10cSrcweir 				aPageObjectTransform.set(1, 2, aPageObjectBound.getMinY());
232*cdf0e10cSrcweir 			}
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 			// #i102637# add gray frame also when printing and page exists (handout pages)
235*cdf0e10cSrcweir 			const bool bCreateGrayFrame(!GetObjectContact().isOutputToPrinter() || pPage);
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 			// get displayed page's content. This is the uscaled page content
238*cdf0e10cSrcweir             if(mpExtractor && pPage)
239*cdf0e10cSrcweir 			{
240*cdf0e10cSrcweir 	            // get displayed page's geometry
241*cdf0e10cSrcweir 	   			drawinglayer::primitive2d::Primitive2DSequence xPageContent;
242*cdf0e10cSrcweir 				const Size aPageSize(pPage->GetSize());
243*cdf0e10cSrcweir 				const double fPageWidth(aPageSize.getWidth());
244*cdf0e10cSrcweir 				const double fPageHeight(aPageSize.getHeight());
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 				// The case that a PageObject contains another PageObject which visualizes the
247*cdf0e10cSrcweir 				// same page again would lead to a recursion. Limit that recursion depth to one
248*cdf0e10cSrcweir 				// by using a local static bool
249*cdf0e10cSrcweir 				static bool bInCreatePrimitive2D(false);
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 				if(bInCreatePrimitive2D)
252*cdf0e10cSrcweir 				{
253*cdf0e10cSrcweir 					// Recursion is possible. Create a replacement primitive
254*cdf0e10cSrcweir 					xPageContent.realloc(2);
255*cdf0e10cSrcweir 					const Color aDocColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
256*cdf0e10cSrcweir 					const Color aBorderColor(aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor);
257*cdf0e10cSrcweir 					const basegfx::B2DRange aPageBound(0.0, 0.0, fPageWidth, fPageHeight);
258*cdf0e10cSrcweir 					const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aPageBound));
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 					// add replacement fill
261*cdf0e10cSrcweir 					xPageContent[0L] = drawinglayer::primitive2d::Primitive2DReference(
262*cdf0e10cSrcweir 						new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), aDocColor.getBColor()));
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 					// add replacement border
265*cdf0e10cSrcweir 					xPageContent[1L] = drawinglayer::primitive2d::Primitive2DReference(
266*cdf0e10cSrcweir 						new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aBorderColor.getBColor()));
267*cdf0e10cSrcweir 				}
268*cdf0e10cSrcweir 				else
269*cdf0e10cSrcweir 				{
270*cdf0e10cSrcweir 					// set recursion flag
271*cdf0e10cSrcweir 					bInCreatePrimitive2D = true;
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 					// init extractor, guarantee existance, set page there
274*cdf0e10cSrcweir 					mpExtractor->SetStartPage(pPage);
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir                     // #i105548# also need to copy the VOCRedirector for sub-content creation
277*cdf0e10cSrcweir                     mpExtractor->SetViewObjectContactRedirector(GetObjectContact().GetViewObjectContactRedirector());
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 					// create page content
280*cdf0e10cSrcweir 					xPageContent = mpExtractor->createPrimitive2DSequenceForPage(rDisplayInfo);
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir                     // #i105548# reset VOCRedirector to not accidentially have a pointer to a
283*cdf0e10cSrcweir                     // temporary class, so calls to it are avoided safely
284*cdf0e10cSrcweir                     mpExtractor->SetViewObjectContactRedirector(0);
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir                     // reset recursion flag
287*cdf0e10cSrcweir 					bInCreatePrimitive2D = false;
288*cdf0e10cSrcweir 				}
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 				// prepare retval
291*cdf0e10cSrcweir 				if(xPageContent.hasElements())
292*cdf0e10cSrcweir 				{
293*cdf0e10cSrcweir 					const uno::Reference< drawing::XDrawPage > xDrawPage(GetXDrawPageForSdrPage(const_cast< SdrPage*>(pPage)));
294*cdf0e10cSrcweir     				const drawinglayer::primitive2d::Primitive2DReference xPagePreview(new drawinglayer::primitive2d::PagePreviewPrimitive2D(
295*cdf0e10cSrcweir 						xDrawPage, aPageObjectTransform, fPageWidth, fPageHeight, xPageContent, true));
296*cdf0e10cSrcweir 					xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xPagePreview, 1);
297*cdf0e10cSrcweir 				}
298*cdf0e10cSrcweir             }
299*cdf0e10cSrcweir             else if(bCreateGrayFrame)
300*cdf0e10cSrcweir             {
301*cdf0e10cSrcweir                 // #i105146# no content, but frame display. To make hitting the page preview objects
302*cdf0e10cSrcweir                 // on the handout page more simple, add hidden fill geometry
303*cdf0e10cSrcweir                 const drawinglayer::primitive2d::Primitive2DReference xFrameHit(
304*cdf0e10cSrcweir                     drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
305*cdf0e10cSrcweir                         false,
306*cdf0e10cSrcweir                         aPageObjectTransform));
307*cdf0e10cSrcweir                 xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xFrameHit, 1);
308*cdf0e10cSrcweir             }
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir 			// add a gray outline frame, except not when printing
311*cdf0e10cSrcweir 			if(bCreateGrayFrame)
312*cdf0e10cSrcweir 			{
313*cdf0e10cSrcweir 				const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor);
314*cdf0e10cSrcweir 				basegfx::B2DPolygon aOwnOutline(basegfx::tools::createUnitPolygon());
315*cdf0e10cSrcweir 				aOwnOutline.transform(aPageObjectTransform);
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 				const drawinglayer::primitive2d::Primitive2DReference xGrayFrame(
318*cdf0e10cSrcweir 					new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOwnOutline, aFrameColor.getBColor()));
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir 				drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xGrayFrame);
321*cdf0e10cSrcweir 			}
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir 			return xRetval;
324*cdf0e10cSrcweir 		}
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir 		ViewObjectContactOfPageObj::ViewObjectContactOfPageObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
327*cdf0e10cSrcweir 		:	ViewObjectContactOfSdrObj(rObjectContact, rViewContact),
328*cdf0e10cSrcweir 			mpExtractor(new PagePrimitiveExtractor(*this))
329*cdf0e10cSrcweir 		{
330*cdf0e10cSrcweir 		}
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 		ViewObjectContactOfPageObj::~ViewObjectContactOfPageObj()
333*cdf0e10cSrcweir 		{
334*cdf0e10cSrcweir 			// delete the helper OC
335*cdf0e10cSrcweir 			if(mpExtractor)
336*cdf0e10cSrcweir 			{
337*cdf0e10cSrcweir 				// remember candidate and reset own pointer to avoid action when createPrimitive2DSequence()
338*cdf0e10cSrcweir 				// would be called for any reason
339*cdf0e10cSrcweir 				PagePrimitiveExtractor* pCandidate = mpExtractor;
340*cdf0e10cSrcweir 				mpExtractor = 0;
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 				// also reset the StartPage to avoid ActionChanged() forwardings in the
343*cdf0e10cSrcweir 				// PagePrimitiveExtractor::InvalidatePartOfView() implementation
344*cdf0e10cSrcweir 				pCandidate->SetStartPage(0);
345*cdf0e10cSrcweir 				delete pCandidate;
346*cdf0e10cSrcweir 			}
347*cdf0e10cSrcweir 		}
348*cdf0e10cSrcweir 	} // end of namespace contact
349*cdf0e10cSrcweir } // end of namespace sdr
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
352*cdf0e10cSrcweir // eof
353