diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-04-14 12:41:06 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-04-14 12:41:06 +0000 |
commit | 9dab45029a75f0a0c582ba511668868ec4e04677 (patch) | |
tree | 38807a73c1743a5e4da310845919e7a862dbd616 /ucb | |
parent | 55dd92688f376f4eb354da7130f38b871f2a081b (diff) |
INTEGRATION: CWS unopkg1 (1.1.2); FILE ADDED
2004/03/12 17:27:53 kso 1.1.2.2: #i26370# - Added support for property 'DocumentModel'
Issue number: i26370
Submitted by:
Reviewed by:
2004/01/20 15:15:13 kso 1.1.2.1: #112920# TDOC UCP: Initial revision.
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_contentcaps.cxx | 616 |
1 files changed, 616 insertions, 0 deletions
diff --git a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx new file mode 100644 index 000000000000..7493984305cc --- /dev/null +++ b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx @@ -0,0 +1,616 @@ +/************************************************************************* + * + * $RCSfile: tdoc_contentcaps.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: hr $ $Date: 2004-04-14 13:41:06 $ + * + * 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 + ************************************************************************** + + ************************************************************************** + + Props/Commands: + + root document folder folder stream stream + (new) (new) + ---------------------------------------------------------------- + ContentType r r r r r r + IsDocument r r r r r r + IsFolder r r r r r r + Title r r w w w w + Storage - - r r - - + DocumentModel - r - - - - + + getCommandInfo x x x x x x + getPropertySetInfo x x x x x x + getPropertyValues x x x x x x + setPropertyValues x x x x x x + insert - - x x x x + delete - - x - x - + open x x x - x - + transfer - x x - - - + + *************************************************************************/ + +#include "com/sun/star/beans/Property.hpp" +#include "com/sun/star/beans/PropertyAttribute.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/embed/XStorage.hpp" +#include "com/sun/star/frame/XModel.hpp" +#include "com/sun/star/ucb/CommandInfo.hpp" +#include "com/sun/star/ucb/OpenCommandArgument2.hpp" +#include "com/sun/star/ucb/TransferInfo.hpp" + +#include "tdoc_content.hxx" + +namespace com { namespace sun { namespace star { namespace embed { + class XStorage; +} } } } + +using namespace com::sun; +using namespace com::sun::star; +using namespace tdoc_ucp; + +//========================================================================= +// +// 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 ) +{ + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + + if ( m_aProps.getType() == STREAM ) + { + //================================================================= + // + // Stream: Supported properties + // + //================================================================= + + static beans::Property aStreamPropertyInfoTable[] = + { + /////////////////////////////////////////////////////////// + // Mandatory 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 + /////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////// + // New properties + /////////////////////////////////////////////////////////// + }; + return uno::Sequence< beans::Property >( aStreamPropertyInfoTable, 4 ); + } + else if ( m_aProps.getType() == FOLDER ) + { + //================================================================= + // + // Folder: Supported properties + // + //================================================================= + + static beans::Property aFolderPropertyInfoTable[] = + { + /////////////////////////////////////////////////////////// + // Mandatory 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 + /////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////// + // New properties + /////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Storage" ) ), + -1, + getCppuType( static_cast< + const uno::Reference< embed::XStorage > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY + ) + }; + return uno::Sequence< beans::Property >( aFolderPropertyInfoTable, 5 ); + } + else if ( m_aProps.getType() == DOCUMENT ) + { + //================================================================= + // + // Document: Supported properties + // + //================================================================= + + static beans::Property aDocPropertyInfoTable[] = + { + /////////////////////////////////////////////////////////// + // Mandatory 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 + | beans::PropertyAttribute::READONLY + ), + /////////////////////////////////////////////////////////// + // Optional standard properties + /////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////// + // New properties + /////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentModel" ) ), + -1, + getCppuType( static_cast< + const uno::Reference< frame::XModel > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY + ) + }; + return uno::Sequence< beans::Property >( aDocPropertyInfoTable, 5 ); + } + else + { + //================================================================= + // + // Root: Supported properties + // + //================================================================= + + OSL_ENSURE( m_aProps.getType() == ROOT, "Wrong content type!" ); + + static beans::Property aRootPropertyInfoTable[] = + { + /////////////////////////////////////////////////////////////// + // Mandatory 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 + | beans::PropertyAttribute::READONLY + ) + /////////////////////////////////////////////////////////////// + // Optional standard properties + /////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////// + // New properties + /////////////////////////////////////////////////////////////// + }; + return uno::Sequence< beans::Property >( aRootPropertyInfoTable, 4 ); + } +} + +//========================================================================= +// virtual +uno::Sequence< star::ucb::CommandInfo > Content::getCommands( + const uno::Reference< star::ucb::XCommandEnvironment > & xEnv ) +{ + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + + if ( m_aProps.getType() == STREAM ) + { + //================================================================= + // + // Stream: Supported commands + // + //================================================================= + + static star::ucb::CommandInfo aStreamCommandInfoTable[] = + { + /////////////////////////////////////////////////////////// + // Mandatory 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, + getCppuVoidType() + ), + star::ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ), + -1, + getCppuType( + static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) ) + ) + /////////////////////////////////////////////////////////// + // New commands + /////////////////////////////////////////////////////////// + }; + return uno::Sequence< + star::ucb::CommandInfo >( aStreamCommandInfoTable, 7 ); + } + else if ( m_aProps.getType() == FOLDER ) + { + //================================================================= + // + // Folder: Supported commands + // + //================================================================= + + static star::ucb::CommandInfo aFolderCommandInfoTable[] = + { + /////////////////////////////////////////////////////////// + // Mandatory 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, + getCppuVoidType() + ), + 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( "transfer" ) ), + -1, + getCppuType( static_cast< star::ucb::TransferInfo * >( 0 ) ) + ) + /////////////////////////////////////////////////////////// + // New commands + /////////////////////////////////////////////////////////// + }; + return uno::Sequence< + star::ucb::CommandInfo >( aFolderCommandInfoTable, 8 ); + } + else if ( m_aProps.getType() == DOCUMENT ) + { + //================================================================= + // + // Document: Supported commands + // + //================================================================= + + static star::ucb::CommandInfo aDocCommandInfoTable[] = + { + /////////////////////////////////////////////////////////// + // Mandatory 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( "open" ) ), + -1, + getCppuType( + static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) ) + ), + 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 >( aDocCommandInfoTable, 6 ); + } + else + { + //================================================================= + // + // Root: Supported commands + // + //================================================================= + + OSL_ENSURE( m_aProps.getType() == ROOT, "Wrong content type!" ); + + static star::ucb::CommandInfo aRootCommandInfoTable[] = + { + /////////////////////////////////////////////////////////// + // Mandatory 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( "open" ) ), + -1, + getCppuType( + static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) ) + ) + /////////////////////////////////////////////////////////// + // New commands + /////////////////////////////////////////////////////////// + }; + return uno::Sequence< + star::ucb::CommandInfo >( aRootCommandInfoTable, 5 ); + } +} |