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