xref: /trunk/main/svx/inc/svx/sdr/overlay/overlaymanager.hxx (revision b5da552ccefc4034e06a43bfae43fb8a8b64a7ad)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SDR_OVERLAY_OVERLAYMANAGER_HXX
25 #define _SDR_OVERLAY_OVERLAYMANAGER_HXX
26 
27 #include <svx/sdr/animation/scheduler.hxx>
28 #include <svx/sdr/overlay/overlayobject.hxx>
29 #include <vcl/mapmod.hxx>
30 #include <tools/color.hxx>
31 #include "svx/svxdllapi.h"
32 #include <svtools/optionsdrawinglayer.hxx>
33 #include <basegfx/matrix/b2dhommatrix.hxx>
34 #include <drawinglayer/geometry/viewinformation2d.hxx>
35 
36 //////////////////////////////////////////////////////////////////////////////
37 // predeclarations
38 
39 class OutputDevice;
40 class Region;
41 
42 namespace sdr { namespace overlay {
43     class OverlayObject;
44 }}
45 
46 namespace basegfx {
47     class B2DRange;
48 }
49 
50 //////////////////////////////////////////////////////////////////////////////
51 
52 namespace sdr
53 {
54     namespace overlay
55     {
56         class SVX_DLLPUBLIC OverlayManager : public ::sdr::animation::Scheduler
57         {
58         protected:
59             // the OutputDevice to work on, set on construction and not to be changed
60             OutputDevice&                               rmOutputDevice;
61 
62             // the vector of registered OverlayObjects
63             OverlayObjectVector                         maOverlayObjects;
64 
65             // Stripe support. All striped OverlayObjects use these stripe
66             // values. Changes change all those objects.
67             Color                                       maStripeColorA; // defaults to Color(COL_BLACK)
68             Color                                       maStripeColorB; // defaults to Color(COL_WHITE)
69             sal_uInt32                                  mnStripeLengthPixel; // defaults to 4L
70 
71             // hold an incarnation of Drawinglayer configuration options
72             SvtOptionsDrawinglayer                      maDrawinglayerOpt;
73 
74             // hold buffered the logic length of discrete vector (1.0, 0.0) and the
75             // view transformation belonging to it. Update happens in getDiscreteOne()
76             basegfx::B2DHomMatrix                       maViewTransformation;
77             drawinglayer::geometry::ViewInformation2D   maViewInformation2D;
78             double                                      mfDiscreteOne;
79 
80             // internal
81             void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const;
82             void ImpStripeDefinitionChanged();
83             void impApplyRemoveActions(OverlayObject& rTarget);
84             void impApplyAddActions(OverlayObject& rTarget);
85 
86             // return mfDiscreteOne to derivations, but also check for buffered local
87             // ViewTransformation and evtl. correct mfDiscreteOne
88             double getDiscreteOne() const;
89 
90         public:
91             // when handing over another OverlayManager at construction, the OverlayObjects
92             // will be taken over from it. The new one will have added all OverlayObjects
93             // while the handed over one will have none
94             OverlayManager(
95                 OutputDevice& rOutputDevice,
96                 OverlayManager* pOldOverlayManager = 0);
97             virtual ~OverlayManager();
98 
99             // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
100             const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const;
101 
102             // complete redraw
103             virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0) const;
104 
105             // flush. Do buffered updates.
106             virtual void flush();
107 
108             // #i68597# part of content gets copied, react on it
109             virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
110 
111             // restore part of background. Implemented form buffered versions only.
112             virtual void restoreBackground(const Region& rRegion) const;
113 
114             // get the OutputDevice
115             OutputDevice& getOutputDevice() const { return rmOutputDevice; }
116 
117             // add and remove OverlayObjects
118             void add(OverlayObject& rOverlayObject);
119             void remove(OverlayObject& rOverlayObject);
120 
121             // invalidate the given range at local OutputDevice
122             virtual void invalidateRange(const basegfx::B2DRange& rRange);
123 
124             // stripe support ColA
125             Color getStripeColorA() const { return maStripeColorA; }
126             void setStripeColorA(Color aNew= Color(COL_BLACK));
127 
128             // stripe support ColB
129             Color getStripeColorB() const { return maStripeColorB; }
130             void setStripeColorB(Color aNew = Color(COL_WHITE));
131 
132             // stripe support StripeLengthPixel
133             sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
134             void setStripeLengthPixel(sal_uInt32 nNew = 5L);
135 
136             // access to maDrawinglayerOpt
137             const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
138         };
139     } // end of namespace overlay
140 } // end of namespace sdr
141 
142 //////////////////////////////////////////////////////////////////////////////
143 
144 #endif //_SDR_OVERLAY_OVERLAYMANAGER_HXX
145 
146 // eof
147