1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _SDR_OVERLAY_OVERLAYMANAGER_HXX
21 #define _SDR_OVERLAY_OVERLAYMANAGER_HXX
23 #include <boost/utility.hpp>
24 #include <rtl/ref.hxx>
25 #include <svx/sdr/animation/scheduler.hxx>
26 #include <svx/sdr/overlay/overlayobject.hxx>
27 #include <vcl/mapmod.hxx>
28 #include <tools/color.hxx>
29 #include "svx/svxdllapi.h"
30 #include <svtools/optionsdrawinglayer.hxx>
31 #include <basegfx/matrix/b2dhommatrix.hxx>
32 #include <drawinglayer/geometry/viewinformation2d.hxx>
34 //////////////////////////////////////////////////////////////////////////////
40 namespace sdr
{ namespace overlay
{
48 //////////////////////////////////////////////////////////////////////////////
54 class SVX_DLLPUBLIC OverlayManager
55 : private boost::noncopyable
56 , protected ::sdr::animation::Scheduler
57 , public rtl::IReference
60 oslInterlockedCount mnRefCount
;
62 // the OutputDevice to work on, set on construction and not to be changed
63 OutputDevice
& rmOutputDevice
;
65 // the vector of registered OverlayObjects
66 OverlayObjectVector maOverlayObjects
;
68 // Stripe support. All striped OverlayObjects use these stripe
69 // values. Changes change all those objects.
70 Color maStripeColorA
; // defaults to Color(COL_BLACK)
71 Color maStripeColorB
; // defaults to Color(COL_WHITE)
72 sal_uInt32 mnStripeLengthPixel
; // defaults to 4L
74 // hold an incarnation of Drawinglayer configuration options
75 SvtOptionsDrawinglayer maDrawinglayerOpt
;
77 // hold buffered the logic length of discrete vector (1.0, 0.0) and the
78 // view transformation belonging to it. Update happens in getDiscreteOne()
79 basegfx::B2DHomMatrix maViewTransformation
;
80 drawinglayer::geometry::ViewInformation2D maViewInformation2D
;
84 void ImpDrawMembers(const basegfx::B2DRange
& rRange
, OutputDevice
& rDestinationDevice
) const;
85 void ImpStripeDefinitionChanged();
86 void impApplyRemoveActions(OverlayObject
& rTarget
);
87 void impApplyAddActions(OverlayObject
& rTarget
);
89 // return mfDiscreteOne to derivations, but also check for buffered local
90 // ViewTransformation and evtl. correct mfDiscreteOne
91 double getDiscreteOne() const;
93 OverlayManager(OutputDevice
& rOutputDevice
);
94 virtual ~OverlayManager();
97 static rtl::Reference
<OverlayManager
> create(OutputDevice
& rOutputDevice
);
99 // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
100 const drawinglayer::geometry::ViewInformation2D
getCurrentViewInformation2D() const;
103 virtual void completeRedraw(const Region
& rRegion
, OutputDevice
* pPreRenderDevice
= 0) const;
105 // flush. Do buffered updates.
106 virtual void flush();
108 // #i68597# part of content gets copied, react on it
109 virtual void copyArea(const Point
& rDestPt
, const Point
& rSrcPt
, const Size
& rSrcSize
);
111 // restore part of background. Implemented form buffered versions only.
112 virtual void restoreBackground(const Region
& rRegion
) const;
114 // get the OutputDevice
115 OutputDevice
& getOutputDevice() const { return rmOutputDevice
; }
117 // add and remove OverlayObjects
118 void add(OverlayObject
& rOverlayObject
);
119 void remove(OverlayObject
& rOverlayObject
);
121 // invalidate the given range at local OutputDevice
122 virtual void invalidateRange(const basegfx::B2DRange
& rRange
);
124 // stripe support ColA
125 Color
getStripeColorA() const { return maStripeColorA
; }
126 void setStripeColorA(Color aNew
= Color(COL_BLACK
));
128 // stripe support ColB
129 Color
getStripeColorB() const { return maStripeColorB
; }
130 void setStripeColorB(Color aNew
= Color(COL_WHITE
));
132 // stripe support StripeLengthPixel
133 sal_uInt32
getStripeLengthPixel() const { return mnStripeLengthPixel
; }
134 void setStripeLengthPixel(sal_uInt32 nNew
= 5L);
136 // access to maDrawinglayerOpt
137 const SvtOptionsDrawinglayer
& getDrawinglayerOpt() const { return maDrawinglayerOpt
; }
139 void InsertEvent(sdr::animation::Event
* pNew
) { Scheduler::InsertEvent(pNew
); }
141 virtual oslInterlockedCount SAL_CALL
acquire();
142 virtual oslInterlockedCount SAL_CALL
release();
144 } // end of namespace overlay
145 } // end of namespace sdr
147 //////////////////////////////////////////////////////////////////////////////
149 #endif //_SDR_OVERLAY_OVERLAYMANAGER_HXX
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */