Branch libreoffice-5-0-4
[LibreOffice.git] / include / svx / sdr / overlay / overlaymanager.hxx
blob6710f61c5cc7d709d3c088ce619dff59237fb221
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
21 #define INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
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>
35 class OutputDevice;
36 class SdrModel;
37 namespace vcl { class Region; }
39 namespace sdr { namespace overlay {
40 class OverlayObject;
43 namespace basegfx {
44 class B2DRange;
47 namespace sdr
49 namespace overlay
51 class SVX_DLLPUBLIC OverlayManager
52 : protected sdr::animation::Scheduler
53 , public salhelper::SimpleReferenceObject
55 private:
56 OverlayManager(const OverlayManager&) SAL_DELETED_FUNCTION;
57 OverlayManager& operator=(const OverlayManager&) SAL_DELETED_FUNCTION;
59 protected:
60 // the OutputDevice to work on, set on construction and not to be changed
61 OutputDevice& mrOutputDevice;
62 const SdrModel* mpModel;
64 // the vector of registered OverlayObjects
65 OverlayObjectVector maOverlayObjects;
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
73 // hold an incarnation of Drawinglayer configuration options
74 SvtOptionsDrawinglayer maDrawinglayerOpt;
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;
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);
88 // return mfDiscreteOne to derivations, but also check for buffered local
89 // ViewTransformation and evtl. correct mfDiscreteOne
90 double getDiscreteOne() const;
92 OverlayManager(OutputDevice& rOutputDevice, const SdrModel* pModel);
93 virtual ~OverlayManager();
95 public:
96 static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice, const SdrModel* pModel);
98 // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
99 const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const;
101 // complete redraw
102 virtual void completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = 0) const;
104 // flush. Do buffered updates.
105 virtual void flush();
107 // #i68597# part of content gets copied, react on it
108 virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
110 // restore part of background. Implemented form buffered versions only.
111 virtual void restoreBackground(const vcl::Region& rRegion) const;
113 // get the OutputDevice
114 OutputDevice& getOutputDevice() const { return mrOutputDevice; }
115 // Get the draw model.
116 const SdrModel* getModel() const { return mpModel; }
118 // add and remove OverlayObjects
119 void add(OverlayObject& rOverlayObject);
120 void remove(OverlayObject& rOverlayObject);
122 // invalidate the given range at local OutputDevice
123 virtual void invalidateRange(const basegfx::B2DRange& rRange);
125 // stripe support ColA
126 Color getStripeColorA() const { return maStripeColorA; }
127 void setStripeColorA(Color aNew= Color(COL_BLACK));
129 // stripe support ColB
130 Color getStripeColorB() const { return maStripeColorB; }
131 void setStripeColorB(Color aNew = Color(COL_WHITE));
133 // stripe support StripeLengthPixel
134 sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
135 void setStripeLengthPixel(sal_uInt32 nNew = 5L);
137 // access to maDrawinglayerOpt
138 const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
140 void InsertEvent(sdr::animation::Event* pNew) { Scheduler::InsertEvent(pNew); }
142 } // end of namespace overlay
143 } // end of namespace sdr
145 #endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */