include/svx/svxids.hrc | 2 + sc/sdi/drawsh.sdi | 2 + sc/source/ui/drawfunc/drawsh2.cxx | 10 ++++++ sc/source/ui/drawfunc/drawsh5.cxx | 37 ++++++++++++++++++++++ sd/inc/app.hrc | 2 - sd/sdi/sdraw.sdi | 34 -------------------- sd/source/ui/view/drviews3.cxx | 42 ++++++++++--------------- sd/source/ui/view/drviewsj.cxx | 16 +++++++-- svx/sdi/svx.sdi | 35 +++++++++++++++++++++ sw/sdi/_drwbase.sdi | 14 ++++++++ sw/source/uibase/shells/drwbassh.cxx | 57 +++++++++++++++++++++++++++++++++++ 11 files changed, 186 insertions(+), 65 deletions(-)
New commits: commit cfb68712a4916448b4edbf57b6037eda53932b18 Author: Armin Le Grand (Allotropia) <armin.le.gr...@me.com> AuthorDate: Wed Mar 2 11:52:14 2022 +0100 Commit: Armin Le Grand <armin.le.gr...@me.com> CommitDate: Wed Mar 2 17:29:38 2022 +0100 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.gr...@me.com> diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 8d6e7dc08e10..af1eddb8c226 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -375,6 +375,8 @@ class XFillGradientItem; #define SID_SPELLCHECK_IGNORE ( SID_SVX_START + 246 ) #define SID_SPELLCHECK_IGNORE_ALL ( SID_SVX_START + 247 ) #define SID_SPELLCHECK_APPLY_SUGGESTION ( SID_SVX_START + 248 ) +#define SID_REGENERATE_DIAGRAM ( SID_SVX_START + 249 ) +#define SID_EDIT_DIAGRAM ( SID_SVX_START + 450 ) // CAUTION! Range <250 .. 250> used by EditEngine (!) diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi index 2688d51101e9..ccd5d69605d4 100644 --- a/sc/sdi/drawsh.sdi +++ b/sc/sdi/drawsh.sdi @@ -144,6 +144,8 @@ interface TableDraw SID_UNGROUP [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; ] SID_ENTER_GROUP [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; ] SID_LEAVE_GROUP [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; ] + SID_REGENERATE_DIAGRAM [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState ] + SID_EDIT_DIAGRAM [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState ] // !!! special SID_DELETE [ExecMethod = ExecDrawFunc ;StateMethod = GetDrawFuncState; ] 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(); diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 16780524b23d..97d43b1d1c06 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -458,7 +458,5 @@ #define SID_HIDE_LAST_LEVEL (SID_SD_START+448) #define SID_SHOW_NEXT_LEVEL (SID_SD_START+449) #define SID_PRESENTATION_MINIMIZER (SID_SD_START+450) -#define SID_REGENERATE_DIAGRAM (SID_SD_START+451) -#define SID_EDIT_DIAGRAM (SID_SD_START+452) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi index 4db38965efe0..09124f3f4a81 100644 --- a/sd/sdi/sdraw.sdi +++ b/sd/sdi/sdraw.sdi @@ -4617,40 +4617,6 @@ SfxVoidItem MovePageLast SID_MOVE_PAGE_LAST GroupId = SfxGroupId::Modify; ] -SfxVoidItem RegenerateDiagram SID_REGENERATE_DIAGRAM -() -[ - AutoUpdate = FALSE, - FastCall = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - - AccelConfig = TRUE, - MenuConfig = TRUE, - ToolBoxConfig = TRUE, - GroupId = SfxGroupId::Modify; -] - -SfxVoidItem EditDiagram SID_EDIT_DIAGRAM -() -[ - AutoUpdate = FALSE, - FastCall = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - - AccelConfig = TRUE, - MenuConfig = TRUE, - ToolBoxConfig = TRUE, - GroupId = SfxGroupId::Modify; -] - SfxBoolItem UnderlineNone SID_ULINE_VAL_NONE [ diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 0d2b32fb7a33..2220bcebc858 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -482,41 +482,33 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) break; case SID_REGENERATE_DIAGRAM: - { - const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); - if (rMarkList.GetMarkCount() == 1) - { - SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - // Support advanced DiagramHelper - SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj); - if(pAnchorObj && pAnchorObj->isDiagram()) - { - mpDrawView->UnmarkAll(); - pAnchorObj->getDiagramHelper()->reLayout(); - mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView()); - } - } - - rReq.Done(); - } - break; - case SID_EDIT_DIAGRAM: { const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); - if (rMarkList.GetMarkCount() == 1) + + if (1 == rMarkList.GetMarkCount()) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + // Support advanced DiagramHelper SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj); if(pAnchorObj && pAnchorObj->isDiagram()) { - VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog( - GetFrameWeld(), - pAnchorObj->getDiagramHelper()); - pDlg->Execute(); + if(SID_REGENERATE_DIAGRAM == nSlot) + { + mpDrawView->UnmarkAll(); + pAnchorObj->getDiagramHelper()->reLayout(); + mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView()); + } + else // SID_EDIT_DIAGRAM + { + VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); + ScopedVclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog( + GetFrameWeld(), + pAnchorObj->getDiagramHelper()); + pDlg->Execute(); + } } } diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx index 40dd8dca8214..c034b98acb66 100644 --- a/sd/source/ui/view/drviewsj.cxx +++ b/sd/source/ui/view/drviewsj.cxx @@ -132,25 +132,33 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) /* If it is not a group object or 3D object, we disable "enter group". */ - const auto* pIsGroup(dynamic_cast<const SdrObjGroup*>(pObj)); - if( !( ( pIsGroup != nullptr && nInv == SdrInventor::Default ) || + const auto* pSdrObjGroup = dynamic_cast<const SdrObjGroup*>(pObj); + + if( !( ( pSdrObjGroup != nullptr && nInv == SdrInventor::Default ) || ( dynamic_cast< const E3dScene* >(pObj) != nullptr ) ) ) { rSet.DisableItem( SID_ENTER_GROUP ); } // Don't allow enter Diagrams - if(nullptr != pIsGroup && pIsGroup->isDiagram()) + if(nullptr != pSdrObjGroup && pSdrObjGroup->isDiagram()) { rSet.DisableItem( SID_ENTER_GROUP ); } // If it is not a group object, we disable "ungroup" - if(dynamic_cast< const SdrObjGroup *>( pObj ) == nullptr || nInv != SdrInventor::Default) + if(pSdrObjGroup == nullptr || nInv != SdrInventor::Default) { rSet.DisableItem(SID_UNGROUP); } + // Support advanced DiagramHelper + if(!pSdrObjGroup || !pSdrObjGroup->isDiagram()) + { + rSet.DisableItem( SID_REGENERATE_DIAGRAM ); + rSet.DisableItem( SID_EDIT_DIAGRAM ); + } + if( nInv == SdrInventor::Default && (nId == SdrObjKind::Line || nId == SdrObjKind::PolyLine || diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 2ea903df9edf..e57e3e5f5938 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -2595,6 +2595,41 @@ SfxVoidItem EnterGroup SID_ENTER_GROUP ] +SfxVoidItem RegenerateDiagram SID_REGENERATE_DIAGRAM +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Modify; +] + +SfxVoidItem EditDiagram SID_EDIT_DIAGRAM +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Modify; +] + + SvxEscapementItem Escapement SID_ATTR_CHAR_ESCAPEMENT [ diff --git a/sw/sdi/_drwbase.sdi b/sw/sdi/_drwbase.sdi index 6c700380ed10..4981490ec22b 100644 --- a/sw/sdi/_drwbase.sdi +++ b/sw/sdi/_drwbase.sdi @@ -60,6 +60,20 @@ interface BaseTextDrawBase StateMethod = GetState ; ] + SID_REGENERATE_DIAGRAM + [ + AutoUpdate = TRUE , + ExecMethod = Execute ; + StateMethod = GetState ; + ] + + SID_EDIT_DIAGRAM + [ + AutoUpdate = TRUE , + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_FRAME_TO_TOP [ ExecMethod = Execute ; diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 5beca065b30e..0665ca4a0c3f 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -48,6 +48,7 @@ #include <sfx2/msg.hxx> #include <swslots.hxx> #include <svx/svxdlg.hxx> +#include <svx/svdogrp.hxx> #include <vcl/unohelp2.hxx> #include <swabstdlg.hxx> #include <swundo.hxx> @@ -443,6 +444,39 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) } break; + case SID_REGENERATE_DIAGRAM: + case SID_EDIT_DIAGRAM: + { + const SdrMarkList& rMarkList = pSdrView->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) + { + pSdrView->UnmarkAll(); + pAnchorObj->getDiagramHelper()->reLayout(); + pSdrView->MarkObj(pObj, pSdrView->GetSdrPageView()); + } + else // SID_EDIT_DIAGRAM + { + VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); + ScopedVclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog( + GetView().GetFrameWeld(), + pAnchorObj->getDiagramHelper()); + pDlg->Execute(); + } + } + } + } + break; + case SID_OBJECT_ALIGN_LEFT: case SID_OBJECT_ALIGN_CENTER: case SID_OBJECT_ALIGN_RIGHT: @@ -906,6 +940,29 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet) } } break; + + case SID_REGENERATE_DIAGRAM: + case SID_EDIT_DIAGRAM: + { + bool bDisable(true); + const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); + if (nullptr != rMarkList.GetMark(0)) + { + SdrObjGroup* pSdrObjGroup = dynamic_cast<SdrObjGroup*>(rMarkList.GetMark(0)->GetMarkedSdrObj()); + if(nullptr != pSdrObjGroup && pSdrObjGroup->isDiagram()) + { + bDisable = false; + } + } + + if(bDisable) + { + rSet.DisableItem(nWhich); + } + } + break; + + } nWhich = aIter.NextWhich(); }