Kaydet (Commit) 3e33c891 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

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
üst ffe0b2c3
...@@ -1487,50 +1487,35 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, ...@@ -1487,50 +1487,35 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
xWorkDocSh->DoClose(); xWorkDocSh->DoClose();
} }
} }
else if( !m_bCancel ) // && bCreateSingleFile
if (bCreateSingleFile)
{ {
RESCHEDULE_GUI;
// sw::DocumentLayoutManager::CopyLayoutFormat() did not generate // sw::DocumentLayoutManager::CopyLayoutFormat() did not generate
// unique fly names, do it here once. // unique fly names, do it here once.
pTargetDoc->SetInMailMerge(false); pTargetDoc->SetInMailMerge(false);
pTargetDoc->SetAllUniqueFlyNames(); pTargetDoc->SetAllUniqueFlyNames();
}
RESCHEDULE_GUI;
// Unfreeze target document layouts and correct all PageDescs. // Unfreeze target document layouts and correct all PageDescs.
if(bCreateSingleFile)
{
pTargetShell->CalcLayout(); pTargetShell->CalcLayout();
for ( auto aLayout : pTargetShell->GetDoc()->GetAllLayouts() ) for ( auto aLayout : pTargetShell->GetDoc()->GetAllLayouts() )
{ {
aLayout->FreezeLayout(false); aLayout->FreezeLayout(false);
aLayout->AllCheckPageDescs(); aLayout->AllCheckPageDescs();
} }
}
pProgressDlg.disposeAndClear(); RESCHEDULE_GUI;
// save the single output document if( !m_bCancel && bMT_FILE )
if( bMT_SHELL )
{
rMergeDescriptor.pMailMergeConfigItem->SetTargetView( pTargetView );
}
else if(bCreateSingleFile)
{
if( !bMT_PRINTER )
{ {
if( !m_bCancel ) // save merged document
{ assert( aTempFile.get() );
// save merged document INetURLObject aTempFileURL( rMergeDescriptor.bSubjectIsFilename ? sSubject : aTempFile->GetURL());
assert( aTempFile.get() ); bNoError = lcl_SaveDoc( &aTempFileURL, pStoreToFilter,
INetURLObject aTempFileURL( rMergeDescriptor.bSubjectIsFilename ? sSubject : aTempFile->GetURL()); pStoreToFilterOptions, &rMergeDescriptor.aSaveToFilterData,
bNoError = lcl_SaveDoc( &aTempFileURL, pStoreToFilter, bIsPDFexport, xTargetDocShell, *pTargetShell );
pStoreToFilterOptions, &rMergeDescriptor.aSaveToFilterData,
bIsPDFexport, xTargetDocShell, *pTargetShell );
}
} }
else if( pTargetView ) // must be available! else if( !m_bCancel && bMT_PRINTER )
{ {
// print the target document // print the target document
uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions ); uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions );
...@@ -1538,12 +1523,16 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, ...@@ -1538,12 +1523,16 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
pTargetView->ExecPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync ); pTargetView->ExecPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync );
} }
// Leave docshell available for caller (e.g. MM wizard) if( !m_bCancel && bMT_SHELL )
if( !bMT_SHELL ) // leave docshell available for caller (e.g. MM wizard)
rMergeDescriptor.pMailMergeConfigItem->SetTargetView( pTargetView );
else
xTargetDocShell->DoClose(); xTargetDocShell->DoClose();
} }
//remove the temporary files pProgressDlg.disposeAndClear();
// remove the temporary files
::std::vector<OUString>::iterator aFileIter; ::std::vector<OUString>::iterator aFileIter;
for(aFileIter = aFilesToRemove.begin(); for(aFileIter = aFilesToRemove.begin();
aFileIter != aFilesToRemove.end(); ++aFileIter) aFileIter != aFilesToRemove.end(); ++aFileIter)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment