From 5337205fdc3917760008dac77f1d0f5c4d55fef7 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Tue, 14 Jan 2025 14:20:33 +0100 Subject: 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/+/180238 Tested-by: Jenkins Reviewed-by: Gabor Kelemen Tested-by: Gabor Kelemen --- editeng/source/outliner/outlvw.cxx | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'editeng/source/outliner') diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 62fa083b0321..80b15c89b225 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, -- cgit