diff options
author | Jaume Pujantell <jaume.pujantell@collabora.com> | 2024-02-13 09:27:00 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-02-14 14:51:16 +0100 |
commit | 6565e46f3e49173c4c37f8b51450f5352ac08341 (patch) | |
tree | 20aa302b9f558f44e7c2d630c9f1cde6dff55024 /svx/source/svdraw | |
parent | 7c0c8a3ae258808012c3514dadeb02fc0c6fc43b (diff) |
tdf#159704 svx: preserve text when getting grpahic from sdrobject
When getting a Graphic object from an SdrGrafObj with text the text was lost.
Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit d0241915eba35c9dc0cc42f322df798a270db00f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163342
Tested-by: Jenkins
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r-- | svx/source/svdraw/svdxcgv.cxx | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 050a99707740..5d16cbae2598 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -599,42 +599,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; - // try to get a graphic from the object first - const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&rSdrObject)); - const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&rSdrObject)); - - if(pSdrGrafObj) + if (!rSdrObject.HasText()) { - if(pSdrGrafObj->isEmbeddedVectorGraphicData()) + // try to get a graphic from the object first + const SdrGrafObj* pSdrGrafObj(dynamic_cast<const SdrGrafObj*>(&rSdrObject)); + const SdrOle2Obj* pSdrOle2Obj(dynamic_cast<const SdrOle2Obj*>(&rSdrObject)); + + if (pSdrGrafObj) { - // get Metafile for Svg content - aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); + if (pSdrGrafObj->isEmbeddedVectorGraphicData()) + { + // get Metafile for Svg content + aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); + } + else + { + // Make behaviour coherent with metafile + // recording below (which of course also takes + // view-transformed objects) + aRet = pSdrGrafObj->GetTransformedGraphic(); + } } - else + else if (pSdrOle2Obj) { - // Make behaviour coherent with metafile - // recording below (which of course also takes - // view-transformed objects) - aRet = pSdrGrafObj->GetTransformedGraphic(); - } - } - else if(pSdrOle2Obj) - { - if(pSdrOle2Obj->GetGraphic()) - { - aRet = *pSdrOle2Obj->GetGraphic(); + if (pSdrOle2Obj->GetGraphic()) + { + aRet = *pSdrOle2Obj->GetGraphic(); + } } - } - else - { - // Support extracting a snapshot from video media, if possible. - const SdrMediaObj* pSdrMediaObj = dynamic_cast<const SdrMediaObj*>(&rSdrObject); - if (pSdrMediaObj) + else { - const css::uno::Reference<css::graphic::XGraphic>& xGraphic - = pSdrMediaObj->getSnapshot(); - if (xGraphic.is()) - aRet = Graphic(xGraphic); + // Support extracting a snapshot from video media, if possible. + const SdrMediaObj* pSdrMediaObj = dynamic_cast<const SdrMediaObj*>(&rSdrObject); + if (pSdrMediaObj) + { + const css::uno::Reference<css::graphic::XGraphic>& xGraphic + = pSdrMediaObj->getSnapshot(); + if (xGraphic.is()) + aRet = Graphic(xGraphic); + } } } |