summaryrefslogtreecommitdiff
path: root/sc/source/ui/drawfunc
diff options
context:
space:
mode:
authorArmin Le Grand (Allotropia) <Armin.Le.Grand@me.com>2022-03-02 11:52:14 +0100
committerArmin Le Grand <Armin.Le.Grand@me.com>2022-03-02 17:29:38 +0100
commitcfb68712a4916448b4edbf57b6037eda53932b18 (patch)
treea428b69b21a0f040a810a44d05efd25f631b8ede /sc/source/ui/drawfunc
parent5af30f3c37f5560cc685482e0be29127dda34b4e (diff)
Advanced Diagram support: Extend UI to all applications
As a preparation make the currently available minimal UI to interact with Diagrams available to all LO apps Change-Id: Idd0a4c187a295cd264ebd09be2b574a3d2a93e44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130837 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'sc/source/ui/drawfunc')
-rw-r--r--sc/source/ui/drawfunc/drawsh2.cxx10
-rw-r--r--sc/source/ui/drawfunc/drawsh5.cxx37
2 files changed, 47 insertions, 0 deletions
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index be66c6625401..c4eb11484aa5 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -28,6 +28,7 @@
#include <sfx2/viewfrm.hxx>
#include <svl/ptitem.hxx>
#include <svx/svdobj.hxx>
+#include <svx/svdogrp.hxx>
#include <svx/svdouno.hxx>
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
@@ -267,6 +268,15 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // disable functions
if (pView->GetAnchorType() != SCA_CELL &&
pView->GetAnchorType() != SCA_CELL_RESIZE)
rSet.DisableItem( SID_FITCELLSIZE );
+
+ // Support advanced DiagramHelper
+ SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj);
+
+ if(!pAnchorObj || !pAnchorObj->isDiagram())
+ {
+ rSet.DisableItem( SID_REGENERATE_DIAGRAM );
+ rSet.DisableItem( SID_EDIT_DIAGRAM );
+ }
}
if ( !bCanRename )
{
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index 82559462c040..32e7009b6470 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -30,6 +30,7 @@
#include <svx/svdouno.hxx>
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
+#include <svx/svdogrp.hxx>
#include <sfx2/docfile.hxx>
#include <osl/diagnose.h>
@@ -271,6 +272,42 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
pView->LeaveOneGroup();
break;
+ case SID_REGENERATE_DIAGRAM:
+ case SID_EDIT_DIAGRAM:
+ {
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+
+ if (1 == rMarkList.GetMarkCount())
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ // Support advanced DiagramHelper
+ SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj);
+
+ if(pAnchorObj && pAnchorObj->isDiagram())
+ {
+ if(SID_REGENERATE_DIAGRAM == nSlotId)
+ {
+ pView->UnmarkAll();
+ pAnchorObj->getDiagramHelper()->reLayout();
+ pView->MarkObj(pObj, pView->GetSdrPageView());
+ }
+ else // SID_EDIT_DIAGRAM
+ {
+ VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
+ vcl::Window* pWin = rViewData.GetActiveWin();
+ ScopedVclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog(
+ pWin ? pWin->GetFrameWeld() : nullptr,
+ pAnchorObj->getDiagramHelper());
+ pDlg->Execute();
+ }
+ }
+ }
+
+ rReq.Done();
+ }
+ break;
+
case SID_MIRROR_HORIZONTAL:
case SID_FLIP_HORIZONTAL:
pView->MirrorAllMarkedHorizontal();