1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 /**************************************************************************
23 **************************************************************************
27 rootfolder folder stream
28 ---------------------------------------------
35 CreatableContentsInfo r r r
38 HasEncryptedEntries r - -
41 getPropertySetInfo x x x
42 getPropertyValues x x x
43 setPropertyValues x x x
49 createNewContent x x -
51 *************************************************************************/
52 #include <com/sun/star/beans/Property.hpp>
53 #include <com/sun/star/beans/PropertyAttribute.hpp>
54 #include <com/sun/star/beans/PropertyValue.hpp>
55 #include <com/sun/star/ucb/CommandInfo.hpp>
56 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
57 #include <com/sun/star/ucb/TransferInfo.hpp>
58 #include <com/sun/star/uno/Sequence.hxx>
59 #include <sal/macros.h>
60 #include "pkgcontent.hxx"
62 using namespace com::sun::star
;
63 using namespace package_ucp
;
66 // Content implementation.
69 #define MAKEPROPSEQUENCE( a ) \
70 uno::Sequence< beans::Property >( a, SAL_N_ELEMENTS( a ) )
72 #define MAKECMDSEQUENCE( a ) \
73 uno::Sequence< ucb::CommandInfo >( a, SAL_N_ELEMENTS( a ) )
76 // IMPORTANT: If any property data ( name / type / ... ) are changed, then
77 // Content::getPropertyValues(...) must be adapted too!
81 uno::Sequence
< beans::Property
> Content::getProperties(
82 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
84 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
88 if ( m_aUri
.isRootFolder() )
92 // Root Folder: Supported properties
95 static const beans::Property aRootFolderPropertyInfoTable
[] =
98 // Required properties
103 cppu::UnoType
<OUString
>::get(),
104 beans::PropertyAttribute::BOUND
105 | beans::PropertyAttribute::READONLY
110 cppu::UnoType
<bool>::get(),
111 beans::PropertyAttribute::BOUND
112 | beans::PropertyAttribute::READONLY
117 cppu::UnoType
<bool>::get(),
118 beans::PropertyAttribute::BOUND
119 | beans::PropertyAttribute::READONLY
124 cppu::UnoType
<OUString
>::get(),
125 beans::PropertyAttribute::BOUND
126 | beans::PropertyAttribute::READONLY
129 // Optional standard properties
134 cppu::UnoType
<OUString
>::get(),
135 beans::PropertyAttribute::BOUND
138 u
"CreatableContentsInfo"_ustr
,
140 cppu::UnoType
<uno::Sequence
< ucb::ContentInfo
>>::get(),
141 beans::PropertyAttribute::BOUND
142 | beans::PropertyAttribute::READONLY
148 u
"HasEncryptedEntries"_ustr
,
150 cppu::UnoType
<bool>::get(),
151 beans::PropertyAttribute::BOUND
152 | beans::PropertyAttribute::READONLY
155 return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable
);
161 // Folder: Supported properties
164 static const beans::Property aFolderPropertyInfoTable
[] =
167 // Required properties
172 cppu::UnoType
<OUString
>::get(),
173 beans::PropertyAttribute::BOUND
174 | beans::PropertyAttribute::READONLY
179 cppu::UnoType
<bool>::get(),
180 beans::PropertyAttribute::BOUND
181 | beans::PropertyAttribute::READONLY
186 cppu::UnoType
<bool>::get(),
187 beans::PropertyAttribute::BOUND
188 | beans::PropertyAttribute::READONLY
193 cppu::UnoType
<OUString
>::get(),
194 beans::PropertyAttribute::BOUND
197 // Optional standard properties
202 cppu::UnoType
<OUString
>::get(),
203 beans::PropertyAttribute::BOUND
206 u
"CreatableContentsInfo"_ustr
,
208 cppu::UnoType
<uno::Sequence
< ucb::ContentInfo
>>::get(),
209 beans::PropertyAttribute::BOUND
210 | beans::PropertyAttribute::READONLY
216 return MAKEPROPSEQUENCE( aFolderPropertyInfoTable
);
223 // Stream: Supported properties
226 static const beans::Property aStreamPropertyInfoTable
[] =
229 // Required properties
234 cppu::UnoType
<OUString
>::get(),
235 beans::PropertyAttribute::BOUND
236 | beans::PropertyAttribute::READONLY
241 cppu::UnoType
<bool>::get(),
242 beans::PropertyAttribute::BOUND
243 | beans::PropertyAttribute::READONLY
248 cppu::UnoType
<bool>::get(),
249 beans::PropertyAttribute::BOUND
250 | beans::PropertyAttribute::READONLY
255 cppu::UnoType
<OUString
>::get(),
256 beans::PropertyAttribute::BOUND
259 // Optional standard properties
264 cppu::UnoType
<OUString
>::get(),
265 beans::PropertyAttribute::BOUND
270 cppu::UnoType
<sal_Int64
>::get(),
271 beans::PropertyAttribute::BOUND
272 | beans::PropertyAttribute::READONLY
275 u
"CreatableContentsInfo"_ustr
,
277 cppu::UnoType
<uno::Sequence
< ucb::ContentInfo
>>::get(),
278 beans::PropertyAttribute::BOUND
279 | beans::PropertyAttribute::READONLY
287 cppu::UnoType
<bool>::get(),
288 beans::PropertyAttribute::BOUND
293 cppu::UnoType
<bool>::get(),
294 beans::PropertyAttribute::BOUND
297 return MAKEPROPSEQUENCE( aStreamPropertyInfoTable
);
303 uno::Sequence
< ucb::CommandInfo
> Content::getCommands(
304 const uno::Reference
< ucb::XCommandEnvironment
> & /*xEnv*/ )
306 osl::Guard
< osl::Mutex
> aGuard( m_aMutex
);
310 if ( m_aUri
.isRootFolder() )
314 // Root Folder: Supported commands
317 static const ucb::CommandInfo aRootFolderCommandInfoTable
[] =
323 u
"getCommandInfo"_ustr
,
325 cppu::UnoType
<void>::get()
328 u
"getPropertySetInfo"_ustr
,
330 cppu::UnoType
<void>::get()
333 u
"getPropertyValues"_ustr
,
335 cppu::UnoType
<uno::Sequence
< beans::Property
>>::get()
338 u
"setPropertyValues"_ustr
,
340 cppu::UnoType
<uno::Sequence
< beans::PropertyValue
>>::get()
343 // Optional standard commands
348 cppu::UnoType
<ucb::OpenCommandArgument2
>::get()
353 cppu::UnoType
<ucb::TransferInfo
>::get()
356 u
"createNewContent"_ustr
,
358 cppu::UnoType
<ucb::ContentInfo
>::get()
366 cppu::UnoType
<void>::get()
370 return MAKECMDSEQUENCE( aRootFolderCommandInfoTable
);
376 // Folder: Supported commands
379 static const ucb::CommandInfo aFolderCommandInfoTable
[] =
385 u
"getCommandInfo"_ustr
,
387 cppu::UnoType
<void>::get()
390 u
"getPropertySetInfo"_ustr
,
392 cppu::UnoType
<void>::get()
395 u
"getPropertyValues"_ustr
,
397 cppu::UnoType
<uno::Sequence
< beans::Property
>>::get()
400 u
"setPropertyValues"_ustr
,
402 cppu::UnoType
<uno::Sequence
< beans::PropertyValue
>>::get()
405 // Optional standard commands
410 cppu::UnoType
<bool>::get()
415 cppu::UnoType
<void>::get()
420 cppu::UnoType
<ucb::OpenCommandArgument2
>::get()
425 cppu::UnoType
<ucb::TransferInfo
>::get()
428 u
"createNewContent"_ustr
,
430 cppu::UnoType
<ucb::ContentInfo
>::get()
438 cppu::UnoType
<void>::get()
442 return MAKECMDSEQUENCE( aFolderCommandInfoTable
);
449 // Stream: Supported commands
452 static const ucb::CommandInfo aStreamCommandInfoTable
[] =
458 u
"getCommandInfo"_ustr
,
460 cppu::UnoType
<void>::get()
463 u
"getPropertySetInfo"_ustr
,
465 cppu::UnoType
<void>::get()
468 u
"getPropertyValues"_ustr
,
470 cppu::UnoType
<uno::Sequence
< beans::Property
>>::get()
473 u
"setPropertyValues"_ustr
,
475 cppu::UnoType
<uno::Sequence
< beans::PropertyValue
>>::get()
478 // Optional standard commands
483 cppu::UnoType
<bool>::get()
488 cppu::UnoType
<void>::get()
493 cppu::UnoType
<ucb::OpenCommandArgument2
>::get()
500 return MAKECMDSEQUENCE( aStreamCommandInfoTable
);
504 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */