diff options
-rw-r--r-- | sw/source/ui/dbui/mmoutputpage.cxx | 25 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmoutputpage.hxx | 1 |
2 files changed, 15 insertions, 11 deletions
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index b8e5cef18afb..73b39c91bcb4 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -330,8 +330,7 @@ SwMailMergeOutputPage::SwMailMergeOutputPage( SwMailMergeWizard* _pParent) : #endif m_bCancelSaving( false ), m_pWizard(_pParent), - m_pTempPrinter( 0 ), - m_pDocumentPrinterCopy(0) + m_pTempPrinter( 0 ) { FreeResource(); @@ -383,7 +382,6 @@ SwMailMergeOutputPage::SwMailMergeOutputPage( SwMailMergeWizard* _pParent) : SwMailMergeOutputPage::~SwMailMergeOutputPage() { delete m_pTempPrinter; - delete m_pDocumentPrinterCopy; } void SwMailMergeOutputPage::ActivatePage() @@ -409,7 +407,6 @@ void SwMailMergeOutputPage::ActivatePage() m_aPrinterLB.SelectEntry( pPrinter->GetName() ); m_aToNF.SetValue( rConfigItem.GetMergedDocumentCount() ); m_aToNF.SetMax( rConfigItem.GetMergedDocumentCount() ); - m_pDocumentPrinterCopy = pTargetView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( true )->Clone(); } m_aPrinterLB.SelectEntry( rConfigItem.GetSelectedPrinter() ); @@ -852,7 +849,10 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) { - if( m_pDocumentPrinterCopy && pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + SwView *const pTargetView = m_pWizard->GetConfigItem().GetTargetView(); + SfxPrinter *const pDocumentPrinter = pTargetView->GetWrtShell() + .getIDocumentDeviceAccess()->getPrinter(true); + if (pDocumentPrinter && pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) { const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), false ); @@ -860,9 +860,11 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) { if ( !m_pTempPrinter ) { - if( (m_pDocumentPrinterCopy->GetName() == pInfo->GetPrinterName()) && - (m_pDocumentPrinterCopy->GetDriverName() == pInfo->GetDriver()) ) - m_pTempPrinter = new Printer( m_pDocumentPrinterCopy->GetJobSetup() ); + if ((pDocumentPrinter->GetName() == pInfo->GetPrinterName()) && + (pDocumentPrinter->GetDriverName() == pInfo->GetDriver())) + { + m_pTempPrinter = new Printer(pDocumentPrinter->GetJobSetup()); + } else m_pTempPrinter = new Printer( *pInfo ); } @@ -922,8 +924,11 @@ IMPL_LINK_NOARG(SwMailMergeOutputPage, PrintHdl_Impl) pTargetView->SetMailMergeConfigItem(&rConfigItem, 0, sal_False); if(m_pTempPrinter) { - m_pDocumentPrinterCopy->SetPrinterProps(m_pTempPrinter); - pTargetView->SetPrinter(m_pDocumentPrinterCopy->Clone()); + SfxPrinter *const pDocumentPrinter = pTargetView->GetWrtShell() + .getIDocumentDeviceAccess()->getPrinter(true); + pDocumentPrinter->SetPrinterProps(m_pTempPrinter); + // this should be able to handle setting its own printer + pTargetView->SetPrinter(pDocumentPrinter); } SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell(); diff --git a/sw/source/ui/dbui/mmoutputpage.hxx b/sw/source/ui/dbui/mmoutputpage.hxx index 0aace255a628..0babb244d4ab 100644 --- a/sw/source/ui/dbui/mmoutputpage.hxx +++ b/sw/source/ui/dbui/mmoutputpage.hxx @@ -118,7 +118,6 @@ class SwMailMergeOutputPage : public svt::OWizardPage //some dialog data Printer* m_pTempPrinter; - SfxPrinter* m_pDocumentPrinterCopy; String m_sCC; String m_sBCC; |