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 12:31:12 +0000
commitb6a2f00e8db0dab8d3b9eead6f8a4d2eee845a80 (patch)
treefe130c13c3c9b63a9ceda946c7c75dfa8b51e13b
parent2229880eb089d95e25ffb8f3853634e5fee8209a (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 (cherry picked from commit af8f938531909122ff7a056c2206af857324fdf3) Reviewed-on: https://gerrit.libreoffice.org/16292 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-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 a3ab6d9716c3..922006df4cb8 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1186,45 +1186,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 );
@@ -1247,6 +1208,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 );