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 /sd | |
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 'sd')
-rw-r--r-- | sd/inc/pch/precompiled_sdui.hxx | 1 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 3 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drviews3.cxx | 30 |
4 files changed, 15 insertions, 25 deletions
diff --git a/sd/inc/pch/precompiled_sdui.hxx b/sd/inc/pch/precompiled_sdui.hxx index 2eed698130b6..237dd892c4dc 100644 --- a/sd/inc/pch/precompiled_sdui.hxx +++ b/sd/inc/pch/precompiled_sdui.hxx @@ -391,7 +391,6 @@ #include <svtools/svtdllapi.h> #include <svtools/unitconv.hxx> #include <svtools/valueset.hxx> -#include <svx/DiagramDataInterface.hxx> #include <svx/XPropertyEntry.hxx> #include <svx/drawitem.hxx> #include <svx/flagsdef.hxx> diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index f69938ab1326..df29ef09c2d8 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -1497,6 +1497,9 @@ void SdOOXMLExportTest2::testSmartartRotation2() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/smartart-rotation2.pptx"), PPTX); // clear SmartArt data to check how group shapes with double-rotated children are exported, not smartart + // NOTE: Resetting the GrabBag data is a *very* indirect way to reset the SmartArt functionality. + // Since this worked before and there is not (yet?) a better way do do it using UNO API, I added + // code to support this for now uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); uno::Sequence<beans::PropertyValue> aInteropGrabBag; xShape->setPropertyValue("InteropGrabBag", uno::makeAny(aInteropGrabBag)); diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index c96db47eb3cc..07be6521d678 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -62,6 +62,7 @@ #include <i18nlangtag/languagetag.hxx> #include <svx/svdpage.hxx> #include <svx/unoapi.hxx> +#include <svx/svdogrp.hxx> #include <sdmod.hxx> #include <sdpage.hxx> @@ -1646,7 +1647,10 @@ void PowerPointExport::WriteShapeTree(const FSHelperPtr& pFS, PageType ePageType if (GetShapeByIndex(GetCurrentGroupIndex(), true)) { SAL_INFO("sd.eppt", "mType: " << mType); - if (DrawingML::IsDiagram(mXShape)) + const SdrObjGroup* pDiagramCandidate(dynamic_cast<const SdrObjGroup*>(SdrObject::getSdrObjectFromXShape(mXShape))); + const bool bIsDiagram(nullptr != pDiagramCandidate && pDiagramCandidate->isDiagram()); + + if (bIsDiagram) WriteDiagram(pFS, aDML, mXShape, mnDiagramId++); else aDML.WriteShape(mXShape); diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 8e06b9327def..0d2b32fb7a33 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -487,27 +487,9 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) if (rMarkList.GetMarkCount() == 1) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - Reference<css::drawing::XShape> xShape(pObj->getUnoShape(), UNO_QUERY); - static bool bAdvancedSmartArt(nullptr != getenv("SAL_ENABLE_ADVANCED_SMART_ART")); - - if (!bAdvancedSmartArt && oox::drawingml::DrawingML::IsDiagram(xShape)) - { - mpDrawView->UnmarkAll(); - - css::uno::Reference<css::uno::XComponentContext> xContext - = comphelper::getProcessComponentContext(); - rtl::Reference<oox::shape::ShapeFilterBase> xFilter( - new oox::shape::ShapeFilterBase(xContext)); - xFilter->setTargetDocument(GetDocSh()->GetModel()); - xFilter->importTheme(); - oox::drawingml::reloadDiagram(pObj, *xFilter); - - mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView()); - } - // Support advanced DiagramHelper SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj); - if(bAdvancedSmartArt && pAnchorObj && pAnchorObj->isDiagram()) + if(pAnchorObj && pAnchorObj->isDiagram()) { mpDrawView->UnmarkAll(); pAnchorObj->getDiagramHelper()->reLayout(); @@ -525,13 +507,15 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) if (rMarkList.GetMarkCount() == 1) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - Reference<css::drawing::XShape> xShape(pObj->getUnoShape(), UNO_QUERY); + // Support advanced DiagramHelper + SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj); - if (oox::drawingml::DrawingML::IsDiagram(xShape)) + if(pAnchorObj && pAnchorObj->isDiagram()) { VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> pDlg - = pFact->CreateDiagramDialog(GetFrameWeld(), pObj->GetDiagramData()); + ScopedVclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog( + GetFrameWeld(), + pAnchorObj->getDiagramHelper()); pDlg->Execute(); } } |