summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2021-09-10 08:46:23 +0200
committerLászló Németh <nemeth@numbertext.org>2021-09-17 09:50:54 +0200
commitd8e5a8c7c3ff747023e7b4b501b7eaef86c40592 (patch)
tree9b8922c17fe3867673ddb3571dd7e5551a0646b5
parentResolves tdf#144523 - Update Liberation fonts to 2.1.4 release (diff)
downloadcore-d8e5a8c7c3ff747023e7b4b501b7eaef86c40592.tar.gz
core-d8e5a8c7c3ff747023e7b4b501b7eaef86c40592.zip
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@numbertext.org> Reviewed-by: Balazs Varga <varga.balazs3@nisz.hu> Tested-by: Jenkins
-rw-r--r--sw/source/ui/dbui/mmresultdialogs.cxx56
-rw-r--r--sw/source/ui/inc/mmresultdialogs.hxx2
-rw-r--r--sw/uiconfig/swriter/ui/mmresultsavedialog.ui3
3 files changed, 39 insertions, 22 deletions
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>