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