update dev300-m58
[ooovba.git] / ucb / source / ucp / hierarchy / hierarchycontentcaps.cxx
blob2adaa8cbb38b646dcecfc9c42e988e9e1ad8ae9d
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: hierarchycontentcaps.cxx,v $
10 * $Revision: 1.9 $
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 /**************************************************************************
35 TODO
36 **************************************************************************
38 **************************************************************************
40 Props/Commands:
42 root folder folder link link
43 (new) (new)
44 ----------------------------------------------------------------
45 ContentType x x x x x
46 IsDocument x x x x x
47 IsFolder x x x x x
48 Title x x x x x
49 TargetURL x x
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
55 insert x x
56 delete x x
57 open x x
58 transfer 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 //=========================================================================
86 // virtual
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 //=================================================================
100 if ( isReadOnly() )
102 static beans::Property aLinkPropertyInfoTable[] =
104 ///////////////////////////////////////////////////////////
105 // Required properties
106 ///////////////////////////////////////////////////////////
107 beans::Property(
108 rtl::OUString(
109 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
111 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
112 beans::PropertyAttribute::BOUND
113 | beans::PropertyAttribute::READONLY
115 beans::Property(
116 rtl::OUString(
117 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
119 getCppuBooleanType(),
120 beans::PropertyAttribute::BOUND
121 | beans::PropertyAttribute::READONLY
123 beans::Property(
124 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
126 getCppuBooleanType(),
127 beans::PropertyAttribute::BOUND
128 | beans::PropertyAttribute::READONLY
130 beans::Property(
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 ///////////////////////////////////////////////////////////
140 beans::Property(
141 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) ),
143 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
144 beans::PropertyAttribute::BOUND
145 | beans::PropertyAttribute::READONLY
147 ///////////////////////////////////////////////////////////
148 // New properties
149 ///////////////////////////////////////////////////////////
151 return uno::Sequence<
152 beans::Property >( aLinkPropertyInfoTable, 5 );
154 else
156 static beans::Property aLinkPropertyInfoTable[] =
158 ///////////////////////////////////////////////////////////
159 // Required properties
160 ///////////////////////////////////////////////////////////
161 beans::Property(
162 rtl::OUString(
163 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
165 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
166 beans::PropertyAttribute::BOUND
167 | beans::PropertyAttribute::READONLY
169 beans::Property(
170 rtl::OUString(
171 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
173 getCppuBooleanType(),
174 beans::PropertyAttribute::BOUND
175 | beans::PropertyAttribute::READONLY
177 beans::Property(
178 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
180 getCppuBooleanType(),
181 beans::PropertyAttribute::BOUND
182 | beans::PropertyAttribute::READONLY
184 beans::Property(
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 ///////////////////////////////////////////////////////////
193 beans::Property(
194 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) ),
196 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
197 beans::PropertyAttribute::BOUND
199 ///////////////////////////////////////////////////////////
200 // New properties
201 ///////////////////////////////////////////////////////////
203 return uno::Sequence<
204 beans::Property >( aLinkPropertyInfoTable, 5 );
207 else if ( m_eKind == FOLDER )
209 //=================================================================
211 // Folder: Supported properties
213 //=================================================================
215 if ( isReadOnly() )
217 static beans::Property aFolderPropertyInfoTable[] =
219 ///////////////////////////////////////////////////////////
220 // Required properties
221 ///////////////////////////////////////////////////////////
222 beans::Property(
223 rtl::OUString(
224 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
226 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
227 beans::PropertyAttribute::BOUND
228 | beans::PropertyAttribute::READONLY
230 beans::Property(
231 rtl::OUString(
232 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
234 getCppuBooleanType(),
235 beans::PropertyAttribute::BOUND
236 | beans::PropertyAttribute::READONLY
238 beans::Property(
239 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
241 getCppuBooleanType(),
242 beans::PropertyAttribute::BOUND
243 | beans::PropertyAttribute::READONLY
245 beans::Property(
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 ///////////////////////////////////////////////////////////
256 // New properties
257 ///////////////////////////////////////////////////////////
259 return uno::Sequence<
260 beans::Property >( aFolderPropertyInfoTable, 4 );
262 else
264 static beans::Property aFolderPropertyInfoTable[] =
266 ///////////////////////////////////////////////////////////
267 // Required properties
268 ///////////////////////////////////////////////////////////
269 beans::Property(
270 rtl::OUString(
271 RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
273 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
274 beans::PropertyAttribute::BOUND
275 | beans::PropertyAttribute::READONLY
277 beans::Property(
278 rtl::OUString(
279 RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
281 getCppuBooleanType(),
282 beans::PropertyAttribute::BOUND
283 | beans::PropertyAttribute::READONLY
285 beans::Property(
286 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
288 getCppuBooleanType(),
289 beans::PropertyAttribute::BOUND
290 | beans::PropertyAttribute::READONLY
292 beans::Property(
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 ///////////////////////////////////////////////////////////
302 // New properties
303 ///////////////////////////////////////////////////////////
305 return uno::Sequence<
306 beans::Property >( aFolderPropertyInfoTable, 4 );
309 else
311 //=================================================================
313 // Root Folder: Supported properties
315 //=================================================================
317 static beans::Property aRootFolderPropertyInfoTable[] =
319 ///////////////////////////////////////////////////////////////
320 // Required properties
321 ///////////////////////////////////////////////////////////////
322 beans::Property(
323 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
325 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
326 beans::PropertyAttribute::BOUND
327 | beans::PropertyAttribute::READONLY
329 beans::Property(
330 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
332 getCppuBooleanType(),
333 beans::PropertyAttribute::BOUND
334 | beans::PropertyAttribute::READONLY
336 beans::Property(
337 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
339 getCppuBooleanType(),
340 beans::PropertyAttribute::BOUND
341 | beans::PropertyAttribute::READONLY
343 beans::Property(
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 ///////////////////////////////////////////////////////////////
354 // New properties
355 ///////////////////////////////////////////////////////////////
357 return uno::Sequence<
358 beans::Property >( aRootFolderPropertyInfoTable, 4 );
362 //=========================================================================
363 // virtual
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 //=================================================================
377 if ( isReadOnly() )
379 static const ucb::CommandInfo aLinkCommandInfoTable[] =
381 ///////////////////////////////////////////////////////////
382 // Required commands
383 ///////////////////////////////////////////////////////////
384 ucb::CommandInfo(
385 rtl::OUString(
386 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
388 getCppuVoidType()
390 ucb::CommandInfo(
391 rtl::OUString(
392 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
394 getCppuVoidType()
396 ucb::CommandInfo(
397 rtl::OUString(
398 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
400 getCppuType(
401 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
403 ucb::CommandInfo(
404 rtl::OUString(
405 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
407 getCppuType(
408 static_cast<
409 uno::Sequence< beans::PropertyValue > * >( 0 ) )
411 ///////////////////////////////////////////////////////////
412 // Optional standard commands
413 ///////////////////////////////////////////////////////////
415 ///////////////////////////////////////////////////////////
416 // New commands
417 ///////////////////////////////////////////////////////////
419 return uno::Sequence<
420 ucb::CommandInfo >( aLinkCommandInfoTable, 4 );
422 else
424 static const ucb::CommandInfo aLinkCommandInfoTable[] =
426 ///////////////////////////////////////////////////////////
427 // Required commands
428 ///////////////////////////////////////////////////////////
429 ucb::CommandInfo(
430 rtl::OUString(
431 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
433 getCppuVoidType()
435 ucb::CommandInfo(
436 rtl::OUString(
437 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
439 getCppuVoidType()
441 ucb::CommandInfo(
442 rtl::OUString(
443 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
445 getCppuType(
446 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
448 ucb::CommandInfo(
449 rtl::OUString(
450 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
452 getCppuType(
453 static_cast<
454 uno::Sequence< beans::PropertyValue > * >( 0 ) )
456 ///////////////////////////////////////////////////////////
457 // Optional standard commands
458 ///////////////////////////////////////////////////////////
459 ucb::CommandInfo(
460 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
462 getCppuBooleanType()
464 ucb::CommandInfo(
465 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
467 getCppuVoidType()
469 ///////////////////////////////////////////////////////////
470 // New commands
471 ///////////////////////////////////////////////////////////
473 return uno::Sequence<
474 ucb::CommandInfo >( aLinkCommandInfoTable, 6 );
477 else if ( m_eKind == FOLDER )
479 //=================================================================
481 // Folder: Supported commands
483 //=================================================================
485 if ( isReadOnly() )
487 static const ucb::CommandInfo aFolderCommandInfoTable[] =
489 ///////////////////////////////////////////////////////////
490 // Required commands
491 ///////////////////////////////////////////////////////////
492 ucb::CommandInfo(
493 rtl::OUString(
494 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
496 getCppuVoidType()
498 ucb::CommandInfo(
499 rtl::OUString(
500 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
502 getCppuVoidType()
504 ucb::CommandInfo(
505 rtl::OUString(
506 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
508 getCppuType(
509 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
511 ucb::CommandInfo(
512 rtl::OUString(
513 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
515 getCppuType(
516 static_cast<
517 uno::Sequence< beans::PropertyValue > * >( 0 ) )
519 ///////////////////////////////////////////////////////////
520 // Optional standard commands
521 ///////////////////////////////////////////////////////////
522 ucb::CommandInfo(
523 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
525 getCppuType(
526 static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
528 ///////////////////////////////////////////////////////////
529 // New commands
530 ///////////////////////////////////////////////////////////
532 return uno::Sequence<
533 ucb::CommandInfo >( aFolderCommandInfoTable, 5 );
535 else
537 static const ucb::CommandInfo aFolderCommandInfoTable[] =
539 ///////////////////////////////////////////////////////////
540 // Required commands
541 ///////////////////////////////////////////////////////////
542 ucb::CommandInfo(
543 rtl::OUString(
544 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
546 getCppuVoidType()
548 ucb::CommandInfo(
549 rtl::OUString(
550 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
552 getCppuVoidType()
554 ucb::CommandInfo(
555 rtl::OUString(
556 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
558 getCppuType(
559 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
561 ucb::CommandInfo(
562 rtl::OUString(
563 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
565 getCppuType(
566 static_cast<
567 uno::Sequence< beans::PropertyValue > * >( 0 ) )
569 ///////////////////////////////////////////////////////////
570 // Optional standard commands
571 ///////////////////////////////////////////////////////////
572 ucb::CommandInfo(
573 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
575 getCppuBooleanType()
577 ucb::CommandInfo(
578 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
580 getCppuVoidType()
582 ucb::CommandInfo(
583 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
585 getCppuType(
586 static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
588 ucb::CommandInfo(
589 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
591 getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
593 ///////////////////////////////////////////////////////////
594 // New commands
595 ///////////////////////////////////////////////////////////
597 return uno::Sequence<
598 ucb::CommandInfo >( aFolderCommandInfoTable, 8 );
601 else
603 //=================================================================
605 // Root Folder: Supported commands
607 //=================================================================
609 if ( isReadOnly() )
611 static const ucb::CommandInfo aRootFolderCommandInfoTable[] =
613 ///////////////////////////////////////////////////////////
614 // Required commands
615 ///////////////////////////////////////////////////////////
616 ucb::CommandInfo(
617 rtl::OUString(
618 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
620 getCppuVoidType()
622 ucb::CommandInfo(
623 rtl::OUString(
624 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
626 getCppuVoidType()
628 ucb::CommandInfo(
629 rtl::OUString(
630 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
632 getCppuType(
633 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
635 ucb::CommandInfo(
636 rtl::OUString(
637 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
639 getCppuType(
640 static_cast<
641 uno::Sequence< beans::PropertyValue > * >( 0 ) )
643 ///////////////////////////////////////////////////////////
644 // Optional standard commands
645 ///////////////////////////////////////////////////////////
646 ucb::CommandInfo(
647 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
649 getCppuType(
650 static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
652 ///////////////////////////////////////////////////////////
653 // New commands
654 ///////////////////////////////////////////////////////////
656 return uno::Sequence<
657 ucb::CommandInfo >( aRootFolderCommandInfoTable, 5 );
659 else
661 static const ucb::CommandInfo aRootFolderCommandInfoTable[] =
663 ///////////////////////////////////////////////////////////
664 // Required commands
665 ///////////////////////////////////////////////////////////
666 ucb::CommandInfo(
667 rtl::OUString(
668 RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
670 getCppuVoidType()
672 ucb::CommandInfo(
673 rtl::OUString(
674 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
676 getCppuVoidType()
678 ucb::CommandInfo(
679 rtl::OUString(
680 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
682 getCppuType(
683 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
685 ucb::CommandInfo(
686 rtl::OUString(
687 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
689 getCppuType(
690 static_cast<
691 uno::Sequence< beans::PropertyValue > * >( 0 ) )
693 ///////////////////////////////////////////////////////////
694 // Optional standard commands
695 ///////////////////////////////////////////////////////////
696 ucb::CommandInfo(
697 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
699 getCppuType(
700 static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
702 ucb::CommandInfo(
703 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
705 getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
707 ///////////////////////////////////////////////////////////
708 // New commands
709 ///////////////////////////////////////////////////////////
711 return uno::Sequence<
712 ucb::CommandInfo >( aRootFolderCommandInfoTable, 6 );