1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_ucb.hxx"
30 
31 /**************************************************************************
32                                 TODO
33  **************************************************************************
34 
35  **************************************************************************
36 
37     Props/Commands:
38 
39                            root    folder  folder  link    link
40                                    (new)           (new)
41     ----------------------------------------------------------------
42     ContentType            x       x       x       x       x
43     IsDocument             x       x       x       x       x
44     IsFolder               x       x       x       x       x
45     Title                  x       x       x       x       x
46     TargetURL                                      x       x
47     CreatableContentsInfo  x       x       x       x       x
48 
49     getCommandInfo         x       x       x       x       x
50     getPropertySetInfo     x       x       x       x       x
51     getPropertyValues      x       x       x       x       x
52     setPropertyValues      x       x       x       x       x
53     createNewContent       x               x
54     insert                                 x               x
55     delete                         x               x
56     open                   x       x
57     transfer               x       x
58 
59  *************************************************************************/
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"
69 
70 using namespace com::sun::star;
71 using namespace hierarchy_ucp;
72 
73 //=========================================================================
74 //
75 // HierarchyContent implementation.
76 //
77 //=========================================================================
78 
79 #define MAKEPROPSEQUENCE( a ) \
80     uno::Sequence< beans::Property >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
81 
82 #define MAKECMDSEQUENCE( a ) \
83     uno::Sequence< ucb::CommandInfo >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
84 
85 //=========================================================================
86 //
87 // IMPORTENT: If any property data ( name / type / ... ) are changed, then
88 //            HierarchyContent::getPropertyValues(...) must be adapted too!
89 //
90 //=========================================================================
91 
92 // virtual
93 uno::Sequence< beans::Property > HierarchyContent::getProperties(
94             const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
95 {
96     osl::Guard< osl::Mutex > aGuard( m_aMutex );
97 
98     if ( m_eKind == LINK )
99     {
100         //=================================================================
101         //
102         // Link: Supported properties
103         //
104         //=================================================================
105 
106         if ( isReadOnly() )
107         {
108             static beans::Property aLinkPropertyInfoTable[] =
109             {
110                 ///////////////////////////////////////////////////////////
111                 // Required properties
112                 ///////////////////////////////////////////////////////////
113                 beans::Property(
114                     rtl::OUString(
115                         RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
116                     -1,
117                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
118                     beans::PropertyAttribute::BOUND
119                         | beans::PropertyAttribute::READONLY
120                 ),
121                 beans::Property(
122                     rtl::OUString(
123                         RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
124                     -1,
125                     getCppuBooleanType(),
126                     beans::PropertyAttribute::BOUND
127                         | beans::PropertyAttribute::READONLY
128                 ),
129                 beans::Property(
130                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
131                     -1,
132                     getCppuBooleanType(),
133                     beans::PropertyAttribute::BOUND
134                         | beans::PropertyAttribute::READONLY
135                 ),
136                 beans::Property(
137                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
138                     -1,
139                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
140                     beans::PropertyAttribute::BOUND
141                         | beans::PropertyAttribute::READONLY
142                 ),
143                 ///////////////////////////////////////////////////////////
144                 // Optional standard properties
145                 ///////////////////////////////////////////////////////////
146                 beans::Property(
147                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) ),
148                     -1,
149                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
150                     beans::PropertyAttribute::BOUND
151                         | beans::PropertyAttribute::READONLY
152                 ),
153                 beans::Property(
154                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
155                         "CreatableContentsInfo" ) ),
156                     -1,
157                     getCppuType( static_cast<
158                         const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
159                     beans::PropertyAttribute::BOUND
160                         | beans::PropertyAttribute::READONLY )
161                 ///////////////////////////////////////////////////////////
162                 // New properties
163                 ///////////////////////////////////////////////////////////
164             };
165             return MAKEPROPSEQUENCE( aLinkPropertyInfoTable );
166         }
167         else
168         {
169             static beans::Property aLinkPropertyInfoTable[] =
170             {
171                 ///////////////////////////////////////////////////////////
172                 // Required properties
173                 ///////////////////////////////////////////////////////////
174                 beans::Property(
175                     rtl::OUString(
176                         RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
177                     -1,
178                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
179                     beans::PropertyAttribute::BOUND
180                         | beans::PropertyAttribute::READONLY
181                 ),
182                 beans::Property(
183                     rtl::OUString(
184                         RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
185                     -1,
186                     getCppuBooleanType(),
187                     beans::PropertyAttribute::BOUND
188                         | beans::PropertyAttribute::READONLY
189                 ),
190                 beans::Property(
191                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
192                     -1,
193                     getCppuBooleanType(),
194                     beans::PropertyAttribute::BOUND
195                         | beans::PropertyAttribute::READONLY
196                 ),
197                 beans::Property(
198                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
199                     -1,
200                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
201                     beans::PropertyAttribute::BOUND
202                 ),
203                 ///////////////////////////////////////////////////////////
204                 // Optional standard properties
205                 ///////////////////////////////////////////////////////////
206                 beans::Property(
207                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) ),
208                     -1,
209                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
210                     beans::PropertyAttribute::BOUND
211                 ),
212                 beans::Property(
213                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
214                         "CreatableContentsInfo" ) ),
215                     -1,
216                     getCppuType( static_cast<
217                         const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
218                     beans::PropertyAttribute::BOUND
219                         | beans::PropertyAttribute::READONLY )
220                 ///////////////////////////////////////////////////////////
221                 // New properties
222                 ///////////////////////////////////////////////////////////
223             };
224             return MAKEPROPSEQUENCE( aLinkPropertyInfoTable );
225         }
226     }
227     else if ( m_eKind == FOLDER )
228     {
229         //=================================================================
230         //
231         // Folder: Supported properties
232         //
233         //=================================================================
234 
235         if ( isReadOnly() )
236         {
237             static beans::Property aFolderPropertyInfoTable[] =
238             {
239                 ///////////////////////////////////////////////////////////
240                 // Required properties
241                 ///////////////////////////////////////////////////////////
242                 beans::Property(
243                     rtl::OUString(
244                         RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
245                     -1,
246                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
247                     beans::PropertyAttribute::BOUND
248                         | beans::PropertyAttribute::READONLY
249                 ),
250                 beans::Property(
251                     rtl::OUString(
252                         RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
253                     -1,
254                     getCppuBooleanType(),
255                     beans::PropertyAttribute::BOUND
256                         | beans::PropertyAttribute::READONLY
257                 ),
258                 beans::Property(
259                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
260                     -1,
261                     getCppuBooleanType(),
262                     beans::PropertyAttribute::BOUND
263                         | beans::PropertyAttribute::READONLY
264                 ),
265                 beans::Property(
266                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
267                     -1,
268                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
269                     beans::PropertyAttribute::BOUND
270                         | beans::PropertyAttribute::READONLY
271                 ),
272                 ///////////////////////////////////////////////////////////
273                 // Optional standard properties
274                 ///////////////////////////////////////////////////////////
275                 beans::Property(
276                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
277                         "CreatableContentsInfo" ) ),
278                     -1,
279                     getCppuType( static_cast<
280                         const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
281                     beans::PropertyAttribute::BOUND
282                         | beans::PropertyAttribute::READONLY )
283                 ///////////////////////////////////////////////////////////
284                 // New properties
285                 ///////////////////////////////////////////////////////////
286             };
287             return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
288         }
289         else
290         {
291             static beans::Property aFolderPropertyInfoTable[] =
292             {
293                 ///////////////////////////////////////////////////////////
294                 // Required properties
295                 ///////////////////////////////////////////////////////////
296                 beans::Property(
297                     rtl::OUString(
298                         RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
299                     -1,
300                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
301                     beans::PropertyAttribute::BOUND
302                         | beans::PropertyAttribute::READONLY
303                 ),
304                 beans::Property(
305                     rtl::OUString(
306                         RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
307                     -1,
308                     getCppuBooleanType(),
309                     beans::PropertyAttribute::BOUND
310                         | beans::PropertyAttribute::READONLY
311                 ),
312                 beans::Property(
313                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
314                     -1,
315                     getCppuBooleanType(),
316                     beans::PropertyAttribute::BOUND
317                         | beans::PropertyAttribute::READONLY
318                 ),
319                 beans::Property(
320                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
321                     -1,
322                     getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
323                     beans::PropertyAttribute::BOUND
324                 ),
325                 ///////////////////////////////////////////////////////////
326                 // Optional standard properties
327                 ///////////////////////////////////////////////////////////
328                 beans::Property(
329                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
330                         "CreatableContentsInfo" ) ),
331                     -1,
332                     getCppuType( static_cast<
333                         const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
334                     beans::PropertyAttribute::BOUND
335                         | beans::PropertyAttribute::READONLY )
336                 ///////////////////////////////////////////////////////////
337                 // New properties
338                 ///////////////////////////////////////////////////////////
339             };
340             return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
341         }
342     }
343     else
344     {
345         //=================================================================
346         //
347         // Root Folder: Supported properties
348         //
349         //=================================================================
350 
351         // Currently no difference between reonly /read-write
352         // -> all props ar read-only
353 
354         static beans::Property aRootFolderPropertyInfoTable[] =
355         {
356             ///////////////////////////////////////////////////////////////
357             // Required properties
358             ///////////////////////////////////////////////////////////////
359             beans::Property(
360                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
361                 -1,
362                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
363                 beans::PropertyAttribute::BOUND
364                     | beans::PropertyAttribute::READONLY
365             ),
366             beans::Property(
367                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
368                 -1,
369                 getCppuBooleanType(),
370                 beans::PropertyAttribute::BOUND
371                     | beans::PropertyAttribute::READONLY
372             ),
373             beans::Property(
374                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
375                 -1,
376                 getCppuBooleanType(),
377                 beans::PropertyAttribute::BOUND
378                     | beans::PropertyAttribute::READONLY
379             ),
380             beans::Property(
381                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
382                 -1,
383                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
384                 beans::PropertyAttribute::BOUND
385                     | beans::PropertyAttribute::READONLY
386             ),
387             ///////////////////////////////////////////////////////////////
388             // Optional standard properties
389             ///////////////////////////////////////////////////////////////
390             beans::Property(
391                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
392                         "CreatableContentsInfo" ) ),
393                     -1,
394                     getCppuType( static_cast<
395                         const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
396                     beans::PropertyAttribute::BOUND
397                         | beans::PropertyAttribute::READONLY )
398             ///////////////////////////////////////////////////////////////
399             // New properties
400             ///////////////////////////////////////////////////////////////
401         };
402         return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable );
403     }
404 }
405 
406 //=========================================================================
407 // virtual
408 uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
409             const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
410 {
411     osl::Guard< osl::Mutex > aGuard( m_aMutex );
412 
413     if ( m_eKind == LINK )
414     {
415         //=================================================================
416         //
417         // Link: Supported commands
418         //
419         //=================================================================
420 
421         if ( isReadOnly() )
422         {
423             static const ucb::CommandInfo aLinkCommandInfoTable[] =
424             {
425                 ///////////////////////////////////////////////////////////
426                 // Required commands
427                 ///////////////////////////////////////////////////////////
428                 ucb::CommandInfo(
429                     rtl::OUString(
430                         RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
431                     -1,
432                     getCppuVoidType()
433                 ),
434                 ucb::CommandInfo(
435                     rtl::OUString(
436                         RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
437                     -1,
438                     getCppuVoidType()
439                 ),
440                 ucb::CommandInfo(
441                     rtl::OUString(
442                         RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
443                     -1,
444                     getCppuType(
445                         static_cast< uno::Sequence< beans::Property > * >( 0 ) )
446                 ),
447                 ucb::CommandInfo(
448                     rtl::OUString(
449                         RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
450                     -1,
451                     getCppuType(
452                         static_cast<
453                             uno::Sequence< beans::PropertyValue > * >( 0 ) )
454                 )
455                 ///////////////////////////////////////////////////////////
456                 // Optional standard commands
457                 ///////////////////////////////////////////////////////////
458 
459                 ///////////////////////////////////////////////////////////
460                 // New commands
461                 ///////////////////////////////////////////////////////////
462             };
463             return MAKECMDSEQUENCE( aLinkCommandInfoTable );
464         }
465         else
466         {
467             static const ucb::CommandInfo aLinkCommandInfoTable[] =
468             {
469                 ///////////////////////////////////////////////////////////
470                 // Required commands
471                 ///////////////////////////////////////////////////////////
472                 ucb::CommandInfo(
473                     rtl::OUString(
474                         RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
475                     -1,
476                     getCppuVoidType()
477                 ),
478                 ucb::CommandInfo(
479                     rtl::OUString(
480                         RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
481                     -1,
482                     getCppuVoidType()
483                 ),
484                 ucb::CommandInfo(
485                     rtl::OUString(
486                         RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
487                     -1,
488                     getCppuType(
489                         static_cast< uno::Sequence< beans::Property > * >( 0 ) )
490                 ),
491                 ucb::CommandInfo(
492                     rtl::OUString(
493                         RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
494                     -1,
495                     getCppuType(
496                         static_cast<
497                             uno::Sequence< beans::PropertyValue > * >( 0 ) )
498                 ),
499                 ///////////////////////////////////////////////////////////
500                 // Optional standard commands
501                 ///////////////////////////////////////////////////////////
502                 ucb::CommandInfo(
503                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
504                     -1,
505                     getCppuBooleanType()
506                 ),
507                 ucb::CommandInfo(
508                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
509                     -1,
510                     getCppuVoidType()
511                 )
512                 ///////////////////////////////////////////////////////////
513                 // New commands
514                 ///////////////////////////////////////////////////////////
515             };
516             return MAKECMDSEQUENCE( aLinkCommandInfoTable );
517         }
518     }
519     else if ( m_eKind == FOLDER )
520     {
521         //=================================================================
522         //
523         // Folder: Supported commands
524         //
525         //=================================================================
526 
527         if ( isReadOnly() )
528         {
529             static const ucb::CommandInfo aFolderCommandInfoTable[] =
530             {
531                 ///////////////////////////////////////////////////////////
532                 // Required commands
533                 ///////////////////////////////////////////////////////////
534                 ucb::CommandInfo(
535                     rtl::OUString(
536                         RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
537                     -1,
538                     getCppuVoidType()
539                 ),
540                 ucb::CommandInfo(
541                     rtl::OUString(
542                         RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
543                     -1,
544                     getCppuVoidType()
545                 ),
546                 ucb::CommandInfo(
547                     rtl::OUString(
548                         RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
549                     -1,
550                     getCppuType(
551                         static_cast< uno::Sequence< beans::Property > * >( 0 ) )
552                 ),
553                 ucb::CommandInfo(
554                     rtl::OUString(
555                         RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
556                     -1,
557                     getCppuType(
558                         static_cast<
559                             uno::Sequence< beans::PropertyValue > * >( 0 ) )
560                 ),
561                 ///////////////////////////////////////////////////////////
562                 // Optional standard commands
563                 ///////////////////////////////////////////////////////////
564                 ucb::CommandInfo(
565                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
566                     -1,
567                     getCppuType(
568                         static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
569                 )
570                 ///////////////////////////////////////////////////////////
571                 // New commands
572                 ///////////////////////////////////////////////////////////
573             };
574             return MAKECMDSEQUENCE( aFolderCommandInfoTable );
575         }
576         else
577         {
578             static const ucb::CommandInfo aFolderCommandInfoTable[] =
579             {
580                 ///////////////////////////////////////////////////////////
581                 // Required commands
582                 ///////////////////////////////////////////////////////////
583                 ucb::CommandInfo(
584                     rtl::OUString(
585                         RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
586                     -1,
587                     getCppuVoidType()
588                 ),
589                 ucb::CommandInfo(
590                     rtl::OUString(
591                         RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
592                     -1,
593                     getCppuVoidType()
594                 ),
595                 ucb::CommandInfo(
596                     rtl::OUString(
597                         RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
598                     -1,
599                     getCppuType(
600                         static_cast< uno::Sequence< beans::Property > * >( 0 ) )
601                 ),
602                 ucb::CommandInfo(
603                     rtl::OUString(
604                         RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
605                     -1,
606                     getCppuType(
607                         static_cast<
608                             uno::Sequence< beans::PropertyValue > * >( 0 ) )
609                 ),
610                 ///////////////////////////////////////////////////////////
611                 // Optional standard commands
612                 ///////////////////////////////////////////////////////////
613                 ucb::CommandInfo(
614                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
615                     -1,
616                     getCppuBooleanType()
617                 ),
618                 ucb::CommandInfo(
619                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
620                     -1,
621                     getCppuVoidType()
622                 ),
623                 ucb::CommandInfo(
624                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
625                     -1,
626                     getCppuType(
627                         static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
628                 ),
629                 ucb::CommandInfo(
630                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
631                     -1,
632                     getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
633                 ),
634                 ucb::CommandInfo(
635                     rtl::OUString(
636                         RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
637                     -1,
638                     getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
639                 )
640                 ///////////////////////////////////////////////////////////
641                 // New commands
642                 ///////////////////////////////////////////////////////////
643             };
644             return MAKECMDSEQUENCE( aFolderCommandInfoTable );
645         }
646     }
647     else
648     {
649         //=================================================================
650         //
651         // Root Folder: Supported commands
652         //
653         //=================================================================
654 
655         if ( isReadOnly() )
656         {
657             static const ucb::CommandInfo aRootFolderCommandInfoTable[] =
658             {
659                 ///////////////////////////////////////////////////////////
660                 // Required commands
661                 ///////////////////////////////////////////////////////////
662                 ucb::CommandInfo(
663                     rtl::OUString(
664                         RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
665                     -1,
666                     getCppuVoidType()
667                 ),
668                 ucb::CommandInfo(
669                     rtl::OUString(
670                         RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
671                     -1,
672                     getCppuVoidType()
673                 ),
674                 ucb::CommandInfo(
675                     rtl::OUString(
676                         RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
677                     -1,
678                     getCppuType(
679                         static_cast< uno::Sequence< beans::Property > * >( 0 ) )
680                 ),
681                 ucb::CommandInfo(
682                     rtl::OUString(
683                         RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
684                     -1,
685                     getCppuType(
686                         static_cast<
687                             uno::Sequence< beans::PropertyValue > * >( 0 ) )
688                 ),
689                 ///////////////////////////////////////////////////////////
690                 // Optional standard commands
691                 ///////////////////////////////////////////////////////////
692                 ucb::CommandInfo(
693                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
694                     -1,
695                     getCppuType(
696                         static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
697                 )
698                 ///////////////////////////////////////////////////////////
699                 // New commands
700                 ///////////////////////////////////////////////////////////
701             };
702             return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
703         }
704         else
705         {
706             static const ucb::CommandInfo aRootFolderCommandInfoTable[] =
707             {
708                 ///////////////////////////////////////////////////////////
709                 // Required commands
710                 ///////////////////////////////////////////////////////////
711                 ucb::CommandInfo(
712                     rtl::OUString(
713                         RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
714                     -1,
715                     getCppuVoidType()
716                 ),
717                 ucb::CommandInfo(
718                     rtl::OUString(
719                         RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
720                     -1,
721                     getCppuVoidType()
722                 ),
723                 ucb::CommandInfo(
724                     rtl::OUString(
725                         RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
726                     -1,
727                     getCppuType(
728                         static_cast< uno::Sequence< beans::Property > * >( 0 ) )
729                 ),
730                 ucb::CommandInfo(
731                     rtl::OUString(
732                         RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
733                     -1,
734                     getCppuType(
735                         static_cast<
736                             uno::Sequence< beans::PropertyValue > * >( 0 ) )
737                 ),
738                 ///////////////////////////////////////////////////////////
739                 // Optional standard commands
740                 ///////////////////////////////////////////////////////////
741                 ucb::CommandInfo(
742                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
743                     -1,
744                     getCppuType(
745                         static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
746                 ),
747                 ucb::CommandInfo(
748                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
749                     -1,
750                     getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
751                 ),
752                 ucb::CommandInfo(
753                     rtl::OUString(
754                         RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
755                     -1,
756                     getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
757                 )
758                 ///////////////////////////////////////////////////////////
759                 // New commands
760                 ///////////////////////////////////////////////////////////
761             };
762             return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
763         }
764     }
765 }
766