diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2021-03-22 13:34:37 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-03-31 12:24:22 +0200 |
commit | ec44f87d5b99a3299322d0b79abc4c6808877865 (patch) | |
tree | 684cd7e5306595fe406988c33874aaca569adc2c /sw/source/uibase/dbui/mmconfigitem.cxx | |
parent | 3db477fd0e6cfc4ff77b3c911ca4ab14fd980932 (diff) |
tdf#117212 sw mailmerge: merge only the selected range
All records were merged before saving or printing the
record range selected in “From 'X' To 'Y' of the
“Save Merged Documents” or “Print Merged Documents”
dialog windows (opened via the Mail merge toolbar).
This was a waste of time in the case of selecting
only a few records.
Change-Id: I52c47d3c5707b09ed7f9b05a1a0f4d20a5595b8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112922
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/uibase/dbui/mmconfigitem.cxx')
-rw-r--r-- | sw/source/uibase/dbui/mmconfigitem.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index ae4f5b60c049..083e1a73e0d0 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -688,6 +688,8 @@ SwMailMergeConfigItem::SwMailMergeConfigItem() : m_bAddressInserted(false), m_bGreetingInserted(false), m_nGreetingMoves(0), + m_nBegin(0), + m_nEnd(0), m_pSourceView(nullptr), m_pTargetView(nullptr) { @@ -982,7 +984,10 @@ sal_Int32 SwMailMergeConfigItem::GetResultSetPosition() const return m_pImpl->m_nResultSetCursorPos; } -bool SwMailMergeConfigItem::IsRecordExcluded(sal_Int32 nRecord) const +bool SwMailMergeConfigItem::IsRecordIncluded(sal_uInt32 nRecord) const + { return nRecord > m_nBegin && nRecord <= m_nEnd; } + +bool SwMailMergeConfigItem::IsRecordExcluded(sal_uInt32 nRecord) const { return m_aExcludedRecords.find(nRecord) != m_aExcludedRecords.end(); } void SwMailMergeConfigItem::ExcludeRecord(sal_Int32 nRecord, bool bExclude) @@ -1000,12 +1005,11 @@ uno::Sequence<uno::Any> SwMailMergeConfigItem::GetSelection() const if(!m_pImpl->m_xResultSet.is()) return {}; m_pImpl->m_xResultSet->last(); - sal_Int32 nResultSetSize = m_pImpl->m_xResultSet->getRow()+1; + sal_uInt32 nResultSetSize = m_pImpl->m_xResultSet->getRow()+1; std::vector<uno::Any> vResult; - vResult.reserve(nResultSetSize); - for(sal_Int32 nIdx=1; nIdx<nResultSetSize;++nIdx) - if(!IsRecordExcluded(nIdx)) - vResult.push_back(uno::makeAny<sal_Int32>(nIdx)); + for(sal_uInt32 nIdx=1; nIdx<nResultSetSize;++nIdx) + if( !IsRecordExcluded(nIdx) && IsRecordIncluded(nIdx) ) + vResult.push_back(uno::makeAny<sal_uInt32>(nIdx)); return comphelper::containerToSequence(vResult); } |