editeng/source/outliner/outlvw.cxx | 39 ++++++++++++++++++++++++++++++++ include/editeng/outliner.hxx | 1 sd/source/ui/func/futext.cxx | 1 sd/source/ui/view/drtxtob.cxx | 44 +++++++++++++++++++++++++++++++++++++ sd/source/ui/view/drtxtob1.cxx | 3 ++ sd/source/ui/view/drviews2.cxx | 3 ++ sd/source/ui/view/drviewsf.cxx | 11 +++++++-- 7 files changed, 100 insertions(+), 2 deletions(-)
New commits: commit cdc8d974973a041a3f845c3fdc3eb3152982d17a Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Tue Jan 14 14:20:33 2025 +0100 Commit: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> CommitDate: Thu Jan 23 14:34:01 2025 +0100 tdf#105083 Support status of numbering and bullet list Shows the status of bullet/numbering in the current text selection in the toolbar buttons ToggleUnorder/OrderedList. Change-Id: I458896293c502da8142ad9cb43b5ea62a9f3b558 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180259 Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Tested-by: allotropia jenkins <jenk...@allotropia.de> diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index f3f780d3524d..6c1f56222f4a 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -926,6 +926,45 @@ void OutlinerView::ToggleBullets() pOwner->UndoActionEnd(); } +bool OutlinerView::IsBulletOrNumbering(bool& bBullets, bool& bNumbering) +{ + //TODO: returns true if the same list is active in the selection, + // sets bBullets/bNumbering if the related list type is found + bool bBulletFound = false; + bool bNumberingFound = false; + + ESelection aSel( pEditView->GetSelection() ); + aSel.Adjust(); + for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; nPara++) + { + Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + DBG_ASSERT(pPara, "OutlinerView::IsBulletOrNumbering(), illegal selection?"); + + if( pPara ) + { + if (pOwner->GetDepth(nPara) < 0) + return false; + const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); + if (pFmt) + { + sal_Int16 nNumType = pFmt->GetNumberingType(); + if (nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL) + bNumberingFound = true; + else + bBulletFound = true; + } + } + } + if (bNumberingFound) + { + if (bBulletFound) + return false; + bNumbering = true; + } + else + bBullets = true; + return true; +} void OutlinerView::ToggleBulletsNumbering( const bool bToggle, diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 5f326c801ad5..1cf870871d95 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -316,6 +316,7 @@ public: or disables bullets/numbering for the selected paragraphs if the bullets/numbering of the first paragraph is on */ void ToggleBullets(); + bool IsBulletOrNumbering(bool& bBullets, bool& bNumbering); void ToggleBulletsNumbering( const bool bToggle, diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 799dc51c42aa..cbb011b5b2fa 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -126,6 +126,7 @@ const sal_uInt16 SidArray[] = { SID_PARASPACE_INCREASE, // 11145 SID_PARASPACE_DECREASE, // 11146 FN_NUM_BULLET_ON, // 20138 + FN_NUM_NUMBERING_ON, // 20144 // 0 }; diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 3e800881960b..92c0d8a62b52 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -53,6 +53,7 @@ #include <sfx2/objface.hxx> #include <drawdoc.hxx> +#include <drawview.hxx> #include <DrawDocShell.hxx> #include <DrawViewShell.hxx> #include <OutlineViewShell.hxx> @@ -444,6 +445,49 @@ void TextObjectBar::GetAttrStateImpl(ViewShell* mpViewShell, ::sd::View* mpView, } break; + case FN_NUM_BULLET_ON: + case FN_NUM_NUMBERING_ON: + { + bool bEnable = false; + const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell); + if (pDrawViewShell) + { + SdrView* pDrawView = pDrawViewShell->GetDrawView(); + //TODO: is pDrawView always available? + const SdrMarkList& rMarkList = pDrawView->GetMarkedObjectList(); + const size_t nMarkCount = rMarkList.GetMarkCount(); + for (size_t nIndex = 0; nIndex < nMarkCount; ++nIndex) + { + SdrTextObj* pTextObj = DynCastSdrTextObj(rMarkList.GetMark(nIndex)->GetMarkedSdrObj()); + if (pTextObj && pTextObj->GetObjInventor() == SdrInventor::Default) + { + if (pTextObj->GetObjIdentifier() != SdrObjKind::OLE2) + { + bEnable = true; + break; + } + } + } + if (bEnable) + { + bool bIsBullet = false; + bool bIsNumbering = false; + OutlinerView* pOlView = pDrawView->GetTextEditOutlinerView(); + if (pOlView) + { + pOlView->IsBulletOrNumbering(bIsBullet, bIsNumbering); + } + rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, bIsBullet)); + rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, bIsNumbering)); + } + else + { + rSet.DisableItem(FN_NUM_BULLET_ON); + rSet.DisableItem(FN_NUM_NUMBERING_ON); + } + } + } + break; default: break; } diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index e88f4c3d974e..9a4b05573062 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -464,6 +464,9 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, ::sd::View* mpView, SfxR } } } + SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings(); + rBindings.Invalidate( FN_NUM_BULLET_ON ); + rBindings.Invalidate( FN_NUM_NUMBERING_ON ); } break; } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 80c9aaae8b2b..28a656daa7ba 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1537,6 +1537,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { SetCurrentFunction( FuBulletAndPosition::Create( this, GetActiveWindow(), mpDrawView.get(), GetDoc(), rReq ) ); Cancel(); + SfxBindings& rBindings = GetViewFrame()->GetBindings(); + rBindings.Invalidate( FN_NUM_BULLET_ON ); + rBindings.Invalidate( FN_NUM_NUMBERING_ON ); } break; diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 89c30c3990fc..ee44f015245f 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -701,8 +701,15 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) } if (bEnable) { - rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, false)); - rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, false)); + bool bIsBullet = false; + bool bIsNumbering = false; + OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView(); + if (pOlView) + { + pOlView->IsBulletOrNumbering(bIsBullet, bIsNumbering); + } + rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, bIsBullet)); + rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, bIsNumbering)); } else {