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 /cui/source | |
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 'cui/source')
-rw-r--r-- | cui/source/dialogs/DiagramDialog.cxx | 18 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 4 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/DiagramDialog.hxx | 6 |
4 files changed, 12 insertions, 18 deletions
diff --git a/cui/source/dialogs/DiagramDialog.cxx b/cui/source/dialogs/DiagramDialog.cxx index eceaaed0c666..9c5816cf4b2b 100644 --- a/cui/source/dialogs/DiagramDialog.cxx +++ b/cui/source/dialogs/DiagramDialog.cxx @@ -10,13 +10,13 @@ #include <DiagramDialog.hxx> #include <comphelper/dispatchcommand.hxx> -#include <svx/DiagramDataInterface.hxx> +#include <svx/svdogrp.hxx> #include <com/sun/star/beans/PropertyValue.hpp> DiagramDialog::DiagramDialog(weld::Window* pWindow, - std::shared_ptr<DiagramDataInterface> pDiagramData) + const std::shared_ptr<IDiagramHelper>& pDiagramHelper) : GenericDialogController(pWindow, "cui/ui/diagramdialog.ui", "DiagramDialog") - , mpDiagramData(pDiagramData) + , mpDiagramHelper(pDiagramHelper) , mpBtnOk(m_xBuilder->weld_button("btnOk")) , mpBtnCancel(m_xBuilder->weld_button("btnCancel")) , mpBtnAdd(m_xBuilder->weld_button("btnAdd")) @@ -40,21 +40,15 @@ DiagramDialog::DiagramDialog(weld::Window* pWindow, IMPL_LINK_NOARG(DiagramDialog, OnAddClick, weld::Button&, void) { OUString sText = mpTextAdd->get_text(); - static bool bAdvancedSmartArt(nullptr != getenv("SAL_ENABLE_ADVANCED_SMART_ART")); if (!sText.isEmpty()) { - OUString sNodeId = mpDiagramData->addNode(sText); + OUString sNodeId = mpDiagramHelper->addNode(sText); std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator()); mpTreeDiagram->insert(nullptr, -1, &sText, &sNodeId, nullptr, nullptr, false, pEntry.get()); mpTreeDiagram->select(*pEntry); comphelper::dispatchCommand(".uno:RegenerateDiagram", {}); } - else if (bAdvancedSmartArt) - { - // For test purposes re-layout without change - comphelper::dispatchCommand(".uno:RegenerateDiagram", {}); - } } IMPL_LINK_NOARG(DiagramDialog, OnRemoveClick, weld::Button&, void) @@ -62,7 +56,7 @@ IMPL_LINK_NOARG(DiagramDialog, OnRemoveClick, weld::Button&, void) std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator()); if (mpTreeDiagram->get_selected(pEntry.get())) { - if (mpDiagramData->removeNode(mpTreeDiagram->get_id(*pEntry))) + if (mpDiagramHelper->removeNode(mpTreeDiagram->get_id(*pEntry))) { mpTreeDiagram->remove(*pEntry); comphelper::dispatchCommand(".uno:RegenerateDiagram", {}); @@ -72,7 +66,7 @@ IMPL_LINK_NOARG(DiagramDialog, OnRemoveClick, weld::Button&, void) void DiagramDialog::populateTree(const weld::TreeIter* pParent, const OUString& rParentId) { - auto aItems = mpDiagramData->getChildren(rParentId); + auto aItems = mpDiagramHelper->getChildren(rParentId); for (auto& aItem : aItems) { std::unique_ptr<weld::TreeIter> pEntry(mpTreeDiagram->make_iterator()); diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 7b0a1971d1fe..c7a8a204e075 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1524,10 +1524,10 @@ AbstractDialogFactory_Impl::CreateToolbarmodeDialog(weld::Window* pParent) } VclPtr<AbstractDiagramDialog> -AbstractDialogFactory_Impl::CreateDiagramDialog(weld::Window* pParent, std::shared_ptr<DiagramDataInterface> pDiagramData) +AbstractDialogFactory_Impl::CreateDiagramDialog(weld::Window* pParent, const std::shared_ptr<IDiagramHelper>& pDiagramHelper) { return VclPtr<AbstractDiagramDialog_Impl>::Create( - std::make_unique<DiagramDialog>(pParent, pDiagramData)); + std::make_unique<DiagramDialog>(pParent, pDiagramHelper)); } #ifdef _WIN32 diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index bc5b22f205e1..3ce135927f14 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -608,7 +608,7 @@ public: virtual VclPtr<AbstractDiagramDialog> CreateDiagramDialog( weld::Window* pParent, - std::shared_ptr<DiagramDataInterface> pDiagramData) override; + const std::shared_ptr<IDiagramHelper>& pDiagramHelper) override; #ifdef _WIN32 virtual VclPtr<VclAbstractDialog> CreateFileExtCheckDialog(weld::Window* pParent, diff --git a/cui/source/inc/DiagramDialog.hxx b/cui/source/inc/DiagramDialog.hxx index adc8328969a8..397aab44f50f 100644 --- a/cui/source/inc/DiagramDialog.hxx +++ b/cui/source/inc/DiagramDialog.hxx @@ -12,17 +12,17 @@ #include <tools/link.hxx> #include <vcl/weld.hxx> -class DiagramDataInterface; +class IDiagramHelper; /** Edit Diagram dialog */ class DiagramDialog : public weld::GenericDialogController { public: - DiagramDialog(weld::Window* pWindow, std::shared_ptr<DiagramDataInterface> pDiagramData); + DiagramDialog(weld::Window* pWindow, const std::shared_ptr<IDiagramHelper>& pDiagramHelper); virtual ~DiagramDialog() override; private: - std::shared_ptr<DiagramDataInterface> mpDiagramData; + const std::shared_ptr<IDiagramHelper> mpDiagramHelper; std::unique_ptr<weld::Button> mpBtnOk; std::unique_ptr<weld::Button> mpBtnCancel; std::unique_ptr<weld::Button> mpBtnAdd; |