1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: myucp_contentcaps.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_ucbhelper.hxx"
34 /**************************************************************************
36 **************************************************************************
38 *************************************************************************/
40 #include "com/sun/star/beans/Property.hpp"
41 #include "com/sun/star/beans/PropertyAttribute.hpp"
42 #include "com/sun/star/beans/PropertyValue.hpp"
43 #include "com/sun/star/ucb/CommandInfo.hpp"
44 #include "com/sun/star/uno/Sequence.hxx"
46 #include "myucp_content.hxx"
48 #ifdef IMPLEMENT_COMMAND_INSERT
49 #include "com/sun/star/ucb/InsertCommandArgument.hpp"
52 #ifdef IMPLEMENT_COMMAND_OPEN
53 #include "com/sun/star/ucb/OpenCommandArgument2.hpp"
56 using namespace com::sun::star
;
58 // @@@ Adjust namespace name.
59 using namespace myucp
;
61 //=========================================================================
63 // Content implementation.
65 //=========================================================================
67 //=========================================================================
69 // IMPORTENT: If any property data ( name / type / ... ) are changed, then
70 // Content::getPropertyValues(...) must be adapted too!
72 //=========================================================================
75 uno::Sequence
< beans::Property
> Content::getProperties(
76 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
78 // @@@ Add additional properties...
80 // @@@ Note: If your data source supports adding/removing properties,
81 // you should implement the interface XPropertyContainer
82 // by yourself and supply your own logic here. The base class
83 // uses the service "com.sun.star.ucb.Store" to maintain
84 // Additional Core properties. But using server functionality
85 // is preferred! In fact you should return a table conatining
86 // even that dynamicly added properties.
88 // osl::Guard< osl::Mutex > aGuard( m_aMutex );
90 //=================================================================
92 // Supported properties
94 //=================================================================
96 #define PROPERTY_COUNT 4
98 static beans::Property aPropertyInfoTable
[] =
100 ///////////////////////////////////////////////////////////////
101 // Mandatory properties
102 ///////////////////////////////////////////////////////////////
104 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
106 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
107 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
110 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
112 getCppuBooleanType(),
113 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
116 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
118 getCppuBooleanType(),
119 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
122 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
124 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
125 beans::PropertyAttribute::BOUND
127 ///////////////////////////////////////////////////////////////
128 // Optional standard properties
129 ///////////////////////////////////////////////////////////////
131 ///////////////////////////////////////////////////////////////
133 ///////////////////////////////////////////////////////////////
135 return uno::Sequence
<
136 beans::Property
>( aPropertyInfoTable
, PROPERTY_COUNT
);
139 //=========================================================================
141 uno::Sequence
< ucb::CommandInfo
> Content::getCommands(
142 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
144 // @@@ Add additional commands...
146 // osl::Guard< osl::Mutex > aGuard( m_aMutex );
148 //=================================================================
150 // Supported commands
152 //=================================================================
154 sal_uInt32 nCommandCount
= 4;
155 #ifdef IMPLEMENT_COMMAND_DELETE
158 #ifdef IMPLEMENT_COMMAND_INSERT
161 #ifdef IMPLEMENT_COMMAND_OPEN
165 static const ucb::CommandInfo aCommandInfoTable
[] =
167 ///////////////////////////////////////////////////////////////
168 // Mandatory commands
169 ///////////////////////////////////////////////////////////////
171 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
176 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
181 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
184 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
187 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
190 static_cast< uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
192 ///////////////////////////////////////////////////////////////
193 // Optional standard commands
194 ///////////////////////////////////////////////////////////////
196 #ifdef IMPLEMENT_COMMAND_DELETE
198 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
203 #ifdef IMPLEMENT_COMMAND_INSERT
205 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
208 static_cast< ucb::InsertCommandArgument
* >( 0 ) )
211 #ifdef IMPLEMENT_COMMAND_OPEN
213 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
215 getCppuType( static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
218 ///////////////////////////////////////////////////////////////
220 ///////////////////////////////////////////////////////////////
223 return uno::Sequence
<
224 ucb::CommandInfo
>( aCommandInfoTable
, nCommandCount
);