summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-01-08 13:26:23 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2016-03-24 22:40:40 +0100
commit3e33c891ab9c49e6fb4b3767c5e6daae651ebc82 (patch)
tree23133fc662ac4d4f7278f2c53d91864c35e9b08b
parentffe0b2c3b6d153dbb0a4a7c3a788ca22ae022ae6 (diff)
MM: cleanup bCreateSingleFile finish
Took me a while to realize most of the post-mm finalization code actually depends on bCreateSingleFile. This allows us to simplify the code structure. Change-Id: Ifd8a8a882d9902bedd40c8b1d1e4a8507b5877fe
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx51
1 files changed, 20 insertions, 31 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 5ee240762887..3439f9351f4e 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1487,50 +1487,35 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
xWorkDocSh->DoClose();
}
}
-
- if (bCreateSingleFile)
+ else if( !m_bCancel ) // && bCreateSingleFile
{
+ RESCHEDULE_GUI;
+
// sw::DocumentLayoutManager::CopyLayoutFormat() did not generate
// unique fly names, do it here once.
pTargetDoc->SetInMailMerge(false);
pTargetDoc->SetAllUniqueFlyNames();
- }
-
- RESCHEDULE_GUI;
- // Unfreeze target document layouts and correct all PageDescs.
- if(bCreateSingleFile)
- {
+ // Unfreeze target document layouts and correct all PageDescs.
pTargetShell->CalcLayout();
for ( auto aLayout : pTargetShell->GetDoc()->GetAllLayouts() )
{
aLayout->FreezeLayout(false);
aLayout->AllCheckPageDescs();
}
- }
- pProgressDlg.disposeAndClear();
+ RESCHEDULE_GUI;
- // save the single output document
- if( bMT_SHELL )
- {
- rMergeDescriptor.pMailMergeConfigItem->SetTargetView( pTargetView );
- }
- else if(bCreateSingleFile)
- {
- if( !bMT_PRINTER )
+ if( !m_bCancel && bMT_FILE )
{
- if( !m_bCancel )
- {
- // save merged document
- assert( aTempFile.get() );
- INetURLObject aTempFileURL( rMergeDescriptor.bSubjectIsFilename ? sSubject : aTempFile->GetURL());
- bNoError = lcl_SaveDoc( &aTempFileURL, pStoreToFilter,
- pStoreToFilterOptions, &rMergeDescriptor.aSaveToFilterData,
- bIsPDFexport, xTargetDocShell, *pTargetShell );
- }
+ // save merged document
+ assert( aTempFile.get() );
+ INetURLObject aTempFileURL( rMergeDescriptor.bSubjectIsFilename ? sSubject : aTempFile->GetURL());
+ bNoError = lcl_SaveDoc( &aTempFileURL, pStoreToFilter,
+ pStoreToFilterOptions, &rMergeDescriptor.aSaveToFilterData,
+ bIsPDFexport, xTargetDocShell, *pTargetShell );
}
- else if( pTargetView ) // must be available!
+ else if( !m_bCancel && bMT_PRINTER )
{
// print the target document
uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions );
@@ -1538,12 +1523,16 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
pTargetView->ExecPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync );
}
- // Leave docshell available for caller (e.g. MM wizard)
- if( !bMT_SHELL )
+ if( !m_bCancel && bMT_SHELL )
+ // leave docshell available for caller (e.g. MM wizard)
+ rMergeDescriptor.pMailMergeConfigItem->SetTargetView( pTargetView );
+ else
xTargetDocShell->DoClose();
}
- //remove the temporary files
+ pProgressDlg.disposeAndClear();
+
+ // remove the temporary files
::std::vector<OUString>::iterator aFileIter;
for(aFileIter = aFilesToRemove.begin();
aFileIter != aFilesToRemove.end(); ++aFileIter)