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