1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewcontactofpageobj.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <svx/sdr/contact/viewcontactofpageobj.hxx>
34 #include <svx/svdopage.hxx>
35 #include <svx/sdr/contact/displayinfo.hxx>
36 #include <vcl/outdev.hxx>
37 #include <svx/svdmodel.hxx>
38 #include <svx/svdpage.hxx>
39 #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
40 #include <svx/sdr/contact/viewobjectcontact.hxx>
41 #include <svx/sdr/contact/viewobjectcontactofpageobj.hxx>
42 #include <basegfx/polygon/b2dpolygontools.hxx>
43 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
45 //////////////////////////////////////////////////////////////////////////////
51 ViewObjectContact
& ViewContactOfPageObj::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
53 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageObj(rObjectContact
, *this);
57 // Access to referenced page
58 const SdrPage
* ViewContactOfPageObj::GetReferencedPage() const
60 return GetPageObj().GetReferencedPage();
63 ViewContactOfPageObj::ViewContactOfPageObj(SdrPageObj
& rPageObj
)
64 : ViewContactOfSdrObj(rPageObj
)
68 ViewContactOfPageObj::~ViewContactOfPageObj()
72 // #i35972# React on changes of the object of this ViewContact
73 void ViewContactOfPageObj::ActionChanged()
75 static bool bIsInActionChange(false);
77 if(!bIsInActionChange
)
79 // set recursion flag, see description in *.hxx
80 bIsInActionChange
= true;
83 ViewContactOfSdrObj::ActionChanged();
85 // reset recursion flag, see description in *.hxx
86 bIsInActionChange
= false;
90 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfPageObj::createViewIndependentPrimitive2DSequence() const
92 // ceate graphical visualisation data. Since this is the view-independent version which should not be used,
93 // create a replacement graphic visualisation here. Use GetLastBoundRect to access the model data directly
94 // which is aOutRect for SdrPageObj.
95 const Rectangle
aModelRectangle(GetPageObj().GetLastBoundRect());
96 const basegfx::B2DRange
aModelRange(aModelRectangle
.Left(), aModelRectangle
.Top(), aModelRectangle
.Right(), aModelRectangle
.Bottom());
97 const basegfx::B2DPolygon
aOutline(basegfx::tools::createPolygonFromRect(aModelRange
));
98 const basegfx::BColor
aYellow(1.0, 1.0, 0.0);
99 const drawinglayer::primitive2d::Primitive2DReference
xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline
, aYellow
));
101 return drawinglayer::primitive2d::Primitive2DSequence(&xReference
, 1);
104 } // end of namespace contact
105 } // end of namespace sdr
107 //////////////////////////////////////////////////////////////////////////////