Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SDR_OVERLAY_OVERLAYMANAGER_HXX
30 : : #define _SDR_OVERLAY_OVERLAYMANAGER_HXX
31 : :
32 : : #include <boost/utility.hpp>
33 : : #include <rtl/ref.hxx>
34 : : #include <svx/sdr/animation/scheduler.hxx>
35 : : #include <svx/sdr/overlay/overlayobject.hxx>
36 : : #include <vcl/mapmod.hxx>
37 : : #include <tools/color.hxx>
38 : : #include "svx/svxdllapi.h"
39 : : #include <svtools/optionsdrawinglayer.hxx>
40 : : #include <basegfx/matrix/b2dhommatrix.hxx>
41 : : #include <drawinglayer/geometry/viewinformation2d.hxx>
42 : :
43 : : //////////////////////////////////////////////////////////////////////////////
44 : : // predeclarations
45 : :
46 : : class OutputDevice;
47 : : class Region;
48 : :
49 : : namespace sdr { namespace overlay {
50 : : class OverlayObject;
51 : : }}
52 : :
53 : : namespace basegfx {
54 : : class B2DRange;
55 : : }
56 : :
57 : : //////////////////////////////////////////////////////////////////////////////
58 : :
59 : : namespace sdr
60 : : {
61 : : namespace overlay
62 : : {
63 : : class SVX_DLLPUBLIC OverlayManager
64 : : : private boost::noncopyable
65 : : , protected ::sdr::animation::Scheduler
66 : : , public rtl::IReference
67 : : {
68 : : private:
69 : : oslInterlockedCount mnRefCount;
70 : : protected:
71 : : // the OutputDevice to work on, set on construction and not to be changed
72 : : OutputDevice& rmOutputDevice;
73 : :
74 : : // the vector of registered OverlayObjects
75 : : OverlayObjectVector maOverlayObjects;
76 : :
77 : : // Stripe support. All striped OverlayObjects use these stripe
78 : : // values. Changes change all those objects.
79 : : Color maStripeColorA; // defaults to Color(COL_BLACK)
80 : : Color maStripeColorB; // defaults to Color(COL_WHITE)
81 : : sal_uInt32 mnStripeLengthPixel; // defaults to 4L
82 : :
83 : : // hold an incarnation of Drawinglayer configuration options
84 : : SvtOptionsDrawinglayer maDrawinglayerOpt;
85 : :
86 : : // hold buffered the logic length of discrete vector (1.0, 0.0) and the
87 : : // view transformation belonging to it. Update happens in getDiscreteOne()
88 : : basegfx::B2DHomMatrix maViewTransformation;
89 : : drawinglayer::geometry::ViewInformation2D maViewInformation2D;
90 : : double mfDiscreteOne;
91 : :
92 : : // internal
93 : : void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const;
94 : : void ImpStripeDefinitionChanged();
95 : : void impApplyRemoveActions(OverlayObject& rTarget);
96 : : void impApplyAddActions(OverlayObject& rTarget);
97 : :
98 : : // return mfDiscreteOne to derivations, but also check for buffered local
99 : : // ViewTransformation and evtl. correct mfDiscreteOne
100 : : double getDiscreteOne() const;
101 : :
102 : : // when handing over another OverlayManager at construction, the OverlayObjects
103 : : // will be taken over from it. The new one will have added all OverlayObjects
104 : : // while the handed over one will have none
105 : : OverlayManager(
106 : : OutputDevice& rOutputDevice,
107 : : OverlayManager* pOldOverlayManager);
108 : : virtual ~OverlayManager();
109 : :
110 : : public:
111 : : static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice,
112 : : OverlayManager* pOldOverlayManager = 0);
113 : :
114 : : // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
115 : : const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const;
116 : :
117 : : // complete redraw
118 : : virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0) const;
119 : :
120 : : // flush. Do buffered updates.
121 : : virtual void flush();
122 : :
123 : : // #i68597# part of content gets copied, react on it
124 : : virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
125 : :
126 : : // restore part of background. Implemented form buffered versions only.
127 : : virtual void restoreBackground(const Region& rRegion) const;
128 : :
129 : : // get the OutputDevice
130 : 124198 : OutputDevice& getOutputDevice() const { return rmOutputDevice; }
131 : :
132 : : // add and remove OverlayObjects
133 : : void add(OverlayObject& rOverlayObject);
134 : : void remove(OverlayObject& rOverlayObject);
135 : :
136 : : // invalidate the given range at local OutputDevice
137 : : virtual void invalidateRange(const basegfx::B2DRange& rRange);
138 : :
139 : : // stripe support ColA
140 : 0 : Color getStripeColorA() const { return maStripeColorA; }
141 : : void setStripeColorA(Color aNew= Color(COL_BLACK));
142 : :
143 : : // stripe support ColB
144 : 0 : Color getStripeColorB() const { return maStripeColorB; }
145 : : void setStripeColorB(Color aNew = Color(COL_WHITE));
146 : :
147 : : // stripe support StripeLengthPixel
148 : 0 : sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
149 : : void setStripeLengthPixel(sal_uInt32 nNew = 5L);
150 : :
151 : : // access to maDrawinglayerOpt
152 : 3689 : const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
153 : :
154 : 0 : void InsertEvent(sdr::animation::Event* pNew) { Scheduler::InsertEvent(pNew); }
155 : :
156 : : virtual oslInterlockedCount SAL_CALL acquire();
157 : : virtual oslInterlockedCount SAL_CALL release();
158 : : };
159 : : } // end of namespace overlay
160 : : } // end of namespace sdr
161 : :
162 : : //////////////////////////////////////////////////////////////////////////////
163 : :
164 : : #endif //_SDR_OVERLAY_OVERLAYMANAGER_HXX
165 : :
166 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|