summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-06-15 12:58:57 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-06-15 13:01:05 +0100
commitaf8f938531909122ff7a056c2206af857324fdf3 (patch)
treebe6d048cd870a293984aa5dd4540f32802c04f0f
parenta35ac249f66fcf482485ab44337426ce4e75491f (diff)
Resolves: tdf#92057 crash on mail-merge to printer
this appears to be a mismerge of commit e0ad036eed6b151ea81311fcf9ba46f1726b103c Author: Luboš Luňák <l.lunak@collabora.com> Date: Thu Feb 19 16:39:06 2015 +0100 mailmerge doesn't need to use the singlefile technique for printing It should be sufficient for every record to just update the fields and print the document. The printing code apparently rather expects to do the printing in one go, so split the functions up there. Conflicts: include/sfx2/viewsh.hxx include/vcl/print.hxx sfx2/source/view/viewprn.cxx sw/source/uibase/dbui/dbmgr.cxx sw/source/uibase/uno/unomailmerge.cxx vcl/source/gdi/print3.cxx where the else if block is positioned at a nutty location Change-Id: Ia22e9e53c27256131283babaf779e57f157ba6b8
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx78
1 files changed, 39 insertions, 39 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index eb2c9c0a642c..47fb01754026 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1252,45 +1252,6 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
lcl_CopyFollowPageDesc( *pTargetShell, *pWorkPageDesc, *pTargetPageDesc, nDocNo );
}
}
- else if( rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER )
- {
- assert(!bCreateSingleFile);
- if( 1 == nDocNo ) // set up printing only once at the beginning
- {
- // printing should be done synchronously otherwise the document
- // might already become invalid during the process
- uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions );
-
- aOptions.realloc( 2 );
- aOptions[ 0 ].Name = "Wait";
- aOptions[ 0 ].Value <<= sal_True;
- aOptions[ 1 ].Name = "MonitorVisible";
- aOptions[ 1 ].Value <<= sal_False;
- // move print options
- const beans::PropertyValue* pPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray();
- for( sal_Int32 nOption = 0, nIndex = 1 ; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption)
- {
- if( pPrintOptions[nOption].Name == "CopyCount" || pPrintOptions[nOption].Name == "FileName"
- || pPrintOptions[nOption].Name == "Collate" || pPrintOptions[nOption].Name == "Pages"
- || pPrintOptions[nOption].Name == "Wait" || pPrintOptions[nOption].Name == "PrinterName" )
- {
- // add an option
- aOptions.realloc( nIndex + 1 );
- aOptions[ nIndex ].Name = pPrintOptions[nOption].Name;
- aOptions[ nIndex++ ].Value = pPrintOptions[nOption].Value ;
- }
- }
- pWorkView->StartPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync );
- SfxPrinter* pDocPrt = pWorkView->GetPrinter(false);
- JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : SfxViewShell::GetJobSetup();
- Printer::PreparePrintJob( pWorkView->GetPrinterController(), aJobSetup );
-#if ENABLE_CUPS && !defined(MACOSX)
- psp::PrinterInfoManager::get().startBatchPrint();
-#endif
- }
- if( !Printer::ExecutePrintJob( pWorkView->GetPrinterController()))
- bCancel = true;
- }
else
pTargetPageDesc = pTargetShell->FindPageDescByName( sModifiedStartingPageDesc );
@@ -1313,6 +1274,45 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
rMergeDescriptor.pMailMergeConfigItem->AddMergedDocument( aMergeInfo );
}
}
+ else if( rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER )
+ {
+ assert(!bCreateSingleFile);
+ if( 1 == nDocNo ) // set up printing only once at the beginning
+ {
+ // printing should be done synchronously otherwise the document
+ // might already become invalid during the process
+ uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions );
+
+ aOptions.realloc( 2 );
+ aOptions[ 0 ].Name = "Wait";
+ aOptions[ 0 ].Value <<= sal_True;
+ aOptions[ 1 ].Name = "MonitorVisible";
+ aOptions[ 1 ].Value <<= sal_False;
+ // move print options
+ const beans::PropertyValue* pPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray();
+ for( sal_Int32 nOption = 0, nIndex = 1 ; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption)
+ {
+ if( pPrintOptions[nOption].Name == "CopyCount" || pPrintOptions[nOption].Name == "FileName"
+ || pPrintOptions[nOption].Name == "Collate" || pPrintOptions[nOption].Name == "Pages"
+ || pPrintOptions[nOption].Name == "Wait" || pPrintOptions[nOption].Name == "PrinterName" )
+ {
+ // add an option
+ aOptions.realloc( nIndex + 1 );
+ aOptions[ nIndex ].Name = pPrintOptions[nOption].Name;
+ aOptions[ nIndex++ ].Value = pPrintOptions[nOption].Value ;
+ }
+ }
+ pWorkView->StartPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync );
+ SfxPrinter* pDocPrt = pWorkView->GetPrinter(false);
+ JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : SfxViewShell::GetJobSetup();
+ Printer::PreparePrintJob( pWorkView->GetPrinterController(), aJobSetup );
+#if ENABLE_CUPS && !defined(MACOSX)
+ psp::PrinterInfoManager::get().startBatchPrint();
+#endif
+ }
+ if( !Printer::ExecutePrintJob( pWorkView->GetPrinterController()))
+ bCancel = true;
+ }
else
{
assert( createTempFile );