[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source sw/uiconfig

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 17 07:51:26 UTC 2021


 sw/source/ui/dbui/mmresultdialogs.cxx        |   56 +++++++++++++++++----------
 sw/source/ui/inc/mmresultdialogs.hxx         |    2 
 sw/uiconfig/swriter/ui/mmresultsavedialog.ui |    3 -
 3 files changed, 39 insertions(+), 22 deletions(-)

New commits:
commit d8e5a8c7c3ff747023e7b4b501b7eaef86c40592
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Fri Sep 10 08:46:23 2021 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Sep 17 09:50:54 2021 +0200

    tdf#144427 tdf#144483 sw mailmerge: fix merge all document
    
    Not all records were merged if we selected the “From 'X' To 'Y' of the
    “Save Merged Documents” or “Print Merged Documents” or "Send to Email"
    dialog windows and write some value into them and then we switched back
    on to Save/Print/Send All record (opened via the Mail merge toolbar).
    
    Regression from commit: ec44f87d5b99a3299322d0b79abc4c6808877865
    (tdf#117212 sw mailmerge: merge only the selected range)
    
    (cherry picked from commit f3993912ec4b526aa57cb4bfb4745d7298a4da82)
    
    tdf#144483 sw mail merge: save ranges in a single document
    
    In the Save mail merged document dialog, it wasn't possible
    to save mail ranges in a single document, because of the bad
    UI of the dialog window: grouping range selector as a radio
    button with the single document/individual documents radio
    buttons. Moreover, commit f3993912ec4b526aa57cb4bfb4745d7298a4da82
    "tdf#144427 sw mailmerge: fix merge all document" removed
    the hidden workaround: setting range at the third radio button,
    and selecting the first radio button. Using checkbox for the
    third option solved the problem as proposed.
    
    (cherry picked from commit 45c4caff685b15a0f1b87ef05436a7e6aca96851)
    
    Fix broken ui file
    
    ...after 45c4caff685b15a0f1b87ef05436a7e6aca96851 "tdf#144483 sw mail merge:
    save ranges in a single document", causing CppunitTest_sw_dialogs_test to fail
    with
    
    > warn:vcl.gtk:2759211:2759211:vcl/unx/gtk3/gtkinst.cxx:21611: GtkInstanceBuilder: error when calling gtk_builder_add_from_file: ~/lo/core/instdir/share/config/soffice.cfg/modules/swriter/ui/mmresultsavedialog.ui:165:49 Invalid property: GtkCheckButton.group
    
    (cherry picked from commit 7b37af5af6afe75ad952538c145a4f4e61de9a96)
    
    Change-Id: I01fc664fe76f74cefe4faa81b324088ec37b9881
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121982
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: Balazs Varga <varga.balazs3 at nisz.hu>
    Tested-by: Jenkins

diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index 6e081c68a9a1..fe39b8ed90d9 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -251,7 +251,7 @@ SwMMResultSaveDialog::SwMMResultSaveDialog(weld::Window* pParent)
     , m_bCancelSaving(false)
     , m_xSaveAsOneRB(m_xBuilder->weld_radio_button("singlerb"))
     , m_xSaveIndividualRB(m_xBuilder->weld_radio_button("individualrb"))
-    , m_xFromRB(m_xBuilder->weld_radio_button("fromrb"))
+    , m_xFromRB(m_xBuilder->weld_check_button("fromrb"))
     , m_xFromNF(m_xBuilder->weld_spin_button("from"))
     , m_xToFT(m_xBuilder->weld_label("toft"))
     , m_xToNF(m_xBuilder->weld_spin_button("to"))
@@ -552,11 +552,17 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void)
     std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
     assert(xConfigItem);
 
-    sal_uInt32 nBegin = static_cast<sal_Int32>(m_xFromNF->get_value() - 1);
-    sal_uInt32 nEnd = static_cast<sal_Int32>(m_xToNF->get_value());
-    sal_uInt32 nMax = static_cast<sal_Int32>(m_xToNF->get_max());
-    if (nEnd > nMax)
-        nEnd = nMax;
+    const sal_uInt32 nDocumentCount = xConfigItem->GetMergedDocumentCount();
+    sal_uInt32 nBegin = 0;
+    sal_uInt32 nEnd = nDocumentCount;
+
+    if (m_xFromRB->get_active())
+    {
+        nBegin = static_cast<sal_Int32>(m_xFromNF->get_value() - 1);
+        nEnd = static_cast<sal_Int32>(m_xToNF->get_value());
+        if (nEnd > nDocumentCount)
+            nEnd = nDocumentCount;
+    }
 
     xConfigItem->SetBeginEnd(nBegin, nEnd);
 
@@ -773,11 +779,17 @@ IMPL_LINK_NOARG(SwMMResultPrintDialog, PrintHdl_Impl, weld::Button&, void)
     std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
     assert(xConfigItem);
 
-    sal_uInt32 nBegin = static_cast<sal_Int32>(m_xFromNF->get_value() - 1);
-    sal_uInt32 nEnd = static_cast<sal_Int32>(m_xToNF->get_value());
-    sal_uInt32 nMax = static_cast<sal_Int32>(m_xToNF->get_max());
-    if (nEnd > nMax)
-        nEnd = nMax;
+    const sal_uInt32 nDocumentCount = xConfigItem->GetMergedDocumentCount();
+    sal_uInt32 nBegin = 0;
+    sal_uInt32 nEnd = nDocumentCount;
+
+    if (m_xFromRB->get_active())
+    {
+        nBegin = static_cast<sal_Int32>(m_xFromNF->get_value() - 1);
+        nEnd = static_cast<sal_Int32>(m_xToNF->get_value());
+        if (nEnd > nDocumentCount)
+            nEnd = nDocumentCount;
+    }
 
     xConfigItem->SetBeginEnd(nBegin, nEnd);
 
@@ -791,8 +803,8 @@ IMPL_LINK_NOARG(SwMMResultPrintDialog, PrintHdl_Impl, weld::Button&, void)
     // refer to the non-blank pages as they appear in the document (see tdf#89708).
     const bool bIgnoreEmptyPages =
             !pTargetView->GetDocShell()->GetDoc()->getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages();
-    const int nStartPage = documentStartPageNumber(xConfigItem.get(), nBegin, bIgnoreEmptyPages);
-    const int nEndPage = documentEndPageNumber(xConfigItem.get(), nEnd - 1, bIgnoreEmptyPages);
+    const int nStartPage = documentStartPageNumber(xConfigItem.get(), 0, bIgnoreEmptyPages);
+    const int nEndPage = documentEndPageNumber(xConfigItem.get(), nEnd - nBegin - 1, bIgnoreEmptyPages);
 
     const OUString sPages(OUString::number(nStartPage) + "-" + OUString::number(nEndPage));
 
@@ -884,11 +896,17 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi
     std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
     assert(xConfigItem);
 
-    sal_uInt32 nBegin = static_cast<sal_Int32>(m_xFromNF->get_value() - 1);
-    sal_uInt32 nEnd = static_cast<sal_Int32>(m_xToNF->get_value());
-    sal_uInt32 nMax = static_cast<sal_Int32>(m_xToNF->get_max());
-    if (nEnd > nMax)
-        nEnd = nMax;
+    const sal_uInt32 nDocumentCount = xConfigItem->GetMergedDocumentCount();
+    sal_uInt32 nBegin = 0;
+    sal_uInt32 nEnd = nDocumentCount;
+
+    if (m_xFromRB->get_active())
+    {
+        nBegin = static_cast<sal_Int32>(m_xFromNF->get_value() - 1);
+        nEnd = static_cast<sal_Int32>(m_xToNF->get_value());
+        if (nEnd > nDocumentCount)
+            nEnd = nDocumentCount;
+    }
 
     xConfigItem->SetBeginEnd(nBegin, nEnd);
 
@@ -1087,7 +1105,7 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi
     //predetermined breaking point
     Application::Reschedule( true );
     m_xDialog->response(RET_OK);
-    for(sal_uInt32 nDoc = nBegin; nDoc < nEnd; ++nDoc)
+    for(sal_uInt32 nDoc = 0; nDoc < nEnd - nBegin; ++nDoc)
     {
         SwDocMergeInfo& rInfo = xConfigItem->GetDocumentMergeInfo(nDoc);
 
diff --git a/sw/source/ui/inc/mmresultdialogs.hxx b/sw/source/ui/inc/mmresultdialogs.hxx
index 72d86389ac8e..ace2860d69b9 100644
--- a/sw/source/ui/inc/mmresultdialogs.hxx
+++ b/sw/source/ui/inc/mmresultdialogs.hxx
@@ -37,7 +37,7 @@ class SwMMResultSaveDialog : public SfxDialogController
 
     std::unique_ptr<weld::RadioButton> m_xSaveAsOneRB;
     std::unique_ptr<weld::RadioButton> m_xSaveIndividualRB;
-    std::unique_ptr<weld::RadioButton> m_xFromRB;
+    std::unique_ptr<weld::CheckButton> m_xFromRB;
     std::unique_ptr<weld::SpinButton> m_xFromNF;
     std::unique_ptr<weld::Label> m_xToFT;
     std::unique_ptr<weld::SpinButton> m_xToNF;
diff --git a/sw/uiconfig/swriter/ui/mmresultsavedialog.ui b/sw/uiconfig/swriter/ui/mmresultsavedialog.ui
index 19e678f5ac10..44759e65a033 100644
--- a/sw/uiconfig/swriter/ui/mmresultsavedialog.ui
+++ b/sw/uiconfig/swriter/ui/mmresultsavedialog.ui
@@ -155,14 +155,13 @@
                     <property name="can_focus">False</property>
                     <property name="column_spacing">12</property>
                     <child>
-                      <object class="GtkRadioButton" id="fromrb">
+                      <object class="GtkCheckButton" id="fromrb">
                         <property name="label" translatable="yes" context="mmresultsavedialog|fromrb">_From</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">singlerb</property>
                         <accessibility>
                           <relation type="label-for" target="from"/>
                         </accessibility>


More information about the Libreoffice-commits mailing list