LibreOffice Module svx (master)  1
overlaymanager.hxx
Go to the documentation of this file.
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>
26 #include <tools/color.hxx>
27 #include <tools/gen.hxx>
28 #include <svx/svxdllapi.h>
33 
34 class OutputDevice;
35 class SdrModel;
36 namespace vcl { class Region; }
37 
38 namespace sdr::overlay {
39  class OverlayObject;
40 }
41 
42 namespace basegfx {
43  class B2DRange;
44 }
45 
46 namespace sdr::overlay
47  {
49  : protected sdr::animation::Scheduler
51  {
52  private:
53  OverlayManager(const OverlayManager&) = delete;
54  OverlayManager& operator=(const OverlayManager&) = delete;
55 
56  protected:
57  // the OutputDevice to work on, set on construction and not to be changed
59 
60  // the vector of registered OverlayObjects
62 
63  // Stripe support. All striped OverlayObjects use these stripe
64  // values. Changes change all those objects.
65  Color maStripeColorA; // defaults to COL_BLACK
66  Color maStripeColorB; // defaults to COL_WHITE
67  sal_uInt32 mnStripeLengthPixel; // defaults to 4L
68 
69  // hold an incarnation of Drawinglayer configuration options
71 
72  // hold buffered the logic length of discrete vector (1.0, 0.0) and the
73  // view transformation belonging to it. Update happens in getDiscreteOne()
76  double mfDiscreteOne;
77 
78  // internal
79  void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const;
80  void ImpStripeDefinitionChanged();
81  void impApplyRemoveActions(OverlayObject& rTarget);
82  void impApplyAddActions(OverlayObject& rTarget);
83 
84  // return mfDiscreteOne to derivations, but also check for buffered local
85  // ViewTransformation and evtl. correct mfDiscreteOne
86  double getDiscreteOne() const;
87 
88  tools::Rectangle RangeToInvalidateRectangle(const basegfx::B2DRange& rRange) const;
89 
90  OverlayManager(OutputDevice& rOutputDevice);
91  virtual ~OverlayManager() override;
92 
93  public:
94  static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice);
95 
96  // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
97  drawinglayer::geometry::ViewInformation2D const & getCurrentViewInformation2D() const;
98 
99  // complete redraw
100  virtual void completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = nullptr) const;
101 
102  // flush. Do buffered updates.
103  virtual void flush();
104 
105  // get the OutputDevice
106  OutputDevice& getOutputDevice() const { return mrOutputDevice; }
107 
108  // add and remove OverlayObjects
109  void add(OverlayObject& rOverlayObject);
110  void remove(OverlayObject& rOverlayObject);
111 
112  // invalidate the given range at local OutputDevice
113  virtual void invalidateRange(const basegfx::B2DRange& rRange);
114 
115  // stripe support ColA
116  const Color& getStripeColorA() const { return maStripeColorA; }
117  void setStripeColorA(Color aNew);
118 
119  // stripe support ColB
120  const Color& getStripeColorB() const { return maStripeColorB; }
121  void setStripeColorB(Color aNew);
122 
123  // stripe support StripeLengthPixel
124  sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
125  void setStripeLengthPixel(sal_uInt32 nNew);
126 
127  // access to maDrawinglayerOpt
128  const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
129 
130  void InsertEvent(sdr::animation::Event& rNew) { Scheduler::InsertEvent(rNew); }
131  };
132 
133 } // end of namespace sdr::overlay
134 
135 #endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX
136 
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
drawinglayer::geometry::ViewInformation2D maViewInformation2D
Reference< deployment::XPackageRegistry > create(Reference< deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, Reference< XComponentContext > const &xComponentContext)
const Color & getStripeColorB() const
const Color & getStripeColorA() const
OverlayObjectVector maOverlayObjects
void InsertEvent(sdr::animation::Event &rNew)
OutputDevice & getOutputDevice() const
SvtOptionsDrawinglayer maDrawinglayerOpt
basegfx::B2DHomMatrix maViewTransformation
const SvtOptionsDrawinglayer & getDrawinglayerOpt() const
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
::std::vector< OverlayObject * > OverlayObjectVector
sal_uInt32 getStripeLengthPixel() const