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 INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
21 : #define INCLUDED_SVX_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 : OverlayManager(OutputDevice& rOutputDevice);
94 : virtual ~OverlayManager();
95 :
96 : public:
97 : static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice);
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 0 : 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 0 : Color getStripeColorA() const { return maStripeColorA; }
126 : void setStripeColorA(Color aNew= Color(COL_BLACK));
127 :
128 : // stripe support ColB
129 0 : Color getStripeColorB() const { return maStripeColorB; }
130 : void setStripeColorB(Color aNew = Color(COL_WHITE));
131 :
132 : // stripe support StripeLengthPixel
133 0 : sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
134 : void setStripeLengthPixel(sal_uInt32 nNew = 5L);
135 :
136 : // access to maDrawinglayerOpt
137 0 : const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
138 :
139 0 : void InsertEvent(sdr::animation::Event* pNew) { Scheduler::InsertEvent(pNew); }
140 :
141 : virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
142 : virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
143 : };
144 : } // end of namespace overlay
145 : } // end of namespace sdr
146 :
147 :
148 :
149 : #endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
150 :
151 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|