diff options
author | Attila Szűcs <attila.szucs@collabora.com> | 2024-03-21 01:57:59 +0100 |
---|---|---|
committer | Attila Szűcs <attila.szucs@collabora.com> | 2024-03-22 15:25:23 +0100 |
commit | d323976fd6d560a9b91da3e7833dfbe9f6b78f39 (patch) | |
tree | 9c32ecd87c938a6bd22240e1fa707002061c10d9 | |
parent | 8f2de92b3da99346f7282e623d47912f40f92b7b (diff) |
tdf#159258 SD: SS: disable placeholdertext in image
Changed the text creation to use ExclusiveEditViewPrimitive2D
in case we are in a placeholder image.
Had to make a flag to send the information if we are in a
placeholderimage.. because this function also called on other
primitives.
Unfortunatelly we cannot do it in
CreateObjectSpecificViewObjectContact
as in case of the icon... because the Primitive2DContainer
that will (later) contain the text will also contain the rectangle
as well, and we want to display the rectange.
Follow-up to commit I307f4b0fe7f8faf98789787f216cac7be86a0515
"Provide tooling for EditView exclusive Primitives".
Change-Id: If24aaa330c7b0b6dbaa72c9900774959ef24da4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165087
Tested-by: Jenkins
Reviewed-by: Attila Szűcs <attila.szucs@collabora.com>
-rw-r--r-- | svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofgraphic.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 24 |
3 files changed, 25 insertions, 6 deletions
diff --git a/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx index 91f1d9d2d4d8..3e19d5b6dce8 100644 --- a/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -33,6 +33,7 @@ private: attribute::SdrLineFillEffectsTextAttribute maSdrLFSTAttribute; GraphicObject maGraphicObject; GraphicAttr maGraphicAttr; + bool mbPlaceholderImage = false; // local decomposition. virtual Primitive2DReference @@ -41,7 +42,8 @@ private: public: SdrGrafPrimitive2D(::basegfx::B2DHomMatrix aTransform, const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute, - const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr); + const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr, + bool bPlaceholderImage = false); // data access const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index f3a18d8e6462..b9f7755b5a03 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -84,7 +84,8 @@ namespace sdr::contact rObjectMatrix, rAttribute, aEmptyGraphicObject, - aEmptyGraphicAttr)); + aEmptyGraphicAttr, + true)); xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReferenceA }; // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index ff91bc67462d..dadc8d06326e 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -20,6 +20,7 @@ #include <sdr/primitive2d/sdrgrafprimitive2d.hxx> #include <drawinglayer/primitive2d/graphicprimitive2d.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> +#include <drawinglayer/primitive2d/exclusiveeditviewprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <sdr/primitive2d/sdrdecompositiontools.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> @@ -103,9 +104,22 @@ Primitive2DReference SdrGrafPrimitive2D::create2DDecomposition( // add text if (!getSdrLFSTAttribute().getText().isDefault()) { - aRetval.push_back(createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - getSdrLFSTAttribute().getText(), - getSdrLFSTAttribute().getLine(), false, false)); + const drawinglayer::primitive2d::Primitive2DReference xReferenceA = createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), false, false); + + if (!mbPlaceholderImage) + { + aRetval.push_back(xReferenceA); + } + else + { + const drawinglayer::primitive2d::Primitive2DReference aEmbedded( + new drawinglayer::primitive2d::ExclusiveEditViewPrimitive2D( + drawinglayer::primitive2d::Primitive2DContainer{ xReferenceA })); + + aRetval.push_back(aEmbedded); + } } // tdf#132199: put glow before shadow, to have shadow of the glow, not the opposite @@ -128,11 +142,13 @@ Primitive2DReference SdrGrafPrimitive2D::create2DDecomposition( SdrGrafPrimitive2D::SdrGrafPrimitive2D( basegfx::B2DHomMatrix aTransform, const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute, - const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr) + const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr, + bool bPlaceholderImage /* = false */) : maTransform(std::move(aTransform)) , maSdrLFSTAttribute(rSdrLFSTAttribute) , maGraphicObject(rGraphicObject) , maGraphicAttr(rGraphicAttr) + , mbPlaceholderImage(bPlaceholderImage) { // activate callback to flush buffered decomposition content setCallbackSeconds(20); |