LCOV - code coverage report
Current view: top level - include/svx/sdr/contact - viewobjectcontact.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 3 4 75.0 %
Date: 2014-11-03 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10