1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_ucb.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir /************************************************************************** 32*cdf0e10cSrcweir TODO 33*cdf0e10cSrcweir ************************************************************************** 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir *************************************************************************/ 36*cdf0e10cSrcweir #include <com/sun/star/beans/Property.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/ucb/CommandInfo.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/ucb/InsertCommandArgument.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/ucb/OpenCommandArgument2.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 43*cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/ucb/TransferInfo.hpp> 45*cdf0e10cSrcweir #include "odma_content.hxx" 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir using namespace com::sun::star; 48*cdf0e10cSrcweir using namespace odma; 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir //========================================================================= 51*cdf0e10cSrcweir // 52*cdf0e10cSrcweir // Content implementation. 53*cdf0e10cSrcweir // 54*cdf0e10cSrcweir //========================================================================= 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir //========================================================================= 57*cdf0e10cSrcweir // 58*cdf0e10cSrcweir // IMPORTENT: If any property data ( name / type / ... ) are changed, then 59*cdf0e10cSrcweir // Content::getPropertyValues(...) must be adapted too! 60*cdf0e10cSrcweir // 61*cdf0e10cSrcweir //========================================================================= 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir // virtual 64*cdf0e10cSrcweir uno::Sequence< beans::Property > Content::getProperties( 65*cdf0e10cSrcweir const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ ) 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir // @@@ Add additional properties... 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir // @@@ Note: If your data source supports adding/removing properties, 70*cdf0e10cSrcweir // you should implement the interface XPropertyContainer 71*cdf0e10cSrcweir // by yourself and supply your own logic here. The base class 72*cdf0e10cSrcweir // uses the service "com.sun.star.ucb.Store" to maintain 73*cdf0e10cSrcweir // Additional Core properties. But using server functionality 74*cdf0e10cSrcweir // is preferred! In fact you should return a table conatining 75*cdf0e10cSrcweir // even that dynamicly added properties. 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir // osl::Guard< osl::Mutex > aGuard( m_aMutex ); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir //================================================================= 80*cdf0e10cSrcweir // 81*cdf0e10cSrcweir // Supported properties 82*cdf0e10cSrcweir // 83*cdf0e10cSrcweir //================================================================= 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir #define PROPERTY_COUNT 10 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir static beans::Property aPropertyInfoTable[] = 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 90*cdf0e10cSrcweir // Required properties 91*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 92*cdf0e10cSrcweir beans::Property( 93*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ), 94*cdf0e10cSrcweir -1, 95*cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 96*cdf0e10cSrcweir beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY 97*cdf0e10cSrcweir ), 98*cdf0e10cSrcweir beans::Property( 99*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ), 100*cdf0e10cSrcweir -1, 101*cdf0e10cSrcweir getCppuBooleanType(), 102*cdf0e10cSrcweir beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY 103*cdf0e10cSrcweir ), 104*cdf0e10cSrcweir beans::Property( 105*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ), 106*cdf0e10cSrcweir -1, 107*cdf0e10cSrcweir getCppuBooleanType(), 108*cdf0e10cSrcweir beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY 109*cdf0e10cSrcweir ), 110*cdf0e10cSrcweir beans::Property( 111*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), 112*cdf0e10cSrcweir -1, 113*cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 114*cdf0e10cSrcweir beans::PropertyAttribute::BOUND 115*cdf0e10cSrcweir ), 116*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 117*cdf0e10cSrcweir // Optional standard properties 118*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 119*cdf0e10cSrcweir beans::Property( 120*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ), 121*cdf0e10cSrcweir -1, 122*cdf0e10cSrcweir getCppuType(static_cast< const util::DateTime * >( 0 ) ), 123*cdf0e10cSrcweir beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY 124*cdf0e10cSrcweir ), 125*cdf0e10cSrcweir beans::Property( 126*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ), 127*cdf0e10cSrcweir -1, 128*cdf0e10cSrcweir getCppuType(static_cast< const util::DateTime * >( 0 ) ), 129*cdf0e10cSrcweir beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY 130*cdf0e10cSrcweir ), 131*cdf0e10cSrcweir beans::Property( 132*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ), 133*cdf0e10cSrcweir -1, 134*cdf0e10cSrcweir getCppuBooleanType(), 135*cdf0e10cSrcweir beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY 136*cdf0e10cSrcweir ), 137*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 138*cdf0e10cSrcweir // New properties 139*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 140*cdf0e10cSrcweir beans::Property( 141*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ), 142*cdf0e10cSrcweir -1, 143*cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 144*cdf0e10cSrcweir beans::PropertyAttribute::BOUND 145*cdf0e10cSrcweir ), 146*cdf0e10cSrcweir beans::Property( 147*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subject" ) ), 148*cdf0e10cSrcweir -1, 149*cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 150*cdf0e10cSrcweir beans::PropertyAttribute::BOUND 151*cdf0e10cSrcweir ), 152*cdf0e10cSrcweir beans::Property( 153*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Keywords" ) ), 154*cdf0e10cSrcweir -1, 155*cdf0e10cSrcweir getCppuType( static_cast< const rtl::OUString * >( 0 ) ), 156*cdf0e10cSrcweir beans::PropertyAttribute::BOUND 157*cdf0e10cSrcweir ) 158*cdf0e10cSrcweir }; 159*cdf0e10cSrcweir return uno::Sequence< 160*cdf0e10cSrcweir beans::Property >( aPropertyInfoTable, PROPERTY_COUNT ); 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir //========================================================================= 164*cdf0e10cSrcweir // virtual 165*cdf0e10cSrcweir uno::Sequence< ucb::CommandInfo > Content::getCommands( 166*cdf0e10cSrcweir const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir // @@@ Add additional commands... 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir // osl::Guard< osl::Mutex > aGuard( m_aMutex ); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir //================================================================= 173*cdf0e10cSrcweir // 174*cdf0e10cSrcweir // Supported commands 175*cdf0e10cSrcweir // 176*cdf0e10cSrcweir //================================================================= 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir #define COMMAND_COUNT 8 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir static ucb::CommandInfo aCommandInfoTable[] = 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 183*cdf0e10cSrcweir // Required commands 184*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 185*cdf0e10cSrcweir ucb::CommandInfo( 186*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ), 187*cdf0e10cSrcweir -1, 188*cdf0e10cSrcweir getCppuVoidType() 189*cdf0e10cSrcweir ), 190*cdf0e10cSrcweir ucb::CommandInfo( 191*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ), 192*cdf0e10cSrcweir -1, 193*cdf0e10cSrcweir getCppuVoidType() 194*cdf0e10cSrcweir ), 195*cdf0e10cSrcweir ucb::CommandInfo( 196*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ), 197*cdf0e10cSrcweir -1, 198*cdf0e10cSrcweir getCppuType( 199*cdf0e10cSrcweir static_cast< uno::Sequence< beans::Property > * >( 0 ) ) 200*cdf0e10cSrcweir ), 201*cdf0e10cSrcweir ucb::CommandInfo( 202*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ), 203*cdf0e10cSrcweir -1, 204*cdf0e10cSrcweir getCppuType( 205*cdf0e10cSrcweir static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) ) 206*cdf0e10cSrcweir ), 207*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 208*cdf0e10cSrcweir // Optional standard commands 209*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 210*cdf0e10cSrcweir /* 211*cdf0e10cSrcweir ucb::CommandInfo( 212*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ), 213*cdf0e10cSrcweir -1, 214*cdf0e10cSrcweir getCppuBooleanType() 215*cdf0e10cSrcweir ), 216*cdf0e10cSrcweir */ 217*cdf0e10cSrcweir ucb::CommandInfo( 218*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ), 219*cdf0e10cSrcweir -1, 220*cdf0e10cSrcweir getCppuType( 221*cdf0e10cSrcweir static_cast< ucb::InsertCommandArgument * >( 0 ) ) 222*cdf0e10cSrcweir ), 223*cdf0e10cSrcweir ucb::CommandInfo( 224*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ), 225*cdf0e10cSrcweir -1, 226*cdf0e10cSrcweir getCppuType( static_cast< ucb::OpenCommandArgument2 * >( 0 ) ) 227*cdf0e10cSrcweir ), 228*cdf0e10cSrcweir ucb::CommandInfo( 229*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "close" ) ), 230*cdf0e10cSrcweir -1, 231*cdf0e10cSrcweir getCppuVoidType( ) 232*cdf0e10cSrcweir ), 233*cdf0e10cSrcweir ucb::CommandInfo( 234*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), 235*cdf0e10cSrcweir -1, 236*cdf0e10cSrcweir getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) 237*cdf0e10cSrcweir ) 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 240*cdf0e10cSrcweir // New commands 241*cdf0e10cSrcweir /////////////////////////////////////////////////////////////// 242*cdf0e10cSrcweir }; 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir return uno::Sequence< 245*cdf0e10cSrcweir ucb::CommandInfo >( aCommandInfoTable, COMMAND_COUNT ); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248