diff options
Diffstat (limited to 'ucbhelper/inc/ucbhelper')
-rw-r--r-- | ucbhelper/inc/ucbhelper/commandenvironment.hxx | 142 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/configureucb.hxx | 122 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/content.hxx | 760 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/contentbroker.hxx | 206 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/contenthelper.hxx | 577 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/contentidentifier.hxx | 142 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/contentinfo.hxx | 215 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/macros.hxx | 792 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/propertyvalueset.hxx | 444 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/providerhelper.hxx | 301 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/resultset.hxx | 609 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/resultsethelper.hxx | 274 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/resultsetmetadata.hxx | 345 |
13 files changed, 4929 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 */ |