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/source/ui | |
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/source/ui')
-rw-r--r-- | sd/source/ui/view/drviews3.cxx | 30 |
1 files changed, 7 insertions, 23 deletions
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(); } } |