summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-01-05 20:53:06 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-19 08:25:44 +0000
commit8d03d6dea84f8c0c9a83031b646e242df7ea5678 (patch)
treea074c5ee5679257bd3381c285382e43a73b4c90f
parenttdf#96198 accept WEEKNUM with only one parameter, tdf#50950 follow-up (diff)
downloadcore-8d03d6dea84f8c0c9a83031b646e242df7ea5678.tar.gz
core-8d03d6dea84f8c0c9a83031b646e242df7ea5678.zip
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> (cherry picked from commit dcae0a5dba5aadc1e89828518102947f749db10e) Reviewed-on: https://gerrit.libreoffice.org/21478 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-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 69c027c348a6..98080da47876 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)