diff options
author | Kurt Zenker <kz@openoffice.org> | 2003-08-25 12:00:37 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2003-08-25 12:00:37 +0000 |
commit | 32ac246610afbae8ebc1cab98b86b97e1b43c36d (patch) | |
tree | 0876867b116ef099b0e2b4bddd819ecaed38ce2e /ucb/source/ucp/odma | |
parent | bfc2f99f8f1b7a3a21ed1c23ba8b18b1d8d6dcfd (diff) |
INTEGRATION: CWS abi4 (1.2.2); FILE ADDED
2003/08/21 10:55:46 abi 1.2.2.1: Retrieving odma
Diffstat (limited to 'ucb/source/ucp/odma')
-rw-r--r-- | ucb/source/ucp/odma/odma_contentcaps.cxx | 300 | ||||
-rw-r--r-- | ucb/source/ucp/odma/odma_contentprops.hxx | 127 |
2 files changed, 427 insertions, 0 deletions
diff --git a/ucb/source/ucp/odma/odma_contentcaps.cxx b/ucb/source/ucp/odma/odma_contentcaps.cxx new file mode 100644 index 0000000000..6256b133a7 --- /dev/null +++ b/ucb/source/ucp/odma/odma_contentcaps.cxx @@ -0,0 +1,300 @@ +/************************************************************************* + * + * $RCSfile: odma_contentcaps.cxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: kz $ $Date: 2003-08-25 13:00:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +/************************************************************************** + TODO + ************************************************************************** + + *************************************************************************/ + +#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_ +#include <com/sun/star/beans/Property.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_COMMANDINFO_HPP_ +#include <com/sun/star/ucb/CommandInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_INSERTCOMMANDARGUMENT_HPP_ +#include <com/sun/star/ucb/InsertCommandArgument.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_ +#include <com/sun/star/ucb/OpenCommandArgument2.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_TRANSFERINFO_HPP_ +#include <com/sun/star/ucb/TransferInfo.hpp> +#endif +#ifndef ODMA_CONTENT_HXX +#include "odma_content.hxx" +#endif + +using namespace com::sun; +using namespace com::sun::star; +using namespace odma; + +//========================================================================= +// +// Content implementation. +// +//========================================================================= + +//========================================================================= +// +// IMPORTENT: If any property data ( name / type / ... ) are changed, then +// Content::getPropertyValues(...) must be adapted too! +// +//========================================================================= + +// virtual +uno::Sequence< beans::Property > Content::getProperties( + const uno::Reference< star::ucb::XCommandEnvironment > & xEnv ) +{ + // @@@ Add additional properties... + + // @@@ Note: If your data source supports adding/removing properties, + // you should implement the interface XPropertyContainer + // by yourself and supply your own logic here. The base class + // uses the service "com.sun.star.ucb.Store" to maintain + // Additional Core properties. But using server functionality + // is preferred! In fact you should return a table conatining + // even that dynamicly added properties. + +// osl::Guard< osl::Mutex > aGuard( m_aMutex ); + + //================================================================= + // + // Supported properties + // + //================================================================= + + #define PROPERTY_COUNT 10 + + static beans::Property aPropertyInfoTable[] = + { + /////////////////////////////////////////////////////////////// + // Required properties + /////////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ), + -1, + getCppuBooleanType(), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ), + -1, + getCppuBooleanType(), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND + ), + /////////////////////////////////////////////////////////////// + // Optional standard properties + /////////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ), + -1, + getCppuType(static_cast< const com::sun::star::util::DateTime * >( 0 ) ), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ), + -1, + getCppuType(static_cast< const com::sun::star::util::DateTime * >( 0 ) ), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ), + -1, + getCppuBooleanType(), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY + ), + /////////////////////////////////////////////////////////////// + // New properties + /////////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subject" ) ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Keywords" ) ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND + ) + }; + return uno::Sequence< + beans::Property >( aPropertyInfoTable, PROPERTY_COUNT ); +} + +//========================================================================= +// virtual +uno::Sequence< star::ucb::CommandInfo > Content::getCommands( + const uno::Reference< star::ucb::XCommandEnvironment > & xEnv ) +{ + // @@@ Add additional commands... + +// osl::Guard< osl::Mutex > aGuard( m_aMutex ); + + //================================================================= + // + // Supported commands + // + //================================================================= + + #define COMMAND_COUNT 8 + + static star::ucb::CommandInfo aCommandInfoTable[] = + { + /////////////////////////////////////////////////////////////// + // Required commands + /////////////////////////////////////////////////////////////// + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ), + -1, + getCppuVoidType() + ), + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ), + -1, + getCppuVoidType() + ), + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ), + -1, + getCppuType( + static_cast< uno::Sequence< beans::Property > * >( 0 ) ) + ), + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ), + -1, + getCppuType( + static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) ) + ), + /////////////////////////////////////////////////////////////// + // Optional standard commands + /////////////////////////////////////////////////////////////// +/* + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ), + -1, + getCppuBooleanType() + ), +*/ + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ), + -1, + getCppuType( + static_cast< star::ucb::InsertCommandArgument * >( 0 ) ) + ), + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ), + -1, + getCppuType( static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) ) + ), + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "close" ) ), + -1, + getCppuVoidType( ) + ), + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), + -1, + getCppuType( static_cast< star::ucb::TransferInfo * >( 0 ) ) + ) + + /////////////////////////////////////////////////////////////// + // New commands + /////////////////////////////////////////////////////////////// + }; + + return uno::Sequence< + star::ucb::CommandInfo >( aCommandInfoTable, COMMAND_COUNT ); +} + diff --git a/ucb/source/ucp/odma/odma_contentprops.hxx b/ucb/source/ucp/odma/odma_contentprops.hxx new file mode 100644 index 0000000000..94a3b295ad --- /dev/null +++ b/ucb/source/ucp/odma/odma_contentprops.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: odma_contentprops.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: kz $ $Date: 2003-08-25 13:00: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 ODMA_CONTENTPROPS_HXX +#define ODMA_CONTENTPROPS_HXX + +#ifndef _VOS_REFERNCE_HXX_ +#include <vos/refernce.hxx> +#endif +#ifndef _VOS_REF_HXX_ +#include <vos/ref.hxx> +#endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif +#include <functional> + +namespace odma +{ + class ContentProperties : public ::vos::OReference + { + public: + com::sun::star::util::DateTime m_aDateCreated; // when was the document created + com::sun::star::util::DateTime m_aDateModified; // when was the document last modified + ::rtl::OUString m_sTitle; // Title + ::rtl::OUString m_sContentType; // ContentType + ::rtl::OString m_sDocumentId; // the document id given from the DMS + ::rtl::OUString m_sDocumentName;// document name + ::rtl::OUString m_sFileURL; // the temporary file location + ::rtl::OUString m_sAuthor; // the Author of the document + ::rtl::OUString m_sSubject; // the subject of the document + ::rtl::OUString m_sKeywords; // the keywords of the document + ::rtl::OUString m_sSavedAsName; // the name which was used to save it + sal_Bool m_bIsDocument; // IsDocument + sal_Bool m_bIsFolder; // IsFolder + sal_Bool m_bIsOpen; // is true when OpenDoc was called + sal_Bool m_bIsReadOnly; // true when the document is read-only + + // @@@ Add other properties supported by your content. + + ContentProperties() + :m_bIsDocument( sal_True ) + ,m_bIsFolder( sal_False ) + ,m_bIsOpen( sal_False ) + ,m_bIsReadOnly( sal_False ) + {} + + inline ::rtl::OUString getTitle() const { return m_sTitle; } + inline ::rtl::OUString getSavedAsName() const { return m_sSavedAsName; } + }; + typedef ::std::binary_function< ::vos::ORef<ContentProperties>, ::rtl::OUString,bool> TContentPropertiesFunctorBase; + /// binary_function Functor object for class ContentProperties return type is bool + class ContentPropertiesMemberFunctor : public TContentPropertiesFunctorBase + { + ::std::const_mem_fun_t< ::rtl::OUString,ContentProperties> m_aFunction; + public: + ContentPropertiesMemberFunctor(const ::std::const_mem_fun_t< ::rtl::OUString,ContentProperties>& _rFunc) + : m_aFunction(_rFunc){} + + inline bool operator()(const ::vos::ORef<ContentProperties>& lhs,const ::rtl::OUString& rhs) const + { + return !!(m_aFunction(lhs.getBodyPtr()) == rhs); + } + }; +} +#endif // ODMA_CONTENTPROPS_HXX + |