summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorPhilipp Lohmann <pl@openoffice.org>2009-06-17 14:07:26 +0000
committerPhilipp Lohmann <pl@openoffice.org>2009-06-17 14:07:26 +0000
commitc65c7c60ac0c12558f4fe96206b40f29ab41afb4 (patch)
treead49e7afb2b2faff6bfe8d0912c4c36d2ff112f9 /toolkit
parent47d8f3b65172271f386a64d1a983b46dd1de0e9f (diff)
#i92516# adapt old deprecated interface to new API
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/toolkit/awt/vclxprinter.hxx15
-rw-r--r--toolkit/source/awt/vclxprinter.cxx30
2 files changed, 19 insertions, 26 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxprinter.hxx b/toolkit/inc/toolkit/awt/vclxprinter.hxx
index e94864b51280..4db43a3c5d77 100644
--- a/toolkit/inc/toolkit/awt/vclxprinter.hxx
+++ b/toolkit/inc/toolkit/awt/vclxprinter.hxx
@@ -43,9 +43,7 @@
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
#include <cppuhelper/propshlp.hxx>
-class Printer;
-class String;
-
+#include "vcl/oldprintadaptor.hxx"
// Fuer den Drucker relevante Properties:
/*
@@ -65,20 +63,17 @@ class VCLXPrinterPropertySet : public ::com::sun::star::awt::XPrinterPropertySe
public MutexAndBroadcastHelper,
public ::cppu::OPropertySetHelper
{
-private:
- Printer* mpPrinter;
+protected:
+ boost::shared_ptr<Printer> mpPrinter;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice;
sal_Int16 mnOrientation;
sal_Bool mbHorizontal;
-
-protected:
-
public:
VCLXPrinterPropertySet( const String& rPrinterName );
virtual ~VCLXPrinterPropertySet();
- Printer* GetPrinter() const { return mpPrinter; }
+ Printer* GetPrinter() const { return mpPrinter.get(); }
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > GetDevice();
// ::com::sun::star::uno::XInterface
@@ -120,6 +115,8 @@ class VCLXPrinter: public ::com::sun::star::awt::XPrinter,
public VCLXPrinterPropertySet,
public ::cppu::OWeakObject
{
+ boost::shared_ptr<vcl::OldStylePrintAdaptor> mpListener;
+ JobSetup maInitJobSetup;
public:
VCLXPrinter( const String& rPrinterName );
~VCLXPrinter();
diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx
index a0d4de43fe0f..a8059463a297 100644
--- a/toolkit/source/awt/vclxprinter.cxx
+++ b/toolkit/source/awt/vclxprinter.cxx
@@ -102,10 +102,10 @@ IMPL_XTYPEPROVIDER_END
VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
: OPropertySetHelper( BrdcstHelper )
+ , mpPrinter( new Printer( rPrinterName ) )
{
osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
- mpPrinter = new Printer( rPrinterName );
mnOrientation = 0;
mbHorizontal = sal_False;
}
@@ -113,8 +113,7 @@ VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
VCLXPrinterPropertySet::~VCLXPrinterPropertySet()
{
osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
-
- delete mpPrinter;
+ mpPrinter.reset();
}
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice()
@@ -331,10 +330,10 @@ sal_Bool VCLXPrinter::start( const ::rtl::OUString& /*rJobName*/, sal_Int16 /*nC
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
sal_Bool bDone = sal_True;
- if ( GetPrinter() )
+ if ( mpListener.get() )
{
- // FIXME: adapt to new interface
- // bDone = GetPrinter()->StartJob( rJobName );
+ maInitJobSetup = mpPrinter->GetJobSetup();
+ mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
}
return bDone;
@@ -344,10 +343,10 @@ void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
- if ( GetPrinter() )
+ if ( mpListener.get() )
{
- // FIXME: adapt to new interface
- // GetPrinter()->EndJob();
+ Printer::PrintJob( mpListener, maInitJobSetup );
+ mpListener.reset();
}
}
@@ -355,18 +354,16 @@ void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
- if ( GetPrinter() )
- GetPrinter()->AbortJob();
+ mpListener.reset();
}
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
- if ( GetPrinter() )
+ if ( mpListener.get() )
{
- // FIXME: adapt to new interface
- // GetPrinter()->StartPage();
+ mpListener->StartPage();
}
return GetDevice();
}
@@ -375,10 +372,9 @@ void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::c
{
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
- if ( GetPrinter() )
+ if ( mpListener.get() )
{
- // FIXME: adapt to new interface
- // GetPrinter()->EndPage();
+ mpListener->EndPage();
}
}