diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-02-16 11:18:37 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-02-16 11:18:37 +0100 |
commit | 68493b03eee03e7cab5ddabe24e673329c7fd09d (patch) | |
tree | 7db0ab6f5936556c1bc1dd93a2c017fc917e8eda /sfx2/source | |
parent | b5d6abc93003a0f2b7b9d99febf1329869cc2f72 (diff) |
cws ppp02: #i109321#: return correct IsBusy property in XPrintable::getPrinter() call
Diffstat (limited to 'sfx2/source')
-rwxr-xr-x | sfx2/source/doc/printhelper.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/view/viewimp.hxx | 26 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 10 |
3 files changed, 25 insertions, 31 deletions
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 103dcf505846..ff21de94ae59 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -269,17 +269,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, 0, sal_False ) : 0; - if ( !pViewFrm ) - return uno::Sequence< beans::PropertyValue >(); + // 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, 0, sal_False ) : 0; + SfxViewFrame* pFirst = pViewFrm; + while ( pViewFrm && !pPrinter ) + { + pPrinter = pViewFrm->GetViewShell()->GetActivePrinter(); + pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, 0, sal_False ); + } + + // if no view is printing currently, use the permanent SfxPrinter instance + if ( !pPrinter && pFirst ) + pPrinter = pFirst->GetViewShell()->GetPrinter(sal_True); - const SfxPrinter *pPrinter = pViewFrm->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" ); diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 9e3791340daa..e3e0085c52d1 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -33,20 +33,16 @@ // include --------------------------------------------------------------- -#ifndef __SBX_SBXOBJ_HXX #include <basic/sbxobj.hxx> -#endif #include <sfx2/viewsh.hxx> #include <sfx2/viewfrm.hxx> // SvBorder #include <osl/mutex.hxx> #include <cppuhelper/interfacecontainer.hxx> - #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <svtools/acceleratorexecute.hxx> - #include <rtl/ref.hxx> - +#include <vcl/print.hxx> #include <queue> // forward --------------------------------------------------------------- @@ -57,24 +53,6 @@ class SfxBaseController; typedef SfxShell* SfxShellPtr_Impl; SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 ) -// struct SfxViewShell_Impl ---------------------------------------------- -#if 0 -class SfxAsyncPrintExec_Impl : public SfxListener -{ - SfxViewShell* pView; - ::std::queue < SfxRequest*> aReqs; - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - -public: - SfxAsyncPrintExec_Impl( SfxViewShell* pShell) - : pView( pShell ) - {} - - void AddRequest( SfxRequest& rReq ); -}; -#endif - class SfxClipboardChangeListener; struct SfxViewShell_Impl @@ -100,9 +78,9 @@ struct SfxViewShell_Impl USHORT nFamily; SfxBaseController* pController; ::svt::AcceleratorExecute* pAccExec; -// SfxAsyncPrintExec_Impl* pPrinterCommandQueue; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; + vcl::PrinterController* pPrinterController; SfxViewShell_Impl(); }; diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 24d31337a662..afb2b46edf47 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -332,6 +332,9 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt if ( m_bNeedsChange ) mpObjectShell->EnableSetModified( m_bOrigStatus ); + + if ( mpViewShell ) + mpViewShell->pImp->pPrinterController = 0; } } @@ -642,6 +645,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro this, rProps ) ); + pImp->pPrinterController = pController.get(); + SfxObjectShell *pObjShell = GetObjectShell(); pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ), makeAny( rtl::OUString( pObjShell->GetTitle(0) ) ) ); @@ -656,6 +661,11 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro Printer::PrintJob( pController, aJobSetup ); } +Printer* SfxViewShell::GetActivePrinter() const +{ + return pImp->pPrinterController ? pImp->pPrinterController->getPrinter().get() : 0; +} + void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // USHORT nCopies=1; |