diff options
author | Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com> | 2022-02-22 19:39:04 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-02-25 09:48:14 +0100 |
commit | ec635b62af9424eddb32cc4646bc425559f4a622 (patch) | |
tree | d67108b25234233cb5fa7893c09bbcd3f8d32def /svx | |
parent | 56c871c247b84d7c2cddf685c13e8355db50da46 (diff) |
Advanced Diagram support: cleanup/consolidate with existing code
Reorganized and streamlined, use IDiagramHelper as main interface
now also for existing code.
Had to adapt oox::Shape && Diagram handling since there the
import gets handled very different. This ensures that a Diagram
is detected at export and that the same happens for now as before
Had to add a detection that resetting the GrabBag is meant to
disable the Diagam functionality. That is very indirect, but
has to stay for compaibility reasons for now
Change-Id: I620b7d61cd84b5f9dd8ae4dc890ebf70ce779cdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130389
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 11 | ||||
-rw-r--r-- | svx/source/svdraw/svdogrp.cxx | 38 |
2 files changed, 35 insertions, 14 deletions
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index cb89a2fc5555..f4068748d512 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -189,7 +189,6 @@ SdrObjTransformInfoRec::SdrObjTransformInfoRec() : struct SdrObject::Impl { sdr::ObjectUserVector maObjectUsers; - std::shared_ptr<DiagramDataInterface> mpDiagramData; std::optional<double> mnRelativeWidth; std::optional<double> mnRelativeHeight; sal_Int16 meRelativeWidthRelation; @@ -637,16 +636,6 @@ sal_Int16 SdrObject::GetRelativeHeightRelation() const return mpImpl->meRelativeHeightRelation; } -void SdrObject::SetDiagramData(std::shared_ptr<DiagramDataInterface> pDiagramData) -{ - mpImpl->mpDiagramData = pDiagramData; -} - -const std::shared_ptr<DiagramDataInterface> & SdrObject::GetDiagramData() const -{ - return mpImpl->mpDiagramData; -} - SfxItemPool& SdrObject::GetObjectItemPool() const { return getSdrModelFromSdrObject().GetItemPool(); diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 47e9f0f83901..dae41c92b2e8 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -35,10 +35,10 @@ #include <rtl/ustrbuf.hxx> #include <vcl/canvastools.hxx> -DiagramHelper::DiagramHelper() {} -DiagramHelper::~DiagramHelper() {} +IDiagramHelper::IDiagramHelper() {} +IDiagramHelper::~IDiagramHelper() {} -void DiagramHelper::anchorToSdrObjGroup(SdrObjGroup& rTarget) +void IDiagramHelper::anchorToSdrObjGroup(SdrObjGroup& rTarget) { rTarget.mp_DiagramHelper.reset(this); } @@ -205,6 +205,38 @@ SdrObjList* SdrObjGroup::GetSubList() const return const_cast< SdrObjGroup* >(this); } +static bool containsOOXData(const css::uno::Any& rVal) +{ + const css::uno::Sequence<css::beans::PropertyValue>& propList(rVal.get< css::uno::Sequence<css::beans::PropertyValue> >()); + for (const auto& rProp : std::as_const(propList)) + { + if(rProp.Name.startsWith("OOX")) + { + return true; + } + } + + return false; +} + +void SdrObjGroup::SetGrabBagItem(const css::uno::Any& rVal) +{ + // detect if the intention is to disable Diagram functionality + if(isDiagram() && !containsOOXData(rVal)) + { + css::uno::Any aOld; + GetGrabBagItem(aOld); + + if(containsOOXData(aOld)) + { + mp_DiagramHelper.reset(); + } + } + + // call parent + SdrObject::SetGrabBagItem(rVal); +} + const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const { // <aOutRect> has to contain the bounding rectangle |