summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-10-01 23:02:57 +0200
committerMichael Stahl <mstahl@redhat.com>2012-10-01 23:15:42 +0200
commitf3020438938d019784d32fffeaf5f18dc6175ed8 (patch)
tree0960c5558d5e148bc15fa8a52d74d49824d03066 /sw
parentdf706c23dcdc81f0cfaa8c2b106afd6accc03ad5 (diff)
fdo#55496: fix lifecycle of SwMailMergeOutputPage:
Its member m_pDocumentPrinterCopy contains a SfxItemSet that points at the SwDoc's item pool; the SwDoc is freed in SwMailMergeWizardExecutor::LinkStubCancelHdl. But the SwDoc::setPrinter method does seem to work fine if the printer that is set is the same as the one it already has, so it does not seem to be necessary to clone the printer; just get it and set it again. Change-Id: Ic591f68f6e0bab4e42cb22a9cb0a47e97f5e938f
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx25
-rw-r--r--sw/source/ui/dbui/mmoutputpage.hxx1
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;