Resolves: #i87883# add a PrinterServer.idl and fix impl

Change-Id: Id351109616737f916d7f4c2715347daa23367281
This commit is contained in:
Caolán McNamara
2013-05-18 12:38:01 +01:00
parent 01d839f257
commit 5ade04867f
4 changed files with 37 additions and 29 deletions

View File

@@ -25,11 +25,15 @@
#include <com/sun/star/awt/XPrinter.hpp>
#include <com/sun/star/awt/XPrinterServer.hpp>
#include <com/sun/star/awt/XInfoPrinter.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
#include <toolkit/helper/macros.hxx>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
#include <toolkit/helper/servicenames.hxx>
#include <cppuhelper/propshlp.hxx>
#include "vcl/oldprintadaptor.hxx"
@@ -190,30 +194,18 @@ public:
// class VCLXPrinterServer
// ----------------------------------------------------
class VCLXPrinterServer : public ::com::sun::star::awt::XPrinterServer,
public ::com::sun::star::lang::XTypeProvider,
public ::cppu::OWeakObject
class VCLXPrinterServer : public ::cppu::WeakImplHelper2<com::sun::star::awt::XPrinterServer,
com::sun::star::lang::XServiceInfo>
{
public:
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
void SAL_CALL release() throw() { OWeakObject::release(); }
// ::com::sun::star::lang::XTypeProvider
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::XPrinterServer
::com::sun::star::uno::Sequence< OUString > SAL_CALL getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > SAL_CALL createPrinter( const OUString& printerName ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > SAL_CALL createInfoPrinter( const OUString& printerName ) throw(::com::sun::star::uno::RuntimeException);
DECLIMPL_SERVICEINFO(VCLXPrinterServer, szServiceName2_PrinterServer);
};
#endif // _TOOLKIT_AWT_VCLXPRINTER_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1744,6 +1744,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\
PopupMenuDirection \
PosSize \
PrinterException \
PrinterServer \
PushButtonType \
RasterOperation \
Rectangle \

View File

@@ -0,0 +1,28 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef __com_sun_star_awt_PrinterServer_idl__
#define __com_sun_star_awt_PrinterServer_idl__
#include <com/sun/star/awt/XPrinterServer.idl>
module com { module sun { module star { module awt {
/** mechanism to discover and manage printers
*/
service PrinterServer
{
interface com::sun::star::awt::XPrinterServer;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -406,19 +406,6 @@ IMPL_XTYPEPROVIDER_END
// class VCLXPrinterServer
// ----------------------------------------------------
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any VCLXPrinterServer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
(static_cast< ::com::sun::star::awt::XPrinterServer* >(this)) );
return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
}
// ::com::sun::star::lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( VCLXPrinterServer )
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterServer>* ) NULL )
IMPL_XTYPEPROVIDER_END
// ::com::sun::star::awt::XPrinterServer
::com::sun::star::uno::Sequence< OUString > VCLXPrinterServer::getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException)
{