diff options
author | Martin Gallwey <mtg@openoffice.org> | 2001-11-15 19:25:26 +0000 |
---|---|---|
committer | Martin Gallwey <mtg@openoffice.org> | 2001-11-15 19:25:26 +0000 |
commit | 45b42b507a63e1b19472957d7ce2966cb6c9b640 (patch) | |
tree | 36c5fcbc1077fa4ed4b603dd257842790d8a04b7 | |
parent | 7fd18fef80d9ecb0b7550537b4490a987744676c (diff) |
#94679# support XServiceInfo and XTypeProvider
-rw-r--r-- | package/source/manifest/ManifestReader.cxx | 75 | ||||
-rw-r--r-- | package/source/manifest/ManifestReader.hxx | 53 | ||||
-rw-r--r-- | package/source/manifest/ManifestWriter.cxx | 69 | ||||
-rw-r--r-- | package/source/manifest/ManifestWriter.hxx | 52 |
4 files changed, 126 insertions, 123 deletions
diff --git a/package/source/manifest/ManifestReader.cxx b/package/source/manifest/ManifestReader.cxx index de1f73dd2..a17707615 100644 --- a/package/source/manifest/ManifestReader.cxx +++ b/package/source/manifest/ManifestReader.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ManifestReader.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mtg $ $Date: 2001-04-27 14:56:05 $ + * last change: $Author: mtg $ $Date: 2001-11-15 20:24:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -60,14 +60,14 @@ ************************************************************************/ #ifndef _MANIFEST_READER_HXX -#include "ManifestReader.hxx" +#include <ManifestReader.hxx> +#endif +#ifndef _MANIFEST_IMPORT_HXX +#include <ManifestImport.hxx> #endif #ifndef _CPPUHELPER_FACTORY_HXX_ #include <cppuhelper/factory.hxx> #endif -#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP -#include <com/sun/star/registry/XRegistryKey.hpp> -#endif #ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #endif @@ -77,11 +77,11 @@ #ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP #include <com/sun/star/xml/sax/XParser.hpp> #endif -#ifndef _VOS_DIAGNOSE_H_ -#include <vos/diagnose.hxx> +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #endif -#ifndef _MANIFEST_IMPORT_HXX -#include <ManifestImport.hxx> +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP +#include <com/sun/star/lang/XSingleServiceFactory.hpp> #endif #include <vector> @@ -103,29 +103,6 @@ ManifestReader::ManifestReader( const Reference < XMultiServiceFactory > & xNewF ManifestReader::~ManifestReader() { } -Any SAL_CALL ManifestReader::queryInterface( const Type& rType ) - throw(RuntimeException) -{ - return ::cppu::queryInterface ( rType , - // OWeakObject interfaces - reinterpret_cast< XInterface* > ( this ) , - static_cast< XWeak* > ( this ) , - // My own interfaces - static_cast< XManifestReader* > ( this ) ); - -} - -void SAL_CALL ManifestReader::acquire( ) - throw() -{ - OWeakObject::acquire(); -} -void SAL_CALL ManifestReader::release( ) - throw() -{ - OWeakObject::release(); -} - Sequence< Sequence< PropertyValue > > SAL_CALL ManifestReader::readManifestSequence( const Reference< XInputStream >& rStream ) throw (::com::sun::star::uno::RuntimeException) { @@ -168,28 +145,46 @@ Reference < XInterface > SAL_CALL ManifestReader_createInstance( Reference< XMul { return *new ManifestReader( rServiceFactory ); } +#define SERVICE_NAME "com.sun.star.packages.manifest.comp.ManifestReader" +OUString ManifestReader::static_getImplementationName() +{ + return OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); +} + +sal_Bool SAL_CALL ManifestReader::static_supportsService(OUString const & rServiceName) +{ + return rServiceName == getSupportedServiceNames()[0]; +} + +Sequence < OUString > ManifestReader::static_getSupportedServiceNames() +{ + Sequence < OUString > aNames(1); + aNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); + return aNames; +} +#undef SERVICE_NAME OUString ManifestReader::getImplementationName() + throw (RuntimeException) { - return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.comp.ManifestReader" ) ); + return static_getImplementationName(); } sal_Bool SAL_CALL ManifestReader::supportsService(OUString const & rServiceName) throw (RuntimeException) { - return rServiceName == getSupportedServiceNames()[0]; + return static_supportsService ( rServiceName ); } Sequence < OUString > ManifestReader::getSupportedServiceNames() + throw (RuntimeException) { - Sequence < OUString > aNames(1); - aNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.ManifestReader" ) ); - return aNames; + return static_getSupportedServiceNames(); } Reference < XSingleServiceFactory > ManifestReader::createServiceFactory( Reference < XMultiServiceFactory > const & rServiceFactory ) { return cppu::createSingleFactory (rServiceFactory, - getImplementationName(), + static_getImplementationName(), ManifestReader_createInstance, - getSupportedServiceNames()); + static_getSupportedServiceNames()); } diff --git a/package/source/manifest/ManifestReader.hxx b/package/source/manifest/ManifestReader.hxx index 40562c331..6019d874d 100644 --- a/package/source/manifest/ManifestReader.hxx +++ b/package/source/manifest/ManifestReader.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ManifestReader.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mtg $ $Date: 2001-04-19 14:09:35 $ + * last change: $Author: mtg $ $Date: 2001-11-15 20:24:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,42 +62,49 @@ #ifndef _MANIFEST_READER_HXX #define _MANIFEST_READER_HXX -#ifndef _CPPUHELPER_WEAK_HXX_ -#include <cppuhelper/weak.hxx> +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> #endif #ifndef _COM_SUN_STAR_PACKAGES_MANIFEST_XMANIFESTREADER_HPP #include <com/sun/star/packages/manifest/XManifestReader.hpp> #endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP -#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#ifndef _COM_SUN_STAR_LANG_XPSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> #endif -class ManifestReader: public ::cppu::OWeakObject, - public ::com::sun::star::packages::manifest::XManifestReader +namespace com { namespace sun { namespace star { + namespace lang { class XMultiServiceFactory; class XSingleServiceFactory; } +} } } + +class ManifestReader: public ::cppu::WeakImplHelper2 +< + ::com::sun::star::packages::manifest::XManifestReader, + ::com::sun::star::lang::XServiceInfo +> { -private: +protected: const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xFactory; public: ManifestReader( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xNewFactory ); - ~ManifestReader(); + virtual ~ManifestReader(); + // XManifestReader virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > SAL_CALL readManifestSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rStream ) throw (::com::sun::star::uno::RuntimeException); - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) - throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire( ) - throw(); - virtual void SAL_CALL release( ) - throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw (::com::sun::star::uno::RuntimeException); + // Component constructor - static ::rtl::OUString getImplementationName(); - static ::com::sun::star::uno::Sequence < ::rtl::OUString > getSupportedServiceNames(); + static ::rtl::OUString static_getImplementationName(); + static ::com::sun::star::uno::Sequence < ::rtl::OUString > static_getSupportedServiceNames(); static ::com::sun::star::uno::Reference < com::sun::star::lang::XSingleServiceFactory > createServiceFactory( com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory ); - virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & rServiceName) + virtual sal_Bool SAL_CALL static_supportsService(rtl::OUString const & rServiceName) throw (com::sun::star::uno::RuntimeException); }; #endif diff --git a/package/source/manifest/ManifestWriter.cxx b/package/source/manifest/ManifestWriter.cxx index 7897b9ef5..5a9fb7e64 100644 --- a/package/source/manifest/ManifestWriter.cxx +++ b/package/source/manifest/ManifestWriter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ManifestWriter.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mtg $ $Date: 2001-04-19 14:09:35 $ + * last change: $Author: mtg $ $Date: 2001-11-15 20:25:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,17 +68,17 @@ #ifndef _CPPUHELPER_FACTORY_HXX_ #include <cppuhelper/factory.hxx> #endif -#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP -#include <com/sun/star/registry/XRegistryKey.hpp> -#endif #ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP #include <com/sun/star/io/XActiveDataSource.hpp> #endif #ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #endif -#ifndef _VOS_DIAGNOSE_H_ -#include <vos/diagnose.hxx> +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP +#include <com/sun/star/lang/XSingleServiceFactory.hpp> #endif using namespace ::rtl; @@ -99,29 +99,6 @@ ManifestWriter::~ManifestWriter() { } -// XInterface methods -Any SAL_CALL ManifestWriter::queryInterface( const Type& rType ) - throw(RuntimeException) -{ - return ::cppu::queryInterface ( rType , - // OWeakObject interfaces - reinterpret_cast< XInterface* > ( this ) , - static_cast< XWeak* > ( this ) , - // My own interfaces - static_cast< XManifestWriter* > ( this ) ); - -} - -void SAL_CALL ManifestWriter::acquire( ) - throw() -{ - OWeakObject::acquire(); -} -void SAL_CALL ManifestWriter::release( ) - throw() -{ - OWeakObject::release(); -} // XManifestWriter methods void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStream >& rStream, const Sequence< Sequence< PropertyValue > >& rSequence ) throw (RuntimeException) @@ -143,26 +120,44 @@ Reference < XInterface > SAL_CALL ManifestWriter_createInstance( Reference< XMul return *new ManifestWriter( rServiceFactory ); } +#define SERVICE_NAME "com.sun.star.packages.manifest.comp.ManifestWriter" +OUString ManifestWriter::static_getImplementationName() +{ + return OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); +} + +sal_Bool SAL_CALL ManifestWriter::static_supportsService(OUString const & rServiceName) +{ + return rServiceName == getSupportedServiceNames()[0]; +} +Sequence < OUString > ManifestWriter::static_getSupportedServiceNames() +{ + Sequence < OUString > aNames(1); + aNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); + return aNames; +} +#undef SERVICE_NAME + OUString ManifestWriter::getImplementationName() + throw (RuntimeException) { - return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.comp.ManifestWriter" ) ); + return static_getImplementationName(); } sal_Bool SAL_CALL ManifestWriter::supportsService(OUString const & rServiceName) throw (RuntimeException) { - return rServiceName == getSupportedServiceNames()[0]; + return static_supportsService ( rServiceName ); } Sequence < OUString > ManifestWriter::getSupportedServiceNames() + throw (RuntimeException) { - Sequence < OUString > aNames(1); - aNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.ManifestWriter" ) ); - return aNames; + return static_getSupportedServiceNames(); } Reference < XSingleServiceFactory > ManifestWriter::createServiceFactory( Reference < XMultiServiceFactory > const & rServiceFactory ) { return cppu::createSingleFactory (rServiceFactory, - getImplementationName(), + static_getImplementationName(), ManifestWriter_createInstance, - getSupportedServiceNames()); + static_getSupportedServiceNames()); } diff --git a/package/source/manifest/ManifestWriter.hxx b/package/source/manifest/ManifestWriter.hxx index d58f549c1..20462d463 100644 --- a/package/source/manifest/ManifestWriter.hxx +++ b/package/source/manifest/ManifestWriter.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ManifestWriter.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mtg $ $Date: 2001-04-19 14:09:35 $ + * last change: $Author: mtg $ $Date: 2001-11-15 20:25:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,43 +62,49 @@ #ifndef _MANIFEST_WRITER_HXX #define _MANIFEST_WRITER_HXX -#ifndef _CPPUHELPER_WEAK_HXX_ -#include <cppuhelper/weak.hxx> +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> #endif #ifndef _COM_SUN_STAR_PACKAGES_MANIFEST_XMANIFESTWRITER_HPP #include <com/sun/star/packages/manifest/XManifestWriter.hpp> #endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP -#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#ifndef _COM_SUN_STAR_LANG_XPSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> #endif +namespace com { namespace sun { namespace star { + namespace lang { class XMultiServiceFactory; class XSingleServiceFactory; } +} } } -class ManifestWriter: public ::cppu::OWeakObject, - public ::com::sun::star::packages::manifest::XManifestWriter +class ManifestWriter: public ::cppu::WeakImplHelper2 +< + ::com::sun::star::packages::manifest::XManifestWriter, + ::com::sun::star::lang::XServiceInfo +> { -private: +protected: const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xFactory; public: ManifestWriter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xNewFactory ); - ~ManifestWriter(); + virtual ~ManifestWriter(); + // XManifestWriter virtual void SAL_CALL writeManifestSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& rSequence ) throw (::com::sun::star::uno::RuntimeException); - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) - throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire( ) - throw(); - virtual void SAL_CALL release( ) - throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw (::com::sun::star::uno::RuntimeException); + // Component constructor - static ::rtl::OUString getImplementationName(); - static ::com::sun::star::uno::Sequence < ::rtl::OUString > getSupportedServiceNames(); + static ::rtl::OUString static_getImplementationName(); + static ::com::sun::star::uno::Sequence < ::rtl::OUString > static_getSupportedServiceNames(); static ::com::sun::star::uno::Reference < com::sun::star::lang::XSingleServiceFactory > createServiceFactory( com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory ); - virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & rServiceName) + virtual sal_Bool SAL_CALL static_supportsService(rtl::OUString const & rServiceName) throw (com::sun::star::uno::RuntimeException); }; #endif |