1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SDR_CONTACT_VIEWOBJECTCONTACT_HXX
21 #define _SDR_CONTACT_VIEWOBJECTCONTACT_HXX
23 #include <sal/types.h>
26 #include "svx/svxdllapi.h"
27 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
29 //////////////////////////////////////////////////////////////////////////////
34 namespace sdr
{ namespace contact
{
38 class ViewObjectContactRedirector
;
41 namespace sdr
{ namespace animation
{
42 class PrimitiveAnimation
;
45 //////////////////////////////////////////////////////////////////////////////
51 class SVX_DLLPUBLIC ViewObjectContact
54 // must-exist and constant contacts
55 ObjectContact
& mrObjectContact
;
56 ViewContact
& mrViewContact
;
58 // This range defines the object's BoundRect
59 basegfx::B2DRange maObjectRange
;
61 // PrimitiveSequence of the ViewContact. This contains all necessary information
62 // for the graphical visualisation and needs to be supported by all VCs which
64 drawinglayer::primitive2d::Primitive2DSequence mxPrimitive2DSequence
;
66 // the PrimitiveAnimation if Primitive2DSequence contains animations
67 sdr::animation::PrimitiveAnimation
* mpPrimitiveAnimation
;
70 // This bool gets set when the object gets invalidated by ActionChanged() and
71 // can be used from the OC to late-invalidates
72 unsigned mbLazyInvalidate
: 1;
75 // make redirector a protected friend, it needs to call createPrimitives as default action
76 friend class ViewObjectContactRedirector
;
78 // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation
79 // and setup accordingly
80 void checkForPrimitive2DAnimations();
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;
89 // method for flushing Primitive2DSequence for VOC implementations
90 void flushPrimitive2DSequence() { mxPrimitive2DSequence
.realloc(0); }
94 ViewObjectContact(ObjectContact
& rObjectContact
, ViewContact
& rViewContact
);
95 virtual ~ViewObjectContact();
97 // access to ObjectContact
98 ObjectContact
& GetObjectContact() const { return mrObjectContact
; }
100 // access to ViewContact
101 ViewContact
& GetViewContact() const { return mrViewContact
; }
103 // get the oebject's size range
104 const basegfx::B2DRange
& getObjectRange() const;
106 // A ViewObjectContact was deleted and shall be forgotten.
107 void RemoveViewObjectContact(ViewObjectContact
& rVOContact
);
109 // React on changes of the object of this ViewContact
110 virtual void ActionChanged();
112 // LazyInvalidate handling
113 void triggerLazyInvalidate();
115 // Check if this primitive is animated in any OC (View) which means it has
116 // generated a PrimitiveAnimation
117 bool isAnimated() const { return (0 != mpPrimitiveAnimation
); }
119 // Take some action when new objects are inserted
120 virtual void ActionChildInserted(ViewContact
& rChild
);
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;
127 // test this VOC for visibility concerning model-view stuff like e.g. Layer
128 virtual bool isPrimitiveVisible(const DisplayInfo
& rDisplayInfo
) const;
130 // test this VOC for ghosted mode
131 virtual bool isPrimitiveGhosted(const DisplayInfo
& rDisplayInfo
) const;
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;
137 // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy
138 drawinglayer::primitive2d::Primitive2DSequence
getPrimitive2DSequenceSubHierarchy(DisplayInfo
& rDisplayInfo
) const;
140 } // end of namespace contact
141 } // end of namespace sdr
143 //////////////////////////////////////////////////////////////////////////////
145 #endif //_SDR_CONTACT_VIEWOBJECTCONTACT_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */