fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / svx / sdr / overlay / overlayobject.hxx
blob263e9a9ab57c8a5ee163ecb8bc761ba8c9017e6f
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 _SDR_OVERLAY_OVERLAYOBJECT_HXX
21 #define _SDR_OVERLAY_OVERLAYOBJECT_HXX
23 #include <basegfx/point/b2dpoint.hxx>
24 #include <basegfx/range/b2drange.hxx>
25 #include <tools/color.hxx>
26 #include <rtl/ref.hxx>
27 #include <svx/sdr/animation/scheduler.hxx>
28 #include "svx/svxdllapi.h"
29 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
31 #include <vector>
33 //////////////////////////////////////////////////////////////////////////////
34 // predeclarations
36 class OutputDevice;
38 namespace sdr
40 namespace overlay
42 class OverlayManager;
43 } // end of namespace overlay
44 } // end of namespace sdr
46 namespace basegfx
48 class B2DPolygon;
49 class B2DPolyPolygon;
50 class B2DRange;
51 } // end of namespace basegfx
53 //////////////////////////////////////////////////////////////////////////////
55 namespace sdr
57 namespace overlay
59 class SVX_DLLPUBLIC OverlayObject : private ::boost::noncopyable, public ::sdr::animation::Event
61 private:
62 // Manager is allowed access to private Member mpOverlayManager
63 friend class OverlayManager;
65 // pointer to OverlayManager, if object is added. Changed by
66 // OverlayManager, do not chnge Yourself.
67 OverlayManager* mpOverlayManager;
69 // Primitive2DSequence of the OverlayObject
70 drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence;
72 protected:
73 // access methods to maPrimitive2DSequence. The usage of this methods may allow
74 // later thread-safe stuff to be added if needed. Only to be used by getPrimitive2DSequence()
75 // implementations for buffering the last decomposition.
76 const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
77 void setPrimitive2DSequence(const drawinglayer::primitive2d::Primitive2DSequence& rNew) { maPrimitive2DSequence = rNew; }
79 // the creation method for Primitive2DSequence. Called when getPrimitive2DSequence()
80 // sees that maPrimitive2DSequence is empty. Needs to be supported by all
81 // OverlayObject implementations. Default implementation will assert
82 // a missing implementation
83 virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
85 // region in logical coordinates
86 basegfx::B2DRange maBaseRange;
88 // base color of this OverlayObject
89 Color maBaseColor;
91 // bitfield
92 // Flag for visibility
93 unsigned mbIsVisible : 1;
95 // Flag to control hittability
96 unsigned mbIsHittable : 1;
98 // Flag to hold info if this objects supports animation. Default is
99 // false. If true, the Trigger() method should be overloaded
100 // to implement the animation effect and to re-initiate the event.
101 unsigned mbAllowsAnimation : 1;
103 // Flag tocontrol if this OverlayObject allows AntiAliased visualisation.
104 // Default is true, but e.g. for selection visualisation in SC and SW,
105 // it is switched to false
106 unsigned mbAllowsAntiAliase : 1;
108 // set changed flag. Call after change, since the old range is invalidated
109 // and then the new one is calculated and invalidated, too. This will only
110 // work after the change.
111 virtual void objectChange();
113 // write access to AntiAliase flag. This is protected since
114 // only implementations are allowed to change this, preferrably in their
115 // constructor
116 void allowAntiAliase(bool bNew);
118 public:
119 explicit OverlayObject(Color aBaseColor);
120 virtual ~OverlayObject();
122 // get OverlayManager
123 OverlayManager* getOverlayManager() const { return mpOverlayManager; }
125 // the access method for Primitive2DSequence. Will use createPrimitive2DSequence and
126 // setPrimitive2DSequence if needed. Overloading may be used to allow disposal of last
127 // created primitives to react on changed circumstances and to re-create primitives
128 virtual drawinglayer::primitive2d::Primitive2DSequence getOverlayObjectPrimitive2DSequence() const;
130 // access to visibility state
131 bool isVisible() const { return mbIsVisible; }
132 void setVisible(bool bNew);
134 // access to hittable flag
135 bool isHittable() const { return mbIsHittable; }
136 void setHittable(bool bNew);
138 // read access to AntiAliase flag
139 bool allowsAntiAliase() const { return mbAllowsAntiAliase; }
141 // read access to baseRange. This may trigger createBaseRange() if
142 // object is changed.
143 const basegfx::B2DRange& getBaseRange() const;
145 // access to baseColor
146 Color getBaseColor() const { return maBaseColor; }
147 void setBaseColor(Color aNew);
149 // execute event from base class ::sdr::animation::Event. Default
150 // implementation does nothing and does not create a new event.
151 virtual void Trigger(sal_uInt32 nTime);
153 // acces to AllowsAnimation flag
154 bool allowsAnimation() const { return mbAllowsAnimation; }
156 // stripe definition has changed. The OverlayManager does have
157 // support data to draw graphics in two colors striped. This
158 // method notifies the OverlayObject if that change takes place.
159 // Default implementation does nothing.
160 virtual void stripeDefinitionHasChanged();
163 // typedefs for a vector of OverlayObjects
164 typedef ::std::vector< OverlayObject* > OverlayObjectVector;
166 } // end of namespace overlay
167 } // end of namespace sdr
169 //////////////////////////////////////////////////////////////////////////////
171 namespace sdr
173 namespace overlay
175 class SVX_DLLPUBLIC OverlayObjectWithBasePosition : public OverlayObject
177 protected:
178 // base position in logical coordinates
179 basegfx::B2DPoint maBasePosition;
181 public:
182 OverlayObjectWithBasePosition(const basegfx::B2DPoint& rBasePos, Color aBaseColor);
183 virtual ~OverlayObjectWithBasePosition();
185 // access to basePosition
186 const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
187 void setBasePosition(const basegfx::B2DPoint& rNew);
189 } // end of namespace overlay
190 } // end of namespace sdr
192 //////////////////////////////////////////////////////////////////////////////
194 #endif //_SDR_OVERLAY_OVERLAYOBJECT_HXX
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */