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: pkgcontentcaps.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 **************************************************************************
40 rootfolder folder stream
41 ---------------------------------------------
50 HasEncryptedEntries r - -
53 getPropertySetInfo x x x
54 getPropertyValues x x x
55 setPropertyValues x x x
62 *************************************************************************/
63 #include <com/sun/star/beans/Property.hpp>
64 #include <com/sun/star/beans/PropertyAttribute.hpp>
65 #include <com/sun/star/beans/PropertyValue.hpp>
66 #include <com/sun/star/ucb/CommandInfo.hpp>
67 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
68 #include <com/sun/star/ucb/TransferInfo.hpp>
69 #include <com/sun/star/uno/Sequence.hxx>
70 #include "pkgcontent.hxx"
72 using namespace com::sun::star
;
73 using namespace package_ucp
;
75 //=========================================================================
77 // Content implementation.
79 //=========================================================================
81 //=========================================================================
83 // IMPORTENT: If any property data ( name / type / ... ) are changed, then
84 // Content::getPropertyValues(...) must be adapted too!
86 //=========================================================================
89 uno::Sequence
< beans::Property
> Content::getProperties(
90 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
92 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
96 if ( m_aUri
.isRootFolder() )
98 //=================================================================
100 // Root Folder: Supported properties
102 //=================================================================
104 static const beans::Property aRootFolderPropertyInfoTable
[] =
106 ///////////////////////////////////////////////////////////////
107 // Required properties
108 ///////////////////////////////////////////////////////////////
111 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
113 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
114 beans::PropertyAttribute::BOUND
115 | beans::PropertyAttribute::READONLY
119 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
121 getCppuBooleanType(),
122 beans::PropertyAttribute::BOUND
123 | beans::PropertyAttribute::READONLY
126 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
128 getCppuBooleanType(),
129 beans::PropertyAttribute::BOUND
130 | beans::PropertyAttribute::READONLY
133 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
135 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
136 beans::PropertyAttribute::BOUND
137 | beans::PropertyAttribute::READONLY
139 ///////////////////////////////////////////////////////////////
140 // Optional standard properties
141 ///////////////////////////////////////////////////////////////
143 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
145 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
146 beans::PropertyAttribute::BOUND
148 ///////////////////////////////////////////////////////////////
150 ///////////////////////////////////////////////////////////////
153 RTL_CONSTASCII_USTRINGPARAM( "HasEncryptedEntries" ) ),
155 getCppuBooleanType(),
156 beans::PropertyAttribute::BOUND
157 | beans::PropertyAttribute::READONLY
160 return uno::Sequence
< beans::Property
>(
161 aRootFolderPropertyInfoTable
, 6 );
165 //=================================================================
167 // Folder: Supported properties
169 //=================================================================
171 static const beans::Property aFolderPropertyInfoTable
[] =
173 ///////////////////////////////////////////////////////////////
174 // Required properties
175 ///////////////////////////////////////////////////////////////
178 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
180 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
181 beans::PropertyAttribute::BOUND
182 | beans::PropertyAttribute::READONLY
186 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
188 getCppuBooleanType(),
189 beans::PropertyAttribute::BOUND
190 | beans::PropertyAttribute::READONLY
193 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
195 getCppuBooleanType(),
196 beans::PropertyAttribute::BOUND
197 | beans::PropertyAttribute::READONLY
200 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
202 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
203 beans::PropertyAttribute::BOUND
205 ///////////////////////////////////////////////////////////////
206 // Optional standard properties
207 ///////////////////////////////////////////////////////////////
209 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
211 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
212 beans::PropertyAttribute::BOUND
214 ///////////////////////////////////////////////////////////////
216 ///////////////////////////////////////////////////////////////
218 return uno::Sequence
< beans::Property
>(
219 aFolderPropertyInfoTable
, 5 );
224 //=================================================================
226 // Stream: Supported properties
228 //=================================================================
230 static const beans::Property aStreamPropertyInfoTable
[] =
232 ///////////////////////////////////////////////////////////////
233 // Required properties
234 ///////////////////////////////////////////////////////////////
236 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
238 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
239 beans::PropertyAttribute::BOUND
240 | beans::PropertyAttribute::READONLY
243 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
245 getCppuBooleanType(),
246 beans::PropertyAttribute::BOUND
247 | beans::PropertyAttribute::READONLY
250 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
252 getCppuBooleanType(),
253 beans::PropertyAttribute::BOUND
254 | beans::PropertyAttribute::READONLY
257 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
259 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
260 beans::PropertyAttribute::BOUND
262 ///////////////////////////////////////////////////////////////
263 // Optional standard properties
264 ///////////////////////////////////////////////////////////////
266 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
268 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
269 beans::PropertyAttribute::BOUND
272 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ),
274 getCppuType( static_cast< const sal_Int64
* >( 0 ) ),
275 beans::PropertyAttribute::BOUND
276 | beans::PropertyAttribute::READONLY
278 ///////////////////////////////////////////////////////////////
280 ///////////////////////////////////////////////////////////////
282 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ),
284 getCppuBooleanType(),
285 beans::PropertyAttribute::BOUND
288 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Encrypted" ) ),
290 getCppuBooleanType(),
291 beans::PropertyAttribute::BOUND
294 return uno::Sequence
< beans::Property
>( aStreamPropertyInfoTable
, 8 );
298 //=========================================================================
300 uno::Sequence
< ucb::CommandInfo
> Content::getCommands(
301 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
303 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
307 if ( m_aUri
.isRootFolder() )
309 //=================================================================
311 // Root Folder: Supported commands
313 //=================================================================
315 static const ucb::CommandInfo aRootFolderCommandInfoTable
[] =
317 ///////////////////////////////////////////////////////////
319 ///////////////////////////////////////////////////////////
322 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
328 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
334 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
338 uno::Sequence
< beans::Property
> * >( 0 ) )
342 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
346 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
348 ///////////////////////////////////////////////////////////
349 // Optional standard commands
350 ///////////////////////////////////////////////////////////
352 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
355 static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
358 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
361 static_cast< ucb::TransferInfo
* >( 0 ) )
363 ///////////////////////////////////////////////////////////
365 ///////////////////////////////////////////////////////////
367 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "flush" ) ),
373 return uno::Sequence
<
374 ucb::CommandInfo
>( aRootFolderCommandInfoTable
, 7 );
378 //=================================================================
380 // Folder: Supported commands
382 //=================================================================
384 static const ucb::CommandInfo aFolderCommandInfoTable
[] =
386 ///////////////////////////////////////////////////////////
388 ///////////////////////////////////////////////////////////
391 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
397 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
403 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
407 uno::Sequence
< beans::Property
> * >( 0 ) )
411 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
415 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
417 ///////////////////////////////////////////////////////////
418 // Optional standard commands
419 ///////////////////////////////////////////////////////////
421 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
426 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
431 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
434 static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
437 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
440 static_cast< ucb::TransferInfo
* >( 0 ) )
442 ///////////////////////////////////////////////////////////
444 ///////////////////////////////////////////////////////////
446 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "flush" ) ),
452 return uno::Sequence
<
453 ucb::CommandInfo
>( aFolderCommandInfoTable
, 9 );
458 //=================================================================
460 // Stream: Supported commands
462 //=================================================================
464 static const ucb::CommandInfo aStreamCommandInfoTable
[] =
466 ///////////////////////////////////////////////////////////////
468 ///////////////////////////////////////////////////////////////
471 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
477 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
483 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
486 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
490 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
494 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
496 ///////////////////////////////////////////////////////////////
497 // Optional standard commands
498 ///////////////////////////////////////////////////////////////
500 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
505 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
510 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
513 static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
515 ///////////////////////////////////////////////////////////////
517 ///////////////////////////////////////////////////////////////
520 return uno::Sequence
< ucb::CommandInfo
>(
521 aStreamCommandInfoTable
, 7 );