From e0ad036eed6b151ea81311fcf9ba46f1726b103c Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Thu, 19 Feb 2015 16:39:06 +0100 Subject: 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 Change-Id: I4d17c703b3220f47609fc4b054ce048b299a0c92 --- sfx2/source/view/viewprn.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 0ed526d48670..21045325bc5f 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -567,8 +567,10 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter ) return pDocPrinter; } -void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rProps, bool bIsAPI, bool bIsDirect ) +void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rProps, bool bIsAPI, bool bIsDirect ) { + assert( pImp->m_xPrinterController.get() == NULL ); + // get the current selection; our controller should know it Reference< frame::XController > xController( GetController() ); Reference< view::XSelectionSupplier > xSupplier( xController, UNO_QUERY ); @@ -610,11 +612,20 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro SfxObjectShell *pObjShell = GetObjectShell(); xNewController->setValue( OUString( "JobName" ), makeAny( OUString( pObjShell->GetTitle(0) ) ) ); +} +void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rProps, bool bIsAPI, bool bIsDirect ) +{ + StartPrint( rProps, bIsAPI, bIsDirect ); // FIXME: job setup SfxPrinter* pDocPrt = GetPrinter(false); JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : GetJobSetup(); - Printer::PrintJob( xNewController, aJobSetup ); + Printer::PrintJob( GetPrinterController(), aJobSetup ); +} + +std::shared_ptr< vcl::PrinterController > SfxViewShell::GetPrinterController() const +{ + return pImp->m_xPrinterController; } Printer* SfxViewShell::GetActivePrinter() const -- cgit