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  document folder  folder  stream  stream
40                                                 (new)          (new)
41     ----------------------------------------------------------------
42     ContentType         r       r       r       r       r       r
43     IsDocument          r       r       r       r       r       r
44     IsFolder            r       r       r       r       r       r
45     Title               r       r       w       w       w       w
46     CreatableContentsInfo r     r       r       r       r       r
47     Storage             -       -       r       r       -       -
48     DocumentModel       -       r       -       -       -       -
49 
50     getCommandInfo      x       x       x       x       x       x
51     getPropertySetInfo  x       x       x       x       x       x
52     getPropertyValues   x       x       x       x       x       x
53     setPropertyValues   x       x       x       x       x       x
54     insert              -       -       x       x       x(*)    x(*)
55     delete              -       -       x       -       x       -
56     open                x       x       x       -       x       -
57     transfer            -       x       x       -       -       -
58     createNewContent    -       x       x       -       -       -
59 
60 #ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
61  (*) not supported by streams that are direct children of document
62 #endif
63 
64  *************************************************************************/
65 
66 #include "com/sun/star/beans/Property.hpp"
67 #include "com/sun/star/beans/PropertyAttribute.hpp"
68 #include "com/sun/star/beans/PropertyValue.hpp"
69 #include "com/sun/star/embed/XStorage.hpp"
70 #include "com/sun/star/frame/XModel.hpp"
71 #include "com/sun/star/ucb/CommandInfo.hpp"
72 #include "com/sun/star/ucb/OpenCommandArgument2.hpp"
73 #include "com/sun/star/ucb/TransferInfo.hpp"
74 
75 #include "tdoc_content.hxx"
76 
77 namespace com { namespace sun { namespace star { namespace embed {
78     class XStorage;
79 } } } }
80 
81 using namespace com::sun::star;
82 using namespace tdoc_ucp;
83 
84 //=========================================================================
85 //
86 // Content implementation.
87 //
88 //=========================================================================
89 
90 #define MAKEPROPSEQUENCE( a ) \
91     uno::Sequence< beans::Property >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
92 
93 #define MAKECMDSEQUENCE( a ) \
94     uno::Sequence< ucb::CommandInfo >( a, sizeof( a )  / sizeof( a[ 0 ] ) )
95 
96 //=========================================================================
97 //
98 // IMPORTENT: If any property data ( name / type / ... ) are changed, then
99 //            Content::getPropertyValues(...) must be adapted too!
100 //
101 //=========================================================================
102 
103 // virtual
104 uno::Sequence< beans::Property > Content::getProperties(
105             const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
106 {
107     osl::Guard< osl::Mutex > aGuard( m_aMutex );
108 
109     if ( m_aProps.getType() == STREAM )
110     {
111         //=================================================================
112         //
113         // Stream: Supported properties
114         //
115         //=================================================================
116 
117         static const beans::Property aStreamPropertyInfoTable[] =
118         {
119             ///////////////////////////////////////////////////////////
120             // Mandatory properties
121             ///////////////////////////////////////////////////////////
122             beans::Property(
123                 rtl::OUString(
124                     RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
125                 -1,
126                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
127                 beans::PropertyAttribute::BOUND
128                     | beans::PropertyAttribute::READONLY
129             ),
130             beans::Property(
131                 rtl::OUString(
132                     RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
133                 -1,
134                 getCppuBooleanType(),
135                 beans::PropertyAttribute::BOUND
136                     | beans::PropertyAttribute::READONLY
137             ),
138             beans::Property(
139                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
140                 -1,
141                 getCppuBooleanType(),
142                 beans::PropertyAttribute::BOUND
143                     | beans::PropertyAttribute::READONLY
144             ),
145             beans::Property(
146                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
147                 -1,
148                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
149                 beans::PropertyAttribute::BOUND
150             ),
151             ///////////////////////////////////////////////////////////
152             // Optional standard properties
153             ///////////////////////////////////////////////////////////
154             beans::Property(
155                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
156                     "CreatableContentsInfo" ) ),
157                 -1,
158                 getCppuType( static_cast<
159                     const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
160                 beans::PropertyAttribute::BOUND
161                     | beans::PropertyAttribute::READONLY
162             )
163             ///////////////////////////////////////////////////////////
164             // New properties
165             ///////////////////////////////////////////////////////////
166         };
167         return MAKEPROPSEQUENCE( aStreamPropertyInfoTable );
168     }
169     else if ( m_aProps.getType() == FOLDER )
170     {
171         //=================================================================
172         //
173         // Folder: Supported properties
174         //
175         //=================================================================
176 
177         static const beans::Property aFolderPropertyInfoTable[] =
178         {
179             ///////////////////////////////////////////////////////////
180             // Mandatory properties
181             ///////////////////////////////////////////////////////////
182             beans::Property(
183                 rtl::OUString(
184                     RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
185                 -1,
186                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
187                 beans::PropertyAttribute::BOUND
188                     | beans::PropertyAttribute::READONLY
189             ),
190             beans::Property(
191                 rtl::OUString(
192                     RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
193                 -1,
194                 getCppuBooleanType(),
195                 beans::PropertyAttribute::BOUND
196                     | beans::PropertyAttribute::READONLY
197             ),
198             beans::Property(
199                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
200                 -1,
201                 getCppuBooleanType(),
202                 beans::PropertyAttribute::BOUND
203                     | beans::PropertyAttribute::READONLY
204             ),
205             beans::Property(
206                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
207                 -1,
208                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
209                 beans::PropertyAttribute::BOUND
210             ),
211             ///////////////////////////////////////////////////////////
212             // Optional standard properties
213             ///////////////////////////////////////////////////////////
214             beans::Property(
215                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
216                     "CreatableContentsInfo" ) ),
217                 -1,
218                 getCppuType( static_cast<
219                     const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
220                 beans::PropertyAttribute::BOUND
221                     | beans::PropertyAttribute::READONLY
222             ),
223             ///////////////////////////////////////////////////////////
224             // New properties
225             ///////////////////////////////////////////////////////////
226             beans::Property(
227                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Storage" ) ),
228                 -1,
229                 getCppuType( static_cast<
230                     const uno::Reference< embed::XStorage > * >( 0 ) ),
231                 beans::PropertyAttribute::BOUND
232                     | beans::PropertyAttribute::READONLY
233             )
234         };
235         return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
236     }
237     else if ( m_aProps.getType() == DOCUMENT )
238     {
239         //=================================================================
240         //
241         // Document: Supported properties
242         //
243         //=================================================================
244 
245         static const beans::Property aDocPropertyInfoTable[] =
246         {
247             ///////////////////////////////////////////////////////////
248             // Mandatory properties
249             ///////////////////////////////////////////////////////////
250             beans::Property(
251                 rtl::OUString(
252                     RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
253                 -1,
254                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
255                 beans::PropertyAttribute::BOUND
256                     | beans::PropertyAttribute::READONLY
257             ),
258             beans::Property(
259                 rtl::OUString(
260                     RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
261                 -1,
262                 getCppuBooleanType(),
263                 beans::PropertyAttribute::BOUND
264                     | beans::PropertyAttribute::READONLY
265             ),
266             beans::Property(
267                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
268                 -1,
269                 getCppuBooleanType(),
270                 beans::PropertyAttribute::BOUND
271                     | beans::PropertyAttribute::READONLY
272             ),
273             beans::Property(
274                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
275                 -1,
276                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
277                 beans::PropertyAttribute::BOUND
278                     | beans::PropertyAttribute::READONLY
279             ),
280             ///////////////////////////////////////////////////////////
281             // Optional standard properties
282             ///////////////////////////////////////////////////////////
283             beans::Property(
284                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
285                     "CreatableContentsInfo" ) ),
286                 -1,
287                 getCppuType( static_cast<
288                     const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
289                 beans::PropertyAttribute::BOUND
290                     | beans::PropertyAttribute::READONLY
291             ),
292             ///////////////////////////////////////////////////////////
293             // New properties
294             ///////////////////////////////////////////////////////////
295             beans::Property(
296                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentModel" ) ),
297                 -1,
298                 getCppuType( static_cast<
299                     const uno::Reference< frame::XModel > * >( 0 ) ),
300                 beans::PropertyAttribute::BOUND
301                     | beans::PropertyAttribute::READONLY
302             )
303         };
304         return MAKEPROPSEQUENCE( aDocPropertyInfoTable );
305     }
306     else
307     {
308         //=================================================================
309         //
310         // Root: Supported properties
311         //
312         //=================================================================
313 
314         OSL_ENSURE( m_aProps.getType() == ROOT, "Wrong content type!" );
315 
316         static const beans::Property aRootPropertyInfoTable[] =
317         {
318             ///////////////////////////////////////////////////////////////
319             // Mandatory properties
320             ///////////////////////////////////////////////////////////////
321             beans::Property(
322                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
323                 -1,
324                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
325                 beans::PropertyAttribute::BOUND
326                     | beans::PropertyAttribute::READONLY
327             ),
328             beans::Property(
329                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
330                 -1,
331                 getCppuBooleanType(),
332                 beans::PropertyAttribute::BOUND
333                     | beans::PropertyAttribute::READONLY
334             ),
335             beans::Property(
336                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
337                 -1,
338                 getCppuBooleanType(),
339                 beans::PropertyAttribute::BOUND
340                     | beans::PropertyAttribute::READONLY
341             ),
342             beans::Property(
343                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
344                 -1,
345                 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
346                 beans::PropertyAttribute::BOUND
347                     | beans::PropertyAttribute::READONLY
348             ),
349             ///////////////////////////////////////////////////////////////
350             // Optional standard properties
351             ///////////////////////////////////////////////////////////////
352             beans::Property(
353                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
354                     "CreatableContentsInfo" ) ),
355                 -1,
356                 getCppuType( static_cast<
357                     const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
358                 beans::PropertyAttribute::BOUND
359                     | beans::PropertyAttribute::READONLY
360             )
361             ///////////////////////////////////////////////////////////////
362             // New properties
363             ///////////////////////////////////////////////////////////////
364         };
365         return MAKEPROPSEQUENCE( aRootPropertyInfoTable );
366     }
367 }
368 
369 //=========================================================================
370 // virtual
371 uno::Sequence< ucb::CommandInfo > Content::getCommands(
372             const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
373 {
374     osl::Guard< osl::Mutex > aGuard( m_aMutex );
375 
376     if ( m_aProps.getType() == STREAM )
377     {
378 #ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
379         Uri aUri( m_xIdentifier->getContentIdentifier() );
380         Uri aParentUri( aUri.getParentUri() );
381 
382         if ( aParentUri.isDocument() )
383         {
384             //=================================================================
385             //
386             // Stream, that is a child of a document: Supported commands
387             //
388             //=================================================================
389 
390             static const ucb::CommandInfo aStreamCommandInfoTable1[] =
391             {
392                 ///////////////////////////////////////////////////////////
393                 // Mandatory commands
394                 ///////////////////////////////////////////////////////////
395                 ucb::CommandInfo(
396                     rtl::OUString(
397                         RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
398                     -1,
399                     getCppuVoidType()
400                 ),
401                 ucb::CommandInfo(
402                     rtl::OUString(
403                         RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
404                     -1,
405                     getCppuVoidType()
406                 ),
407                 ucb::CommandInfo(
408                     rtl::OUString(
409                         RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
410                     -1,
411                     getCppuType(
412                         static_cast< uno::Sequence< beans::Property > * >( 0 ) )
413                 ),
414                 ucb::CommandInfo(
415                     rtl::OUString(
416                         RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
417                     -1,
418                     getCppuType(
419                         static_cast<
420                             uno::Sequence< beans::PropertyValue > * >( 0 ) )
421                 ),
422                 ///////////////////////////////////////////////////////////
423                 // Optional standard commands
424                 ///////////////////////////////////////////////////////////
425                 ucb::CommandInfo(
426                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
427                     -1,
428                     getCppuBooleanType()
429                 ),
430                 ucb::CommandInfo(
431                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
432                     -1,
433                     getCppuType(
434                         static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
435                 )
436                 ///////////////////////////////////////////////////////////
437                 // New commands
438                 ///////////////////////////////////////////////////////////
439             };
440             return MAKECMDSEQUENCE( aStreamCommandInfoTable1 );
441         }
442 #endif
443         //=================================================================
444         //
445         // Stream: Supported commands
446         //
447         //=================================================================
448 
449         static const ucb::CommandInfo aStreamCommandInfoTable[] =
450         {
451             ///////////////////////////////////////////////////////////
452             // Mandatory commands
453             ///////////////////////////////////////////////////////////
454             ucb::CommandInfo(
455                 rtl::OUString(
456                     RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
457                 -1,
458                 getCppuVoidType()
459             ),
460             ucb::CommandInfo(
461                 rtl::OUString(
462                     RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
463                 -1,
464                 getCppuVoidType()
465             ),
466             ucb::CommandInfo(
467                 rtl::OUString(
468                     RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
469                 -1,
470                 getCppuType(
471                     static_cast< uno::Sequence< beans::Property > * >( 0 ) )
472             ),
473             ucb::CommandInfo(
474                 rtl::OUString(
475                     RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
476                 -1,
477                 getCppuType(
478                     static_cast<
479                         uno::Sequence< beans::PropertyValue > * >( 0 ) )
480             ),
481             ///////////////////////////////////////////////////////////
482             // Optional standard commands
483             ///////////////////////////////////////////////////////////
484             ucb::CommandInfo(
485                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
486                 -1,
487                 getCppuBooleanType()
488             ),
489             ucb::CommandInfo(
490                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
491                 -1,
492                 getCppuVoidType()
493             ),
494             ucb::CommandInfo(
495                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
496                 -1,
497                 getCppuType(
498                     static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
499             )
500             ///////////////////////////////////////////////////////////
501             // New commands
502             ///////////////////////////////////////////////////////////
503         };
504         return MAKECMDSEQUENCE( aStreamCommandInfoTable );
505     }
506     else if ( m_aProps.getType() == FOLDER )
507     {
508         //=================================================================
509         //
510         // Folder: Supported commands
511         //
512         //=================================================================
513 
514         static const ucb::CommandInfo aFolderCommandInfoTable[] =
515         {
516             ///////////////////////////////////////////////////////////
517             // Mandatory commands
518             ///////////////////////////////////////////////////////////
519             ucb::CommandInfo(
520                 rtl::OUString(
521                     RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
522                 -1,
523                 getCppuVoidType()
524             ),
525             ucb::CommandInfo(
526                 rtl::OUString(
527                     RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
528                 -1,
529                 getCppuVoidType()
530             ),
531             ucb::CommandInfo(
532                 rtl::OUString(
533                     RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
534                 -1,
535                 getCppuType(
536                     static_cast< uno::Sequence< beans::Property > * >( 0 ) )
537             ),
538             ucb::CommandInfo(
539                 rtl::OUString(
540                     RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
541                 -1,
542                 getCppuType(
543                     static_cast<
544                         uno::Sequence< beans::PropertyValue > * >( 0 ) )
545             ),
546             ///////////////////////////////////////////////////////////
547             // Optional standard commands
548             ///////////////////////////////////////////////////////////
549             ucb::CommandInfo(
550                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
551                 -1,
552                 getCppuBooleanType()
553             ),
554             ucb::CommandInfo(
555                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
556                 -1,
557                 getCppuVoidType()
558             ),
559             ucb::CommandInfo(
560                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
561                 -1,
562                 getCppuType(
563                     static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
564             ),
565             ucb::CommandInfo(
566                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
567                 -1,
568                 getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
569             ),
570             ucb::CommandInfo(
571                 rtl::OUString(
572                     RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
573                 -1,
574                 getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
575             )
576             ///////////////////////////////////////////////////////////
577             // New commands
578             ///////////////////////////////////////////////////////////
579         };
580         return MAKECMDSEQUENCE( aFolderCommandInfoTable );
581     }
582     else if ( m_aProps.getType() == DOCUMENT )
583     {
584         //=================================================================
585         //
586         // Document: Supported commands
587         //
588         //=================================================================
589 
590         static const ucb::CommandInfo aDocCommandInfoTable[] =
591         {
592             ///////////////////////////////////////////////////////////
593             // Mandatory commands
594             ///////////////////////////////////////////////////////////
595             ucb::CommandInfo(
596                 rtl::OUString(
597                     RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
598                 -1,
599                 getCppuVoidType()
600             ),
601             ucb::CommandInfo(
602                 rtl::OUString(
603                     RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
604                 -1,
605                 getCppuVoidType()
606             ),
607             ucb::CommandInfo(
608                 rtl::OUString(
609                     RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
610                 -1,
611                 getCppuType(
612                     static_cast< uno::Sequence< beans::Property > * >( 0 ) )
613             ),
614             ucb::CommandInfo(
615                 rtl::OUString(
616                     RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
617                 -1,
618                 getCppuType(
619                     static_cast<
620                         uno::Sequence< beans::PropertyValue > * >( 0 ) )
621             ),
622             ///////////////////////////////////////////////////////////
623             // Optional standard commands
624             ///////////////////////////////////////////////////////////
625             ucb::CommandInfo(
626                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
627                 -1,
628                 getCppuType(
629                     static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
630             ),
631             ucb::CommandInfo(
632                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
633                 -1,
634                 getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
635             ),
636             ucb::CommandInfo(
637                 rtl::OUString(
638                     RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
639                 -1,
640                 getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
641             )
642             ///////////////////////////////////////////////////////////
643             // New commands
644             ///////////////////////////////////////////////////////////
645         };
646         return MAKECMDSEQUENCE( aDocCommandInfoTable );
647     }
648     else
649     {
650         //=================================================================
651         //
652         // Root: Supported commands
653         //
654         //=================================================================
655 
656         OSL_ENSURE( m_aProps.getType() == ROOT, "Wrong content type!" );
657 
658         static const ucb::CommandInfo aRootCommandInfoTable[] =
659         {
660             ///////////////////////////////////////////////////////////
661             // Mandatory commands
662             ///////////////////////////////////////////////////////////
663             ucb::CommandInfo(
664                 rtl::OUString(
665                     RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
666                 -1,
667                 getCppuVoidType()
668             ),
669             ucb::CommandInfo(
670                 rtl::OUString(
671                     RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
672                 -1,
673                 getCppuVoidType()
674             ),
675             ucb::CommandInfo(
676                 rtl::OUString(
677                     RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
678                 -1,
679                 getCppuType(
680                     static_cast< uno::Sequence< beans::Property > * >( 0 ) )
681             ),
682             ucb::CommandInfo(
683                 rtl::OUString(
684                     RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
685                 -1,
686                 getCppuType(
687                     static_cast<
688                         uno::Sequence< beans::PropertyValue > * >( 0 ) )
689             ),
690             ///////////////////////////////////////////////////////////
691             // Optional standard commands
692             ///////////////////////////////////////////////////////////
693             ucb::CommandInfo(
694                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
695                 -1,
696                 getCppuType(
697                     static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
698             )
699             ///////////////////////////////////////////////////////////
700             // New commands
701             ///////////////////////////////////////////////////////////
702         };
703         return MAKECMDSEQUENCE( aRootCommandInfoTable );
704     }
705 }
706