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

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 19 20:45:16 UTC 2019


 sw/source/ui/dbui/mmresultdialogs.cxx |   67 ++++++++++++----------------------
 1 file changed, 24 insertions(+), 43 deletions(-)

New commits:
commit 546e6c359e96a2e7f5aab7c158c7e843be6c8957
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Oct 18 12:45:07 2019 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Sat Oct 19 22:44:37 2019 +0200

    MM dialogs: Simplify code for from/to range a little bit
    
    Change-Id: I8a845e24d0ce5aec6b2edc70fef42c39109ab6a3
    Reviewed-on: https://gerrit.libreoffice.org/81092
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index 9644ed99c538..4bb4b971d5a9 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -566,22 +566,18 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void)
     }
     else
     {
+        const sal_uInt32 nDocumentCount = xConfigItem->GetMergedDocumentCount();
         sal_uInt32 nBegin = 0;
-        sal_uInt32 nEnd = 0;
-        sal_uInt32 documentCount = xConfigItem->GetMergedDocumentCount();
+        sal_uInt32 nEnd = nDocumentCount;
 
-        if (m_xSaveIndividualRB->get_active())
-        {
-            nBegin = 0;
-            nEnd = documentCount;
-        }
-        else
+        if (!m_xSaveIndividualRB->get_active())
         {
             nBegin  = static_cast< sal_Int32 >(m_xFromNF->get_value() - 1);
             nEnd    = static_cast< sal_Int32 >(m_xToNF->get_value());
-            if(nEnd > documentCount)
-                nEnd = documentCount;
+            if(nEnd > nDocumentCount)
+                nEnd = nDocumentCount;
         }
+
         OUString sTargetTempURL = URIHelper::SmartRel2Abs(
             INetURLObject(), utl::TempFile::CreateTempName(),
             URIHelper::GetMaybeFileHdl());
@@ -756,21 +752,16 @@ IMPL_LINK_NOARG(SwMMResultPrintDialog, PrintHdl_Impl, weld::Button&, void)
     SwView* pTargetView = xConfigItem->GetTargetView();
     assert(pTargetView);
 
+    const sal_uInt32 nDocumentCount = xConfigItem->GetMergedDocumentCount();
     sal_uInt32 nBegin = 0;
-    sal_uInt32 nEnd = 0;
-    sal_uInt32 documentCount = xConfigItem->GetMergedDocumentCount();
+    sal_uInt32 nEnd = nDocumentCount;
 
-    if (m_xPrintAllRB->get_active())
-    {
-        nBegin = 0;
-        nEnd = documentCount;
-    }
-    else
+    if (!m_xPrintAllRB->get_active())
     {
         nBegin  = m_xFromNF->get_value() - 1;
         nEnd    = m_xToNF->get_value();
-        if(nEnd > documentCount)
-            nEnd = documentCount;
+        if(nEnd > nDocumentCount)
+            nEnd = nDocumentCount;
     }
 
     // If we skip autoinserted blanks, then the page numbers used in the print range string
@@ -885,19 +876,15 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi
         lcl_UpdateEmailSettingsFromGlobalConfig(*xConfigItem);
     }
     //add the documents
+    const sal_uInt32 nDocumentCount = xConfigItem->GetMergedDocumentCount();
     sal_uInt32 nBegin = 0;
-    sal_uInt32 nEnd = 0;
-    if (m_xSendAllRB->get_active())
-    {
-        nBegin = 0;
-        nEnd = xConfigItem->GetMergedDocumentCount();
-    }
-    else
+    sal_uInt32 nEnd = nDocumentCount;
+    if (!m_xSendAllRB->get_active())
     {
         nBegin  = static_cast< sal_Int32 >(m_xFromNF->get_value() - 1);
         nEnd    = static_cast< sal_Int32 >(m_xToNF->get_value());
-        if(nEnd > xConfigItem->GetMergedDocumentCount())
-            nEnd = xConfigItem->GetMergedDocumentCount();
+        if(nEnd > nDocumentCount)
+            nEnd = nDocumentCount;
     }
     bool bAsBody = false;
     rtl_TextEncoding eEncoding = ::osl_getThreadTextEncoding();
commit ff8e01b58c4d1a667c4db2163dcffade3de9fa7c
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Oct 18 12:33:34 2019 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Sat Oct 19 22:44:26 2019 +0200

    SwMMResultSaveDialog: Move some common code one level up
    
    The dialog is called in any case.
    
    Change-Id: I2cb14f227ad1e7417e2f44e4f0e357cb29d82fdc
    Reviewed-on: https://gerrit.libreoffice.org/81091
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index 6920fee3fe1c..9644ed99c538 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -529,15 +529,16 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void)
     SwView* pTargetView = xConfigItem->GetTargetView();
     assert(pTargetView);
 
+    OUString sFilter;
+    OUString sPath = SwMailMergeHelper::CallSaveAsDialog(m_xDialog.get(), sFilter);
+    if (sPath.isEmpty())
+    {
+        // just return back to the dialog
+        return;
+    }
+
     if (m_xSaveAsOneRB->get_active())
     {
-        OUString sFilter;
-        const OUString sPath = SwMailMergeHelper::CallSaveAsDialog(m_xDialog.get(), sFilter);
-        if (sPath.isEmpty())
-        {
-            // just return back to the dialog
-            return;
-        }
         uno::Sequence< beans::PropertyValue > aValues(1);
         beans::PropertyValue* pValues = aValues.getArray();
         pValues[0].Name = "FilterName";
@@ -581,13 +582,6 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void)
             if(nEnd > documentCount)
                 nEnd = documentCount;
         }
-        OUString sFilter;
-        OUString sPath = SwMailMergeHelper::CallSaveAsDialog(m_xDialog.get(), sFilter);
-        if (sPath.isEmpty())
-        {
-            // just return back to the dialog
-            return;
-        }
         OUString sTargetTempURL = URIHelper::SmartRel2Abs(
             INetURLObject(), utl::TempFile::CreateTempName(),
             URIHelper::GetMaybeFileHdl());


More information about the Libreoffice-commits mailing list