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: odma_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_ucb.hxx"
34 /**************************************************************************
36 **************************************************************************
38 *************************************************************************/
39 #include <com/sun/star/beans/Property.hpp>
40 #include <com/sun/star/beans/PropertyAttribute.hpp>
41 #include <com/sun/star/beans/PropertyValue.hpp>
42 #include <com/sun/star/ucb/CommandInfo.hpp>
43 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
44 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
45 #include <com/sun/star/uno/Sequence.hxx>
46 #include <com/sun/star/util/DateTime.hpp>
47 #include <com/sun/star/ucb/TransferInfo.hpp>
48 #include "odma_content.hxx"
50 using namespace com::sun::star
;
53 //=========================================================================
55 // Content implementation.
57 //=========================================================================
59 //=========================================================================
61 // IMPORTENT: If any property data ( name / type / ... ) are changed, then
62 // Content::getPropertyValues(...) must be adapted too!
64 //=========================================================================
67 uno::Sequence
< beans::Property
> Content::getProperties(
68 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
70 // @@@ Add additional properties...
72 // @@@ Note: If your data source supports adding/removing properties,
73 // you should implement the interface XPropertyContainer
74 // by yourself and supply your own logic here. The base class
75 // uses the service "com.sun.star.ucb.Store" to maintain
76 // Additional Core properties. But using server functionality
77 // is preferred! In fact you should return a table conatining
78 // even that dynamicly added properties.
80 // osl::Guard< osl::Mutex > aGuard( m_aMutex );
82 //=================================================================
84 // Supported properties
86 //=================================================================
88 #define PROPERTY_COUNT 10
90 static beans::Property aPropertyInfoTable
[] =
92 ///////////////////////////////////////////////////////////////
93 // Required properties
94 ///////////////////////////////////////////////////////////////
96 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
98 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
99 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
102 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
104 getCppuBooleanType(),
105 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
108 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
110 getCppuBooleanType(),
111 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
114 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
116 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
117 beans::PropertyAttribute::BOUND
119 ///////////////////////////////////////////////////////////////
120 // Optional standard properties
121 ///////////////////////////////////////////////////////////////
123 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ),
125 getCppuType(static_cast< const util::DateTime
* >( 0 ) ),
126 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
129 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ),
131 getCppuType(static_cast< const util::DateTime
* >( 0 ) ),
132 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
135 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
137 getCppuBooleanType(),
138 beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
140 ///////////////////////////////////////////////////////////////
142 ///////////////////////////////////////////////////////////////
144 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ),
146 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
147 beans::PropertyAttribute::BOUND
150 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subject" ) ),
152 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
153 beans::PropertyAttribute::BOUND
156 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Keywords" ) ),
158 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
159 beans::PropertyAttribute::BOUND
162 return uno::Sequence
<
163 beans::Property
>( aPropertyInfoTable
, PROPERTY_COUNT
);
166 //=========================================================================
168 uno::Sequence
< ucb::CommandInfo
> Content::getCommands(
169 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
171 // @@@ Add additional commands...
173 // osl::Guard< osl::Mutex > aGuard( m_aMutex );
175 //=================================================================
177 // Supported commands
179 //=================================================================
181 #define COMMAND_COUNT 8
183 static ucb::CommandInfo aCommandInfoTable
[] =
185 ///////////////////////////////////////////////////////////////
187 ///////////////////////////////////////////////////////////////
189 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
194 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
199 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
202 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
205 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
208 static_cast< uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
210 ///////////////////////////////////////////////////////////////
211 // Optional standard commands
212 ///////////////////////////////////////////////////////////////
215 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
221 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
224 static_cast< ucb::InsertCommandArgument
* >( 0 ) )
227 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
229 getCppuType( static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
232 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "close" ) ),
237 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
239 getCppuType( static_cast< ucb::TransferInfo
* >( 0 ) )
242 ///////////////////////////////////////////////////////////////
244 ///////////////////////////////////////////////////////////////
247 return uno::Sequence
<
248 ucb::CommandInfo
>( aCommandInfoTable
, COMMAND_COUNT
);