diff options
Diffstat (limited to 'sw/source/ui/dbui/mmoutputpage.cxx')
-rw-r--r-- | sw/source/ui/dbui/mmoutputpage.cxx | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index f3bb4b4663..5f03a2409f 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -782,7 +782,8 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) aSaveMonitor.aPrintInfo.SetText(sStat); //now extract a document from the target document - SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); + // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here + SfxObjectShellLock xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() ); @@ -1020,8 +1021,6 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(nRet != RET_OK && nRet != RET_YES) return 0; } - //create the send dialog - SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem ); //add the documents sal_uInt32 nBegin = 0; sal_uInt32 nEnd = 0; @@ -1047,7 +1046,26 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) switch( nDocType ) { case MM_DOCTYPE_OOO : break; - case MM_DOCTYPE_PDF : bIsPDF = true; break; + case MM_DOCTYPE_PDF : bIsPDF = true; + { + //the method SwIOSystemGetFilterOfFormat( ) returns the template filter + //because it uses the same user data :-( + SfxFilterMatcher aMatcher( pFilterContainer->GetName() ); + SfxFilterMatcherIter aIter( &aMatcher ); + const SfxFilter* pFilter = aIter.First(); + String sFilterMime( String::CreateFromAscii( "application/pdf" )); + while ( pFilter ) + { + if( pFilter->GetMimeType() == sFilterMime && pFilter->CanExport() ) + { + pSfxFlt = pFilter; + break; + } + pFilter = aIter.Next(); + } + + } + break; case MM_DOCTYPE_WORD: { //the method SwIOSystemGetFilterOfFormat( ) returns the template filter @@ -1153,6 +1171,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); xStore->storeToURL( sTargetTempURL, aValues ); + //create the send dialog + SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem ); pDlg->SetDocumentCount( nEnd ); pDlg->ShowDialog(); //help to force painting the dialog @@ -1166,7 +1186,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) SwDocMergeInfo& rInfo = rConfigItem.GetDocumentMergeInfo(nDoc); //now extract a document from the target document - SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); + // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here + SfxObjectShellLock xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() ); |