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_OVERLAY_OVERLAYMANAGER_HXX
21 : #define _SDR_OVERLAY_OVERLAYMANAGER_HXX
22 :
23 : #include <boost/utility.hpp>
24 : #include <rtl/ref.hxx>
25 : #include <svx/sdr/animation/scheduler.hxx>
26 : #include <svx/sdr/overlay/overlayobject.hxx>
27 : #include <vcl/mapmod.hxx>
28 : #include <tools/color.hxx>
29 : #include "svx/svxdllapi.h"
30 : #include <svtools/optionsdrawinglayer.hxx>
31 : #include <basegfx/matrix/b2dhommatrix.hxx>
32 : #include <drawinglayer/geometry/viewinformation2d.hxx>
33 :
34 : //////////////////////////////////////////////////////////////////////////////
35 : // predeclarations
36 :
37 : class OutputDevice;
38 : class Region;
39 :
40 : namespace sdr { namespace overlay {
41 : class OverlayObject;
42 : }}
43 :
44 : namespace basegfx {
45 : class B2DRange;
46 : }
47 :
48 : //////////////////////////////////////////////////////////////////////////////
49 :
50 : namespace sdr
51 : {
52 : namespace overlay
53 : {
54 : class SVX_DLLPUBLIC OverlayManager
55 : : private boost::noncopyable
56 : , protected ::sdr::animation::Scheduler
57 : , public rtl::IReference
58 : {
59 : private:
60 : oslInterlockedCount mnRefCount;
61 : protected:
62 : // the OutputDevice to work on, set on construction and not to be changed
63 : OutputDevice& rmOutputDevice;
64 :
65 : // the vector of registered OverlayObjects
66 : OverlayObjectVector maOverlayObjects;
67 :
68 : // Stripe support. All striped OverlayObjects use these stripe
69 : // values. Changes change all those objects.
70 : Color maStripeColorA; // defaults to Color(COL_BLACK)
71 : Color maStripeColorB; // defaults to Color(COL_WHITE)
72 : sal_uInt32 mnStripeLengthPixel; // defaults to 4L
73 :
74 : // hold an incarnation of Drawinglayer configuration options
75 : SvtOptionsDrawinglayer maDrawinglayerOpt;
76 :
77 : // hold buffered the logic length of discrete vector (1.0, 0.0) and the
78 : // view transformation belonging to it. Update happens in getDiscreteOne()
79 : basegfx::B2DHomMatrix maViewTransformation;
80 : drawinglayer::geometry::ViewInformation2D maViewInformation2D;
81 : double mfDiscreteOne;
82 :
83 : // internal
84 : void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const;
85 : void ImpStripeDefinitionChanged();
86 : void impApplyRemoveActions(OverlayObject& rTarget);
87 : void impApplyAddActions(OverlayObject& rTarget);
88 :
89 : // return mfDiscreteOne to derivations, but also check for buffered local
90 : // ViewTransformation and evtl. correct mfDiscreteOne
91 : double getDiscreteOne() const;
92 :
93 : // when handing over another OverlayManager at construction, the OverlayObjects
94 : // will be taken over from it. The new one will have added all OverlayObjects
95 : // while the handed over one will have none
96 : OverlayManager(
97 : OutputDevice& rOutputDevice,
98 : OverlayManager* pOldOverlayManager);
99 : virtual ~OverlayManager();
100 :
101 : public:
102 : static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice,
103 : OverlayManager* pOldOverlayManager = 0);
104 :
105 : // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
106 : const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const;
107 :
108 : // complete redraw
109 : virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0) const;
110 :
111 : // flush. Do buffered updates.
112 : virtual void flush();
113 :
114 : // #i68597# part of content gets copied, react on it
115 : virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
116 :
117 : // restore part of background. Implemented form buffered versions only.
118 : virtual void restoreBackground(const Region& rRegion) const;
119 :
120 : // get the OutputDevice
121 : OutputDevice& getOutputDevice() const { return rmOutputDevice; }
122 :
123 : // add and remove OverlayObjects
124 : void add(OverlayObject& rOverlayObject);
125 : void remove(OverlayObject& rOverlayObject);
126 :
127 : // invalidate the given range at local OutputDevice
128 : virtual void invalidateRange(const basegfx::B2DRange& rRange);
129 :
130 : // stripe support ColA
131 0 : Color getStripeColorA() const { return maStripeColorA; }
132 : void setStripeColorA(Color aNew= Color(COL_BLACK));
133 :
134 : // stripe support ColB
135 0 : Color getStripeColorB() const { return maStripeColorB; }
136 : void setStripeColorB(Color aNew = Color(COL_WHITE));
137 :
138 : // stripe support StripeLengthPixel
139 0 : sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
140 : void setStripeLengthPixel(sal_uInt32 nNew = 5L);
141 :
142 : // access to maDrawinglayerOpt
143 : const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
144 :
145 0 : void InsertEvent(sdr::animation::Event* pNew) { Scheduler::InsertEvent(pNew); }
146 :
147 : virtual oslInterlockedCount SAL_CALL acquire();
148 : virtual oslInterlockedCount SAL_CALL release();
149 : };
150 : } // end of namespace overlay
151 : } // end of namespace sdr
152 :
153 : //////////////////////////////////////////////////////////////////////////////
154 :
155 : #endif //_SDR_OVERLAY_OVERLAYMANAGER_HXX
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|