1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef _SDR_CONTACT_VIEWOBJECTCONTACT_HXX 25*b1cdbd2cSJim Jagielski #define _SDR_CONTACT_VIEWOBJECTCONTACT_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include <sal/types.h> 28*b1cdbd2cSJim Jagielski 29*b1cdbd2cSJim Jagielski #include <vector> 30*b1cdbd2cSJim Jagielski #include <tools/debug.hxx> 31*b1cdbd2cSJim Jagielski #include <tools/gen.hxx> 32*b1cdbd2cSJim Jagielski #include "svx/svxdllapi.h" 33*b1cdbd2cSJim Jagielski #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 36*b1cdbd2cSJim Jagielski // predeclarations 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim Jagielski class Region; 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski namespace sdr { namespace contact { 41*b1cdbd2cSJim Jagielski class DisplayInfo; 42*b1cdbd2cSJim Jagielski class ObjectContact; 43*b1cdbd2cSJim Jagielski class ViewContact; 44*b1cdbd2cSJim Jagielski class ViewObjectContactRedirector; 45*b1cdbd2cSJim Jagielski }} 46*b1cdbd2cSJim Jagielski 47*b1cdbd2cSJim Jagielski namespace sdr { namespace animation { 48*b1cdbd2cSJim Jagielski class PrimitiveAnimation; 49*b1cdbd2cSJim Jagielski }} 50*b1cdbd2cSJim Jagielski 51*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 52*b1cdbd2cSJim Jagielski 53*b1cdbd2cSJim Jagielski namespace sdr 54*b1cdbd2cSJim Jagielski { 55*b1cdbd2cSJim Jagielski namespace contact 56*b1cdbd2cSJim Jagielski { 57*b1cdbd2cSJim Jagielski class SVX_DLLPUBLIC ViewObjectContact 58*b1cdbd2cSJim Jagielski { 59*b1cdbd2cSJim Jagielski private: 60*b1cdbd2cSJim Jagielski // must-exist and constant contacts 61*b1cdbd2cSJim Jagielski ObjectContact& mrObjectContact; 62*b1cdbd2cSJim Jagielski ViewContact& mrViewContact; 63*b1cdbd2cSJim Jagielski 64*b1cdbd2cSJim Jagielski // This range defines the object's BoundRect 65*b1cdbd2cSJim Jagielski basegfx::B2DRange maObjectRange; 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski // PrimitiveSequence of the ViewContact. This contains all necessary information 68*b1cdbd2cSJim Jagielski // for the graphical visualisation and needs to be supported by all VCs which 69*b1cdbd2cSJim Jagielski // can be visualized. 70*b1cdbd2cSJim Jagielski drawinglayer::primitive2d::Primitive2DSequence mxPrimitive2DSequence; 71*b1cdbd2cSJim Jagielski 72*b1cdbd2cSJim Jagielski // the PrimitiveAnimation if Primitive2DSequence contains animations 73*b1cdbd2cSJim Jagielski sdr::animation::PrimitiveAnimation* mpPrimitiveAnimation; 74*b1cdbd2cSJim Jagielski 75*b1cdbd2cSJim Jagielski // bitfield 76*b1cdbd2cSJim Jagielski // This bool gets set when the object gets invalidated by ActionChanged() and 77*b1cdbd2cSJim Jagielski // can be used from the OC to late-invalidates 78*b1cdbd2cSJim Jagielski unsigned mbLazyInvalidate : 1; 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski protected: 81*b1cdbd2cSJim Jagielski // make redirector a protected friend, it needs to call createPrimitives as default action 82*b1cdbd2cSJim Jagielski friend class ViewObjectContactRedirector; 83*b1cdbd2cSJim Jagielski 84*b1cdbd2cSJim Jagielski // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation 85*b1cdbd2cSJim Jagielski // and setup accordingly 86*b1cdbd2cSJim Jagielski void checkForPrimitive2DAnimations(); 87*b1cdbd2cSJim Jagielski 88*b1cdbd2cSJim Jagielski // This method is responsible for creating the graphical visualisation data which is 89*b1cdbd2cSJim Jagielski // stored/cached in the local primitive. Default gets view-independent Primitive 90*b1cdbd2cSJim Jagielski // from the ViewContact using ViewContact::getViewIndependentPrimitive2DSequence(), takes care of 91*b1cdbd2cSJim Jagielski // visibility, handles glue and ghosted. 92*b1cdbd2cSJim Jagielski // This method will not handle included hierarchies and not check geometric visibility. 93*b1cdbd2cSJim Jagielski virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; 94*b1cdbd2cSJim Jagielski 95*b1cdbd2cSJim Jagielski // method for flushing Primitive2DSequence for VOC implementations flushPrimitive2DSequence()96*b1cdbd2cSJim Jagielski void flushPrimitive2DSequence() { mxPrimitive2DSequence.realloc(0); } 97*b1cdbd2cSJim Jagielski 98*b1cdbd2cSJim Jagielski public: 99*b1cdbd2cSJim Jagielski // basic constructor. 100*b1cdbd2cSJim Jagielski ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact); 101*b1cdbd2cSJim Jagielski virtual ~ViewObjectContact(); 102*b1cdbd2cSJim Jagielski 103*b1cdbd2cSJim Jagielski // access to ObjectContact GetObjectContact() const104*b1cdbd2cSJim Jagielski ObjectContact& GetObjectContact() const { return mrObjectContact; } 105*b1cdbd2cSJim Jagielski 106*b1cdbd2cSJim Jagielski // access to ViewContact GetViewContact() const107*b1cdbd2cSJim Jagielski ViewContact& GetViewContact() const { return mrViewContact; } 108*b1cdbd2cSJim Jagielski 109*b1cdbd2cSJim Jagielski // get the oebject's size range 110*b1cdbd2cSJim Jagielski const basegfx::B2DRange& getObjectRange() const; 111*b1cdbd2cSJim Jagielski 112*b1cdbd2cSJim Jagielski // A ViewObjectContact was deleted and shall be forgotten. 113*b1cdbd2cSJim Jagielski void RemoveViewObjectContact(ViewObjectContact& rVOContact); 114*b1cdbd2cSJim Jagielski 115*b1cdbd2cSJim Jagielski // React on changes of the object of this ViewContact 116*b1cdbd2cSJim Jagielski virtual void ActionChanged(); 117*b1cdbd2cSJim Jagielski 118*b1cdbd2cSJim Jagielski // LazyInvalidate handling 119*b1cdbd2cSJim Jagielski void triggerLazyInvalidate(); 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielski // Check if this primitive is animated in any OC (View) which means it has 122*b1cdbd2cSJim Jagielski // generated a PrimitiveAnimation isAnimated() const123*b1cdbd2cSJim Jagielski bool isAnimated() const { return (0 != mpPrimitiveAnimation); } 124*b1cdbd2cSJim Jagielski 125*b1cdbd2cSJim Jagielski // Take some action when new objects are inserted 126*b1cdbd2cSJim Jagielski virtual void ActionChildInserted(ViewContact& rChild); 127*b1cdbd2cSJim Jagielski 128*b1cdbd2cSJim Jagielski // access to the local primitive. This will ensure that the local primitive is 129*b1cdbd2cSJim Jagielski // current in comparing the local one with a fresh created incarnation 130*b1cdbd2cSJim Jagielski // This method will not handle included hierarchies and not check visibility. 131*b1cdbd2cSJim Jagielski drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; 132*b1cdbd2cSJim Jagielski 133*b1cdbd2cSJim Jagielski // test this VOC for visibility concerning model-view stuff like e.g. Layer 134*b1cdbd2cSJim Jagielski virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; 135*b1cdbd2cSJim Jagielski 136*b1cdbd2cSJim Jagielski // test this VOC for ghosted mode 137*b1cdbd2cSJim Jagielski virtual bool isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const; 138*b1cdbd2cSJim Jagielski 139*b1cdbd2cSJim Jagielski // process this primitive: Eventually also recursively travel an existing hierarchy, 140*b1cdbd2cSJim Jagielski // e.g. for group objects, scenes or pages. This method will test geometrical visibility. 141*b1cdbd2cSJim Jagielski virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; 142*b1cdbd2cSJim Jagielski 143*b1cdbd2cSJim Jagielski // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy 144*b1cdbd2cSJim Jagielski drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const; 145*b1cdbd2cSJim Jagielski }; 146*b1cdbd2cSJim Jagielski } // end of namespace contact 147*b1cdbd2cSJim Jagielski } // end of namespace sdr 148*b1cdbd2cSJim Jagielski 149*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 150*b1cdbd2cSJim Jagielski 151*b1cdbd2cSJim Jagielski #endif //_SDR_CONTACT_VIEWOBJECTCONTACT_HXX 152*b1cdbd2cSJim Jagielski 153*b1cdbd2cSJim Jagielski // eof 154