summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/inc/ucbhelper/commandenvironment.hxx142
-rw-r--r--ucbhelper/inc/ucbhelper/configureucb.hxx122
-rw-r--r--ucbhelper/inc/ucbhelper/content.hxx760
-rw-r--r--ucbhelper/inc/ucbhelper/contentbroker.hxx206
-rw-r--r--ucbhelper/inc/ucbhelper/contenthelper.hxx577
-rw-r--r--ucbhelper/inc/ucbhelper/contentidentifier.hxx142
-rw-r--r--ucbhelper/inc/ucbhelper/contentinfo.hxx215
-rw-r--r--ucbhelper/inc/ucbhelper/macros.hxx792
-rw-r--r--ucbhelper/inc/ucbhelper/propertyvalueset.hxx444
-rw-r--r--ucbhelper/inc/ucbhelper/providerhelper.hxx301
-rw-r--r--ucbhelper/inc/ucbhelper/resultset.hxx609
-rw-r--r--ucbhelper/inc/ucbhelper/resultsethelper.hxx274
-rw-r--r--ucbhelper/inc/ucbhelper/resultsetmetadata.hxx345
-rw-r--r--ucbhelper/prj/d.lst24
-rw-r--r--ucbhelper/source/client/commandenvironment.cxx191
-rw-r--r--ucbhelper/source/client/content.cxx1069
-rw-r--r--ucbhelper/source/client/contentbroker.cxx299
-rw-r--r--ucbhelper/source/client/makefile.mk91
-rw-r--r--ucbhelper/source/provider/configureucb.cxx167
-rw-r--r--ucbhelper/source/provider/contenthelper.cxx1250
-rw-r--r--ucbhelper/source/provider/contentidentifier.cxx262
-rw-r--r--ucbhelper/source/provider/contentinfo.cxx475
-rw-r--r--ucbhelper/source/provider/makefile.mk98
-rw-r--r--ucbhelper/source/provider/propertyvalueset.cxx925
-rw-r--r--ucbhelper/source/provider/providerhelper.cxx614
-rw-r--r--ucbhelper/source/provider/registerucb.cxx249
-rw-r--r--ucbhelper/source/provider/resultset.cxx1706
-rw-r--r--ucbhelper/source/provider/resultsethelper.cxx369
-rw-r--r--ucbhelper/source/provider/resultsetmetadata.cxx588
-rw-r--r--ucbhelper/util/makefile.mk127
-rw-r--r--ucbhelper/util/ucbhelper.flt13
-rw-r--r--ucbhelper/version.mk77
-rw-r--r--ucbhelper/workben/myucp/exports.map8
-rw-r--r--ucbhelper/workben/myucp/makefile.mk132
-rw-r--r--ucbhelper/workben/myucp/myucp_content.cxx805
-rw-r--r--ucbhelper/workben/myucp/myucp_content.hxx207
-rw-r--r--ucbhelper/workben/myucp/myucp_contentcaps.cxx253
-rw-r--r--ucbhelper/workben/myucp/myucp_datasupplier.cxx443
-rw-r--r--ucbhelper/workben/myucp/myucp_datasupplier.hxx111
-rw-r--r--ucbhelper/workben/myucp/myucp_provider.cxx211
-rw-r--r--ucbhelper/workben/myucp/myucp_provider.hxx131
-rw-r--r--ucbhelper/workben/myucp/myucp_resultset.cxx129
-rw-r--r--ucbhelper/workben/myucp/myucp_resultset.hxx99
-rw-r--r--ucbhelper/workben/myucp/myucp_services.cxx175
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/document.bmpbin0 -> 1318 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/fldclose.bmpbin0 -> 298 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/fldopen.bmpbin0 -> 322 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/link.bmpbin0 -> 1318 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/makefile.mk111
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.cxx1293
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.hrc99
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.src195
52 files changed, 17925 insertions, 0 deletions
diff --git a/ucbhelper/inc/ucbhelper/commandenvironment.hxx b/ucbhelper/inc/ucbhelper/commandenvironment.hxx
new file mode 100644
index 000000000000..683a889651d7
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/commandenvironment.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: commandenvironment.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
+#define _UCBHELPER_COMMANDENVIRONMENT_HXX
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace ucb
+{
+
+struct CommandEnvironment_Impl;
+
+//=========================================================================
+
+/**
+ * This class implements the interface
+ * com::sun::star::ucb::XCommandEnvironement. Instances of this class can
+ * be used to supply environments to commands executed by UCB contents.
+ */
+class CommandEnvironment : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XCommandEnvironment
+{
+ CommandEnvironment_Impl* m_pImpl;
+
+private:
+ CommandEnvironment( const CommandEnvironment& ); // n.i.
+ CommandEnvironment& operator=( const CommandEnvironment& ); // n.i.
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxInteractionHandler is the implementation of an Interaction
+ * Handler or an empty reference.
+ * @param rxProgressHandler is the implementation of a Progress
+ * Handler or an empty reference.
+ */
+ CommandEnvironment(
+ const com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler >&
+ rxInteractionHandler,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler >&
+ rxProgressHandler );
+ /**
+ * Destructor.
+ */
+ virtual ~CommandEnvironment();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XCommandEnvironemnt
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler > SAL_CALL
+ getProgressHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+};
+
+} /* namespace ucb */
+
+#endif /* !_UCBHELPER_COMMANDENVIRONMENT_HXX */
diff --git a/ucbhelper/inc/ucbhelper/configureucb.hxx b/ucbhelper/inc/ucbhelper/configureucb.hxx
new file mode 100644
index 000000000000..63873735348d
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/configureucb.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: configureucb.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONFIGUREUCB_HXX_
+#define _UCBHELPER_CONFIGUREUCB_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+ namespace ucb { class XContentProviderManager; }
+ namespace uno { class RuntimeException; }
+} } }
+namespace rtl { class OUString; }
+
+//============================================================================
+/** The keys under which the com.sun.star.ucb.Configuration service's
+ com::sun::star::ucb::XContentProviderConfigurationManager stores the
+ various com::sun::star::ucb::XContentProviderConfigurations.
+ */
+#define UCBHELPER_CONFIGURATION_KEY_STANDARD "ContentProviderServices"
+#define UCBHELPER_CONFIGURATION_KEY_LOCAL "LocalContentProviderServices"
+
+//============================================================================
+namespace ucb {
+
+/** Configure a (newly instantiated) Universal Content Broker.
+
+ @descr This function tries to register at the given UCB all the content
+ provider services supplied by the given
+ com::sun::star::ucb::XContentProviderConfiguration.
+
+ @param rUcb A (newly intantiated) Universal Content Broker.
+
+ @param rFactory A factory through which to obtain the
+ com.sun.star.ucb.Configuration service and the various content provider
+ services.
+
+ @param rConfigurationKey The key under which the given
+ com.sun.star.ucb.Configuration service's
+ com::sun::star::ucb::XContentProviderConfigurationManager stores the
+ desired com::sun::star::ucb::XContentProviderConfiguration.
+
+ @return True if the UCB has successfuly been configured (though not all
+ content providers have necessarily been registered due to conflicts with
+ already registered providers).
+ */
+bool
+configureUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rUcb,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rFactory,
+ rtl::OUString const & rConfigurationKey)
+ throw (com::sun::star::uno::RuntimeException);
+
+}
+
+#endif // _UCBHELPER_CONFIGUREUCB_HXX_
+
diff --git a/ucbhelper/inc/ucbhelper/content.hxx b/ucbhelper/inc/ucbhelper/content.hxx
new file mode 100644
index 000000000000..6c2c4092af17
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/content.hxx
@@ -0,0 +1,760 @@
+/*************************************************************************
+ *
+ * $RCSfile: content.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENT_HXX
+#define _UCBHELPER_CONTENT_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySetInfo;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XActiveDataSink;
+ class XOutputStream;
+ class XInputStream;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace sdbc {
+ class XResultSet;
+ class XRow;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class CommandAbortedException;
+ class XCommandEnvironment;
+ class XCommandInfo;
+ class XContent;
+ class XContentIdentifier;
+ class XDynamicResultSet;
+} } } }
+
+namespace ucb
+{
+
+//=========================================================================
+
+/**
+ * This exception will be thrown from class ucb::Content constructors.
+ */
+class ContentCreationException : public ::com::sun::star::uno::Exception
+{
+public:
+ enum Reason
+ {
+ UNKNOWN,
+ NO_CONTENT_BROKER,
+ NO_IDENTIFIER_FACTORY,
+ IDENTIFIER_CREATION_FAILED,
+ NO_CONTENT_PROVIDER,
+ CONTENT_CREATION_FAILED
+ };
+
+private:
+ Reason m_eReason;
+
+public:
+ ContentCreationException( Reason eReason = UNKNOWN )
+ : m_eReason( eReason ) {}
+
+ const Reason getReason() const { return m_eReason; }
+};
+
+//=========================================================================
+
+/**
+ * These are the possible values for the parameter eMode of method
+ * ucb::Content::createCursor.
+ */
+enum ResultSetInclude
+{
+ INCLUDE_FOLDERS_ONLY,
+ INCLUDE_DOCUMENTS_ONLY,
+ INCLUDE_FOLDERS_AND_DOCUMENTS
+};
+
+//=========================================================================
+
+class Content_Impl;
+
+/**
+ * This class simplifies access to UCB contents by providing a more
+ * convenient API for frequently used functionality then the "raw"
+ * UCB-API does.
+ */
+class Content
+{
+ vos::ORef< Content_Impl > m_xImpl;
+
+public:
+ /**
+ * Constructor.
+ */
+ Content();
+
+ /**
+ * Constructor.
+ *
+ * @param rURL is the URL of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const rtl::OUString& rURL,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Constructor.
+ *
+ * @param rId is the content identifier of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& rId,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Constructor.
+ *
+ * @param rContent is the content object of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent >& rContent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv );
+ /**
+ * Copy Constructor.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content( const Content& rOther );
+
+ /**
+ * Destructor.
+ */
+ ~Content();
+
+ /**
+ * Assignment operator.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content& operator=( const Content& rOther );
+
+ //////////////////////////////////////////////////////////////////////
+ // Direct access to UCB content.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method provides access to the "native" UCB content interface(s).
+ * This is usefull in case the convenience methods provided by this
+ * class are insufficient for your needs. You may obtain all interfaces
+ * supported by the underlying UCB content by calling this method and
+ * after that doing a queryInterface call.
+ *
+ * @return the XContent interface of the underlying UCB content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >
+ get() const;
+
+ //////////////////////////////////////////////////////////////////////
+ // Access to supported commands/properties.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This methods provides access to meta data of the commands supported
+ * by this content.
+ *
+ * @return An XCommandInfo interface implementation, which can be used
+ * to obtain meta data of the commands supported by this content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandInfo >
+ getCommands()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods provides access to meta data of the properties supported
+ * by this content.
+ *
+ * @return An XPropertSetInfo interface implementation, which can be used
+ * to obtain meta data of the properties supported by this content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ getProperties()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // Access to property value(s).
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method can be used to read a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the value
+ * shall be obtained.
+ * @return the property value.
+ */
+ ::com::sun::star::uno::Any
+ getPropertyValue( const rtl::OUString& rPropertyName )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read a single property value.
+ *
+ * @param nPropertyHande is the handle of the property for that the
+ * value shall be obtained.
+ * @return the property value.
+ */
+ ::com::sun::star::uno::Any
+ getPropertyValue( sal_Int32 nPropertyHandle )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the
+ * value shall be set.
+ */
+ void
+ setPropertyValue( const rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set a single property value.
+ *
+ * @param nPropertyHande is the handle of the property for that the
+ * value shall be set.
+ */
+ void
+ setPropertyValue( const sal_Int32 nPropertyHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getPropertyValues( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values shall be obtained.
+ * @return an XRow interface that can be used to obtain the property
+ * values.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getPropertyValues( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValuesInterface( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values shall be obtained.
+ * @return an XRow interface that can be used to obtain the property
+ * values.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValuesInterface( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that values shall be set.
+ */
+ void
+ setPropertyValues( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that values shall be set.
+ */
+ void
+ setPropertyValues( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // General command execution.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method can be used to execute any command supported by the
+ * content.
+ *
+ * @param rCommandName is the name of the command to execute.
+ * @param rCommandArgument is the argument for the command. Type and
+ * values of this parameter must correspond to the command
+ * specification.
+ * @return the result of the command according to its specification.
+ */
+ ::com::sun::star::uno::Any
+ executeCommand( const rtl::OUString& rCommandName,
+ const ::com::sun::star::uno::Any& rCommandArgument )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ ::com::sun::star::uno::Any
+ /**
+ * This method can be used to execute any command supported by the
+ * content.
+ *
+ * @param rCommandHandle is the handle of the command to execute.
+ * @param rCommandArgument is the argument for the command. Type and
+ * values of this parameter must correspond to the command
+ * specification.
+ * @return the result of the command according to its specification.
+ */
+ executeCommand( sal_Int32 nCommandHandle,
+ const ::com::sun::star::uno::Any& rCommandArgument )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to abort the command currently executed by
+ * a content. Note that a content can only process one command per
+ * thread at a time. The implementation of the content is responsible
+ * for determining the command to abort when this method is called.
+ */
+ void
+ abortCommand();
+ /**
+ * This method returns the command environment of the content.
+ *
+ * @return the command environment.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >
+ getCommandEnvironment();
+
+ //////////////////////////////////////////////////////////////////////
+ // Special commands.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessable via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.ContentResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ createCursor( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values should be accessable via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.ContentResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ createCursor( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessable via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.DynamicResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
+ createDynamicCursor( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode
+ = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param nPropertyHandes is a sequence of handles of properties for
+ * that the values should be accessable via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.DynamicResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
+ createDynamicCursor( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode
+ = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rSink is the implementation of an XActiveDataSink interface,
+ * which shall be used by the content to deliver the data.
+ */
+ sal_Bool
+ openStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XActiveDataSink >& rSink )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rStream is the implementation of an XOutputStream interface,
+ * which shall be used by the content to deliver the data.
+ */
+ sal_Bool
+ openStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XOutputStream >& rStream )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "insert" at the content.
+ *
+ * @param rStream is the implementation of an XInputStream interface,
+ * which contains the content data to write.
+ * @param bReplaceExisting specifies, whether any existing content data
+ * shall be overwritten.
+ */
+ void
+ writeStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ sal_Bool bReplaceExisting )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param nPropertyHandes is a sequence of handles of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the handles must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property handles.
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rStream is a stream containing the content data for the new
+ * content (i.e. the content of a file to create)
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param nPropertyHandes is a sequence of handles of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the handles must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property handles.
+ * @param rStream is a stream containing the content data for the new
+ * content (i.e. the content of a file to create)
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // Required properties.
+ //////////////////////////////////////////////////////////////////////
+
+ /** This method returns the value of the content's property "IsFolder".
+ *
+ * @return true, if the content is a folder ( it can contain other
+ * UCB contents). false, otherwise.
+ */
+ sal_Bool
+ isFolder()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /** This method returns the value of the content's property "IsDocument".
+ *
+ * @return true, if the content is a document ( it has a content stream ).
+ * false, otherwise.
+ */
+ sal_Bool
+ isDocument()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+};
+
+} /* namespace ucb */
+
+#endif /* !_UCBHELPER_CONTENT_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentbroker.hxx b/ucbhelper/inc/ucbhelper/contentbroker.hxx
new file mode 100644
index 000000000000..cfdc9876fc4b
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentbroker.hxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentbroker.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#define _UCBHELPER_CONTENTBROKER_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XContentIdentifierFactory;
+ class XContentProvider;
+ class XContentProviderManager;
+} } } }
+
+namespace ucb
+{
+
+class ContentBroker_Impl;
+
+//=========================================================================
+
+/**
+ * This class simplifies access to the Universal Content Broker (UCB).
+ * Currently there can only be one UCB instance per process. This class can
+ * be used to initialize and deinitialize the Broker and to access its
+ * interfaces directly.
+ */
+class ContentBroker
+{
+ ContentBroker_Impl* m_pImpl;
+ // The "one and only" Broker.
+ static ContentBroker* m_pTheBroker;
+
+private:
+ ContentBroker( const ContentBroker& ); // n.i.
+ ContentBroker& operator=( const ContentBroker& ); // n.i.
+
+ /** Constructor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rArguments are the arguments to pass to the
+ * com.sun.star.ucb.UniversalContentBroker service when creating it.
+ * Currently, this must be a sequence containing exactly one
+ * boolean. If this boolean is true, the Broker is automatically
+ * configured (the appropriate content provider services are
+ * registered); if the boolean is false, the Broker is left
+ * unconfigured (no content providers are registered).
+ */
+ ContentBroker( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rArguments );
+
+protected:
+ /**
+ * Destructor.
+ */
+ ~ContentBroker();
+
+public:
+ /** Initialize "the one and only" Broker. This method must be called
+ * exactly once, before the Broker is used in any way.
+ *
+ * @param rSMgr is a factory to create services needed in the Broker's
+ * implementation.
+ *
+ * @param rArguments are the arguments to pass to the
+ * com.sun.star.ucb.UniversalContentBroker service when creating
+ * it. Currently, this must be a sequence containing exactly one
+ * boolean. If this boolean is true, the Broker is automatically
+ * configured (the appropriate content provider services are
+ * registered); if the boolean is false, the Broker is left
+ * unconfigured (no content providers are registered).
+ *
+ * @return True if creation and possible configuration of the Broker
+ * was successful.
+ */
+ static sal_Bool
+ initialize( const::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rArguments );
+
+ /** Deinitialize "the one and only" Broker. Once this method has been
+ * called, the Broker must not be used any longer.
+ */
+ static void
+ deinitialize();
+
+ /**
+ * This method returns the Broker, if it was already initialized.
+ *
+ * @return the Broker or 0, if ContentBroker::initialize() was not yet
+ * called or did fail.
+ */
+ static ContentBroker*
+ get();
+
+ /**
+ * This method returns the Service Manager used to instanciate the Broker.
+ *
+ * @return a Service Manager.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >
+ getServiceManager() const;
+
+ /**
+ * This method returns the XContentIdentifierFactory interface of the
+ * Broker.
+ *
+ * @return a XContentIdentifierFactory interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifierFactory >
+ getContentIdentifierFactoryInterface() const;
+
+ /**
+ * This method returns the XContentProvider interface of the Broker.
+ *
+ * @return a XContentProvider interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentProvider >
+ getContentProviderInterface() const;
+
+ /**
+ * This method returns the XContentProviderManager interface of the Broker.
+ *
+ * @return a XContentProviderManager interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentProviderManager >
+ getContentProviderManagerInterface() const;
+};
+
+} /* namespace ucb */
+
+#endif /* !_UCBHELPER_CONTENTBROKER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contenthelper.hxx b/ucbhelper/inc/ucbhelper/contenthelper.hxx
new file mode 100644
index 000000000000..e0bdf0c0b78d
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contenthelper.hxx
@@ -0,0 +1,577 @@
+/*************************************************************************
+ *
+ * $RCSfile: contenthelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#define _UCBHELPER_CONTENTHELPER_HXX
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HPP_
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGENOTIFIER_HPP_
+#include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_
+#include <com/sun/star/ucb/XContent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFOCHANGENOTIFIER_HPP_
+#include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFOCHANGENOTIFIER_HPP_
+#include <com/sun/star/ucb/XCommandInfoChangeNotifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include <com/sun/star/container/XChild.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XCommandInfo;
+ class XPersistentPropertySet;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySetInfo;
+} } } }
+
+namespace ucb_impl { struct ContentImplHelper_Impl; }
+
+namespace ucb
+{
+
+//=========================================================================
+
+struct PropertyInfoTableEntry
+{
+ const sal_Char* pName;
+ sal_Int32 nHandle;
+ const ::com::sun::star::uno::Type* pType;
+ sal_Int16 nAttributes;
+};
+
+//=========================================================================
+
+struct CommandInfoTableEntry
+{
+ const sal_Char* pName;
+ sal_Int32 nHandle;
+ const ::com::sun::star::uno::Type* pArgType;
+};
+
+//=========================================================================
+
+class ContentProviderImplHelper;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.Content. Implementations derived from this class are
+ * objects provided by implementations derived from
+ * class ucb::ContentProviderImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service com::sun::star::ucb::Content
+ * - all required listener containers
+ * ( XComponent, XPropertiesChangeNotifier, XPropertySetInfoChangeNotifier,
+ * XCommandInfoChangeNotifier )
+ * - XPropertyContainer implementation ( persistence is implemented using
+ * service com.sun.star.ucb.Store )
+ * - complete XPropertySetInfo implementation ( including Additioanl Core
+ * Properties supplied via XPropertyContainer interface )
+ * -> protected method: getPropertySetInfo
+ * - complete XCommandInfo implementation
+ * -> protected method: getCommandInfo
+ */
+class ContentImplHelper :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XComponent,
+ public com::sun::star::ucb::XContent,
+ public com::sun::star::ucb::XCommandProcessor,
+ public com::sun::star::beans::XPropertiesChangeNotifier,
+ public com::sun::star::beans::XPropertyContainer,
+ public com::sun::star::beans::XPropertySetInfoChangeNotifier,
+ public com::sun::star::ucb::XCommandInfoChangeNotifier,
+ public com::sun::star::container::XChild
+{
+ friend class PropertySetInfo;
+ friend class CommandProcessorInfo;
+
+ ucb_impl::ContentImplHelper_Impl* m_pImpl;
+
+protected:
+ osl::Mutex m_aMutex;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >
+ m_xIdentifier;
+ vos::ORef< ContentProviderImplHelper >
+ m_xProvider;
+ sal_uInt32 m_nCommandId;
+
+private:
+ /**
+ * Your implementation of this method must return a table containing
+ * the meta data of the properties supported by the content.
+ * Note: If you wish to provide your own implementation of the interface
+ * XPropertyContainer ( completely override addContent and removeContent
+ * implementation of this base class in this case ), you can supply the
+ * meta data for your Additional Core Properties here to get a fully
+ * featured getPropertySetInfo method ( see below ).
+ *
+ * @return a table containing the property meta data.
+ */
+ virtual const ::ucb::PropertyInfoTableEntry& getPropertyInfoTable() = 0;
+
+ /**
+ * Your implementation of this method must return a table containing
+ * the meta data of the commands supported by the content.
+ *
+ * @return a table containing the command meta data.
+ */
+ virtual const ::ucb::CommandInfoTableEntry& getCommandInfoTable() = 0;
+
+ /**
+ * The implementation of this method shall return the URL of the parent
+ * of your content.
+ *
+ * @return the URL of the parent content or an empty string.
+ * Note that not all contents must have one parent. There may
+ * be contents with no parent. In that case an empty string must
+ * be returned. If your content has more than one parent you may
+ * return the URL of one "preferred" parent or an empty string.
+ */
+ virtual ::rtl::OUString getParentURL() = 0;
+
+protected:
+ /**
+ * This method returns complete meta data for the properties ( including
+ * Additional Core Properties supplied via XPropertyContainer interface )
+ * supported by the content. To implement the required command
+ * "getPropertySetInfo" simply return the return value of this method.
+ *
+ * @return an XPropertySetInfo implementation object containing meta data
+ * for the properties supported by this content.
+ */
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >
+ getPropertySetInfo();
+
+ /**
+ * This method returns complete meta data for the commands supported by
+ * the content. To implement the required command "getCommandInfo" simply
+ * return the return value of this method.
+ *
+ * @return an XCommandInfo implementation object containing meta data
+ * for the commands supported by this content.
+ */
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo >
+ getCommandInfo();
+
+ /**
+ * This method can be used to propagate changes of property values.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertiesChange(
+ const com::sun::star::uno::Sequence<
+ com::sun::star::beans::PropertyChangeEvent >& evt ) const;
+
+ /**
+ * This method can be used to propagate changes of the propertyset
+ * info of your content (i.e. this happens if a new property is added
+ * to your content via its XPropertyContainer interface). This base class
+ * automatically generates events when the propertyset info changes. If
+ * you provide your own implementations of addproperty and removeProperty,
+ * then you must call "notifyPropertySetInfoChange" by yourself.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertySetInfoChange(
+ const com::sun::star::beans::PropertySetInfoChangeEvent& evt ) const;
+
+ /**
+ * This method can be used to propagate changes of the command info of
+ * your content. This can happen at any time if there shall be a new
+ * command available at a content or a currently present command shall no
+ * longer be present. (i.e. only if the content count of a trash can
+ * object is greater then zero, there will be available a command
+ * "emptyTrash". If there are no objects in the trash can, this command
+ * won't be available.
+ *
+ * @param evt is a sequence of command info change events.
+ */
+ void notifyCommandInfoChange(
+ const com::sun::star::ucb::CommandInfoChangeEvent& evt ) const;
+
+ /**
+ * This method can be used to propagate content events.
+ *
+ * @param evt is a sequence of content events.
+ */
+ void notifyContentEvent(
+ const com::sun::star::ucb::ContentEvent& evt ) const;
+
+ /**
+ * Use this method to announce the insertion of this content at
+ * the end of your implementation of the command "insert". The
+ * implementation of is method propagates a ContentEvent( INSERTED ).
+ */
+ void inserted();
+
+ /**
+ * Use this method to announce the destruction of this content at
+ * the end of your implementation of the command "delete". The
+ * implementation of is method propagates a ContentEvent( DELETED )
+ * and a ContentEvent( REMOVED ) at the parent of the deleted content,
+ * if a parent exists.
+ */
+ void deleted();
+
+ /**
+ * Use this method to change the identity of a content. The implementation
+ * of this method will replace the content identifier of the content and
+ * propagate the appropriate ContentEvent( EXCHANGED ).
+ *
+ * @param rNewId is the new content identifier for the contant.
+ * @return a success indicator.
+ */
+ sal_Bool exchange( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >& rNewId );
+
+ /**
+ * Use this method to get access to the Additional Core Properties of
+ * the content ( added using content's XPropertyContainer interface ).
+ * If you supply your own XPropertyContainer implementation, this method
+ * will always return an empty propertyset.
+ *
+ * @param bCreate indicates whether a new propertyset shall be created
+ * if it does not exist.
+ * @return the implementation of the service
+ * com.sun.star.ucb.PersistentPropertySet.
+ */
+ com::sun::star::uno::Reference< com::sun::star::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( sal_Bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be renamed too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool renameAdditionalPropertySet( const ::rtl::OUString& rOldKey,
+ const ::rtl::OUString& rNewKey,
+ sal_Bool bRecursive );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be removed too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool removeAdditionalPropertySet( sal_Bool bRecursive );
+
+public:
+ /**
+ * Constructor.
+ *
+ * Note that the implementation of this ctor registers itself at its
+ * content provider. The provider implementation inserts the content
+ * in a hash map. So it easyly can be found and reused when the provider
+ * is asked for a content.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rxProvider is the provider for the content.
+ * @param Identifier is the content identifier for the content.
+ * @param bRegisterAtProvider can be used to create a content that
+ * will not autmatically register itself at its provider. This
+ * can be usefull if creating a content object from inside a
+ * XContentCreator::createNewContent method. That new content
+ * would register at its provider after it has successfully
+ * processed its "insert" command".
+ */
+ ContentImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< ContentProviderImplHelper >& rxProvider,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >& Identifier,
+ sal_Bool bRegisterAtProvider = sal_True );
+
+ /**
+ * Destructor.
+ *
+ * Note that the implementation of this dtor deregisters itself from its
+ * content provider. The provider implementation removes the content
+ * from a hash map.
+ */
+ virtual ~ContentImplHelper();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XComponent
+ virtual void SAL_CALL
+ dispose()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContent
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier > SAL_CALL
+ getIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getContentType()
+ throw( com::sun::star::uno::RuntimeException ) = 0;
+ virtual void SAL_CALL
+ addContentEventListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeContentEventListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandProcessor
+ virtual sal_Int32 SAL_CALL
+ createCommandIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ 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 ) = 0;
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId )
+ throw( com::sun::star::uno::RuntimeException ) = 0;
+
+ // XPropertiesChangeNotifier
+ virtual void SAL_CALL
+ addPropertiesChangeListener(
+ const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertiesChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removePropertiesChangeListener(
+ const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertiesChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandInfoChangeNotifier
+ virtual void SAL_CALL
+ addCommandInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeCommandInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XPropertyContainer
+
+ /**
+ * This method adds a property to the content according to the interface
+ * specification. The properties will be stored using the service
+ * com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ addProperty( const rtl::OUString& Name,
+ sal_Int16 Attributes,
+ const com::sun::star::uno::Any& DefaultValue )
+ throw( com::sun::star::beans::PropertyExistException,
+ com::sun::star::beans::IllegalTypeException,
+ com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::uno::RuntimeException );
+
+ /**
+ * This method removes a property from the content according to the
+ * interface specification. The properties will be stored using the
+ * service com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ removeProperty( const rtl::OUString& Name )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::beans::NotRemoveableException,
+ com::sun::star::uno::RuntimeException );
+
+ // XPropertySetInfoChangeNotifier
+ virtual void SAL_CALL
+ addPropertySetInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removePropertySetInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XChild
+
+ /**
+ * This method returns the content representing the parent of a content,
+ * if such a parent exists. The implementation of this method uses your
+ * implementation of getParentURL.
+ */
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface > SAL_CALL
+ getParent()
+ throw( com::sun::star::uno::RuntimeException );
+
+ /**
+ * The implementation of this method always throws a NoSupportException.
+ */
+ virtual void SAL_CALL
+ setParent( const com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface >& Parent )
+ throw( com::sun::star::lang::NoSupportException,
+ com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the provider of the content.
+ *
+ * @return the provider of the content.
+ */
+ const vos::ORef< ContentProviderImplHelper >& getProvider() const
+ { return m_xProvider; }
+};
+
+} // namespace ucb
+
+#endif /* !_UCBHELPER_CONTENTHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentidentifier.hxx b/ucbhelper/inc/ucbhelper/contentidentifier.hxx
new file mode 100644
index 000000000000..7886f47118aa
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentidentifier.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentidentifier.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#define _UCBHELPER_CONTENTIDENTIFIER_HXX
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIER_HPP_
+#include <com/sun/star/ucb/XContentIdentifier.hpp>
+#endif
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace rtl {
+ class OUString;
+}
+
+namespace ucb
+{
+
+struct ContentIdentifier_Impl;
+
+//=========================================================================
+
+/**
+ * This class implements a simple identifier object for UCB contents.
+ * It mainly stores and returns the URL as it was passed to the constructor -
+ * The only difference is that the URL scheme will be lower cased. This can
+ * be done, because URL schemes are never case sensitive.
+ */
+class ContentIdentifier :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XContentIdentifier
+{
+public:
+ ContentIdentifier( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::OUString& rURL );
+ ContentIdentifier( const rtl::OUString& rURL );
+ virtual ~ContentIdentifier();
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ acquire()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ release()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContentIdentifier
+ virtual rtl::OUString SAL_CALL
+ getContentIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getContentProviderScheme()
+ throw( com::sun::star::uno::RuntimeException );
+
+private:
+ ContentIdentifier_Impl* m_pImpl;
+};
+
+} /* namespace ucb */
+
+#endif /* !_UCBHELPER_CONTENTIDENTIFIER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentinfo.hxx b/ucbhelper/inc/ucbhelper/contentinfo.hxx
new file mode 100644
index 000000000000..659d662c3cfa
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentinfo.hxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentinfo.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTINFO_HXX
+#define _UCBHELPER_CONTENTINFO_HXX
+
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace ucb {
+
+//============================================================================
+//
+// class PropertySetInfo.
+//
+//============================================================================
+
+class ContentImplHelper;
+
+/**
+ * This class provides a propertyset info ( the complete implementation of
+ * the interface XPropertySetInfo ) for an object derived from class
+ * ucb::ContentImplHelper. The implementation takes care about Additional
+ * Core Properties that may have been added to the content.
+ */
+class PropertySetInfo :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::beans::XPropertySetInfo
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Sequence< com::sun::star::beans::Property >*
+ m_pProps;
+ vos::OMutex m_aMutex;
+ ContentImplHelper* m_pContent;
+
+private:
+ sal_Bool queryProperty( const rtl::OUString& rName,
+ com::sun::star::beans::Property& rProp );
+
+public:
+ PropertySetInfo( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ ContentImplHelper* pContent );
+ virtual ~PropertySetInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XPropertySetInfo
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::beans::Property > SAL_CALL
+ getProperties()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::beans::Property SAL_CALL
+ getPropertyByName( const rtl::OUString& aName )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const rtl::OUString& Name )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // Non-Interface methods.
+ void reset();
+};
+
+//============================================================================
+//
+// class CommandProcessorInfo.
+//
+//============================================================================
+
+/**
+ * This class provides a command info ( the complete implementation of
+ * the interface XCommandInfo ) for an object derived from class
+ * ucb::ContentImplHelper.
+ */
+class CommandProcessorInfo :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XCommandInfo
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >*
+ m_pCommands;
+ vos::OMutex m_aMutex;
+ ContentImplHelper* m_pContent;
+
+private:
+ sal_Bool queryCommand( const rtl::OUString& rName,
+ com::sun::star::ucb::CommandInfo& rCommand );
+ sal_Bool queryCommand( sal_Int32 nHandle,
+ com::sun::star::ucb::CommandInfo& rCommand );
+
+public:
+ CommandProcessorInfo( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ ContentImplHelper* pContent );
+ virtual ~CommandProcessorInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XCommandInfo
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::ucb::CommandInfo > SAL_CALL
+ getCommands()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::ucb::CommandInfo SAL_CALL
+ getCommandInfoByName( const rtl::OUString& Name )
+ throw( com::sun::star::ucb::UnsupportedCommandException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::ucb::CommandInfo SAL_CALL
+ getCommandInfoByHandle( sal_Int32 Handle )
+ throw( com::sun::star::ucb::UnsupportedCommandException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasCommandByName( const rtl::OUString& Name )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasCommandByHandle( sal_Int32 Handle )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // Non-Interface methods.
+ void reset();
+};
+
+} // namespace ucb
+
+#endif /* !_UCBHELPER_CONTENTINFO_HXX */
diff --git a/ucbhelper/inc/ucbhelper/macros.hxx b/ucbhelper/inc/ucbhelper/macros.hxx
new file mode 100644
index 000000000000..d5f7c201ade8
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/macros.hxx
@@ -0,0 +1,792 @@
+/*************************************************************************
+ *
+ * $RCSfile: macros.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_MACROS_HXX
+#define _UCBHELPER_MACROS_HXX
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAKREF_HXX_
+#include <cppuhelper/weakref.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+
+//=========================================================================
+
+#define CPPU_TYPE( T ) getCppuType( static_cast< T * >( 0 ) )
+#define CPPU_TYPE_REF( T ) CPPU_TYPE( com::sun::star::uno::Reference< T > )
+
+//=========================================================================
+//
+// XInterface decl.
+//
+//=========================================================================
+
+#define XINTERFACE_DECL() \
+ virtual com::sun::star::uno::Any SAL_CALL \
+ queryInterface( const com::sun::star::uno::Type & rType ) \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual void SAL_CALL \
+ acquire() \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual void SAL_CALL \
+ release() \
+ throw( com::sun::star::uno::RuntimeException );
+
+//=========================================================================
+//
+// XInterface impl. internals.
+//
+//=========================================================================
+
+#define XINTERFACE_COMMON_IMPL( Class ) \
+void SAL_CALL Class::acquire() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ OWeakObject::acquire(); \
+} \
+ \
+void SAL_CALL Class::release() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ OWeakObject::release(); \
+}
+
+#define QUERYINTERFACE_IMPL_START( Class ) \
+com::sun::star::uno::Any SAL_CALL Class::queryInterface( \
+ const com::sun::star::uno::Type & rType ) \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ com::sun::star::uno::Any aRet = cppu::queryInterface( rType,
+
+#define QUERYINTERFACE_IMPL_END \
+ ); \
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ); \
+}
+
+//=========================================================================
+//
+// XInterface impl.
+//
+//=========================================================================
+
+// 1 interface implemented
+#define XINTERFACE_IMPL_1( Class, Ifc1 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 2 interfaces implemented
+#define XINTERFACE_IMPL_2( Class, Ifc1, Ifc2 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 3 interfaces implemented
+#define XINTERFACE_IMPL_3( Class, Ifc1, Ifc2, Ifc3 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 4 interfaces implemented
+#define XINTERFACE_IMPL_4( Class, Ifc1, Ifc2, Ifc3, Ifc4 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ), \
+ SAL_STATIC_CAST( Ifc4*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 5 interfaces implemented
+#define XINTERFACE_IMPL_5( Class, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ), \
+ SAL_STATIC_CAST( Ifc4*, this ), \
+ SAL_STATIC_CAST( Ifc5*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 6 interfaces implemented
+#define XINTERFACE_IMPL_6( Class,I1,I2,I3,I4,I5,I6 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 7 interfaces implemented
+#define XINTERFACE_IMPL_7( Class,I1,I2,I3,I4,I5,I6,I7 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 8 interfaces implemented
+#define XINTERFACE_IMPL_8( Class,I1,I2,I3,I4,I5,I6,I7,I8 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 9 interfaces implemented
+#define XINTERFACE_IMPL_9( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 10 interfaces implemented
+#define XINTERFACE_IMPL_10( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 11 interfaces implemented
+#define XINTERFACE_IMPL_11( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 12 interfaces implemented
+#define XINTERFACE_IMPL_12( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 13 interfaces implemented
+#define XINTERFACE_IMPL_13( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 14 interfaces implemented
+#define XINTERFACE_IMPL_14( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ), \
+ SAL_STATIC_CAST( I14*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 15 interfaces implemented
+#define XINTERFACE_IMPL_15( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ), \
+ SAL_STATIC_CAST( I14*, this ), \
+ SAL_STATIC_CAST( I15*, this ) \
+QUERYINTERFACE_IMPL_END
+
+//=========================================================================
+//
+// XTypeProvider decl.
+//
+//=========================================================================
+
+#define XTYPEPROVIDER_DECL() \
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL \
+ getImplementationId() \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL \
+ getTypes() \
+ throw( com::sun::star::uno::RuntimeException );
+
+//=========================================================================
+//
+// XTypeProvider impl. internals
+//
+//=========================================================================
+
+#define XTYPEPROVIDER_COMMON_IMPL( Class ) \
+com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL \
+Class::getImplementationId() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ static cppu::OImplementationId* pId = NULL; \
+ if ( !pId ) \
+ { \
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); \
+ if ( !pId ) \
+ { \
+ static cppu::OImplementationId id( sal_False ); \
+ pId = &id; \
+ } \
+ } \
+ return (*pId).getImplementationId(); \
+}
+
+#define GETTYPES_IMPL_START( Class ) \
+com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL \
+Class::getTypes() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ static cppu::OTypeCollection* pCollection = NULL; \
+ if ( !pCollection ) \
+ { \
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); \
+ if ( !pCollection ) \
+ { \
+ static cppu::OTypeCollection collection(
+
+#define GETTYPES_IMPL_END \
+ ); \
+ pCollection = &collection; \
+ } \
+ } \
+ return (*pCollection).getTypes(); \
+}
+
+//=========================================================================
+//
+// XTypeProvider impl.
+//
+//=========================================================================
+
+// 1 interface supported
+#define XTYPEPROVIDER_IMPL_1( Class, I1 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ) \
+GETTYPES_IMPL_END
+
+// 2 interfaces supported
+#define XTYPEPROVIDER_IMPL_2( Class, I1,I2 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ) \
+GETTYPES_IMPL_END
+
+// 3 interfaces supported
+#define XTYPEPROVIDER_IMPL_3( Class, I1,I2,I3 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ) \
+GETTYPES_IMPL_END
+
+// 4 interfaces supported
+#define XTYPEPROVIDER_IMPL_4( Class, I1,I2,I3,I4 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ) \
+GETTYPES_IMPL_END
+
+// 5 interfaces supported
+#define XTYPEPROVIDER_IMPL_5( Class, I1,I2,I3,I4,I5 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ) \
+GETTYPES_IMPL_END
+
+// 6 interfaces supported
+#define XTYPEPROVIDER_IMPL_6( Class, I1,I2,I3,I4,I5,I6 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ) \
+GETTYPES_IMPL_END
+
+// 7 interfaces supported
+#define XTYPEPROVIDER_IMPL_7( Class, I1,I2,I3,I4,I5,I6,I7 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ) \
+GETTYPES_IMPL_END
+
+// 8 interfaces supported
+#define XTYPEPROVIDER_IMPL_8( Class, I1,I2,I3,I4,I5,I6,I7,I8 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ) \
+GETTYPES_IMPL_END
+
+// 9 interfaces supported
+#define XTYPEPROVIDER_IMPL_9( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ) \
+GETTYPES_IMPL_END
+
+// 10 interfaces supported
+#define XTYPEPROVIDER_IMPL_10( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ) \
+GETTYPES_IMPL_END
+
+// 11 interfaces supported
+#define XTYPEPROVIDER_IMPL_11( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ) \
+GETTYPES_IMPL_END
+
+// 12 interfaces supported
+#define XTYPEPROVIDER_IMPL_12( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ) \
+GETTYPES_IMPL_END
+
+// 13 interfaces supported
+#define XTYPEPROVIDER_IMPL_13( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ) \
+GETTYPES_IMPL_END
+
+// 14 interfaces supported
+#define XTYPEPROVIDER_IMPL_14( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ), \
+ CPPU_TYPE_REF( I14 ) \
+GETTYPES_IMPL_END
+
+// 15 interfaces supported
+#define XTYPEPROVIDER_IMPL_15( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ), \
+ CPPU_TYPE_REF( I14 ), \
+ CPPU_TYPE_REF( I15 ) \
+GETTYPES_IMPL_END
+
+//=========================================================================
+//
+// XServiceInfo decl.
+//
+//=========================================================================
+
+#define XSERVICEINFO_NOFACTORY_DECL() \
+ virtual rtl::OUString SAL_CALL \
+ getImplementationName() \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual sal_Bool SAL_CALL \
+ supportsService( const rtl::OUString& ServiceName ) \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL \
+ getSupportedServiceNames() \
+ throw( com::sun::star::uno::RuntimeException ); \
+ \
+ static rtl::OUString \
+ getImplementationName_Static(); \
+ static com::sun::star::uno::Sequence< rtl::OUString > \
+ getSupportedServiceNames_Static();
+
+#define XSERVICEINFO_DECL() \
+ XSERVICEINFO_NOFACTORY_DECL() \
+ \
+ static com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+ createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr );
+
+//=========================================================================
+//
+// XServiceInfo impl. internals
+//
+//=========================================================================
+
+#define XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+rtl::OUString SAL_CALL Class::getImplementationName() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ return getImplementationName_Static(); \
+} \
+ \
+rtl::OUString Class::getImplementationName_Static() \
+{ \
+ return ImplName; \
+} \
+ \
+sal_Bool SAL_CALL \
+Class::supportsService( const rtl::OUString& ServiceName ) \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNL = \
+ getSupportedServiceNames(); \
+ const rtl::OUString* pArray = aSNL.getArray(); \
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) \
+ { \
+ if( pArray[ i ] == ServiceName ) \
+ return sal_True; \
+ } \
+ \
+ return sal_False; \
+} \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL \
+Class::getSupportedServiceNames() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ return getSupportedServiceNames_Static(); \
+}
+
+#define XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+static com::sun::star::uno::Reference< \
+ com::sun::star::uno::XInterface > SAL_CALL \
+Class##_CreateInstance( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory> & rSMgr ) \
+ throw( com::sun::star::uno::Exception ) \
+{ \
+ com::sun::star::lang::XServiceInfo* pX = \
+ (com::sun::star::lang::XServiceInfo*)new Class( rSMgr ); \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::uno::XInterface >::query( pX ); \
+}
+
+//=========================================================================
+//
+// XServiceInfo impl.
+//
+//=========================================================================
+
+#define ONE_INSTANCE_SERVICE_FACTORY_IMPL( Class ) \
+com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+Class::createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ) \
+{ \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory >( \
+ cppu::createOneInstanceFactory( \
+ rxServiceMgr, \
+ Class::getImplementationName_Static(), \
+ Class##_CreateInstance, \
+ Class::getSupportedServiceNames_Static() ) ); \
+}
+
+#define SINGLE_SERVICE_FACTORY_IMPL( Class ) \
+com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+Class::createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ) \
+{ \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory >( \
+ cppu::createSingleFactory( \
+ rxServiceMgr, \
+ Class::getImplementationName_Static(), \
+ Class##_CreateInstance, \
+ Class::getSupportedServiceNames_Static() ) ); \
+}
+
+// Service without service factory.
+
+// Own implementation of getSupportedServiceNames_Static().
+#define XSERVICEINFO_NOFACTORY_IMPL_0( Class, ImplName ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static()
+
+// 1 service name
+#define XSERVICEINFO_NOFACTORY_IMPL_1( Class, ImplName, Service1 ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static() \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \
+ aSNS.getArray()[ 0 ] = Service1; \
+ return aSNS; \
+}
+
+// Service with service factory.
+
+// Own implementation of getSupportedServiceNames_Static().
+#define XSERVICEINFO_IMPL_0( Class, ImplName ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static()
+
+// 1 service name
+#define XSERVICEINFO_IMPL_1( Class, ImplName, Service1 ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static() \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \
+ aSNS.getArray()[ 0 ] = Service1; \
+ return aSNS; \
+}
+
+#endif /* !_UCBHELPER_MACROS_HXX */
diff --git a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
new file mode 100644
index 000000000000..0af670631d35
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * $RCSfile: propertyvalueset.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
+#define _UCBHELPER_PROPERTYVALUESET_HXX
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace script {
+ class XTypeConverter;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct Property;
+ class XPropertySet;
+} } } }
+
+namespace ucb {
+
+class PropertyValues;
+
+//=========================================================================
+
+/**
+ * This class implements the interface XRow. After construction of a valueset
+ * the user can append properties ( incl. its values ) to the set. This class
+ * is useful when implementing the command "getPropertyValues", because the
+ * values to return can easyly appended to a valueset object. That object can
+ * directly be returned by the implementation of the command.
+ */
+class PropertyValueSet :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::sdbc::XRow,
+ public com::sun::star::sdbc::XColumnLocate
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter >
+ m_xTypeConverter;
+ vos::OMutex m_aMutex;
+ PropertyValues* m_pValues;
+ sal_Bool m_bWasNull;
+ sal_Bool m_bTriedToGetTypeConverter;
+
+private:
+ const com::sun::star::uno::Reference<
+ com::sun::star::script::XTypeConverter >&
+ getTypeConverter();
+
+public:
+ PropertyValueSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
+ virtual ~PropertyValueSet();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull()
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL
+ getString( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess >& typeMap )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL
+ findColumn( const ::rtl::OUString& columnName )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the number of elements of the value set.
+ *
+ * @return the number of elements of the value set.
+ */
+ sal_Int32 getLength() const;
+
+ /**
+ * This method appends a string to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendString ( const ::com::sun::star::beans::Property& rProp,
+ const ::rtl::OUString& rValue );
+
+ /**
+ * This method appends a boolean to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBoolean ( const ::com::sun::star::beans::Property& rProp,
+ sal_Bool bValue );
+
+ /**
+ * This method appends a byte to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendByte ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int8 nValue );
+
+ /**
+ * This method appends a short to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendShort ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int16 nValue );
+
+ /**
+ * This method appends an int to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendInt ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int32 nValue );
+
+ /**
+ * This method appends a long to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendLong ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int64 nValue );
+
+ /**
+ * This method appends a float to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendFloat ( const ::com::sun::star::beans::Property& rProp,
+ float nValue );
+
+ /**
+ * This method appends a double to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendDouble ( const ::com::sun::star::beans::Property& rProp,
+ double nValue );
+
+ /**
+ * This method appends a byte sequence to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBytes ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int8 >& rValue );
+
+ /**
+ * This method appends a date to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendDate ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::Date& rValue );
+
+ /**
+ * This method appends a time to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendTime ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::Time& rValue );
+
+ /**
+ * This method appends a timestamp to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendTimestamp( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::DateTime& rValue );
+
+ /**
+ * This method appends a binary stream to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBinaryStream ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >&
+ rValue );
+
+ /**
+ * This method appends a character stream to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendCharacterStream( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >&
+ rValue );
+
+ /**
+ * This method appends an object ( any ) to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendObject ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Any& rValue );
+
+ /**
+ * This method appends a ref to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendRef ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XRef >& rValue );
+
+ /**
+ * This method appends a blob to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBlob ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XBlob >& rValue );
+
+ /**
+ * This method appends a clob to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendClob ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XClob >& rValue );
+
+ /**
+ * This method appends an array to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendArray ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XArray >& rValue );
+
+ /**
+ * This method appends a void value ( a "hole" ) to the value set. This
+ * is useful, since void values indicate errors, like non-existing
+ * property (-values) etc.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendVoid ( const ::com::sun::star::beans::Property& rProp );
+
+ /**
+ * This method tries to append all property values contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ */
+ void appendPropertySet( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& rSet );
+
+ /** This method tries to append a single property value contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ * @param rProperty is the property for that the value shall be obtained
+ * from the given property set.
+ * @return False, if the property value cannot be obtained from the
+ * given property pet. True, otherwise.
+ */
+ sal_Bool appendPropertySetValue(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& rSet,
+ const ::com::sun::star::beans::Property& rProperty );
+};
+
+}
+
+#endif /* !_UCBHELPER_PROPERTYVALUESET_HXX */
diff --git a/ucbhelper/inc/ucbhelper/providerhelper.hxx b/ucbhelper/inc/ucbhelper/providerhelper.hxx
new file mode 100644
index 000000000000..d77f62142f57
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/providerhelper.hxx
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * $RCSfile: providerhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#define _UCBHELPER_PROVIDERHELPER_HXX
+
+#ifndef __LIST__
+#include <stl/list>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+//=========================================================================
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XPropertySetRegistry;
+ class XPersistentPropertySet;
+} } } }
+
+namespace ucb_impl { struct ContentProviderImplHelper_Impl; }
+
+namespace ucb {
+
+//=========================================================================
+
+class ContentImplHelper;
+typedef vos::ORef< ContentImplHelper >ContentImplHelperRef;
+typedef std::list< ContentImplHelperRef > ContentRefList;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.ContentProvider. It provides contents derived from
+ * class ucb::ContentImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - maintains a set of ContentImplHelper objects, which were created by
+ * the provider implementation. So there will be exactly one object for
+ * one Content Identifier.
+ * - Provides access to the Additional Core PropertySet of a content.
+ * ( These set contains the properties added to a content using its
+ * XPropertyContainer interface )
+ */
+class ContentProviderImplHelper : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::ucb::XContentProvider
+{
+ friend class ContentImplHelper;
+
+ ucb_impl::ContentProviderImplHelper_Impl* m_pImpl;
+
+protected:
+ vos::OMutex m_aMutex;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+
+private:
+ void addContent ( ContentImplHelper* pContent );
+ void removeContent( ContentImplHelper* pContent );
+ void removeContent( const ::rtl::OUString& rURL );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XPropertySetRegistry >
+ getAdditionalPropertySetRegistry();
+
+protected:
+ /**
+ * This method returns a content with the given id, if it already exists.
+ * Use this method in your "queryContent" implementation to ensure unique
+ * objects.
+ *
+ * @param Identifier is the content identifier, for that an existing
+ * content object is requested.
+ * @return the content with the given identifier, if it exists or 0, if it
+ * does not exist.
+ */
+ vos::ORef< ContentImplHelper >
+ queryExistingContent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier );
+
+ /**
+ * This method returns a content with the given URL, if it already exists.
+ *
+ * @param rURL is the URL ( content identifier string ), for that an
+ * existing content object is requested.
+ * @return the content with the given URL, if it exists or 0, if it
+ * does not exist.
+ */
+ vos::ORef< ContentImplHelper >
+ queryExistingContent( const ::rtl::OUString& rURL );
+
+public:
+
+ //////////////////////////////////////////////////////////////////////
+ // Contsruction/Destruction
+ //////////////////////////////////////////////////////////////////////
+
+ ContentProviderImplHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+ virtual ~ContentProviderImplHelper();
+
+ //////////////////////////////////////////////////////////////////////
+ // XInterface
+ //////////////////////////////////////////////////////////////////////
+
+ XINTERFACE_DECL()
+
+ //////////////////////////////////////////////////////////////////////
+ // XTypeProvider
+ //////////////////////////////////////////////////////////////////////
+
+ XTYPEPROVIDER_DECL()
+
+ //////////////////////////////////////////////////////////////////////
+ // XServiceInfo
+ //////////////////////////////////////////////////////////////////////
+
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ //////////////////////////////////////////////////////////////////////
+ // XContentProvider
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns a content with the requested id.
+ *
+ * The implementation should:
+ *
+ * - Check, whether the Identifier is valid ( URL syntax ).
+ * - Use queryExistingContent(...) to determine, whether there exists
+ * already a content with the given id.
+ * - Return the possibly existing content.Create and return a new
+ * content, otherwise
+ */
+ 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 ) = 0;
+ virtual sal_Int32 SAL_CALL
+ compareContentIds( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Id1,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Id2 )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns a mutex, which protects the content list of the
+ * provider. So you can prevent modifications of that list easyly.
+ *
+ * @return the mutex.
+ */
+ vos::OMutex& getContentListMutex() { return m_aMutex; }
+
+ /**
+ * This method fills a list with all contents existing at calling time.
+ * Note: You may prevent modifications of the content list at any time
+ * by acquiring the content list mutex of the provider.
+ *
+ * @param rContents is the list to fill with the children.
+ */
+ void queryExistingContents( ContentRefList& rContents );
+
+ /**
+ * This method returns the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key for the propertyset.
+ * @param bCreate is a flag indicating whether the propertyset shall
+ * be created in case it does not exist.
+ * @return the propertyset containing the Additional Core Properties.
+ */
+ ::com::sun::star::uno::Reference<
+ com::sun::star::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( const ::rtl::OUString& rKey, sal_Bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be renamed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool renameAdditionalPropertySet( const ::rtl::OUString& rOldKey,
+ const ::rtl::OUString& rNewKey,
+ sal_Bool bRecursive );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key of the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be removed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool removeAdditionalPropertySet( const ::rtl::OUString& rKey,
+ sal_Bool bRecursive );
+};
+
+} // namespace ucb
+
+#endif /* !_UCBHELPER_PROVIDERHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultset.hxx b/ucbhelper/inc/ucbhelper/resultset.hxx
new file mode 100644
index 000000000000..04bf0af9448d
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultset.hxx
@@ -0,0 +1,609 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultset.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSET_HXX
+#define _UCBHELPER_RESULTSET_HXX
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_RESULTSETEXCEPTION_HPP_
+#include <com/sun/star/ucb/ResultSetException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_HPP_
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+#ifndef _VOS_REFERNCE_HXX_
+#include <vos/refernce.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace ucb {
+
+//=========================================================================
+
+#define RESULTSET_SERVICE_NAME "com.sun.star.ucb.ContentResultSet"
+
+//=========================================================================
+
+class ResultSetDataSupplier;
+struct ResultSet_Impl;
+
+/**
+ * This is an implementation of the service com.sun.star.ucb.ContentResultSet.
+ * It can be used to implement the method XDynamicResultSet::getStaticResultSet,
+ * which needs to be implemented for instance to implement the command "open"
+ * at folder objects. This class uses a user supplied ResultSetDataSupplier
+ * object to request data on demand.
+ *
+ * @see ResultSetDataSupplier
+ */
+class ResultSet :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XComponent,
+ public com::sun::star::ucb::XContentAccess,
+ public com::sun::star::sdbc::XResultSet,
+ public com::sun::star::sdbc::XResultSetMetaDataSupplier,
+ public com::sun::star::sdbc::XRow,
+ public com::sun::star::sdbc::XCloseable,
+ public com::sun::star::beans::XPropertySet
+{
+ ResultSet_Impl* m_pImpl;
+
+public:
+ /**
+ * Construction.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProperties is a sequence of properties for that the resultset
+ * shall be able to obtain the values.
+ * @param rDataSupplier is a supplier for the resultset data.
+ */
+ ResultSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::beans::Property >& rProperties,
+ const vos::ORef< ResultSetDataSupplier >& rDataSupplier );
+ virtual ~ResultSet();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_NOFACTORY_DECL()
+
+ // XComponent
+ virtual void SAL_CALL
+ dispose()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContentAccess
+ virtual rtl::OUString SAL_CALL
+ queryContentIdentfierString()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier > SAL_CALL
+ queryContentIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContent > SAL_CALL
+ queryContent()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XResultSetMetaDataSupplier
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSetMetaData > SAL_CALL
+ getMetaData()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XResultSet
+ virtual sal_Bool SAL_CALL
+ next()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isBeforeFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isAfterLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ beforeFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ afterLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ first()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ last()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getRow()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ absolute( sal_Int32 row )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ relative( sal_Int32 rows )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ previous()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ refreshRow()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowUpdated()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowInserted()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowDeleted()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface > SAL_CALL
+ getStatement()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getString( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XNameAccess >& typeMap )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XCloseable
+ virtual void SAL_CALL
+ close()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XPropertySet
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setPropertyValue( const rtl::OUString& aPropertyName,
+ const com::sun::star::uno::Any& aValue )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::beans::PropertyVetoException,
+ com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Any SAL_CALL
+ getPropertyValue( const rtl::OUString& PropertyName )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addPropertyChangeListener( const rtl::OUString& aPropertyName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removePropertyChangeListener( const rtl::OUString& aPropertyName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addVetoableChangeListener( const rtl::OUString& PropertyName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeVetoableChangeListener( const rtl::OUString& PropertyName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+
+ /////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ /////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method propagates property value changes to all registered
+ * listeners.
+ *
+ * @param rEvt is a property change event.
+ */
+ void propertyChanged(
+ const com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were new data obtained from the data source.
+ *
+ * @param nOld is the old count of rows.
+ * @param nnew is the new count of rows.
+ */
+ void rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew );
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were all rows obtained from the data source.
+ */
+ void rowCountFinal();
+
+ /**
+ * This method returns a sequence containing all properties ( not the
+ * values! ) of the result set.
+ *
+ * @return a sequence of properties.
+ */
+ const com::sun::star::uno::Sequence< com::sun::star::beans::Property >&
+ getProperties();
+};
+
+//=========================================================================
+
+/**
+ * This is the base class for an object that supplies data to a result set
+ *
+ * @see ResultSet
+ */
+class ResultSetDataSupplier : public vos::OReference
+{
+ friend class ResultSet;
+
+ // No ref, otherwise we get a cyclic reference between supplier and set!
+ // Will be set from ResultSet ctor.
+ ResultSet* m_pResultSet;
+
+public:
+ ResultSetDataSupplier() : m_pResultSet( 0 ) {}
+
+ /**
+ * This method returns the resultset this supplier belongs to.
+ *
+ * @return the resultset for that the supplier supplies data.
+ */
+ vos::ORef< ResultSet > getResultSet() const { return m_pResultSet; }
+
+ /**
+ * This method returns the identifier string of the content at the
+ * specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the content's identifier string.
+ */
+ virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the identifier of the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the content's identifier.
+ */
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >
+ queryContentIdentifier( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the content.
+ */
+ virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
+ queryContent( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns whether there is a content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return true, if there is a content at the given index.
+ */
+ virtual sal_Bool getResult( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the total count of objects in the logical data array
+ * of the supplier. The implementation of this method may be very
+ * "expensive", because it can be necessary to obtain all data in order
+ * to determine the count. Therefor the ResultSet implementation calls
+ * it very seldom.
+ *
+ * @return the total count of objects.
+ */
+ virtual sal_uInt32 totalCount() = 0;
+
+ /**
+ * This method returns the count of objects obtained so far. There is no
+ * for the implemetation to obtain all objects at once. It can obtain
+ * all data on demand.
+ *
+ * The implementation should call m_pResultSet->rowCountChanged(...)
+ * everytime it has inserted a new entry in its logical result array.
+ *
+ * @return the count of objects obtained so far.
+ */
+ virtual sal_uInt32 currentCount() = 0;
+
+ /**
+ * This method returns whether the value returned by currentCount() is
+ * "final". This is the case, if that there was all data obtained by the
+ * supplier and the current count won't increase any more.
+ *
+ * The implementation should call m_pResultSet->rowCountFinal(...) if
+ * it has inserted all entries in its logical result array.
+ *
+ * @return true, if the the value returned by currentCount() won't change
+ anymore.
+ */
+ virtual sal_Bool isCountFinal() = 0;
+
+ /**
+ * This method returns an object for accessing the property values at
+ * the specified index. The implementation may use the helper class
+ * ucb::PropertyValueSet to provide the return value.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the object for accessing the property values.
+ */
+ virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
+ queryPropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method is called to instruct the supplier to release the (possibly
+ * presnt) property values at the given index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ */
+ virtual void releasePropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * to instruct the data supplier to release all resources it has
+ * allocated so far. In case the supplier is collecting data
+ * asynchronously, that process must be stopped.
+ */
+ virtual void close() = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * check, whether an error has occured while collecting data. The
+ * implementation of this method must throw an exception in that case.
+ *
+ * Note: An exception thrown to indicate an error must always be thrown
+ * by the thread that created the data supplier. If the supplier collects
+ * data asynchronously ( i.e. in a separate thread ) and an error
+ * occures, throwing of the appropriate exception must be deferred
+ * until validate() is called by the ResultSet implementation from
+ * inside the main thread.
+ * In case data are obtained synchronously, the ResultSetException can
+ * be thrown directly.
+ *
+ * @exception ResultSetException thrown, if an error has occured
+ */
+ virtual void validate()
+ throw( com::sun::star::ucb::ResultSetException ) = 0;
+};
+
+}
+
+#endif /* !_UCBHELPER_RESULTSET_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultsethelper.hxx b/ucbhelper/inc/ucbhelper/resultsethelper.hxx
new file mode 100644
index 000000000000..6bc07e4018b8
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultsethelper.hxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultsethelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSETHELPER_HXX
+#define _UCBHELPER_RESULTSETHELPER_HXX
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP_
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+
+namespace cppu {
+ class OInterfaceContainerHelper;
+}
+
+namespace ucb {
+
+//=========================================================================
+
+#define DYNAMICRESULTSET_SERVICE_NAME \
+ "com.sun.star.ucb.DynamicContentResultSet"
+
+//=========================================================================
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.DynamicResultSet, which is the result of the command
+ * "open" executed at a UCB folder content.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service com::sun::star::ucb::DynamicResultSet
+ */
+class ResultSetImplHelper :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::ucb::XDynamicResultSet
+{
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ sal_Bool m_bStatic;
+ sal_Bool m_bInitDone;
+
+protected:
+ osl::Mutex m_aMutex;
+ com::sun::star::ucb::OpenCommandArgument2 m_aCommand;
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ // Resultset #1
+ com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > m_xResultSet1;
+ // Resultset #2
+ com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > m_xResultSet2;
+ // Resultset changes listener.
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSetListener > m_xListener;
+
+private:
+ void init( sal_Bool bStatic );
+
+ /**
+ * Your implementation of this method has to fill the protected member
+ * m_xResultSet1. This resultset must implement a complete static
+ * resultset ( service com.sun.star.ucb.ContentResultSet ). This method
+ * will be called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "static". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively statically. You may deploy this factum to optimize your
+ * implementation (i.e. "switch off" all changes detection code in
+ * your implementation).
+ * Note that you may use the class ucb::ResultSet to implement the
+ * static resultset, that is required here.
+ */
+ virtual void initStatic() = 0;
+
+ /**
+ * Your implementation of this method has to fill the protected members
+ * m_xResultSet1 and m_xResultSet2 of this base class. Each of these
+ * resultsets must implement a complete static resultset
+ * ( service com.sun.star.ucb.ContentResultSet ). This method will be
+ * called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "dynamic". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively dynamically. This means, it is interested in getting
+ * notifications on changes of data of the resultset contents. ( These
+ * changes are to propagate by your implementation throw the member
+ * m_xListener of this base class ).
+ * If your implementation cannot detect changes of relevant data, you
+ * may fill m_xResultSet1 and m_xResultSet2 with the same static resultset
+ * implementation object. This normally will be the same instance you put
+ * into m_xResultSet1 when initStatic() is called.
+ */
+ virtual void initDynamic() = 0;
+
+public:
+ /**
+ * Construtor.
+ *
+ * @param rxSMgr is a Service Manager.
+ */
+ ResultSetImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
+
+ /**
+ * Construtor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rCommand is the paramter for the open command that produces
+ * this resultset.
+ */
+ ResultSetImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::ucb::OpenCommandArgument2& rCommand );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetImplHelper();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_NOFACTORY_DECL()
+
+ // XComponent ( base class of XDynamicResultSet )
+ virtual void SAL_CALL
+ dispose()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XDynamicResultSet
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > SAL_CALL
+ getStaticResultSet()
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setListener( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSetListener >& Listener )
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ connectToCache( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSet > & xCache )
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::ucb::AlreadyInitializedException,
+ com::sun::star::ucb::ServiceNotFoundException,
+ com::sun::star::uno::RuntimeException );
+
+ /**
+ * The implemetation of this method always returns 0. Override this
+ * method, if necassary.
+ */
+ virtual sal_Int16 SAL_CALL
+ getCapabilities()
+ throw( com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns, whether the resultset is static or dynamic.
+ * If neither getStatic() nor getDynamic() was called, the type
+ * of the resultset is "dynamic".
+ *
+ * @return true, if the resultset type is "static". False, otherwise.
+ */
+ sal_Bool isStatic() const { return m_bStatic; }
+};
+
+}
+
+#endif /* !_UCBHELPER_RESULTSETHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx b/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx
new file mode 100644
index 000000000000..4c4745dade77
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultsetmetadata.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
+#define _UCBHELPER_RESULTSETMETADATA_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+ namespace beans { struct Property; }
+} } }
+
+namespace ucb
+{
+
+//=========================================================================
+
+struct ResultSetMetaData_Impl;
+
+/**
+ * This is a simple implementation of the interface XResultSetMetaData.
+ * Some methods will simply return standard values. Other calculating the
+ * return values using the property sequence provided to the constructor of
+ * this class.
+ * One can derive from this class, if other implementations of any methods
+ * is needed, but for many cases this implementation should do good guesses
+ * for many use cases.
+ */
+class ResultSetMetaData :
+ public ::cppu::OWeakObject,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::sdbc::XResultSetMetaData
+{
+private:
+ ResultSetMetaData_Impl* m_pImpl;
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property > m_aProps;
+ sal_Bool m_bReadOnly;
+
+public:
+
+ /**
+ * Constructor.
+ *
+ * @param rxSMgr is a Servive Manager.
+ * @param rProps is a sequence of properties (partially) describing the
+ * columns of a resultset.
+ * @param bReadOnly is used to specify whether the whole(!) resultset
+ * is read-only.
+ */
+ ResultSetMetaData(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property >& rProps,
+ sal_Bool bReadOnly = sal_True );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetMetaData();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XResultSetMetaData
+ /**
+ * @return the length of the property sequence.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnCount()
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the value of member m_bReadOnly.
+ */
+ virtual sal_Bool SAL_CALL
+ isAutoIncrement( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always true.
+ */
+ virtual sal_Bool SAL_CALL
+ isCaseSensitive( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always false.
+ */
+ virtual sal_Bool SAL_CALL
+ isSearchable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always false.
+ */
+ virtual sal_Bool SAL_CALL
+ isCurrency( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always ColumnValue::NULLABLE.
+ */
+ virtual sal_Int32 SAL_CALL
+ isNullable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always false.
+ */
+ virtual sal_Bool SAL_CALL
+ isSigned( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always 16.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnDisplaySize( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the name of the property that corresponds to column.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnLabel( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the name of the property that corresponds to column.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getSchemaName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always -1.
+ */
+ virtual sal_Int32 SAL_CALL
+ getPrecision( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always 0.
+ */
+ virtual sal_Int32 SAL_CALL
+ getScale( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getTableName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ getCatalogName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the type of the property that corresponds to column - mapped
+ * from UNO-Type to SQL-Type.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnType( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnTypeName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the value of member m_bReadOnly.
+ */
+ virtual sal_Bool SAL_CALL
+ isReadOnly( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the inverted value of member m_bReadOnly.
+ */
+ virtual sal_Bool SAL_CALL
+ isWritable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the inverted value of member m_bReadOnly.
+ */
+ virtual sal_Bool SAL_CALL
+ isDefinitelyWritable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnServiceName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+};
+
+} // namespace ucb
+
+#endif /* !_UCBHELPER_RESULTSETMETADATA_HXX */
diff --git a/ucbhelper/prj/d.lst b/ucbhelper/prj/d.lst
new file mode 100644
index 000000000000..f32f8ced6ba9
--- /dev/null
+++ b/ucbhelper/prj/d.lst
@@ -0,0 +1,24 @@
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
+..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%\lib*.dylib
+..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT%\*.lib
+..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
+..\%__SRC%\misc\*.sym %_DEST%\bin%_EXT%\*.sym
+
+mkdir: %_DEST%\inc%_EXT%\ucbhelper
+..\inc\ucbhelper\configureucb.hxx %_DEST%\inc%_EXT%\ucbhelper\configureucb.hxx
+..\inc\ucbhelper\content.hxx %_DEST%\inc%_EXT%\ucbhelper\content.hxx
+..\inc\ucbhelper\contentbroker.hxx %_DEST%\inc%_EXT%\ucbhelper\contentbroker.hxx
+..\inc\ucbhelper\commandenvironment.hxx %_DEST%\inc%_EXT%\ucbhelper\commandenvironment.hxx
+..\inc\ucbhelper\contentidentifier.hxx %_DEST%\inc%_EXT%\ucbhelper\contentidentifier.hxx
+..\inc\ucbhelper\contenthelper.hxx %_DEST%\inc%_EXT%\ucbhelper\contenthelper.hxx
+..\inc\ucbhelper\contentidentifier.hxx %_DEST%\inc%_EXT%\ucbhelper\contentidentifier.hxx
+..\inc\ucbhelper\contentinfo.hxx %_DEST%\inc%_EXT%\ucbhelper\contentinfo.hxx
+..\inc\ucbhelper\macros.hxx %_DEST%\inc%_EXT%\ucbhelper\macros.hxx
+..\inc\ucbhelper\propertyvalueset.hxx %_DEST%\inc%_EXT%\ucbhelper\propertyvalueset.hxx
+..\inc\ucbhelper\providerhelper.hxx %_DEST%\inc%_EXT%\ucbhelper\providerhelper.hxx
+..\inc\ucbhelper\registerucb.hxx %_DEST%\inc%_EXT%\ucbhelper\registerucb.hxx
+..\inc\ucbhelper\resultset.hxx %_DEST%\inc%_EXT%\ucbhelper\resultset.hxx
+..\inc\ucbhelper\resultsetmetadata.hxx %_DEST%\inc%_EXT%\ucbhelper\resultsetmetadata.hxx
+..\inc\ucbhelper\resultsethelper.hxx %_DEST%\inc%_EXT%\ucbhelper\resultsethelper.hxx
+..\version.mk %_DEST%\inc%_EXT%\ucbhelper\version.mk
diff --git a/ucbhelper/source/client/commandenvironment.cxx b/ucbhelper/source/client/commandenvironment.cxx
new file mode 100644
index 000000000000..feef034704cf
--- /dev/null
+++ b/ucbhelper/source/client/commandenvironment.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * $RCSfile: commandenvironment.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIERFACTORY_HPP_
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+
+#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
+#include <ucbhelper/commandenvironment.hxx>
+#endif
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace ucb
+{
+
+//=========================================================================
+//=========================================================================
+//
+// struct CommandEnvironment_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+struct CommandEnvironment_Impl
+{
+ Reference< XInteractionHandler > m_xInteractionHandler;
+ Reference< XProgressHandler > m_xProgressHandler;
+
+ CommandEnvironment_Impl(
+ const Reference< XInteractionHandler >& rxInteractionHandler,
+ const Reference< XProgressHandler >& rxProgressHandler )
+ : m_xInteractionHandler( rxInteractionHandler ),
+ m_xProgressHandler( rxProgressHandler ) {}
+};
+
+//=========================================================================
+//=========================================================================
+//
+// CommandEnvironment Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+CommandEnvironment::CommandEnvironment(
+ const Reference< XInteractionHandler >& rxInteractionHandler,
+ const Reference< XProgressHandler >& rxProgressHandler )
+{
+ m_pImpl = new CommandEnvironment_Impl( rxInteractionHandler,
+ rxProgressHandler );
+}
+
+//=========================================================================
+// virtual
+CommandEnvironment::~CommandEnvironment()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( CommandEnvironment,
+ XTypeProvider,
+ XCommandEnvironment );
+
+//=========================================================================
+//
+// XTypeProvider methods
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( CommandEnvironment,
+ XTypeProvider,
+ XCommandEnvironment );
+
+//=========================================================================
+//
+// XCommandEnvironemnt methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XInteractionHandler > SAL_CALL
+CommandEnvironment::getInteractionHandler()
+ throw ( RuntimeException )
+{
+ return m_pImpl->m_xInteractionHandler;
+}
+
+//=========================================================================
+// virtual
+Reference< XProgressHandler > SAL_CALL
+CommandEnvironment::getProgressHandler()
+ throw ( RuntimeException )
+{
+ return m_pImpl->m_xProgressHandler;
+}
+
+} /* namespace ucb */
+
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
new file mode 100644
index 000000000000..7de4a7d38f41
--- /dev/null
+++ b/ucbhelper/source/client/content.cxx
@@ -0,0 +1,1069 @@
+/*************************************************************************
+ *
+ * $RCSfile: content.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_REFERNCE_HXX_
+#include <vos/refernce.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_COMMAND_HPP_
+#include <com/sun/star/ucb/Command.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_COMMANDINFO_HPP_
+#include <com/sun/star/ucb/CommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_INSERTCOMMANDARGUMENT_HPP_
+#include <com/sun/star/ucb/InsertCommandArgument.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_
+#include <com/sun/star/ucb/OpenMode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTCREATOR_HPP_
+#include <com/sun/star/ucb/XContentCreator.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIERFACTORY_HPP_
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP_
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#include <ucbhelper/contentbroker.hxx>
+#endif
+
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace ucb
+{
+
+//=========================================================================
+//=========================================================================
+//
+// class Content_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+class Content_Impl : public vos::OReference
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XContent > m_xContent;
+ Reference< XCommandProcessor > m_xCommandProcessor;
+ Reference< XCommandEnvironment > m_xEnv;
+ vos::OMutex m_aMutex;
+ sal_Int32 m_aCommandId;
+
+public:
+ inline Content_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv );
+
+ virtual ~Content_Impl();
+
+ Reference< XContent > getContent() const { return m_xContent; }
+ Reference< XCommandProcessor > getCommandProcessor();
+ sal_Int32 getCommandId();
+
+ Any executeCommand( const Command& rCommand );
+ void abortCommand();
+ Reference< XCommandEnvironment > getEnvironment() const { return m_xEnv; }
+};
+
+//=========================================================================
+inline Content_Impl::Content_Impl(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv )
+: m_xSMgr( rSMgr ),
+ m_xContent( rContent ),
+ m_xEnv( rEnv ),
+ m_aCommandId( 0 )
+{
+}
+
+//=========================================================================
+//=========================================================================
+//
+// Content Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+Content::Content()
+{
+}
+
+//=========================================================================
+Content::Content( const OUString& rURL,
+ const Reference< XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException, RuntimeException )
+{
+ ucb::ContentBroker* pBroker = ucb::ContentBroker::get();
+ if ( !pBroker )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_BROKER );
+
+ VOS_ENSURE( pBroker->getContentProviderManagerInterface()
+ ->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
+
+ Reference< XContentIdentifierFactory > xIdFac
+ = pBroker->getContentIdentifierFactoryInterface();
+ if ( !xIdFac.is() )
+ throw ContentCreationException(
+ ContentCreationException::NO_IDENTIFIER_FACTORY );
+
+ Reference< XContentIdentifier > xId
+ = xIdFac->createContentIdentifier( rURL );
+ if ( !xId.is() )
+ throw ContentCreationException(
+ ContentCreationException::IDENTIFIER_CREATION_FAILED );
+
+ Reference< XContentProvider > xProvider
+ = pBroker->getContentProviderInterface();
+ if ( !xProvider.is() )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_PROVIDER );
+
+ Reference< XContent > xContent;
+ try
+ {
+ xContent = xProvider->queryContent( xId );
+ }
+ catch ( IllegalIdentifierException )
+ {
+ throw ContentCreationException(
+ ContentCreationException::CONTENT_CREATION_FAILED );
+ }
+
+ if ( !xContent.is() )
+ throw ContentCreationException(
+ ContentCreationException::CONTENT_CREATION_FAILED );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Reference< XContentIdentifier >& rId,
+ const Reference< XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException, RuntimeException )
+{
+ ucb::ContentBroker* pBroker = ucb::ContentBroker::get();
+ if ( !pBroker )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_BROKER );
+
+ VOS_ENSURE( pBroker->getContentProviderManagerInterface()
+ ->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
+
+ Reference< XContentProvider > xProvider
+ = pBroker->getContentProviderInterface();
+ if ( !xProvider.is() )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_PROVIDER );
+
+ Reference< XContent > xContent;
+ try
+ {
+ xContent = xProvider->queryContent( rId );
+ }
+ catch ( IllegalIdentifierException )
+ {
+ throw ContentCreationException(
+ ContentCreationException::CONTENT_CREATION_FAILED );
+ }
+
+ if ( !xContent.is() )
+ throw ContentCreationException(
+ ContentCreationException::CONTENT_CREATION_FAILED );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv )
+{
+ ucb::ContentBroker* pBroker = ucb::ContentBroker::get();
+ if ( !pBroker )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_BROKER );
+
+ VOS_ENSURE( pBroker->getContentProviderManagerInterface()
+ ->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), rContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Content& rOther )
+{
+ m_xImpl = rOther.m_xImpl;
+}
+
+//=========================================================================
+Content::~Content()
+{
+}
+
+//=========================================================================
+Content& Content::operator=( const Content& rOther )
+{
+ m_xImpl = rOther.m_xImpl;
+ return *this;
+}
+
+//=========================================================================
+Reference< XContent > Content::get() const
+{
+ return m_xImpl->getContent();
+}
+
+//=========================================================================
+Reference< XCommandInfo > Content::getCommands()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "getCommandInfo" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = Any();
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XCommandInfo > xInfo;
+ aResult >>= xInfo;
+ return xInfo;
+}
+
+//=========================================================================
+Reference< XPropertySetInfo > Content::getProperties()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "getPropertySetInfo" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = Any();
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XPropertySetInfo > xInfo;
+ aResult >>= xInfo;
+ return xInfo;
+}
+
+//=========================================================================
+Any Content::getPropertyValue( const OUString& rPropertyName )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< OUString > aNames( 1 );
+ aNames.getArray()[ 0 ] = rPropertyName;
+
+ Sequence< Any > aRet = getPropertyValues( aNames );
+ return aRet.getConstArray()[ 0 ];
+}
+
+//=========================================================================
+Any Content::getPropertyValue( sal_Int32 nPropertyHandle )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< sal_Int32 > aHandles( 1 );
+ aHandles.getArray()[ 0 ] = nPropertyHandle;
+
+ Sequence< Any > aRet = getPropertyValues( aHandles );
+ return aRet.getConstArray()[ 0 ];
+}
+
+//=========================================================================
+void Content::setPropertyValue( const OUString& rName,
+ const Any& rValue )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< OUString > aNames( 1 );
+ aNames.getArray()[ 0 ] = rName;
+
+ Sequence< Any > aValues( 1 );
+ aValues.getArray()[ 0 ] = rValue;
+
+ setPropertyValues( aNames, aValues );
+}
+
+//=========================================================================
+void Content::setPropertyValue( const sal_Int32 nPropertyHandle,
+ const Any& rValue )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< sal_Int32 > aHandles( 1 );
+ aHandles.getArray()[ 0 ] = nPropertyHandle;
+
+ Sequence< Any > aValues( 1 );
+ aValues.getArray()[ 0 ] = rValue;
+
+ setPropertyValues( aHandles, aValues );
+}
+
+//=========================================================================
+Sequence< Any > Content::getPropertyValues(
+ const Sequence< OUString >& rPropertyNames )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XRow > xRow = getPropertyValuesInterface( rPropertyNames );
+
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Any > aValues( nCount );
+ Any* pValues = aValues.getArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ pValues[ n ] = xRow->getObject( n + 1, Reference< XNameAccess >() );
+
+ return aValues;
+}
+
+//=========================================================================
+Sequence< Any > Content::getPropertyValues(
+ const Sequence< sal_Int32 >& nPropertyHandles )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XRow > xRow = getPropertyValuesInterface( nPropertyHandles );
+
+ sal_Int32 nCount = nPropertyHandles.getLength();
+ Sequence< Any > aValues( nCount );
+ Any* pValues = aValues.getArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ pValues[ n ] = xRow->getObject( n + 1, Reference< XNameAccess >() );
+
+ return aValues;
+}
+
+//=========================================================================
+Reference< XRow > Content::getPropertyValuesInterface(
+ const Sequence< OUString >& rPropertyNames )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+// rProp.Type =
+// rProp.Attributes = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "getPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XRow > xRow;
+ aResult >>= xRow;
+ return xRow;
+}
+
+//=========================================================================
+Reference< XRow > Content::getPropertyValuesInterface(
+ const Sequence< sal_Int32 >& nPropertyHandles )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Int32 nCount = nPropertyHandles.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+
+ const sal_Int32* pHandles = nPropertyHandles.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ rProp.Name = OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+// rProp.Type =
+// rProp.Attributes = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "getPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XRow > xRow;
+ aResult >>= xRow;
+ return xRow;
+}
+
+//=========================================================================
+void Content::setPropertyValues(
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& rValues )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rPropertyNames.getLength() != rValues.getLength() )
+ throw CommandAbortedException();
+
+ sal_Int32 nCount = rValues.getLength();
+ Sequence< PropertyValue > aProps( nCount );
+ PropertyValue* pProps = aProps.getArray();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ PropertyValue& rProp = pProps[ n ];
+
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+ rProp.Value = pValues[ n ];
+// rProp.State = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "setPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+void Content::setPropertyValues(
+ const Sequence< sal_Int32 >& nPropertyHandles,
+ const Sequence< Any >& rValues )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( nPropertyHandles.getLength() != rValues.getLength() )
+ throw CommandAbortedException();
+
+ sal_Int32 nCount = rValues.getLength();
+ Sequence< PropertyValue > aProps( nCount );
+ PropertyValue* pProps = aProps.getArray();
+
+ const sal_Int32* pHandles = nPropertyHandles.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ PropertyValue& rProp = pProps[ n ];
+
+ rProp.Name = OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+ rProp.Value = pValues[ n ];
+// rProp.State = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "setPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+Any Content::executeCommand( const OUString& rCommandName,
+ const Any& rCommandArgument )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = rCommandName;
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = rCommandArgument;
+
+ return m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+Any Content::executeCommand( sal_Int32 nCommandHandle,
+ const Any& rCommandArgument )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = OUString(); // n/a
+ aCommand.Handle = nCommandHandle;
+ aCommand.Argument = rCommandArgument;
+
+ return m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+void Content::abortCommand()
+{
+ m_xImpl->abortCommand();
+}
+
+//=========================================================================
+Reference< XCommandEnvironment > Content::getCommandEnvironment()
+{
+ return m_xImpl->getEnvironment();
+}
+
+//=========================================================================
+Reference< XResultSet > Content::createCursor(
+ const Sequence< OUString >& rPropertyNames,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isFolder() )
+ return Reference< XResultSet >();
+
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const OUString* pNames = rPropertyNames.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XDynamicResultSet > xDynSet;
+ Reference< XResultSet > xStaticSet;
+ if ( aResult >>= xDynSet )
+ xStaticSet = xDynSet->getStaticResultSet();
+
+ VOS_ENSURE( xStaticSet.is(), "Content::createCursor - no cursor!" );
+
+ if ( !xStaticSet.is() )
+ {
+ // Former, the open command directly returned a XResultSet.
+ aResult >>= xStaticSet;
+
+ VOS_ENSURE( !xStaticSet.is(),
+ "Content::createCursor - open-Command must "
+ "return a Reference< XDynnamicResultSet >!" );
+ }
+
+ return xStaticSet;
+}
+
+//=========================================================================
+Reference< XResultSet > Content::createCursor(
+ const Sequence< sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isFolder() )
+ return Reference< XResultSet >();
+
+ sal_Int32 nCount = rPropertyHandles.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const sal_Int32* pHandles = rPropertyHandles.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XDynamicResultSet > xDynSet;
+ Reference< XResultSet > xStaticSet;
+ if ( aResult >>= xDynSet )
+ xStaticSet = xDynSet->getStaticResultSet();
+
+ VOS_ENSURE( xStaticSet.is(), "Content::createCursor - no cursor!" );
+
+ if ( !xStaticSet.is() )
+ {
+ // Former, the open command directly returned a XResultSet.
+ aResult >>= xStaticSet;
+
+ VOS_ENSURE( !xStaticSet.is(),
+ "Content::createCursor - open-Command must "
+ "return a Reference< XDynnamicResultSet >!" );
+ }
+
+ return xStaticSet;
+}
+
+//=========================================================================
+Reference< XDynamicResultSet > Content::createDynamicCursor(
+ const Sequence< OUString >& rPropertyNames,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isFolder() )
+ return Reference< XDynamicResultSet >();
+
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const OUString* pNames = rPropertyNames.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ Reference< XDynamicResultSet > xSet;
+ m_xImpl->executeCommand( aCommand ) >>= xSet;
+
+ VOS_ENSURE( xSet.is(), "Content::createDynamicCursor - no cursor!" );
+
+ return xSet;
+}
+
+//=========================================================================
+Reference< XDynamicResultSet > Content::createDynamicCursor(
+ const Sequence< sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isFolder() )
+ return Reference< XDynamicResultSet >();
+
+ sal_Int32 nCount = rPropertyHandles.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const sal_Int32* pHandles = rPropertyHandles.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ Reference< XDynamicResultSet > xSet;
+ m_xImpl->executeCommand( aCommand ) >>= xSet;
+
+ VOS_ENSURE( xSet.is(), "Content::createDynamicCursor - no cursor!" );
+
+ return xSet;
+}
+
+//=========================================================================
+sal_Bool Content::openStream( const Reference< XActiveDataSink >& rSink )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return sal_False;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
+ aArg.Sink = rSink;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::openStream( const Reference< XOutputStream >& rStream )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return sal_False;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
+ aArg.Sink = rStream;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return sal_True;
+}
+
+//=========================================================================
+void Content::writeStream( const Reference< XInputStream >& rStream,
+ sal_Bool bReplaceExisting )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !rStream.is() )
+ return;
+
+ if ( !isDocument() )
+ return;
+
+ InsertCommandArgument aArg;
+ aArg.Data = rStream;
+ aArg.ReplaceExisting = bReplaceExisting;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "insert" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const OUString& rContentType,
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ return insertNewContent( rContentType,
+ rPropertyNames,
+ rPropertyValues,
+ Reference< XInputStream >(),
+ rNewContent );
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const OUString& rContentType,
+ const Sequence< sal_Int32 >& nPropertyHandles,
+ const Sequence< Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ return insertNewContent( rContentType,
+ nPropertyHandles,
+ rPropertyValues,
+ Reference< XInputStream >(),
+ rNewContent );
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const OUString& rContentType,
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& rPropertyValues,
+ const Reference< XInputStream >& rData,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rContentType.getLength() == 0 )
+ return sal_False;
+
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+
+ VOS_ENSURE( xCreator.is(),
+ "Content::insertNewContent - Not a XContentCreator!" );
+
+ if ( !xCreator.is() )
+ return sal_False;
+
+ ContentInfo aInfo;
+ aInfo.Type = rContentType;
+ aInfo.Attributes = 0;
+
+ Reference< XContent > xNew = xCreator->createNewContent( aInfo );
+ if ( !xNew.is() )
+ return sal_False;
+
+ Content aNewContent( xNew, m_xImpl->getEnvironment() );
+ aNewContent.setPropertyValues( rPropertyNames, rPropertyValues );
+ aNewContent.executeCommand( OUString::createFromAscii( "insert" ),
+ makeAny(
+ InsertCommandArgument(
+ rData,
+ sal_False /* ReplaceExisting */ ) ) );
+ rNewContent = aNewContent;
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const OUString& rContentType,
+ const Sequence< sal_Int32 >& nPropertyHandles,
+ const Sequence< Any >& rPropertyValues,
+ const Reference< XInputStream >& rData,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rContentType.getLength() == 0 )
+ return sal_False;
+
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+
+ VOS_ENSURE( xCreator.is(),
+ "Content::insertNewContent - Not a XContentCreator!" );
+
+ if ( !xCreator.is() )
+ return sal_False;
+
+ ContentInfo aInfo;
+ aInfo.Type = rContentType;
+ aInfo.Attributes = 0;
+
+ Reference< XContent > xNew = xCreator->createNewContent( aInfo );
+ if ( !xNew.is() )
+ return sal_False;
+
+ Content aNewContent( xNew, m_xImpl->getEnvironment() );
+ aNewContent.setPropertyValues( nPropertyHandles, rPropertyValues );
+ aNewContent.executeCommand( OUString::createFromAscii( "insert" ),
+ makeAny(
+ InsertCommandArgument(
+ rData,
+ sal_False /* ReplaceExisting */ ) ) );
+ rNewContent = aNewContent;
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::isFolder()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Bool bFolder = sal_False;
+ getPropertyValue( OUString::createFromAscii( "IsFolder" ) ) >>= bFolder;
+ return bFolder;
+}
+
+//=========================================================================
+sal_Bool Content::isDocument()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Bool bDoc = sal_False;
+ getPropertyValue( OUString::createFromAscii( "IsDocument" ) ) >>= bDoc;
+ return bDoc;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// Content_Impl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+// virtual
+Content_Impl::~Content_Impl()
+{
+}
+
+//=========================================================================
+Reference< XCommandProcessor > Content_Impl::getCommandProcessor()
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_xCommandProcessor.is() )
+ m_xCommandProcessor
+ = Reference< XCommandProcessor >( m_xContent, UNO_QUERY );
+
+ return m_xCommandProcessor;
+}
+
+//=========================================================================
+sal_Int32 Content_Impl::getCommandId()
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( m_aCommandId == 0 )
+ {
+ Reference< XCommandProcessor > xProc = getCommandProcessor();
+ if ( xProc.is() )
+ m_aCommandId = xProc->createCommandIdentifier();
+ }
+
+ return m_aCommandId;
+}
+
+//=========================================================================
+Any Content_Impl::executeCommand( const Command& rCommand )
+{
+ Reference< XCommandProcessor > xProc = getCommandProcessor();
+ if ( !xProc.is() )
+ return Any();
+
+ // Execute command
+ return xProc->execute( rCommand, getCommandId(), m_xEnv );
+}
+
+//=========================================================================
+void Content_Impl::abortCommand()
+{
+ if ( ( m_aCommandId != 0 ) && m_xCommandProcessor.is() )
+ m_xCommandProcessor->abort( m_aCommandId );
+}
+
+} /* namespace ucb */
+
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
new file mode 100644
index 000000000000..d6ad6c9f1a18
--- /dev/null
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentbroker.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIERFACTORY_HPP_
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#include <ucbhelper/contentbroker.hxx>
+#endif
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace ucb
+{
+
+//=========================================================================
+//=========================================================================
+//
+// class ContentBroker_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+class ContentBroker_Impl
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XContentIdentifierFactory > m_xIdFac;
+ Reference< XContentProvider > m_xProvider;
+ Reference< XContentProviderManager > m_xProviderMgr;
+ Sequence< Any > m_aArguments;
+ vos::OMutex m_aMutex;
+ sal_Bool m_bInitDone;
+
+private:
+ void init() const;
+ void init();
+
+public:
+ ContentBroker_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+ : m_xSMgr( rSMgr ), m_aArguments( rArguments ), m_bInitDone( sal_False )
+ {}
+
+ ~ContentBroker_Impl();
+
+ const Reference< XMultiServiceFactory >& getServiceManager() const
+ { return m_xSMgr; }
+
+ const Reference< XContentIdentifierFactory >& getIdFactory() const
+ { init(); return m_xIdFac; }
+
+ const Reference< XContentProvider >& getProvider() const
+ { init(); return m_xProvider; }
+
+ const Reference< XContentProviderManager >& getProviderManager() const
+ { init(); return m_xProviderMgr; }
+};
+
+//=========================================================================
+//=========================================================================
+//
+// ContentBroker Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+// static member!
+ContentBroker* ContentBroker::m_pTheBroker = 0;
+
+//=========================================================================
+ContentBroker::ContentBroker( const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+{
+ m_pImpl = new ContentBroker_Impl( rSMgr, rArguments );
+}
+
+//=========================================================================
+ContentBroker::~ContentBroker()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+Reference< XMultiServiceFactory > ContentBroker::getServiceManager() const
+{
+ return m_pImpl->getServiceManager();
+}
+
+//=========================================================================
+Reference< XContentIdentifierFactory >
+ ContentBroker::getContentIdentifierFactoryInterface() const
+{
+ return m_pImpl->getIdFactory();
+}
+
+//=========================================================================
+Reference< XContentProvider >
+ ContentBroker::getContentProviderInterface() const
+{
+ return m_pImpl->getProvider();
+}
+
+//=========================================================================
+Reference< XContentProviderManager >
+ ContentBroker::getContentProviderManagerInterface() const
+{
+ return m_pImpl->getProviderManager();
+}
+
+//=========================================================================
+// static
+sal_Bool ContentBroker::initialize(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+{
+ vos::OGuard aGuard( vos::OMutex::getGlobalMutex() );
+
+ VOS_ENSURE( !m_pTheBroker,
+ "ContentBroker::create - already created!" );
+
+ if ( !m_pTheBroker )
+ m_pTheBroker = new ContentBroker( rSMgr, rArguments );
+
+ return m_pTheBroker != 0;
+}
+
+//=========================================================================
+// static
+void ContentBroker::deinitialize()
+{
+ vos::OGuard aGuard( vos::OMutex::getGlobalMutex() );
+
+ delete m_pTheBroker;
+ m_pTheBroker = 0;
+}
+
+//=========================================================================
+// static
+ContentBroker* ContentBroker::get()
+{
+ return m_pTheBroker;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ContentBroker_Impl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentBroker_Impl::~ContentBroker_Impl()
+{
+ Reference< XComponent > xComponent( m_xProvider, UNO_QUERY );
+ if ( xComponent.is() ) // must not exist, if init() was never called.
+ {
+ m_xIdFac = 0;
+ m_xProvider = 0;
+ m_xProviderMgr = 0;
+
+ xComponent->dispose();
+ }
+}
+
+//=========================================================================
+void ContentBroker_Impl::init() const
+{
+ const_cast< ContentBroker_Impl * >( this )->init();
+}
+
+//=========================================================================
+void ContentBroker_Impl::init()
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_bInitDone )
+ {
+ m_bInitDone = sal_True;
+
+ Reference< XInterface > xIfc
+ = m_xSMgr->createInstanceWithArguments(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.UniversalContentBroker" ),
+ m_aArguments );
+
+ VOS_ENSURE( xIfc.is(), "Error creating UCB service!" );
+
+ if ( xIfc.is() )
+ {
+ m_xIdFac
+ = Reference< XContentIdentifierFactory >( xIfc, UNO_QUERY );
+
+ VOS_ENSURE( m_xIdFac.is(),
+ "UCB without XContentIdentifierFactory!" );
+
+ m_xProvider
+ = Reference< XContentProvider >( xIfc, UNO_QUERY );
+
+ VOS_ENSURE( m_xProvider.is(),
+ "UCB without XContentProvider!" );
+
+ m_xProviderMgr
+ = Reference< XContentProviderManager >( xIfc, UNO_QUERY );
+
+ VOS_ENSURE( m_xProviderMgr.is(),
+ "UCB without XContentProviderManager!" );
+ }
+ }
+}
+
+} /* namespace ucb */
+
diff --git a/ucbhelper/source/client/makefile.mk b/ucbhelper/source/client/makefile.mk
new file mode 100644
index 000000000000..2b2079e1c44c
--- /dev/null
+++ b/ucbhelper/source/client/makefile.mk
@@ -0,0 +1,91 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME= ucbhelper
+TARGET= client
+AUTOSEG= TRUE
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+SLOFILES=\
+ $(SLO)$/content.obj \
+ $(SLO)$/contentbroker.obj \
+ $(SLO)$/commandenvironment.obj
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/ucbhelper/source/provider/configureucb.cxx b/ucbhelper/source/provider/configureucb.cxx
new file mode 100644
index 000000000000..56f16ebe0e99
--- /dev/null
+++ b/ucbhelper/source/provider/configureucb.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * $RCSfile: configureucb.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONFIGUREUCB_HXX_
+#include <ucbhelper/configureucb.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_CONTENTPROVIDERSERVICEINFO2_HPP_
+#include <com/sun/star/ucb/ContentProviderServiceInfo2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_DUPLICATEPROVIDEREXCEPTION_HPP_
+#include <com/sun/star/ucb/DuplicateProviderException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERCONFIGURATION_HPP_
+#include <com/sun/star/ucb/XContentProviderConfiguration.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERCONFIGURATIONMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderConfigurationManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPARAMETERIZEDCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
+#include <com/sun/star/uno/Exception.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
+#include <com/sun/star/uno/RuntimeException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _UCBHELPER_REGISTERUCB_HXX_
+#include <ucbhelper/registerucb.hxx>
+#endif
+
+using namespace com::sun;
+using namespace com::sun::star;
+
+//============================================================================
+//
+// configureUcb
+//
+//============================================================================
+
+namespace ucb {
+
+bool
+configureUcb(
+ uno::Reference< star::ucb::XContentProviderManager > const & rUcb,
+ uno::Reference< lang::XMultiServiceFactory > const & rFactory,
+ rtl::OUString const & rConfigurationKey)
+ throw (uno::RuntimeException)
+{
+ if (!(rUcb.is() && rFactory.is()))
+ return false;
+
+ uno::Reference< star::ucb::XContentProviderConfigurationManager >
+ xManager;
+ try
+ {
+ xManager
+ = uno::Reference<
+ star::ucb::XContentProviderConfigurationManager >(
+ rFactory->
+ createInstance(rtl::OUString::createFromAscii(
+ "com.sun.star.ucb.Configuration")),
+ uno::UNO_QUERY);
+ }
+ catch (uno::RuntimeException const &) { throw; }
+ catch (uno::Exception const &) {}
+ if (!xManager.is())
+ return false;
+
+ uno::Reference< star::ucb::XContentProviderConfiguration >
+ xConfiguration(xManager->queryContentProviderConfiguration(
+ rConfigurationKey));
+ if (!xConfiguration.is())
+ return false;
+
+ registerAtUcb(rUcb,
+ rFactory,
+ xConfiguration->
+ queryContentProviderServiceInfo(rtl::OUString()),
+ 0);
+ return true;
+}
+
+}
+
+
diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx
new file mode 100644
index 000000000000..3e5e875ddbe6
--- /dev/null
+++ b/ucbhelper/source/provider/contenthelper.cxx
@@ -0,0 +1,1250 @@
+/*************************************************************************
+ *
+ * $RCSfile: contenthelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __HASH_MAP__
+#include <stl/hash_map>
+#endif
+#ifndef _COM_SUN_STAR_UCB_CONTENTACTION_HPP_
+#include <com/sun/star/ucb/ContentAction.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_COMMANDINFOCHANGE_HPP_
+#include <com/sun/star/ucb/CommandInfoChange.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPERSISTENTPROPERTYSET_HPP_
+#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSETINFOCHANGE_HPP_
+#include <com/sun/star/beans/PropertySetInfoChange.hpp>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#include <ucbhelper/providerhelper.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTINFO_HXX
+#include <ucbhelper/contentinfo.hxx>
+#endif
+
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace cppu;
+using namespace rtl;
+using namespace vos;
+using namespace ucb;
+
+namespace ucb_impl
+{
+
+//=========================================================================
+//
+// class PropertyEventSequence.
+//
+//=========================================================================
+
+class PropertyEventSequence
+{
+ Sequence< PropertyChangeEvent > m_aSeq;
+ sal_uInt32 m_nPos;
+
+public:
+ PropertyEventSequence( sal_uInt32 nSize )
+ : m_aSeq( nSize ), m_nPos( 0 ) {};
+
+ void append( const PropertyChangeEvent& rEvt )
+ { m_aSeq.getArray()[ m_nPos ] = rEvt; ++m_nPos; }
+
+ const Sequence< PropertyChangeEvent >& getEvents()
+ { m_aSeq.realloc( m_nPos ); return m_aSeq; }
+};
+
+//=========================================================================
+//
+// PropertiesEventListenerMap.
+//
+//=========================================================================
+
+typedef void* XPropertiesChangeListenerPtr; // -> Compiler problems!
+
+struct equalPtr
+{
+ bool operator()( const XPropertiesChangeListenerPtr& rp1,
+ const XPropertiesChangeListenerPtr& rp2 ) const
+ {
+ return ( rp1 == rp2 );
+ }
+};
+
+struct hashPtr
+{
+ size_t operator()( const XPropertiesChangeListenerPtr& rp ) const
+ {
+ return (size_t)rp;
+ }
+};
+
+typedef std::hash_map
+<
+ XPropertiesChangeListenerPtr,
+ PropertyEventSequence*,
+ hashPtr,
+ equalPtr
+>
+PropertiesEventListenerMap;
+
+//=========================================================================
+//
+// PropertyChangeListenerContainer.
+//
+//=========================================================================
+
+struct equalStr
+{
+ bool operator()( const OUString& s1, const OUString& s2 ) const
+ {
+ return !!( s1 == s2 );
+ }
+};
+
+struct hashStr
+{
+ size_t operator()( const OUString& rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef OMultiTypeInterfaceContainerHelperVar
+<
+ OUString,
+ hashStr,
+ equalStr
+> PropertyChangeListeners;
+
+//=========================================================================
+//
+// struct ContentImplHelper_Impl
+//
+//=========================================================================
+
+struct ContentImplHelper_Impl
+{
+ vos::ORef< PropertySetInfo > m_xPropSetInfo;
+ vos::ORef< CommandProcessorInfo > m_xCommandsInfo;
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ cppu::OInterfaceContainerHelper* m_pContentEventListeners;
+ cppu::OInterfaceContainerHelper* m_pPropSetChangeListeners;
+ cppu::OInterfaceContainerHelper* m_pCommandChangeListeners;
+ PropertyChangeListeners* m_pPropertyChangeListeners;
+
+ ContentImplHelper_Impl()
+ : m_pDisposeEventListeners( 0 ),
+ m_pContentEventListeners( 0 ),
+ m_pPropSetChangeListeners( 0 ),
+ m_pCommandChangeListeners( 0 ),
+ m_pPropertyChangeListeners( 0 ) {}
+
+ ~ContentImplHelper_Impl()
+ {
+ delete m_pDisposeEventListeners;
+ delete m_pContentEventListeners;
+ delete m_pPropSetChangeListeners;
+ delete m_pCommandChangeListeners;
+ delete m_pPropertyChangeListeners;
+ }
+};
+
+} // namespace ucb_impl
+
+using namespace ucb_impl;
+
+//=========================================================================
+//=========================================================================
+//
+// ContentImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentImplHelper::ContentImplHelper(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< ContentProviderImplHelper >& rxProvider,
+ const Reference< XContentIdentifier >& Identifier,
+ sal_Bool bRegisterAtProvider )
+: m_pImpl( new ContentImplHelper_Impl ),
+ m_xSMgr( rxSMgr ),
+ m_xProvider( rxProvider ),
+ m_xIdentifier( Identifier ),
+ m_nCommandId( 0 )
+{
+ if ( bRegisterAtProvider )
+ m_xProvider->addContent( this );
+}
+
+//=========================================================================
+// virtual
+ContentImplHelper::~ContentImplHelper()
+{
+ m_xProvider->removeContent( this );
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_10( ContentImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent,
+ XContent,
+ XCommandProcessor,
+ XPropertiesChangeNotifier,
+ XCommandInfoChangeNotifier,
+ XPropertyContainer,
+ XPropertySetInfoChangeNotifier,
+ XChild );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_10( ContentImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent,
+ XContent,
+ XCommandProcessor,
+ XPropertiesChangeNotifier,
+ XCommandInfoChangeNotifier,
+ XPropertyContainer,
+ XPropertySetInfoChangeNotifier,
+ XChild );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+// virtual
+OUString SAL_CALL ContentImplHelper::getImplementationName()
+ throw( RuntimeException )
+{
+}
+
+//=========================================================================
+// virtual
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ContentImplHelper::getSupportedServiceNames()
+ throw( RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ContentImplHelper::supportsService(
+ const OUString& ServiceName )
+ throw( RuntimeException )
+{
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString* pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::dispose()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners &&
+ m_pImpl->m_pDisposeEventListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XComponent * >( this );
+ m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pContentEventListeners &&
+ m_pImpl->m_pContentEventListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XContent * >( this );
+ m_pImpl->m_pContentEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XPropertySetInfoChangeNotifier * >( this );
+ m_pImpl->m_pPropSetChangeListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pCommandChangeListeners &&
+ m_pImpl->m_pCommandChangeListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XCommandInfoChangeNotifier * >( this );
+ m_pImpl->m_pCommandChangeListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XPropertiesChangeNotifier * >( this );
+ m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::addEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners
+ = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XContent methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XContentIdentifier > SAL_CALL ContentImplHelper::getIdentifier()
+ throw( RuntimeException )
+{
+ return m_xIdentifier;
+}
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ContentImplHelper::getContentType()
+ throw( RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::addContentEventListener(
+ const Reference< XContentEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pContentEventListeners )
+ m_pImpl->m_pContentEventListeners
+ = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pContentEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeContentEventListener(
+ const Reference< XContentEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pContentEventListeners )
+ m_pImpl->m_pContentEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XCommandProcessor methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL ContentImplHelper::createCommandIdentifier()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ // Just increase counter on every call to generate an identifier.
+ return ++m_nCommandId;
+}
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+//=========================================================================
+// virtual
+Any SAL_CALL ContentImplHelper::execute( const Command& aCommand,
+ sal_Int32 CommandId,
+ const Reference<
+ XCommandEnvironment >& Environment )
+ throw( Exception, CommandAbortedException, RuntimeException )
+{
+ if ( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ Sequence< Property > Properties;
+ if ( !( aCommand.Argument >>= Properties ) )
+ {
+ VOS_ENSURE( sal_False, "Wrong argument type!" )
+ return Any();
+ }
+
+ // Note: GET + empty sequence means "get all property values".
+ }
+ else if ( aCommand.Name.compareToAscii( "setPropertyValues" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // setPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ Sequence< PropertyValue > Properties;
+ if ( !( aCommand.Argument >>= Properties ) )
+ {
+ VOS_ENSURE( sal_False, "Wrong argument type!" )
+ return Any();
+ }
+
+ if ( !Properties.getLength() )
+ {
+ VOS_ENSURE( sal_False, "No properties!" )
+ return Any();
+ }
+ }
+ else if ( aCommand.Name.compareToAscii( "getPropertySetInfo" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertySetInfo
+ //////////////////////////////////////////////////////////////////
+
+ aRet <<= getPropertySetInfo();
+ }
+ else if ( aCommand.Name.compareToAscii( "getCommandInfo" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getCommandInfo
+ //////////////////////////////////////////////////////////////////
+
+ aRet <<= getCommandInfo();
+ }
+ else if ( ( aCommand.Name.compareToAscii( "open" ) == 0 ) &&
+ ( open_command_arg contains no data sink ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // open command for a folder content
+ //////////////////////////////////////////////////////////////////
+
+ Reference< XDynamicResultSet > xSet
+ = new DynamicResultSet( m_xSMgr, this, aCommand, Environment );
+ aRet <<= xSet;
+ }
+ else if ( aCommand.Name.compareToAscii( "search" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // search command
+ //////////////////////////////////////////////////////////////////
+
+ Reference< XDynamicResultSet > xSet
+ = new DynamicResultSet( m_xSMgr, this, aCommand, Environment );
+ aRet <<= xSet;
+ }
+ else
+ {
+ //////////////////////////////////////////////////////////////////
+ // any other command
+ //////////////////////////////////////////////////////////////////
+
+ // Check the command...
+ if ( !aCommand.Name.getLength() && ( aCommand.Handle == -1 ) )
+ {
+ VOS_ENSURE( sal_False, "No command!" )
+ return Any();
+ }
+
+ }
+
+ return aRet;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::abort( sal_Int32 CommandId )
+ throw( RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+//
+// XPropertiesChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addPropertiesChangeListener(
+ const Sequence< OUString >& PropertyNames,
+ const Reference< XPropertiesChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners
+ = new PropertyChangeListeners( m_aMutex );
+
+ sal_Int32 nCount = PropertyNames.getLength();
+ if ( !nCount )
+ {
+ // Note: An empty sequence means a listener for "all" properties.
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ OUString(), Listener );
+ }
+ else
+ {
+ const OUString* pSeq = PropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rName = pSeq[ n ];
+ if ( rName.getLength() )
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ rName, Listener );
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removePropertiesChangeListener(
+ const Sequence< OUString >& PropertyNames,
+ const Reference< XPropertiesChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ sal_Int32 nCount = PropertyNames.getLength();
+ if ( !nCount )
+ {
+ // Note: An empty sequence means a listener for "all" properties.
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ OUString(), Listener );
+ }
+ else
+ {
+ const OUString* pSeq = PropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rName = pSeq[ n ];
+ if ( rName.getLength() )
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ rName, Listener );
+ }
+ }
+}
+
+//=========================================================================
+//
+// XCommandInfoChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addCommandInfoChangeListener(
+ const Reference< XCommandInfoChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pCommandChangeListeners )
+ m_pImpl->m_pCommandChangeListeners
+ = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pCommandChangeListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeCommandInfoChangeListener(
+ const Reference< XCommandInfoChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pCommandChangeListeners )
+ m_pImpl->m_pCommandChangeListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XPropertyContainer methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addProperty(
+ const OUString& Name, sal_Int16 Attributes, const Any& DefaultValue )
+ throw( PropertyExistException,
+ IllegalTypeException,
+ IllegalArgumentException,
+ RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ //////////////////////////////////////////////////////////////////////
+ // Make sure a property with the requested name does not already
+ // exist in dynamic and static(!) properties.
+ //////////////////////////////////////////////////////////////////////
+
+ if ( getPropertySetInfo()->hasPropertyByName( Name ) )
+ {
+ // Property does already exist.
+ throw PropertyExistException();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Add a new dynamic property.
+ //////////////////////////////////////////////////////////////////////
+
+ // Open/create persistent property set.
+ Reference< XPersistentPropertySet > xSet(
+ getAdditionalPropertySet( sal_True ) );
+
+ VOS_ENSURE( xSet.is(), "ContentImplHelper::addProperty - No property set!" );
+
+ if ( xSet.is() )
+ {
+ Reference< XPropertyContainer > xContainer( xSet, UNO_QUERY );
+
+ VOS_ENSURE( xContainer.is(),
+ "ContentImplHelper::addProperty - No property container!" );
+
+ if ( xContainer.is() )
+ {
+ // Property is always removeable.
+ Attributes |= PropertyAttribute::REMOVEABLE;
+
+ try
+ {
+ xContainer->addProperty( Name, Attributes, DefaultValue );
+ }
+ catch ( PropertyExistException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Exists!" );
+ throw e;
+ }
+ catch ( IllegalTypeException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Wrong Type!" );
+ throw e;
+ }
+ catch ( IllegalArgumentException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Illegal Arg!" );
+ throw e;
+ }
+
+ // Success!
+
+ if ( m_pImpl->m_xPropSetInfo.isValid() )
+ {
+ // Info cached in propertyset info is invalid now!
+ m_pImpl->m_xPropSetInfo->reset();
+ }
+
+ // Notify propertyset info change listeners.
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ PropertySetInfoChangeEvent evt(
+ static_cast< OWeakObject * >( this ),
+ Name,
+ -1, // No handle available
+ PropertySetInfoChange::PROPERTY_INSERTED );
+ notifyPropertySetInfoChange( evt );
+ }
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeProperty( const OUString& Name )
+ throw( UnknownPropertyException,
+ NotRemoveableException,
+ RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ try
+ {
+ Property aProp = getPropertySetInfo()->getPropertyByName( Name );
+
+ if ( !( aProp.Attributes & PropertyAttribute::REMOVEABLE ) )
+ {
+ // Not removeable!
+ throw NotRemoveableException();
+ }
+ }
+ catch ( UnknownPropertyException& e )
+ {
+ VOS_ENSURE( sal_False, "ContentImplHelper::removeProperty - Unknown!" );
+ throw e;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Try to remove property from dynamic property set.
+ //////////////////////////////////////////////////////////////////////
+
+ // Open persistent property set, if exists.
+ Reference< XPersistentPropertySet > xSet(
+ getAdditionalPropertySet( sal_False ) );
+ if ( xSet.is() )
+ {
+ Reference< XPropertyContainer > xContainer( xSet, UNO_QUERY );
+
+ VOS_ENSURE( xContainer.is(),
+ "ContentImplHelper::removeProperty - No property container!" );
+
+ if ( xContainer.is() )
+ {
+ try
+ {
+ xContainer->removeProperty( Name );
+ }
+ catch ( UnknownPropertyException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::removeProperty - Unknown!" );
+ throw e;
+ }
+ catch ( NotRemoveableException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::removeProperty - Unremoveable!" );
+ throw e;
+ }
+
+ xContainer = 0;
+
+ // Success!
+
+ if ( xSet->getPropertySetInfo()->getProperties().getLength() == 0 )
+ {
+ // Remove empty propertyset from registry.
+ Reference< XPropertySetRegistry > xReg = xSet->getRegistry();
+ if ( xReg.is() )
+ {
+ OUString aKey( xSet->getKey() );
+ xSet = 0;
+ xReg->removePropertySet( aKey );
+ }
+ }
+
+ if ( m_pImpl->m_xPropSetInfo.isValid() )
+ {
+ // Info cached in propertyset info is invalid now!
+ m_pImpl->m_xPropSetInfo->reset();
+ }
+
+ // Notify propertyset info change listeners.
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ PropertySetInfoChangeEvent evt(
+ static_cast< OWeakObject * >( this ),
+ Name,
+ -1, // No handle available
+ PropertySetInfoChange::PROPERTY_REMOVED );
+ notifyPropertySetInfoChange( evt );
+ }
+ }
+ }
+}
+
+//=========================================================================
+//
+// XPropertySetInfoChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addPropertySetInfoChangeListener(
+ const Reference< XPropertySetInfoChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropSetChangeListeners )
+ m_pImpl->m_pPropSetChangeListeners
+ = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pPropSetChangeListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removePropertySetInfoChangeListener(
+ const Reference< XPropertySetInfoChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pPropSetChangeListeners )
+ m_pImpl->m_pPropSetChangeListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XChild methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XInterface > SAL_CALL ContentImplHelper::getParent()
+ throw( RuntimeException )
+{
+ OUString aURL = getParentURL();
+
+ if ( aURL.getLength() )
+ {
+ Reference< XContentIdentifier > xId(
+ new ::ucb::ContentIdentifier( m_xSMgr, aURL ) );
+ return m_xProvider->queryContent( xId );
+ }
+
+ return Reference< XInterface >();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::setParent(
+ const Reference< XInterface >& Parent )
+ throw( NoSupportException, RuntimeException )
+{
+ throw NoSupportException();
+}
+
+//=========================================================================
+//
+// Non-interface methods
+//
+//=========================================================================
+
+Reference< XPersistentPropertySet >
+ ContentImplHelper::getAdditionalPropertySet( sal_Bool bCreate )
+{
+ // Get propertyset from provider.
+ return m_xProvider->getAdditionalPropertySet(
+ m_xIdentifier->getContentIdentifier(), bCreate );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::renameAdditionalPropertySet(
+ const OUString& rOldKey,
+ const OUString& rNewKey,
+ sal_Bool bRecursive )
+{
+ return m_xProvider->renameAdditionalPropertySet(
+ rOldKey, rNewKey, bRecursive );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::removeAdditionalPropertySet( sal_Bool bRecursive )
+{
+ return m_xProvider->removeAdditionalPropertySet(
+ m_xIdentifier->getContentIdentifier(), bRecursive );
+}
+
+//=========================================================================
+void ContentImplHelper::notifyPropertiesChange(
+ const Sequence< PropertyChangeEvent >& evt ) const
+{
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ sal_Int32 nCount = evt.getLength();
+ if ( nCount )
+ {
+ // First, notify listeners interested in changes of every property.
+ OInterfaceContainerHelper* pAllPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer( OUString() );
+ if ( pAllPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pAllPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ Reference< XPropertiesChangeListener > xListener(
+ aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertiesChange( evt );
+ }
+ }
+
+ PropertiesEventListenerMap aListeners;
+
+ const PropertyChangeEvent* pEvents = evt.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const PropertyChangeEvent& rEvent = pEvents[ n ];
+ const OUString& rName = rEvent.PropertyName;
+
+ OInterfaceContainerHelper* pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer( rName );
+ if ( pPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ PropertyEventSequence* pEvents = NULL;
+
+ XPropertiesChangeListener* pListener =
+ static_cast< XPropertiesChangeListener * >(
+ aIter.next() );
+ PropertiesEventListenerMap::iterator it =
+ aListeners.find( pListener );
+ if ( it == aListeners.end() )
+ {
+ // Not in map - create and insert new entry.
+ pEvents = new PropertyEventSequence( nCount );
+ aListeners[ pListener ] = pEvents;
+ }
+ else
+ pEvents = (*it).second;
+
+ if ( pEvents )
+ pEvents->append( rEvent );
+ }
+ }
+ }
+
+ // Notify listeners.
+ PropertiesEventListenerMap::iterator it = aListeners.begin();
+ while ( !aListeners.empty() )
+ {
+ XPropertiesChangeListener* pListener =
+ static_cast< XPropertiesChangeListener * >( (*it).first );
+ PropertyEventSequence* pSeq = (*it).second;
+
+ // Remove current element.
+ aListeners.erase( it );
+
+ // Propagate event.
+ pListener->propertiesChange( pSeq->getEvents() );
+
+ delete pSeq;
+
+ it = aListeners.begin();
+ }
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyPropertySetInfoChange(
+ const PropertySetInfoChangeEvent& evt ) const
+{
+ if ( !m_pImpl->m_pPropSetChangeListeners )
+ return;
+
+ // Notify event listeners.
+ OInterfaceIteratorHelper aIter( *m_pImpl->m_pPropSetChangeListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ Reference< XPropertySetInfoChangeListener >
+ xListener( aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertySetInfoChange( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyCommandInfoChange(
+ const CommandInfoChangeEvent& evt ) const
+{
+ if ( !m_pImpl->m_pCommandChangeListeners )
+ return;
+
+ // Notify event listeners.
+ OInterfaceIteratorHelper aIter( *m_pImpl->m_pCommandChangeListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ Reference< XCommandInfoChangeListener >
+ xListener( aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->commandInfoChange( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyContentEvent( const ContentEvent& evt ) const
+{
+ if ( !m_pImpl->m_pContentEventListeners )
+ return;
+
+ // Notify event listeners.
+ OInterfaceIteratorHelper aIter( *m_pImpl->m_pContentEventListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ Reference< XContentEventListener > xListener( aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->contentEvent( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::inserted()
+{
+ // Content is not yet registered at provider.
+ m_xProvider->addContent( this );
+
+ // If the parent content is currently not instanciated, there can be
+ // no listeners interested in changes ;-)
+
+ vos::ORef< ContentImplHelper > xParent
+ = m_xProvider->queryExistingContent( getParentURL() );
+
+ if ( xParent.isValid() )
+ {
+ ContentEvent aEvt( static_cast< OWeakObject * >(
+ xParent.getBodyPtr() ), // Source
+ ContentAction::INSERTED, // Action
+ this, // Content
+ xParent->getIdentifier() ); // Id
+ xParent->notifyContentEvent( aEvt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::deleted()
+{
+ Reference< XContent > xThis = this;
+
+ vos::ORef< ContentImplHelper > xParent
+ = m_xProvider->queryExistingContent( getParentURL() );
+
+ if ( xParent.isValid() )
+ {
+ // Let parent notify "REMOVED" event.
+ ContentEvent aEvt( static_cast< OWeakObject * >( xParent.getBodyPtr() ),
+ ContentAction::REMOVED,
+ this,
+ xParent->getIdentifier() );
+ xParent->notifyContentEvent( aEvt );
+ }
+
+ // Notify "DELETED" event.
+ ContentEvent aEvt1( static_cast< OWeakObject * >( this ),
+ ContentAction::DELETED,
+ this,
+ getIdentifier() );
+ notifyContentEvent( aEvt1 );
+
+ m_xProvider->removeContent( this );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::exchange(
+ const Reference< XContentIdentifier >& rNewId )
+{
+ Reference< XContent > xThis = this;
+
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ vos::ORef< ContentImplHelper > xContent
+ = m_xProvider->queryExistingContent( rNewId );
+ if ( xContent.isValid() )
+ {
+ // @@@
+ // Big trouble. Another object with the new identity exists.
+ // How shall I mutate to / merge with the other object?
+ return sal_False;
+ }
+
+ Reference< XContentIdentifier > xOldId = getIdentifier();
+
+ // Re-insert at provider.
+ m_xProvider->removeContent( this );
+ m_xIdentifier = rNewId;
+ m_xProvider->addContent( this );
+
+ aGuard.clear();
+
+ // Notify "EXCHANGED" event.
+ ContentEvent aEvt( static_cast< OWeakObject * >( this ),
+ ContentAction::EXCHANGED,
+ this,
+ xOldId );
+ notifyContentEvent( aEvt );
+ return sal_True;
+}
+
+//=========================================================================
+Reference< XCommandInfo > ContentImplHelper::getCommandInfo()
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xCommandsInfo.isValid() )
+ m_pImpl->m_xCommandsInfo = new CommandProcessorInfo( m_xSMgr, this );
+
+ return Reference< XCommandInfo >( m_pImpl->m_xCommandsInfo.getBodyPtr() );
+}
+
+//=========================================================================
+Reference< XPropertySetInfo > ContentImplHelper::getPropertySetInfo()
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xPropSetInfo.isValid() )
+ m_pImpl->m_xPropSetInfo = new PropertySetInfo( m_xSMgr, this );
+
+ return Reference< XPropertySetInfo >(
+ m_pImpl->m_xPropSetInfo.getBodyPtr() );
+}
+
diff --git a/ucbhelper/source/provider/contentidentifier.cxx b/ucbhelper/source/provider/contentidentifier.cxx
new file mode 100644
index 000000000000..115c44414960
--- /dev/null
+++ b/ucbhelper/source/provider/contentidentifier.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentidentifier.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+
+namespace ucb
+{
+
+//=========================================================================
+//=========================================================================
+//
+// struct ContentIdentifier_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+struct ContentIdentifier_Impl
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ OUString m_aContentId;
+ OUString m_aProviderScheme;
+ osl::Mutex m_aMutex;
+
+ ContentIdentifier_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const OUString& rURL );
+};
+
+//=========================================================================
+//
+// ContentIdentifier_Impl Implementation.
+//
+//=========================================================================
+
+ContentIdentifier_Impl::ContentIdentifier_Impl(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const OUString& rURL )
+: m_xSMgr( rSMgr )
+{
+ // Normalize URL scheme ( it's case insensitive ).
+
+ // The content provider scheme is the part before the first ':'
+ // within the content id.
+ sal_Int32 nPos = rURL.indexOf( ':', 0 );
+ if ( nPos != -1 )
+ {
+ OUString aScheme( rURL.copy( 0, nPos ) );
+ m_aProviderScheme = aScheme.toLowerCase();
+ m_aContentId = rURL.replaceAt( 0, nPos, aScheme );
+ }
+}
+
+//=========================================================================
+//
+// ContentIdentifier Implementation.
+//
+//=========================================================================
+
+ContentIdentifier::ContentIdentifier(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const OUString& rURL )
+{
+ m_pImpl = new ContentIdentifier_Impl( rxSMgr, rURL );
+}
+
+//=========================================================================
+ContentIdentifier::ContentIdentifier( const OUString& rURL )
+{
+ m_pImpl = new ContentIdentifier_Impl(
+ Reference< XMultiServiceFactory >(), rURL );
+}
+
+//=========================================================================
+// virtual
+ContentIdentifier::~ContentIdentifier()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentIdentifier::acquire()
+ throw( RuntimeException )
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentIdentifier::release()
+ throw( RuntimeException )
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL
+ContentIdentifier::queryInterface( const Type & rType )
+ throw ( RuntimeException )
+{
+ Any aRet = cppu::queryInterface( rType,
+ static_cast< XTypeProvider * >( this ),
+ static_cast< XContentIdentifier * >( this ) );
+
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< sal_Int8 > SAL_CALL
+ContentIdentifier::getImplementationId()
+ throw( RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+Sequence< com::sun::star::uno::Type > SAL_CALL
+ContentIdentifier::getTypes()
+ throw( RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = NULL;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ Reference < XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ Reference< XContentIdentifier > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XContentIdentifier methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL ContentIdentifier::getContentIdentifier()
+ throw( RuntimeException )
+{
+ return m_pImpl->m_aContentId;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ContentIdentifier::getContentProviderScheme()
+ throw( RuntimeException )
+{
+ return m_pImpl->m_aProviderScheme;
+}
+
+} /* namespace ucb */
+
diff --git a/ucbhelper/source/provider/contentinfo.cxx b/ucbhelper/source/provider/contentinfo.cxx
new file mode 100644
index 000000000000..588eabbf6e22
--- /dev/null
+++ b/ucbhelper/source/provider/contentinfo.cxx
@@ -0,0 +1,475 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentinfo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPROPERTYSETREGISTRY_HPP_
+#include <com/sun/star/ucb/XPropertySetRegistry.hpp>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTINFO_HXX
+#include <ucbhelper/contentinfo.hxx>
+#endif
+
+using namespace rtl;
+using namespace vos;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::ucb;
+using namespace ucb;
+
+//=========================================================================
+//=========================================================================
+//
+// PropertySetInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+PropertySetInfo::PropertySetInfo(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ ContentImplHelper* pContent )
+: m_xSMgr( rxSMgr ),
+ m_pProps( 0 ),
+ m_pContent( pContent )
+{
+}
+
+//=========================================================================
+// virtual
+PropertySetInfo::~PropertySetInfo()
+{
+ delete m_pProps;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( PropertySetInfo,
+ XTypeProvider,
+ XPropertySetInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( PropertySetInfo,
+ XTypeProvider,
+ XPropertySetInfo );
+
+//=========================================================================
+//
+// XPropertySetInfo methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< Property > SAL_CALL PropertySetInfo::getProperties()
+ throw( RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_pProps )
+ {
+ m_pProps = new Sequence< Property >( 128 );
+ Property* pProps = m_pProps->getArray();
+ sal_Int32 nPos = 0;
+ sal_Int32 nSize = m_pProps->getLength();
+
+ //////////////////////////////////////////////////////////////////
+ // Get info for core ( native) properties.
+ //////////////////////////////////////////////////////////////////
+
+ const ::ucb::PropertyInfoTableEntry& rCoreProps
+ = m_pContent->getPropertyInfoTable();
+ const ::ucb::PropertyInfoTableEntry* pCurr = &rCoreProps;
+ while ( pCurr->pName )
+ {
+ if ( nSize <= nPos )
+ {
+ m_pProps->realloc( 128 );
+ nSize += 128;
+ }
+
+ Property& rProp = pProps[ nPos ];
+
+ VOS_ENSURE( pCurr->pType,
+ "PropertySetInfo::getProperties - No type!" );
+
+ rProp.Name = OUString::createFromAscii( pCurr->pName );
+ rProp.Handle = pCurr->nHandle;
+ rProp.Type = *pCurr->pType;
+ rProp.Attributes = pCurr->nAttributes;
+
+ nPos++;
+ pCurr++;
+ }
+
+ if ( nPos > 0 )
+ {
+ m_pProps->realloc( nPos );
+ nSize = m_pProps->getLength();
+ }
+
+ //////////////////////////////////////////////////////////////////
+ // Get info for additional properties.
+ //////////////////////////////////////////////////////////////////
+
+ Reference< XPersistentPropertySet > xSet (
+ m_pContent->getAdditionalPropertySet( sal_False ) );
+
+ if ( xSet.is() )
+ {
+ // Get property set info.
+ Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
+ if ( xInfo.is() )
+ {
+ const Sequence< Property >& rAddProps = xInfo->getProperties();
+ sal_Int32 nAddProps = rAddProps.getLength();
+ if ( nAddProps > 0 )
+ {
+ m_pProps->realloc( nSize + nAddProps );
+ pProps = m_pProps->getArray();
+
+ const Property* pAddProps = rAddProps.getConstArray();
+ for ( sal_Int32 n = 0; n < nAddProps; ++n, ++nPos )
+ pProps[ nPos ] = pAddProps[ n ];
+ }
+ }
+ }
+ }
+ return *m_pProps;
+}
+
+//=========================================================================
+// virtual
+Property SAL_CALL PropertySetInfo::getPropertyByName( const OUString& aName )
+ throw( UnknownPropertyException, RuntimeException )
+{
+ Property aProp;
+ if ( queryProperty( aName, aProp ) )
+ return aProp;
+
+ throw UnknownPropertyException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName( const OUString& Name )
+ throw( RuntimeException )
+{
+ Property aProp;
+ return queryProperty( Name, aProp );
+}
+
+//=========================================================================
+//
+// Non-Interface methods.
+//
+//=========================================================================
+
+void PropertySetInfo::reset()
+{
+ vos::OGuard aGuard( m_aMutex );
+ delete m_pProps;
+ m_pProps = 0;
+}
+
+//=========================================================================
+sal_Bool PropertySetInfo::queryProperty(
+ const OUString& rName, Property& rProp )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ getProperties();
+
+ const Property* pProps = m_pProps->getConstArray();
+ sal_Int32 nCount = m_pProps->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const Property& rCurrProp = pProps[ n ];
+ if ( rCurrProp.Name == rName )
+ {
+ rProp = rCurrProp;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// CommandProcessorInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+CommandProcessorInfo::CommandProcessorInfo(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ ContentImplHelper* pContent )
+: m_xSMgr( rxSMgr ),
+ m_pCommands( 0 ),
+ m_pContent( pContent )
+{
+}
+
+//=========================================================================
+// virtual
+CommandProcessorInfo::~CommandProcessorInfo()
+{
+ delete m_pCommands;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( CommandProcessorInfo,
+ XTypeProvider,
+ XCommandInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( CommandProcessorInfo,
+ XTypeProvider,
+ XCommandInfo );
+
+//=========================================================================
+//
+// XCommandInfo methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< CommandInfo > SAL_CALL CommandProcessorInfo::getCommands()
+ throw( RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_pCommands )
+ {
+ m_pCommands = new Sequence< CommandInfo >( 128 );
+ CommandInfo* pCommands = m_pCommands->getArray();
+ sal_Int32 nPos = 0;
+ sal_Int32 nSize = m_pCommands->getLength();
+
+ //////////////////////////////////////////////////////////////////
+ // Get info for commands.
+ //////////////////////////////////////////////////////////////////
+
+ const ::ucb::CommandInfoTableEntry& rCommands
+ = m_pContent->getCommandInfoTable();
+ const ::ucb::CommandInfoTableEntry* pCurr = &rCommands;
+ while ( pCurr->pName )
+ {
+ if ( nSize <= nPos )
+ {
+ m_pCommands->realloc( 128 );
+ nSize += 128;
+ }
+
+ CommandInfo& rCommand = pCommands[ nPos ];
+
+ rCommand.Name = OUString::createFromAscii( pCurr->pName );
+ rCommand.Handle = pCurr->nHandle;
+ if ( pCurr->pArgType )
+ rCommand.ArgType = *pCurr->pArgType;
+
+ nPos++;
+ pCurr++;
+ }
+
+ if ( nPos > 0 )
+ m_pCommands->realloc( nPos );
+ }
+ return *m_pCommands;
+}
+
+//=========================================================================
+// virtual
+CommandInfo SAL_CALL CommandProcessorInfo::getCommandInfoByName(
+ const OUString& Name )
+ throw( UnsupportedCommandException, RuntimeException )
+{
+ CommandInfo aInfo;
+ if ( queryCommand( Name, aInfo ) )
+ return aInfo;
+
+ throw UnsupportedCommandException();
+}
+
+//=========================================================================
+// virtual
+CommandInfo SAL_CALL CommandProcessorInfo::getCommandInfoByHandle(
+ sal_Int32 Handle )
+ throw( UnsupportedCommandException, RuntimeException )
+{
+ CommandInfo aInfo;
+ if ( queryCommand( Handle, aInfo ) )
+ return aInfo;
+
+ throw UnsupportedCommandException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByName( const OUString& Name )
+ throw( RuntimeException )
+{
+ CommandInfo aInfo;
+ return queryCommand( Name, aInfo );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle )
+ throw( RuntimeException )
+{
+ CommandInfo aInfo;
+ return queryCommand( Handle, aInfo );
+}
+
+//=========================================================================
+//
+// Non-Interface methods.
+//
+//=========================================================================
+
+void CommandProcessorInfo::reset()
+{
+ vos::OGuard aGuard( m_aMutex );
+ delete m_pCommands;
+ m_pCommands = 0;
+}
+
+
+//=========================================================================
+sal_Bool CommandProcessorInfo::queryCommand( const OUString& rName,
+ CommandInfo& rCommand )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ getCommands();
+
+ const CommandInfo* pCommands = m_pCommands->getConstArray();
+ sal_Int32 nCount = m_pCommands->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const CommandInfo& rCurrCommand = pCommands[ n ];
+ if ( rCurrCommand.Name == rName )
+ {
+ rCommand = rCurrCommand;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+sal_Bool CommandProcessorInfo::queryCommand( sal_Int32 nHandle,
+ CommandInfo& rCommand )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ getCommands();
+
+ const CommandInfo* pCommands = m_pCommands->getConstArray();
+ sal_Int32 nCount = m_pCommands->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const CommandInfo& rCurrCommand = pCommands[ n ];
+ if ( rCurrCommand.Handle == nHandle )
+ {
+ rCommand = rCurrCommand;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
diff --git a/ucbhelper/source/provider/makefile.mk b/ucbhelper/source/provider/makefile.mk
new file mode 100644
index 000000000000..2f76091e63a1
--- /dev/null
+++ b/ucbhelper/source/provider/makefile.mk
@@ -0,0 +1,98 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME= ucbhelper
+TARGET= provider
+AUTOSEG= TRUE
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+SLOFILES=\
+ $(SLO)$/configureucb.obj \
+ $(SLO)$/contentidentifier.obj \
+ $(SLO)$/providerhelper.obj \
+ $(SLO)$/contenthelper.obj \
+ $(SLO)$/contentinfo.obj \
+ $(SLO)$/propertyvalueset.obj \
+ $(SLO)$/registerucb.obj \
+ $(SLO)$/resultsetmetadata.obj \
+ $(SLO)$/resultset.obj \
+ $(SLO)$/resultsethelper.obj
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx
new file mode 100644
index 000000000000..db4bdf68f48b
--- /dev/null
+++ b/ucbhelper/source/provider/propertyvalueset.cxx
@@ -0,0 +1,925 @@
+/*************************************************************************
+ *
+ * $RCSfile: propertyvalueset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __VECTOR__
+#include <stl/vector>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_
+#include <com/sun/star/script/XTypeConverter.hpp>
+#endif
+
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+
+#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
+#include <ucbhelper/propertyvalueset.hxx>
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::script;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace rtl;
+using namespace ucb;
+
+namespace ucb_impl
+{
+
+//=========================================================================
+//
+// PropertyValue.
+//
+//=========================================================================
+
+const sal_uInt32 NO_VALUE_SET = 0x00000000;
+const sal_uInt32 STRING_VALUE_SET = 0x00000001;
+const sal_uInt32 BOOLEAN_VALUE_SET = 0x00000002;
+const sal_uInt32 BYTE_VALUE_SET = 0x00000004;
+const sal_uInt32 SHORT_VALUE_SET = 0x00000008;
+const sal_uInt32 INT_VALUE_SET = 0x00000010;
+const sal_uInt32 LONG_VALUE_SET = 0x00000020;
+const sal_uInt32 FLOAT_VALUE_SET = 0x00000040;
+const sal_uInt32 DOUBLE_VALUE_SET = 0x00000080;
+const sal_uInt32 BYTES_VALUE_SET = 0x00000100;
+const sal_uInt32 DATE_VALUE_SET = 0x00000200;
+const sal_uInt32 TIME_VALUE_SET = 0x00000400;
+const sal_uInt32 TIMESTAMP_VALUE_SET = 0x00000800;
+const sal_uInt32 BINARYSTREAM_VALUE_SET = 0x00001000;
+const sal_uInt32 CHARACTERSTREAM_VALUE_SET = 0x00002000;
+const sal_uInt32 REF_VALUE_SET = 0x00004000;
+const sal_uInt32 BLOB_VALUE_SET = 0x00008000;
+const sal_uInt32 CLOB_VALUE_SET = 0x00010000;
+const sal_uInt32 ARRAY_VALUE_SET = 0x00020000;
+const sal_uInt32 OBJECT_VALUE_SET = 0x00040000;
+
+struct PropertyValue
+{
+ Property aProperty;
+
+ sal_uInt32 nPropsSet;
+ sal_uInt32 nOrigValue;
+
+ OUString aString; // getString
+ sal_Bool bBoolean; // getBoolean
+ sal_Int8 nByte; // getByte
+ sal_Int16 nShort; // getShort
+ sal_Int32 nInt; // getInt
+ sal_Int64 nLong; // getLong
+ float nFloat; // getFloat
+ double nDouble; // getDouble
+
+ Sequence< sal_Int8 > aBytes; // getBytes
+ Date aDate; // getDate
+ Time aTime; // getTime
+ DateTime aTimestamp; // getTimestamp
+ Reference< XInputStream > xBinaryStream; // getBinaryStream
+ Reference< XInputStream > xCharacterStream; // getCharacterStream
+ Reference< XRef > xRef; // getRef
+ Reference< XBlob > xBlob; // getBlob
+ Reference< XClob > xClob; // getClob
+ Reference< XArray > xArray; // getArray
+ Any aObject; // getObject
+
+ inline PropertyValue()
+ : nPropsSet( NO_VALUE_SET ), nOrigValue( NO_VALUE_SET ) {}
+};
+
+} // namespace ucb_impl
+
+using namespace ucb_impl;
+
+namespace ucb
+{
+
+//=========================================================================
+//
+// class PropertyValues.
+//
+//=========================================================================
+
+typedef std::vector< ucb_impl::PropertyValue > PropertyValuesVector;
+
+class PropertyValues : public PropertyValuesVector {};
+
+} // namespace ucb
+
+//=========================================================================
+//
+// Welcome to the macro hell...
+//
+//=========================================================================
+
+#define GETVALUE_IMPL_TYPE( _type_, _type_name_, _member_name_, _cppu_type_ ) \
+ \
+ vos::OGuard aGuard( m_aMutex ); \
+ \
+ _type_ aValue = _type_(); /* default ctor */ \
+ \
+ m_bWasNull = sal_True; \
+ \
+ if ( ( columnIndex < 1 ) || ( columnIndex > m_pValues->size() ) ) \
+ { \
+ VOS_ENSURE( sal_False, "PropertyValueSet - index out of range!" ); \
+ } \
+ else \
+ { \
+ ucb_impl::PropertyValue& rValue = (*m_pValues)[ columnIndex - 1 ]; \
+ \
+ if ( rValue.nOrigValue != NO_VALUE_SET ) \
+ { \
+ if ( rValue.nPropsSet & _type_name_ ) \
+ { \
+ /* Values is present natively... */ \
+ aValue = rValue._member_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ else \
+ { \
+ if ( !(rValue.nPropsSet & OBJECT_VALUE_SET) ) \
+ { \
+ /* Value is not (yet) available as Any. Create it. */ \
+ getObject( columnIndex, Reference< XNameAccess >() ); \
+ } \
+ \
+ if ( rValue.nPropsSet & OBJECT_VALUE_SET ) \
+ { \
+ /* Value is available as Any. */ \
+ \
+ /* Try to convert into native value. */ \
+ if ( rValue.aObject >>= aValue ) \
+ { \
+ rValue._member_name_ = aValue; \
+ rValue.nPropsSet |= _type_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ else \
+ { \
+ /* Last chance. Try type converter service... */ \
+ \
+ Reference< XTypeConverter > xConverter \
+ = getTypeConverter(); \
+ if ( xConverter.is() ) \
+ { \
+ try \
+ { \
+ Any aConvAny = xConverter->convertTo( \
+ rValue.aObject, \
+ _cppu_type_ ); \
+ \
+ if ( aConvAny >>= aValue ) \
+ { \
+ rValue._member_name_ = aValue; \
+ rValue.nPropsSet |= _type_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ } \
+ catch ( IllegalArgumentException ) \
+ { \
+ } \
+ catch ( CannotConvertException ) \
+ { \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } \
+ return aValue;
+
+#define GETVALUE_IMPL( _type_, _type_name_, _member_name_ ) \
+ GETVALUE_IMPL_TYPE( _type_, \
+ _type_name_, \
+ _member_name_, \
+ getCppuType( static_cast< const _type_ * >( 0 ) ) )
+
+#define SETVALUE_IMPL( _property_, _type_name_, _member_name_, _value_ ) \
+ \
+ vos::OGuard aGuard( m_aMutex ); \
+ \
+ ucb_impl::PropertyValue aNewValue; \
+ aNewValue.aProperty = _property_; \
+ aNewValue.nPropsSet = _type_name_; \
+ aNewValue.nOrigValue = _type_name_; \
+ aNewValue._member_name_ = _value_; \
+ \
+ m_pValues->push_back( aNewValue );
+
+//=========================================================================
+//=========================================================================
+//
+// PropertyValueSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+PropertyValueSet::PropertyValueSet(
+ const Reference< XMultiServiceFactory >& rxSMgr )
+: m_xSMgr( rxSMgr ),
+ m_bWasNull( sal_False ),
+ m_bTriedToGetTypeConverter( sal_False )
+{
+ m_pValues = new PropertyValues;
+}
+
+//=========================================================================
+// virtual
+PropertyValueSet::~PropertyValueSet()
+{
+ delete m_pValues;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_3( PropertyValueSet,
+ XTypeProvider,
+ XRow,
+ XColumnLocate );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( PropertyValueSet,
+ XTypeProvider,
+ XRow,
+ XColumnLocate );
+
+//=========================================================================
+//
+// XRow methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL PropertyValueSet::wasNull()
+ throw( SQLException, RuntimeException )
+{
+ // This method can not be implemented correctly!!! Imagine different
+ // threads doing a getXYZ - wasNull calling sequence on the same
+ // implementation object...
+ return m_bWasNull;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL PropertyValueSet::getString( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( OUString, STRING_VALUE_SET, aString );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertyValueSet::getBoolean( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL_TYPE(
+ sal_Bool, BOOLEAN_VALUE_SET, bBoolean, getCppuBooleanType() );
+}
+
+//=========================================================================
+// virtual
+sal_Int8 SAL_CALL PropertyValueSet::getByte( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int8, BYTE_VALUE_SET, nByte );
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL PropertyValueSet::getShort( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int16, SHORT_VALUE_SET, nShort );
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL PropertyValueSet::getInt( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int32, INT_VALUE_SET, nInt );
+}
+
+//=========================================================================
+// virtual
+sal_Int64 SAL_CALL PropertyValueSet::getLong( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int64, LONG_VALUE_SET, nLong );
+}
+
+//=========================================================================
+// virtual
+float SAL_CALL PropertyValueSet::getFloat( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( float, FLOAT_VALUE_SET, nFloat );
+}
+
+//=========================================================================
+// virtual
+double SAL_CALL PropertyValueSet::getDouble( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( double, DOUBLE_VALUE_SET, nDouble );
+}
+
+//=========================================================================
+// virtual
+Sequence< sal_Int8 > SAL_CALL
+PropertyValueSet::getBytes( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Sequence< sal_Int8 >, BYTES_VALUE_SET, aBytes );
+}
+
+//=========================================================================
+// virtual
+Date SAL_CALL PropertyValueSet::getDate( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Date, DATE_VALUE_SET, aDate );
+}
+
+//=========================================================================
+// virtual
+Time SAL_CALL PropertyValueSet::getTime( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Time, TIME_VALUE_SET, aTime );
+}
+
+//=========================================================================
+// virtual
+DateTime SAL_CALL PropertyValueSet::getTimestamp( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( DateTime, TIMESTAMP_VALUE_SET, aTimestamp );
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+PropertyValueSet::getBinaryStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL(
+ Reference< XInputStream >, BINARYSTREAM_VALUE_SET, xBinaryStream );
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+PropertyValueSet::getCharacterStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL(
+ Reference< XInputStream >, CHARACTERSTREAM_VALUE_SET, xCharacterStream );
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL PropertyValueSet::getObject(
+ sal_Int32 columnIndex,
+ const Reference< XNameAccess >& typeMap )
+ throw( SQLException, RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ Any aValue;
+
+ m_bWasNull = sal_True;
+
+ if ( ( columnIndex < 1 ) || ( columnIndex > m_pValues->size() ) )
+ {
+ VOS_ENSURE( sal_False, "PropertyValueSet - index out of range!" );
+ }
+ else
+ {
+ ucb_impl::PropertyValue& rValue = (*m_pValues)[ columnIndex - 1 ];
+
+ if ( rValue.nPropsSet & OBJECT_VALUE_SET )
+ {
+ // Values is present natively...
+ aValue = rValue.aObject;
+ m_bWasNull = sal_False;
+ }
+ else
+ {
+ // Make Any from original value.
+
+ switch ( rValue.nOrigValue )
+ {
+ case NO_VALUE_SET:
+ break;
+
+ case STRING_VALUE_SET:
+ aValue <<= rValue.aString;
+ break;
+
+ case BOOLEAN_VALUE_SET:
+ aValue <<= rValue.bBoolean;
+ break;
+
+ case BYTE_VALUE_SET:
+ aValue <<= rValue.nByte;
+ break;
+
+ case SHORT_VALUE_SET:
+ aValue <<= rValue.nShort;
+ break;
+
+ case INT_VALUE_SET:
+ aValue <<= rValue.nInt;
+ break;
+
+ case LONG_VALUE_SET:
+ aValue <<= rValue.nLong;
+ break;
+
+ case FLOAT_VALUE_SET:
+ aValue <<= rValue.nFloat;
+ break;
+
+ case DOUBLE_VALUE_SET:
+ aValue <<= rValue.nDouble;
+ break;
+
+ case BYTES_VALUE_SET:
+ aValue <<= rValue.aBytes;
+ break;
+
+ case DATE_VALUE_SET:
+ aValue <<= rValue.aDate;
+ break;
+
+ case TIME_VALUE_SET:
+ aValue <<= rValue.aTime;
+ break;
+
+ case TIMESTAMP_VALUE_SET:
+ aValue <<= rValue.aTimestamp;
+ break;
+
+ case BINARYSTREAM_VALUE_SET:
+ aValue <<= rValue.xBinaryStream;
+ break;
+
+ case CHARACTERSTREAM_VALUE_SET:
+ aValue <<= rValue.xCharacterStream;
+ break;
+
+ case REF_VALUE_SET:
+ aValue <<= rValue.xRef;
+ break;
+
+ case BLOB_VALUE_SET:
+ aValue <<= rValue.xBlob;
+ break;
+
+ case CLOB_VALUE_SET:
+ aValue <<= rValue.xClob;
+ break;
+
+ case ARRAY_VALUE_SET:
+ aValue <<= rValue.xArray;
+ break;
+
+ case OBJECT_VALUE_SET:
+ // Fall-through is intended!
+ default:
+ VOS_ENSURE( sal_False,
+ "PropertyValueSet::getObject - "
+ "Wrong original type" );
+ break;
+ }
+
+ if ( aValue.hasValue() )
+ {
+ rValue.aObject = aValue;
+ rValue.nPropsSet |= OBJECT_VALUE_SET;
+ m_bWasNull = sal_False;
+ }
+ }
+ }
+
+ return aValue;
+}
+
+//=========================================================================
+// virtual
+Reference< XRef > SAL_CALL PropertyValueSet::getRef( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XRef >, REF_VALUE_SET, xRef );
+}
+
+//=========================================================================
+// virtual
+Reference< XBlob > SAL_CALL PropertyValueSet::getBlob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XBlob >, BLOB_VALUE_SET, xBlob );
+}
+
+//=========================================================================
+// virtual
+Reference< XClob > SAL_CALL PropertyValueSet::getClob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XClob >, CLOB_VALUE_SET, xClob );
+}
+
+//=========================================================================
+// virtual
+Reference< XArray > SAL_CALL PropertyValueSet::getArray( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XArray >, ARRAY_VALUE_SET, xArray );
+}
+
+//=========================================================================
+//
+// XColumnLocate methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL PropertyValueSet::findColumn( const OUString& columnName )
+ throw( SQLException, RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( columnName.getLength() )
+ {
+ sal_Int32 nCount = m_pValues->size();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ if ( (*m_pValues)[ n ].aProperty.Name.equals( columnName ) )
+ return sal_Int32( n + 1 ); // Index is 1-based.
+ }
+ }
+ return 0;
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+const Reference< XTypeConverter >& PropertyValueSet::getTypeConverter()
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_bTriedToGetTypeConverter && !m_xTypeConverter.is() )
+ {
+ m_bTriedToGetTypeConverter = sal_True;
+ m_xTypeConverter = Reference< XTypeConverter >(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.script.Converter" ) ),
+ UNO_QUERY );
+
+ VOS_ENSURE( m_xTypeConverter.is(),
+ "PropertyValueSet::getTypeConverter() - "
+ "Service 'com.sun.star.script.Converter' n/a!" );
+ }
+ return m_xTypeConverter;
+}
+
+//=========================================================================
+sal_Int32 PropertyValueSet::getLength() const
+{
+ return m_pValues->size();
+}
+
+//=========================================================================
+void PropertyValueSet::appendString( const Property& rProp,
+ const OUString& rValue )
+{
+ SETVALUE_IMPL( rProp, STRING_VALUE_SET, aString, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBoolean( const Property& rProp,
+ sal_Bool bValue )
+{
+ SETVALUE_IMPL( rProp, BOOLEAN_VALUE_SET, bBoolean, bValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendByte( const Property& rProp,
+ sal_Int8 nValue )
+{
+ SETVALUE_IMPL( rProp, BYTE_VALUE_SET, nByte, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendShort( const Property& rProp,
+ sal_Int16 nValue )
+{
+ SETVALUE_IMPL( rProp, SHORT_VALUE_SET, nShort, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendInt( const Property& rProp,
+ sal_Int32 nValue )
+{
+ SETVALUE_IMPL( rProp, INT_VALUE_SET, nInt, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendLong( const Property& rProp,
+ sal_Int64 nValue )
+{
+ SETVALUE_IMPL( rProp, LONG_VALUE_SET, nLong, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendFloat( const Property& rProp,
+ float nValue )
+{
+ SETVALUE_IMPL( rProp, FLOAT_VALUE_SET, nFloat, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendDouble( const Property& rProp,
+ double nValue )
+{
+ SETVALUE_IMPL( rProp, DOUBLE_VALUE_SET, nDouble, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBytes( const Property& rProp,
+ const Sequence< sal_Int8 >& rValue )
+{
+ SETVALUE_IMPL( rProp, BYTES_VALUE_SET, aBytes, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendDate( const Property& rProp,
+ const Date& rValue )
+{
+ SETVALUE_IMPL( rProp, DATE_VALUE_SET, aDate, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendTime( const Property& rProp,
+ const Time& rValue )
+{
+ SETVALUE_IMPL( rProp, TIME_VALUE_SET, aTime, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendTimestamp( const Property& rProp,
+ const DateTime& rValue )
+{
+ SETVALUE_IMPL( rProp, TIMESTAMP_VALUE_SET, aTimestamp, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBinaryStream(
+ const Property& rProp,
+ const Reference< XInputStream >& rValue )
+{
+ SETVALUE_IMPL( rProp, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendCharacterStream(
+ const Property& rProp,
+ const Reference< XInputStream >& rValue )
+{
+ SETVALUE_IMPL( rProp, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendObject( const Property& rProp,
+ const Any& rValue )
+{
+ SETVALUE_IMPL( rProp, OBJECT_VALUE_SET, aObject, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendRef( const Property& rProp,
+ const Reference< XRef >& rValue )
+{
+ SETVALUE_IMPL( rProp, REF_VALUE_SET, xRef, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBlob( const Property& rProp,
+ const Reference< XBlob >& rValue )
+{
+ SETVALUE_IMPL( rProp, BLOB_VALUE_SET, xBlob, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendClob( const Property& rProp,
+ const Reference< XClob >& rValue )
+{
+ SETVALUE_IMPL( rProp, CLOB_VALUE_SET, xClob, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendArray( const Property& rProp,
+ const Reference< XArray >& rValue )
+{
+ SETVALUE_IMPL( rProp, ARRAY_VALUE_SET, xArray, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendVoid( const Property& rProp )
+{
+ SETVALUE_IMPL( rProp, NO_VALUE_SET, aObject, Any() );
+}
+
+//=========================================================================
+void PropertyValueSet::appendPropertySet(
+ const Reference< XPropertySet >& rxSet )
+{
+ if ( rxSet.is() )
+ {
+ Reference< XPropertySetInfo > xInfo = rxSet->getPropertySetInfo();
+ if ( xInfo.is() )
+ {
+ Sequence< Property > aProps = xInfo->getProperties();
+ const Property* pProps = aProps.getConstArray();
+ sal_Int32 nPropsCount = aProps.getLength();
+
+ Reference< XPropertyAccess > xPropertyAccess( rxSet, UNO_QUERY );
+ if ( xPropertyAccess.is() )
+ {
+ // Efficient: Get all prop values with one ( remote) call.
+
+ Sequence< ::com::sun::star::beans::PropertyValue > aPropValues
+ = xPropertyAccess->getPropertyValues();
+
+ const ::com::sun::star::beans::PropertyValue* pPropValues
+ = aPropValues.getConstArray();
+
+ sal_Int32 nValuesCount = aPropValues.getLength();
+ for ( sal_Int32 n = 0; n < nValuesCount; ++n )
+ {
+ const ::com::sun::star::beans::PropertyValue& rPropValue
+ = pPropValues[ n ];
+
+ // Find info for current property value.
+ for ( sal_Int32 m = 0; m < nPropsCount; ++m )
+ {
+ const Property& rProp = pProps[ m ];
+ if ( rProp.Name == rPropValue.Name )
+ {
+ // Found!
+ appendObject( rProp, rPropValue.Value );
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ // Get every single prop value with one ( remote) call.
+
+ for ( sal_Int32 n = 0; n < nPropsCount; ++n )
+ {
+ const Property& rProp = pProps[ n ];
+
+ try
+ {
+ Any aValue = rxSet->getPropertyValue( rProp.Name );
+
+ if ( aValue.hasValue() )
+ appendObject( rProp, aValue );
+ }
+ catch ( UnknownPropertyException )
+ {
+ }
+ catch ( WrappedTargetException )
+ {
+ }
+ }
+ }
+ }
+ }
+}
+
+//=========================================================================
+sal_Bool PropertyValueSet::appendPropertySetValue(
+ const Reference< XPropertySet >& rxSet,
+ const Property& rProperty )
+{
+ if ( rxSet.is() )
+ {
+ try
+ {
+ Any aValue = rxSet->getPropertyValue( rProperty.Name );
+ if ( aValue.hasValue() )
+ {
+ appendObject( rProperty, aValue );
+ return sal_True;
+ }
+ }
+ catch ( UnknownPropertyException )
+ {
+ }
+ catch ( WrappedTargetException )
+ {
+ }
+ }
+
+ // Error.
+ return sal_False;
+}
+
diff --git a/ucbhelper/source/provider/providerhelper.cxx b/ucbhelper/source/provider/providerhelper.cxx
new file mode 100644
index 000000000000..2d646f2943b8
--- /dev/null
+++ b/ucbhelper/source/provider/providerhelper.cxx
@@ -0,0 +1,614 @@
+/*************************************************************************
+ *
+ * $RCSfile: providerhelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __HASH_MAP__
+#include <stl/hash_map>
+#endif
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
+#include <com/sun/star/container/XNamed.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPROPERTYSETREGISTRYFACTORY_HPP_
+#include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPROPERTYSETREGISTRY_HPP_
+#include <com/sun/star/ucb/XPropertySetRegistry.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCONFIGMANAGER_HPP_
+#include <com/sun/star/frame/XConfigManager.hpp>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#include <ucbhelper/providerhelper.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+
+#define PROPSET_REGISTRY_FILE_NAME "dynprops.rdb"
+
+using namespace rtl;
+using namespace com::sun::star::container;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace ucb;
+
+namespace ucb_impl
+{
+
+//=========================================================================
+//
+// Contents.
+//
+//=========================================================================
+
+struct equalString
+{
+ bool operator()( const OUString& rKey11, const OUString& rKey22 ) const
+ {
+ return !!( rKey11 == rKey22 );
+ }
+};
+
+struct hashString
+{
+ size_t operator()( const OUString & rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef std::hash_map
+<
+ OUString,
+ ContentImplHelper*,
+ hashString,
+ equalString
+>
+Contents;
+
+//=========================================================================
+//
+// struct ContentProviderImplHelper_Impl.
+//
+//=========================================================================
+
+struct ContentProviderImplHelper_Impl
+{
+ Reference< XPropertySetRegistry > m_xPropertySetRegistry;
+ Contents m_aContents;
+};
+
+} // namespace ucb_impl
+
+using namespace ucb_impl;
+
+//=========================================================================
+//=========================================================================
+//
+// ContentProviderImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentProviderImplHelper::ContentProviderImplHelper(
+ const Reference< XMultiServiceFactory >& rXSMgr )
+: m_xSMgr( rXSMgr ),
+ m_pImpl( new ucb_impl::ContentProviderImplHelper_Impl )
+{
+}
+
+//=========================================================================
+// virtual
+ContentProviderImplHelper::~ContentProviderImplHelper()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_3( ContentProviderImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XContentProvider );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( ContentProviderImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XContentProvider );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+// virtual
+OUString SAL_CALL ContentProviderImplHelper::getImplementationName()
+ throw( RuntimeException )
+{
+}
+
+//=========================================================================
+// virtual
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ContentProviderImplHelper::getSupportedServiceNames()
+ throw( RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ContentProviderImplHelper::supportsService(
+ const OUString& ServiceName )
+ throw( RuntimeException )
+{
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString* pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//
+// XContentProvider methods.
+//
+//=========================================================================
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+// virtual
+Reference< XContent > SAL_CALL ContentProviderImplHelper::queryContent(
+ const Reference< XContentIdentifier >& Identifier )
+ throw( IllegalIdentifierException, RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ContentProviderImplHelper::compareContentIds(
+ const Reference< XContentIdentifier >& Id1,
+ const Reference< XContentIdentifier >& Id2 )
+ throw( RuntimeException )
+{
+ // Simply do a string compare.
+
+ OUString aURL1( Id1->getContentIdentifier() );
+ OUString aURL2( Id2->getContentIdentifier() );
+
+ return aURL1.compareTo( aURL2 );;
+}
+
+//=========================================================================
+//
+// Non-interface methods
+//
+//=========================================================================
+
+void ContentProviderImplHelper::addContent(
+ ::ucb::ContentImplHelper* pContent )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ const OUString aURL( pContent->getIdentifier()->getContentIdentifier() );
+
+#ifdef _DEBUG
+ Contents::const_iterator it = m_pImpl->m_aContents.find( aURL );
+ VOS_ENSURE( it == m_pImpl->m_aContents.end(),
+ "ContentProviderImplHelper::addContent - Already registered!" );
+#endif
+
+ m_pImpl->m_aContents[ aURL ] = pContent;
+}
+
+//=========================================================================
+void ContentProviderImplHelper::removeContent(
+ ::ucb::ContentImplHelper* pContent )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ const OUString aURL( pContent->getIdentifier()->getContentIdentifier() );
+ removeContent( aURL );
+}
+
+//=========================================================================
+void ContentProviderImplHelper::removeContent( const OUString& rURL )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ Contents::iterator it = m_pImpl->m_aContents.find( rURL );
+
+// VOS_ENSURE( it != m_pImpl->m_aContents.end(),
+// "ContentProviderImplHelper::removeContent - Not registered!" );
+
+ if ( it != m_pImpl->m_aContents.end() )
+ m_pImpl->m_aContents.erase( it );
+}
+
+//=========================================================================
+vos::ORef< ContentImplHelper >
+ContentProviderImplHelper::queryExistingContent(
+ const Reference< XContentIdentifier >& Identifier )
+{
+ return queryExistingContent( Identifier->getContentIdentifier() );
+}
+
+//=========================================================================
+vos::ORef< ContentImplHelper >
+ContentProviderImplHelper::queryExistingContent( const OUString& rURL )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ // Check, if a content with given id already exists...
+
+ Contents::const_iterator it = m_pImpl->m_aContents.find( rURL );
+ if ( it != m_pImpl->m_aContents.end() )
+ {
+ // Already there. Return it.
+ return vos::ORef< ContentImplHelper >( (*it).second );
+ }
+
+ return vos::ORef< ContentImplHelper >();
+}
+
+//=========================================================================
+void ContentProviderImplHelper::queryExistingContents(
+ ContentRefList& rContents )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ Contents::const_iterator it = m_pImpl->m_aContents.begin();
+ Contents::const_iterator end = m_pImpl->m_aContents.end();
+
+ while ( it != end )
+ {
+ rContents.push_back( ContentImplHelperRef( (*it).second ) );
+ ++it;
+ }
+}
+
+//=========================================================================
+Reference< XPropertySetRegistry >
+ContentProviderImplHelper::getAdditionalPropertySetRegistry()
+{
+ // Get propertyset registry.
+
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ Reference< XPropertySetRegistryFactory > xRegFac(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.ucb.Store" ) ),
+ UNO_QUERY );
+
+ VOS_ENSURE( xRegFac.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "No UCB-Store service!" );
+
+ Reference< XSimpleRegistry > xCfgReg(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.config.SpecialConfigManager" ) ),
+ UNO_QUERY );
+
+ VOS_ENSURE( xCfgReg.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "No ConfigManager service!" );
+
+ Reference< XConfigManager > xCfgMgr;
+ if ( xCfgReg.is() )
+ xCfgMgr = Reference< XConfigManager >( xCfgReg, UNO_QUERY );
+
+ VOS_ENSURE( xCfgMgr.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "No XConfigManager!" );
+
+ if ( xRegFac.is() && xCfgReg.is() && xCfgMgr.is() )
+ {
+ OUString aRegURL;
+
+ try
+ {
+ Reference< XRegistryKey > xRegistryKey( xCfgReg->getRootKey() );
+ if ( xRegistryKey.is() )
+ xRegistryKey = xRegistryKey->openKey(
+ OUString::createFromAscii( "Directories/Storage-Dir") );
+
+ if ( xRegistryKey.is() )
+ aRegURL = xRegistryKey->getStringValue();
+ }
+ catch ( InvalidRegistryException& )
+ {
+ }
+
+ aRegURL = xCfgMgr->substituteVariables( aRegURL );
+
+ VOS_ENSURE( aRegURL.getLength(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "Unable to get Store-directory!" );
+
+ if ( aRegURL.getLength() )
+ {
+ // Convert path to a URL.
+ OUString aUNCPath;
+ osl::FileBase::RC
+ eErr = osl::FileBase::normalizePath( aRegURL, aUNCPath );
+
+ if ( eErr == osl::FileBase::E_None )
+ {
+ eErr = osl::FileBase::getFileURLFromNormalizedPath(
+ aUNCPath, aRegURL );
+ if ( eErr == osl::FileBase::E_None )
+ {
+ OUString aLastChar(
+ aRegURL.copy( aRegURL.getLength() - 1 ) );
+ OUString aTmpOWStr = OUString::createFromAscii ( "/" );
+ if ( aLastChar != aTmpOWStr )
+ aRegURL += aTmpOWStr;
+
+ aRegURL += OUString::createFromAscii(
+ PROPSET_REGISTRY_FILE_NAME );
+
+ // Open/create a registry.
+ m_pImpl->m_xPropertySetRegistry
+ = xRegFac->createPropertySetRegistry( aRegURL );
+ }
+ }
+
+ VOS_ENSURE( m_pImpl->m_xPropertySetRegistry.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "Error opening registry!" );
+ }
+ }
+ }
+
+ return m_pImpl->m_xPropertySetRegistry;
+}
+
+
+//=========================================================================
+Reference< XPersistentPropertySet >
+ContentProviderImplHelper::getAdditionalPropertySet( const OUString& rKey,
+ sal_Bool bCreate )
+{
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ // Open/create persistent property set.
+ return Reference< XPersistentPropertySet >(
+ m_pImpl->m_xPropertySetRegistry->openPropertySet(
+ rKey, bCreate ) );
+ }
+
+ return Reference< XPersistentPropertySet >();
+}
+
+//=========================================================================
+sal_Bool ContentProviderImplHelper::renameAdditionalPropertySet(
+ const OUString& rOldKey,
+ const OUString& rNewKey,
+ sal_Bool bRecursive )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( bRecursive )
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ Reference< XNameAccess > xNameAccess(
+ m_pImpl->m_xPropertySetRegistry, UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ Sequence< OUString > aKeys = xNameAccess->getElementNames();
+ sal_Int32 nCount = aKeys.getLength();
+ if ( nCount > 0 )
+ {
+ const OUString* pKeys = aKeys.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rKey = pKeys[ n ];
+ if ( rKey.compareTo(
+ rOldKey, rOldKey.getLength() ) == 0 )
+ {
+ OUString aNewKey
+ = rKey.replaceAt(
+ 0, rOldKey.getLength(), rNewKey );
+ if ( !renameAdditionalPropertySet(
+ rKey, aNewKey, sal_False ) )
+ return sal_False;
+ }
+ }
+ }
+ }
+ else
+ return sal_False;
+ }
+ else
+ return sal_False;
+ }
+ else
+ {
+ // Get old property set, if exists.
+ Reference< XPersistentPropertySet > xOldSet
+ = getAdditionalPropertySet( rOldKey, sal_False );
+ if ( xOldSet.is() )
+ {
+ // Rename property set.
+ Reference< XNamed > xNamed( xOldSet, UNO_QUERY );
+ if ( xNamed.is() )
+ {
+ // ??? throws no exceptions and has no return value ???
+ xNamed->setName( rNewKey );
+ }
+ else
+ return sal_False;
+ }
+ }
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool ContentProviderImplHelper::removeAdditionalPropertySet(
+ const OUString& rKey,
+ sal_Bool bRecursive )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( bRecursive )
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ Reference< XNameAccess > xNameAccess(
+ m_pImpl->m_xPropertySetRegistry, UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ Sequence< OUString > aKeys = xNameAccess->getElementNames();
+ sal_Int32 nCount = aKeys.getLength();
+ if ( nCount > 0 )
+ {
+ const OUString* pKeys = aKeys.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rCurrKey = pKeys[ n ];
+ if ( rCurrKey.compareTo( rKey, rKey.getLength() ) == 0 )
+ {
+ if ( !removeAdditionalPropertySet(
+ rCurrKey, sal_False ) )
+ return sal_False;
+ }
+ }
+ }
+ }
+ else
+ return sal_False;
+ }
+ else
+ return sal_False;
+ }
+ else
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ m_pImpl->m_xPropertySetRegistry->removePropertySet( rKey );
+ else
+ return sal_False;
+ }
+ return sal_True;
+}
+
diff --git a/ucbhelper/source/provider/registerucb.cxx b/ucbhelper/source/provider/registerucb.cxx
new file mode 100644
index 000000000000..a86aa199427e
--- /dev/null
+++ b/ucbhelper/source/provider/registerucb.cxx
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * $RCSfile: registerucb.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_REGISTERUCB_HXX_
+#include <ucbhelper/registerucb.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_CONTENTPROVIDERSERVICEINFO2_HPP_
+#include <com/sun/star/ucb/ContentProviderServiceInfo2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPARAMETERIZEDCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERFACTORY_HPP_
+#include <com/sun/star/ucb/XContentProviderFactory.hpp>
+#endif
+
+using namespace com::sun;
+using namespace com::sun::star;
+
+//============================================================================
+//
+// registerAtUcb
+//
+//============================================================================
+
+namespace ucb {
+
+void
+registerAtUcb(
+ uno::Reference< star::ucb::XContentProviderManager > const & rUcb,
+ uno::Reference< lang::XMultiServiceFactory > const & rFactory,
+ uno::Sequence< star::ucb::ContentProviderServiceInfo2 > const &
+ rProviders,
+ std::vector< ContentProviderRegistrationInfo > * pResults)
+ throw (uno::RuntimeException)
+{
+ uno::Reference< star::ucb::XContentProviderFactory > xFac;
+ try
+ {
+ xFac = uno::Reference< star::ucb::XContentProviderFactory >(
+ rFactory->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.ucb.ContentProviderProxyFactory")),
+ uno::UNO_QUERY);
+ }
+ catch (uno::RuntimeException const &) { throw; }
+ catch (uno::Exception const &) {}
+
+ star::ucb::ContentProviderServiceInfo2 const * pInfo
+ = rProviders.getConstArray();
+ for (sal_Int32 n = rProviders.getLength(); n > 0; --n)
+ {
+ uno::Reference< star::ucb::XContentProvider > xProvider;
+ if (xFac.is())
+ {
+ // Try to instantiate proxy for provider.
+ xProvider = xFac->createContentProvider(pInfo->Service);
+ }
+
+ if (!xProvider.is())
+ {
+ // Try to instantiate provider directly.
+ try
+ {
+ xProvider = uno::Reference< star::ucb::XContentProvider >(
+ rFactory->createInstance(pInfo->Service),
+ uno::UNO_QUERY);
+ }
+ catch (uno::RuntimeException const &) { throw; }
+ catch (uno::Exception const &) {}
+ }
+
+ uno::Reference< star::ucb::XContentProvider >
+ xOriginalProvider(xProvider);
+ uno::Reference< star::ucb::XParameterizedContentProvider >
+ xParameterized(xProvider, uno::UNO_QUERY);
+ if (xParameterized.is())
+ {
+ uno::Reference< star::ucb::XContentProvider > xInstance;
+ try
+ {
+ xInstance
+ = xParameterized->registerInstance(pInfo->Scheme,
+ pInfo->Arguments,
+ pInfo->
+ ReplaceExisting);
+ //@@@ if this call replaces an old instance, the commit-
+ // or-rollback code below will not work
+ }
+ catch (lang::IllegalArgumentException const &) {}
+
+ if (xInstance.is())
+ xProvider = xInstance;
+ }
+
+ if (rUcb.is() && xProvider.is())
+ try
+ {
+ rUcb->registerContentProvider(xProvider, pInfo->Scheme,
+ pInfo->ReplaceExisting);
+ }
+ catch (star::ucb::DuplicateProviderException const &)
+ {
+ if (xParameterized.is())
+ try
+ {
+ xParameterized->deregisterInstance(pInfo->Scheme,
+ pInfo->Arguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+ xOriginalProvider = 0;
+ }
+ catch (...)
+ {
+ if (xParameterized.is())
+ try
+ {
+ xParameterized->deregisterInstance(pInfo->Scheme,
+ pInfo->Arguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+ throw;
+ }
+
+ if (pResults)
+ pResults->
+ push_back(ContentProviderRegistrationInfo(xOriginalProvider,
+ pInfo->Arguments,
+ pInfo->Scheme));
+
+ ++pInfo;
+ }
+}
+
+//============================================================================
+//
+// deregisterFromUcb
+//
+//============================================================================
+
+void
+deregisterFromUcb(
+ uno::Reference< star::ucb::XContentProviderManager > const & rUcb,
+ std::vector< ContentProviderRegistrationInfo > const & rProviders)
+ throw (uno::RuntimeException)
+{
+ std::vector< ContentProviderRegistrationInfo >::const_iterator
+ aEnd(rProviders.end());
+ for (std::vector< ContentProviderRegistrationInfo >::const_iterator
+ aIt(rProviders.begin());
+ aIt != aEnd; ++aIt)
+ {
+ uno::Reference< star::ucb::XContentProvider >
+ xProvider(aIt->m_xProvider);
+ if (xProvider.is())
+ {
+ uno::Reference< star::ucb::XParameterizedContentProvider >
+ xParameterized(xProvider, uno::UNO_QUERY);
+ if (xParameterized.is())
+ {
+ uno::Reference< star::ucb::XContentProvider > xInstance;
+ try
+ {
+ xInstance
+ = xParameterized->
+ deregisterInstance(aIt->m_aTemplate,
+ aIt->m_aArguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+
+ if (xInstance.is())
+ xProvider = xInstance;
+ }
+
+ if (rUcb.is() && xProvider.is())
+ rUcb->deregisterContentProvider(xProvider, aIt->m_aTemplate);
+ //@@@ if this fails, a roll-back of deregisterInstance()
+ // is missing
+ }
+ }
+}
+
+}
+
diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx
new file mode 100644
index 000000000000..38fba0cd09b4
--- /dev/null
+++ b/ucbhelper/source/provider/resultset.cxx
@@ -0,0 +1,1706 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __HASH_MAP__
+#include <stl/hash_map>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _UCBHELPER_RESULTSET_HXX
+#include <ucbhelper/resultset.hxx>
+#endif
+#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
+#include <ucbhelper/resultsetmetadata.hxx>
+#endif
+
+using namespace cppu;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace rtl;
+using namespace ucb;
+
+//=========================================================================
+
+namespace ucb_impl
+{
+
+struct PropertyInfo
+{
+ const char* pName;
+ sal_Int32 nHandle;
+ sal_Int16 nAttributes;
+ const com::sun::star::uno::Type& (*pGetCppuType)();
+};
+
+static const com::sun::star::uno::Type& sal_uInt32_getCppuType()
+{
+ // ! uInt -> Int, because of Java !!!
+ return getCppuType( static_cast< const sal_Int32 * >( 0 ) );
+}
+
+static const com::sun::star::uno::Type& sal_Bool_getCppuType()
+{
+ return getCppuBooleanType();
+}
+
+static PropertyInfo aPropertyTable[] =
+{
+ { "IsRowCountFinal",
+ 1000,
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY,
+ &sal_Bool_getCppuType
+ },
+ { "RowCount",
+ 1001,
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY,
+ &sal_uInt32_getCppuType
+ },
+ { 0,
+ 0,
+ 0,
+ 0
+ }
+};
+
+#define RESULTSET_PROPERTY_COUNT 2
+
+//=========================================================================
+//
+// class PropertySetInfo
+//
+//=========================================================================
+
+class PropertySetInfo :
+ public OWeakObject, public XTypeProvider, public XPropertySetInfo
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Sequence< Property >* m_pProps;
+
+private:
+ sal_Bool queryProperty( const rtl::OUString& aName, Property& rProp );
+
+public:
+ PropertySetInfo( const Reference< XMultiServiceFactory >& rxSMgr,
+ const PropertyInfo* pProps,
+ sal_uInt32 nProps );
+ virtual ~PropertySetInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XPropertySetInfo
+ virtual Sequence< Property > SAL_CALL getProperties()
+ throw( RuntimeException );
+ virtual Property SAL_CALL getPropertyByName( const rtl::OUString& aName )
+ throw( UnknownPropertyException, RuntimeException );
+ virtual sal_Bool SAL_CALL hasPropertyByName( const rtl::OUString& Name )
+ throw( RuntimeException );
+};
+
+//=========================================================================
+//
+// PropertyChangeListenerContainer.
+//
+//=========================================================================
+
+struct equalStr_Impl
+{
+ bool operator()( const OUString& s1, const OUString& s2 ) const
+ {
+ return !!( s1 == s2 );
+ }
+};
+
+struct hashStr_Impl
+{
+ size_t operator()( const OUString& rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef OMultiTypeInterfaceContainerHelperVar
+<
+ OUString,
+ hashStr_Impl,
+ equalStr_Impl
+> PropertyChangeListenerContainer;
+
+//=========================================================================
+//
+// class PropertyChangeListeners.
+//
+//=========================================================================
+
+class PropertyChangeListeners : public PropertyChangeListenerContainer
+{
+public:
+ PropertyChangeListeners( osl::Mutex& rMutex )
+ : PropertyChangeListenerContainer( rMutex ) {}
+};
+
+} // namespace ucb_impl
+
+using namespace ucb_impl;
+
+namespace ucb
+{
+
+//=========================================================================
+//
+// struct ResultSet_Impl.
+//
+//=========================================================================
+
+struct ResultSet_Impl
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XPropertySetInfo > m_xPropSetInfo;
+ Reference< XResultSetMetaData > m_xMetaData;
+ Sequence< Property > m_aProperties;
+ vos::ORef< ResultSetDataSupplier > m_xDataSupplier;
+ osl::Mutex m_aMutex;
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ PropertyChangeListeners* m_pPropertyChangeListeners;
+ sal_Int32 m_nPos;
+ sal_Bool m_bWasNull;
+ sal_Bool m_bAfterLast;
+
+ inline ResultSet_Impl( const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProperties,
+ const vos::ORef<
+ ResultSetDataSupplier >& rDataSupplier );
+ inline ~ResultSet_Impl();
+};
+
+} // namespace ucb
+
+inline ResultSet_Impl::ResultSet_Impl(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProperties,
+ const vos::ORef< ResultSetDataSupplier >& rDataSupplier )
+: m_xSMgr( rxSMgr ),
+ m_aProperties( rProperties ),
+ m_xDataSupplier( rDataSupplier ),
+ m_pDisposeEventListeners( 0 ),
+ m_pPropertyChangeListeners( 0 ),
+ m_nPos( 0 ), // Position is one-based. Zero means: before first element.
+ m_bWasNull( sal_False ),
+ m_bAfterLast( sal_False )
+{
+}
+
+//=========================================================================
+inline ResultSet_Impl::~ResultSet_Impl()
+{
+ delete m_pDisposeEventListeners;
+ delete m_pPropertyChangeListeners;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ResultSet::ResultSet( const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProperties,
+ const vos::ORef< ResultSetDataSupplier >& rDataSupplier )
+: m_pImpl( new ResultSet_Impl( rxSMgr, rProperties, rDataSupplier ) )
+{
+ rDataSupplier->m_pResultSet = this;
+}
+
+//=========================================================================
+// virtual
+ResultSet::~ResultSet()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_9( ResultSet,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent,
+ XContentAccess,
+ XResultSet,
+ XResultSetMetaDataSupplier,
+ XRow,
+ XCloseable,
+ XPropertySet );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_9( ResultSet,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent,
+ XContentAccess,
+ XResultSet,
+ XResultSetMetaDataSupplier,
+ XRow,
+ XCloseable,
+ XPropertySet );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+XSERVICEINFO_NOFACTORY_IMPL_1( ResultSet,
+ OUString::createFromAscii( "ResultSet" ),
+ OUString::createFromAscii( RESULTSET_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSet::dispose()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners &&
+ m_pImpl->m_pDisposeEventListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XComponent * >( this );
+ m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XPropertySet * >( this );
+ m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
+ }
+
+ m_pImpl->m_xDataSupplier->close();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners =
+ new OInterfaceContainerHelper( m_pImpl->m_aMutex );
+
+ m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removeEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XResultSetMetaDataSupplier methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XResultSetMetaData > SAL_CALL ResultSet::getMetaData()
+ throw( SQLException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_xMetaData.is() )
+ m_pImpl->m_xMetaData = new ResultSetMetaData( m_pImpl->m_xSMgr,
+ m_pImpl->m_aProperties );
+
+ return m_pImpl->m_xMetaData;
+}
+
+//=========================================================================
+//
+// XResultSet methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL ResultSet::next()
+ throw( SQLException, RuntimeException )
+{
+ // Note: Cursor is initially positioned before the first row.
+ // First call to 'next()' moves it to first row.
+
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ // getResult works zero-based!
+ if ( !m_pImpl->m_xDataSupplier->getResult( m_pImpl->m_nPos ) )
+ {
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_nPos++;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isBeforeFirst()
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ // getResult works zero-based!
+ if ( !m_pImpl->m_xDataSupplier->getResult( 0 ) )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == 0 );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isAfterLast()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_bAfterLast;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isFirst()
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == 1 );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isLast()
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( !nCount )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == nCount );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::beforeFirst()
+ throw( SQLException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::afterLast()
+ throw( SQLException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::first()
+ throw( SQLException, RuntimeException )
+{
+ // getResult works zero-based!
+ if ( m_pImpl->m_xDataSupplier->getResult( 0 ) )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 1;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::last()
+ throw( SQLException, RuntimeException )
+{
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( nCount )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = nCount;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSet::getRow()
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_nPos;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
+ throw( SQLException, RuntimeException )
+{
+/*
+ If the row number is positive, the cursor moves to the given row number
+ with respect to the beginning of the result set. The first row is row 1,
+ the second is row 2, and so on.
+
+ If the given row number is negative, the cursor moves to an absolute row
+ position with respect to the end of the result set. For example, calling
+ absolaute( -1 ) positions the cursor on the last row, absolaute( -2 )
+ indicates the next-to-last row, and so on.
+
+ An attempt to position the cursor beyond the first/last row in the result
+ set leaves the cursor before/after the first/last row, respectively.
+
+ Calling absolute( 1 ) is the same as calling first().
+
+ Calling absolute( -1 ) is the same as calling last().
+*/
+ if ( row < 0 )
+ {
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+
+ if ( ( row * -1 ) > nCount )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ else // |row| <= nCount
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( nCount + row + 1 );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ }
+ else if ( row == 0 )
+ {
+ // @throws SQLException
+ // ... if row is 0 ...
+ throw SQLException();
+ }
+ else // row > 0
+ {
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+
+ if ( row <= nCount )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = row;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else // row > nCount
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+
+ // unreachable...
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
+ throw( SQLException, RuntimeException )
+{
+/*
+ Attempting to move beyond the first/last row in the result set
+ positions the cursor before/after the the first/last row.
+
+ Calling relative( 0 ) is valid, but does not change the cursor position.
+
+ Calling relative( 1 ) is different from calling next() because it makes
+ sense to call next() when there is no current row, for example, when
+ the cursor is positioned before the first row or after the last row of
+ the result set.
+*/
+ if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
+ {
+ // "No current row".
+ throw SQLException();
+ }
+
+ if ( rows < 0 )
+ {
+ if ( ( m_pImpl->m_nPos + rows ) > 0 )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+ else if ( rows == 0 )
+ {
+ // nop.
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else // rows > 0
+ {
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( ( m_pImpl->m_nPos + rows ) <= nCount )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+
+ // unreachable...
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::previous()
+ throw( SQLException, RuntimeException )
+{
+/*
+ previous() is not the same as relative( -1 ) because it makes sense
+ to call previous() when there is no current row.
+*/
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_bAfterLast = sal_False;
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ m_pImpl->m_nPos = nCount;
+ }
+ else if ( m_pImpl->m_nPos )
+ m_pImpl->m_nPos--;
+
+ if ( m_pImpl->m_nPos )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::refreshRow()
+ throw( SQLException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
+ return;
+
+ m_pImpl->m_xDataSupplier->releasePropertyValues( m_pImpl->m_nPos );
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowUpdated()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowInserted()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowDeleted()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+Reference< XInterface > SAL_CALL ResultSet::getStatement()
+ throw( SQLException, RuntimeException )
+{
+/*
+ returns the Statement that produced this ResultSet object. If the
+ result set was generated some other way, ... this method returns null.
+*/
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XInterface >();
+}
+
+//=========================================================================
+//
+// XRow methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL ResultSet::wasNull()
+ throw( SQLException, RuntimeException )
+{
+ // This method can not be implemented correctly!!! Imagine different
+ // threads doing a getXYZ - wasNull calling sequence on the same
+ // implementation object...
+
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->wasNull();
+ }
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_bWasNull;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSet::getString( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getString( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::getBoolean( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBoolean( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int8 SAL_CALL ResultSet::getByte( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getByte( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL ResultSet::getShort( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getShort( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSet::getInt( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getInt( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int64 SAL_CALL ResultSet::getLong( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getLong( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+float SAL_CALL ResultSet::getFloat( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getFloat( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+double SAL_CALL ResultSet::getDouble( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getDouble( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+Sequence< sal_Int8 > SAL_CALL
+ResultSet::getBytes( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBytes( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Sequence< sal_Int8 >();
+}
+
+//=========================================================================
+// virtual
+Date SAL_CALL ResultSet::getDate( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getDate( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Date();
+}
+
+//=========================================================================
+// virtual
+Time SAL_CALL ResultSet::getTime( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getTime( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Time();
+}
+
+//=========================================================================
+// virtual
+com::sun::star::util::DateTime SAL_CALL
+ResultSet::getTimestamp( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getTimestamp( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return com::sun::star::util::DateTime();
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+ResultSet::getBinaryStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBinaryStream( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XInputStream >();
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+ResultSet::getCharacterStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getCharacterStream( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XInputStream >();
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL ResultSet::getObject( sal_Int32 columnIndex,
+ const Reference< XNameAccess >& typeMap )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getObject( columnIndex, typeMap );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Any();
+}
+
+//=========================================================================
+// virtual
+Reference< XRef > SAL_CALL ResultSet::getRef( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getRef( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XRef >();
+}
+
+//=========================================================================
+// virtual
+Reference< XBlob > SAL_CALL ResultSet::getBlob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBlob( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XBlob >();
+}
+
+//=========================================================================
+// virtual
+Reference< XClob > SAL_CALL ResultSet::getClob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getClob( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XClob >();
+}
+
+//=========================================================================
+// virtual
+Reference< XArray > SAL_CALL ResultSet::getArray( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getArray( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XArray >();
+}
+
+//=========================================================================
+//
+// XCloseable methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSet::close()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->close();
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+//
+// XContentAccess methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL ResultSet::queryContentIdentfierString()
+ throw( RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContentIdentifierString(
+ m_pImpl->m_nPos - 1 );
+
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+Reference< XContentIdentifier > SAL_CALL ResultSet::queryContentIdentifier()
+ throw( RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContentIdentifier(
+ m_pImpl->m_nPos - 1 );
+
+ return Reference< XContentIdentifier >();
+}
+
+//=========================================================================
+// virtual
+Reference< XContent > SAL_CALL ResultSet::queryContent()
+ throw( RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContent( m_pImpl->m_nPos - 1 );
+
+ return Reference< XContent >();
+}
+
+//=========================================================================
+//
+// XPropertySet methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XPropertySetInfo > SAL_CALL ResultSet::getPropertySetInfo()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_xPropSetInfo.is() )
+ m_pImpl->m_xPropSetInfo
+ = new PropertySetInfo( m_pImpl->m_xSMgr,
+ aPropertyTable,
+ RESULTSET_PROPERTY_COUNT );
+ return m_pImpl->m_xPropSetInfo;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::setPropertyValue( const OUString& aPropertyName,
+ const Any& aValue )
+ throw( UnknownPropertyException,
+ PropertyVetoException,
+ IllegalArgumentException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ if ( !aPropertyName.getLength() )
+ throw UnknownPropertyException();
+
+ if ( aPropertyName.equals(
+ OUString::createFromAscii( "RowCount" ) ) )
+ {
+ // property is read-only.
+ throw IllegalArgumentException();
+ }
+ else if ( aPropertyName.equals(
+ OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ {
+ // property is read-only.
+ throw IllegalArgumentException();
+ }
+ else
+ {
+ throw UnknownPropertyException();
+ }
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL ResultSet::getPropertyValue( const OUString& PropertyName )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ if ( !PropertyName.getLength() )
+ throw UnknownPropertyException();
+
+ Any aValue;
+
+ if ( PropertyName.equals(
+ OUString::createFromAscii( "RowCount" ) ) )
+ {
+ aValue <<= m_pImpl->m_xDataSupplier->currentCount();
+ }
+ else if ( PropertyName.equals(
+ OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ {
+ aValue <<= m_pImpl->m_xDataSupplier->isCountFinal();
+ }
+ else
+ {
+ throw UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addPropertyChangeListener(
+ const OUString& aPropertyName,
+ const Reference< XPropertyChangeListener >& xListener )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ // Note: An empty property name means a listener for "all" properties.
+
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( aPropertyName.getLength() &&
+ !aPropertyName.equals(
+ OUString::createFromAscii( "RowCount" ) ) &&
+ !aPropertyName.equals(
+ OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ throw UnknownPropertyException();
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners
+ = new PropertyChangeListeners( m_pImpl->m_aMutex );
+
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ aPropertyName, xListener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removePropertyChangeListener(
+ const OUString& aPropertyName,
+ const Reference< XPropertyChangeListener >& xListener )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( aPropertyName.getLength() &&
+ !aPropertyName.equals(
+ OUString::createFromAscii( "RowCount" ) ) &&
+ !aPropertyName.equals(
+ OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ throw UnknownPropertyException();
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ aPropertyName, xListener );
+
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addVetoableChangeListener(
+ const OUString& PropertyName,
+ const Reference< XVetoableChangeListener >& aListener )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ // No constrained props. at the moment.
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removeVetoableChangeListener(
+ const OUString& PropertyName,
+ const Reference< XVetoableChangeListener >& aListener )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ // No constrained props. at the moment.
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void ResultSet::propertyChanged( const PropertyChangeEvent& rEvt )
+{
+// osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ // Notify listeners interested especially in the changed property.
+ OInterfaceContainerHelper* pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer(
+ rEvt.PropertyName );
+ if ( pPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ Reference< XPropertyChangeListener > xListener(
+ aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertyChange( rEvt );
+ }
+ }
+
+ // Notify listeners interested in all properties.
+ pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer( OUString() );
+ if ( pPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ Reference< XPropertyChangeListener > xListener(
+ aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertyChange( rEvt );
+ }
+ }
+}
+
+//=========================================================================
+void ResultSet::rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew )
+{
+ VOS_ENSURE( nOld < nNew, "ResultSet::rowCountChanged - nOld >= nNew!" );
+
+// osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ propertyChanged(
+ PropertyChangeEvent( static_cast< OWeakObject * >( this ),
+ OUString::createFromAscii( "RowCount" ),
+ sal_False,
+ 1001,
+ makeAny( nOld ), // old value
+ makeAny( nNew ) ) ); // new value
+}
+
+//=========================================================================
+void ResultSet::rowCountFinal()
+{
+// osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ propertyChanged(
+ PropertyChangeEvent( static_cast< OWeakObject * >( this ),
+ OUString::createFromAscii( "IsRowCountFinal" ),
+ sal_False,
+ 1000,
+ makeAny( sal_False ), // old value
+ makeAny( sal_True ) ) ); // new value
+}
+
+//=========================================================================
+const Sequence< Property >& ResultSet::getProperties()
+{
+ return m_pImpl->m_aProperties;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// PropertySetInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+PropertySetInfo::PropertySetInfo(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const PropertyInfo* pProps,
+ sal_uInt32 nProps )
+: m_xSMgr( rxSMgr )
+{
+ m_pProps = new Sequence< Property >( nProps );
+
+ if ( nProps )
+ {
+ const PropertyInfo* pEntry = pProps;
+ Property* pProperties = m_pProps->getArray();
+
+ for ( sal_uInt32 n = 0; n < nProps; ++n )
+ {
+ Property& rProp = pProperties[ n ];
+
+ rProp.Name = rtl::OUString::createFromAscii( pEntry->pName );
+ rProp.Handle = pEntry->nHandle;
+ rProp.Type = pEntry->pGetCppuType();
+ rProp.Attributes = pEntry->nAttributes;
+
+ pEntry++;
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+PropertySetInfo::~PropertySetInfo()
+{
+ delete m_pProps;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( PropertySetInfo,
+ XTypeProvider,
+ XPropertySetInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( PropertySetInfo,
+ XTypeProvider,
+ XPropertySetInfo );
+
+//=========================================================================
+//
+// XPropertySetInfo methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< Property > SAL_CALL PropertySetInfo::getProperties()
+ throw( RuntimeException )
+{
+ return Sequence< Property >( *m_pProps );
+}
+
+//=========================================================================
+// virtual
+Property SAL_CALL PropertySetInfo::getPropertyByName( const OUString& aName )
+ throw( UnknownPropertyException, RuntimeException )
+{
+ Property aProp;
+ if ( queryProperty( aName, aProp ) )
+ return aProp;
+
+ throw UnknownPropertyException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName( const OUString& Name )
+ throw( RuntimeException )
+{
+ Property aProp;
+ return queryProperty( Name, aProp );
+}
+
+//=========================================================================
+sal_Bool PropertySetInfo::queryProperty(
+ const OUString& aName, Property& rProp )
+{
+ sal_uInt32 nCount = m_pProps->getLength();
+ const Property* pProps = m_pProps->getConstArray();
+ for ( sal_uInt32 n = 0; n < nCount; ++n )
+ {
+ const Property& rCurr = pProps[ n ];
+ if ( rCurr.Name == aName )
+ {
+ rProp = rCurr;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
diff --git a/ucbhelper/source/provider/resultsethelper.cxx b/ucbhelper/source/provider/resultsethelper.cxx
new file mode 100644
index 000000000000..eaaad700aaa5
--- /dev/null
+++ b/ucbhelper/source/provider/resultsethelper.cxx
@@ -0,0 +1,369 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultsethelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ - This implementation is far away from completion. It has no interface
+ for changes notifications etc.
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_UCB_LISTACTIONTYPE_HPP_
+#include <com/sun/star/ucb/ListActionType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_WELCOMEDYNAMICRESULTSETSTRUCT_HPP_
+#include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCACHEDDYNAMICRESULTSETSTUBFACTORY_HPP_
+#include <com/sun/star/ucb/XCachedDynamicResultSetStubFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XSOURCEINITIALIZATION_HPP_
+#include <com/sun/star/ucb/XSourceInitialization.hpp>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+#ifndef _UCBHELPER_RESULTSETHELPER_HXX
+#include <ucbhelper/resultsethelper.hxx>
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace cppu;
+using namespace rtl;
+using namespace ucb;
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSetImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+#define RESULTSETHELPER_INIT() \
+ m_xSMgr( rxSMgr ), \
+ m_pDisposeEventListeners( 0 ), \
+ m_bInitDone( sal_False ), \
+ m_bStatic( sal_False )
+
+//=========================================================================
+ResultSetImplHelper::ResultSetImplHelper(
+ const Reference< XMultiServiceFactory >& rxSMgr )
+: RESULTSETHELPER_INIT()
+{
+}
+
+//=========================================================================
+ResultSetImplHelper::ResultSetImplHelper(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const OpenCommandArgument2& rCommand )
+: RESULTSETHELPER_INIT(),
+ m_aCommand( rCommand )
+{
+}
+
+//=========================================================================
+// virtual
+ResultSetImplHelper::~ResultSetImplHelper()
+{
+ delete m_pDisposeEventListeners;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_4( ResultSetImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent, /* base of XDynamicResultSet */
+ XDynamicResultSet );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( ResultSetImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XDynamicResultSet );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+XSERVICEINFO_NOFACTORY_IMPL_1( ResultSetImplHelper,
+ OUString::createFromAscii( "ResultSetImplHelper" ),
+ OUString::createFromAscii( DYNAMICRESULTSET_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSetImplHelper::dispose()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XComponent * >( this );
+ m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::addEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pDisposeEventListeners )
+ m_pDisposeEventListeners = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::removeEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pDisposeEventListeners )
+ m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XDynamicResultSet methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XResultSet > SAL_CALL ResultSetImplHelper::getStaticResultSet()
+ throw( ListenerAlreadySetException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_xListener.is() )
+ throw ListenerAlreadySetException();
+
+ init( sal_True );
+ return m_xResultSet1;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::setListener(
+ const Reference< XDynamicResultSetListener >& Listener )
+ throw( ListenerAlreadySetException, RuntimeException )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_bStatic || m_xListener.is() )
+ throw ListenerAlreadySetException();
+
+ m_xListener = Listener;
+
+ //////////////////////////////////////////////////////////////////////
+ // Create "welcome event" and send it to listener.
+ //////////////////////////////////////////////////////////////////////
+
+ // Note: We only have the implementation for a static result set at the
+ // moment (src590). The dynamic result sets passed to the listener
+ // are a fake. This implementation will never call "notify" at the
+ // listener to propagate any changes!!!
+
+ init( sal_False );
+
+ Any aInfo;
+ aInfo <<= WelcomeDynamicResultSetStruct( m_xResultSet1 /* "old" */,
+ m_xResultSet2 /* "new" */ );
+
+ Sequence< ListAction > aActions( 1 );
+ aActions.getArray()[ 0 ] = ListAction( 0, // Position; not used
+ 0, // Count; not used
+ ListActionType::WELCOME,
+ aInfo );
+ aGuard.clear();
+
+ Listener->notify(
+ ListEvent( static_cast< OWeakObject * >( this ), aActions ) );
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL ResultSetImplHelper::getCapabilities()
+ throw( RuntimeException )
+{
+ // ! ContentResultSetCapability::SORTED
+ return 0;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::connectToCache(
+ const Reference< XDynamicResultSet > & xCache )
+ throw( ListenerAlreadySetException,
+ AlreadyInitializedException,
+ ServiceNotFoundException,
+ RuntimeException )
+{
+ if ( m_xListener.is() )
+ throw ListenerAlreadySetException();
+
+ if ( m_bStatic )
+ throw ListenerAlreadySetException();
+
+ Reference< XSourceInitialization > xTarget( xCache, UNO_QUERY );
+ if ( xTarget.is() )
+ {
+ Reference< XCachedDynamicResultSetStubFactory > xStubFactory(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.CachedDynamicResultSetStubFactory" ) ),
+ UNO_QUERY );
+ if ( xStubFactory.is() )
+ {
+ xStubFactory->connectToCache(
+ this, xCache, m_aCommand.SortingInfo, 0 );
+ return;
+ }
+ }
+ throw ServiceNotFoundException();
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void ResultSetImplHelper::init( sal_Bool bStatic )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_bInitDone )
+ {
+ if ( bStatic )
+ {
+ // virtual... derived class fills m_xResultSet1
+ initStatic();
+
+ VOS_ENSURE( m_xResultSet1.is(),
+ "ResultSetImplHelper::init - No 1st result set!" );
+ m_bStatic = sal_True;
+ }
+ else
+ {
+ // virtual... derived class fills m_xResultSet1 and m_xResultSet2
+ initDynamic();
+
+ VOS_ENSURE( m_xResultSet1.is(),
+ "ResultSetImplHelper::init - No 1st result set!" );
+ VOS_ENSURE( m_xResultSet2.is(),
+ "ResultSetImplHelper::init - No 2nd result set!" );
+ m_bStatic = sal_False;
+ }
+ m_bInitDone = sal_True;
+ }
+
+}
+
+/*
+
+pure virtual
+
+//=========================================================================
+// virtual
+void ResultSetImplHelper::initStatic()
+{
+}
+
+//=========================================================================
+// virtual
+void ResultSetImplHelper::initDynamic()
+{
+}
+
+*/
+
diff --git a/ucbhelper/source/provider/resultsetmetadata.cxx b/ucbhelper/source/provider/resultsetmetadata.cxx
new file mode 100644
index 000000000000..8647ea0c60e0
--- /dev/null
+++ b/ucbhelper/source/provider/resultsetmetadata.cxx
@@ -0,0 +1,588 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultsetmetadata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ - Search for @@@ in this file to find out what's to do
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include <com/sun/star/sdbc/DataType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XARRAY_HPP_
+#include <com/sun/star/sdbc/XArray.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XBLOB_HPP_
+#include <com/sun/star/sdbc/XBlob.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCLOB_HPP_
+#include <com/sun/star/sdbc/XClob.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XREF_HPP_
+#include <com/sun/star/sdbc/XRef.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_
+#include <com/sun/star/util/Date.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_
+#include <com/sun/star/util/Time.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
+#include <com/sun/star/util/DateTime.hpp>
+#endif
+
+#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
+#include <ucbhelper/resultsetmetadata.hxx>
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace rtl;
+using namespace ucb;
+
+namespace ucb
+{
+
+struct ResultSetMetaData_Impl
+{
+ osl::Mutex m_aMutex;
+ sal_Bool m_bObtainedTypes;
+
+ ResultSetMetaData_Impl() : m_bObtainedTypes( sal_False ) {}
+};
+
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSetMetaData Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ResultSetMetaData::ResultSetMetaData(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProps,
+ sal_Bool bReadOnly )
+: m_pImpl( new ResultSetMetaData_Impl ),
+ m_xSMgr( rxSMgr ),
+ m_aProps( rProps ),
+ m_bReadOnly( bReadOnly )
+{
+}
+
+//=========================================================================
+// virtual
+ResultSetMetaData::~ResultSetMetaData()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( ResultSetMetaData,
+ XTypeProvider,
+ XResultSetMetaData );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( ResultSetMetaData,
+ XTypeProvider,
+ XResultSetMetaData );
+
+//=========================================================================
+//
+// XResultSetMetaData methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnCount()
+ throw( SQLException, RuntimeException )
+{
+ return m_aProps.getLength();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isAutoIncrement( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether column is automatically numbered, which makes it
+ read-only.
+ */
+
+ return m_bReadOnly;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isCaseSensitive( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ // @@@
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether the value stored in column can be used in a
+ WHERE clause.
+ */
+
+ // @@@
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether column is a cash value.
+ */
+
+ // @@@
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether a NULL can be stored in column.
+ Possible values: see com/sun/star/sdbc/ColumnValue.idl
+ */
+
+ // All columns may contain NULL. Think of result sets containing
+ // UCB contents of different types...
+ return ColumnValue::NULLABLE;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether the value stored in column is a signed number.
+ */
+
+ // @@@
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the normal maximum width in characters for column.
+ */
+
+ // @@@
+ return 16;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnLabel( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the suggested column title for column, to be used in print-
+ outs and displays.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_aProps.getConstArray()[ column - 1 ].Name;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the name of column.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_aProps.getConstArray()[ column - 1 ].Name;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the schema name for the table from which column of this
+ result set was derived.
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ For number types, getprecision gets the number of decimal digits
+ in column.
+ For character types, it gets the maximum length in characters for
+ column.
+ For binary types, it gets the maximum length in bytes for column.
+ */
+
+ // @@@
+ return -1;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the number of digits to the right of the decimal point for
+ values in column.
+ */
+
+ // @@@
+ return 0;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getTableName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the name of the table from which column of this result set
+ was derived or "" if there is none (for example, for a join).
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getCatalogName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the catalog name for the table from which column of this
+ result set was derived.
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnType( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the JDBC type for the value stored in column. ... The STRUCT
+ and DISTINCT type codes are always returned for structured and
+ distinct types, regardless of whether the value will be mapped
+ according to the standard mapping or be a custom mapping.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return DataType::SQLNULL;
+
+ if ( m_aProps.getConstArray()[ column - 1 ].Type
+ == getCppuVoidType() )
+ {
+ // No type given. Try UCB's Properties Manager...
+
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_bObtainedTypes )
+ {
+ try
+ {
+ Reference< XPropertySetInfo > xInfo(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.PropertiesManager" ) ),
+ UNO_QUERY );
+ if ( xInfo.is() )
+ {
+#if 0
+ // Convenient...
+
+ sal_Int32 nCount = m_pImpl->m_aProps.getLength();
+ Property* pProps = m_pImpl->m_aProps.getArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ try
+ {
+ Property aProp
+ = xInfo->getPropertyByName( rProp.Name );
+ rProp.Type = aProp.Type;
+ }
+ catch ( UnknownPropertyException& )
+ {
+ // getPropertyByName
+ }
+ }
+#else
+ // Less (remote) calls...
+
+ Sequence< Property > aProps = xInfo->getProperties();
+ const Property* pProps1 = aProps.getConstArray();
+ sal_Int32 nCount1 = aProps.getLength();
+
+ sal_Int32 nCount = m_aProps.getLength();
+ Property* pProps = m_aProps.getArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ for ( sal_Int32 m = 0; m < nCount1; ++m )
+ {
+ const Property& rProp1 = pProps1[ m ];
+ if ( rProp.Name == rProp1.Name )
+ {
+ // Found...
+ rProp.Type = rProp1.Type;
+ break;
+ }
+ }
+ }
+#endif
+ }
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ // createInstance
+ }
+
+ m_pImpl->m_bObtainedTypes = sal_True;
+ }
+ }
+
+ const Type& rType = m_aProps.getConstArray()[ column - 1 ].Type;
+ sal_Int32 nType = DataType::OTHER;
+
+ if ( rType == getCppuType( static_cast< const rtl::OUString * >( 0 ) ) )
+ nType = DataType::VARCHAR; // XRow::getString
+ else if ( rType == getCppuBooleanType() )
+ nType = DataType::BIT; // XRow::getBoolean
+ else if ( rType == getCppuType( static_cast< const sal_Int32 * >( 0 ) ) )
+ nType = DataType::INTEGER; // XRow::getInt
+ else if ( rType == getCppuType( static_cast< const sal_Int64 * >( 0 ) ) )
+ nType = DataType::BIGINT; // XRow::getLong
+ else if ( rType == getCppuType( static_cast< const sal_Int16 * >( 0 ) ) )
+ nType = DataType::SMALLINT; // XRow::getShort
+ else if ( rType == getCppuType( static_cast< const sal_Int8 * >( 0 ) ) )
+ nType = DataType::TINYINT; // XRow::getByte
+ else if ( rType == getCppuType( static_cast< const float * >( 0 ) ) )
+ nType = DataType::REAL; // XRow::getFloat
+ else if ( rType == getCppuType( static_cast< const double * >( 0 ) ) )
+ nType = DataType::DOUBLE; // XRow::getDouble
+ else if ( rType == getCppuType( static_cast< const Sequence< sal_Int8 > * >( 0 ) ) )
+ nType = DataType::VARBINARY;// XRow::getBytes
+ else if ( rType == getCppuType( static_cast< const Date * >( 0 ) ) )
+ nType = DataType::DATE; // XRow::getDate
+ else if ( rType == getCppuType( static_cast< const Time * >( 0 ) ) )
+ nType = DataType::TIME; // XRow::getTime
+ else if ( rType == getCppuType( static_cast< const DateTime * >( 0 ) ) )
+ nType = DataType::TIMESTAMP;// XRow::getTimestamp
+ else if ( rType == getCppuType( static_cast< Reference< XInputStream > * >( 0 ) ) )
+ nType = DataType::LONGVARBINARY; // XRow::getBinaryStream
+// nType = DataType::LONGVARCHAR; // XRow::getCharacterStream
+ else if ( rType == getCppuType( static_cast< Reference< XClob > * >( 0 ) ) )
+ nType = DataType::CLOB; // XRow::getClob
+ else if ( rType == getCppuType( static_cast< Reference< XBlob > * >( 0 ) ) )
+ nType = DataType::BLOB; // XRow::getBlob
+ else if ( rType == getCppuType( static_cast< Reference< XArray > * >( 0 ) ) )
+ nType = DataType::ARRAY;// XRow::getArray
+ else if ( rType == getCppuType( static_cast< Reference< XRef > * >( 0 ) ) )
+ nType = DataType::REF;// XRow::getRef
+ else
+ nType = DataType::OBJECT;// XRow::getObject
+
+ return nType;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the type name used by this particular data source for the
+ values stored in column. If the type code for the type of value
+ stored in column is STRUCT, DISTINCT or JAVA_OBJECT, this method
+ returns a fully-qualified SQL type name.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ // @@@ According to DG, the type name may be empty.
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ // ContentResultSet's are completely read-only.
+ return m_bReadOnly;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ // ContentResultSet's are completely read-only.
+ return !m_bReadOnly;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isDefinitelyWritable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ // ContentResultSet's are completely read-only.
+ return !m_bReadOnly;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnServiceName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Returns the fully-qualified name of the service whose instances
+ are manufactured if XResultSet::getObject is called to retrieve
+ a value from the column.
+ */
+
+ return OUString();
+}
+
diff --git a/ucbhelper/util/makefile.mk b/ucbhelper/util/makefile.mk
new file mode 100644
index 000000000000..99cbd547028e
--- /dev/null
+++ b/ucbhelper/util/makefile.mk
@@ -0,0 +1,127 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME= ucbhelper
+TARGET= ucbhelper
+NO_BSYMBOLIC= TRUE
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.INCLUDE : ..$/version.mk
+
+# --- Files --------------------------------------------------------
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1FILES= $(SLB)$/client.lib \
+ $(SLB)$/provider.lib
+
+SHL1TARGET= $(TARGET)$(UCBHELPER_MAJOR)$(COM)
+SHL1STDLIBS= $(SALLIB) \
+ $(VOSLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB)
+SHL1DEPN=
+SHL1IMPLIB= i$(TARGET)
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt
+DEFLIB1NAME= $(TARGET)
+DEF1DES= Universal Content Broker - Helpers
+#DEF1EXPORT1= createComponentFactory
+#DEF1EXPORT2= writeComponentInfo
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# --- Filter -----------------------------------------------------------
+
+$(MISC)$/$(SHL1TARGET).flt : ucbhelper.flt
+ @echo ------------------------------
+ @echo Making: $@
+ @+$(TYPE) ucbhelper.flt > $@
+.IF "$(COM)"=="MSC"
+ @echo __CT>>$@
+ @echo ??_5>>$@
+ @echo ??_7>>$@
+ @echo ??_8>>$@
+ @echo ??_9>>$@
+ @echo ??_C>>$@
+ @echo ??_E>>$@
+ @echo ??_F>>$@
+ @echo ??_G>>$@
+ @echo ??_H>>$@
+ @echo ??_I>>$@
+.ENDIF # MSC
+.IF "$(GUI)"=="WNT"
+ @echo ?CreateType@>>$@
+.ENDIF # WNT
+
diff --git a/ucbhelper/util/ucbhelper.flt b/ucbhelper/util/ucbhelper.flt
new file mode 100644
index 000000000000..f28f925efc90
--- /dev/null
+++ b/ucbhelper/util/ucbhelper.flt
@@ -0,0 +1,13 @@
+_Impl
+IMP
+Dbg
+DLL
+getCppuType
+cpp_queryInterface
+cpp_acquire
+cpp_release
+_aType
+unnamed
+?queryInterface@ContentIdentifier@ucb@@WBA@AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z
+?queryInterface@ContentIdentifier@ucb@@WM@AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z
+?queryInterface@cppu@@YA?AVAny@uno@star@sun@com@@ABVType@3456@PAVXTypeProvider@lang@456@PAVXContentIdentifier@ucb@456@@Z
diff --git a/ucbhelper/version.mk b/ucbhelper/version.mk
new file mode 100644
index 000000000000..de31697a55b8
--- /dev/null
+++ b/ucbhelper/version.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# $RCSfile: version.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+UCBHELPER_TARGET=ucbhelper
+
+# the major
+UCBHELPER_MAJOR=1
+# the minor
+UCBHELPER_MINOR=0
+# the micro
+UCBHELPER_MICRO=0
+
+# this is a c++ compatible library
+UCBHELPER_CPP=1
+
+UCBHELPER=$(UCBHELPER_TARGET)_$(CMPEXT)
+
+LIBUCBHELPER_UNX=lib$(UCBHELPER).a.$(UCBHELPER_MAJOR)
+LIBUCBHELPER_WIN=$(UCBHELPER_TARGET)$(UCBHELPER_MAJOR)$(CMPEXT).dll
diff --git a/ucbhelper/workben/myucp/exports.map b/ucbhelper/workben/myucp/exports.map
new file mode 100644
index 000000000000..14a2531f23ad
--- /dev/null
+++ b/ucbhelper/workben/myucp/exports.map
@@ -0,0 +1,8 @@
+VERS_1_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/ucbhelper/workben/myucp/makefile.mk b/ucbhelper/workben/myucp/makefile.mk
new file mode 100644
index 000000000000..06117e001ed7
--- /dev/null
+++ b/ucbhelper/workben/myucp/makefile.mk
@@ -0,0 +1,132 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+# @@@ UCP Version - Increase, if your UCP libraray becomes incompatible.
+UCP_VERSION=1
+
+# @@@ Name for your UCP. Will become part of the library name (See below).
+UCP_NAME=myucp
+
+# @@@ Relative path to project root.
+PRJ=..$/..
+
+# @@@ Name of the project your UCP code recides it.
+PRJNAME=UCBHELPER
+
+TARGET=ucp$(UCP_NAME)
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+NO_BSYMBOLIC=TRUE
+
+# --- Settings ---------------------------------------------------------
+
+.INCLUDE: svpre.mk
+.INCLUDE: settings.mk
+.INCLUDE: sv.mk
+
+# --- General -----------------------------------------------------
+
+# @@@ Adjust template file names. Add own files here.
+SLOFILES=\
+ $(SLO)$/myucp_services.obj \
+ $(SLO)$/myucp_provider.obj \
+ $(SLO)$/myucp_content.obj \
+ $(SLO)$/myucp_contentcaps.obj
+
+# You need these only if you implement a folder content,
+# which supports the command "open" returning a result set.
+# $(SLO)$/myucp_resultset.obj
+# $(SLO)$/myucp_datasupplier.obj
+
+LIB1TARGET=$(SLB)$/_$(TARGET).lib
+LIB1OBJFILES=$(SLOFILES)
+
+# --- Shared-Library ---------------------------------------------------
+
+SHL1TARGET=$(TARGET)$(UCP_VERSION)
+SHL1IMPLIB=i$(TARGET)
+SHL1VERSIONMAP=exports.map
+
+# @@@ Add additional libs here.
+SHL1STDLIBS=\
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(UCBHELPERLIB)
+
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+SHL1LIBS=$(LIB1TARGET)
+
+# --- Def-File ---------------------------------------------------------
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# @@@ A description string for you UCP.
+DEF1DES=UCB Content Provider
+
+# --- Targets ----------------------------------------------------------
+
+.INCLUDE: target.mk
+
diff --git a/ucbhelper/workben/myucp/myucp_content.cxx b/ucbhelper/workben/myucp/myucp_content.cxx
new file mode 100644
index 000000000000..938dec90661d
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_content.cxx
@@ -0,0 +1,805 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_content.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPERSISTENTPROPERTYSET_HPP_
+#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
+#include <ucbhelper/propertyvalueset.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_PROVIDER_HXX
+#include "myucp_provider.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+//#ifndef _MYUCP_RESULTSET_HXX
+//#include "myucp_resultset.hxx"
+//#endif
+
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace cppu;
+using namespace rtl;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//=========================================================================
+//
+// Content Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+Content::Content( const Reference< XMultiServiceFactory >& rxSMgr,
+ ::ucb::ContentProviderImplHelper* pProvider,
+ const Reference< XContentIdentifier >& Identifier )
+: ContentImplHelper( rxSMgr, pProvider, Identifier )
+{
+ // @@@ Fill m_aProps here or implement lazy evaluation logic for this.
+ // m_aProps.aTitle =
+ // m_aprops.aContentType =
+ // m_aProps.bIsDocument =
+ // m_aProps.bIsFolder =
+}
+
+//=========================================================================
+// virtual
+Content::~Content()
+{
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL Content::acquire()
+ throw( RuntimeException )
+{
+ ContentImplHelper::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL Content::release()
+ throw( RuntimeException )
+{
+ ContentImplHelper::release();
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL Content::queryInterface( const Type & rType )
+ throw ( RuntimeException )
+{
+ Any aRet;
+
+ // @@@ Add support for additional interfaces.
+#if 0
+ aRet = cppu::queryInterface( rType,
+ static_cast< Xxxxxxxxx * >( this ) );
+#endif
+
+ return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_COMMON_IMPL( Content );
+
+//=========================================================================
+// virtual
+Sequence< Type > SAL_CALL Content::getTypes()
+ throw( RuntimeException )
+{
+ // @@@ Add own interfaces.
+
+ static OTypeCollection* pCollection = NULL;
+
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static OTypeCollection aCollection(
+ CPPU_TYPE_REF( XTypeProvider ),
+ CPPU_TYPE_REF( XServiceInfo ),
+ CPPU_TYPE_REF( XComponent ),
+ CPPU_TYPE_REF( XContent ),
+ CPPU_TYPE_REF( XCommandProcessor ),
+ CPPU_TYPE_REF( XPropertiesChangeNotifier ),
+ CPPU_TYPE_REF( XCommandInfoChangeNotifier ),
+ CPPU_TYPE_REF( XPropertyContainer ),
+ CPPU_TYPE_REF( XPropertySetInfoChangeNotifier ),
+ CPPU_TYPE_REF( XChild ) );
+ pCollection = &aCollection;
+ }
+ }
+
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL Content::getImplementationName()
+ throw( RuntimeException )
+{
+ // @@@ Adjust implementation name.
+ return OUString::createFromAscii( "myucp_Content" );
+}
+
+//=========================================================================
+// virtual
+Sequence< OUString > SAL_CALL Content::getSupportedServiceNames()
+ throw( RuntimeException )
+{
+ // @@@ Adjust macro name.
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ]
+ = OUString::createFromAscii( MYUCP_CONTENT_SERVICE_NAME );
+ return aSNS;
+}
+
+//=========================================================================
+//
+// XContent methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL Content::getContentType()
+ throw( RuntimeException )
+{
+ // @@@ Adjust macro name ( def in myucp_provider.hxx ).
+ return OUString::createFromAscii( MYUCP_CONTENT_TYPE );
+}
+
+//=========================================================================
+//
+// XCommandProcessor methods.
+//
+//=========================================================================
+
+// virtual
+Any SAL_CALL Content::execute( const Command& aCommand,
+ sal_Int32 CommandId,
+ const Reference<
+ XCommandEnvironment >& Environment )
+ throw( Exception, CommandAbortedException, RuntimeException )
+{
+ Any aRet;
+
+ if ( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ Sequence< Property > Properties;
+ if ( !( aCommand.Argument >>= Properties ) )
+ {
+ VOS_ENSURE( sal_False, "Wrong argument type!" );
+ return Any();
+ }
+
+ aRet <<= getPropertyValues( Properties );
+ }
+ else if ( aCommand.Name.compareToAscii( "setPropertyValues" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // setPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ Sequence< PropertyValue > aProperties;
+ if ( !( aCommand.Argument >>= aProperties ) )
+ {
+ VOS_ENSURE( sal_False, "Wrong argument type!" );
+ return Any();
+ }
+
+ if ( !aProperties.getLength() )
+ {
+ VOS_ENSURE( sal_False, "No properties!" );
+ return Any();
+ }
+
+ setPropertyValues( aProperties );
+ }
+ else if ( aCommand.Name.compareToAscii( "getPropertySetInfo" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertySetInfo
+ //////////////////////////////////////////////////////////////////
+
+ // Note: Implemented by base class.
+ aRet <<= getPropertySetInfo();
+ }
+ else if ( aCommand.Name.compareToAscii( "getCommandInfo" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getCommandInfo
+ //////////////////////////////////////////////////////////////////
+
+ // Note: Implemented by base class.
+ aRet <<= getCommandInfo();
+ }
+#if 0
+ else if ( isFolder() && ( aCommand.Name.compareToAscii( "open" ) == 0 ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // open command for a folder content
+ //////////////////////////////////////////////////////////////////
+
+ OpenCommandArgument2 aOpenCommand;
+ if ( aCommand.Argument >>= aOpenCommand )
+ {
+ Reference< XDynamicResultSet > xSet
+ = new DynamicResultSet( m_xSMgr, this, aOpenCommand );
+ aRet <<= xSet;
+ }
+ else
+ {
+ VOS_ENSURE( sal_False,
+ "Content::execute - invalid parameter!" );
+ throw CommandAbortedException();
+ }
+ }
+ else if ( aCommand.Name.compareToAscii( "insert" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // insert
+ //////////////////////////////////////////////////////////////////
+
+ insert();
+ }
+ else if ( aCommand.Name.compareToAscii( "delete" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // delete
+ //////////////////////////////////////////////////////////////////
+
+ sal_Bool bDeletePhysical = sal_False;
+ aCommand.Argument >>= bDeletePhysical;
+ destroy( bDeletePhysical );
+
+ // Remove own and all childrens(!) persistent data.
+// removeData();
+ }
+#endif
+ else
+ {
+ //////////////////////////////////////////////////////////////////
+ // Unknown command
+ //////////////////////////////////////////////////////////////////
+
+ VOS_ENSURE( sal_False,
+ "Content::execute - unknown command!" );
+ throw CommandAbortedException();
+ }
+
+ return aRet;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL Content::abort( sal_Int32 CommandId )
+ throw( RuntimeException )
+{
+ // @@@ Implement logic to abort running commands, if this makes
+ // sense for your content.
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+// virtual
+OUString Content::getParentURL()
+{
+ OUString aURL = m_xIdentifier->getContentIdentifier();
+
+ // @@@ Assemble URL of parent...
+
+ return OUString();
+}
+
+//=========================================================================
+// static
+Reference< XRow > Content::getPropertyValues(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Property >& rProperties,
+ const ContentProperties& rData,
+ const vos::ORef< ucb::ContentProviderImplHelper >& rProvider,
+ const OUString& rContentId )
+{
+ // Note: Empty sequence means "get values of all supported properties".
+
+ vos::ORef< ::ucb::PropertyValueSet > xRow
+ = new ::ucb::PropertyValueSet( rSMgr );
+
+ sal_Int32 nCount = rProperties.getLength();
+ if ( nCount )
+ {
+ Reference< XPropertySet > xAdditionalPropSet;
+ sal_Bool bTriedToGetAdditonalPropSet = sal_False;
+
+ const Property* pProps = rProperties.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const Property& rProp = pProps[ n ];
+
+ // Process Core properties.
+
+ if ( rProp.Name.compareToAscii( "ContentType" ) == 0 )
+ {
+ xRow->appendString ( rProp, rData.aContentType );
+ }
+ else if ( rProp.Name.compareToAscii( "Title" ) == 0 )
+ {
+ xRow->appendString ( rProp, rData.aTitle );
+ }
+ else if ( rProp.Name.compareToAscii( "IsDocument" ) == 0 )
+ {
+ xRow->appendBoolean( rProp, rData.bIsDocument );
+ }
+ else if ( rProp.Name.compareToAscii( "IsFolder" ) == 0 )
+ {
+ xRow->appendBoolean( rProp, rData.bIsFolder );
+ }
+
+ // @@@ Process other properties supported directly.
+#if 0
+ else if ( rProp.Name.compareToAscii( "xxxxxx" ) == 0 )
+ {
+ }
+#endif
+ else
+ {
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Not a Core Property! Maybe it's an Additional Core Property?!
+
+ if ( !bTriedToGetAdditonalPropSet && !xAdditionalPropSet.is() )
+ {
+ xAdditionalPropSet
+ = Reference< XPropertySet >(
+ rProvider->getAdditionalPropertySet( rContentId,
+ sal_False ),
+ UNO_QUERY );
+ bTriedToGetAdditonalPropSet = sal_True;
+ }
+
+ if ( xAdditionalPropSet.is() )
+ {
+ if ( !xRow->appendPropertySetValue(
+ xAdditionalPropSet,
+ rProp ) )
+ {
+ // Append empty entry.
+ xRow->appendVoid( rProp );
+ }
+ }
+ else
+ {
+ // Append empty entry.
+ xRow->appendVoid( rProp );
+ }
+ }
+ }
+ }
+ else
+ {
+ // Append all Core Properties.
+ xRow->appendString (
+ Property( OUString::createFromAscii( "ContentType" ),
+ -1,
+ getCppuType( static_cast< const OUString * >( 0 ) ),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ rData.aContentType );
+ xRow->appendString (
+ Property( OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< const OUString * >( 0 ) ),
+ PropertyAttribute::BOUND ),
+ rData.aTitle );
+ xRow->appendBoolean(
+ Property( OUString::createFromAscii( "IsDocument" ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ rData.bIsDocument );
+ xRow->appendBoolean(
+ Property( OUString::createFromAscii( "IsFolder" ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ rData.bIsFolder );
+
+ // @@@ Append other properties supported directly.
+
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Append all Additional Core Properties.
+
+ Reference< XPropertySet > xSet(
+ rProvider->getAdditionalPropertySet( rContentId, sal_False ),
+ UNO_QUERY );
+ xRow->appendPropertySet( xSet );
+ }
+
+ return Reference< XRow >( xRow.getBodyPtr() );
+}
+
+//=========================================================================
+Reference< XRow > Content::getPropertyValues(
+ const Sequence< Property >& rProperties )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ return getPropertyValues( m_xSMgr,
+ rProperties,
+ m_aProps,
+ m_xProvider,
+ m_xIdentifier->getContentIdentifier() );
+}
+
+//=========================================================================
+void Content::setPropertyValues( const Sequence< PropertyValue >& rValues )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ Sequence< PropertyChangeEvent > aChanges( rValues.getLength() );
+ sal_Int32 nChanged = 0;
+
+ PropertyChangeEvent aEvent;
+ aEvent.Source = static_cast< OWeakObject * >( this );
+ aEvent.Further = sal_False;
+// aEvent.PropertyName =
+ aEvent.PropertyHandle = -1;
+// aEvent.OldValue =
+// aEvent.NewValue =
+
+ const PropertyValue* pValues = rValues.getConstArray();
+ sal_Int32 nCount = rValues.getLength();
+
+ Reference< XPersistentPropertySet > xAdditionalPropSet;
+ sal_Bool bTriedToGetAdditonalPropSet = sal_False;
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const PropertyValue& rValue = pValues[ n ];
+
+ if ( rValue.Name.compareToAscii( "ContentType" ) == 0 )
+ {
+ // Read-only property!
+ }
+ else if ( rValue.Name.compareToAscii( "IsDocument" ) == 0 )
+ {
+ // Read-only property!
+ }
+ else if ( rValue.Name.compareToAscii( "IsFolder" ) == 0 )
+ {
+ // Read-only property!
+ }
+ else if ( rValue.Name.compareToAscii( "Title" ) == 0 )
+ {
+ OUString aNewValue;
+ if ( rValue.Value >>= aNewValue )
+ {
+ if ( aNewValue != m_aProps.aTitle )
+ {
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+ m_aProps.aTitle = aNewValue;
+
+ aGuard.clear();
+
+ aEvent.PropertyName = rValue.Name;
+ aEvent.OldValue = makeAny( m_aProps.aTitle );
+ aEvent.NewValue = makeAny( aNewValue );
+
+ aChanges.getArray()[ nChanged ] = aEvent;
+ nChanged++;
+ }
+ }
+ }
+
+ // @@@ Process other properties supported directly.
+#if 0
+ else if ( rValue.Name.compareToAscii( "xxxxx" ) == 0 )
+ {
+ }
+#endif
+ else
+ {
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Not a Core Property! Maybe it's an Additional Core Property?!
+
+ if ( !bTriedToGetAdditonalPropSet && !xAdditionalPropSet.is() )
+ {
+ xAdditionalPropSet = getAdditionalPropertySet( sal_False );
+ bTriedToGetAdditonalPropSet = sal_True;
+ }
+
+ if ( xAdditionalPropSet.is() )
+ {
+ try
+ {
+ Any aOldValue = xAdditionalPropSet->getPropertyValue(
+ rValue.Name );
+ xAdditionalPropSet->setPropertyValue(
+ rValue.Name, rValue.Value );
+
+ if ( aOldValue != rValue.Value )
+ {
+ aEvent.PropertyName = rValue.Name;
+ aEvent.OldValue = aOldValue;
+ aEvent.NewValue = rValue.Value;
+
+ aChanges.getArray()[ nChanged ] = aEvent;
+ nChanged++;
+ }
+ }
+ catch ( UnknownPropertyException )
+ {
+ }
+ catch ( WrappedTargetException )
+ {
+ }
+ catch ( PropertyVetoException )
+ {
+ }
+ catch ( IllegalArgumentException )
+ {
+ }
+ }
+ }
+ }
+
+ if ( nChanged > 0 )
+ {
+ // @@@ Save changes.
+// storeData();
+
+ aGuard.clear();
+ aChanges.realloc( nChanged );
+ notifyPropertiesChange( aChanges );
+ }
+}
+
+#if 0
+//=========================================================================
+void Content::queryChildren( ::myucp::ContentRefList& rChildren )
+{
+ // @@@ Adapt method to your URL scheme...
+
+ // Obtain a list with a snapshot of all currently instanciated contents
+ // from provider and extract the contents which are direct children
+ // of this content.
+
+ ::ucb::ContentRefList aAllContents;
+ m_xProvider->queryExistingContents( aAllContents );
+
+ OUString aURL = m_xIdentifier->getContentIdentifier();
+ sal_Int32 nPos = aURL.lastIndexOf( '/' );
+
+ if ( nPos != ( aURL.getLength() - 1 ) )
+ {
+ // No trailing slash found. Append.
+ aURL += OUString::createFromAscii( "/" );
+ }
+
+ sal_Int32 nLen = aURL.getLength();
+
+ ::ucb::ContentRefList::const_iterator it = aAllContents.begin();
+ ::ucb::ContentRefList::const_iterator end = aAllContents.end();
+
+ while ( it != end )
+ {
+ ::ucb::ContentImplHelperRef xChild = (*it);
+ OUString aChildURL = xChild->getIdentifier()->getContentIdentifier();
+
+ // Is aURL a prefix of aChildURL?
+ if ( ( aChildURL.getLength() > nLen ) &&
+ ( aChildURL.compareTo( aURL, nLen ) == 0 ) )
+ {
+ sal_Int32 nPos = nLen;
+ nPos = aChildURL.indexOf( '/', nPos );
+
+ if ( ( nPos == -1 ) ||
+ ( nPos == ( aChildURL.getLength() - 1 ) ) )
+ {
+ // No further slashes / only a final slash. It's a child!
+ rChildren.push_back(
+ HierarchyContentRef(
+ static_cast< HierarchyContent * >(
+ xChild.getBodyPtr() ) ) );
+ }
+ }
+ ++it;
+ }
+}
+
+//=========================================================================
+void Content::insert()
+ throw( CommandAbortedException )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ // Check, if all required properties were set.
+ if ( m_aProps.xxxx == yyyyy )
+ {
+ VOS_ENSURE( sal_False, "Content::insert - property value missing!" );
+ throw CommandAbortedException();
+ }
+
+ // Assemble new content identifier...
+
+ Reference< XContentIdentifier > xId = ...;
+ if ( !xId.is() )
+ throw CommandAbortedException();
+
+ // Fail, if a content with given id already exists.
+ if ( hasData( xId ) )
+ throw CommandAbortedException();
+
+ m_xIdentifier = xId;
+
+// @@@
+// storeData();
+
+ aGuard.clear();
+ inserted();
+}
+
+//=========================================================================
+void Content::destroy( sal_Bool bDeletePhysical )
+ throw( CommandAbortedException )
+{
+ // @@@ take care about bDeletePhysical -> trashcan support
+
+ Reference< XContent > xThis = this;
+
+ deleted();
+
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ // Process instanciated children...
+
+ ::myucp::ContentRefList aChildren;
+ queryChildren( aChildren );
+
+ ContentRefList::const_iterator it = aChildren.begin();
+ ContentRefList::const_iterator end = aChildren.end();
+
+ while ( it != end )
+ {
+ (*it)->destroy( bDeletePhysical );
+ ++it;
+ }
+}
+#endif
+
diff --git a/ucbhelper/workben/myucp/myucp_content.hxx b/ucbhelper/workben/myucp/myucp_content.hxx
new file mode 100644
index 000000000000..cef039ec6ffa
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_content.hxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_content.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_CONTENT_HXX
+#define _MYUCP_CONTENT_HXX
+
+#ifndef __LIST__
+#include <stl/list>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct Property;
+ struct PropertyValue;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace sdbc {
+ class XRow;
+} } } }
+
+// @@@ Adjust namespace name.
+namespace myucp
+{
+
+//=========================================================================
+
+// @@@ Adjust service name.
+
+// UNO service name for the content.
+#define MYUCP_CONTENT_SERVICE_NAME \
+ "com.sun.star.ucb.MyContent"
+
+//=========================================================================
+
+struct ContentProperties
+{
+ ::rtl::OUString aTitle; // Title
+ ::rtl::OUString aContentType; // ContentType
+ sal_Bool bIsDocument; // IsDocument
+ sal_Bool bIsFolder; // IsFolder
+
+ // @@@ Add other properties supported by your content.
+
+ ContentProperties()
+ : bIsDocument( sal_False ), bIsFolder( sal_True ) {}
+};
+
+//=========================================================================
+
+class Content : public ::ucb::ContentImplHelper
+{
+ ContentProperties m_aProps;
+
+private:
+ virtual const ::ucb::PropertyInfoTableEntry& getPropertyInfoTable();
+ virtual const ::ucb::CommandInfoTableEntry& getCommandInfoTable();
+ 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 );
+ void setPropertyValues(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rValues );
+
+// typedef vos::ORef< HierarchyContent > HierarchyContentRef;
+// typedef std::list< HierarchyContentRef > HierarchyContentRefList;
+// void queryChildren( HierarchyContentRefList& rChildren );
+
+// // Command "insert"
+// void insert()
+// throw( ::com::sun::star::ucb::CommandAbortedException );
+
+// // Command "delete"
+// void destroy( sal_Bool bDeletePhysical )
+// throw( ::com::sun::star::ucb::CommandAbortedException );
+
+public:
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ ::ucb::ContentProviderImplHelper* pProvider,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier );
+ virtual ~Content();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // 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 );
+
+ //////////////////////////////////////////////////////////////////////
+ // Additional interfaces
+ //////////////////////////////////////////////////////////////////////
+
+ // Add additional interfaces ( like com::sun:.star::ucb::XContentCreator ).
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ // Called from resultset data supplier.
+ 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,
+ const ::vos::ORef< ::ucb::ContentProviderImplHelper >&
+ rProvider,
+ const ::rtl::OUString& rContentId );
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_contentcaps.cxx b/ucbhelper/workben/myucp/myucp_contentcaps.cxx
new file mode 100644
index 000000000000..8feff8e28cda
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_contentcaps.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_contentcaps.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::ucb;
+using namespace rtl;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//
+// Content implementation.
+//
+//=========================================================================
+
+//=========================================================================
+//
+// IMPORTENT: If any property data ( name / type / ... ) are changed, then
+// Content::getPropertyValues(...) must be adapted too!
+//
+//=========================================================================
+
+// virtual
+const ::ucb::PropertyInfoTableEntry& Content::getPropertyInfoTable()
+{
+ // @@@ Add additional properties...
+
+ // @@@ Note: If your data source supports adding/removing properties,
+ // you should implement the interface XPropertyContainer
+ // by yourself and supply your own logic here. The base class
+ // uses the service "com.sun.star.ucb.Store" to maintain
+ // Additional Core properties. But using server functionality
+ // is preferred! In fact you should return a table conatining
+ // even that dynamicly added properties.
+
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ //=================================================================
+ //
+ // Supported properties
+ //
+ //=================================================================
+
+ static ::ucb::PropertyInfoTableEntry aPropertyInfoTable[] =
+ {
+ ///////////////////////////////////////////////////////////////
+ // Required properties
+ ///////////////////////////////////////////////////////////////
+ {
+ "ContentType",
+ -1,
+ &getCppuType( static_cast< const OUString * >( 0 ) ),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ },
+ {
+ "IsDocument",
+ -1,
+ &getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ },
+ {
+ "IsFolder",
+ -1,
+ &getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ },
+ {
+ "Title",
+ -1,
+ &getCppuType( static_cast< const OUString * >( 0 ) ),
+ PropertyAttribute::BOUND
+ },
+ ///////////////////////////////////////////////////////////////
+ // Optional standard properties
+ ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // New properties
+ ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // EOT
+ ///////////////////////////////////////////////////////////////
+ {
+ 0, // name
+ 0, // handle
+ 0, // type
+ 0 // attributes
+ }
+ };
+ return *aPropertyInfoTable;
+}
+
+//=========================================================================
+// virtual
+const ::ucb::CommandInfoTableEntry& Content::getCommandInfoTable()
+{
+ // @@@ Add additional commands...
+
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ //=================================================================
+ //
+ // Supported commands
+ //
+ //=================================================================
+
+ static ::ucb::CommandInfoTableEntry aCommandInfoTable[] =
+ {
+ ///////////////////////////////////////////////////////////////
+ // Required commands
+ ///////////////////////////////////////////////////////////////
+ {
+ "getCommandInfo",
+ -1,
+ &getCppuVoidType()
+ },
+ {
+ "getPropertySetInfo",
+ -1,
+ &getCppuVoidType()
+ },
+ {
+ "getPropertyValues",
+ -1,
+ &getCppuType( static_cast< Sequence< Property > * >( 0 ) )
+ },
+ {
+ "setPropertyValues",
+ -1,
+ &getCppuType( static_cast< Sequence< PropertyValue > * >( 0 ) )
+ },
+ ///////////////////////////////////////////////////////////////
+ // Optional standard commands
+ ///////////////////////////////////////////////////////////////
+#if 0
+ {
+ "delete",
+ -1,
+ &getCppuBooleanType()
+ },
+ {
+ "insert",
+ -1,
+ &getCppuVoidType()
+ },
+ {
+ "open",
+ -1,
+ &getCppuType( static_cast< OpenCommandArgument2 * >( 0 ) )
+ },
+#endif
+ ///////////////////////////////////////////////////////////////
+ // New commands
+ ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // EOT
+ ///////////////////////////////////////////////////////////////
+ {
+ 0, // name
+ 0, // handle
+ 0 // type
+ }
+ };
+
+ return *aCommandInfoTable;
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_datasupplier.cxx b/ucbhelper/workben/myucp/myucp_datasupplier.cxx
new file mode 100644
index 000000000000..3fc120d1f40d
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_datasupplier.cxx
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_datasupplier.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __VECTOR__
+#include <stl/vector>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#include <ucbhelper/providerhelper.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_DATASUPPLIER_HXX
+#include "myucp_datasupplier.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::sdbc;
+using namespace rtl;
+using namespace ucb;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+// @@@ Adjust namespace name.
+namespace myucp
+{
+
+//=========================================================================
+//
+// struct ResultListEntry.
+//
+//=========================================================================
+
+struct ResultListEntry
+{
+ OUString aId;
+ Reference< XContentIdentifier > xId;
+ Reference< XContent > xContent;
+ Reference< XRow > xRow;
+ const ContentProperties& rData;
+
+ ResultListEntry( const ContentProperties& rEntry ) : rData( rEntry ) {}
+};
+
+//=========================================================================
+//
+// ResultList.
+//
+//=========================================================================
+
+typedef std::vector< ResultListEntry* > ResultList;
+
+//=========================================================================
+//
+// struct DataSupplier_Impl.
+//
+//=========================================================================
+
+struct DataSupplier_Impl
+{
+ osl::Mutex m_aMutex;
+ ResultList m_aResults;
+ vos::ORef< Content > m_xContent;
+ Reference< XMultiServiceFactory > m_xSMgr;
+// @@@ The data source and an iterator for it
+// HierarchyEntry m_aFolder;
+// HierarchyEntry::iterator m_aIterator;
+ sal_Bool m_bCountFinal;
+
+ DataSupplier_Impl( const Reference< XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rContent )
+ : m_xContent( rContent ), m_xSMgr( rxSMgr ),
+// m_aFolder( rxSMgr, rContent->getIdentifier()->getContentIdentifier() ),
+ m_bCountFinal( sal_False ) {}
+ ~DataSupplier_Impl();
+};
+
+//=========================================================================
+DataSupplier_Impl::~DataSupplier_Impl()
+{
+ ResultList::const_iterator it = m_aResults.begin();
+ ResultList::const_iterator end = m_aResults.end();
+
+ while ( it != end )
+ {
+ delete (*it);
+ it++;
+ }
+}
+
+}
+
+//=========================================================================
+//=========================================================================
+//
+// DataSupplier Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+DataSupplier::DataSupplier( const Reference< XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rContent )
+: m_pImpl( new DataSupplier_Impl( rxSMgr, rContent ) )
+{
+}
+
+//=========================================================================
+// virtual
+DataSupplier::~DataSupplier()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+// virtual
+OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
+ if ( aId.getLength() )
+ {
+ // Already cached.
+ return aId;
+ }
+ }
+
+ if ( getResult( nIndex ) )
+ {
+ OUString aId
+ = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
+
+ aId += m_pImpl->m_aResults[ nIndex ]->rData.aTitle;
+
+ m_pImpl->m_aResults[ nIndex ]->aId = aId;
+ return aId;
+ }
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+Reference< XContentIdentifier > DataSupplier::queryContentIdentifier(
+ sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ Reference< XContentIdentifier > xId
+ = m_pImpl->m_aResults[ nIndex ]->xId;
+ if ( xId.is() )
+ {
+ // Already cached.
+ return xId;
+ }
+ }
+
+ OUString aId = queryContentIdentifierString( nIndex );
+ if ( aId.getLength() )
+ {
+ Reference< XContentIdentifier > xId = new ContentIdentifier( aId );
+ m_pImpl->m_aResults[ nIndex ]->xId = xId;
+ return xId;
+ }
+ return Reference< XContentIdentifier >();
+}
+
+//=========================================================================
+// virtual
+Reference< XContent > DataSupplier::queryContent( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ Reference< XContent > xContent
+ = m_pImpl->m_aResults[ nIndex ]->xContent;
+ if ( xContent.is() )
+ {
+ // Already cached.
+ return xContent;
+ }
+ }
+
+ Reference< XContentIdentifier > xId = queryContentIdentifier( nIndex );
+ if ( xId.is() )
+ {
+ try
+ {
+ Reference< XContent > xContent
+ = m_pImpl->m_xContent->getProvider()->queryContent( xId );
+ m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
+ return xContent;
+
+ }
+ catch ( IllegalIdentifierException& )
+ {
+ }
+ }
+ return Reference< XContent >();
+}
+
+//=========================================================================
+// virtual
+sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_aResults.size() > nIndex )
+ {
+ // Result already present.
+ return sal_True;
+ }
+
+ // Result not (yet) present.
+
+ if ( m_pImpl->m_bCountFinal )
+ return sal_False;
+
+ // Try to obtain result...
+
+ sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+ sal_Bool bFound = sal_False;
+ sal_uInt32 nPos = nOldCount;
+
+ // @@@ Obtain data and put it into result list...
+/*
+ while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
+ {
+ m_pImpl->m_aResults.push_back(
+ new ResultListEntry( *m_pImpl->m_aIterator ) );
+
+ if ( nPos == nIndex )
+ {
+ // Result obtained.
+ bFound = sal_True;
+ break;
+ }
+
+ nPos++;
+ }
+*/
+
+ if ( !bFound )
+ m_pImpl->m_bCountFinal = sal_True;
+
+ vos::ORef< ResultSet > xResultSet = getResultSet();
+ if ( xResultSet.isValid() )
+ {
+ // Callbacks follow!
+ aGuard.clear();
+
+ if ( nOldCount < m_pImpl->m_aResults.size() )
+ xResultSet->rowCountChanged(
+ nOldCount, m_pImpl->m_aResults.size() );
+
+ if ( m_pImpl->m_bCountFinal )
+ xResultSet->rowCountFinal();
+ }
+
+ return bFound;
+}
+
+//=========================================================================
+// virtual
+sal_uInt32 DataSupplier::totalCount()
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bCountFinal )
+ return m_pImpl->m_aResults.size();
+
+ sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+
+ // @@@ Obtain data and put it into result list...
+/*
+ while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
+ m_pImpl->m_aResults.push_back(
+ new ResultListEntry( *m_pImpl->m_aIterator ) );
+*/
+ m_pImpl->m_bCountFinal = sal_True;
+
+ vos::ORef< ResultSet > xResultSet = getResultSet();
+ if ( xResultSet.isValid() )
+ {
+ // Callbacks follow!
+ aGuard.clear();
+
+ if ( nOldCount < m_pImpl->m_aResults.size() )
+ xResultSet->rowCountChanged(
+ nOldCount, m_pImpl->m_aResults.size() );
+
+ xResultSet->rowCountFinal();
+ }
+
+ return m_pImpl->m_aResults.size();
+}
+
+//=========================================================================
+// virtual
+sal_uInt32 DataSupplier::currentCount()
+{
+ return m_pImpl->m_aResults.size();
+}
+
+//=========================================================================
+// virtual
+sal_Bool DataSupplier::isCountFinal()
+{
+ return m_pImpl->m_bCountFinal;
+}
+
+//=========================================================================
+// virtual
+Reference< XRow > DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
+ if ( xRow.is() )
+ {
+ // Already cached.
+ return xRow;
+ }
+ }
+
+ if ( getResult( nIndex ) )
+ {
+ Reference< XRow > xRow = Content::getPropertyValues(
+ m_pImpl->m_xSMgr,
+ getResultSet()->getProperties(),
+ m_pImpl->m_aResults[ nIndex ]->rData,
+ m_pImpl->m_xContent->getProvider(),
+ queryContentIdentifierString( nIndex ) );
+ m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
+ return xRow;
+ }
+
+ return Reference< XRow >();
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ m_pImpl->m_aResults[ nIndex ]->xRow = Reference< XRow >();
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::close()
+{
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::validate()
+ throw( ResultSetException )
+{
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_datasupplier.hxx b/ucbhelper/workben/myucp/myucp_datasupplier.hxx
new file mode 100644
index 000000000000..a7337d565d5f
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_datasupplier.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_datasupplier.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_DATASUPPLIER_HXX
+#define _MYUCP_DATASUPPLIER_HXX
+
+#ifndef _UCBHELPER_RESULTSET_HXX
+#include <ucbhelper/resultset.hxx>
+#endif
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+struct DataSupplier_Impl;
+class Content;
+
+class DataSupplier : public ucb::ResultSetDataSupplier
+{
+ DataSupplier_Impl* m_pImpl;
+
+public:
+ DataSupplier( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rContent );
+ 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 );
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_provider.cxx b/ucbhelper/workben/myucp/myucp_provider.cxx
new file mode 100644
index 000000000000..2e409d46191a
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_provider.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_provider.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_PROVIDER_HXX
+#include "myucp_provider.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//=========================================================================
+//
+// ContentProvider Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentProvider::ContentProvider(
+ const Reference< XMultiServiceFactory >& rSMgr )
+: ::ucb::ContentProviderImplHelper( rSMgr )
+{
+}
+
+//=========================================================================
+// virtual
+ContentProvider::~ContentProvider()
+{
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// @@@ Add own interfaces.
+XINTERFACE_IMPL_3( ContentProvider,
+ XTypeProvider,
+ XServiceInfo,
+ XContentProvider );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// @@@ Add own interfaces.
+XTYPEPROVIDER_IMPL_3( ContentProvider,
+ XTypeProvider,
+ XServiceInfo,
+ XContentProvider );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// @@@ Adjust implementation name and service name.
+XSERVICEINFO_IMPL_1( ContentProvider,
+ OUString::createFromAscii(
+ "myucp_ContentProvider" ),
+ OUString::createFromAscii(
+ MYUCP_CONTENT_PROVIDER_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// Service factory implementation.
+//
+//=========================================================================
+
+ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
+
+//=========================================================================
+//
+// XContentProvider methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XContent > SAL_CALL ContentProvider::queryContent(
+ const Reference< XContentIdentifier >& Identifier )
+ throw( IllegalIdentifierException, RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ // Check URL scheme...
+
+ OUString aScheme( OUString::createFromAscii( MYUCP_URL_SCHEME ) );
+ if ( !Identifier->getContentProviderScheme().equalsIgnoreCase( aScheme ) )
+ throw IllegalIdentifierException();
+
+ // @@@ Further id checks may go here...
+#if 0
+ if ( id-check-failes )
+ throw IllegalIdentifierException();
+#endif
+
+ // @@@ Id normalization may go here...
+#if 0
+ // Normalize URL and create new Id.
+ OUString aCanonicURL = xxxxx( Identifier->getContentIdentifier() );
+ Reference< XContentIdentifier > xCanonicId =
+ new ::ucb::ContentIdentifier( m_xSMgr, aCanonicURL );
+#else
+ Reference< XContentIdentifier > xCanonicId = Identifier;
+#endif
+
+ // Check, if a content with given id already exists...
+ Reference< XContent > xContent
+ = queryExistingContent( xCanonicId ).getBodyPtr();
+ if ( xContent.is() )
+ return xContent;
+
+ // @@@ Decision, which content implementation to instanciate may be
+ // made here ( in case you have different content classes ).
+
+ // Create a new content. Note that the content will insert itself
+ // into providers content list by calling addContent(...) from it's ctor.
+
+ xContent = new Content( m_xSMgr, this, xCanonicId );
+
+ if ( !xContent->getIdentifier().is() )
+ throw IllegalIdentifierException();
+
+ return xContent;
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_provider.hxx b/ucbhelper/workben/myucp/myucp_provider.hxx
new file mode 100644
index 000000000000..4d52c82fa7e9
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_provider.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_provider.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_PROVIDER_HXX
+#define _MYUCP_PROVIDER_HXX
+
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#include <ucbhelper/providerhelper.hxx>
+#endif
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+//=========================================================================
+
+// @@@ Adjust defines.
+
+// UNO service name for the provider. This name will be used by the UCB to
+// create instances of the provider.
+#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME \
+ "com.sun.star.ucb.MyContentProvider"
+#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 34
+
+// URL scheme. This is the scheme the provider will be able to create
+// contents for. The UCB will select the provider ( i.e. in order to create
+// contents ) according to this scheme.
+#define MYUCP_URL_SCHEME \
+ "vnd.sun.star.myucp"
+#define MYUCP_URL_SCHEME_LENGTH 24
+
+// UCB Content Type.
+#define MYUCP_CONTENT_TYPE \
+ "application/" MYUCP_URL_SCHEME "-content"
+
+//=========================================================================
+
+class ContentProvider : public ::ucb::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 );
+
+ //////////////////////////////////////////////////////////////////////
+ // Additional interfaces
+ //////////////////////////////////////////////////////////////////////
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_resultset.cxx b/ucbhelper/workben/myucp/myucp_resultset.cxx
new file mode 100644
index 000000000000..07f470972f87
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_resultset.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_resultset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ - This implementation is not a dynamic result set!!! It only implements
+ the necessary interfaces, but never recognizes/notifies changes!!!
+
+ *************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_DATASUPPLIER_HXX
+#include "myucp_datasupplier.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_RESULTSET_HXX
+#include "myucp_resultset.hxx"
+#endif
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//=========================================================================
+//
+// DynamicResultSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+DynamicResultSet::DynamicResultSet(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rxContent,
+ const OpenCommandArgument2& rCommand )
+: ResultSetImplHelper( rxSMgr, rCommand ),
+ m_xContent( rxContent )
+{
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void DynamicResultSet::initStatic()
+{
+ m_xResultSet1
+ = new ::ucb::ResultSet( m_xSMgr,
+ m_aCommand.Properties,
+ new ResultSetDataSupplier( m_xSMgr,
+ m_xContent ) );
+}
+
+//=========================================================================
+void DynamicResultSet::initDynamic()
+{
+ m_xResultSet1
+ = new ::ucb::ResultSet( m_xSMgr,
+ m_aCommand.Properties,
+ new ResultSetDataSupplier( m_xSMgr,
+ m_xContent ) );
+ m_xResultSet2 = m_xResultSet1;
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_resultset.hxx b/ucbhelper/workben/myucp/myucp_resultset.hxx
new file mode 100644
index 000000000000..e6899a26c319
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_resultset.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_resultset.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_RESULTSET_HXX
+#define _MYUCP_RESULTSET_HXX
+
+#ifndef _UCBHELPER_RESULTSETHELPER_HXX
+#include <ucbhelper/resultsethelper.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>