vclxprinter.cxx (7cf0cab2) vclxprinter.cxx (05b7ab28)
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

--- 28 unchanged lines hidden (view full) ---

37#include <vcl/svapp.hxx>
38
39#include <tools/debug.hxx>
40#include <tools/stream.hxx>
41
42#include <toolkit/awt/vclxdevice.hxx>
43
44
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

--- 28 unchanged lines hidden (view full) ---

37#include <vcl/svapp.hxx>
38
39#include <tools/debug.hxx>
40#include <tools/stream.hxx>
41
42#include <toolkit/awt/vclxdevice.hxx>
43
44
45#define BINARYSETUPMARKER 0x23864691
45#define BINARYSETUPMARKER 0x23864691
46
46
47#define PROPERTY_Orientation 0
48#define PROPERTY_Horizontal 1
47#define PROPERTY_Orientation 0
48#define PROPERTY_Horizontal 1
49
50::com::sun::star::beans::Property* ImplGetProperties( sal_uInt16& rElementCount )
51{
49
50::com::sun::star::beans::Property* ImplGetProperties( sal_uInt16& rElementCount )
51{
52 static ::com::sun::star::beans::Property* pProperties = NULL;
53 static sal_uInt16 nElements = 0;
54 if( !pProperties )
55 {
56 ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
57 if( !pProperties )
58 {
59 static ::com::sun::star::beans::Property __FAR_DATA aPropTable[] =
60 {
61 ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Orientation" ), PROPERTY_Orientation, ::getCppuType((const sal_Int16*)0), 0 ),
62 ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Horizontal" ), PROPERTY_Horizontal, ::getBooleanCppuType(), 0 )
63 };
64 pProperties = aPropTable;
65 nElements = sizeof( aPropTable ) / sizeof( ::com::sun::star::beans::Property );
66 }
67 }
68 rElementCount = nElements;
69 return pProperties;
52 static ::com::sun::star::beans::Property* pProperties = NULL;
53 static sal_uInt16 nElements = 0;
54 if( !pProperties )
55 {
56 ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
57 if( !pProperties )
58 {
59 static ::com::sun::star::beans::Property __FAR_DATA aPropTable[] =
60 {
61 ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Orientation" ), PROPERTY_Orientation, ::getCppuType((const sal_Int16*)0), 0 ),
62 ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Horizontal" ), PROPERTY_Horizontal, ::getBooleanCppuType(), 0 )
63 };
64 pProperties = aPropTable;
65 nElements = sizeof( aPropTable ) / sizeof( ::com::sun::star::beans::Property );
66 }
67 }
68 rElementCount = nElements;
69 return pProperties;
70}
71
70}
71
72// ----------------------------------------------------
73// class VCLXPrinterPropertySet
74// ----------------------------------------------------
72// ----------------------------------------------------
73// class VCLXPrinterPropertySet
74// ----------------------------------------------------
75
76IMPLEMENT_FORWARD_XINTERFACE2( VCLXPrinterPropertySet, VCLXPrinterPropertySet_Base, OPropertySetHelper )
77IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXPrinterPropertySet, VCLXPrinterPropertySet_Base, ::cppu::OPropertySetHelper )
78
79VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
75
76IMPLEMENT_FORWARD_XINTERFACE2( VCLXPrinterPropertySet, VCLXPrinterPropertySet_Base, OPropertySetHelper )
77IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXPrinterPropertySet, VCLXPrinterPropertySet_Base, ::cppu::OPropertySetHelper )
78
79VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
80 : OPropertySetHelper( BrdcstHelper )
80 : OPropertySetHelper( BrdcstHelper )
81 , mpPrinter( new Printer( rPrinterName ) )
82{
81 , mpPrinter( new Printer( rPrinterName ) )
82{
83 osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
83 osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
84
84
85 mnOrientation = 0;
86 mbHorizontal = sal_False;
85 mnOrientation = 0;
86 mbHorizontal = sal_False;
87}
88
89VCLXPrinterPropertySet::~VCLXPrinterPropertySet()
90{
87}
88
89VCLXPrinterPropertySet::~VCLXPrinterPropertySet()
90{
91 osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
91 osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
92 mpPrinter.reset();
93}
94
95::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice()
96{
92 mpPrinter.reset();
93}
94
95::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice()
96{
97 if ( !mxPrnDevice.is() )
98 {
99 VCLXDevice* pDev = new VCLXDevice;
100 pDev->SetOutputDevice( GetPrinter() );
101 mxPrnDevice = pDev;
102 }
103 return mxPrnDevice;
97 if ( !mxPrnDevice.is() )
98 {
99 VCLXDevice* pDev = new VCLXDevice;
100 pDev->SetOutputDevice( GetPrinter() );
101 mxPrnDevice = pDev;
102 }
103 return mxPrnDevice;
104}
105
106::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXPrinterPropertySet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
107{
104}
105
106::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXPrinterPropertySet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
107{
108 static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
109 return xInfo;
108 static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
109 return xInfo;
110}
111
112::cppu::IPropertyArrayHelper& VCLXPrinterPropertySet::getInfoHelper()
113{
110}
111
112::cppu::IPropertyArrayHelper& VCLXPrinterPropertySet::getInfoHelper()
113{
114 static ::cppu::OPropertyArrayHelper* pPropertyArrayHelper = NULL;
115 if ( !pPropertyArrayHelper )
116 {
117 ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
118 if( !pPropertyArrayHelper )
119 {
120 sal_uInt16 nElements;
121 ::com::sun::star::beans::Property* pProps = ImplGetProperties( nElements );
122 pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( pProps, nElements, sal_False );
123 }
124 }
125 return *pPropertyArrayHelper ;
114 static ::cppu::OPropertyArrayHelper* pPropertyArrayHelper = NULL;
115 if ( !pPropertyArrayHelper )
116 {
117 ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
118 if( !pPropertyArrayHelper )
119 {
120 sal_uInt16 nElements;
121 ::com::sun::star::beans::Property* pProps = ImplGetProperties( nElements );
122 pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( pProps, nElements, sal_False );
123 }
124 }
125 return *pPropertyArrayHelper ;
126}
127
128sal_Bool VCLXPrinterPropertySet::convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException)
129{
126}
127
128sal_Bool VCLXPrinterPropertySet::convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException)
129{
130 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
131
132 sal_Bool bDifferent = sal_False;
133 switch ( nHandle )
134 {
135 case PROPERTY_Orientation:
136 {
137 sal_Int16 n;
138 if( ( rValue >>= n ) && ( n != mnOrientation ) )
139 {
140 rConvertedValue <<= n;
141 rOldValue <<= mnOrientation;
142 bDifferent = sal_True;
143 }
144 }
145 break;
146 case PROPERTY_Horizontal:
147 {
148 sal_Bool b;
149 if( ( rValue >>= b ) && ( b != mbHorizontal ) )
150 {
151 rConvertedValue <<= b;
152 rOldValue <<= mbHorizontal;
153 bDifferent = sal_True;
154 }
155 }
156 break;
157 default:
158 {
159 DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
160 }
161 }
162 return bDifferent;
130 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
131
132 sal_Bool bDifferent = sal_False;
133 switch ( nHandle )
134 {
135 case PROPERTY_Orientation:
136 {
137 sal_Int16 n;
138 if( ( rValue >>= n ) && ( n != mnOrientation ) )
139 {
140 rConvertedValue <<= n;
141 rOldValue <<= mnOrientation;
142 bDifferent = sal_True;
143 }
144 }
145 break;
146 case PROPERTY_Horizontal:
147 {
148 sal_Bool b;
149 if( ( rValue >>= b ) && ( b != mbHorizontal ) )
150 {
151 rConvertedValue <<= b;
152 rOldValue <<= mbHorizontal;
153 bDifferent = sal_True;
154 }
155 }
156 break;
157 default:
158 {
159 DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
160 }
161 }
162 return bDifferent;
163}
164
165void VCLXPrinterPropertySet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
166{
163}
164
165void VCLXPrinterPropertySet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
166{
167 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
168
169 switch( nHandle )
170 {
171 case PROPERTY_Orientation:
172 {
173 rValue >>= mnOrientation;
174 }
175 break;
176 case PROPERTY_Horizontal:
177 {
178 rValue >>= mbHorizontal;
179 }
180 break;
181 default:
182 {
183 DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
184 }
185 }
167 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
168
169 switch( nHandle )
170 {
171 case PROPERTY_Orientation:
172 {
173 rValue >>= mnOrientation;
174 }
175 break;
176 case PROPERTY_Horizontal:
177 {
178 rValue >>= mbHorizontal;
179 }
180 break;
181 default:
182 {
183 DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
184 }
185 }
186}
187
188void VCLXPrinterPropertySet::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const
189{
186}
187
188void VCLXPrinterPropertySet::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const
189{
190 ::osl::Guard< ::osl::Mutex > aGuard( ((VCLXPrinterPropertySet*)this)->Mutex );
191
192 switch( nHandle )
193 {
194 case PROPERTY_Orientation:
195 rValue <<= mnOrientation;
196 break;
197 case PROPERTY_Horizontal:
198 rValue <<= mbHorizontal;
199 break;
200 default:
201 {
202 DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
203 }
204 }
190 ::osl::Guard< ::osl::Mutex > aGuard( ((VCLXPrinterPropertySet*)this)->Mutex );
191
192 switch( nHandle )
193 {
194 case PROPERTY_Orientation:
195 rValue <<= mnOrientation;
196 break;
197 case PROPERTY_Horizontal:
198 rValue <<= mbHorizontal;
199 break;
200 default:
201 {
202 DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
203 }
204 }
205}
206
207// ::com::sun::star::awt::XPrinterPropertySet
208void VCLXPrinterPropertySet::setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
209{
205}
206
207// ::com::sun::star::awt::XPrinterPropertySet
208void VCLXPrinterPropertySet::setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
209{
210 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
210 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
211
211
212 ::com::sun::star::uno::Any aValue;
213 aValue <<= bHorizontal;
214 setFastPropertyValue( PROPERTY_Horizontal, aValue );
212 ::com::sun::star::uno::Any aValue;
213 aValue <<= bHorizontal;
214 setFastPropertyValue( PROPERTY_Horizontal, aValue );
215}
216
217::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterPropertySet::getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException)
218{
215}
216
217::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterPropertySet::getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException)
218{
219 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
220
221 sal_uInt16 nPaperBinCount = GetPrinter()->GetPaperBinCount();
222 ::com::sun::star::uno::Sequence< ::rtl::OUString > aDescriptions( nPaperBinCount );
223 for ( sal_uInt16 n = 0; n < nPaperBinCount; n++ )
224 {
225 // Format: <DisplayFormName;FormNameId;DisplayPaperBinName;PaperBinNameId;DisplayPaperName;PaperNameId>
226 String aDescr( RTL_CONSTASCII_USTRINGPARAM( "*;*;" ) );
227 aDescr += GetPrinter()->GetPaperBinName( n );
228 aDescr += ';';
229 aDescr += n;
230 aDescr.AppendAscii( ";*;*", 4 );
219 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
231
220
232 aDescriptions.getArray()[n] = aDescr;
233 }
234 return aDescriptions;
221 sal_uInt16 nPaperBinCount = GetPrinter()->GetPaperBinCount();
222 ::com::sun::star::uno::Sequence< ::rtl::OUString > aDescriptions( nPaperBinCount );
223 for ( sal_uInt16 n = 0; n < nPaperBinCount; n++ )
224 {
225 // Format: <DisplayFormName;FormNameId;DisplayPaperBinName;PaperBinNameId;DisplayPaperName;PaperNameId>
226 String aDescr( RTL_CONSTASCII_USTRINGPARAM( "*;*;" ) );
227 aDescr += GetPrinter()->GetPaperBinName( n );
228 aDescr += ';';
229 aDescr += n;
230 aDescr.AppendAscii( ";*;*", 4 );
231
232 aDescriptions.getArray()[n] = aDescr;
233 }
234 return aDescriptions;
235}
236
237void VCLXPrinterPropertySet::selectForm( const ::rtl::OUString& rFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
238{
235}
236
237void VCLXPrinterPropertySet::selectForm( const ::rtl::OUString& rFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
238{
239 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
240
239 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
240
241 sal_Int32 nIndex = 0;
241 sal_Int32 nIndex = 0;
242 sal_uInt16 nPaperBin = sal::static_int_cast< sal_uInt16 >(
242 sal_uInt16 nPaperBin = sal::static_int_cast< sal_uInt16 >(
243 rFormDescription.getToken( 3, ';', nIndex ).toInt32());
243 rFormDescription.getToken( 3, ';', nIndex ).toInt32());
244 GetPrinter()->SetPaperBin( nPaperBin );
244 GetPrinter()->SetPaperBin( nPaperBin );
245}
246
247::com::sun::star::uno::Sequence< sal_Int8 > VCLXPrinterPropertySet::getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException)
248{
245}
246
247::com::sun::star::uno::Sequence< sal_Int8 > VCLXPrinterPropertySet::getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException)
248{
249 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
250
251 SvMemoryStream aMem;
252 aMem << BINARYSETUPMARKER;
253 aMem << GetPrinter()->GetJobSetup();
254 return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
249 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
250
251 SvMemoryStream aMem;
252 aMem << BINARYSETUPMARKER;
253 aMem << GetPrinter()->GetJobSetup();
254 return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
255}
256
257void VCLXPrinterPropertySet::setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
258{
255}
256
257void VCLXPrinterPropertySet::setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
258{
259 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
260
261 SvMemoryStream aMem( (char*) data.getConstArray(), data.getLength(), STREAM_READ );
262 sal_uInt32 nMarker;
263 aMem >> nMarker;
264 DBG_ASSERT( nMarker == BINARYSETUPMARKER, "setBinarySetup - invalid!" );
265 if ( nMarker == BINARYSETUPMARKER )
266 {
267 JobSetup aSetup;
268 aMem >> aSetup;
269 GetPrinter()->SetJobSetup( aSetup );
270 }
259 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
260
261 SvMemoryStream aMem( (char*) data.getConstArray(), data.getLength(), STREAM_READ );
262 sal_uInt32 nMarker;
263 aMem >> nMarker;
264 DBG_ASSERT( nMarker == BINARYSETUPMARKER, "setBinarySetup - invalid!" );
265 if ( nMarker == BINARYSETUPMARKER )
266 {
267 JobSetup aSetup;
268 aMem >> aSetup;
269 GetPrinter()->SetJobSetup( aSetup );
270 }
271}
272
273
271}
272
273
274// ----------------------------------------------------
275// class VCLXPrinter
276// ----------------------------------------------------
277VCLXPrinter::VCLXPrinter( const String& rPrinterName )
278 : VCLXPrinter_Base( rPrinterName )
274// ----------------------------------------------------
275// class VCLXPrinter
276// ----------------------------------------------------
277VCLXPrinter::VCLXPrinter( const String& rPrinterName )
278 : VCLXPrinter_Base( rPrinterName )
279{
280}
281
282VCLXPrinter::~VCLXPrinter()
283{
284}
285
286sal_Bool VCLXPrinter::start( const ::rtl::OUString& /*rJobName*/, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
287{
279{
280}
281
282VCLXPrinter::~VCLXPrinter()
283{
284}
285
286sal_Bool VCLXPrinter::start( const ::rtl::OUString& /*rJobName*/, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
287{
288 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
289
290 sal_Bool bDone = sal_True;
291 if ( mpListener.get() )
288 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
289
290 sal_Bool bDone = sal_True;
291 if ( mpListener.get() )
292 {
293 maInitJobSetup = mpPrinter->GetJobSetup();
294 mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
295 }
292 {
293 maInitJobSetup = mpPrinter->GetJobSetup();
294 mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
295 }
296
297 return bDone;
296
297 return bDone;
298}
299
300void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
301{
298}
299
300void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
301{
302 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
303
304 if ( mpListener.get() )
302 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
303
304 if ( mpListener.get() )
305 {
306 Printer::PrintJob( mpListener, maInitJobSetup );
307 mpListener.reset();
308 }
309}
310
311void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException)
312{
305 {
306 Printer::PrintJob( mpListener, maInitJobSetup );
307 mpListener.reset();
308 }
309}
310
311void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException)
312{
313 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
313 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
314
314
315 mpListener.reset();
315 mpListener.reset();
316}
317
318::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
319{
316}
317
318::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
319{
320 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
321
322 if ( mpListener.get() )
320 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
321
322 if ( mpListener.get() )
323 {
324 mpListener->StartPage();
325 }
323 {
324 mpListener->StartPage();
325 }
326 return GetDevice();
326 return GetDevice();
327}
328
329void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
330{
327}
328
329void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
330{
331 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
332
333 if ( mpListener.get() )
331 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
332
333 if ( mpListener.get() )
334 {
335 mpListener->EndPage();
336 }
337}
338
339
334 {
335 mpListener->EndPage();
336 }
337}
338
339
340// ----------------------------------------------------
341// class VCLXInfoPrinter
342// ----------------------------------------------------
340// ----------------------------------------------------
341// class VCLXInfoPrinter
342// ----------------------------------------------------
343
343
344VCLXInfoPrinter::VCLXInfoPrinter( const String& rPrinterName )
345 : VCLXInfoPrinter_Base( rPrinterName )
344VCLXInfoPrinter::VCLXInfoPrinter( const String& rPrinterName )
345 : VCLXInfoPrinter_Base( rPrinterName )
346{
347}
348
349VCLXInfoPrinter::~VCLXInfoPrinter()
350{
351}
352
353// ::com::sun::star::awt::XInfoPrinter
354::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXInfoPrinter::createDevice( ) throw(::com::sun::star::uno::RuntimeException)
355{
346{
347}
348
349VCLXInfoPrinter::~VCLXInfoPrinter()
350{
351}
352
353// ::com::sun::star::awt::XInfoPrinter
354::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXInfoPrinter::createDevice( ) throw(::com::sun::star::uno::RuntimeException)
355{
356 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
357
358 return GetDevice();
356 ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
357
358 return GetDevice();
359}
360
359}
360
361// ----------------------------------------------------
362// class VCLXPrinterServer
363// ----------------------------------------------------
361// ----------------------------------------------------
362// class VCLXPrinterServer
363// ----------------------------------------------------
364
365// ::com::sun::star::awt::XPrinterServer
366::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterServer::getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException)
367{
368 const std::vector<rtl::OUString>& rQueues = Printer::GetPrinterQueues();
364
365// ::com::sun::star::awt::XPrinterServer
366::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterServer::getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException)
367{
368 const std::vector<rtl::OUString>& rQueues = Printer::GetPrinterQueues();
369 sal_uInt32 nPrinters = rQueues.size();
369 sal_uInt32 nPrinters = rQueues.size();
370
370
371 ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( nPrinters );
372 for ( sal_uInt32 n = 0; n < nPrinters; n++ )
373 aNames.getArray()[n] = rQueues[n];
374
375 return aNames;
371 ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( nPrinters );
372 for ( sal_uInt32 n = 0; n < nPrinters; n++ )
373 aNames.getArray()[n] = rQueues[n];
374
375 return aNames;
376}
377
378::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > VCLXPrinterServer::createPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
379{
376}
377
378::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > VCLXPrinterServer::createPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
379{
380 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > xP;
381 xP = new VCLXPrinter( rPrinterName );
382 return xP;
380 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > xP;
381 xP = new VCLXPrinter( rPrinterName );
382 return xP;
383}
384
385::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > VCLXPrinterServer::createInfoPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
386{
383}
384
385::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > VCLXPrinterServer::createInfoPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
386{
387 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > xP;
388 xP = new VCLXInfoPrinter( rPrinterName );
389 return xP;
387 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > xP;
388 xP = new VCLXInfoPrinter( rPrinterName );
389 return xP;
390}
391
392
390}
391
392