summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-05-14 13:49:20 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-05-14 13:49:20 +0000
commit065b374d695f5208c6dcdad8ead3f1ff6223036f (patch)
treedba972aac7f924dbf20c109d4b26f53b2e4efa7c
parent9f3ce0477113161ee0e9c591baf437c0230843b2 (diff)
INTEGRATION: CWS ucpgio1 (1.1.2); FILE ADDED
2008/04/30 16:35:19 cmc 1.1.2.1: #i88090# add gio content provider
-rw-r--r--ucb/source/ucp/gio/gio_mount.hxx75
-rw-r--r--ucb/source/ucp/gio/gio_outputstream.cxx95
-rw-r--r--ucb/source/ucp/gio/gio_outputstream.hxx85
-rw-r--r--ucb/source/ucp/gio/gio_provider.cxx176
-rw-r--r--ucb/source/ucp/gio/gio_provider.hxx69
-rw-r--r--ucb/source/ucp/gio/gio_resultset.cxx62
-rw-r--r--ucb/source/ucp/gio/gio_resultset.hxx59
-rw-r--r--ucb/source/ucp/gio/gio_seekable.cxx132
-rw-r--r--ucb/source/ucp/gio/gio_seekable.hxx83
-rw-r--r--ucb/source/ucp/gio/ucpgio-ucd.txt6
10 files changed, 842 insertions, 0 deletions
diff --git a/ucb/source/ucp/gio/gio_mount.hxx b/ucb/source/ucp/gio/gio_mount.hxx
new file mode 100644
index 000000000000..d6e57e89fc60
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_mount.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_mount.hxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef GIO_MOUNT_HXX
+#define GIO_MOUNT_HXX
+
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define OOO_TYPE_MOUNT_OPERATION (ooo_mount_operation_get_type ())
+#define OOO_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), OOO_TYPE_MOUNT_OPERATION, OOoMountOperation))
+#define OOO_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), OOO_TYPE_MOUNT_OPERATION, OOoMountOperationClass))
+#define OOO_IS_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), OOO_TYPE_MOUNT_OPERATION))
+#define OOO_IS_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), OOO_TYPE_MOUNT_OPERATION))
+#define OOO_MOUNT_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), OOO_TYPE_MOUNT_OPERATION, OOoMountOperationClass))
+
+typedef struct OOoMountOperation OOoMountOperation;
+typedef struct OOoMountOperationClass OOoMountOperationClass;
+typedef struct OOoMountOperationPrivate OOoMountOperationPrivate;
+
+struct OOoMountOperation
+{
+ GMountOperation parent_instance;
+
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > *pEnv;
+ char *m_pPrevUsername;
+ char *m_pPrevPassword;
+};
+
+struct OOoMountOperationClass
+{
+ GMountOperationClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+
+GType ooo_mount_operation_get_type (void);
+GMountOperation *ooo_mount_operation_new(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rEnv);
+
+G_END_DECLS
+#endif
diff --git a/ucb/source/ucp/gio/gio_outputstream.cxx b/ucb/source/ucp/gio/gio_outputstream.cxx
new file mode 100644
index 000000000000..05f9bfbdb176
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_outputstream.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_outputstream.cxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <rtl/memory.h>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <ucbhelper/cancelcommandexecution.hxx>
+#include <string.h>
+
+#include "gio_outputstream.hxx"
+#include "gio_content.hxx"
+
+using namespace com::sun::star;
+
+namespace gio
+{
+
+OutputStream::OutputStream(GFileOutputStream *pStream) : Seekable(G_SEEKABLE(pStream)), mpStream(pStream)
+{
+ if (!mpStream)
+ throw io::NotConnectedException();
+}
+
+OutputStream::~OutputStream( void )
+{
+ closeOutput();
+}
+
+void SAL_CALL OutputStream::writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& rData )
+ throw( io::NotConnectedException, io::BufferSizeExceededException,
+ io::IOException, uno::RuntimeException)
+{
+ if (!mpStream)
+ throw io::NotConnectedException();
+
+ GError *pError=NULL;
+ if (!g_output_stream_write_all(G_OUTPUT_STREAM(mpStream), rData.getConstArray(), rData.getLength(), NULL, NULL, &pError))
+ convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+}
+
+void SAL_CALL OutputStream::flush( void )
+ throw( io::NotConnectedException, io::BufferSizeExceededException,
+ io::IOException, uno::RuntimeException )
+{
+ if (!mpStream)
+ throw io::NotConnectedException();
+
+ GError *pError=NULL;
+ if (!g_output_stream_flush(G_OUTPUT_STREAM(mpStream), NULL, &pError))
+ convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+}
+
+void SAL_CALL OutputStream::closeOutput( void )
+ throw( io::NotConnectedException, io::IOException,
+ uno::RuntimeException )
+{
+ if (mpStream)
+ g_output_stream_close(G_OUTPUT_STREAM(mpStream), NULL, NULL);
+}
+
+uno::Any OutputStream::queryInterface( const uno::Type &type ) throw( uno::RuntimeException )
+{
+ uno::Any aRet = ::cppu::queryInterface ( type,
+ static_cast< XOutputStream * >( this ) );
+
+ return aRet.hasValue() ? aRet : Seekable::queryInterface( type );
+}
+
+}
diff --git a/ucb/source/ucp/gio/gio_outputstream.hxx b/ucb/source/ucp/gio/gio_outputstream.hxx
new file mode 100644
index 000000000000..20a036249b36
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_outputstream.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_outputstream.hxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef GIO_OUTPUTSTREAM_HXX
+#define GIO_OUTPUTSTREAM_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+
+#include "gio_seekable.hxx"
+
+namespace gio
+{
+
+class OutputStream :
+ public ::com::sun::star::io::XOutputStream,
+ public Seekable
+{
+private:
+ GFileOutputStream *mpStream;
+
+public:
+ OutputStream ( GFileOutputStream *pStream );
+ virtual ~OutputStream();
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & type )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire( void ) throw () { OWeakObject::acquire(); }
+ virtual void SAL_CALL release( void ) throw() { OWeakObject::release(); }
+
+ // XOutputStream
+ virtual void SAL_CALL writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL flush( void )
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+
+ virtual void SAL_CALL closeOutput( void )
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+};
+
+} // namespace gio
+#endif
diff --git a/ucb/source/ucp/gio/gio_provider.cxx b/ucb/source/ucp/gio/gio_provider.cxx
new file mode 100644
index 000000000000..77718a82da9b
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_provider.cxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_provider.cxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/contenthelper.hxx>
+#include <com/sun/star/ucb/ContentCreationException.hpp>
+#include "gio_provider.hxx"
+#include "gio_content.hxx"
+
+#include <stdio.h>
+
+using namespace com::sun::star;
+
+namespace gio
+{
+uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
+ContentProvider::queryContent(
+ const uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >& Identifier )
+ throw( com::sun::star::ucb::IllegalIdentifierException,
+ uno::RuntimeException )
+{
+#ifdef DEBUG
+ fprintf(stderr, "QueryContent: '%s'",
+ (const sal_Char *)rtl::OUStringToOString
+ (Identifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8));
+#endif
+
+ osl::MutexGuard aGuard( m_aMutex );
+
+ // Check, if a content with given id already exists...
+ uno::Reference< ucb::XContent > xContent = queryExistingContent( Identifier ).get();
+ if ( xContent.is() )
+ return xContent;
+
+ try
+ {
+ xContent = new ::gio::Content(m_xSMgr, this, Identifier);
+ }
+ catch ( com::sun::star::ucb::ContentCreationException const & )
+ {
+ throw com::sun::star::ucb::IllegalIdentifierException();
+ }
+
+ if ( !xContent->getIdentifier().is() )
+ throw com::sun::star::ucb::IllegalIdentifierException();
+
+ return xContent;
+}
+
+ContentProvider::ContentProvider(
+ const uno::Reference< lang::XMultiServiceFactory >& rSMgr )
+: ::ucbhelper::ContentProviderImplHelper( rSMgr )
+{
+}
+
+ContentProvider::~ContentProvider()
+{
+}
+
+XINTERFACE_IMPL_3( ContentProvider,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ com::sun::star::ucb::XContentProvider );
+
+XTYPEPROVIDER_IMPL_3( ContentProvider,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ com::sun::star::ucb::XContentProvider );
+
+XSERVICEINFO_IMPL_1( ContentProvider,
+ rtl::OUString::createFromAscii(
+ "com.sun.star.comp.GIOContentProvider" ),
+ rtl::OUString::createFromAscii(
+ "com.sun.star.ucb.GIOContentProvider" ) );
+
+ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
+
+}
+
+static sal_Bool writeInfo( void *pRegistryKey,
+ const rtl::OUString &rImplementationName, uno::Sequence< rtl::OUString > const &rServiceNames )
+{
+ rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) );
+ aKeyName += rImplementationName;
+ aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" );
+
+ uno::Reference< registry::XRegistryKey > xKey;
+ try
+ {
+ xKey = static_cast< registry::XRegistryKey * > (pRegistryKey )->createKey( aKeyName );
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {}
+
+ if ( !xKey.is() )
+ return sal_False;
+
+ sal_Bool bSuccess = sal_True;
+
+ for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n )
+ {
+ try
+ {
+ xKey->createKey( rServiceNames[ n ] );
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ bSuccess = sal_False;
+ break;
+ }
+ }
+ return bSuccess;
+}
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **ppEnvTypeName, uno_Environment **)
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void *, void *pRegistryKey )
+{
+ return pRegistryKey &&
+ writeInfo( pRegistryKey,
+ ::gio::ContentProvider::getImplementationName_Static(),
+ ::gio::ContentProvider::getSupportedServiceNames_Static() );
+}
+
+extern "C" void * SAL_CALL component_getFactory( const sal_Char *pImplName,
+ void *pServiceManager, void * )
+{
+ void * pRet = 0;
+
+ uno::Reference< lang::XMultiServiceFactory > xSMgr
+ (reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ if ( !::gio::ContentProvider::getImplementationName_Static().compareToAscii( pImplName ) )
+ xFactory = ::gio::ContentProvider::createServiceFactory( xSMgr );
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
diff --git a/ucb/source/ucp/gio/gio_provider.hxx b/ucb/source/ucp/gio/gio_provider.hxx
new file mode 100644
index 000000000000..95b928d9c100
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_provider.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_provider.hxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef GIO_PROVIDER_HXX
+#define GIO_PROVIDER_HXX
+
+#include <com/sun/star/beans/Property.hpp>
+#include <ucbhelper/providerhelper.hxx>
+
+#define GIO_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.GIOContentProvider"
+
+namespace gio
+{
+
+class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
+{
+public:
+ ContentProvider( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
+ virtual ~ContentProvider();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_DECL()
+
+ // XContentProvider
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent > SAL_CALL
+ queryContent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier )
+ throw( ::com::sun::star::ucb::IllegalIdentifierException,
+ ::com::sun::star::uno::RuntimeException );
+};
+
+}
+
+#endif
diff --git a/ucb/source/ucp/gio/gio_resultset.cxx b/ucb/source/ucp/gio/gio_resultset.cxx
new file mode 100644
index 000000000000..4934b6ee54a5
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_resultset.cxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_resultset.cxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "gio_datasupplier.hxx"
+#include "gio_resultset.hxx"
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+
+using namespace gio;
+
+DynamicResultSet::DynamicResultSet(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const Reference< Content >& rxContent,
+ const OpenCommandArgument2& rCommand,
+ const Reference< XCommandEnvironment >& rxEnv )
+ : ResultSetImplHelper( rxSMgr, rCommand ),
+ m_xContent( rxContent ),
+ m_xEnv( rxEnv )
+{
+}
+
+void DynamicResultSet::initStatic()
+{
+ m_xResultSet1 = new ::ucbhelper::ResultSet(
+ m_xSMgr, m_aCommand.Properties,
+ new DataSupplier( m_xSMgr, m_xContent, m_aCommand.Mode ), m_xEnv );
+}
+
+void DynamicResultSet::initDynamic()
+{
+ initStatic();
+ m_xResultSet2 = m_xResultSet1;
+}
diff --git a/ucb/source/ucp/gio/gio_resultset.hxx b/ucb/source/ucp/gio/gio_resultset.hxx
new file mode 100644
index 000000000000..d5a24e9b864f
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_resultset.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_resultset.hxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef GIO_RESULTSET_HXX
+#define GIO_RESULTSET_HXX
+
+#include <ucbhelper/resultsethelper.hxx>
+#include "gio_content.hxx"
+
+namespace gio
+{
+
+ class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper
+ {
+ com::sun::star::uno::Reference< Content > m_xContent;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xEnv;
+
+ private:
+ virtual void initStatic();
+ virtual void initDynamic();
+
+ public:
+ DynamicResultSet(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::uno::Reference< Content >& rxContent,
+ const com::sun::star::ucb::OpenCommandArgument2& rCommand,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& rxEnv );
+ };
+}
+
+#endif
diff --git a/ucb/source/ucp/gio/gio_seekable.cxx b/ucb/source/ucp/gio/gio_seekable.cxx
new file mode 100644
index 000000000000..ae5c6dd9121d
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_seekable.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_seekable.cxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <rtl/memory.h>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <ucbhelper/cancelcommandexecution.hxx>
+#include <string.h>
+
+#include "gio_seekable.hxx"
+#include "gio_content.hxx"
+
+using namespace com::sun::star;
+
+namespace gio
+{
+
+Seekable::Seekable(GSeekable *pStream) : mpStream(pStream)
+{
+ if (!mpStream)
+ throw io::NotConnectedException();
+}
+
+Seekable::~Seekable( void )
+{
+}
+
+void SAL_CALL Seekable::truncate( void )
+ throw( io::IOException, uno::RuntimeException )
+{
+ if (!mpStream)
+ throw io::NotConnectedException();
+
+ if (!g_seekable_can_truncate(mpStream))
+ throw io::IOException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Truncate unsupported")),
+ static_cast< cppu::OWeakObject * >(this));
+
+ GError *pError=NULL;
+ if (!g_seekable_truncate(mpStream, 0, NULL, &pError))
+ convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+}
+
+void SAL_CALL Seekable::seek( sal_Int64 location )
+ throw( lang::IllegalArgumentException, io::IOException, uno::RuntimeException )
+{
+ if (!mpStream)
+ throw io::NotConnectedException();
+
+ if (!g_seekable_can_seek(mpStream))
+ throw io::IOException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Seek unsupported")),
+ static_cast< cppu::OWeakObject * >(this));
+
+ GError *pError=NULL;
+ if (!g_seekable_seek(mpStream, location, G_SEEK_SET, NULL, &pError))
+ convertToException(pError, static_cast< cppu::OWeakObject * >(this));
+}
+
+sal_Int64 SAL_CALL Seekable::getPosition() throw( io::IOException, uno::RuntimeException )
+{
+ if (!mpStream)
+ throw io::NotConnectedException();
+
+ return g_seekable_tell(mpStream);
+}
+
+sal_Int64 SAL_CALL Seekable::getLength() throw( io::IOException, uno::RuntimeException )
+{
+ if (!mpStream)
+ throw io::NotConnectedException();
+
+ GFileInfo* pInfo = G_IS_FILE_INPUT_STREAM(mpStream)
+ ? g_file_input_stream_query_info(G_FILE_INPUT_STREAM(mpStream), const_cast<char*>(G_FILE_ATTRIBUTE_STANDARD_SIZE), NULL, NULL)
+ : g_file_output_stream_query_info(G_FILE_OUTPUT_STREAM(mpStream), const_cast<char*>(G_FILE_ATTRIBUTE_STANDARD_SIZE), NULL, NULL);
+
+ if (!pInfo)
+ throw io::IOException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Getting attributes unsupported")),
+ static_cast< cppu::OWeakObject * >(this));
+
+ bool bOk = true;
+ sal_uInt64 nSize = 0;
+ if (g_file_info_has_attribute(pInfo, G_FILE_ATTRIBUTE_STANDARD_SIZE))
+ nSize = g_file_info_get_size(pInfo);
+ else
+ bOk = false;
+
+ g_object_unref(pInfo);
+
+ if (!bOk)
+ throw io::IOException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Getting size unsupported")),
+ static_cast< cppu::OWeakObject * >(this));
+
+ return nSize;
+}
+
+uno::Any Seekable::queryInterface( const uno::Type &type ) throw( uno::RuntimeException )
+{
+ uno::Any aRet = ::cppu::queryInterface ( type,
+ static_cast< XSeekable * >( this ) );
+
+ if (!aRet.hasValue() && g_seekable_can_truncate(mpStream))
+ aRet = ::cppu::queryInterface ( type, static_cast< XTruncate * >( this ) );
+
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( type );
+}
+
+}
diff --git a/ucb/source/ucp/gio/gio_seekable.hxx b/ucb/source/ucp/gio/gio_seekable.hxx
new file mode 100644
index 000000000000..e32ad844402e
--- /dev/null
+++ b/ucb/source/ucp/gio/gio_seekable.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gio_seekable.hxx,v $
+ * $Revision: 1.2 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef GIO_SEEKABLE_HXX
+#define GIO_SEEKABLE_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+
+#include <gio/gio.h>
+
+namespace gio
+{
+
+class Seekable : public ::com::sun::star::io::XTruncate,
+ public ::com::sun::star::io::XSeekable,
+ public ::cppu::OWeakObject
+{
+private:
+ GSeekable *mpStream;
+public:
+ Seekable( GSeekable *pStream );
+ virtual ~Seekable();
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & type )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire( void ) throw () { OWeakObject::acquire(); }
+ virtual void SAL_CALL release( void ) throw() { OWeakObject::release(); }
+
+ // XSeekable
+ virtual void SAL_CALL seek( sal_Int64 location )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int64 SAL_CALL getPosition()
+ throw( ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int64 SAL_CALL getLength()
+ throw( ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XTruncate
+ virtual void SAL_CALL truncate( void )
+ throw( com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+};
+
+} // namespace gio
+#endif
diff --git a/ucb/source/ucp/gio/ucpgio-ucd.txt b/ucb/source/ucp/gio/ucpgio-ucd.txt
new file mode 100644
index 000000000000..ce7657fa73e3
--- /dev/null
+++ b/ucb/source/ucp/gio/ucpgio-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+ImplementationName=com.sun.star.comp.GIOContentProvider
+ComponentName=ucpgio1.uno.so
+LoaderName=com.sun.star.loader.SharedLibrary
+[SupportedServices]
+com.sun.star.ucb.GIOContentProvider