From eaaf5ef8f99404797ffbb44ceeebf8795d85f07e Mon Sep 17 00:00:00 2001 From: "Armin Le Grand (Allotropia)" Date: Fri, 18 Feb 2022 16:07:28 +0100 Subject: Advanced Diagram support: first additions/reorganizations To allow advanced Diagram/SmartArt support in the future this is a first step to organize imported SmartArt Data in a way that will allow to re-layout loaded SmartArts, under re-usage of the oox::Theme (held available). It is designed to work without holding available the original XML snippets defining the imported Diagram in any way, also for performance reasons. It tries to re-use some of the already basically added functionality, including the systematic layouting using the generic layout algorithm, plus some already available text extraction. Before being sure that the former state can be completely replaced this is optoinal and used when SAL_ENABLE_ADVANCED_SMART_ART is defined. Some new stuff is already done but e.g. the redefined reLayout method will not (yet) be triggered. It works and reliably produces a re-layouted identical version, also preserving transformations. Change-Id: I08cfbae04afa663d0589530aae549216d853128d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130171 Tested-by: Jenkins Reviewed-by: Armin Le Grand --- sd/source/ui/view/drviews3.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sd') diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 54cccf78654b..8e06b9327def 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -487,8 +488,9 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); Reference xShape(pObj->getUnoShape(), UNO_QUERY); + static bool bAdvancedSmartArt(nullptr != getenv("SAL_ENABLE_ADVANCED_SMART_ART")); - if (oox::drawingml::DrawingML::IsDiagram(xShape)) + if (!bAdvancedSmartArt && oox::drawingml::DrawingML::IsDiagram(xShape)) { mpDrawView->UnmarkAll(); @@ -502,6 +504,15 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView()); } + + // Support advanced DiagramHelper + SdrObjGroup* pAnchorObj = dynamic_cast(pObj); + if(bAdvancedSmartArt && pAnchorObj && pAnchorObj->isDiagram()) + { + mpDrawView->UnmarkAll(); + pAnchorObj->getDiagramHelper()->reLayout(); + mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView()); + } } rReq.Done(); -- cgit