[Libreoffice-commits] .: 5 commits - libcmis/ExternalLib_libcmis.mk libcmis/Makefile libcmis/Module_libcmis.mk libcmis/prj offapi/com offapi/UnoApi_offapi.mk officecfg/registry postprocess/packcomponents scp2/source solenv/inc svtools/source tools/CppunitTest_tools_test.mk tools/inc tools/qa tools/source ucbhelper/inc ucbhelper/Library_ucbhelper.mk ucbhelper/Package_inc.mk ucbhelper/source ucb/prj ucb/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Sat Oct 1 07:20:23 PDT 2011


 libcmis/ExternalLib_libcmis.mk                               |   33 
 libcmis/Makefile                                             |   38 
 libcmis/Module_libcmis.mk                                    |   35 
 libcmis/prj/build.lst                                        |    2 
 libcmis/prj/makefile.mk                                      |   40 
 offapi/UnoApi_offapi.mk                                      |    1 
 offapi/com/sun/star/ucb/CmisContentProvider.idl              |   57 
 officecfg/registry/data/org/openoffice/ucb/Configuration.xcu |   11 
 postprocess/packcomponents/makefile.mk                       |    1 
 scp2/source/ooo/file_library_ooo.scp                         |   21 
 scp2/source/ooo/module_hidden_ooo.scp                        |    1 
 solenv/inc/libs.mk                                           |    1 
 svtools/source/config/colorcfg.cxx                           |    2 
 tools/CppunitTest_tools_test.mk                              |    1 
 tools/inc/tools/urlobj.hxx                                   |    3 
 tools/qa/urlobj/tools_urlobj_test.cxx                        |  380 +++---
 tools/source/fsys/urlobj.cxx                                 |    6 
 ucb/prj/build.lst                                            |    3 
 ucb/prj/d.lst                                                |    1 
 ucb/source/ucp/cmis/cmis_content.cxx                         |  683 +++++++++++
 ucb/source/ucp/cmis/cmis_content.hxx                         |  181 ++
 ucb/source/ucp/cmis/cmis_provider.cxx                        |  127 ++
 ucb/source/ucp/cmis/cmis_provider.hxx                        |   67 +
 ucb/source/ucp/cmis/cmis_url.cxx                             |   94 +
 ucb/source/ucp/cmis/cmis_url.hxx                             |   56 
 ucb/source/ucp/cmis/makefile.mk                              |   72 +
 ucb/source/ucp/cmis/ucpcmis.component                        |   34 
 ucb/source/ucp/cmis/ucpcmis.xml                              |  126 ++
 ucb/source/ucp/ftp/ftpcfunc.cxx                              |    1 
 ucb/source/ucp/ftp/ftpcontent.cxx                            |    6 
 ucb/source/ucp/ftp/ftpinpstr.cxx                             |  208 ---
 ucb/source/ucp/ftp/ftpinpstr.hxx                             |  154 --
 ucb/source/ucp/ftp/ftpurl.cxx                                |    1 
 ucb/source/ucp/ftp/makefile.mk                               |    1 
 ucb/source/ucp/gio/gio_content.cxx                           |    1 
 ucbhelper/Library_ucbhelper.mk                               |    1 
 ucbhelper/Package_inc.mk                                     |    1 
 ucbhelper/inc/ucbhelper/fd_inputstream.hxx                   |  157 ++
 ucbhelper/source/provider/fd_inputstream.cxx                 |  203 +++
 39 files changed, 2284 insertions(+), 527 deletions(-)

New commits:
commit 14a03abcd32800b52e900c405673c5b864e994a6
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Sat Oct 1 15:54:09 2011 +0200

    CMIS UCP: get the document content stream

diff --git a/libcmis/ExternalLib_libcmis.mk b/libcmis/ExternalLib_libcmis.mk
index 88d981d..5f912e1 100644
--- a/libcmis/ExternalLib_libcmis.mk
+++ b/libcmis/ExternalLib_libcmis.mk
@@ -28,6 +28,6 @@
 
 $(eval $(call gb_ExternalLib_ExternalLib,libcmis,autotools))
 
-$(eval $(call gb_ExternalLib_set_src_package,libcmis,b9ac948fed0a9a5dd083160119c0b0b3-libcmis-0.1.0.tar.gz))
+$(eval $(call gb_ExternalLib_set_src_package,libcmis,51eba115d4b25b5db571e385c1395ac8-libcmis-0.1.0.tar.gz))
 
 # vim: set noet sw=4 ts=4:
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 31f49a9..d72041e 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -31,18 +31,29 @@
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
 #include <com/sun/star/ucb/ContentInfoAttribute.hpp>
 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
+#include <com/sun/star/ucb/OpenMode.hpp>
+#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
+#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
 #include <com/sun/star/ucb/XCommandInfo.hpp>
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+
+#include <libcmis/document.hxx>
 
 #include <ucbhelper/cancelcommandexecution.hxx>
 #include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/fd_inputstream.hxx>
 #include <ucbhelper/propertyvalueset.hxx>
 
 #include "cmis_content.hxx"
 #include "cmis_provider.hxx"
+#include "cmis_url.hxx"
+
 
 using namespace com::sun::star;
+using namespace std;
 
 namespace cmis
 {
@@ -50,12 +61,20 @@ namespace cmis
         ContentProvider *pProvider, const uno::Reference< ucb::XContentIdentifier >& Identifier)
             throw ( ucb::ContentCreationException )
         : ContentImplHelper( rxSMgr, pProvider, Identifier ),
-        m_pProvider( pProvider )
+        m_pProvider( pProvider ),
+        m_pSession( NULL )
     {
 #if OSL_DEBUG_LEVEL > 1
-    fprintf(stderr, "TODO - New Content ('%s')\n", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
+    fprintf(stderr, "New Content ('%s')\n", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
 #endif
-        // TODO Implement me
+        // Split the URL into bits
+        cmis::URL url( m_xIdentifier->getContentIdentifier() );
+
+        // Initiate a CMIS session
+        m_pSession = libcmis::SessionFactory::createSession( url.getSessionParams( ) );
+
+        // Get the content Object
+        m_pObject = m_pSession->getObject( url.getObjectId() );
     }
 
     Content::Content( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider,
@@ -63,7 +82,8 @@ namespace cmis
         sal_Bool /*bIsFolder*/)
             throw ( ucb::ContentCreationException )
         : ContentImplHelper( rxSMgr, pProvider, Identifier ),
-        m_pProvider( pProvider )
+        m_pProvider( pProvider ),
+        m_pSession( NULL )
     {
 #if OSL_DEBUG_LEVEL > 1
     fprintf(stderr, "TODO - Create Content ('%s')\n", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
@@ -73,21 +93,12 @@ namespace cmis
 
     Content::~Content()
     {
-#if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "TODO - cmis::Content::~Content()\n" );
-#endif
-        // TODO Implement me
+        delete m_pSession;
     }
 
     bool Content::isFolder(const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/)
     {
-        bool bRet = false;
-#if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "TODO - cmis::Content::isFolder()\n" );
-#endif
-        // TODO Implement me
-
-        return bRet;
+        return m_pObject->getBaseType( ) == "cmis::folder";
     }
 
     uno::Any Content::getBadArgExcept()
@@ -98,17 +109,75 @@ namespace cmis
     }
 
     uno::Reference< sdbc::XRow > Content::getPropertyValues(
-            const uno::Sequence< beans::Property >& /*rProperties*/,
+            const uno::Sequence< beans::Property >& rProperties,
             const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/ )
     {
-        uno::Reference< sdbc::XRow > rRow;
-
 #if OSL_DEBUG_LEVEL > 1
         fprintf( stderr, "TODO - cmis::Content::getPropertyValues()\n" );
 #endif
-        // TODO Implement me
+        rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( m_xSMgr );
 
-        return rRow;
+        sal_Int32 nProps;
+        const beans::Property* pProps;
+
+        nProps = rProperties.getLength();
+        pProps = rProperties.getConstArray();
+
+        for( sal_Int32 n = 0; n < nProps; ++n )
+        {
+            const beans::Property& rProp = pProps[ n ];
+
+            if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) )
+            {
+                if ( m_pObject->getBaseType( ) == "cmis:document" )
+                    xRow->appendBoolean( rProp, true );
+                else
+                    xRow->appendVoid( rProp );
+            }
+            else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) )
+            {
+                if( m_pObject->getBaseType( ) == "cmis:folder" )
+                    xRow->appendBoolean( rProp, true );
+                else
+                    xRow->appendVoid( rProp );
+            }
+            else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
+            {
+                xRow->appendString( rProp, rtl::OUString::createFromAscii( m_pObject->getName().c_str() ) );
+            }
+            else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsReadOnly" ) ) )
+            {
+                // TODO Fix this value
+                xRow->appendBoolean( rProp, sal_True );
+            }
+            else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateCreated" ) ) )
+            {
+                // TODO Fix this value
+                xRow->appendVoid( rProp );
+            }
+            else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateModified" ) ) )
+            {
+                // TODO Fix this value
+                xRow->appendVoid( rProp );
+            }
+            else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) )
+            {
+                libcmis::Document* document = dynamic_cast< libcmis::Document* >( m_pObject.get( ) );
+                if ( NULL != document )
+                    xRow->appendLong( rProp, document->getContentLength() );
+                else
+                    xRow->appendVoid( rProp );
+            }
+#if OSL_DEBUG_LEVEL > 1
+            else
+            {
+                fprintf( stderr, "Looking for unsupported property %s\n",
+                    rtl::OUStringToOString( rProp.Name, RTL_TEXTENCODING_UTF8 ).getStr( ) );
+            }
+#endif
+        }
+
+        return uno::Reference< sdbc::XRow >( xRow.get() );
     }
 
     void Content::queryChildren( ContentRefList& /*rChildren*/ )
@@ -119,16 +188,62 @@ namespace cmis
         // TODO Implement me
     }
 
-    uno::Any Content::open(const ucb::OpenCommandArgument2 & /*rArg*/,
-        const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
+    uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand,
+        const uno::Reference< ucb::XCommandEnvironment > & xEnv )
             throw( uno::Exception )
     {
+        bool bIsFolder = isFolder( xEnv );
+
+        // TODO Handle the case of the non-existing file
+
         uno::Any aRet;
 
+        sal_Bool bOpenFolder = (
+            ( rOpenCommand.Mode == ucb::OpenMode::ALL ) ||
+            ( rOpenCommand.Mode == ucb::OpenMode::FOLDERS ) ||
+            ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENTS )
+         );
+
+        if ( bOpenFolder && bIsFolder )
+        {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "TODO - cmis::Content::open()\n" );
+        fprintf( stderr, "TODO - cmis::Content::open() - Folder case\n" );
 #endif
-        // TODO Implement me
+            // TODO Implement the folder case
+        }
+        else if ( rOpenCommand.Sink.is() )
+        {
+            if (
+                ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_NONE ) ||
+                ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE )
+               )
+            {
+                ucbhelper::cancelCommandExecution(
+                    uno::makeAny ( ucb::UnsupportedOpenModeException
+                        ( rtl::OUString(), static_cast< cppu::OWeakObject * >( this ),
+                          sal_Int16( rOpenCommand.Mode ) ) ),
+                        xEnv );
+            }
+
+            if ( !feedSink( rOpenCommand.Sink, xEnv ) )
+            {
+                // Note: rOpenCommand.Sink may contain an XStream
+                //       implementation. Support for this type of
+                //       sink is optional...
+#if OSL_DEBUG_LEVEL > 1
+                fprintf( stderr, "Failed to load data from '%s'\n",
+                    rtl::OUStringToOString( m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8 ).getStr() );
+#endif
+
+                ucbhelper::cancelCommandExecution(
+                    uno::makeAny (ucb::UnsupportedDataSinkException
+                        ( rtl::OUString(), static_cast< cppu::OWeakObject * >( this ),
+                          rOpenCommand.Sink ) ),
+                        xEnv );
+            }
+        }
+        else
+            fprintf( stderr, "Open falling through ..." );
 
         return aRet;
     }
@@ -190,16 +305,31 @@ namespace cmis
         return aRet;
     }
 
-    sal_Bool Content::feedSink( uno::Reference< uno::XInterface> /*aSink*/,
+    sal_Bool Content::feedSink( uno::Reference< uno::XInterface> xSink,
         const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/ )
     {
-        sal_Bool bRet = sal_False;
-#if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "TODO - cmis::Content::feedSink()\n" );
-#endif
-        // TODO Implement me
+        if ( !xSink.is() )
+            return sal_False;
 
-        return bRet;
+        uno::Reference< io::XOutputStream > xOut = uno::Reference< io::XOutputStream >(xSink, uno::UNO_QUERY );
+        uno::Reference< io::XActiveDataSink > xDataSink = uno::Reference< io::XActiveDataSink >(xSink, uno::UNO_QUERY );
+
+        if ( !xOut.is() && !xDataSink.is() )
+            return sal_False;
+
+        libcmis::Document* document = dynamic_cast< libcmis::Document* >( m_pObject.get() );
+        FILE* fd = document->getContent( );
+
+        uno::Reference< io::XInputStream > xIn = new ucbhelper::FdInputStream( fd );
+        if( !xIn.is( ) )
+            return sal_False;
+
+        if ( xDataSink.is() )
+            xDataSink->setInputStream( xIn );
+        else if ( xOut.is() )
+            copyData( xIn, xOut );
+
+        return sal_True;
     }
 
     sal_Bool Content::exchangeIdentity( const uno::Reference< ucb::XContentIdentifier >& /*xNewId*/ )
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index 20171a6..ef7503a 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -66,7 +66,9 @@ class ContentProperties;
 class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator
 {
 private:
-    ContentProvider  *m_pProvider;
+    ContentProvider*       m_pProvider;
+    libcmis::Session*      m_pSession;
+    libcmis::CmisObjectPtr m_pObject;
 
     bool isFolder(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv);
 
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
new file mode 100644
index 0000000..2942d8c
--- /dev/null
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 SUSE <cbosdonnat at suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <libcmis/session-factory.hxx>
+#include <tools/urlobj.hxx>
+
+#include "cmis_url.hxx"
+
+using namespace std;
+
+#define OUSTR_TO_STDSTR(s) string( rtl::OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
+
+
+namespace cmis
+{
+    URL::URL( rtl::OUString const & urlStr )
+    {
+        INetURLObject url( urlStr );
+
+        string bindingUrl( "http://" );
+        bindingUrl += OUSTR_TO_STDSTR( url.GetHostPort( ) );
+        bindingUrl += OUSTR_TO_STDSTR( url.GetURLPath( ) );
+        m_sBindingUrl = bindingUrl;
+
+        // Split the query into bits and locate the repo-id key
+        rtl::OUString query = url.GetParam( );
+        while ( query.getLength() > 0 )
+        {
+            sal_Int32 nPos = query.indexOfAsciiL( "&", 1 );
+            rtl::OUString segment;
+            if ( nPos > 0 )
+            {
+                segment = query.copy( 0, nPos );
+                query = query.copy( nPos + 1 );
+            }
+            else
+            {
+                segment = query;
+                query = rtl::OUString();
+            }
+
+            sal_Int32 nEqPos = segment.indexOfAsciiL( "=", 1 );
+            string key = OUSTR_TO_STDSTR( segment.copy( 0, nEqPos ) );
+            string value = OUSTR_TO_STDSTR( segment.copy( nEqPos +1 ) );
+
+            if ( key == "repo-id" )
+                m_sRepositoryId = value;
+            else
+                m_aQuery[key] = value;
+        }
+
+    }
+
+    map< int, string > URL::getSessionParams( )
+    {
+        map< int, string > params;
+        params[ATOMPUB_URL] = m_sBindingUrl;
+        params[REPOSITORY_ID] = m_sRepositoryId;
+
+        return params;
+    }
+
+    string URL::getObjectId( )
+    {
+        return m_aQuery["id"];
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/cmis/cmis_url.hxx b/ucb/source/ucp/cmis/cmis_url.hxx
new file mode 100644
index 0000000..1859102
--- /dev/null
+++ b/ucb/source/ucp/cmis/cmis_url.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 SUSE <cbosdonnat at suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef CMIS_URL_HXX
+#define CMIS_URL_HXX
+
+#include <map>
+#include <string>
+
+#include <rtl/ustring.hxx>
+
+namespace cmis
+{
+    class URL
+    {
+        private:
+            std::string m_sBindingUrl;
+            std::string m_sRepositoryId;
+
+            std::map< std::string, std::string > m_aQuery;
+
+        public:
+            URL( rtl::OUString const & urlStr );
+
+            std::map< int, std::string > getSessionParams( );
+            std::string getObjectId( );
+    };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/cmis/makefile.mk b/ucb/source/ucp/cmis/makefile.mk
index d30a116..43b7c43 100644
--- a/ucb/source/ucp/cmis/makefile.mk
+++ b/ucb/source/ucp/cmis/makefile.mk
@@ -41,7 +41,8 @@ NO_BSYMBOLIC=TRUE
 DLLPRE =
 
 SLOFILES=$(SLO)$/cmis_provider.obj\
-         $(SLO)$/cmis_content.obj
+         $(SLO)$/cmis_content.obj \
+		 $(SLO)$/cmis_url.obj
 
 SHL1TARGET=$(TARGET)$(UCPCMIS_MAJOR).uno
 SHL1DEF=$(MISC)$/$(SHL1TARGET).def
@@ -53,6 +54,7 @@ SHL1STDLIBS=\
     $(SALLIB)  \
     $(SALHELPERLIB)  \
     $(UCBHELPERLIB) \
+	$(TOOLSLIB) \
 	$(CMISLIB)
 
 SHL1VERSIONMAP=$(SOLARENV)/src/component.map
diff --git a/ucb/source/ucp/ftp/ftpcfunc.cxx b/ucb/source/ucp/ftp/ftpcfunc.cxx
index 8df90ec..16373e2 100644
--- a/ucb/source/ucp/ftp/ftpcfunc.cxx
+++ b/ucb/source/ucp/ftp/ftpcfunc.cxx
@@ -37,7 +37,6 @@
 #include <string.h>
 
 #include "ftpcontentidentifier.hxx"
-#include "ftpinpstr.hxx"
 #include <stdio.h>
 
 using namespace ftp;
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index f0edeea..46d663a 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -41,7 +41,6 @@
 #include "ftpresultsetI.hxx"
 #include "ftpcontent.hxx"
 #include "ftpcontentprovider.hxx"
-#include "ftpinpstr.hxx"
 #include "ftpdirp.hxx"
 #include "ftpcontentidentifier.hxx"
 #include "ftpcfunc.hxx"
@@ -55,6 +54,7 @@
 #include <curl/easy.h>
 #include <ucbhelper/cancelcommandexecution.hxx>
 #include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/fd_inputstream.hxx>
 #include <ucbhelper/propertyvalueset.hxx>
 #include <ucbhelper/contentidentifier.hxx>
 #include <ucbhelper/cancelcommandexecution.hxx>
@@ -505,11 +505,11 @@ Any SAL_CALL FTPContent::execute(
 
                     if(xActiveDataSink.is()) {
                         xActiveDataSink->setInputStream(
-                            new FTPInputStream(m_aFTPURL.open()));
+                            new ucbhelper::FdInputStream(m_aFTPURL.open()));
                     }
                     else if(xOutputStream.is()) {
                         Reference<XInputStream> xStream(
-                            new FTPInputStream(m_aFTPURL.open()));
+                            new ucbhelper::FdInputStream(m_aFTPURL.open()));
                         Sequence<sal_Int8> byte_seq(4096);
                         sal_Int32 n = 1000; // value does not matter here
                         for (;;) {
diff --git a/ucb/source/ucp/ftp/ftpinpstr.cxx b/ucb/source/ucp/ftp/ftpinpstr.cxx
deleted file mode 100644
index bb7d1a1..0000000
--- a/ucb/source/ucp/ftp/ftpinpstr.cxx
+++ /dev/null
@@ -1,208 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_ucb.hxx"
-
-/**************************************************************************
-                                TODO
- **************************************************************************
-
- *************************************************************************/
-#include "ftpinpstr.hxx"
-#include <rtl/alloc.h>
-#ifndef STD_ALGORITHM
-#include <algorithm>
-#define STD_ALGORITHM
-#endif
-#include <stdio.h>
-
-using namespace ftp;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::io;
-
-
-FTPInputStream::FTPInputStream(FILE* tmpfl)
-    : m_tmpfl(tmpfl ? tmpfl : tmpfile())
-{
-    fseek(m_tmpfl,0,SEEK_END);
-    long pos = ftell(m_tmpfl);
-    rewind(m_tmpfl);
-    m_nLength = sal_Int64(pos);
-}
-
-
-
-FTPInputStream::~FTPInputStream()
-{
-    if ( 0 != m_tmpfl)
-        fclose(m_tmpfl);
-}
-
-
-Any SAL_CALL FTPInputStream::queryInterface(
-    const Type& rType
-)
-    throw(
-        RuntimeException
-    )
-{
-    Any aRet = ::cppu::queryInterface(rType,
-                                      SAL_STATIC_CAST( XInputStream*,this ),
-                                      SAL_STATIC_CAST( XSeekable*,this ) );
-
-    return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
-}
-
-
-
-void SAL_CALL FTPInputStream::acquire( void ) throw() {
-    OWeakObject::acquire();
-}
-
-
-
-void SAL_CALL FTPInputStream::release( void ) throw() {
-    OWeakObject::release();
-}
-
-
-sal_Int32 SAL_CALL FTPInputStream::readBytes(Sequence< sal_Int8 >& aData,
-                                             sal_Int32 nBytesToRead)
-    throw(NotConnectedException,
-          BufferSizeExceededException,
-          IOException,
-          RuntimeException)
-{
-    osl::MutexGuard aGuard(m_aMutex);
-
-    if(0 <= nBytesToRead && aData.getLength() < nBytesToRead)
-        aData.realloc(nBytesToRead);
-
-    size_t nWanted = static_cast<size_t>(nBytesToRead);
-    size_t nRead = fread(aData.getArray(), 1, nWanted, m_tmpfl);
-    if (nRead != nWanted && ferror(m_tmpfl))
-        throw IOException();
-
-    return static_cast<sal_Int32>(nRead);
-}
-
-
-sal_Int32 SAL_CALL FTPInputStream::readSomeBytes( Sequence< sal_Int8 >& aData,
-                                                  sal_Int32 nMaxBytesToRead )
-    throw( NotConnectedException,
-           BufferSizeExceededException,
-           IOException,
-           RuntimeException)
-{
-    return readBytes(aData,nMaxBytesToRead);
-}
-
-
-
-void SAL_CALL FTPInputStream::skipBytes(sal_Int32 nBytesToSkip)
-    throw(NotConnectedException,
-          BufferSizeExceededException,
-          IOException,
-          RuntimeException)
-{
-    osl::MutexGuard aGuard(m_aMutex);
-    if(!m_tmpfl)
-        throw IOException();
-
-    fseek(m_tmpfl,long(nBytesToSkip),SEEK_CUR);
-}
-
-
-
-sal_Int32 SAL_CALL FTPInputStream::available(void)
-    throw(NotConnectedException,
-          IOException,
-          RuntimeException)
-{
-    return sal::static_int_cast<sal_Int32>(m_nLength - getPosition());
-}
-
-
-
-void SAL_CALL FTPInputStream::closeInput(void)
-    throw(NotConnectedException,
-          IOException,
-          RuntimeException)
-{
-    osl::MutexGuard aGuard(m_aMutex);
-    if(m_tmpfl)
-        fclose(m_tmpfl),m_tmpfl = 0;
-}
-
-
-
-void SAL_CALL FTPInputStream::seek(sal_Int64 location)
-    throw( IllegalArgumentException,
-           IOException,
-           RuntimeException )
-{
-    osl::MutexGuard aGuard(m_aMutex);
-    if(!m_tmpfl)
-        throw IOException();
-
-    fseek(m_tmpfl,long(location),SEEK_SET);
-}
-
-
-
-sal_Int64 SAL_CALL
-FTPInputStream::getPosition(
-    void )
-    throw( IOException,
-           RuntimeException )
-{
-    osl::MutexGuard aGuard(m_aMutex);
-    if(!m_tmpfl)
-        throw IOException();
-
-//     fpos_t pos;
-//     fgetpos(m_tmpfl,&pos);
-    long pos;
-    pos = ftell(m_tmpfl);
-    return sal_Int64(pos);
-}
-
-
-
-sal_Int64 SAL_CALL FTPInputStream::getLength(
-    void
-) throw(
-    IOException,RuntimeException
-)
-{
-    return m_nLength;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/ftpinpstr.hxx b/ucb/source/ucp/ftp/ftpinpstr.hxx
deleted file mode 100644
index 96e8e99..0000000
--- a/ucb/source/ucp/ftp/ftpinpstr.hxx
+++ /dev/null
@@ -1,154 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/**************************************************************************
-                                TODO
- **************************************************************************
-
- *************************************************************************/
-
-#ifndef _FTP_FTPINPSTR_HXX_
-#define _FTP_FTPINPSTR_HXX_
-
-
-#include <rtl/ustring.hxx>
-#include <osl/mutex.hxx>
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <stdio.h>
-
-
-namespace ftp {
-
-
-    /** Implements a seekable InputStream
-     *  working on a buffer.
-     */
-
-
-    namespace css = com::sun::star;
-
-
-    class FTPInputStream
-        : public cppu::OWeakObject,
-          public com::sun::star::io::XInputStream,
-          public com::sun::star::io::XSeekable
-    {
-    public:
-
-        /** Defines the storage kind found
-         *  on which the inputstream acts.
-         */
-
-        FTPInputStream(FILE* tmpfl = 0);
-
-        ~FTPInputStream();
-
-        virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& rType)
-            throw(css::uno::RuntimeException);
-
-        virtual void SAL_CALL acquire(void) throw();
-
-        virtual void SAL_CALL release(void) throw();
-
-        virtual sal_Int32 SAL_CALL
-        readBytes(css::uno::Sequence< sal_Int8 >& aData,
-                  sal_Int32 nBytesToRead)
-            throw( css::io::NotConnectedException,
-                   css::io::BufferSizeExceededException,
-                   css::io::IOException,
-                   css::uno::RuntimeException);
-
-        virtual sal_Int32 SAL_CALL
-        readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
-                      sal_Int32 nMaxBytesToRead )
-            throw( css::io::NotConnectedException,
-                   css::io::BufferSizeExceededException,
-                   css::io::IOException,
-                   css::uno::RuntimeException);
-
-        virtual void SAL_CALL
-        skipBytes(sal_Int32 nBytesToSkip)
-            throw(css::io::NotConnectedException,
-                  css::io::BufferSizeExceededException,
-                  css::io::IOException,
-                  css::uno::RuntimeException );
-
-        virtual sal_Int32 SAL_CALL
-        available(void)
-            throw(css::io::NotConnectedException,
-                  css::io::IOException,
-                  css::uno::RuntimeException );
-
-        virtual void SAL_CALL
-        closeInput(void)
-            throw(css::io::NotConnectedException,
-                  css::io::IOException,
-                  css::uno::RuntimeException);
-
-
-        /** XSeekable
-         */
-
-        virtual void SAL_CALL
-        seek(sal_Int64 location)
-            throw(css::lang::IllegalArgumentException,
-                  css::io::IOException,
-                  css::uno::RuntimeException);
-
-
-        virtual sal_Int64 SAL_CALL
-        getPosition(void)
-            throw(css::io::IOException,
-                  css::uno::RuntimeException);
-
-
-        virtual sal_Int64 SAL_CALL
-        getLength(void)
-            throw(css::io::IOException,
-                  css::uno::RuntimeException);
-
-        // additional
-
-//          void append(const void* pBuffer,size_t size,size_t nmemb);
-
-    private:
-
-        osl::Mutex m_aMutex;
-        FILE* m_tmpfl;
-        sal_Int64 m_nLength;
-    };
-
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index c022e58..93eeb2f 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -43,7 +43,6 @@
 #include "ftpstrcont.hxx"
 #include "ftpurl.hxx"
 #include "ftphandleprovider.hxx"
-#include "ftpinpstr.hxx"
 #include "ftpcfunc.hxx"
 #include "ftpcontainer.hxx"
 
diff --git a/ucb/source/ucp/ftp/makefile.mk b/ucb/source/ucp/ftp/makefile.mk
index 8c30a59..944b179 100644
--- a/ucb/source/ucp/ftp/makefile.mk
+++ b/ucb/source/ucp/ftp/makefile.mk
@@ -54,7 +54,6 @@ SLOFILES1=\
     $(SLO)$/ftpresultsetbase.obj \
     $(SLO)$/ftpresultsetI.obj \
     $(SLO)$/ftploaderthread.obj  \
-    $(SLO)$/ftpinpstr.obj	\
     $(SLO)$/ftpdirp.obj     \
     $(SLO)$/ftpcfunc.obj     \
     $(SLO)$/ftpurl.obj     \
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index e10a69d..fab393e 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -65,7 +65,6 @@
 #include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
 #include <com/sun/star/ucb/UnsupportedNameClashException.hpp>
 #include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
-#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
 #include <com/sun/star/ucb/NameClashException.hpp>
 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
 #include <com/sun/star/ucb/XContentCreator.hpp>
diff --git a/ucbhelper/Library_ucbhelper.mk b/ucbhelper/Library_ucbhelper.mk
index ce1798d..5fe25ca 100644
--- a/ucbhelper/Library_ucbhelper.mk
+++ b/ucbhelper/Library_ucbhelper.mk
@@ -72,6 +72,7 @@ $(eval $(call gb_Library_add_exception_objects,ucbhelper,\
 	ucbhelper/source/provider/contentinfo \
 	ucbhelper/source/provider/interactionrequest \
 	ucbhelper/source/provider/providerhelper \
+	ucbhelper/source/provider/fd_inputstream \
 	ucbhelper/source/client/proxydecider \
 	ucbhelper/source/client/content \
 	ucbhelper/source/client/contentbroker \
diff --git a/ucbhelper/Package_inc.mk b/ucbhelper/Package_inc.mk
index 501cc29..ccce9c9 100644
--- a/ucbhelper/Package_inc.mk
+++ b/ucbhelper/Package_inc.mk
@@ -54,5 +54,6 @@ $(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/contentidentifier.
 $(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/providerhelper.hxx,ucbhelper/providerhelper.hxx))
 $(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/simplenameclashresolverequest.hxx,ucbhelper/simplenameclashresolverequest.hxx))
 $(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/macros.hxx,ucbhelper/macros.hxx))
+$(eval $(call gb_Package_add_file,ucbhelper_inc,inc/ucbhelper/fd_inputstream.hxx,ucbhelper/fd_inputstream.hxx))
 
 # vim: set noet sw=4 ts=4:
diff --git a/ucbhelper/inc/ucbhelper/fd_inputstream.hxx b/ucbhelper/inc/ucbhelper/fd_inputstream.hxx
new file mode 100644
index 0000000..a6551f7
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/fd_inputstream.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/**************************************************************************
+                                TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _UCBHELPER_FD_INPUTSTREAM_HXX_
+#define _UCBHELPER_FD_INPUTSTREAM_HXX_
+
+
+#include <rtl/ustring.hxx>
+#include <osl/mutex.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <stdio.h>
+
+#include "ucbhelper/ucbhelperdllapi.h"
+
+
+namespace ucbhelper
+{
+
+
+    /** Implements a seekable InputStream
+     *  working on a buffer.
+     */
+
+
+    namespace css = com::sun::star;
+
+
+    class UCBHELPER_DLLPUBLIC FdInputStream
+        : public cppu::OWeakObject,
+          public com::sun::star::io::XInputStream,
+          public com::sun::star::io::XSeekable
+    {
+    public:
+
+        /** Defines the storage kind found
+         *  on which the inputstream acts.
+         */
+
+        FdInputStream(FILE* tmpfl = 0);
+
+        ~FdInputStream();
+
+        virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& rType)
+            throw(css::uno::RuntimeException);
+
+        virtual void SAL_CALL acquire(void) throw();
+
+        virtual void SAL_CALL release(void) throw();
+
+        virtual sal_Int32 SAL_CALL
+        readBytes(css::uno::Sequence< sal_Int8 >& aData,
+                  sal_Int32 nBytesToRead)
+            throw( css::io::NotConnectedException,
+                   css::io::BufferSizeExceededException,
+                   css::io::IOException,
+                   css::uno::RuntimeException);
+
+        virtual sal_Int32 SAL_CALL
+        readSomeBytes(css::uno::Sequence< sal_Int8 >& aData,
+                      sal_Int32 nMaxBytesToRead )
+            throw( css::io::NotConnectedException,
+                   css::io::BufferSizeExceededException,
+                   css::io::IOException,
+                   css::uno::RuntimeException);
+
+        virtual void SAL_CALL
+        skipBytes(sal_Int32 nBytesToSkip)
+            throw(css::io::NotConnectedException,
+                  css::io::BufferSizeExceededException,
+                  css::io::IOException,
+                  css::uno::RuntimeException );
+
+        virtual sal_Int32 SAL_CALL
+        available(void)
+            throw(css::io::NotConnectedException,
+                  css::io::IOException,
+                  css::uno::RuntimeException );
+
+        virtual void SAL_CALL
+        closeInput(void)
+            throw(css::io::NotConnectedException,
+                  css::io::IOException,
+                  css::uno::RuntimeException);
+
+
+        /** XSeekable
+         */
+
+        virtual void SAL_CALL
+        seek(sal_Int64 location)
+            throw(css::lang::IllegalArgumentException,
+                  css::io::IOException,
+                  css::uno::RuntimeException);
+
+
+        virtual sal_Int64 SAL_CALL
+        getPosition(void)
+            throw(css::io::IOException,
+                  css::uno::RuntimeException);
+
+
+        virtual sal_Int64 SAL_CALL
+        getLength(void)
+            throw(css::io::IOException,
+                  css::uno::RuntimeException);
+
+        // additional
+
+//          void append(const void* pBuffer,size_t size,size_t nmemb);
+
+    private:
+
+        osl::Mutex m_aMutex;
+        FILE* m_tmpfl;
+        sal_Int64 m_nLength;
+    };
+
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucbhelper/source/provider/fd_inputstream.cxx b/ucbhelper/source/provider/fd_inputstream.cxx
new file mode 100644
index 0000000..3c0e88d
--- /dev/null
+++ b/ucbhelper/source/provider/fd_inputstream.cxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+#include "ucbhelper/fd_inputstream.hxx"
+
+#include <rtl/alloc.h>
+#include <algorithm>
+#include <stdio.h>
+
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::io;
+
+namespace ucbhelper
+{
+    FdInputStream::FdInputStream(FILE* tmpfl)
+        : m_tmpfl(tmpfl ? tmpfl : tmpfile())
+    {
+        fseek(m_tmpfl,0,SEEK_END);
+        long pos = ftell(m_tmpfl);
+        rewind(m_tmpfl);
+        m_nLength = sal_Int64(pos);
+    }
+
+
+
+    FdInputStream::~FdInputStream()
+    {
+        if ( 0 != m_tmpfl)
+            fclose(m_tmpfl);
+    }
+
+
+    Any SAL_CALL FdInputStream::queryInterface(
+        const Type& rType
+    )
+        throw(
+            RuntimeException
+        )
+    {
+        Any aRet = ::cppu::queryInterface(rType,
+                                          SAL_STATIC_CAST( XInputStream*,this ),
+                                          SAL_STATIC_CAST( XSeekable*,this ) );
+
+        return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+    }
+
+
+
+    void SAL_CALL FdInputStream::acquire( void ) throw() {
+        OWeakObject::acquire();
+    }
+
+
+
+    void SAL_CALL FdInputStream::release( void ) throw() {
+        OWeakObject::release();
+    }
+
+
+    sal_Int32 SAL_CALL FdInputStream::readBytes(Sequence< sal_Int8 >& aData,
+                                                 sal_Int32 nBytesToRead)
+        throw(NotConnectedException,
+              BufferSizeExceededException,
+              IOException,
+              RuntimeException)
+    {
+        osl::MutexGuard aGuard(m_aMutex);
+
+        if(0 <= nBytesToRead && aData.getLength() < nBytesToRead)
+            aData.realloc(nBytesToRead);
+
+        size_t nWanted = static_cast<size_t>(nBytesToRead);
+        size_t nRead = fread(aData.getArray(), 1, nWanted, m_tmpfl);
+        if (nRead != nWanted && ferror(m_tmpfl))
+            throw IOException();
+
+        return static_cast<sal_Int32>(nRead);
+    }
+
+
+    sal_Int32 SAL_CALL FdInputStream::readSomeBytes( Sequence< sal_Int8 >& aData,
+                                                      sal_Int32 nMaxBytesToRead )
+        throw( NotConnectedException,
+               BufferSizeExceededException,
+               IOException,
+               RuntimeException)
+    {
+        return readBytes(aData,nMaxBytesToRead);
+    }
+
+
+
+    void SAL_CALL FdInputStream::skipBytes(sal_Int32 nBytesToSkip)
+        throw(NotConnectedException,
+              BufferSizeExceededException,
+              IOException,
+              RuntimeException)
+    {
+        osl::MutexGuard aGuard(m_aMutex);
+        if(!m_tmpfl)
+            throw IOException();
+
+        fseek(m_tmpfl,long(nBytesToSkip),SEEK_CUR);
+    }
+
+
+
+    sal_Int32 SAL_CALL FdInputStream::available(void)
+        throw(NotConnectedException,
+              IOException,
+              RuntimeException)
+    {
+        return sal::static_int_cast<sal_Int32>(m_nLength - getPosition());
+    }
+
+
+
+    void SAL_CALL FdInputStream::closeInput(void)
+        throw(NotConnectedException,
+              IOException,
+              RuntimeException)
+    {
+        osl::MutexGuard aGuard(m_aMutex);
+        if(m_tmpfl)
+            fclose(m_tmpfl),m_tmpfl = 0;
+    }
+
+
+
+    void SAL_CALL FdInputStream::seek(sal_Int64 location)
+        throw( IllegalArgumentException,
+               IOException,
+               RuntimeException )
+    {
+        osl::MutexGuard aGuard(m_aMutex);
+        if(!m_tmpfl)
+            throw IOException();
+
+        fseek(m_tmpfl,long(location),SEEK_SET);
+    }
+
+
+
+    sal_Int64 SAL_CALL
+    FdInputStream::getPosition(
+        void )
+        throw( IOException,
+               RuntimeException )
+    {
+        osl::MutexGuard aGuard(m_aMutex);
+        if(!m_tmpfl)
+            throw IOException();
+
+    //     fpos_t pos;
+    //     fgetpos(m_tmpfl,&pos);
+        long pos;
+        pos = ftell(m_tmpfl);
+        return sal_Int64(pos);
+    }
+
+
+
+    sal_Int64 SAL_CALL FdInputStream::getLength(
+        void
+    ) throw(
+        IOException,RuntimeException
+    )
+    {
+        return m_nLength;
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a43730b4dfce70ee02996f808525cbd4e197e899
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Fri Sep 30 15:47:27 2011 +0200

    Cmis: Fixed the installation of the new UCP provider and libcmis

diff --git a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
index 8cd6d14..58d6e41 100644
--- a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
+++ b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
@@ -202,7 +202,7 @@
                 <value>com.sun.star.ucb.CmisContentProvider</value>
               </prop>
               <prop oor:name="URLTemplate">
-                <value>vnd.sun.star.cmis</value>
+                <value>cmis+atom</value>
               </prop>
               <prop oor:name="Arguments">
                 <value/>
diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk
index 8c5a214..a96049a 100644
--- a/postprocess/packcomponents/makefile.mk
+++ b/postprocess/packcomponents/makefile.mk
@@ -160,6 +160,7 @@ my_components = \
     stringresource \
     syssh \
     ucb1 \
+	ucpcmis \
     ucpexpand1 \
     ucpext \
     ucpfile1 \
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index 568ab94..ec58f59 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -186,6 +186,25 @@ End
 
 #endif
 
+File gid_File_Lib_Cmis
+    TXT_FILE_BODY;
+    Styles = (PACKED);
+    Dir = SCP2_OOO_BIN_DIR;
+  #ifdef UNX
+    #ifdef MACOSX
+       Name = STRING(CONCAT2(libcmis-0.2.0,UNXSUFFIX));
+    #else
+       Name = STRING(CONCAT3(libcmis-0.2,UNXSUFFIX,.0));
+    #endif
+  #else
+   #ifdef _gcc3
+    Name = "libcmis-0.2.dll";
+   #else
+    Name = "libcmis.dll";
+   #endif
+  #endif
+End
+
 #ifndef SYSTEM_DB
 
 File gid_File_Lib_Db
@@ -1333,6 +1352,8 @@ SPECIAL_COMPONENT_LIB_FILE(gid_File_Ucpexpand1, ucpexpand1.uno)
 SPECIAL_COMPONENT_LIB_FILE(gid_File_Ucpodma1, ucpodma1)
 #endif
 
+SPECIAL_COMPONENT_LIB_FILE(gid_File_Ucpcmis, ucpcmis1.uno)
+
 File gid_File_Lib_Lnth
     TXT_FILE_BODY;
     Styles = (PACKED);
diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
index 3ba48ef..0865fb8 100644
--- a/scp2/source/ooo/module_hidden_ooo.scp
+++ b/scp2/source/ooo/module_hidden_ooo.scp
@@ -340,6 +340,7 @@ Module gid_Module_Root_Files_5
 	gid_File_Lib_Ldapbe2,
 	gid_File_Lib_Comphelper2,
 	gid_File_Lib_Cached1,
+	gid_File_Lib_Cmis,
 	gid_File_Lib_Curl,
 	gid_Unixlink_File_Lib_Curl,
 	gid_File_Lib_Db,
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index c103178..55c9120 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -2136,7 +2136,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin,
             { ".uno:", "staroffice.uno:", INET_PROT_UNO,
               PrefixInfo::INTERNAL },
             { "cid:", 0, INET_PROT_CID, PrefixInfo::OFFICIAL },
-            { "cmis+atom:", 0, INET_PROT_CMIS_ATOM, PrefixInfo::EXTERNAL },
+            { "cmis+atom:", 0, INET_PROT_CMIS_ATOM, PrefixInfo::INTERNAL },
             { "data:", 0, INET_PROT_DATA, PrefixInfo::OFFICIAL },
             { "db:", "staroffice.db:", INET_PROT_DB, PrefixInfo::INTERNAL },
             { "file:", 0, INET_PROT_FILE, PrefixInfo::OFFICIAL },
diff --git a/ucb/source/ucp/cmis/cmis_provider.cxx b/ucb/source/ucp/cmis/cmis_provider.cxx
index 122f8fe..297737c 100644
--- a/ucb/source/ucp/cmis/cmis_provider.cxx
+++ b/ucb/source/ucp/cmis/cmis_provider.cxx
@@ -46,7 +46,7 @@ ContentProvider::queryContent(
            uno::RuntimeException )
 {
 #ifdef DEBUG
-    fprintf(stderr, "QueryContent: '%s'",
+    fprintf(stderr, "QueryContent: '%s'\n",
        (const sal_Char *)rtl::OUStringToOString
        (Identifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8));
 #endif
commit 246ed4227aefde8927991982a94f7f0cb6a43a6b
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Thu Sep 29 22:46:39 2011 +0200

    Added cmis+atom:// scheme to the tools urlobj.
    
    Found out a unexecuted cppunit test for the urlobj, fixed it and added a
    test for the cmis+atom:// URLs

diff --git a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
index fcc3389..8cd6d14 100644
--- a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
+++ b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
@@ -197,6 +197,17 @@
                 <value/>
               </prop>
             </node>
+            <node oor:name="Provider43" oor:op="replace">
+              <prop oor:name="ServiceName">
+                <value>com.sun.star.ucb.CmisContentProvider</value>
+              </prop>
+              <prop oor:name="URLTemplate">
+                <value>vnd.sun.star.cmis</value>
+              </prop>
+              <prop oor:name="Arguments">
+                <value/>
+              </prop>
+            </node>
             <!-- We want the Provider to be the final fallback provider -->
             <node oor:name="Provider999" oor:op="replace" install:module="gio">
               <prop oor:name="ServiceName">
diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
index c39f0a2..154670e 100644
--- a/tools/CppunitTest_tools_test.mk
+++ b/tools/CppunitTest_tools_test.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
     tools/qa/cppunit/test_reversemap \
     tools/qa/cppunit/test_pathutils \
     tools/qa/cppunit/test_stream \
+	tools/qa/urlobj/tools_urlobj_test \
 ))
 
 $(eval $(call gb_CppunitTest_add_api,tools_test, \
diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx
index 2c18004..08211e9 100644
--- a/tools/inc/tools/urlobj.hxx
+++ b/tools/inc/tools/urlobj.hxx
@@ -143,7 +143,8 @@ enum INetProtocol
     INET_PROT_SMB = 31,
     INET_PROT_HID = 32,
     INET_PROT_SFTP = 33,
-    INET_PROT_END = 34
+    INET_PROT_CMIS_ATOM = 34,
+    INET_PROT_END = 35
 };
 
 //============================================================================
diff --git a/tools/qa/urlobj/tools_urlobj_test.cxx b/tools/qa/urlobj/tools_urlobj_test.cxx
index 0e9a16a..d66e5b3 100644
--- a/tools/qa/urlobj/tools_urlobj_test.cxx
+++ b/tools/qa/urlobj/tools_urlobj_test.cxx
@@ -26,162 +26,234 @@
  * instead of those above.
  */
 
+#include <string>
+
 #include "sal/config.h"
 #include "sal/precppunit.hxx"
 
- #include <urlobj.hxx>
-
- namespace tools_urlobj
- {
-
- class urlobjTest : public CppUnit::TestFixture
- {
-
- public:
-     // initialise your test code values here.
-     void setUp()
-     {
-     }
-
-     void tearDown()
-     {
-     }
-
-     // insert your test code here.
-     // this is only demonstration code
-     void urlobjTest_001()
-     {
-        INetURLObject aUrl(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file://10.10.1.1/sampledir/sample.file")));
- #ifdef LINUX
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://10.10.1.1/sampledir/sample.file")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
- #endif
- #ifdef WIN
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://10.10.1.1/sampledir/sample.file")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
- #endif
-        CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("10.10.1.1")==0);
-        CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/sampledir/sample.file")==0);
-        CPPUNIT_ASSERT(aUrl.getName().compareToAscii("sample.file")==0);
-        CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("sample")==0);
-        CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("file")==0);
-     }
-
-     void urlobjTest_002()
-     {
-        INetURLObject aUrl;
-        aUrl.setFSysPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\\\\137.65.170.24\\c$\\Img0001.jpg")), INetURLObject::FSYS_DETECT);
- #ifdef LINUX
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://137.65.170.24/c$/Img0001.jpg")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
- #endif
- #ifdef WIN
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://137.65.170.24/c$/Img0001.jpg")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
- #endif
-        CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("137.65.170.24")==0);
-        CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/c$/Img0001.jpg")==0);
-        CPPUNIT_ASSERT(aUrl.getName().compareToAscii("Img0001.jpg")==0);
-        CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("Img0001")==0);
-        CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("jpg")==0);
-     }
-
-
-     void urlobjTest_003()
-     {
-        INetURLObject aUrl;
-        aUrl.setFSysPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\\\\hive-winxp-x86\\pmladek\\test2.odt")), INetURLObject::FSYS_DETECT);
- #ifdef LINUX
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://hive-winxp-x86/pmladek/test2.odt")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
- #endif
- #ifdef WIN
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://hive-winxp-x86/pmladek/test2.odt")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
- #endif
-        CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("hive-winxp-x86")==0);
-        CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/pmladek/test2.odt")==0);
-     }
-
-     void urlobjTest_004()
-     {
-        INetURLObject aUrl(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("smb://10.10.1.1/sampledir/sample.file")));
- #ifdef LINUX
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://10.10.1.1/sampledir/sample.file")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
- #endif
- #ifdef WIN
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://10.10.1.1/sampledir/sample.file")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
- #endif
-        CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("10.10.1.1")==0);
-        CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/sampledir/sample.file")==0);
-        CPPUNIT_ASSERT(aUrl.getName().compareToAscii("sample.file")==0);
-        CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("sample")==0);
-        CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("file")==0);
-     }
-
-     void urlobjTest_005()
-     {
-        INetURLObject aUrl;
-        aUrl.setFSysPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("//137.65.170.24/c$/Img0001.jpg")), INetURLObject::FSYS_DETECT);
- #ifdef LINUX
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://137.65.170.24/c$/Img0001.jpg")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
- #endif
- #ifdef WIN
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://137.65.170.24/c$/Img0001.jpg")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
- #endif
-        CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("137.65.170.24")==0);
-        CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/c$/Img0001.jpg")==0);
-        CPPUNIT_ASSERT(aUrl.getName().compareToAscii("Img0001.jpg")==0);
-        CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("Img0001")==0);
-        CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("jpg")==0);
-     }
-
-
-     void urlobjTest_006()
-     {
-        INetURLObject aUrl;
-        aUrl.setFSysPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("//hive-winxp-x86/pmladek/test2.odt")), INetURLObject::FSYS_DETECT);
- #ifdef LINUX
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://hive-winxp-x86/pmladek/test2.odt")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
- #endif
- #ifdef WIN
-        CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://hive-winxp-x86/pmladek/test2.odt")==0);
-        CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
- #endif
-        CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("hive-winxp-x86")==0);
-        CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/pmladek/test2.odt")==0);
-     }
-
-
-
-     // Change the following lines only, if you add, remove or rename
-     // member functions of the current class,
-     // because these macros are need by auto register mechanism.
-
-     CPPUNIT_TEST_SUITE(urlobjTest);
-     CPPUNIT_TEST(urlobjTest_001);
-     CPPUNIT_TEST(urlobjTest_002);
-     CPPUNIT_TEST(urlobjTest_003);
-     CPPUNIT_TEST(urlobjTest_004);
-     CPPUNIT_TEST(urlobjTest_005);
-     CPPUNIT_TEST(urlobjTest_006);
-     CPPUNIT_TEST_SUITE_END();
- }; // class createPool
-
-
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tools_urlobj::urlobjTest, "tools_urlobj");
- } // namespace rtl_random
-
-
- // -----------------------------------------------------------------------------
-
- // this macro creates an empty function, which will called by the RegisterAllFunctions()
- // to let the user the possibility to also register some functions by hand.
- NOADDITIONAL;
+#include "tools/urlobj.hxx"
+
+#define OUSTR_TO_STDSTR( oustr ) std::string( rtl::OUStringToOString( oustr, RTL_TEXTENCODING_ASCII_US ).getStr() )
+
+namespace tools_urlobj
+{
+
+    class urlobjTest:public CppUnit::TestFixture
+    {
+
+      public:
+        // initialise your test code values here.
+        void setUp(  )
+        {
+        }
+
+        void tearDown(  )
+        {
+        }
+
+        // insert your test code here.
+        // this is only demonstration code
+        void urlobjTest_001(  )
+        {
+            INetURLObject aUrl( rtl::
+                                OUString( RTL_CONSTASCII_USTRINGPARAM
+                                          ( "file://10.10.1.1/sampledir/sample.file" ) ) );
+#ifdef LINUX
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii
+                            ( "smb://10.10.1.1/sampledir/sample.file" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_SMB );
+#endif
+#ifdef WIN
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii
+                            ( "file://10.10.1.1/sampledir/sample.file" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_FILE );
+#endif
+            CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ).
+                            compareToAscii( "10.10.1.1" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::NO_DECODE ).
+                            compareToAscii( "/sampledir/sample.file" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getName(  ).
+                            compareToAscii( "sample.file" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getBase(  ).compareToAscii( "sample" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.getExtension(  ).compareToAscii( "file" ) ==
+                            0 );
+        }
+
+        void urlobjTest_002(  )
+        {
+            INetURLObject aUrl;
+            aUrl.
+                setFSysPath( rtl::
+                             OUString( RTL_CONSTASCII_USTRINGPARAM
+                                       ( "\\\\137.65.170.24\\c$\\Img0001.jpg" ) ),
+                             INetURLObject::FSYS_DETECT );
+#ifdef LINUX
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii
+                            ( "smb://137.65.170.24/c$/Img0001.jpg" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_SMB );
+#endif
+#ifdef WIN
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii
+                            ( "file://137.65.170.24/c$/Img0001.jpg" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_FILE );
+#endif
+            CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ).
+                            compareToAscii( "137.65.170.24" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::NO_DECODE ).
+                            compareToAscii( "/c$/Img0001.jpg" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getName(  ).
+                            compareToAscii( "Img0001.jpg" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getBase(  ).compareToAscii( "Img0001" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.getExtension(  ).compareToAscii( "jpg" ) ==
+                            0 );
+        }
+
+
+        void urlobjTest_003(  )
+        {
+            INetURLObject aUrl;
+            aUrl.
+                setFSysPath( rtl::
+                             OUString( RTL_CONSTASCII_USTRINGPARAM
+                                       ( "\\\\hive-winxp-x86\\pmladek\\test2.odt" ) ),
+                             INetURLObject::FSYS_DETECT );
+#ifdef LINUX
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii
+                            ( "smb://hive-winxp-x86/pmladek/test2.odt" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_SMB );
+#endif
+#ifdef WIN
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii
+                            ( "file://hive-winxp-x86/pmladek/test2.odt" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_FILE );
+#endif
+            CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ).
+                            compareToAscii( "hive-winxp-x86" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::NO_DECODE ).
+                            compareToAscii( "/pmladek/test2.odt" ) == 0 );
+        }
+
+        void urlobjTest_004(  )
+        {
+            INetURLObject aUrl( rtl::
+                                OUString( RTL_CONSTASCII_USTRINGPARAM
+                                          ( "smb://10.10.1.1/sampledir/sample.file" ) ) );
+#ifdef LINUX
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii
+                            ( "smb://10.10.1.1/sampledir/sample.file" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_SMB );
+#endif
+#ifdef WIN
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii
+                            ( "file://10.10.1.1/sampledir/sample.file" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_FILE );
+#endif
+            CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ).
+                            compareToAscii( "10.10.1.1" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::NO_DECODE ).
+                            compareToAscii( "/sampledir/sample.file" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getName(  ).
+                            compareToAscii( "sample.file" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getBase(  ).compareToAscii( "sample" ) ==
+                            0 );
+            CPPUNIT_ASSERT( aUrl.getExtension(  ).compareToAscii( "file" ) ==
+                            0 );
+        }
+
+        void urlobjTest_005(  )
+        {
+            INetURLObject aUrl;
+            aUrl.setFSysPath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "//137.65.170.24/c$/Img0001.jpg" ) ),
+                              INetURLObject::FSYS_DETECT );
+#ifdef LINUX
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii( "smb://137.65.170.24/c$/Img0001.jpg" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_SMB );
+#endif
+#ifdef WIN
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii( "file://137.65.170.24/c$/Img0001.jpg" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_FILE );
+#endif
+            CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ).
+                            compareToAscii( "137.65.170.24" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::NO_DECODE ).
+                            compareToAscii( "/c$/Img0001.jpg" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getName(  ).compareToAscii( "Img0001.jpg" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getBase(  ).compareToAscii( "Img0001" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.getExtension(  ).compareToAscii( "jpg" ) == 0 );
+        }
+
+
+        void urlobjTest_006(  )
+        {
+            INetURLObject aUrl;
+            aUrl.setFSysPath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "//hive-winxp-x86/pmladek/test2.odt" ) ),
+                              INetURLObject::FSYS_DETECT );
+#ifdef LINUX
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii( "smb://hive-winxp-x86/pmladek/test2.odt" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_SMB );
+#endif
+#ifdef WIN
+            CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
+                            compareToAscii( "file://hive-winxp-x86/pmladek/test2.odt" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetProtocol(  ) == INET_PROT_FILE );
+#endif
+            CPPUNIT_ASSERT( aUrl.GetHost( INetURLObject::NO_DECODE ).
+                            compareToAscii( "hive-winxp-x86" ) == 0 );
+            CPPUNIT_ASSERT( aUrl.GetURLPath( INetURLObject::NO_DECODE ).
+                            compareToAscii( "/pmladek/test2.odt" ) == 0 );
+        }
+
+        void urlobjCmisTest(  )
+        {
+            INetURLObject aUrl( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+                            "cmis+atom://foo.bar.com:8080/my%2Fcmis%2Fatom/path/to/content" ) ) );
+            CPPUNIT_ASSERT_EQUAL( std::string( "foo.bar.com" ),
+                    OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::NO_DECODE ) ) );
+            CPPUNIT_ASSERT( aUrl.GetPort(  ) == 8080 );
+            CPPUNIT_ASSERT_EQUAL( std::string( "/my%2Fcmis%2Fatom/path/to/content" ),
+                    OUSTR_TO_STDSTR( aUrl.GetURLPath( INetURLObject::NO_DECODE ) ) );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong protocol found", INET_PROT_CMIS_ATOM, aUrl.GetProtocol(  ) );
+        }
+
+        // Change the following lines only, if you add, remove or rename
+        // member functions of the current class,
+        // because these macros are need by auto register mechanism.
+
+        CPPUNIT_TEST_SUITE( urlobjTest );
+        CPPUNIT_TEST( urlobjTest_001 );
+        CPPUNIT_TEST( urlobjTest_002 );
+        CPPUNIT_TEST( urlobjTest_003 );
+        CPPUNIT_TEST( urlobjTest_004 );
+        CPPUNIT_TEST( urlobjTest_005 );
+        CPPUNIT_TEST( urlobjTest_006 );
+        CPPUNIT_TEST( urlobjCmisTest );
+        CPPUNIT_TEST_SUITE_END(  );
+    };                          // class createPool
+
+
+    CPPUNIT_TEST_SUITE_REGISTRATION( urlobjTest );
+}                               // namespace rtl_random
+
+
+// -----------------------------------------------------------------------------
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index bbf2106..c103178 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -429,7 +429,9 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END]
         { "hid", "hid:", 0, false, false, false, false, false, false,
           false, true },
         { "sftp", "sftp://", 22, true, true, false, true, true, true, true,
-          true } };
+          true },
+        { "cmis+atom", "cmis+atom://", 0, true, true, false,
+          true, true, true, true, true } };
 
 
 // static
@@ -2134,6 +2136,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin,
             { ".uno:", "staroffice.uno:", INET_PROT_UNO,
               PrefixInfo::INTERNAL },
             { "cid:", 0, INET_PROT_CID, PrefixInfo::OFFICIAL },
+            { "cmis+atom:", 0, INET_PROT_CMIS_ATOM, PrefixInfo::EXTERNAL },
             { "data:", 0, INET_PROT_DATA, PrefixInfo::OFFICIAL },
             { "db:", "staroffice.db:", INET_PROT_DB, PrefixInfo::INTERNAL },
             { "file:", 0, INET_PROT_FILE, PrefixInfo::OFFICIAL },
@@ -2998,6 +3001,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
         case INET_PROT_VND_SUN_STAR_WEBDAV:
         case INET_PROT_HTTPS:
         case INET_PROT_SMB:
+        case INET_PROT_CMIS_ATOM:
             if (pPos < pEnd && *pPos != '/')
                 return false;
             while (pPos < pEnd && *pPos != nQueryDelimiter
commit 61db713ee57d6ed27936ab30b1946590b3cb3df4
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Thu Sep 29 15:10:49 2011 +0200

    CMIS: added libcmis module and created empty cmis UCP shell

diff --git a/libcmis/ExternalLib_libcmis.mk b/libcmis/ExternalLib_libcmis.mk
new file mode 100644
index 0000000..88d981d
--- /dev/null
+++ b/libcmis/ExternalLib_libcmis.mk
@@ -0,0 +1,33 @@
+
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2011 SUSE <cbosdonnat at suse.com>
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_ExternalLib_ExternalLib,libcmis,autotools))
+
+$(eval $(call gb_ExternalLib_set_src_package,libcmis,b9ac948fed0a9a5dd083160119c0b0b3-libcmis-0.1.0.tar.gz))
+
+# vim: set noet sw=4 ts=4:
diff --git a/libcmis/Makefile b/libcmis/Makefile
new file mode 100644
index 0000000..f3cf94e
--- /dev/null
+++ b/libcmis/Makefile
@@ -0,0 +1,38 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2011 SUSE <cbosdonnat at suse.com>
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+ifeq ($(strip $(SRC_ROOT)),)
+$(error No environment set!)
+endif
+
+gb_PARTIALBUILD := T
+GBUILDDIR := $(SRC_ROOT)/solenv/gbuild
+include $(GBUILDDIR)/gbuild.mk
+
+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/libcmis/Module_libcmis.mk b/libcmis/Module_libcmis.mk
new file mode 100644
index 0000000..0cf0d04
--- /dev/null
+++ b/libcmis/Module_libcmis.mk
@@ -0,0 +1,35 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2011 SUSE <cbosdonnat at suse.com>
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_Module_Module,libcmis))
+
+$(eval $(call gb_Module_add_targets,libcmis,\
+	ExternalLib_libcmis \
+))
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/libcmis/prj/build.lst b/libcmis/prj/build.lst
new file mode 100644
index 0000000..65dd566
--- /dev/null
+++ b/libcmis/prj/build.lst
@@ -0,0 +1,2 @@
+lc	libcmis	:	soltools NULL
+lc	libcmis/prj					nmake	-	all	lc_prj NULL
diff --git a/libcmis/prj/d.lst b/libcmis/prj/d.lst
new file mode 100644
index 0000000..e69de29
diff --git a/libcmis/prj/makefile.mk b/libcmis/prj/makefile.mk
new file mode 100644
index 0000000..2483afd
--- /dev/null
+++ b/libcmis/prj/makefile.mk
@@ -0,0 +1,40 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2011 Norbert Thiebaud <nthiebaud at gmail.com>
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+PRJ=..
+TARGET=prj
+
+.INCLUDE : settings.mk
+
+.IF "$(VERBOSE)"!=""
+VERBOSEFLAG :=
+.ELSE
+VERBOSEFLAG := -s
+.ENDIF
+
+all:
+	cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(GMAKE_MODULE_PARALLELISM) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index a956fb0..69c0926 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1335,6 +1335,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles_noheader,offapi,offapi/com/sun/star/u
 	CachedDynamicResultSetFactory \
 	CachedDynamicResultSetStub \
 	CachedDynamicResultSetStubFactory \
+	CmisContentProvider \
 	Content \
 	ContentProvider \
 	ContentProviderProxy \
diff --git a/offapi/com/sun/star/ucb/CmisContentProvider.idl b/offapi/com/sun/star/ucb/CmisContentProvider.idl
new file mode 100644
index 0000000..7eadbb2
--- /dev/null
+++ b/offapi/com/sun/star/ucb/CmisContentProvider.idl
@@ -0,0 +1,57 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 SUSE <cbosdonnat at suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef __com_sun_star_ucb_CmisContentProvider_idl__
+#define __com_sun_star_ucb_CmisContentProvider_idl__
+
+#include <com/sun/star/ucb/XContentProvider.idl>
+
+
+//=============================================================================
+
+module com { module sun { module star { module ucb {
+
+//=============================================================================
+/** The Cmis Content Provider implements a <type>ContentProvider</type>
+    for the <Type>UniversalContentBroker</type> (UCB).
+
+    <p>The served contents enable access to directories and files on a
+    cmis-enabled server.</p>
+
+    @see com::sun::star::ucb::Content
+
+    @since LibreOffice 3.5
+*/
+
+service CmisContentProvider : com::sun::star::ucb::XContentProvider
+{
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/solenv/inc/libs.mk b/solenv/inc/libs.mk
index c6e89b9..1f5dc20 100644
--- a/solenv/inc/libs.mk
+++ b/solenv/inc/libs.mk
@@ -248,6 +248,7 @@ REDLANDLIB=$(REDLAND_LIBS)
 .ELSE
 REDLANDLIB=-lrdf
 .ENDIF
+CMISLIB=-lcmis-0.2
 
 
 # #110743#
diff --git a/ucb/prj/build.lst b/ucb/prj/build.lst
index 7c4e3bc..34ea2bc 100644
--- a/ucb/prj/build.lst
+++ b/ucb/prj/build.lst
@@ -1,4 +1,4 @@
-uc ucb : cppuhelper CURL:curl OPENSSL:openssl NEON:neon LIBXML2:libxml2 LIBXSLT:libxslt offapi sal salhelper ucbhelper udkapi comphelper tools NULL
+uc ucb : cppuhelper CURL:curl OPENSSL:openssl NEON:neon LIBXML2:libxml2 LIBXSLT:libxslt libcmis offapi sal salhelper ucbhelper udkapi comphelper tools NULL
 uc	ucb							usr1	-	all	uc_mkout NULL
 uc	ucb\inc					    nmake	-	all	uc_inc NULL
 uc	ucb\source\regexp		    nmake	-	all	uc_regexp uc_inc NULL
@@ -16,6 +16,7 @@ uc	ucb\source\ucp\tdoc			nmake	-	all	uc_tdoc uc_inc NULL
 uc	ucb\source\ucp\expand		nmake	-	all	uc_expand uc_inc NULL
 uc	ucb\source\ucp\ext		    nmake	-	all	uc_ext uc_inc NULL
 uc	ucb\source\ucp\odma			nmake	-	w	uc_odma uc_inc NULL
+uc	ucb\source\ucp\cmis			nmake	-	all	uc_cmis uc_inc NULL
 #uc      ucb\qa\complex\ucb              nmake   -       all     uc_complex_ucb uc_inc NULL
 # fails, please fix
 # uc      ucb\qa\complex\tdoc             nmake   -       all     uc_complex_tdoc uc_complex_tdoc_interfaces uc_inc NULL
diff --git a/ucb/prj/d.lst b/ucb/prj/d.lst
index db5b290..1351c77 100644
--- a/ucb/prj/d.lst
+++ b/ucb/prj/d.lst
@@ -40,6 +40,7 @@
 
 ..\%__SRC%\misc\ucpgvfs.component  %_DEST%\xml\ucpgvfs.component
 ..\%__SRC%\misc\ucpgio.component  %_DEST%\xml\ucpgio.component
+..\%__SRC%\misc\ucpcmis.component  %_DEST%\xml\ucpcmis.component
 ..\%__SRC%\misc\cached1.component %_DEST%\xml\cached1.component
 ..\%__SRC%\misc\srtrs1.component %_DEST%\xml\srtrs1.component
 ..\%__SRC%\misc\ucb1.component %_DEST%\xml\ucb1.component
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
new file mode 100644
index 0000000..31f49a9
--- /dev/null
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -0,0 +1,553 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 SUSE <cbosdonnat at suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <cstdio>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
+#include <com/sun/star/ucb/InsertCommandArgument.hpp>
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+
+#include <ucbhelper/cancelcommandexecution.hxx>
+#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/propertyvalueset.hxx>
+
+#include "cmis_content.hxx"
+#include "cmis_provider.hxx"
+
+using namespace com::sun::star;
+
+namespace cmis
+{
+    Content::Content( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+        ContentProvider *pProvider, const uno::Reference< ucb::XContentIdentifier >& Identifier)
+            throw ( ucb::ContentCreationException )
+        : ContentImplHelper( rxSMgr, pProvider, Identifier ),
+        m_pProvider( pProvider )
+    {
+#if OSL_DEBUG_LEVEL > 1
+    fprintf(stderr, "TODO - New Content ('%s')\n", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+        // TODO Implement me
+    }
+
+    Content::Content( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider,
+        const uno::Reference< ucb::XContentIdentifier >& Identifier,
+        sal_Bool /*bIsFolder*/)
+            throw ( ucb::ContentCreationException )
+        : ContentImplHelper( rxSMgr, pProvider, Identifier ),
+        m_pProvider( pProvider )
+    {
+#if OSL_DEBUG_LEVEL > 1
+    fprintf(stderr, "TODO - Create Content ('%s')\n", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+        // TODO Implement me
+    }
+
+    Content::~Content()
+    {
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::~Content()\n" );
+#endif
+        // TODO Implement me
+    }
+
+    bool Content::isFolder(const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/)
+    {
+        bool bRet = false;
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::isFolder()\n" );
+#endif
+        // TODO Implement me
+
+        return bRet;
+    }
+
+    uno::Any Content::getBadArgExcept()
+    {
+        return uno::makeAny( lang::IllegalArgumentException(
+            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Wrong argument type!")),
+            static_cast< cppu::OWeakObject * >( this ), -1) );
+    }
+
+    uno::Reference< sdbc::XRow > Content::getPropertyValues(
+            const uno::Sequence< beans::Property >& /*rProperties*/,
+            const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/ )
+    {
+        uno::Reference< sdbc::XRow > rRow;
+
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::getPropertyValues()\n" );
+#endif
+        // TODO Implement me
+
+        return rRow;
+    }
+
+    void Content::queryChildren( ContentRefList& /*rChildren*/ )
+    {
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::queryChildren()\n" );
+#endif
+        // TODO Implement me
+    }
+
+    uno::Any Content::open(const ucb::OpenCommandArgument2 & /*rArg*/,
+        const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
+            throw( uno::Exception )
+    {
+        uno::Any aRet;
+
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::open()\n" );
+#endif
+        // TODO Implement me
+
+        return aRet;
+    }
+
+    void Content::transfer( const ucb::TransferInfo& /*rTransferInfo*/,
+        const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
+            throw( uno::Exception )
+    {
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::transfer()\n" );
+#endif
+        // TODO Implement me
+    }
+
+    void Content::insert( const uno::Reference< io::XInputStream > & /*xInputStream*/,
+        sal_Bool /*bReplaceExisting*/, const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/ )
+            throw( uno::Exception )
+    {
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::insert()\n" );
+#endif
+        // TODO Implement me
+    }
+
+    void Content::destroy( sal_Bool /*bDeletePhysical*/ ) throw( uno::Exception )
+    {
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::destroy()\n" );
+#endif
+        // TODO Implement me
+    }
+
+    const int TRANSFER_BUFFER_SIZE = 65536;
+
+    void Content::copyData(
+        uno::Reference< io::XInputStream > xIn,
+        uno::Reference< io::XOutputStream > xOut )
+    {
+        uno::Sequence< sal_Int8 > theData( TRANSFER_BUFFER_SIZE );
+
+        while ( xIn->readBytes( theData, TRANSFER_BUFFER_SIZE ) > 0 )
+            xOut->writeBytes( theData );
+
+        xOut->closeOutput();
+    }
+
+    uno::Sequence< uno::Any > Content::setPropertyValues(
+            const uno::Sequence< beans::PropertyValue >& rValues,
+            const uno::Reference< ucb::XCommandEnvironment >& )
+    {
+        sal_Int32 nCount = rValues.getLength();
+        uno::Sequence< uno::Any > aRet( nCount );
+
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::setPropertyValue()\n" );
+#endif
+        // TODO Implement me
+
+        return aRet;
+    }
+
+    sal_Bool Content::feedSink( uno::Reference< uno::XInterface> /*aSink*/,
+        const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/ )
+    {
+        sal_Bool bRet = sal_False;
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::feedSink()\n" );
+#endif
+        // TODO Implement me
+
+        return bRet;
+    }
+
+    sal_Bool Content::exchangeIdentity( const uno::Reference< ucb::XContentIdentifier >& /*xNewId*/ )
+    {
+        sal_Bool bRet = sal_False;
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::exchangeIdentity()\n" );
+#endif
+        // TODO Implement me
+
+        return bRet;
+    }
+
+    uno::Sequence< beans::Property > Content::getProperties(
+            const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
+    {
+        static const beans::Property aGenericProperties[] =
+        {
+            beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
+                -1, getCppuBooleanType(),
+                beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+            beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
+                -1, getCppuBooleanType(),
+                beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+            beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
+                -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+                beans::PropertyAttribute::BOUND ),
+            beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
+                -1, getCppuBooleanType(),
+                beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+            beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ),
+                -1, getCppuType( static_cast< const util::DateTime * >( 0 ) ),
+                beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+            beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ),
+                -1, getCppuType( static_cast< const util::DateTime * >( 0 ) ),
+                beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+            beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ),
+                -1, getCppuType( static_cast< const sal_Int64 * >( 0 ) ),
+                beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+        };
+
+        const int nProps = SAL_N_ELEMENTS(aGenericProperties);
+        return uno::Sequence< beans::Property > ( aGenericProperties, nProps );
+    }
+
+    uno::Sequence< ucb::CommandInfo > Content::getCommands(
+            const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+    {
+        static ucb::CommandInfo aCommandInfoTable[] =
+        {
+            // Required commands
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
+              -1, getCppuVoidType() ),
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
+              -1, getCppuVoidType() ),
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
+              -1, getCppuType( static_cast<uno::Sequence< beans::Property > * >( 0 ) ) ),
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
+              -1, getCppuType( static_cast<uno::Sequence< beans::PropertyValue > * >( 0 ) ) ),
+
+            // Optional standard commands
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
+              -1, getCppuBooleanType() ),
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
+              -1, getCppuType( static_cast<ucb::InsertCommandArgument * >( 0 ) ) ),
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
+              -1, getCppuType( static_cast<ucb::OpenCommandArgument2 * >( 0 ) ) ),
+
+            // Folder Only, omitted if not a folder
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
+              -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ),
+            ucb::CommandInfo
+            ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+              -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
+        };
+
+        const int nProps = SAL_N_ELEMENTS(aCommandInfoTable);
+        return uno::Sequence< ucb::CommandInfo >(aCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 2);
+    }
+
+    ::rtl::OUString Content::getParentURL()
+    {
+        rtl::OUString sRet;
+
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::getParentURL()\n" );
+#endif
+        // TODO Implement me
+
+        return sRet;
+    }
+
+    XTYPEPROVIDER_COMMON_IMPL( Content );
+
+    void SAL_CALL Content::acquire() throw()
+    {
+        ContentImplHelper::acquire();
+    }
+
+    void SAL_CALL Content::release() throw()
+    {
+        ContentImplHelper::release();
+    }
+
+    uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType ) throw ( uno::RuntimeException )
+    {
+        uno::Any aRet = cppu::queryInterface( rType, static_cast< ucb::XContentCreator * >( this ) );
+        return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface(rType);
+    }
+
+    rtl::OUString SAL_CALL Content::getImplementationName() throw( uno::RuntimeException )
+    {
+       return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.CmisContent"));
+    }
+
+    uno::Sequence< rtl::OUString > SAL_CALL Content::getSupportedServiceNames()
+           throw( uno::RuntimeException )
+    {
+           uno::Sequence< rtl::OUString > aSNS( 1 );
+           aSNS.getArray()[ 0 ] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.CmisContent"));
+           return aSNS;
+    }
+
+    rtl::OUString SAL_CALL Content::getContentType() throw( uno::RuntimeException )
+    {
+        return isFolder(uno::Reference< ucb::XCommandEnvironment >())
+            ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CMIS_FOLDER_TYPE ))
+            : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CMIS_FILE_TYPE ));
+    }
+
+    uno::Any SAL_CALL Content::execute(
+        const ucb::Command& aCommand,
+        sal_Int32 /*CommandId*/,
+        const uno::Reference< ucb::XCommandEnvironment >& xEnv )
+            throw( uno::Exception, ucb::CommandAbortedException, uno::RuntimeException )
+    {
+        uno::Any aRet;
+
+        if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getPropertyValues" ) ))
+        {
+            uno::Sequence< beans::Property > Properties;
+            if ( !( aCommand.Argument >>= Properties ) )
+                ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
+            aRet <<= getPropertyValues( Properties, xEnv );
+        }
+        else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getPropertySetInfo" ) ))
+            aRet <<= getPropertySetInfo( xEnv, sal_False );
+        else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getCommandInfo" ) ))
+            aRet <<= getCommandInfo( xEnv, sal_False );
+        else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "open" ) ))
+        {
+            ucb::OpenCommandArgument2 aOpenCommand;
+            if ( !( aCommand.Argument >>= aOpenCommand ) )
+                ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
+            aRet = open( aOpenCommand, xEnv );
+        }
+        else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "transfer" ) ))
+        {
+            ucb::TransferInfo transferArgs;
+            if ( !( aCommand.Argument >>= transferArgs ) )
+                ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
+            transfer( transferArgs, xEnv );
+        }
+        else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "setPropertyValues" ) ))
+        {
+            uno::Sequence< beans::PropertyValue > aProperties;
+            if ( !( aCommand.Argument >>= aProperties ) || !aProperties.getLength() )
+                ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
+            aRet <<= setPropertyValues( aProperties, xEnv );
+        }
+        else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) )
+                 && isFolder( xEnv ) )
+        {
+            ucb::ContentInfo arg;
+            if ( !( aCommand.Argument >>= arg ) )
+                    ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
+            aRet <<= createNewContent( arg );
+        }
+        else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "insert" ) ))
+        {
+            ucb::InsertCommandArgument arg;
+            if ( !( aCommand.Argument >>= arg ) )
+                    ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
+            insert( arg.Data, arg.ReplaceExisting, xEnv );
+        }
+        else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "delete" ) ))
+        {
+            sal_Bool bDeletePhysical = sal_False;
+            aCommand.Argument >>= bDeletePhysical;
+
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::execute() - delete\n" );
+#endif
+            // TODO Actually delete it
+
+            destroy( bDeletePhysical );
+        }
+        else
+        {
+#if OSL_DEBUG_LEVEL > 1
+            fprintf( stderr, "cmis::Content::execute() - UNKNOWN COMMAND\n" );
+#endif
+
+            ucbhelper::cancelCommandExecution
+                ( uno::makeAny( ucb::UnsupportedCommandException
+                  ( rtl::OUString(),
+                    static_cast< cppu::OWeakObject * >( this ) ) ),
+                  xEnv );
+        }
+
+        return aRet;
+    }
+
+    void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ ) throw( uno::RuntimeException )
+    {
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "TODO - cmis::Content::abort()\n" );
+#endif
+        // TODO Implement me
+    }
+
+    uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo()
+            throw( uno::RuntimeException )
+    {
+        return queryCreatableContentsInfo( uno::Reference< ucb::XCommandEnvironment >() );
+    }
+
+    uno::Reference< ucb::XContent > SAL_CALL Content::createNewContent(
+            const ucb::ContentInfo& Info ) throw( uno::RuntimeException )
+    {
+        bool create_document;
+        const char *name;
+
+        if ( Info.Type.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( CMIS_FILE_TYPE ) ) )
+            create_document = true;
+        else if ( Info.Type.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( CMIS_FOLDER_TYPE ) ) )
+            create_document = false;
+        else
+        {
+#if OSL_DEBUG_LEVEL > 1
+            fprintf( stderr, "Failed to create new content '%s'",
+                    rtl::OUStringToOString(Info.Type, RTL_TEXTENCODING_UTF8).getStr() );
+#endif
+            return uno::Reference< ucb::XContent >();
+        }
+
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, "createNewContent (%d)", (int) create_document );
+#endif
+
+        rtl::OUString aURL = m_xIdentifier->getContentIdentifier();
+
+        if ( ( aURL.lastIndexOf( '/' ) + 1 ) != aURL.getLength() )
+                aURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
+
+        name = create_document ? "[New_Content]" : "[New_Collection]";
+        aURL += rtl::OUString::createFromAscii( name );
+
+        uno::Reference< ucb::XContentIdentifier > xId(new ::ucbhelper::ContentIdentifier(m_xSMgr, aURL));
+
+        try
+        {
+            return new ::cmis::Content( m_xSMgr, m_pProvider, xId, !create_document );
+        } catch ( ucb::ContentCreationException & )
+        {
+                return uno::Reference< ucb::XContent >();
+        }
+    }
+
+    uno::Sequence< uno::Type > SAL_CALL Content::getTypes() throw( uno::RuntimeException )
+    {
+        if ( isFolder( uno::Reference< ucb::XCommandEnvironment >() ) )
+        {
+            static cppu::OTypeCollection aFolderCollection
+                (CPPU_TYPE_REF( lang::XTypeProvider ),
+                 CPPU_TYPE_REF( lang::XServiceInfo ),
+                 CPPU_TYPE_REF( lang::XComponent ),
+                 CPPU_TYPE_REF( ucb::XContent ),
+                 CPPU_TYPE_REF( ucb::XCommandProcessor ),
+                 CPPU_TYPE_REF( beans::XPropertiesChangeNotifier ),

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list