[Libreoffice-commits] core.git: ucb/source

Norbert Thiebaud nthiebaud at gmail.com
Fri Mar 7 04:09:18 PST 2014


 ucb/source/ucp/ftp/ftpcontent.cxx         |  170 ++++++++++++----------
 ucb/source/ucp/ftp/ftpcontent.hxx         |  227 ++++++++++++++----------------
 ucb/source/ucp/ftp/ftpcontentprovider.cxx |  179 ++++++++++++++---------
 ucb/source/ucp/ftp/ftpcontentprovider.hxx |   60 ++++---
 4 files changed, 354 insertions(+), 282 deletions(-)

New commits:
commit b1995a2f2d193d12bf189dfcfa2e0fcaa415bbf6
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Mar 7 05:25:23 2014 -0600

    de-macroize ucb ftpcontent, ftpcontentprovider
    
    Change-Id: I61919d79ab847273d90c2845ae37f7edc4aa5044

diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index e4caebb..88641aa 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -80,54 +80,37 @@ using namespace com::sun::star::io;
 using namespace com::sun::star::sdbc;
 
 
-
-
-
-
 // Content Implementation.
 
-
-
-
 FTPContent::FTPContent( const Reference< XComponentContext >& rxContext,
                         FTPContentProvider* pProvider,
                         const Reference< XContentIdentifier >& Identifier,
                         const FTPURL& aFTPURL)
-    : ContentImplHelper(rxContext,pProvider,Identifier),
-      m_pFCP(pProvider),
-      m_aFTPURL(aFTPURL),
-      m_bInserted(false),
-      m_bTitleSet(false)
+    : ContentImplHelper(rxContext,pProvider,Identifier)
+    , m_pFCP(pProvider)
+    , m_aFTPURL(aFTPURL)
+    , m_bInserted(false)
+    , m_bTitleSet(false)
 {
 }
 
-
-
 FTPContent::FTPContent( const Reference< XComponentContext >& rxContext,
                         FTPContentProvider* pProvider,
                         const Reference< XContentIdentifier >& Identifier,
                         const ContentInfo& Info)
-    : ContentImplHelper(rxContext,pProvider,Identifier),
-      m_pFCP(pProvider),
-      m_aFTPURL(Identifier->getContentIdentifier(),
-                pProvider),
-      m_bInserted(true),
-      m_bTitleSet(false),
-      m_aInfo(Info)
+    : ContentImplHelper(rxContext,pProvider,Identifier)
+    , m_pFCP(pProvider)
+    , m_aFTPURL(Identifier->getContentIdentifier(), pProvider)
+    , m_bInserted(true)
+    , m_bTitleSet(false)
+    , m_aInfo(Info)
 {
 }
 
-
-
-
-
 FTPContent::~FTPContent()
 {
 }
 
-
-
-
 // XInterface methods.
 
 void SAL_CALL FTPContent::acquire()
@@ -158,37 +141,86 @@ css::uno::Any SAL_CALL FTPContent::queryInterface( const css::uno::Type & rType
 
 // XTypeProvider methods.
 
+css::uno::Sequence< sal_Int8 > SAL_CALL FTPContent::getImplementationId()
+    throw( css::uno::RuntimeException,
+           std::exception )
+{
+    static cppu::OImplementationId* pId = NULL;
+      if ( !pId )
+      {
+        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+          if ( !pId )
+          {
+              static cppu::OImplementationId id( false );
+              pId = &id;
+          }
+      }
+      return (*pId).getImplementationId();
+}
 
-
-XTYPEPROVIDER_IMPL_6( FTPContent,
-                          XTypeProvider,
-                          XServiceInfo,
-                          XContent,
-                      XCommandProcessor,
-                      XContentCreator,
-                      XChild);
+css::uno::Sequence< css::uno::Type > SAL_CALL FTPContent::getTypes()
+    throw( css::uno::RuntimeException,
+           std::exception )
+{
+    static cppu::OTypeCollection* pCollection = NULL;
+    if ( !pCollection )
+    {
+        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+        if ( !pCollection )
+        {
+            static cppu::OTypeCollection collection(
+                    getCppuType( static_cast< css::uno::Reference< XTypeProvider >*>(0) ),
+                    getCppuType( static_cast< css::uno::Reference< XServiceInfo>*> (0) ),
+                    getCppuType( static_cast< css::uno::Reference< XContent > *> (0)),
+                    getCppuType( static_cast< css::uno::Reference< XCommandProcessor >*> (0) ),
+                    getCppuType( static_cast< css::uno::Reference< XContentCreator >*> (0)),
+                    getCppuType( static_cast< css::uno::Reference< XChild >*> (0) )
+                );
+            pCollection = &collection;
+        }
+    }
+    return (*pCollection).getTypes();
+}
 
 
 
 // XServiceInfo methods.
 
+OUString SAL_CALL FTPContent::getImplementationName()
+    throw( css::uno::RuntimeException, std::exception )
+{
+    return getImplementationName_Static();
+}
 
+OUString FTPContent::getImplementationName_Static()
+{
+    return OUString( "com.sun.star.comp.FTPContent");
+}
 
-// needed, because the service shall not be creatable!!
-#undef XSERVICEINFO_CREATE_INSTANCE_IMPL
-#define XSERVICEINFO_CREATE_INSTANCE_IMPL( Class )
-
-XSERVICEINFO_IMPL_1( FTPContent,
-                     OUString( "com.sun.star.comp.FTPContent"),
-                     OUString( "com.sun.star.ucb.FTPContent"));
+sal_Bool SAL_CALL FTPContent::supportsService( const OUString& ServiceName )
+    throw( css::uno::RuntimeException, std::exception )
+{
+    return cppu::supportsService( this, ServiceName );
+}
 
+css::uno::Sequence< OUString > SAL_CALL FTPContent::getSupportedServiceNames()
+    throw( css::uno::RuntimeException, std::exception )
+{
+    return getSupportedServiceNames_Static();
+}
 
+css::uno::Sequence< OUString > FTPContent::getSupportedServiceNames_Static()
+{
+    css::uno::Sequence< OUString > aSNS( 1 );
+    aSNS.getArray()[ 0 ] = OUString( "com.sun.star.ucb.FTPContent");
+    return aSNS;
+}
 
 
 
-// XContent methods.
 
 
+// XContent methods.
 
 // virtual
 OUString SAL_CALL FTPContent::getContentType()
@@ -197,31 +229,21 @@ OUString SAL_CALL FTPContent::getContentType()
     return OUString(FTP_CONTENT_TYPE);
 }
 
-
-
-
 // XCommandProcessor methods.
 
-
-
-
 //virtual
 void SAL_CALL FTPContent::abort( sal_Int32 /*CommandId*/ )
     throw( RuntimeException, std::exception )
 {
 }
 
-
-
 /***************************************************************************/
 /*                                                                         */
 /*                     Internal implementation class.                      */
 /*                                                                         */
 /***************************************************************************/
 
-
-class ResultSetFactoryI
-    : public ResultSetFactory
+class ResultSetFactoryI : public ResultSetFactory
 {
 public:
 
@@ -260,14 +282,8 @@ public:
     std::vector<FTPDirentry>                        m_dirvec;
 };
 
-
-
-
-
 // XCommandProcessor methods.
 
-
-
 enum ACTION { NOACTION,
               THROWAUTHENTICATIONREQUEST,
               THROWACCESSDENIED,
@@ -277,26 +293,25 @@ enum ACTION { NOACTION,
               THROWNOFILE,
               THROWGENERAL };
 
-
 // virtual
-Any SAL_CALL FTPContent::execute(
-    const Command& aCommand,
-    sal_Int32 /*CommandId*/,
-    const Reference<
-    XCommandEnvironment >& Environment
-)
-    throw(
-        Exception,
-        CommandAbortedException,
-        RuntimeException, std::exception
-    )
+Any SAL_CALL FTPContent::execute( const Command& aCommand,
+                                  sal_Int32 /*CommandId*/,
+                                  const Reference<
+                                  XCommandEnvironment >& Environment)
+    throw( Exception,
+           CommandAbortedException,
+           RuntimeException,
+           std::exception)
 {
     ACTION action(NOACTION);
     Any aRet;
 
     while(true)
-        try {
-            if(action == THROWAUTHENTICATIONREQUEST) {
+    {
+        try
+        {
+            if(action == THROWAUTHENTICATIONREQUEST)
+            {
                 // try to get a continuation first
                 OUString aRealm,aPassword,aAccount;
                 m_pFCP->forHost(m_aFTPURL.host(),
@@ -606,7 +621,9 @@ Any SAL_CALL FTPContent::execute(
             }
 
             return aRet;
-        } catch(const curl_exception& e) {
+        }
+        catch(const curl_exception& e)
+        {
             if(e.code() == CURLE_COULDNT_CONNECT)
                 action = THROWINTERACTIVECONNECT;
             else if(e.code() == CURLE_COULDNT_RESOLVE_HOST )
@@ -626,6 +643,7 @@ Any SAL_CALL FTPContent::execute(
                 // nothing known about the cause of the error
                 action = THROWGENERAL;
         }
+    }
 }
 
 #define FTP_FILE OUString( "application/vnd.sun.staroffice.ftp-file")
diff --git a/ucb/source/ucp/ftp/ftpcontent.hxx b/ucb/source/ucp/ftp/ftpcontent.hxx
index 0cf88a9..84d76e2 100644
--- a/ucb/source/ucp/ftp/ftpcontent.hxx
+++ b/ucb/source/ucp/ftp/ftpcontent.hxx
@@ -25,7 +25,6 @@
 #include <com/sun/star/ucb/XContentCreator.hpp>
 #include "ftpurl.hxx"
 
-
 namespace com { namespace sun { namespace star { namespace beans {
     struct Property;
     struct PropertyValue;
@@ -39,135 +38,135 @@ namespace com { namespace sun { namespace star { namespace sdbc {
 namespace ftp
 {
 
+class FTPContentProvider;
 
-
-    class FTPContentProvider;
-
-
-
-    class FTPContent
-        : public ::ucbhelper::ContentImplHelper,
-          public com::sun::star::ucb::XContentCreator
-    {
-    public:
-
-        FTPContent( const ::com::sun::star::uno::Reference<
-                    ::com::sun::star::uno::XComponentContext >& rxContext,
-                    FTPContentProvider* pProvider,
-                    const ::com::sun::star::uno::Reference<
-                    ::com::sun::star::ucb::XContentIdentifier >& Identifier,
-                    const FTPURL& FtpUrl);
-
-        FTPContent( const ::com::sun::star::uno::Reference<
-                    ::com::sun::star::uno::XComponentContext >& rxContext,
-                    FTPContentProvider* pProvider,
-                    const ::com::sun::star::uno::Reference<
-                    ::com::sun::star::ucb::XContentIdentifier >& Identifier,
-                    const com::sun::star::ucb::ContentInfo& aInfo);
-
-
-        virtual ~FTPContent();
-
-        // XInterface
-        virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
-            throw( css::uno::RuntimeException, std::exception );
-        virtual void SAL_CALL acquire()
-            throw();
-        virtual void SAL_CALL release()
-            throw();
-
-        // XTypeProvider
-        XTYPEPROVIDER_DECL()
-
-        // XServiceInfo
-        XSERVICEINFO_DECL()
-
-        // XContent
-        virtual OUString SAL_CALL
-        getContentType()
-            throw( com::sun::star::uno::RuntimeException, std::exception );
-
-        // XCommandProcessor
-        virtual com::sun::star::uno::Any SAL_CALL
-        execute( const com::sun::star::ucb::Command& aCommand,
-                 sal_Int32 CommandId,
-                 const com::sun::star::uno::Reference<
-                 com::sun::star::ucb::XCommandEnvironment >& Environment )
-            throw( com::sun::star::uno::Exception,
-                   com::sun::star::ucb::CommandAbortedException,
-                   com::sun::star::uno::RuntimeException, std::exception );
-
-        virtual void SAL_CALL
-        abort(sal_Int32 CommandId)
-            throw( com::sun::star::uno::RuntimeException, std::exception);
-
-        // XContentCreator
-        virtual com::sun::star::uno::Sequence<
-        com::sun::star::ucb::ContentInfo > SAL_CALL
+class FTPContent : public ::ucbhelper::ContentImplHelper,
+                   public css::ucb::XContentCreator
+{
+public:
+
+    FTPContent( const css::uno::Reference<
+                css::uno::XComponentContext >& rxContext,
+                FTPContentProvider* pProvider,
+                const css::uno::Reference<
+                css::ucb::XContentIdentifier >& Identifier,
+                const FTPURL& FtpUrl);
+
+    FTPContent( const css::uno::Reference<
+                css::uno::XComponentContext >& rxContext,
+                FTPContentProvider* pProvider,
+                const css::uno::Reference<
+                css::ucb::XContentIdentifier >& Identifier,
+                const css::ucb::ContentInfo& aInfo);
+
+
+    virtual ~FTPContent();
+
+    // XInterface
+    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
+        throw( css::uno::RuntimeException, std::exception );
+    virtual void SAL_CALL acquire()
+        throw();
+    virtual void SAL_CALL release()
+        throw();
+
+    // XTypeProvider
+    virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+        throw( css::uno::RuntimeException,
+               std::exception );
+    virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
+        throw( css::uno::RuntimeException,
+                   std::exception );
+
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName()
+        throw( css::uno::RuntimeException, std::exception );
+    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
+        throw( css::uno::RuntimeException, std::exception );
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+        throw( css::uno::RuntimeException, std::exception );
+
+    static OUString getImplementationName_Static();
+    static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
+
+    static css::uno::Reference< css::lang::XSingleServiceFactory >
+    createServiceFactory( const css::uno::Reference<
+            css::lang::XMultiServiceFactory >& rxServiceMgr );
+
+    // XContent
+    virtual OUString SAL_CALL getContentType()
+        throw( css::uno::RuntimeException, std::exception );
+
+    // XCommandProcessor
+    virtual css::uno::Any SAL_CALL execute( const css::ucb::Command& aCommand,
+                                            sal_Int32 CommandId,
+                                            const css::uno::Reference<
+                                            css::ucb::XCommandEnvironment >& Environment )
+        throw( css::uno::Exception,
+               css::ucb::CommandAbortedException,
+               css::uno::RuntimeException, std::exception );
+
+    virtual void SAL_CALL abort(sal_Int32 CommandId)
+        throw( css::uno::RuntimeException, std::exception);
+
+    // XContentCreator
+    virtual css::uno::Sequence<
+        css::ucb::ContentInfo > SAL_CALL
         queryCreatableContentsInfo(  )
-            throw (com::sun::star::uno::RuntimeException, std::exception);
-
-        virtual com::sun::star::uno::Reference<
-        com::sun::star::ucb::XContent > SAL_CALL
-        createNewContent( const com::sun::star::ucb::ContentInfo& Info )
-            throw (com::sun::star::uno::RuntimeException, std::exception);
+            throw (css::uno::RuntimeException, std::exception);
 
-        // XChild
+    virtual css::uno::Reference<
+        css::ucb::XContent > SAL_CALL
+        createNewContent( const css::ucb::ContentInfo& Info )
+            throw (css::uno::RuntimeException, std::exception);
 
-        virtual ::com::sun::star::uno::Reference<
-        ::com::sun::star::uno::XInterface > SAL_CALL
-        getParent(  )
-            throw (::com::sun::star::uno::RuntimeException, std::exception);
+    // XChild
 
-        virtual void SAL_CALL
-        setParent( const ::com::sun::star::uno::Reference<
-                   ::com::sun::star::uno::XInterface >& Parent )
-            throw (::com::sun::star::lang::NoSupportException,
-                   ::com::sun::star::uno::RuntimeException, std::exception);
+    virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent(  )
+        throw (css::uno::RuntimeException, std::exception);
 
+    virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent )
+        throw (css::lang::NoSupportException,
+               css::uno::RuntimeException, std::exception);
 
-        static com::sun::star::uno::Sequence<
-        com::sun::star::ucb::ContentInfo >
-        queryCreatableContentsInfo_Static(  )
-            throw (com::sun::star::uno::RuntimeException);
+    static css::uno::Sequence< css::ucb::ContentInfo > queryCreatableContentsInfo_Static()
+        throw (css::uno::RuntimeException);
 
-    private:
+private:
 
-        FTPContentProvider *m_pFCP;
-        FTPURL              m_aFTPURL;
-        bool                m_bInserted;
-        bool                m_bTitleSet;
-        com::sun::star::ucb::ContentInfo m_aInfo;
+    FTPContentProvider *m_pFCP;
+    FTPURL              m_aFTPURL;
+    bool                m_bInserted;
+    bool                m_bTitleSet;
+    css::ucb::ContentInfo m_aInfo;
 
-        virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
-        getProperties( const com::sun::star::uno::Reference<
-                       com::sun::star::ucb::XCommandEnvironment > & xEnv );
+    virtual css::uno::Sequence< css::beans::Property >
+        getProperties( const css::uno::Reference<
+                       css::ucb::XCommandEnvironment > & xEnv );
 
 
-        virtual com::sun::star::uno::Sequence<
-        com::sun::star::ucb::CommandInfo>
-        getCommands(const com::sun::star::uno::Reference<
-                    com::sun::star::ucb::XCommandEnvironment > & xEnv);
+    virtual css::uno::Sequence< css::ucb::CommandInfo>
+        getCommands(const css::uno::Reference<
+                    css::ucb::XCommandEnvironment > & xEnv);
 
 
-        virtual OUString getParentURL();
+    virtual OUString getParentURL();
 
-        com::sun::star::uno::Reference<com::sun::star::sdbc::XRow>
+    css::uno::Reference<css::sdbc::XRow>
         getPropertyValues(
-            const com::sun::star::uno::Sequence<
-            com::sun::star::beans::Property>& seqProp,
-            const com::sun::star::uno::Reference<
-            com::sun::star::ucb::XCommandEnvironment >& Environment
-        );
-
-        com::sun::star::uno::Sequence<com::sun::star::uno::Any>
-        setPropertyValues(
-            const ::com::sun::star::uno::Sequence<
-            ::com::sun::star::beans::PropertyValue>& seqPropVal);
-
-        void insert(const com::sun::star::ucb::InsertCommandArgument&,
-                    const com::sun::star::uno::Reference<
-                    com::sun::star::ucb::XCommandEnvironment>&);
+                const css::uno::Sequence<
+                css::beans::Property>& seqProp,
+                const css::uno::Reference<
+                css::ucb::XCommandEnvironment >& Environment
+            );
+
+    css::uno::Sequence<css::uno::Any>
+        setPropertyValues( const css::uno::Sequence<
+                           css::beans::PropertyValue>& seqPropVal);
+
+    void insert(const css::ucb::InsertCommandArgument&,
+                const css::uno::Reference<
+                css::ucb::XCommandEnvironment>&);
     };
 
 }
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index 14d642c..0b2c578 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -31,7 +31,6 @@
 #include "ftpcontent.hxx"
 #include "ftploaderthread.hxx"
 
-
 using namespace ftp;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::container;
@@ -39,21 +38,12 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::ucb;
 using namespace com::sun::star::beans;
 
-
-
-
-
-
 // ContentProvider Implementation.
 
-
-
-
-FTPContentProvider::FTPContentProvider(
-    const Reference< XComponentContext >& rxContext)
-: ::ucbhelper::ContentProviderImplHelper(rxContext),
-  m_ftpLoaderThread(0),
-  m_pProxyDecider(0)
+FTPContentProvider::FTPContentProvider( const Reference< XComponentContext >& rxContext)
+    : ::ucbhelper::ContentProviderImplHelper(rxContext)
+    , m_ftpLoaderThread(0)
+    , m_pProxyDecider(0)
 {
 }
 
@@ -65,8 +55,6 @@ FTPContentProvider::~FTPContentProvider()
     delete m_pProxyDecider;
 }
 
-
-
 // XInterface methods.
 void SAL_CALL FTPContentProvider::acquire()
     throw()
@@ -84,57 +72,119 @@ css::uno::Any SAL_CALL FTPContentProvider::queryInterface( const css::uno::Type
     throw( css::uno::RuntimeException, std::exception )
 {
     css::uno::Any aRet = cppu::queryInterface( rType,
-    (static_cast< XTypeProvider* >(this)),
-    (static_cast< XServiceInfo* >(this)),
-    (static_cast< XContentProvider* >(this))
-                    );
+                                               (static_cast< XTypeProvider* >(this)),
+                                               (static_cast< XServiceInfo* >(this)),
+                                               (static_cast< XContentProvider* >(this))
+        );
     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
 }
 
 // XTypeProvider methods.
+css::uno::Sequence< sal_Int8 > SAL_CALL FTPContentProvider::getImplementationId()
+    throw( css::uno::RuntimeException,
+           std::exception )
+{
+    static cppu::OImplementationId* pId = NULL;
+      if ( !pId )
+      {
+        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+          if ( !pId )
+          {
+              static cppu::OImplementationId id( false );
+              pId = &id;
+          }
+      }
+      return (*pId).getImplementationId();
+}
 
-
-
-XTYPEPROVIDER_IMPL_3(FTPContentProvider,
-                     XTypeProvider,
-                     XServiceInfo,
-                     XContentProvider)
+css::uno::Sequence< css::uno::Type > SAL_CALL FTPContentProvider::getTypes()
+    throw( css::uno::RuntimeException,
+           std::exception )
+{
+    static cppu::OTypeCollection* pCollection = NULL;
+    if ( !pCollection )
+    {
+        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+        if ( !pCollection )
+        {
+            static cppu::OTypeCollection collection(
+                    getCppuType( static_cast< css::uno::Reference< XTypeProvider >*>(0) ),
+                    getCppuType( static_cast< css::uno::Reference< XServiceInfo>*> (0) ),
+                    getCppuType( static_cast< css::uno::Reference< XContentProvider>*> (0) )
+                );
+            pCollection = &collection;
+        }
+    }
+    return (*pCollection).getTypes();
+}
 
 
 
 // XServiceInfo methods.
 
+OUString SAL_CALL FTPContentProvider::getImplementationName()
+    throw( css::uno::RuntimeException, std::exception )
+{
+    return getImplementationName_Static();
+}
 
+OUString FTPContentProvider::getImplementationName_Static()
+{
+    return OUString("com.sun.star.comp.FTPContentProvider");
+}
 
-XSERVICEINFO_IMPL_1_CTX(
-    FTPContentProvider,
-    OUString("com.sun.star.comp.FTPContentProvider"),
-    OUString(FTP_CONTENT_PROVIDER_SERVICE_NAME));
-
-
-
-// Service factory implementation.
-
+sal_Bool SAL_CALL FTPContentProvider::supportsService( const OUString& ServiceName )
+    throw( css::uno::RuntimeException, std::exception )
+{
+    return cppu::supportsService( this, ServiceName );
+}
 
+css::uno::Sequence< OUString > SAL_CALL FTPContentProvider::getSupportedServiceNames()
+    throw( css::uno::RuntimeException, std::exception )
+{
+    return getSupportedServiceNames_Static();
+}
 
-ONE_INSTANCE_SERVICE_FACTORY_IMPL(FTPContentProvider);
+static css::uno::Reference< css::uno::XInterface > SAL_CALL
+FTPContentProvider_CreateInstance( const css::uno::Reference<
+                                   css::lang::XMultiServiceFactory> & rSMgr )
+    throw( css::uno::Exception )
+{
+    css::lang::XServiceInfo* pX = (css::lang::XServiceInfo*)
+        new FTPContentProvider( ucbhelper::getComponentContext(rSMgr) );
+    return css::uno::Reference< css::uno::XInterface >::query( pX );
+}
 
+css::uno::Sequence< OUString > FTPContentProvider::getSupportedServiceNames_Static()
+{
+    css::uno::Sequence< OUString > aSNS( 1 );
+    aSNS.getArray()[ 0 ] = OUString(FTP_CONTENT_PROVIDER_SERVICE_NAME);
+    return aSNS;
+}
 
+// Service factory implementation.
 
+css::uno::Reference< css::lang::XSingleServiceFactory >
+FTPContentProvider::createServiceFactory( const css::uno::Reference<
+            css::lang::XMultiServiceFactory >& rxServiceMgr )
+{
+    return css::uno::Reference<
+        css::lang::XSingleServiceFactory >(
+            cppu::createOneInstanceFactory(
+                rxServiceMgr,
+                FTPContentProvider::getImplementationName_Static(),
+                FTPContentProvider_CreateInstance,
+                FTPContentProvider::getSupportedServiceNames_Static() ) );
+}
 
 // XContentProvider methods.
 
-
-
 // virtual
-Reference<XContent> SAL_CALL
-FTPContentProvider::queryContent(
-    const Reference< XContentIdentifier >& xCanonicId
-)
-    throw(
-        IllegalIdentifierException,
-        RuntimeException, std::exception
-    )
+Reference<XContent> SAL_CALL FTPContentProvider::queryContent(
+        const Reference< XContentIdentifier >& xCanonicId)
+    throw( IllegalIdentifierException,
+           RuntimeException,
+           std::exception)
 {
     // Check, if a content with given id already exists...
     Reference<XContent> xContent = queryExistingContent(xCanonicId).get();
@@ -186,28 +236,24 @@ FTPContentProvider::queryContent(
     return xContent;
 }
 
-
-
-
-void FTPContentProvider::init() {
+void FTPContentProvider::init()
+{
     m_ftpLoaderThread = new FTPLoaderThread();
     m_pProxyDecider = new ucbhelper::InternetProxyDecider( m_xContext );
 }
 
-
-
-CURL* FTPContentProvider::handle() {
+CURL* FTPContentProvider::handle()
+{
     // Cannot be zero if called from here;
     return m_ftpLoaderThread->handle();
 }
 
 
-bool FTPContentProvider::forHost(
-    const OUString& host,
-    const OUString& port,
-    const OUString& username,
-    OUString& password,
-    OUString& account)
+bool FTPContentProvider::forHost( const OUString& host,
+                                  const OUString& port,
+                                  const OUString& username,
+                                  OUString& password,
+                                  OUString& account)
 {
     osl::MutexGuard aGuard(m_aMutex);
     for(unsigned int i = 0; i < m_ServerInfo.size(); ++i)
@@ -223,13 +269,11 @@ bool FTPContentProvider::forHost(
     return false;
 }
 
-
-bool  FTPContentProvider::setHost(
-    const OUString& host,
-    const OUString& port,
-    const OUString& username,
-    const OUString& password,
-    const OUString& account)
+bool  FTPContentProvider::setHost( const OUString& host,
+                                   const OUString& port,
+                                   const OUString& username,
+                                   const OUString& password,
+                                   const OUString& account)
 {
     ServerInfo inf;
     inf.host = host;
@@ -258,8 +302,7 @@ bool  FTPContentProvider::setHost(
 
 
 
-Reference<XContentProvider>
-FTPContentProvider::getHttpProvider()
+Reference<XContentProvider> FTPContentProvider::getHttpProvider()
     throw(RuntimeException)
 {
     // used for access to ftp-proxy
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.hxx b/ucb/source/ucp/ftp/ftpcontentprovider.hxx
index 565a79b..f75e3a7 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.hxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.hxx
@@ -22,7 +22,6 @@
 
 #include <vector>
 #include <osl/mutex.hxx>
-#include <ucbhelper/macros.hxx>
 #include <ucbhelper/proxydecider.hxx>
 #include <ucbhelper/providerhelper.hxx>
 #include <com/sun/star/ucb/XContentProviderManager.hpp>
@@ -35,50 +34,64 @@
 #define FTP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider"
 #define FTP_CONTENT_TYPE "application/ftp-content"
 
-
 /**
  *  Definition of ftpcontentprovider
  */
-
-
-
-namespace ftp {
-
-
+namespace ftp
+{
     class FTPLoaderThread;
 
-
     class FTPContentProvider:
         public ::ucbhelper::ContentProviderImplHelper,
         public FTPHandleProvider
     {
     public:
 
-        FTPContentProvider(
-            const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
+        FTPContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
 
         ~FTPContentProvider();
 
         // XInterface
         virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
-            throw( css::uno::RuntimeException, std::exception );
+            throw( css::uno::RuntimeException,
+                   std::exception );
         virtual void SAL_CALL acquire()
             throw();
         virtual void SAL_CALL release()
             throw();
 
         // XTypeProvider
-        XTYPEPROVIDER_DECL()
+        virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+            throw( css::uno::RuntimeException,
+                   std::exception );
+        virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
+            throw( css::uno::RuntimeException,
+                   std::exception );
 
         // XServiceInfo
-        XSERVICEINFO_DECL()
+        virtual OUString SAL_CALL getImplementationName()
+            throw( css::uno::RuntimeException,
+                   std::exception );
+        virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
+            throw( css::uno::RuntimeException,
+                   std::exception );
+        virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+            throw( css::uno::RuntimeException,
+                   std::exception );
+
+        static OUString getImplementationName_Static();
+        static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
+
+        static css::uno::Reference< css::lang::XSingleServiceFactory >
+        createServiceFactory( const css::uno::Reference<
+                              css::lang::XMultiServiceFactory >& rxServiceMgr );
 
         // XContentProvider
-        virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
-        queryContent(
-            const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier )
-            throw( com::sun::star::ucb::IllegalIdentifierException,
-                   com::sun::star::uno::RuntimeException, std::exception );
+        virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
+        queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier )
+            throw( css::ucb::IllegalIdentifierException,
+                   css::uno::RuntimeException,
+                   std::exception );
 
         // FTPHandleProvider.
 
@@ -96,8 +109,8 @@ namespace ftp {
                              const OUString& password,
                              const OUString& account);
 
-
-        struct ServerInfo {
+        struct ServerInfo
+        {
             OUString host;
             OUString port;
             OUString username;
@@ -114,9 +127,8 @@ namespace ftp {
 
         void init();
 
-        com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>
-        getHttpProvider()
-            throw(com::sun::star::uno::RuntimeException);
+        css::uno::Reference<css::ucb::XContentProvider> getHttpProvider()
+            throw(css::uno::RuntimeException);
 
     };  // end class FTPContentProvider
 


More information about the Libreoffice-commits mailing list