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>
This commit is contained in:
Armin Le Grand (Allotropia)
2022-03-02 17:29:38 +01:00
committed by Armin Le Grand
parent 5af30f3c37
commit cfb68712a4
11 changed files with 186 additions and 65 deletions
+2
View File
@@ -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 (!)
+2
View File
@@ -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; ]
+10
View File
@@ -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 )
{
+37
View File
@@ -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();
-2
View File
@@ -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: */
-34
View File
@@ -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
[
+17 -25
View File
@@ -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();
}
}
}
+12 -4
View File
@@ -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 ||
+35
View File
@@ -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
[
+14
View File
@@ -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 ;
+57
View File
@@ -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();
}