diff options
author | Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com> | 2022-05-23 15:48:41 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-05-25 09:59:17 +0200 |
commit | 8b4b852a35149b1cfffc681cbb4f57d4c0b671b3 (patch) | |
tree | 66dc1121c200bc0baa7caa135cee60cb02a67f80 /sw | |
parent | 2682828f73a6c759735613ec924357424baeae24 (diff) |
Advanced Diagram support: Isolated IDiagramHelper, selection visualization
Moved and isolated IDiagramHelper to own file to get SdrObjGroup smaller
and less dependent again, all places adapted. isDiagram() now available
at SdrObject directly, adapted and have less places which need to cast
for SdrObjGroup for check.
Started to add SdrHdl/selection visualization to seleced Diagram. Only
as a start, will need to be extended to look good/better, plus evtl.
functionality in handles/UI.
Corrected error(s) found by failing UnitTests
More clang-notes (static, namespace) I nneeded to follow
Change-Id: If4675b3270d3ee30259fce49deb017dbbaf5c0c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134825
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwbassh.cxx | 14 |
3 files changed, 9 insertions, 11 deletions
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 898166f0178a..44fbce476a7a 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2456,8 +2456,7 @@ bool SwFEShell::IsGroupSelected(bool bAllowDiagams) if(!bAllowDiagams) { // Don't allow enter Diagrams - auto* pGroup(dynamic_cast<SdrObjGroup*>(pObj)); - if(nullptr != pGroup && pGroup->isDiagram()) + if(pObj->isDiagram()) { return false; } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index db9fd1a873b8..6d179315d456 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6459,8 +6459,7 @@ void DocxAttributeOutput::WriteFlyFrame(const ww8::Frame& rFrame) const SdrObject* pSdrObj = rFrame.GetFrameFormat().FindRealSdrObject(); if ( pSdrObj ) { - const SdrObjGroup* pDiagramCandidate(dynamic_cast<const SdrObjGroup*>(pSdrObj)); - const bool bIsDiagram(nullptr != pDiagramCandidate && pDiagramCandidate->isDiagram()); + const bool bIsDiagram(nullptr != pSdrObj && pSdrObj->isDiagram()); if (bIsDiagram) { diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 77325a28eddb..766ca0ae81bb 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -59,6 +59,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <fmtfollowtextflow.hxx> #include <textboxhelper.hxx> +#include <svx/diagram/IDiagramHelper.hxx> using namespace ::com::sun::star; using namespace css::beans; @@ -446,14 +447,12 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); // Support advanced DiagramHelper - SdrObjGroup* pAnchorObj = dynamic_cast<SdrObjGroup*>(pObj); - - if(pAnchorObj && pAnchorObj->isDiagram()) + if(nullptr != pObj && pObj->isDiagram()) { if(SID_REGENERATE_DIAGRAM == nSlotId) { pSdrView->UnmarkAll(); - pAnchorObj->getDiagramHelper()->reLayout(*pAnchorObj); + pObj->getDiagramHelper()->reLayout(*static_cast<SdrObjGroup*>(pObj)); pSdrView->MarkObj(pObj, pSdrView->GetSdrPageView()); } else // SID_EDIT_DIAGRAM @@ -461,7 +460,7 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); ScopedVclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog( GetView().GetFrameWeld(), - *pAnchorObj); + *static_cast<SdrObjGroup*>(pObj)); pDlg->Execute(); } } @@ -940,8 +939,9 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet) const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); if (nullptr != rMarkList.GetMark(0)) { - SdrObjGroup* pSdrObjGroup = dynamic_cast<SdrObjGroup*>(rMarkList.GetMark(0)->GetMarkedSdrObj()); - if(nullptr != pSdrObjGroup && pSdrObjGroup->isDiagram()) + SdrObject* pObj(rMarkList.GetMark(0)->GetMarkedSdrObj()); + + if(nullptr != pObj && pObj->isDiagram()) { bDisable = false; } |