From 87dfa6dd336d596112c0beb6b42f082178461678 Mon Sep 17 00:00:00 2001 From: Ariel Constenla-Haile Date: Sun, 24 Feb 2013 18:23:21 +0000 Subject: Resolves: #i121810# Adapt SfxPrintingHint to work with... the "new" XDocumentEventBroadcaster (cherry picked from commit 1bfae56dd9d633a80924bfeefc03368100d75a8f) Conflicts: sfx2/inc/sfx2/event.hxx sfx2/source/view/viewprn.cxx Change-Id: I6b3e1edc396b82d85fe059e6cdf7ad0009d5b94b --- sfx2/source/doc/printhelper.cxx | 6 ++++-- sfx2/source/view/viewprn.cxx | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 1b00652fde04..c042c6e66356 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -54,6 +54,8 @@ #include #include +#define SFX_PRINTABLESTATE_CANCELJOB -2 + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -137,7 +139,7 @@ void SAL_CALL SfxPrintJob_Impl::cancelJob() throw (RuntimeException) { // FIXME: how to cancel PrintJob via API?! if( m_pData->m_pObjectShell.Is() ) - m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( -2 ) ); + m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( SFX_PRINTABLESTATE_CANCELJOB ) ); } SfxPrintHelper::SfxPrintHelper() @@ -792,7 +794,7 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint ); if ( &rBC != m_pObjectShell || !pPrintHint - || pPrintHint->GetWhich() == -2 ) // -2 : CancelPrintJob + || pPrintHint->GetWhich() == SFX_PRINTABLESTATE_CANCELJOB ) return; if ( pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_STARTED ) diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 0a9c080121c9..dab76f34b1f6 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -19,7 +19,6 @@ #include -#include #include "com/sun/star/view/XRenderable.hpp" #include @@ -55,7 +54,7 @@ using namespace com::sun::star; using namespace com::sun::star::uno; -TYPEINIT1(SfxPrintingHint, SfxHint); +TYPEINIT1(SfxPrintingHint, SfxViewEventHint); // ----------------------------------------------------------------------- class SfxPrinterController : public vcl::PrinterController, public SfxListener @@ -321,9 +320,15 @@ void SfxPrinterController::jobStarted() now.GetDay(), now.GetMonth(), now.GetYear() ) ); SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), mpObjectShell ) ); - // FIXME: how to get all print options incl. AdditionalOptions easily? uno::Sequence < beans::PropertyValue > aOpts; - mpObjectShell->Broadcast( SfxPrintingHint( view::PrintableState_JOB_STARTED, aOpts ) ); + aOpts = getJobProperties( aOpts ); + + uno::Reference< frame::XController2 > xController; + if ( mpViewShell ) + xController.set( mpViewShell->GetController(), uno::UNO_QUERY ); + + mpObjectShell->Broadcast( SfxPrintingHint( + view::PrintableState_JOB_STARTED, aOpts, mpObjectShell, xController ) ); } } -- cgit