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