printhelper.cxx (a628ea0e) | printhelper.cxx (3d720f72) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 46 unchanged lines hidden (view full) --- 55#include <sfx2/viewsh.hxx> 56#include <sfx2/dispatch.hxx> 57#include <sfx2/request.hxx> 58#include <sfx2/printer.hxx> 59#include <sfx2/app.hxx> 60#include <sfx2/objsh.hxx> 61#include <sfx2/event.hxx> 62 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 46 unchanged lines hidden (view full) --- 55#include <sfx2/viewsh.hxx> 56#include <sfx2/dispatch.hxx> 57#include <sfx2/request.hxx> 58#include <sfx2/printer.hxx> 59#include <sfx2/app.hxx> 60#include <sfx2/objsh.hxx> 61#include <sfx2/event.hxx> 62 |
63#define SFX_PRINTABLESTATE_CANCELJOB -2 64 |
|
63using namespace ::com::sun::star; 64using namespace ::com::sun::star::uno; 65 66struct IMPL_PrintListener_DataContainer : public SfxListener 67{ 68 SfxObjectShellRef m_pObjectShell; 69 ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer; 70 uno::Reference< com::sun::star::view::XPrintJob> m_xPrintJob; --- 67 unchanged lines hidden (view full) --- 138 Reference < view::XPrintable > xPrintable( m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->GetModel() : NULL, UNO_QUERY ); 139 return xPrintable; 140} 141 142void SAL_CALL SfxPrintJob_Impl::cancelJob() throw (RuntimeException) 143{ 144 // FIXME: how to cancel PrintJob via API?! 145 if( m_pData->m_pObjectShell.Is() ) | 65using namespace ::com::sun::star; 66using namespace ::com::sun::star::uno; 67 68struct IMPL_PrintListener_DataContainer : public SfxListener 69{ 70 SfxObjectShellRef m_pObjectShell; 71 ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer; 72 uno::Reference< com::sun::star::view::XPrintJob> m_xPrintJob; --- 67 unchanged lines hidden (view full) --- 140 Reference < view::XPrintable > xPrintable( m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->GetModel() : NULL, UNO_QUERY ); 141 return xPrintable; 142} 143 144void SAL_CALL SfxPrintJob_Impl::cancelJob() throw (RuntimeException) 145{ 146 // FIXME: how to cancel PrintJob via API?! 147 if( m_pData->m_pObjectShell.Is() ) |
146 m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( -2 ) ); | 148 m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( SFX_PRINTABLESTATE_CANCELJOB ) ); |
147} 148 149SfxPrintHelper::SfxPrintHelper() 150{ 151 m_pData = new IMPL_PrintListener_DataContainer(m_aMutex); 152} 153 154void SAL_CALL SfxPrintHelper::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) --- 628 unchanged lines hidden (view full) --- 783 } 784} 785 786void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 787{ 788 SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint ); 789 if ( &rBC != m_pObjectShell 790 || !pPrintHint | 149} 150 151SfxPrintHelper::SfxPrintHelper() 152{ 153 m_pData = new IMPL_PrintListener_DataContainer(m_aMutex); 154} 155 156void SAL_CALL SfxPrintHelper::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) --- 628 unchanged lines hidden (view full) --- 785 } 786} 787 788void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 789{ 790 SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint ); 791 if ( &rBC != m_pObjectShell 792 || !pPrintHint |
791 || pPrintHint->GetWhich() == -2 ) // -2 : CancelPrintJob | 793 || pPrintHint->GetWhich() == SFX_PRINTABLESTATE_CANCELJOB ) |
792 return; 793 794 if ( pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_STARTED ) 795 { 796 if ( !m_xPrintJob.is() ) 797 m_xPrintJob = new SfxPrintJob_Impl( this ); 798 m_aPrintOptions = pPrintHint->GetOptions(); 799 } --- 28 unchanged lines hidden --- | 794 return; 795 796 if ( pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_STARTED ) 797 { 798 if ( !m_xPrintJob.is() ) 799 m_xPrintJob = new SfxPrintJob_Impl( this ); 800 m_aPrintOptions = pPrintHint->GetOptions(); 801 } --- 28 unchanged lines hidden --- |