[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/source
Jan-Marek Glogowski
glogow at fbihome.de
Tue Jan 19 00:26:14 PST 2016
sw/source/uibase/dbui/dbmgr.cxx | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
New commits:
commit 8d03d6dea84f8c0c9a83031b646e242df7ea5678
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Tue Jan 5 20:53:06 2016 +0100
tdf#93565 Use multiple docs for individual PDF MM
There is actually a comment in the mail merge code:
// convert fields to text if we are exporting to PDF
// this prevents a second merge while updating the fields
// in SwXTextDocument::getRendererCount()
This was included to fix i#93714.
But the reference to 2005-05-23 #122919# in the actual code
doesn't help to understand, why the original code is needed.
I would like to get rid of it, but currently don't have time
for tests.
So the optimization to skip ConvertFieldsToText() and use a
single working document for individual document mail merge
breaks for PDF, as the working document won't contain any
fields after the first document is written.
This uses multiple working documents for PDF export again.
(cherry picked from commit d7e0d0135ba65243fab5ee038c21290b8e74e548)
Conflicts:
sw/inc/dbmgr.hxx
sw/source/uibase/dbui/dbmgr.cxx
Change-Id: I0cf1c64da27863fc5fb4bb6c7812fed90b737d13
Reviewed-on: https://gerrit.libreoffice.org/21136
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
(cherry picked from commit dcae0a5dba5aadc1e89828518102947f749db10e)
Reviewed-on: https://gerrit.libreoffice.org/21478
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 69c027c..98080da 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -928,6 +928,8 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
pStoreToFilterOptions = &rMergeDescriptor.sSaveToFilterOptions;
}
}
+ const bool bIsPDFeport = pStoreToFilter && pStoreToFilter->GetFilterName() == "writer_pdf_Export";
+
bCancel = false;
// in case of creating a single resulting file this has to be created here
@@ -1113,7 +1115,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
// Create a copy of the source document and work with that one instead of the source.
// If we're not in the single file mode (which requires modifying the document for the merging),
// it is enough to do this just once.
- if( 1 == nDocNo || bCreateSingleFile )
+ if( 1 == nDocNo || bCreateSingleFile || bIsPDFeport )
{
assert( !xWorkDocSh.Is());
// copy the source document
@@ -1271,7 +1273,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
//convert fields to text if we are exporting to PDF
//this prevents a second merge while updating the fields in SwXTextDocument::getRendererCount()
- if( pStoreToFilter && pStoreToFilter->GetFilterName() == "writer_pdf_Export")
+ if( bIsPDFeport )
rWorkShell.ConvertFieldsToText();
xWorkDocSh->DoSaveAs(*pDstMed);
xWorkDocSh->DoSaveCompleted(pDstMed);
@@ -1360,7 +1362,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
}
}
}
- if( bCreateSingleFile )
+ if( bCreateSingleFile || bIsPDFeport )
{
pWorkDoc->SetDBManager( pOldDBManager );
xWorkDocSh->DoClose();
@@ -1398,8 +1400,11 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
psp::PrinterInfoManager::get().flushBatchPrint();
#endif
}
- pWorkDoc->SetDBManager( pOldDBManager );
- xWorkDocSh->DoClose();
+ if( !bIsPDFeport )
+ {
+ pWorkDoc->SetDBManager( pOldDBManager );
+ xWorkDocSh->DoClose();
+ }
}
if (bCreateSingleFile)
More information about the Libreoffice-commits
mailing list