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