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: hierarchycontentcaps.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 **************************************************************************
42 root folder folder link link
44 ----------------------------------------------------------------
51 getCommandInfo x x x x x
52 getPropertySetInfo x x x x x
53 getPropertyValues x x x x x
54 setPropertyValues x x x x x
60 *************************************************************************/
61 #include <com/sun/star/beans/Property.hpp>
62 #include <com/sun/star/beans/PropertyAttribute.hpp>
63 #include <com/sun/star/beans/PropertyValue.hpp>
64 #include <com/sun/star/ucb/CommandInfo.hpp>
65 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
66 #include <com/sun/star/ucb/TransferInfo.hpp>
67 #include <com/sun/star/uno/Sequence.hxx>
68 #include "hierarchycontent.hxx"
70 using namespace com::sun::star
;
71 using namespace hierarchy_ucp
;
73 //=========================================================================
75 // HierarchyContent implementation.
77 //=========================================================================
79 //=========================================================================
81 // IMPORTENT: If any property data ( name / type / ... ) are changed, then
82 // HierarchyContent::getPropertyValues(...) must be adapted too!
84 //=========================================================================
87 uno::Sequence
< beans::Property
> HierarchyContent::getProperties(
88 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
90 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
92 if ( m_eKind
== LINK
)
94 //=================================================================
96 // Link: Supported properties
98 //=================================================================
102 static beans::Property aLinkPropertyInfoTable
[] =
104 ///////////////////////////////////////////////////////////
105 // Required properties
106 ///////////////////////////////////////////////////////////
109 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
111 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
112 beans::PropertyAttribute::BOUND
113 | beans::PropertyAttribute::READONLY
117 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
119 getCppuBooleanType(),
120 beans::PropertyAttribute::BOUND
121 | beans::PropertyAttribute::READONLY
124 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
126 getCppuBooleanType(),
127 beans::PropertyAttribute::BOUND
128 | beans::PropertyAttribute::READONLY
131 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
133 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
134 beans::PropertyAttribute::BOUND
135 | beans::PropertyAttribute::READONLY
137 ///////////////////////////////////////////////////////////
138 // Optional standard properties
139 ///////////////////////////////////////////////////////////
141 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) ),
143 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
144 beans::PropertyAttribute::BOUND
145 | beans::PropertyAttribute::READONLY
147 ///////////////////////////////////////////////////////////
149 ///////////////////////////////////////////////////////////
151 return uno::Sequence
<
152 beans::Property
>( aLinkPropertyInfoTable
, 5 );
156 static beans::Property aLinkPropertyInfoTable
[] =
158 ///////////////////////////////////////////////////////////
159 // Required properties
160 ///////////////////////////////////////////////////////////
163 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
165 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
166 beans::PropertyAttribute::BOUND
167 | beans::PropertyAttribute::READONLY
171 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
173 getCppuBooleanType(),
174 beans::PropertyAttribute::BOUND
175 | beans::PropertyAttribute::READONLY
178 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
180 getCppuBooleanType(),
181 beans::PropertyAttribute::BOUND
182 | beans::PropertyAttribute::READONLY
185 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
187 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
188 beans::PropertyAttribute::BOUND
190 ///////////////////////////////////////////////////////////
191 // Optional standard properties
192 ///////////////////////////////////////////////////////////
194 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) ),
196 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
197 beans::PropertyAttribute::BOUND
199 ///////////////////////////////////////////////////////////
201 ///////////////////////////////////////////////////////////
203 return uno::Sequence
<
204 beans::Property
>( aLinkPropertyInfoTable
, 5 );
207 else if ( m_eKind
== FOLDER
)
209 //=================================================================
211 // Folder: Supported properties
213 //=================================================================
217 static beans::Property aFolderPropertyInfoTable
[] =
219 ///////////////////////////////////////////////////////////
220 // Required properties
221 ///////////////////////////////////////////////////////////
224 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
226 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
227 beans::PropertyAttribute::BOUND
228 | beans::PropertyAttribute::READONLY
232 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
234 getCppuBooleanType(),
235 beans::PropertyAttribute::BOUND
236 | beans::PropertyAttribute::READONLY
239 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
241 getCppuBooleanType(),
242 beans::PropertyAttribute::BOUND
243 | beans::PropertyAttribute::READONLY
246 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
248 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
249 beans::PropertyAttribute::BOUND
250 | beans::PropertyAttribute::READONLY
252 ///////////////////////////////////////////////////////////
253 // Optional standard properties
254 ///////////////////////////////////////////////////////////
255 ///////////////////////////////////////////////////////////
257 ///////////////////////////////////////////////////////////
259 return uno::Sequence
<
260 beans::Property
>( aFolderPropertyInfoTable
, 4 );
264 static beans::Property aFolderPropertyInfoTable
[] =
266 ///////////////////////////////////////////////////////////
267 // Required properties
268 ///////////////////////////////////////////////////////////
271 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
273 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
274 beans::PropertyAttribute::BOUND
275 | beans::PropertyAttribute::READONLY
279 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
281 getCppuBooleanType(),
282 beans::PropertyAttribute::BOUND
283 | beans::PropertyAttribute::READONLY
286 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
288 getCppuBooleanType(),
289 beans::PropertyAttribute::BOUND
290 | beans::PropertyAttribute::READONLY
293 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
295 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
296 beans::PropertyAttribute::BOUND
298 ///////////////////////////////////////////////////////////
299 // Optional standard properties
300 ///////////////////////////////////////////////////////////
301 ///////////////////////////////////////////////////////////
303 ///////////////////////////////////////////////////////////
305 return uno::Sequence
<
306 beans::Property
>( aFolderPropertyInfoTable
, 4 );
311 //=================================================================
313 // Root Folder: Supported properties
315 //=================================================================
317 static beans::Property aRootFolderPropertyInfoTable
[] =
319 ///////////////////////////////////////////////////////////////
320 // Required properties
321 ///////////////////////////////////////////////////////////////
323 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
325 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
326 beans::PropertyAttribute::BOUND
327 | beans::PropertyAttribute::READONLY
330 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
332 getCppuBooleanType(),
333 beans::PropertyAttribute::BOUND
334 | beans::PropertyAttribute::READONLY
337 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
339 getCppuBooleanType(),
340 beans::PropertyAttribute::BOUND
341 | beans::PropertyAttribute::READONLY
344 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
346 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
347 beans::PropertyAttribute::BOUND
348 | beans::PropertyAttribute::READONLY
350 ///////////////////////////////////////////////////////////////
351 // Optional standard properties
352 ///////////////////////////////////////////////////////////////
353 ///////////////////////////////////////////////////////////////
355 ///////////////////////////////////////////////////////////////
357 return uno::Sequence
<
358 beans::Property
>( aRootFolderPropertyInfoTable
, 4 );
362 //=========================================================================
364 uno::Sequence
< ucb::CommandInfo
> HierarchyContent::getCommands(
365 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
367 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
369 if ( m_eKind
== LINK
)
371 //=================================================================
373 // Link: Supported commands
375 //=================================================================
379 static const ucb::CommandInfo aLinkCommandInfoTable
[] =
381 ///////////////////////////////////////////////////////////
383 ///////////////////////////////////////////////////////////
386 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
392 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
398 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
401 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
405 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
409 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
411 ///////////////////////////////////////////////////////////
412 // Optional standard commands
413 ///////////////////////////////////////////////////////////
415 ///////////////////////////////////////////////////////////
417 ///////////////////////////////////////////////////////////
419 return uno::Sequence
<
420 ucb::CommandInfo
>( aLinkCommandInfoTable
, 4 );
424 static const ucb::CommandInfo aLinkCommandInfoTable
[] =
426 ///////////////////////////////////////////////////////////
428 ///////////////////////////////////////////////////////////
431 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
437 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
443 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
446 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
450 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
454 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
456 ///////////////////////////////////////////////////////////
457 // Optional standard commands
458 ///////////////////////////////////////////////////////////
460 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
465 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
469 ///////////////////////////////////////////////////////////
471 ///////////////////////////////////////////////////////////
473 return uno::Sequence
<
474 ucb::CommandInfo
>( aLinkCommandInfoTable
, 6 );
477 else if ( m_eKind
== FOLDER
)
479 //=================================================================
481 // Folder: Supported commands
483 //=================================================================
487 static const ucb::CommandInfo aFolderCommandInfoTable
[] =
489 ///////////////////////////////////////////////////////////
491 ///////////////////////////////////////////////////////////
494 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
500 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
506 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
509 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
513 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
517 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
519 ///////////////////////////////////////////////////////////
520 // Optional standard commands
521 ///////////////////////////////////////////////////////////
523 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
526 static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
528 ///////////////////////////////////////////////////////////
530 ///////////////////////////////////////////////////////////
532 return uno::Sequence
<
533 ucb::CommandInfo
>( aFolderCommandInfoTable
, 5 );
537 static const ucb::CommandInfo aFolderCommandInfoTable
[] =
539 ///////////////////////////////////////////////////////////
541 ///////////////////////////////////////////////////////////
544 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
550 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
556 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
559 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
563 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
567 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
569 ///////////////////////////////////////////////////////////
570 // Optional standard commands
571 ///////////////////////////////////////////////////////////
573 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
578 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
583 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
586 static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
589 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
591 getCppuType( static_cast< ucb::TransferInfo
* >( 0 ) )
593 ///////////////////////////////////////////////////////////
595 ///////////////////////////////////////////////////////////
597 return uno::Sequence
<
598 ucb::CommandInfo
>( aFolderCommandInfoTable
, 8 );
603 //=================================================================
605 // Root Folder: Supported commands
607 //=================================================================
611 static const ucb::CommandInfo aRootFolderCommandInfoTable
[] =
613 ///////////////////////////////////////////////////////////
615 ///////////////////////////////////////////////////////////
618 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
624 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
630 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
633 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
637 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
641 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
643 ///////////////////////////////////////////////////////////
644 // Optional standard commands
645 ///////////////////////////////////////////////////////////
647 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
650 static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
652 ///////////////////////////////////////////////////////////
654 ///////////////////////////////////////////////////////////
656 return uno::Sequence
<
657 ucb::CommandInfo
>( aRootFolderCommandInfoTable
, 5 );
661 static const ucb::CommandInfo aRootFolderCommandInfoTable
[] =
663 ///////////////////////////////////////////////////////////
665 ///////////////////////////////////////////////////////////
668 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
674 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
680 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
683 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
687 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
691 uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
693 ///////////////////////////////////////////////////////////
694 // Optional standard commands
695 ///////////////////////////////////////////////////////////
697 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
700 static_cast< ucb::OpenCommandArgument2
* >( 0 ) )
703 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
705 getCppuType( static_cast< ucb::TransferInfo
* >( 0 ) )
707 ///////////////////////////////////////////////////////////
709 ///////////////////////////////////////////////////////////
711 return uno::Sequence
<
712 ucb::CommandInfo
>( aRootFolderCommandInfoTable
, 6 );