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