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