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