editeng/source/outliner/outlvw.cxx |   29 +++++++++++++++++++++++++++++
 include/editeng/outliner.hxx       |    5 +++++
 sd/source/ui/func/fuolbull.cxx     |   13 +++++++++++++
 3 files changed, 47 insertions(+)

New commits:
commit d181d828d9a3490cefc3a9b41fbda2d5b07b08c3
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Thu Dec 16 08:51:55 2021 +0200
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Tue Dec 21 09:54:57 2021 +0100

    tdf#133713 sd: bullets and numbering should enable it
    
    This fixes a LO 6.3 regression caused by re-working
    the numbering dialog (switching from FuOutlineBullet
    to the new FuBulletAndPosition).
    
    When running uno:OutlineBullet, one expects to have
    numbering applied to the selection. However, that part
    was completely omitted from the new implementation.
    I can't imagine why, since most everything else in the
    nearby code was just a copy/paste from the old methods.
    
    This patch restores some of the logic from the old function.
    [Deleted in commit 5ff162bede44b77cb19e5ff6571b6e34f228d9fb
    Author: Gül?ah Köse on Mon May 27 23:49:41 2019 +0300
        tdf#120905 Remove old FuOutlineBullet dialog code.]
    
    Partially revert loplugin:unusedmethods to recover EnableBullets()
    from commit cae829e9c1394851fc88829d5197460929c2792a
    
    This fixes Format -> Bullets and Numbering,
    right-click pop-up Bullets and Numbering,
    and sidebar's Toggle * List's "More Numbering".
    
    Change-Id: Iee3b66bd715e92167c9423242627a996191dcb72
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126904
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit 12832284318125b8649f6a67e3aa12aa953afdfb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127176
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index e607698d5efe..bf11c742dfea 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -930,6 +930,35 @@ void OutlinerView::ToggleBulletsNumbering(
     }
 }
 
+void OutlinerView::EnsureNumberingIsOn()
+{
+    pOwner->UndoActionStart(OLUNDO_DEPTH);
+
+    ESelection aSel(pEditView->GetSelection());
+    aSel.Adjust();
+
+    const bool bUpdate = pOwner->pEditEngine->IsUpdateLayout();
+    pOwner->pEditEngine->SetUpdateLayout(false);
+
+    for (sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++)
+    {
+        Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
+        DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
+
+        if (pPara && pOwner->GetDepth(nPara) == -1)
+            pOwner->SetDepth(pPara, 0);
+    }
+
+    sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount();
+    pOwner->ImplCheckParagraphs(aSel.nStartPara, nParaCount);
+
+    const sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
+    pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.nStartPara, 0, 
nEndPara, 0));
+
+    pOwner->pEditEngine->SetUpdateLayout(bUpdate);
+
+    pOwner->UndoActionEnd();
+}
 
 void OutlinerView::ApplyBulletsNumbering(
     const bool bHandleBullets,
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index f34028496941..87fabb4ee45e 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -345,6 +345,11 @@ public:
     void SwitchOffBulletsNumbering(
         const bool bAtSelection = false );
 
+    /** enables numbering for the selected paragraphs that are not enabled and 
ignore all selected
+        paragraphs that already have numbering enabled.
+    */
+    void        EnsureNumberingIsOn();
+
     bool        IsCursorAtWrongSpelledWord();
     bool        IsWrongSpelledWordAtPos( const Point& rPosPixel );
     void        ExecuteSpellPopup(const Point& rPosPixel, const 
Link<SpellCallbackInfo&,void>& rCallBack);
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 6c6b9aef5b0f..054a44e9b8a3 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -91,6 +91,19 @@ void FuBulletAndPosition::DoExecute( SfxRequest& rReq )
 
     if( nResult == RET_OK )
     {
+        OutlinerView* pOLV = pView->GetTextEditOutlinerView();
+
+        std::unique_ptr<OutlineViewModelChangeGuard, 
o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard;
+
+        if (OutlineView* pOutlineView = dynamic_cast<OutlineView*>(pView))
+        {
+            pOLV = 
pOutlineView->GetViewByWindow(mpViewShell->GetActiveWindow());
+            aGuard.reset(new OutlineViewModelChangeGuard(*pOutlineView));
+        }
+
+        if( pOLV )
+            pOLV->EnsureNumberingIsOn();
+
         const SfxItemSet pOutputSet( *pDlg->GetOutputItemSet( &aNewAttr ) );
         pView->SetAttributes(pOutputSet, /*bReplaceAll=*/false, /*bSlide*/ 
pDlg->IsSlideScope(), /*bMaster=*/pDlg->IsApplyToMaster());
     }

Reply via email to