tdf#103334 - EDITING: Undo on bullet point style

I have checked the normal model and the editing model after UNDO, and
all seems to be well, this is purely a rendering/lack-of-invalidation
issue.

The extra invalidation I add here is restricted to the UNDO case to
prevent tripping up a LOK unit test
(SdTiledRenderingTest::testCursorViews).

I confess to not having followed the invalidation logic all the way to
see why exactly it makes the bug go away.

Change-Id: I34f7d84526462665b1ec09aba966c98cd4e8795f
Reviewed-on: https://gerrit.libreoffice.org/30225
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index a612872..bde286a 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -741,9 +741,9 @@ void EditEngine::SetUndoMode(bool b)
    pImpEditEngine->SetUndoMode(b);
}

void EditEngine::FormatAndUpdate(EditView* pCurView)
void EditEngine::FormatAndUpdate(EditView* pCurView, bool bCalledFromUndo)
{
    pImpEditEngine->FormatAndUpdate(pCurView);
    pImpEditEngine->FormatAndUpdate(pCurView, bCalledFromUndo);
}

void EditEngine::Undo(EditView* pView)
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 1e09ce6..90ea9ba 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -77,7 +77,7 @@ bool EditUndoManager::Undo()

    aNewSel.Min() = aNewSel.Max();
    mpEditEngine->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel );
    mpEditEngine->FormatAndUpdate( mpEditEngine->GetActiveView() );
    mpEditEngine->FormatAndUpdate( mpEditEngine->GetActiveView(), true );

    return bDone;
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 1771aac..b76fa58 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -859,7 +859,7 @@ public:
    void            SetNotifyHdl( const Link<EENotify&,void>& rLink )     { aNotifyHdl = rLink; }
    const Link<EENotify&,void>&   GetNotifyHdl() const            { return aNotifyHdl; }

    void            FormatAndUpdate( EditView* pCurView = nullptr );
    void            FormatAndUpdate( EditView* pCurView = nullptr, bool bCalledFromUndo = false );
    inline void     IdleFormatAndUpdate( EditView* pCurView );

    svtools::ColorConfig& GetColorConfig();
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 1d62eba..81ef5db 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -4022,7 +4022,7 @@ EditSelection* ImpEditEngine::SelectParagraph( sal_Int32 nPara )
    return pSel;
}

void ImpEditEngine::FormatAndUpdate( EditView* pCurView )
void ImpEditEngine::FormatAndUpdate( EditView* pCurView, bool bCalledFromUndo )
{
    if ( bDowning )
        return ;
@@ -4031,6 +4031,10 @@ void ImpEditEngine::FormatAndUpdate( EditView* pCurView )
        IdleFormatAndUpdate( pCurView );
    else
    {
        if (bCalledFromUndo)
            // in order to make bullet points that have had their styles changed, redraw themselves
            for ( sal_Int32 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
                GetParaPortions()[nPortion]->MarkInvalid( 0, 0 );
        FormatDoc();
        UpdateViews( pCurView );
    }
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 873b344..d8be7c6 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -600,7 +600,7 @@ public:
    const ViewsType& GetEditViews() const;

    void SetUndoMode(bool b);
    void FormatAndUpdate(EditView* pCurView);
    void FormatAndUpdate(EditView* pCurView, bool bCalledFromUndo = false);

    void Undo(EditView* pView);
    void Redo(EditView* pView);
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index bd60739..af5ddf9 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -226,7 +226,8 @@ void Window::KeyInput(const KeyEvent& rKEvt)
    {
        mpViewShell->GetDoc()->dumpAsXml(nullptr);
        OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView();
        pOLV->GetEditView().GetEditEngine()->dumpAsXmlEditDoc(nullptr);
        if (pOLV)
            pOLV->GetEditView().GetEditEngine()->dumpAsXmlEditDoc(nullptr);
        return;
    }