summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/printhelper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/doc/printhelper.cxx')
-rwxr-xr-xsfx2/source/doc/printhelper.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index b446b11777..fee1e4df3c 100755
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -266,17 +266,23 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro
// object already disposed?
::vos::OGuard aGuard( Application::GetSolarMutex() );
- // Printer beschaffen
- SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ?
- SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0;
- if ( !pViewFrm )
- return uno::Sequence< beans::PropertyValue >();
-
- const SfxPrinter *pPrinter = pViewFrm->GetViewShell()->GetPrinter(sal_True);
+ // search for any view of this document that is currently printing
+ const Printer *pPrinter = NULL;
+ SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0;
+ SfxViewFrame* pFirst = pViewFrm;
+ while ( pViewFrm && !pPrinter )
+ {
+ pPrinter = pViewFrm->GetViewShell()->GetActivePrinter();
+ pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, sal_False );
+ }
+
+ // if no view is printing currently, use the permanent SfxPrinter instance
+ if ( !pPrinter && pFirst )
+ pPrinter = pFirst->GetViewShell()->GetPrinter(sal_True);
+
if ( !pPrinter )
return uno::Sequence< beans::PropertyValue >();
- // Printer Eigenschaften uebertragen
uno::Sequence< beans::PropertyValue > aPrinter(8);
aPrinter.getArray()[7].Name = DEFINE_CONST_UNICODE( "CanSetPaperSize" );