summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-24 12:05:06 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-24 12:05:06 +0100
commitad195dcdbcb178b2df5602babb825863096f1c7a (patch)
treed57d9fdf755d8c01ed1e59ec8bc6c28c0cd528e0
parentb0db7d65f63c2267212b02d8f9f8f864a5f08f94 (diff)
slidecopy: initial version of an UCP for browsing the content of the deployed extensions
-rw-r--r--officecfg/registry/data/org/openoffice/ucb/Configuration.xcu11
-rw-r--r--ucb/prj/build.lst1
-rw-r--r--ucb/source/ucp/ext/makefile.mk65
-rw-r--r--ucb/source/ucp/ext/ucpext.uno.map8
-rw-r--r--ucb/source/ucp/ext/ucpext_content.cxx489
-rw-r--r--ucb/source/ucp/ext/ucpext_content.hxx144
-rw-r--r--ucb/source/ucp/ext/ucpext_datasupplier.cxx295
-rw-r--r--ucb/source/ucp/ext/ucpext_datasupplier.hxx84
-rw-r--r--ucb/source/ucp/ext/ucpext_provider.cxx147
-rw-r--r--ucb/source/ucp/ext/ucpext_provider.hxx64
-rw-r--r--ucb/source/ucp/ext/ucpext_resultset.cxx97
-rw-r--r--ucb/source/ucp/ext/ucpext_resultset.hxx66
-rw-r--r--ucb/source/ucp/ext/ucpext_services.cxx93
13 files changed, 1564 insertions, 0 deletions
diff --git a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
index cf606e456691..c86a1e5315f5 100644
--- a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
+++ b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
@@ -178,6 +178,17 @@
<value/>
</prop>
</node>
+ <node oor:name="Provider14" oor:op="replace">
+ <prop oor:name="ServiceName">
+ <value>com.sun.star.ucb.ExtensionContentProvider</value>
+ </prop>
+ <prop oor:name="URLTemplate">
+ <value>vnd.oracle.ooo.extension</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/ucb/prj/build.lst b/ucb/prj/build.lst
index f0eb0da8395e..f97493acb0e8 100644
--- a/ucb/prj/build.lst
+++ b/ucb/prj/build.lst
@@ -14,3 +14,4 @@ uc ucb\source\ucp\webdav nmake - all uc_webdav uc_inc NULL
uc ucb\source\ucp\package nmake - all uc_package uc_inc NULL
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
diff --git a/ucb/source/ucp/ext/makefile.mk b/ucb/source/ucp/ext/makefile.mk
new file mode 100644
index 000000000000..f8919e50e594
--- /dev/null
+++ b/ucb/source/ucp/ext/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# 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: makefile.mk,v $
+#
+# $Revision: 1.4 $
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+PRJNAME = ucb
+TARGET = ucpext.uno
+ENABLE_EXCEPTIONS = TRUE
+
+.INCLUDE : settings.mk
+DLLPRE =
+
+SLOFILES= \
+ $(SLO)$/ucpext_provider.obj \
+ $(SLO)$/ucpext_content.obj \
+ $(SLO)$/ucpext_services.obj \
+ $(SLO)$/ucpext_resultset.obj \
+ $(SLO)$/ucpext_datasupplier.obj
+
+SHL1STDLIBS = \
+ $(UCBHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB)
+
+SHL1VERSIONMAP = $(TARGET).map
+SHL1TARGET = $(TARGET)
+
+SHL1DEPN =
+SHL1IMPLIB = i$(TARGET)
+SHL1LIBS = $(SLB)$/$(TARGET).lib
+SHL1DEF = $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME = $(SHL1TARGET)
+
+.INCLUDE : target.mk
diff --git a/ucb/source/ucp/ext/ucpext.uno.map b/ucb/source/ucp/ext/ucpext.uno.map
new file mode 100644
index 000000000000..f4ed78b9e970
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext.uno.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx
new file mode 100644
index 000000000000..27579f2a1d9f
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_content.cxx
@@ -0,0 +1,489 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#include "precompiled_ucb.hxx"
+
+#include "ucpext_content.hxx"
+
+#include "ucpext_content.hxx"
+#include "ucpext_provider.hxx"
+#include "ucpext_resultset.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/lang/IllegalAccessException.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/ucb/OpenCommandArgument2.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/OpenCommandArgument2.hpp>
+#include <com/sun/star/ucb/OpenMode.hpp>
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#include <com/sun/star/lang/IllegalAccessException.hpp>
+/** === end UNO includes === **/
+
+#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/propertyvalueset.hxx>
+#include <ucbhelper/cancelcommandexecution.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/string.hxx>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::ucb::XContentIdentifier;
+ using ::com::sun::star::ucb::IllegalIdentifierException;
+ using ::com::sun::star::ucb::XContent;
+ using ::com::sun::star::ucb::XCommandEnvironment;
+ using ::com::sun::star::ucb::Command;
+ using ::com::sun::star::ucb::CommandAbortedException;
+ using ::com::sun::star::beans::Property;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::ucb::OpenCommandArgument2;
+ using ::com::sun::star::ucb::XDynamicResultSet;
+ using ::com::sun::star::ucb::UnsupportedOpenModeException;
+ using ::com::sun::star::io::XOutputStream;
+ using ::com::sun::star::io::XActiveDataSink;
+ using ::com::sun::star::io::XInputStream;
+ using ::com::sun::star::ucb::UnsupportedDataSinkException;
+ using ::com::sun::star::ucb::UnsupportedCommandException;
+ using ::com::sun::star::sdbc::XRow;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::beans::PropertyChangeEvent;
+ using ::com::sun::star::lang::IllegalAccessException;
+ using ::com::sun::star::ucb::CommandInfo;
+ /** === end UNO using === **/
+ namespace OpenMode = ::com::sun::star::ucb::OpenMode;
+ namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
+
+ //==================================================================================================================
+ //= Content
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ Content::Content( const Reference< XMultiServiceFactory >& i_rORB, ::ucbhelper::ContentProviderImplHelper* i_pProvider,
+ const Reference< XContentIdentifier >& i_rIdentifier )
+ :Content_Base( i_rORB, i_pProvider, i_rIdentifier )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Content::~Content()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL Content::getImplementationName() throw( RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.ucp.ext.Content" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL Content::getSupportedServiceNames() throw( RuntimeException )
+ {
+ Sequence< ::rtl::OUString > aServiceNames(2);
+ aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.Content" ) );
+ aServiceNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.ExtensionContent" ) );
+ return aServiceNames;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL Content::getContentType() throw( RuntimeException )
+ {
+ return m_aProps.aContentType;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL Content::execute( const Command& aCommand, sal_Int32 /* CommandId */, const Reference< XCommandEnvironment >& i_rEvironment )
+ throw( Exception, CommandAbortedException, RuntimeException )
+ {
+ Any aRet;
+
+ if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getPropertyValues" ) ) )
+ {
+ Sequence< Property > Properties;
+ if ( !( aCommand.Argument >>= Properties ) )
+ {
+ ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
+ ::rtl::OUString(), *this, -1 ) ),
+ i_rEvironment );
+ // unreachable
+ }
+
+ aRet <<= getPropertyValues( Properties, i_rEvironment );
+ }
+ else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "setPropertyValues" ) ) )
+ {
+ Sequence< PropertyValue > aProperties;
+ if ( !( aCommand.Argument >>= aProperties ) )
+ {
+ ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
+ ::rtl::OUString(), *this, -1 ) ),
+ i_rEvironment );
+ // unreachable
+ }
+
+ if ( !aProperties.getLength() )
+ {
+ ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
+ ::rtl::OUString(), *this, -1 ) ),
+ i_rEvironment );
+ // unreachable
+ }
+
+ aRet <<= setPropertyValues( aProperties, i_rEvironment );
+ }
+ else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getPropertySetInfo" ) ) )
+ {
+ // implemented by base class.
+ aRet <<= getPropertySetInfo( i_rEvironment );
+ }
+ else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getCommandInfo" ) ) )
+ {
+ // implemented by base class.
+ aRet <<= getCommandInfo( i_rEvironment );
+ }
+ else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "open" ) ) )
+ {
+ OpenCommandArgument2 aOpenCommand;
+ if ( !( aCommand.Argument >>= aOpenCommand ) )
+ {
+ ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
+ ::rtl::OUString(), *this, -1 ) ),
+ i_rEvironment );
+ // unreachable
+ }
+
+ sal_Bool bOpenFolder =
+ ( ( aOpenCommand.Mode == OpenMode::ALL ) ||
+ ( aOpenCommand.Mode == OpenMode::FOLDERS ) ||
+ ( aOpenCommand.Mode == OpenMode::DOCUMENTS ) );
+
+
+ if ( bOpenFolder && m_aProps.bIsFolder )
+ {
+ Reference< XDynamicResultSet > xSet = new ResultSet(
+ m_xSMgr, this, aOpenCommand, i_rEvironment );
+ aRet <<= xSet;
+ }
+
+ if ( aOpenCommand.Sink.is() )
+ {
+ // Open document - supply document data stream.
+
+ // Check open mode
+ if ( ( aOpenCommand.Mode == OpenMode::DOCUMENT_SHARE_DENY_NONE )
+ || ( aOpenCommand.Mode == OpenMode::DOCUMENT_SHARE_DENY_WRITE )
+ )
+ {
+ // unsupported.
+ ::ucbhelper::cancelCommandExecution( makeAny( UnsupportedOpenModeException(
+ ::rtl::OUString(), *this, sal_Int16( aOpenCommand.Mode ) ) ),
+ i_rEvironment );
+ // unreachable
+ }
+
+ ::rtl::OUString aURL = m_xIdentifier->getContentIdentifier();
+ Reference< XOutputStream > xOut( aOpenCommand.Sink, UNO_QUERY );
+ if ( xOut.is() )
+ {
+ // TODO: write data into xOut
+ }
+ else
+ {
+ Reference< XActiveDataSink > xDataSink( aOpenCommand.Sink, UNO_QUERY );
+ if ( xDataSink.is() )
+ {
+ Reference< XInputStream > xIn
+ /* @@@ your XInputStream + XSeekable impl. object */;
+ // TODO
+ xDataSink->setInputStream( xIn );
+ }
+ else
+ {
+ // Note: aOpenCommand.Sink may contain an XStream
+ // implementation. Support for this type of
+ // sink is optional...
+ ::ucbhelper::cancelCommandExecution( makeAny( UnsupportedDataSinkException(
+ ::rtl::OUString(), *this, aOpenCommand.Sink ) ),
+ i_rEvironment );
+ // unreachable
+ }
+ }
+ }
+ }
+
+ else
+ {
+ ::ucbhelper::cancelCommandExecution( makeAny( UnsupportedCommandException(
+ ::rtl::OUString(), *this ) ),
+ i_rEvironment );
+ // unreachable
+ }
+
+ return aRet;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL Content::abort( sal_Int32 ) throw( RuntimeException )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString Content::escapeIdentifier( const ::rtl::OUString& i_rIdentifier )
+ {
+ const ::rtl::OUString sQuoteQuotes = ::comphelper::string::searchAndReplaceAllAsciiWithAscii(
+ i_rIdentifier, "%", "%%" );
+ const ::rtl::OUString sQuoteSlashes = ::comphelper::string::searchAndReplaceAllAsciiWithAscii(
+ i_rIdentifier, "/", "%47" );
+ return sQuoteSlashes;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool Content::denotesRootContent( const Reference< XContentIdentifier >& i_rIdentifier )
+ {
+ const sal_Char* pScheme = "vnd.oracle.ooo.extension";
+ const sal_Int32 nSchemeLength = sizeof( "vnd.oracle.ooo.extension" ) - 1;
+ const ::rtl::OUString sIdentifier( i_rIdentifier->getContentIdentifier() );
+ ENSURE_OR_RETURN_FALSE( sIdentifier.matchAsciiL( pScheme, nSchemeLength ), "illegal content URL" );
+ return sIdentifier.copy( nSchemeLength ).equalsAsciiL( ":/", 2 );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString Content::getParentURL()
+ {
+ const ::rtl::OUString sURL = m_xIdentifier->getContentIdentifier();
+ const ::rtl::OUString sParentURL( sURL.copy( 0, sURL.lastIndexOf( '/' ) + 1 ) );
+ return sParentURL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XRow > Content::getPropertyValues( const Reference< XMultiServiceFactory >& i_rORB,
+ const Sequence< Property >& i_rProperties, const ContentProperties& i_rData )
+ {
+ // note: empty sequence means "get values of all supported properties".
+ ::rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( i_rORB );
+
+ const sal_Int32 nCount = i_rProperties.getLength();
+ if ( nCount )
+ {
+ Reference< XPropertySet > xAdditionalPropSet;
+
+ const Property* pProps = i_rProperties.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const Property& rProp = pProps[ n ];
+
+ // Process Core properties.
+ if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) )
+ {
+ xRow->appendString ( rProp, i_rData.aContentType );
+ }
+ else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
+ {
+ xRow->appendString ( rProp, i_rData.aTitle );
+ }
+ else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) )
+ {
+ xRow->appendBoolean( rProp, i_rData.bIsDocument );
+ }
+ else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) )
+ {
+ xRow->appendBoolean( rProp, i_rData.bIsFolder );
+ }
+ else
+ {
+ // append empty entry.
+ xRow->appendVoid( rProp );
+ }
+ }
+ }
+ else
+ {
+ // Append all Core Properties.
+ xRow->appendString ( Property( ::rtl::OUString::createFromAscii( "ContentType" ),
+ -1,
+ getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ i_rData.aContentType );
+ xRow->appendString ( Property( ::rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ i_rData.aTitle );
+ xRow->appendBoolean( Property( ::rtl::OUString::createFromAscii( "IsDocument" ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ i_rData.bIsDocument );
+ xRow->appendBoolean( Property( ::rtl::OUString::createFromAscii( "IsFolder" ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ i_rData.bIsFolder );
+ }
+
+ return Reference< XRow >( xRow.get() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XRow > Content::getPropertyValues( const Sequence< Property >& i_rProperties, const Reference< XCommandEnvironment >& /* xEnv */)
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ return getPropertyValues( m_xSMgr,
+ i_rProperties,
+ m_aProps );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< Any > Content::setPropertyValues( const Sequence< PropertyValue >& i_rValues, const Reference< XCommandEnvironment >& /* xEnv */)
+ {
+ ::osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ Sequence< Any > aRet( i_rValues.getLength() );
+ Sequence< PropertyChangeEvent > aChanges( i_rValues.getLength() );
+
+ PropertyChangeEvent aEvent;
+ aEvent.Source = static_cast< cppu::OWeakObject * >( this );
+ aEvent.Further = sal_False;
+ aEvent.PropertyHandle = -1;
+
+ const PropertyValue* pValues = i_rValues.getConstArray();
+ const sal_Int32 nCount = i_rValues.getLength();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n, ++pValues )
+ {
+ // all our properties are read-only ...
+ aRet[ n ] <<= IllegalAccessException( ::rtl::OUString::createFromAscii( "property is read-only." ), *this );
+ }
+
+ return aRet;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< CommandInfo > Content::getCommands( const Reference< XCommandEnvironment > & /*xEnv*/ )
+ {
+ sal_uInt32 nCommandCount = 5;
+ static const CommandInfo aCommandInfoTable[] =
+ {
+ ///////////////////////////////////////////////////////////////
+ // Mandatory commands
+ ///////////////////////////////////////////////////////////////
+ CommandInfo(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
+ -1,
+ getCppuVoidType()
+ ),
+ CommandInfo(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
+ -1,
+ getCppuVoidType()
+ ),
+ CommandInfo(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
+ -1,
+ getCppuType(
+ static_cast< Sequence< Property > * >( 0 ) )
+ ),
+ CommandInfo(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
+ -1,
+ getCppuType(
+ static_cast< Sequence< PropertyValue > * >( 0 ) )
+ )
+ ///////////////////////////////////////////////////////////////
+ // Optional standard commands
+ ///////////////////////////////////////////////////////////////
+
+ #ifdef IMPLEMENT_COMMAND_OPEN
+ , CommandInfo(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
+ -1,
+ getCppuType( static_cast< OpenCommandArgument2 * >( 0 ) )
+ )
+ #endif
+ };
+
+ return Sequence< CommandInfo >( aCommandInfoTable, nCommandCount );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< Property > Content::getProperties( const Reference< XCommandEnvironment > & /*xEnv*/ )
+ {
+ static Property aProperties[] =
+ {
+ Property(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
+ -1,
+ getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ ),
+ Property(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ ),
+ Property(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ ),
+ Property(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
+ -1,
+ getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ )
+ };
+ return Sequence< Property >( aProperties, sizeof( aProperties ) / sizeof( aProperties[0] ) );
+ }
+
+//......................................................................................................................
+} } } // namespace ucp::ext
+//......................................................................................................................
diff --git a/ucb/source/ucp/ext/ucpext_content.hxx b/ucb/source/ucp/ext/ucpext_content.hxx
new file mode 100644
index 000000000000..9b5667a1d641
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_content.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#ifndef UCB_UCPEXT_CONTENT_HXX
+#define UCB_UCPEXT_CONTENT_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+/** === end UNO includes === **/
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/contenthelper.hxx>
+
+#include <list>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ContentProvider
+ //==================================================================================================================
+ struct ContentProperties
+ {
+ ::rtl::OUString aTitle; // Title
+ ::rtl::OUString aContentType; // ContentType
+ bool bIsDocument; // IsDocument
+ bool bIsFolder; // IsFolder
+
+ ContentProperties()
+ :bIsDocument( false )
+ ,bIsFolder( true )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= ContentProvider
+ //==================================================================================================================
+ typedef ::ucbhelper::ContentImplHelper Content_Base;
+ class Content : public Content_Base
+ {
+ public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValues(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties,
+ const ContentProperties& rData
+ );
+
+ Content(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ ::ucbhelper::ContentProviderImplHelper* pProvider,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& Identifier
+ );
+
+ static bool denotesRootContent( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& i_rIdentifier );
+
+ static ::rtl::OUString
+ escapeIdentifier( const ::rtl::OUString& i_rIdentifier );
+
+ protected:
+ virtual ~Content();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XContent
+ virtual rtl::OUString SAL_CALL getContentType() throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandProcessor
+ virtual com::sun::star::uno::Any SAL_CALL
+ execute(
+ const com::sun::star::ucb::Command& aCommand,
+ sal_Int32 CommandId,
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment
+ )
+ throw ( ::com::sun::star::uno::Exception
+ , ::com::sun::star::ucb::CommandAbortedException
+ , ::com::sun::star::uno::RuntimeException
+ );
+
+ virtual void SAL_CALL
+ abort(
+ sal_Int32 CommandId
+ )
+ throw ( ::com::sun::star::uno::RuntimeException
+ );
+
+ protected:
+ const ContentProperties& getProperties() const { return m_aProps; }
+ ContentProperties& getProperties() { return m_aProps; }
+
+ private:
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > getProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& i_rEnv );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::CommandInfo > getCommands( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& i_rEnv );
+ virtual ::rtl::OUString getParentURL();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv
+ );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ setPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv
+ );
+
+ private:
+ ContentProperties m_aProps;
+ };
+
+//......................................................................................................................
+} } } // namespace ucb::ucp::ext
+//......................................................................................................................
+
+#endif // UCB_UCPEXT_CONTENT_HXX
diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
new file mode 100644
index 000000000000..d40e2339fe70
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
@@ -0,0 +1,295 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#include "precompiled_ucb.hxx"
+
+#include "ucpext_datasupplier.hxx"
+#include "ucpext_content.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/deployment/XPackageInformationProvider.hpp>
+/** === end UNO includes === **/
+
+#include <ucbhelper/contentidentifier.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <ucbhelper/providerhelper.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <vector>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::ucb::XContent;
+ using ::com::sun::star::ucb::XContentIdentifier;
+ using ::com::sun::star::sdbc::XRow;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::ucb::IllegalIdentifierException;
+ using ::com::sun::star::ucb::ResultSetException;
+ using ::com::sun::star::deployment::XPackageInformationProvider;
+ using ::com::sun::star::beans::Property;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= ResultListEntry
+ //==================================================================================================================
+ struct ResultListEntry
+ {
+ ::rtl::OUString sId;
+ Reference< XContentIdentifier > xId;
+ ContentProperties aProperties;
+ Reference< XContent > xContent;
+ Reference< XRow > xRow;
+
+ ResultListEntry( const ::rtl::OUString& i_rParentId, const ::rtl::OUString& i_rLocalId )
+ {
+ aProperties.aTitle = i_rLocalId;
+ sId = i_rParentId + Content::escapeIdentifier( i_rLocalId );
+ }
+ };
+
+ typedef ::std::vector< ResultListEntry > ResultList;
+
+ //==================================================================================================================
+ //= DataSupplier_Impl
+ //==================================================================================================================
+ struct DataSupplier_Impl
+ {
+ ::osl::Mutex m_aMutex;
+ ResultList m_aResults;
+ ::rtl::Reference< Content > m_xContent;
+ Reference< XMultiServiceFactory > m_xSMgr;
+ sal_Int32 m_nOpenMode;
+
+ DataSupplier_Impl( const Reference< XMultiServiceFactory >& i_rORB, const ::rtl::Reference< Content >& i_rContent,
+ const sal_Int32 i_nOpenMode )
+ :m_xContent( i_rContent )
+ ,m_xSMgr( i_rORB )
+ ,m_nOpenMode( i_nOpenMode )
+ {
+ }
+ ~DataSupplier_Impl();
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ DataSupplier_Impl::~DataSupplier_Impl()
+ {
+ }
+
+ //==================================================================================================================
+ //= DataSupplier
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DataSupplier::DataSupplier( const Reference< XMultiServiceFactory >& i_rORB,
+ const ::rtl::Reference< Content >& i_rContent,
+ const sal_Int32 i_nOpenMode )
+ :m_pImpl( new DataSupplier_Impl( i_rORB, i_rContent, i_nOpenMode ) )
+ {
+ try
+ {
+ if ( Content::denotesRootContent( m_pImpl->m_xContent->getIdentifier() ) )
+ {
+ const ::rtl::OUString sContentId( m_pImpl->m_xContent->getIdentifier()->getContentIdentifier() );
+
+ const ::comphelper::ComponentContext aContext( i_rORB );
+ Reference< XPackageInformationProvider > xPackageInfo(
+ aContext.getSingleton( "com.sun.star.deployment.PackageInformationProvider" ), UNO_QUERY_THROW );
+
+ Sequence< Sequence< ::rtl::OUString > > aExtensionInfo( xPackageInfo->getExtensionList() );
+ for ( const Sequence< ::rtl::OUString >* pExtInfo = aExtensionInfo.getConstArray();
+ pExtInfo != aExtensionInfo.getConstArray() + aExtensionInfo.getLength();
+ ++pExtInfo
+ )
+ {
+ ENSURE_OR_CONTINUE( pExtInfo->getLength() > 0, "illegal extension info" );
+
+ ResultListEntry aEntry( sContentId, (*pExtInfo)[0] );
+ aEntry.aProperties.aContentType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.oracle.ooo.extension-content" ) );
+ m_pImpl->m_aResults.push_back( ResultListEntry( aEntry ) );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DataSupplier::~DataSupplier()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 i_nIndex )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( i_nIndex < m_pImpl->m_aResults.size() )
+ {
+ const ::rtl::OUString sId = m_pImpl->m_aResults[ i_nIndex ].sId;
+ if ( sId.getLength() )
+ return sId;
+ }
+
+ OSL_ENSURE( false, "DataSupplier::queryContentIdentifierString: illegal index, or illegal result entry id!" );
+ return ::rtl::OUString();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XContentIdentifier > DataSupplier::queryContentIdentifier( sal_uInt32 i_nIndex )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( i_nIndex < m_pImpl->m_aResults.size() )
+ {
+ Reference< XContentIdentifier > xId( m_pImpl->m_aResults[ i_nIndex ].xId );
+ if ( xId.is() )
+ return xId;
+ }
+
+ ::rtl::OUString sId = queryContentIdentifierString( i_nIndex );
+ if ( sId.getLength() )
+ {
+ Reference< XContentIdentifier > xId = new ::ucbhelper::ContentIdentifier( sId );
+ m_pImpl->m_aResults[ i_nIndex ].xId = xId;
+ return xId;
+ }
+
+ return Reference< XContentIdentifier >();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XContent > DataSupplier::queryContent( sal_uInt32 i_nIndex )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ ENSURE_OR_RETURN( i_nIndex < m_pImpl->m_aResults.size(), "illegal index!", NULL );
+
+ Reference< XContent > xContent( m_pImpl->m_aResults[ i_nIndex ].xContent );
+ if ( xContent.is() )
+ return xContent;
+
+ Reference< XContentIdentifier > xId( queryContentIdentifier( i_nIndex ) );
+ if ( xId.is() )
+ {
+ try
+ {
+ Reference< XContent > xContent( m_pImpl->m_xContent->getProvider()->queryContent( xId ) );
+ m_pImpl->m_aResults[ i_nIndex ].xContent = xContent;
+ return xContent;
+
+ }
+ catch ( const IllegalIdentifierException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ return Reference< XContent >();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool DataSupplier::getResult( sal_uInt32 i_nIndex )
+ {
+ ::osl::ClearableGuard< ::osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_aResults.size() > i_nIndex )
+ // result already present.
+ return sal_True;
+
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_uInt32 DataSupplier::totalCount()
+ {
+ ::osl::ClearableGuard< ::osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ return m_pImpl->m_aResults.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_uInt32 DataSupplier::currentCount()
+ {
+ return m_pImpl->m_aResults.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool DataSupplier::isCountFinal()
+ {
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XRow > DataSupplier::queryPropertyValues( sal_uInt32 i_nIndex )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ ENSURE_OR_RETURN( i_nIndex < m_pImpl->m_aResults.size(), "DataSupplier::queryPropertyValues: illegal index!", NULL );
+
+ Reference< XRow > xRow = m_pImpl->m_aResults[ i_nIndex ].xRow;
+ if ( xRow.is() )
+ return xRow;
+
+ xRow = Content::getPropertyValues( m_pImpl->m_xSMgr, getResultSet()->getProperties(),
+ m_pImpl->m_aResults[ i_nIndex ].aProperties );
+ return xRow;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DataSupplier::releasePropertyValues( sal_uInt32 i_nIndex )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( i_nIndex < m_pImpl->m_aResults.size() )
+ m_pImpl->m_aResults[ i_nIndex ].xRow.clear();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DataSupplier::close()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DataSupplier::validate() throw( ResultSetException )
+ {
+ }
+
+//......................................................................................................................
+} } } // namespace ucp::ext
+//......................................................................................................................
diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.hxx b/ucb/source/ucp/ext/ucpext_datasupplier.hxx
new file mode 100644
index 000000000000..7957a318aa36
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_datasupplier.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#ifndef UCB_UCPEXT_DATA_SUPPLIER_HXX
+#define UCB_UCPEXT_DATA_SUPPLIER_HXX
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/resultset.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ struct DataSupplier_Impl;
+ class Content;
+
+ //==================================================================================================================
+ //= DataSupplier
+ //==================================================================================================================
+ typedef ::ucbhelper::ResultSetDataSupplier DataSupplier_Base;
+ class DataSupplier : public ::ucbhelper::ResultSetDataSupplier
+ {
+ public:
+ DataSupplier(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& i_rORB,
+ const rtl::Reference< Content >& rContent,
+ const sal_Int32 nOpenMode
+ );
+
+ protected:
+ virtual ~DataSupplier();
+
+ virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex );
+ virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > queryContentIdentifier( sal_uInt32 nIndex );
+ virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > queryContent( sal_uInt32 nIndex );
+
+ virtual sal_Bool getResult( sal_uInt32 nIndex );
+
+ virtual sal_uInt32 totalCount();
+ virtual sal_uInt32 currentCount();
+ virtual sal_Bool isCountFinal();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > queryPropertyValues( sal_uInt32 nIndex );
+ virtual void releasePropertyValues( sal_uInt32 nIndex );
+
+ virtual void close();
+
+ virtual void validate() throw( com::sun::star::ucb::ResultSetException );
+
+ private:
+ ::boost::scoped_ptr< DataSupplier_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} } } // namespace ucp::ext
+//......................................................................................................................
+
+#endif // UCB_UCPEXT_DATA_SUPPLIER_HXX
diff --git a/ucb/source/ucp/ext/ucpext_provider.cxx b/ucb/source/ucp/ext/ucpext_provider.cxx
new file mode 100644
index 000000000000..4e26dacf229c
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_provider.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#include "precompiled_ucb.hxx"
+
+#include "ucpext_provider.hxx"
+#include "ucpext_content.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <ucbhelper/contentidentifier.hxx>
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <rtl/ustrbuf.hxx>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::ucb::XContentIdentifier;
+ using ::com::sun::star::ucb::IllegalIdentifierException;
+ using ::com::sun::star::ucb::XContent;
+ using ::com::sun::star::uno::XComponentContext;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= ContentProvider
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ContentProvider::ContentProvider( const Reference< XMultiServiceFactory >& i_rServiceManager )
+ :ContentProvider_Base( i_rServiceManager )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ContentProvider::~ContentProvider()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ContentProvider::getImplementationName_static() throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.ucp.ext.ContentProvider" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ContentProvider::getImplementationName() throw (RuntimeException)
+ {
+ return getImplementationName_static();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ContentProvider::getSupportedServiceNames_static( ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(2);
+ aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.ContentProvider" ) );
+ aServiceNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.ExtensionContentProvider" ) );
+ return aServiceNames;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL ContentProvider::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ return getSupportedServiceNames_static();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > ContentProvider::Create( const Reference< XComponentContext >& i_rContext )
+ {
+ const ::comphelper::ComponentContext aContext( i_rContext );
+ return *( new ContentProvider( aContext.getLegacyServiceFactory() ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XContent > SAL_CALL ContentProvider::queryContent( const Reference< XContentIdentifier >& i_rIdentifier )
+ throw( IllegalIdentifierException, RuntimeException )
+ {
+ // Check URL scheme...
+ const ::rtl::OUString aScheme( rtl::OUString::createFromAscii( "vnd.oracle.ooo.extension" ) );
+ if ( !i_rIdentifier->getContentProviderScheme().equalsIgnoreAsciiCase( aScheme ) )
+ throw IllegalIdentifierException();
+
+ // normalize the scheme
+ const ::rtl::OUString sIdentifier( i_rIdentifier->getContentIdentifier() );
+ ::rtl::OUStringBuffer aComposer;
+ aComposer.append( sIdentifier.copy( 0, aScheme.getLength() ).toAsciiLowerCase() );
+ aComposer.append( sIdentifier.copy( aScheme.getLength() ) );
+ const Reference< XContentIdentifier > xNormalizedIdentifier( new ::ucbhelper::ContentIdentifier( m_xSMgr, aComposer.makeStringAndClear() ) );
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // check if a content with given id already exists...
+ Reference< XContent > xContent( queryExistingContent( xNormalizedIdentifier ).get() );
+ if ( xContent.is() )
+ return xContent;
+
+ // create a new content
+ xContent = new Content( m_xSMgr, this, xNormalizedIdentifier );
+ if ( !xContent->getIdentifier().is() )
+ throw IllegalIdentifierException();
+
+ registerNewContent( xContent );
+ return xContent;
+ }
+
+//......................................................................................................................
+} } } // namespace ucb::ucp::ext
+//......................................................................................................................
diff --git a/ucb/source/ucp/ext/ucpext_provider.hxx b/ucb/source/ucp/ext/ucpext_provider.hxx
new file mode 100644
index 000000000000..1e9090dab2e0
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_provider.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#ifndef UCB_UCPEXT_CONTENT_PROVIDER_HXX
+#define UCB_UCPEXT_CONTENT_PROVIDER_HXX
+
+#include <ucbhelper/providerhelper.hxx>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ContentProvider
+ //==================================================================================================================
+ typedef ::ucbhelper::ContentProviderImplHelper ContentProvider_Base;
+ class ContentProvider : public ContentProvider_Base
+ {
+ public:
+ ContentProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rServiceManager );
+ virtual ~ContentProvider();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static versions
+ static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static() throw (::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext );
+
+ // 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);
+ };
+
+//......................................................................................................................
+} } } // namespace ucb::ucp::ext
+//......................................................................................................................
+
+#endif // UCB_UCPEXT_CONTENT_PROVIDER_HXX
diff --git a/ucb/source/ucp/ext/ucpext_resultset.cxx b/ucb/source/ucp/ext/ucpext_resultset.cxx
new file mode 100644
index 000000000000..6d5e79d61902
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_resultset.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#include "precompiled_ucb.hxx"
+
+#include "ucpext_resultset.hxx"
+#include "ucpext_content.hxx"
+#include "ucpext_datasupplier.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <ucbhelper/resultset.hxx>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::ucb::XContentIdentifier;
+ using ::com::sun::star::ucb::OpenCommandArgument2;
+ using ::com::sun::star::ucb::XCommandEnvironment;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= ResultSet
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ ResultSet::ResultSet( const Reference< XMultiServiceFactory >& i_rORB, const ::rtl::Reference< Content >& i_rContent,
+ const OpenCommandArgument2& i_rCommand, const Reference< XCommandEnvironment >& i_rEnv )
+ :ResultSetImplHelper( i_rORB, i_rCommand )
+ ,m_xEnvironment( i_rEnv )
+ ,m_xContent( i_rContent )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ResultSet::initStatic()
+ {
+ m_xResultSet1 = new ::ucbhelper::ResultSet(
+ m_xSMgr,
+ m_aCommand.Properties,
+ new DataSupplier(
+ m_xSMgr,
+ m_xContent,
+ m_aCommand.Mode
+ ),
+ m_xEnvironment
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void ResultSet::initDynamic()
+ {
+ initStatic();
+ m_xResultSet2 = m_xResultSet1;
+ }
+
+//......................................................................................................................
+} } } // namespace ucp::ext
+//......................................................................................................................
diff --git a/ucb/source/ucp/ext/ucpext_resultset.hxx b/ucb/source/ucp/ext/ucpext_resultset.hxx
new file mode 100644
index 000000000000..2924197a0fdc
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_resultset.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#ifndef UCB_UCPEXT_RESULT_SET_HXX
+#define UCB_UCPEXT_RESULT_SET_HXX
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/resultsethelper.hxx>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ class Content;
+
+ //==================================================================================================================
+ //= ResultSet
+ //==================================================================================================================
+ class ResultSet : public ::ucbhelper::ResultSetImplHelper
+ {
+ public:
+ ResultSet(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& i_rORB,
+ const rtl::Reference< Content >& i_rContent,
+ const com::sun::star::ucb::OpenCommandArgument2& i_rCommand,
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& i_rEnv
+ );
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > m_xEnvironment;
+ ::rtl::Reference< Content > m_xContent;
+
+ private:
+ virtual void initStatic();
+ virtual void initDynamic();
+ };
+
+//......................................................................................................................
+} } } // namespace ucp::ext
+//......................................................................................................................
+
+#endif // UCB_UCPEXT_RESULT_SET_HXX
diff --git a/ucb/source/ucp/ext/ucpext_services.cxx b/ucb/source/ucp/ext/ucpext_services.cxx
new file mode 100644
index 000000000000..8daa33f5cf8c
--- /dev/null
+++ b/ucb/source/ucp/ext/ucpext_services.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ * 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.
+ *
+************************************************************************/
+
+#include "precompiled_ucb.hxx"
+
+#include "ucpext_provider.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <cppuhelper/implementationentry.hxx>
+
+//......................................................................................................................
+namespace ucb { namespace ucp { namespace ext
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::XSingleComponentFactory;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= descriptors for the services implemented in this component
+ //==================================================================================================================
+ static struct ::cppu::ImplementationEntry s_aServiceEntries[] =
+ {
+ {
+ ContentProvider::Create,
+ ContentProvider::getImplementationName_static,
+ ContentProvider::getSupportedServiceNames_static,
+ ::cppu::createOneInstanceComponentFactory, NULL, 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+ };
+
+//......................................................................................................................
+} } } // namespace ucb::ucp::ext
+//......................................................................................................................
+
+extern "C"
+{
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey )
+ {
+ return ::cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, ::ucb::ucp::ext::s_aServiceEntries );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+ {
+ return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::ucb::ucp::ext::s_aServiceEntries );
+ }
+}