From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- .../svx/sdr/overlay/overlayanimatedbitmapex.hxx | 81 +++++++++ include/svx/sdr/overlay/overlaybitmapex.hxx | 61 +++++++ include/svx/sdr/overlay/overlaymanager.hxx | 130 ++++++++++++++ include/svx/sdr/overlay/overlayobject.hxx | 197 +++++++++++++++++++++ include/svx/sdr/overlay/overlayobjectlist.hxx | 70 ++++++++ include/svx/sdr/overlay/overlaypolypolygon.hxx | 71 ++++++++ .../overlay/overlayprimitive2dsequenceobject.hxx | 48 +++++ include/svx/sdr/overlay/overlayselection.hxx | 77 ++++++++ 8 files changed, 735 insertions(+) create mode 100644 include/svx/sdr/overlay/overlayanimatedbitmapex.hxx create mode 100644 include/svx/sdr/overlay/overlaybitmapex.hxx create mode 100644 include/svx/sdr/overlay/overlaymanager.hxx create mode 100644 include/svx/sdr/overlay/overlayobject.hxx create mode 100644 include/svx/sdr/overlay/overlayobjectlist.hxx create mode 100644 include/svx/sdr/overlay/overlaypolypolygon.hxx create mode 100644 include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx create mode 100644 include/svx/sdr/overlay/overlayselection.hxx (limited to 'include/svx/sdr/overlay') diff --git a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx new file mode 100644 index 000000000..cf1b41136 --- /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 +#include + + +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 000000000..42de7d653 --- /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 +#include + + +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 000000000..696cf5c99 --- /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 +#include +#include +#include +#include +#include +#include +#include +#include + +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 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 000000000..d4ef56646 --- /dev/null +++ b/include/svx/sdr/overlay/overlayobject.hxx @@ -0,0 +1,197 @@ +/* -*- 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 +#include +#include +#include +#include +#include + +#include + +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; + + // 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 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 000000000..6985a1b5a --- /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 +#include +#include +#include +#include + + +class Point; + +namespace sdr::overlay + { + class SVXCORE_DLLPUBLIC OverlayObjectList final + { + // the vector of OverlayObjects + ::std::vector< std::unique_ptr > 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 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 000000000..d3aa2074d --- /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 +#include + + +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(const basegfx::B2DPolyPolygon& rLinePolyPolygon, + 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( + const basegfx::B2DPolyPolygon& rLinePolyPolygon); + 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 000000000..06e7428de --- /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 +#include + + +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 000000000..d456ac6bf --- /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 + + +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: */ -- cgit v1.2.3