diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-12-17 11:51:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-12-17 11:51:54 +0000 |
commit | 8e8444471a2110fe5db7704d408161924cdab86b (patch) | |
tree | f940ffce3d1f0220d30964a665ac42e510e60235 /vcl/unx/headless | |
parent | 4e0286ec6bef391b616a35ea47a4b7acf60ba2cf (diff) |
Move the PrinterUpdate stuff to be SalInstance specific
Diffstat (limited to 'vcl/unx/headless')
-rw-r--r-- | vcl/unx/headless/svpinst.hxx | 4 | ||||
-rw-r--r-- | vcl/unx/headless/svpprn.cxx | 53 | ||||
-rw-r--r-- | vcl/unx/headless/svpprn.hxx | 17 |
3 files changed, 46 insertions, 28 deletions
diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index ace3ac7c236c..622eda072e41 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -198,6 +198,10 @@ public: virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType); + + virtual void updatePrinterUpdate(); + virtual void jobStartedPrinterUpdate(); + virtual void jobEndedPrinterUpdate(); }; #endif // _SV_SALINST_HXX diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx index 9038e3cd42fb..2c3b4bee275b 100644 --- a/vcl/unx/headless/svpprn.cxx +++ b/vcl/unx/headless/svpprn.cxx @@ -851,7 +851,7 @@ BOOL PspSalPrinter::StartJob( bool /*bDirect*/, ImplJobSetup* pJobSetup ) { - vcl_sal::PrinterUpdate::jobStarted(); + SvpSalInstance::s_pDefaultInstance->jobStartedPrinterUpdate(); m_bFax = false; m_bPdf = false; @@ -946,7 +946,7 @@ BOOL PspSalPrinter::EndJob() bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand ); } } - vcl_sal::PrinterUpdate::jobEnded(); + SvpSalInstance::s_pDefaultInstance->jobEndedPrinterUpdate(); return bSuccess; } @@ -955,7 +955,7 @@ BOOL PspSalPrinter::EndJob() BOOL PspSalPrinter::AbortJob() { BOOL bAbort = m_aPrintJob.AbortJob() ? TRUE : FALSE; - vcl_sal::PrinterUpdate::jobEnded(); + SvpSalInstance::s_pDefaultInstance->jobEndedPrinterUpdate(); return bAbort; } @@ -997,13 +997,29 @@ ULONG PspSalPrinter::GetErrorCode() } /* - * vcl::PrinterUpdate + * svp::PrinterUpdate */ -Timer* vcl_sal::PrinterUpdate::pPrinterUpdateTimer = NULL; -int vcl_sal::PrinterUpdate::nActiveJobs = 0; +namespace svp +{ + class PrinterUpdate + { + static Timer* pPrinterUpdateTimer; + static int nActiveJobs; + + static void doUpdate(); + DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* ); + public: + static void update(); + static void jobStarted() { nActiveJobs++; } + static void jobEnded(); + }; +} -void vcl_sal::PrinterUpdate::doUpdate() +Timer* svp::PrinterUpdate::pPrinterUpdateTimer = NULL; +int svp::PrinterUpdate::nActiveJobs = 0; + +void svp::PrinterUpdate::doUpdate() { ::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() ); if( rManager.checkPrintersChanged( false ) && SvpSalInstance::s_pDefaultInstance ) @@ -1017,7 +1033,7 @@ void vcl_sal::PrinterUpdate::doUpdate() // ----------------------------------------------------------------------- -IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, ) +IMPL_STATIC_LINK_NOINSTANCE( svp::PrinterUpdate, UpdateTimerHdl, void*, ) { if( nActiveJobs < 1 ) { @@ -1033,7 +1049,7 @@ IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, ) // ----------------------------------------------------------------------- -void vcl_sal::PrinterUpdate::update() +void svp::PrinterUpdate::update() { if( Application::GetSettings().GetMiscSettings().GetDisablePrinting() ) return; @@ -1053,14 +1069,19 @@ void vcl_sal::PrinterUpdate::update() { pPrinterUpdateTimer = new Timer(); pPrinterUpdateTimer->SetTimeout( 500 ); - pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, vcl_sal::PrinterUpdate, UpdateTimerHdl ) ); + pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, svp::PrinterUpdate, UpdateTimerHdl ) ); pPrinterUpdateTimer->Start(); } } +void SvpSalInstance::updatePrinterUpdate() +{ + svp::PrinterUpdate::update(); +} + // ----------------------------------------------------------------------- -void vcl_sal::PrinterUpdate::jobEnded() +void svp::PrinterUpdate::jobEnded() { nActiveJobs--; if( nActiveJobs < 1 ) @@ -1075,4 +1096,14 @@ void vcl_sal::PrinterUpdate::jobEnded() } } +void SvpSalInstance::jobStartedPrinterUpdate() +{ + svp::PrinterUpdate::jobStarted(); +} + +void SvpSalInstance::jobEndedPrinterUpdate() +{ + svp::PrinterUpdate::jobEnded(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx index b776e7c3e313..b10f7a1c4071 100644 --- a/vcl/unx/headless/svpprn.hxx +++ b/vcl/unx/headless/svpprn.hxx @@ -99,23 +99,6 @@ public: virtual ULONG GetErrorCode(); }; -class Timer; - -namespace vcl_sal { -class VCL_DLLPUBLIC PrinterUpdate -{ - static Timer* pPrinterUpdateTimer; - static int nActiveJobs; - - static void doUpdate(); - DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* ); -public: - static void update(); - static void jobStarted() { nActiveJobs++; } - static void jobEnded(); -}; -} - #endif // _SVP_SVPPRN_HXX |