diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /include/svx/sdr/overlay | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/svx/sdr/overlay')
-rw-r--r-- | include/svx/sdr/overlay/overlayanimatedbitmapex.hxx | 81 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaybitmapex.hxx | 61 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaymanager.hxx | 130 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayobject.hxx | 206 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayobjectlist.hxx | 70 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlaypolypolygon.hxx | 71 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx | 48 | ||||
-rw-r--r-- | include/svx/sdr/overlay/overlayselection.hxx | 77 |
8 files changed, 744 insertions, 0 deletions
diff --git a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx new file mode 100644 index 0000000000..cf1b411366 --- /dev/null +++ b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/bitmapex.hxx> + + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayAnimatedBitmapEx final : public OverlayObjectWithBasePosition + { + // the Bitmaps + BitmapEx maBitmapEx1; + BitmapEx maBitmapEx2; + + // position of the basePosition inside the Bitmaps, in pixels + sal_uInt16 mnCenterX1; + sal_uInt16 mnCenterY1; + sal_uInt16 mnCenterX2; + sal_uInt16 mnCenterY2; + + // #i53216# added CursorBlinkTime (in ms) + sal_uInt32 mnBlinkTime; + + // optional shear and rotation + double mfShearX; + double mfRotation; + + // Flag to remember which state to draw. Inited with false (0) + bool mbOverlayState : 1; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + OverlayAnimatedBitmapEx( + const basegfx::B2DPoint& rBasePos, + const BitmapEx& rBitmapEx1, + const BitmapEx& rBitmapEx2, + sal_uInt64 nBlinkTime, + sal_uInt16 nCenX1 = 0, + sal_uInt16 nCenY1 = 0, + sal_uInt16 nCenX2 = 0, + sal_uInt16 nCenY2 = 0, + double fShearX = 0.0, + double fRotation = 0.0); + virtual ~OverlayAnimatedBitmapEx() override; + + // execute event from base class sdr::animation::Event. Default + // implementation does nothing and does not create a new event. + virtual void Trigger(sal_uInt32 nTime) override; + + // get shearX and rotation + double getShearX() const { return mfShearX; } + double getRotation() const { return mfRotation; } + }; +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaybitmapex.hxx b/include/svx/sdr/overlay/overlaybitmapex.hxx new file mode 100644 index 0000000000..42de7d6531 --- /dev/null +++ b/include/svx/sdr/overlay/overlaybitmapex.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <vcl/bitmapex.hxx> + + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayBitmapEx final : public OverlayObjectWithBasePosition + { + // the Bitmap itself + BitmapEx maBitmapEx; + + // position of the basePosition inside the Bitmap, in pixels + sal_uInt16 mnCenterX; + sal_uInt16 mnCenterY; + + // optional transparency, shear and rotation + double mfAlpha; + double mfShearX; + double mfRotation; + + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + OverlayBitmapEx( + const basegfx::B2DPoint& rBasePos, + const BitmapEx& rBitmapEx, + sal_uInt16 nCenX = 0, + sal_uInt16 nCenY = 0, + double fAlpha = 0.0, + double fShearX = 0.0, + double fRotation = 0.0); + virtual ~OverlayBitmapEx() override; + }; +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYBITMAPEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaymanager.hxx b/include/svx/sdr/overlay/overlaymanager.hxx new file mode 100644 index 0000000000..696cf5c992 --- /dev/null +++ b/include/svx/sdr/overlay/overlaymanager.hxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX + +#include <rtl/ref.hxx> +#include <svx/sdr/animation/scheduler.hxx> +#include <svx/sdr/overlay/overlayobject.hxx> +#include <tools/color.hxx> +#include <tools/gen.hxx> +#include <svx/svxdllapi.h> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include <salhelper/simplereferenceobject.hxx> + +class OutputDevice; +class SdrModel; +namespace vcl { class Region; } + +namespace sdr::overlay { + class OverlayObject; +} + +namespace basegfx { + class B2DRange; +} + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayManager + : protected sdr::animation::Scheduler + , public salhelper::SimpleReferenceObject + { + private: + OverlayManager(const OverlayManager&) = delete; + OverlayManager& operator=(const OverlayManager&) = delete; + + protected: + // the OutputDevice to work on, set on construction and not to be changed + OutputDevice& mrOutputDevice; + + // the vector of registered OverlayObjects + OverlayObjectVector maOverlayObjects; + + // Stripe support. All striped OverlayObjects use these stripe + // values. Changes change all those objects. + Color maStripeColorA; // defaults to COL_BLACK + Color maStripeColorB; // defaults to COL_WHITE + sal_uInt32 mnStripeLengthPixel; // defaults to 4L + + // hold buffered the logic length of discrete vector (1.0, 0.0) and the + // view transformation belonging to it. Update happens in getDiscreteOne() + basegfx::B2DHomMatrix maViewTransformation; + drawinglayer::geometry::ViewInformation2D maViewInformation2D; + double mfDiscreteOne; + + // internal + void ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const; + void ImpStripeDefinitionChanged(); + void impApplyRemoveActions(OverlayObject& rTarget); + void impApplyAddActions(OverlayObject& rTarget); + + // return mfDiscreteOne to derivations, but also check for buffered local + // ViewTransformation and evtl. correct mfDiscreteOne + double getDiscreteOne() const; + + tools::Rectangle RangeToInvalidateRectangle(const basegfx::B2DRange& rRange) const; + + OverlayManager(OutputDevice& rOutputDevice); + virtual ~OverlayManager() override; + + public: + static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice); + + // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D + drawinglayer::geometry::ViewInformation2D const & getCurrentViewInformation2D() const; + + // complete redraw + virtual void completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = nullptr) const; + + // flush. Do buffered updates. + virtual void flush(); + + // get the OutputDevice + OutputDevice& getOutputDevice() const { return mrOutputDevice; } + + // add and remove OverlayObjects + void add(OverlayObject& rOverlayObject); + void remove(OverlayObject& rOverlayObject); + + // invalidate the given range at local OutputDevice + virtual void invalidateRange(const basegfx::B2DRange& rRange); + + // stripe support ColA + const Color& getStripeColorA() const { return maStripeColorA; } + void setStripeColorA(Color aNew); + + // stripe support ColB + const Color& getStripeColorB() const { return maStripeColorB; } + void setStripeColorB(Color aNew); + + // stripe support StripeLengthPixel + sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; } + void setStripeLengthPixel(sal_uInt32 nNew); + + void InsertEvent(sdr::animation::Event& rNew) { Scheduler::InsertEvent(rNew); } + }; + +} // end of namespace sdr::overlay + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayobject.hxx b/include/svx/sdr/overlay/overlayobject.hxx new file mode 100644 index 0000000000..1c8d1d43b1 --- /dev/null +++ b/include/svx/sdr/overlay/overlayobject.hxx @@ -0,0 +1,206 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECT_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECT_HXX + +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/range/b2drange.hxx> +#include <tools/color.hxx> +#include <svx/sdr/animation/scheduler.hxx> +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> + +#include <vector> + +class OutputDevice; + +namespace sdr::overlay +{ + class OverlayManager; +} +namespace basegfx +{ + class B2DPolygon; + class B2DPolyPolygon; + class B2DRange; +} + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayObject : public sdr::animation::Event + { + private: + OverlayObject(const OverlayObject&) = delete; + OverlayObject& operator=(const OverlayObject&) = delete; + + // Manager is allowed access to private Member mpOverlayManager + friend class OverlayManager; + + // pointer to OverlayManager, if object is added. Changed by + // OverlayManager, do not change Yourself. + OverlayManager* mpOverlayManager; + + // Primitive2DContainer of the OverlayObject + drawinglayer::primitive2d::Primitive2DContainer maPrimitive2DSequence; + + // Possible Offset added to the geometry (automatically in + // createOverlayObjectPrimitive2DSequence()). Usually zero, may + // be used e.g. from calc when GridOffset is needed + basegfx::B2DVector maOffset; + + protected: + // access methods to maPrimitive2DSequence. The usage of this methods may allow + // later thread-safe stuff to be added if needed. Only to be used by getPrimitive2DSequence() + // implementations for buffering the last decomposition. + // Resetting is allowed e.g. in ::getOverlayObjectPrimitive2DSequence() implementations + // if the conditions have changed to force a re-creation in calling the base implementation. + // The only allowed setter of maPrimitive2DSequence is + // OverlayObject::getOverlayObjectPrimitive2DSequence() which should be called by calling + // the base implementation in derived functions. That one will use the result of + // createOverlayObjectPrimitive2DSequence() to provide the geometry. + const drawinglayer::primitive2d::Primitive2DContainer& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + void resetPrimitive2DSequence() { maPrimitive2DSequence.clear(); } + + // the creation method for Primitive2DContainer. Called when getPrimitive2DSequence() + // sees that maPrimitive2DSequence is empty. Needs to be supported by all + // OverlayObject implementations. Default implementation will assert + // a missing implementation + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence(); + + // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000) + static sal_uInt32 impCheckBlinkTimeValueRange(sal_uInt64 nBlinkTime); + + // region in logical coordinates + basegfx::B2DRange maBaseRange; + + // base color of this OverlayObject + Color maBaseColor; + + // Flag for visibility + bool mbIsVisible : 1; + + // Flag to control hittability + bool mbIsHittable : 1; + + // Flag to hold info if this objects supports animation. Default is + // false. If true, the Trigger() method should be overridden + // to implement the animation effect and to re-initiate the event. + bool mbAllowsAnimation : 1; + + // Flag to control if this OverlayObject allows AntiAliased visualisation. + // Default is true, but e.g. for selection visualisation in SC and SW, + // it is switched to false + bool mbAllowsAntiAliase : 1; + + // In High Contrast mode all fg and bg are forced to a pair of normal + // high contrast colors. If this flag is set, then in High Contrast mode + // the colors are instead forced to the high contrast selection fg/bg pair. + // Default is false. + bool mbHighContrastSelection : 1; + + // set changed flag. Call after change, since the old range is invalidated + // and then the new one is calculated and invalidated, too. This will only + // work after the change. + void objectChange(); + + // write access to AntiAliase flag. This is protected since + // only implementations are allowed to change this, preferably in their + // constructor + void allowAntiAliase(bool bNew); + + public: + explicit OverlayObject(Color aBaseColor); + virtual ~OverlayObject() override; + + // get OverlayManager + OverlayManager* getOverlayManager() const { return mpOverlayManager; } + + // the access method for Primitive2DContainer. Will use createPrimitive2DSequence and + // setPrimitive2DSequence if needed. Overriding may be used to allow disposal of last + // created primitives to react on changed circumstances and to re-create primitives + virtual drawinglayer::primitive2d::Primitive2DContainer getOverlayObjectPrimitive2DSequence() const; + + // access to visibility state + bool isVisible() const { return mbIsVisible; } + void setVisible(bool bNew); + + // access to hittable flag + bool isHittable() const { return mbIsHittable; } + void setHittable(bool bNew); + + // read access to AntiAliase flag + bool allowsAntiAliase() const { return mbAllowsAntiAliase; } + + // read access to DrawModeSettings flag + bool isHighContrastSelection() const { return mbHighContrastSelection; } + + // read access to baseRange. This may trigger createBaseRange() if + // object is changed. + const basegfx::B2DRange& getBaseRange() const; + + // access to baseColor + const Color& getBaseColor() const { return maBaseColor; } + void setBaseColor(Color aNew); + + // access to Offset + const basegfx::B2DVector& getOffset() const { return maOffset; } + void setOffset(const basegfx::B2DVector& rOffset); + + // execute event from base class sdr::animation::Event. Default + // implementation does nothing and does not create a new event. + virtual void Trigger(sal_uInt32 nTime) override; + + // access to AllowsAnimation flag + bool allowsAnimation() const { return mbAllowsAnimation; } + + // stripe definition has changed. The OverlayManager does have + // support data to draw graphics in two colors striped. This + // method notifies the OverlayObject if that change takes place. + // Default implementation does nothing. + virtual void stripeDefinitionHasChanged(); + }; + + // typedefs for a vector of OverlayObjects + typedef ::std::vector< OverlayObject* > OverlayObjectVector; + +} // end of namespace sdr::overlay + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayObjectWithBasePosition : public OverlayObject + { + protected: + // base position in logical coordinates + basegfx::B2DPoint maBasePosition; + + public: + OverlayObjectWithBasePosition(const basegfx::B2DPoint& rBasePos, Color aBaseColor); + virtual ~OverlayObjectWithBasePosition() override; + + // access to basePosition + const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; } + void setBasePosition(const basegfx::B2DPoint& rNew); + }; + +} // end of namespace sdr::overlay + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayobjectlist.hxx b/include/svx/sdr/overlay/overlayobjectlist.hxx new file mode 100644 index 0000000000..6985a1b5ae --- /dev/null +++ b/include/svx/sdr/overlay/overlayobjectlist.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <sal/types.h> +#include <svx/svxdllapi.h> +#include <memory> +#include <vector> + + +class Point; + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayObjectList final + { + // the vector of OverlayObjects + ::std::vector< std::unique_ptr<OverlayObject> > maVector; + + public: + OverlayObjectList() {} + OverlayObjectList(const OverlayObjectList&) = delete; + OverlayObjectList& operator=(const OverlayObjectList&) = delete; + ~OverlayObjectList(); + + // clear list, this includes deletion of all contained objects + void clear(); + + // append objects (takes ownership) + void append(std::unique_ptr<OverlayObject> pOverlayObject); + + // access to objects + sal_uInt32 count() const { return maVector.size(); } + OverlayObject& getOverlayObject(sal_uInt32 nIndex) const { return *(maVector[nIndex]); } + + // Hittest with logical coordinates + bool isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance = 0.0) const; + + // Hittest with pixel coordinates + bool isHitPixel(const Point& rDiscretePosition) const; + + // calculate BaseRange of all included OverlayObjects and return + basegfx::B2DRange getBaseRange() const; + }; + +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlaypolypolygon.hxx b/include/svx/sdr/overlay/overlaypolypolygon.hxx new file mode 100644 index 0000000000..0cc31b38c7 --- /dev/null +++ b/include/svx/sdr/overlay/overlaypolypolygon.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + + +namespace sdr::overlay +{ + class SVXCORE_DLLPUBLIC OverlayPolyPolygon final : public OverlayObject + { + private: + basegfx::B2DPolyPolygon maLinePolyPolygon; + double mfLineWidth; + Color maFillColor; + + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + explicit OverlayPolyPolygon(basegfx::B2DPolyPolygon aLinePolyPolygon, + Color const & rLineColor, + double mfLineWidth, + Color const & rFillColor); + virtual ~OverlayPolyPolygon() override; + }; + + class SVXCORE_DLLPUBLIC OverlayPolyPolygonStripedAndFilled final : public OverlayObject + { + // geometry + basegfx::B2DPolyPolygon maLinePolyPolygon; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + explicit OverlayPolyPolygonStripedAndFilled( + basegfx::B2DPolyPolygon aLinePolyPolygon); + virtual ~OverlayPolyPolygonStripedAndFilled() override; + + // change geometry + const basegfx::B2DPolyPolygon& getLinePolyPolygon() const { return maLinePolyPolygon; } + + // react on stripe definition change + virtual void stripeDefinitionHasChanged() override; + }; + +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx b/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx new file mode 100644 index 0000000000..06e7428de1 --- /dev/null +++ b/include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> + + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayPrimitive2DSequenceObject final : public OverlayObjectWithBasePosition + { + // the sequence of primitives to show + const drawinglayer::primitive2d::Primitive2DContainer maSequence; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + explicit OverlayPrimitive2DSequenceObject(drawinglayer::primitive2d::Primitive2DContainer&& rSequence); + + virtual ~OverlayPrimitive2DSequenceObject() override; + }; + +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/overlay/overlayselection.hxx b/include/svx/sdr/overlay/overlayselection.hxx new file mode 100644 index 0000000000..d456ac6bf1 --- /dev/null +++ b/include/svx/sdr/overlay/overlayselection.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX +#define INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> + + +namespace sdr::overlay + { + // overlay type definition + enum class OverlayType + { + Invert, + Solid, + Transparent + }; + + class SVXCORE_DLLPUBLIC OverlaySelection final : public OverlayObject + { + // type of overlay + OverlayType meOverlayType; + + // geometry of overlay + std::vector< basegfx::B2DRange > maRanges; + + // Values of last primitive creation. These are checked in getOverlayObjectPrimitive2DSequence + // to evtl. get rid of last Primitive2DContainer. This ensures that these values are up-to-date + // and are usable when creating primitives + OverlayType maLastOverlayType; + sal_uInt16 mnLastTransparence; + + bool mbBorder : 1; + + // geometry creation for OverlayObject, can use local *Last* values + virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override; + + public: + OverlaySelection( + OverlayType eType, + const Color& rColor, + std::vector< basegfx::B2DRange >&& rRanges, + bool bBorder); + virtual ~OverlaySelection() override; + + // data read access + const std::vector< basegfx::B2DRange >& getRanges() const { return maRanges; } + + /// override to check conditions for last createOverlayObjectPrimitive2DSequence + virtual drawinglayer::primitive2d::Primitive2DContainer getOverlayObjectPrimitive2DSequence() const override; + + // data write access + void setRanges(std::vector< basegfx::B2DRange >&& rNew); + }; +} // end of namespace sdr::overlay + + +#endif // INCLUDED_SVX_SDR_OVERLAY_OVERLAYSELECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |