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 #ifndef _SDR_CONTACT_VIEWOBJECTCONTACT_HXX 29 #define _SDR_CONTACT_VIEWOBJECTCONTACT_HXX 30 31 #include <sal/types.h> 32 33 #include <vector> 34 #include <tools/debug.hxx> 35 #include <tools/gen.hxx> 36 #include "svx/svxdllapi.h" 37 #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 38 39 ////////////////////////////////////////////////////////////////////////////// 40 // predeclarations 41 42 class Region; 43 44 namespace sdr { namespace contact { 45 class DisplayInfo; 46 class ObjectContact; 47 class ViewContact; 48 class ViewObjectContactRedirector; 49 }} 50 51 namespace sdr { namespace animation { 52 class PrimitiveAnimation; 53 }} 54 55 ////////////////////////////////////////////////////////////////////////////// 56 57 namespace sdr 58 { 59 namespace contact 60 { 61 class SVX_DLLPUBLIC ViewObjectContact 62 { 63 private: 64 // must-exist and constant contacts 65 ObjectContact& mrObjectContact; 66 ViewContact& mrViewContact; 67 68 // This range defines the object's BoundRect 69 basegfx::B2DRange maObjectRange; 70 71 // PrimitiveSequence of the ViewContact. This contains all necessary information 72 // for the graphical visualisation and needs to be supported by all VCs which 73 // can be visualized. 74 drawinglayer::primitive2d::Primitive2DSequence mxPrimitive2DSequence; 75 76 // the PrimitiveAnimation if Primitive2DSequence contains animations 77 sdr::animation::PrimitiveAnimation* mpPrimitiveAnimation; 78 79 // bitfield 80 // This bool gets set when the object gets invalidated by ActionChanged() and 81 // can be used from the OC to late-invalidates 82 unsigned mbLazyInvalidate : 1; 83 84 protected: 85 // make redirector a protected friend, it needs to call createPrimitives as default action 86 friend class ViewObjectContactRedirector; 87 88 // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation 89 // and setup accordingly 90 void checkForPrimitive2DAnimations(); 91 92 // This method is responsible for creating the graphical visualisation data which is 93 // stored/cached in the local primitive. Default gets view-independent Primitive 94 // from the ViewContact using ViewContact::getViewIndependentPrimitive2DSequence(), takes care of 95 // visibility, handles glue and ghosted. 96 // This method will not handle included hierarchies and not check geometric visibility. 97 virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; 98 99 // method for flushing Primitive2DSequence for VOC implementations 100 void flushPrimitive2DSequence() { mxPrimitive2DSequence.realloc(0); } 101 102 public: 103 // basic constructor. 104 ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact); 105 virtual ~ViewObjectContact(); 106 107 // access to ObjectContact 108 ObjectContact& GetObjectContact() const { return mrObjectContact; } 109 110 // access to ViewContact 111 ViewContact& GetViewContact() const { return mrViewContact; } 112 113 // get the oebject's size range 114 const basegfx::B2DRange& getObjectRange() const; 115 116 // A ViewObjectContact was deleted and shall be forgotten. 117 void RemoveViewObjectContact(ViewObjectContact& rVOContact); 118 119 // React on changes of the object of this ViewContact 120 virtual void ActionChanged(); 121 122 // LazyInvalidate handling 123 void triggerLazyInvalidate(); 124 125 // Check if this primitive is animated in any OC (View) which means it has 126 // generated a PrimitiveAnimation 127 bool isAnimated() const { return (0 != mpPrimitiveAnimation); } 128 129 // Take some action when new objects are inserted 130 virtual void ActionChildInserted(ViewContact& rChild); 131 132 // access to the local primitive. This will ensure that the local primitive is 133 // current in comparing the local one with a fresh created incarnation 134 // This method will not handle included hierarchies and not check visibility. 135 drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; 136 137 // test this VOC for visibility concerning model-view stuff like e.g. Layer 138 virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; 139 140 // test this VOC for ghosted mode 141 virtual bool isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const; 142 143 // process this primitive: Eventually also recursively travel an existing hierarchy, 144 // e.g. for group objects, scenes or pages. This method will test geometrical visibility. 145 virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; 146 147 // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy 148 drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const; 149 }; 150 } // end of namespace contact 151 } // end of namespace sdr 152 153 ////////////////////////////////////////////////////////////////////////////// 154 155 #endif //_SDR_CONTACT_VIEWOBJECTCONTACT_HXX 156 157 // eof 158