Bump version to 6.4-15
[LibreOffice.git] / include / svx / sdr / overlay / overlaymanager.hxx
blobc84a3cbf2bc1104b498967bff7d0c753b2e4ffda
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 <tools/color.hxx>
27 #include <tools/gen.hxx>
28 #include <svx/svxdllapi.h>
29 #include <svtools/optionsdrawinglayer.hxx>
30 #include <basegfx/matrix/b2dhommatrix.hxx>
31 #include <drawinglayer/geometry/viewinformation2d.hxx>
32 #include <salhelper/simplereferenceobject.hxx>
34 class OutputDevice;
35 class SdrModel;
36 namespace vcl { class Region; }
38 namespace sdr { namespace overlay {
39 class OverlayObject;
42 namespace basegfx {
43 class B2DRange;
46 namespace sdr
48 namespace overlay
50 class SVX_DLLPUBLIC OverlayManager
51 : protected sdr::animation::Scheduler
52 , public salhelper::SimpleReferenceObject
54 private:
55 OverlayManager(const OverlayManager&) = delete;
56 OverlayManager& operator=(const OverlayManager&) = delete;
58 protected:
59 // the OutputDevice to work on, set on construction and not to be changed
60 OutputDevice& mrOutputDevice;
62 // the vector of registered OverlayObjects
63 OverlayObjectVector maOverlayObjects;
65 // Stripe support. All striped OverlayObjects use these stripe
66 // values. Changes change all those objects.
67 Color maStripeColorA; // defaults to COL_BLACK
68 Color maStripeColorB; // defaults to COL_WHITE
69 sal_uInt32 mnStripeLengthPixel; // defaults to 4L
71 // hold an incarnation of Drawinglayer configuration options
72 SvtOptionsDrawinglayer const maDrawinglayerOpt;
74 // hold buffered the logic length of discrete vector (1.0, 0.0) and the
75 // view transformation belonging to it. Update happens in getDiscreteOne()
76 basegfx::B2DHomMatrix maViewTransformation;
77 drawinglayer::geometry::ViewInformation2D maViewInformation2D;
78 double mfDiscreteOne;
80 // internal
81 void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const;
82 void ImpStripeDefinitionChanged();
83 void impApplyRemoveActions(OverlayObject& rTarget);
84 void impApplyAddActions(OverlayObject& rTarget);
86 // return mfDiscreteOne to derivations, but also check for buffered local
87 // ViewTransformation and evtl. correct mfDiscreteOne
88 double getDiscreteOne() const;
90 tools::Rectangle RangeToInvalidateRectangle(const basegfx::B2DRange& rRange) const;
92 OverlayManager(OutputDevice& rOutputDevice);
93 virtual ~OverlayManager() override;
95 public:
96 static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice);
98 // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
99 drawinglayer::geometry::ViewInformation2D const & getCurrentViewInformation2D() const;
101 // complete redraw
102 virtual void completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = nullptr) const;
104 // flush. Do buffered updates.
105 virtual void flush();
107 // get the OutputDevice
108 OutputDevice& getOutputDevice() const { return mrOutputDevice; }
110 // add and remove OverlayObjects
111 void add(OverlayObject& rOverlayObject);
112 void remove(OverlayObject& rOverlayObject);
114 // invalidate the given range at local OutputDevice
115 virtual void invalidateRange(const basegfx::B2DRange& rRange);
117 // stripe support ColA
118 const Color& getStripeColorA() const { return maStripeColorA; }
119 void setStripeColorA(Color aNew);
121 // stripe support ColB
122 const Color& getStripeColorB() const { return maStripeColorB; }
123 void setStripeColorB(Color aNew);
125 // stripe support StripeLengthPixel
126 sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
127 void setStripeLengthPixel(sal_uInt32 nNew);
129 // access to maDrawinglayerOpt
130 const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
132 void InsertEvent(sdr::animation::Event& rNew) { Scheduler::InsertEvent(rNew); }
134 } // end of namespace overlay
135 } // end of namespace sdr
137 #endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */