[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 17 07:36:34 UTC 2021


 sw/source/uibase/shells/drawdlg.cxx  |    9 ++++++---
 sw/source/uibase/shells/drwbassh.cxx |    2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit c64f221fc2e22ffa60c4d78240893f7f04531b3e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 16 15:32:07 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 17 09:36:02 2021 +0200

    tdf#143778 these async callbacks expect to have SdrModel::IsChanged of false
    
    when they are entered. They are adapted from the original non-async
    SwDrawShell::ExecDrawDlg where the start of SwDrawShell::ExecDrawDlg has...
    
    bool bChanged = pDoc->IsChanged();
    pDoc->SetChanged(false);
    
    and the end has
    
    if (pDoc->IsChanged())
        GetShell().SetModified();
    else
        if (bChanged)
            pDoc->SetChanged();
    
    and before async dialogs the start and end happened before and after the
    dialog appeared and disappeared. The intent seems to be unset the
    sdrmodel-changed and restore its original state if the dialogs caused
    nothing to happen and to explicitly set SetModified on the document if
    something did.
    
    Now the async dialogs callback happens after SwDrawShell::ExecDrawDlg
    has ended and so the callbacks start with SdrModel::IsChanged at its
    original value (restored by the end of ExecDrawDlg), not the "false"
    they were originally written to expect.
    
    For simplicity set the SdrModel IsChanged to false at the start of the
    callbacks and continue to restore to the passed in bChanged state
    if there was no changes by the callback.
    
    Change-Id: I671b35acab6d1b391fa7e6590c09f8be135449b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120548
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index 9922e9d79fa8..c3ab179a1bf2 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -115,6 +115,8 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
 
             pDlg->StartExecuteAsync([bChanged, bHasMarked, pDoc, pDlg, pSh, pView, this](
                                         sal_Int32 nResult){
+                pDoc->SetChanged(false);
+
                 if (nResult == RET_OK)
                 {
                     pSh->StartAction();
@@ -168,6 +170,8 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
 
             pDlg->StartExecuteAsync([bChanged, bHasMarked, pDoc, pDlg, pSh, pView, this](
                                         sal_Int32 nResult){
+                pDoc->SetChanged(false);
+
                 if (nResult == RET_OK)
                 {
                     pSh->StartAction();
@@ -210,9 +214,8 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
 
     if (pDoc->IsChanged())
         GetShell().SetModified();
-    else
-        if (bChanged)
-            pDoc->SetChanged();
+    else if (bChanged)
+        pDoc->SetChanged();
 }
 
 namespace
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index 14c07162d711..f6e077520719 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -244,6 +244,8 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
                         pDlg->StartExecuteAsync([bCaption, bChanged, pDlg, pFrameFormat, pSdrView,
                                                  pSh, &rMarkList, this](
                                                     sal_Int32 nResult){
+                            pSdrView->GetModel()->SetChanged(false);
+
                             if (nResult == RET_OK)
                             {
                                 SwFormatVertOrient aVOrientFinal(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));


More information about the Libreoffice-commits mailing list