[PATCH] Change in core[libreoffice-4-0]: Resolves: fdo#58998 insert section applied twice

Caolán McNamara (via_Code_Review) gerrit at gerrit.libreoffice.org
Wed Jan 16 15:43:44 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1729

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/29/1729/1

Resolves: fdo#58998 insert section applied twice

regression since 0157f0b1ba364f7f9af2aacd1be9fbb5ddec2b4d

my belief was that OK_Impl was only called in one
place, in sw/source/ui/fmtui/tmpdlg.cxx, so I
merged the use there into OK_Impl, but of course
there was another use in sfx2/source/dialog/tabdlg.cxx

Given that OK_Impl only called PrepareLeaveCurrentPage originally...

a) replace OK_Impl in sfx2/source/dialog/tabdlg.cxx
with PrepareLeaveCurrentPage, a no-op from the original state.
b) add an Apply method that does what I want, i.e.
call ok without closing the dialog, so we can retain
the fix of fdo#38606 to have "apply" immediately
apply the effect of pressing "ok" without closing
and reopening the dialog

Change-Id: I57e2e41c07ab9bf89ada98d1b9c3336db3493f19
(cherry picked from commit 8fd85527981e3a6a915192aaea6f1595ea9f037c)
---
M sfx2/inc/sfx2/tabdlg.hxx
M sfx2/source/dialog/tabdlg.cxx
M sw/source/ui/dialog/swdlgfact.cxx
3 files changed, 13 insertions(+), 9 deletions(-)



diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx
index 164dae3..594731f 100644
--- a/sfx2/inc/sfx2/tabdlg.hxx
+++ b/sfx2/inc/sfx2/tabdlg.hxx
@@ -201,13 +201,9 @@
     void                SetApplyHandler(const Link& _rHdl);
 
     SAL_DLLPRIVATE void Start_Impl();
-    bool OK_Impl()
-    {
-        bool bRet = PrepareLeaveCurrentPage();
-        if (bRet)
-            Ok();
-        return bRet;
-    }
+
+    //calls Ok without closing dialog
+    bool Apply();
 };
 
 namespace sfx { class ItemConnectionBase; }
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index eda2375..0015972 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1090,7 +1090,7 @@
 {
     pImpl->bInOK = sal_True;
 
-    if ( OK_Impl() )
+    if (PrepareLeaveCurrentPage())
     {
         if ( pImpl->bModal )
             EndDialog( Ok() );
@@ -1103,6 +1103,14 @@
     return 0;
 }
 
+bool SfxTabDialog::Apply()
+{
+    bool bApplied = false;
+    if (PrepareLeaveCurrentPage())
+         bApplied = (Ok() == RET_OK);
+    return bApplied;
+}
+
 // -----------------------------------------------------------------------
 
 bool SfxTabDialog::PrepareLeaveCurrentPage()
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 70beaa9..9bc0c87 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -159,7 +159,7 @@
 
 IMPL_LINK_NOARG(AbstractApplyTabDialog_Impl, ApplyHdl)
 {
-    if (pDlg->OK_Impl())
+    if (pDlg->Apply())
         m_aHandler.Call(NULL);
     return 0;
 }

-- 
To view, visit https://gerrit.libreoffice.org/1729
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57e2e41c07ab9bf89ada98d1b9c3336db3493f19
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Caolán McNamara <caolanm at redhat.com>



More information about the LibreOffice mailing list