summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-01-05 20:53:06 +0100
committerMichael Stahl <mstahl@redhat.com>2016-01-07 14:13:15 +0000
commitdcae0a5dba5aadc1e89828518102947f749db10e (patch)
tree12d492174d59e4cfadb208d2da16bc077c12e3ab
parent795324d953e54b8e42d34ce577feee8559b9226d (diff)
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@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 0c0a7c7aaf2d..3932b119540f 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -991,6 +991,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
@@ -1176,7 +1178,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
@@ -1336,7 +1338,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);
@@ -1425,7 +1427,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
}
}
}
- if( bCreateSingleFile )
+ if( bCreateSingleFile || bIsPDFeport )
{
pWorkDoc->SetDBManager( pOldDBManager );
xWorkDocSh->DoClose();
@@ -1462,8 +1464,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)