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

Generated by: LCOV version 1.11