update dev300-m58
[ooovba.git] / ucbhelper / workben / myucp / myucp_contentcaps.cxx
blobe5303b48fb1348c3988af4431ef78010b7203748
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: myucp_contentcaps.cxx,v $
10 * $Revision: 1.7 $
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 /**************************************************************************
35 TODO
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"
50 #endif
52 #ifdef IMPLEMENT_COMMAND_OPEN
53 #include "com/sun/star/ucb/OpenCommandArgument2.hpp"
54 #endif
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 //=========================================================================
74 // virtual
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 ///////////////////////////////////////////////////////////////
103 beans::Property(
104 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
106 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
107 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
109 beans::Property(
110 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
112 getCppuBooleanType(),
113 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
115 beans::Property(
116 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
118 getCppuBooleanType(),
119 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
121 beans::Property(
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 ///////////////////////////////////////////////////////////////
132 // New properties
133 ///////////////////////////////////////////////////////////////
135 return uno::Sequence<
136 beans::Property >( aPropertyInfoTable, PROPERTY_COUNT );
139 //=========================================================================
140 // virtual
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
156 nCommandCount++;
157 #endif
158 #ifdef IMPLEMENT_COMMAND_INSERT
159 nCommandCount++;
160 #endif
161 #ifdef IMPLEMENT_COMMAND_OPEN
162 nCommandCount++;
163 #endif
165 static const ucb::CommandInfo aCommandInfoTable[] =
167 ///////////////////////////////////////////////////////////////
168 // Mandatory commands
169 ///////////////////////////////////////////////////////////////
170 ucb::CommandInfo(
171 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
173 getCppuVoidType()
175 ucb::CommandInfo(
176 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
178 getCppuVoidType()
180 ucb::CommandInfo(
181 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
183 getCppuType(
184 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
186 ucb::CommandInfo(
187 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
189 getCppuType(
190 static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
192 ///////////////////////////////////////////////////////////////
193 // Optional standard commands
194 ///////////////////////////////////////////////////////////////
196 #ifdef IMPLEMENT_COMMAND_DELETE
197 , ucb::CommandInfo(
198 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
200 getCppuBooleanType()
202 #endif
203 #ifdef IMPLEMENT_COMMAND_INSERT
204 , ucb::CommandInfo(
205 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
207 getCppuType(
208 static_cast< ucb::InsertCommandArgument * >( 0 ) )
210 #endif
211 #ifdef IMPLEMENT_COMMAND_OPEN
212 , ucb::CommandInfo(
213 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
215 getCppuType( static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
217 #endif
218 ///////////////////////////////////////////////////////////////
219 // New commands
220 ///////////////////////////////////////////////////////////////
223 return uno::Sequence<
224 ucb::CommandInfo >( aCommandInfoTable, nCommandCount );