[Libreoffice-commits] core.git: sw/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 13 06:16:11 UTC 2021
sw/source/ui/dbui/mmresultdialogs.cxx | 54 ++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 18 deletions(-)
New commits:
commit f3993912ec4b526aa57cb4bfb4745d7298a4da82
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Fri Sep 10 08:46:23 2021 +0200
Commit: Balazs Varga <varga.balazs3 at nisz.hu>
CommitDate: Mon Sep 13 08:15:39 2021 +0200
tdf#144427 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)
Change-Id: I01fc664fe76f74cefe4faa81b324088ec37b9881
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121867
Tested-by: Jenkins
Reviewed-by: Balazs Varga <varga.balazs3 at nisz.hu>
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index ab41dcb4693c..38bd28376d77 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -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);
@@ -1085,7 +1103,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);
More information about the Libreoffice-commits
mailing list