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