fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / package / pkgcontentcaps.cxx
blob45acf60af2d575f0cb78f44eb24e5059b7f4a9bc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 /**************************************************************************
22 TODO
23 **************************************************************************
25 Props/Commands:
27 rootfolder folder stream
28 ---------------------------------------------
29 ContentType r r r
30 IsDocument r r r
31 IsFolder r r r
32 MediaType (w) (w) w
33 Title r w w
34 Size - - r
35 CreatableContentsInfo r r r
36 Compressed - - w
37 Encrypted - - w
38 HasEncryptedEntries r - -
40 getCommandInfo x x x
41 getPropertySetInfo x x x
42 getPropertyValues x x x
43 setPropertyValues x x x
44 insert - x x
45 delete - x x
46 open x x x
47 transfer x x -
48 flush 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;
67 // Content implementation.
71 #define MAKEPROPSEQUENCE( a ) \
72 uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
74 #define MAKECMDSEQUENCE( a ) \
75 uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
79 // IMPORTANT: If any property data ( name / type / ... ) are changed, then
80 // Content::getPropertyValues(...) must be adapted too!
84 // virtual
85 uno::Sequence< beans::Property > Content::getProperties(
86 const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
88 osl::Guard< osl::Mutex > aGuard( m_aMutex );
90 if ( isFolder() )
92 if ( m_aUri.isRootFolder() )
96 // Root Folder: Supported properties
100 static const beans::Property aRootFolderPropertyInfoTable[] =
103 // Required properties
105 beans::Property(
106 OUString( "ContentType" ),
108 cppu::UnoType<OUString>::get(),
109 beans::PropertyAttribute::BOUND
110 | beans::PropertyAttribute::READONLY
112 beans::Property(
113 OUString( "IsDocument" ),
115 cppu::UnoType<bool>::get(),
116 beans::PropertyAttribute::BOUND
117 | beans::PropertyAttribute::READONLY
119 beans::Property(
120 OUString( "IsFolder" ),
122 cppu::UnoType<bool>::get(),
123 beans::PropertyAttribute::BOUND
124 | beans::PropertyAttribute::READONLY
126 beans::Property(
127 OUString( "Title" ),
129 cppu::UnoType<OUString>::get(),
130 beans::PropertyAttribute::BOUND
131 | beans::PropertyAttribute::READONLY
134 // Optional standard properties
136 beans::Property(
137 OUString( "MediaType" ),
139 cppu::UnoType<OUString>::get(),
140 beans::PropertyAttribute::BOUND
142 beans::Property(
143 OUString(
144 "CreatableContentsInfo" ),
146 cppu::UnoType<uno::Sequence< ucb::ContentInfo >>::get(),
147 beans::PropertyAttribute::BOUND
148 | beans::PropertyAttribute::READONLY
151 // New properties
153 beans::Property(
154 OUString( "HasEncryptedEntries" ),
156 cppu::UnoType<bool>::get(),
157 beans::PropertyAttribute::BOUND
158 | beans::PropertyAttribute::READONLY
161 return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable );
163 else
167 // Folder: Supported properties
171 static const beans::Property aFolderPropertyInfoTable[] =
174 // Required properties
176 beans::Property(
177 OUString( "ContentType" ),
179 cppu::UnoType<OUString>::get(),
180 beans::PropertyAttribute::BOUND
181 | beans::PropertyAttribute::READONLY
183 beans::Property(
184 OUString( "IsDocument" ),
186 cppu::UnoType<bool>::get(),
187 beans::PropertyAttribute::BOUND
188 | beans::PropertyAttribute::READONLY
190 beans::Property(
191 OUString( "IsFolder" ),
193 cppu::UnoType<bool>::get(),
194 beans::PropertyAttribute::BOUND
195 | beans::PropertyAttribute::READONLY
197 beans::Property(
198 OUString( "Title" ),
200 cppu::UnoType<OUString>::get(),
201 beans::PropertyAttribute::BOUND
204 // Optional standard properties
206 beans::Property(
207 OUString( "MediaType" ),
209 cppu::UnoType<OUString>::get(),
210 beans::PropertyAttribute::BOUND
212 beans::Property(
213 OUString(
214 "CreatableContentsInfo" ),
216 cppu::UnoType<uno::Sequence< ucb::ContentInfo >>::get(),
217 beans::PropertyAttribute::BOUND
218 | beans::PropertyAttribute::READONLY
221 // New properties
224 return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
227 else
231 // Stream: Supported properties
235 static const beans::Property aStreamPropertyInfoTable[] =
238 // Required properties
240 beans::Property(
241 OUString( "ContentType" ),
243 cppu::UnoType<OUString>::get(),
244 beans::PropertyAttribute::BOUND
245 | beans::PropertyAttribute::READONLY
247 beans::Property(
248 OUString( "IsDocument" ),
250 cppu::UnoType<bool>::get(),
251 beans::PropertyAttribute::BOUND
252 | beans::PropertyAttribute::READONLY
254 beans::Property(
255 OUString( "IsFolder" ),
257 cppu::UnoType<bool>::get(),
258 beans::PropertyAttribute::BOUND
259 | beans::PropertyAttribute::READONLY
261 beans::Property(
262 OUString( "Title" ),
264 cppu::UnoType<OUString>::get(),
265 beans::PropertyAttribute::BOUND
268 // Optional standard properties
270 beans::Property(
271 OUString( "MediaType" ),
273 cppu::UnoType<OUString>::get(),
274 beans::PropertyAttribute::BOUND
276 beans::Property(
277 OUString( "Size" ),
279 cppu::UnoType<sal_Int64>::get(),
280 beans::PropertyAttribute::BOUND
281 | beans::PropertyAttribute::READONLY
283 beans::Property(
284 OUString(
285 "CreatableContentsInfo" ),
287 cppu::UnoType<uno::Sequence< ucb::ContentInfo >>::get(),
288 beans::PropertyAttribute::BOUND
289 | beans::PropertyAttribute::READONLY
292 // New properties
294 beans::Property(
295 OUString( "Compressed" ),
297 cppu::UnoType<bool>::get(),
298 beans::PropertyAttribute::BOUND
300 beans::Property(
301 OUString( "Encrypted" ),
303 cppu::UnoType<bool>::get(),
304 beans::PropertyAttribute::BOUND
307 return MAKEPROPSEQUENCE( aStreamPropertyInfoTable );
312 // virtual
313 uno::Sequence< ucb::CommandInfo > Content::getCommands(
314 const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
316 osl::Guard< osl::Mutex > aGuard( m_aMutex );
318 if ( isFolder() )
320 if ( m_aUri.isRootFolder() )
324 // Root Folder: Supported commands
328 static const ucb::CommandInfo aRootFolderCommandInfoTable[] =
331 // Required commands
333 ucb::CommandInfo(
334 OUString( "getCommandInfo" ),
336 cppu::UnoType<void>::get()
338 ucb::CommandInfo(
339 OUString( "getPropertySetInfo" ),
341 cppu::UnoType<void>::get()
343 ucb::CommandInfo(
344 OUString( "getPropertyValues" ),
346 cppu::UnoType<uno::Sequence< beans::Property >>::get()
348 ucb::CommandInfo(
349 OUString( "setPropertyValues" ),
351 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
354 // Optional standard commands
356 ucb::CommandInfo(
357 OUString( "open" ),
359 cppu::UnoType<ucb::OpenCommandArgument2>::get()
361 ucb::CommandInfo(
362 OUString( "transfer" ),
364 cppu::UnoType<ucb::TransferInfo>::get()
366 ucb::CommandInfo(
367 OUString( "createNewContent" ),
369 cppu::UnoType<ucb::ContentInfo>::get()
372 // New commands
374 ucb::CommandInfo(
375 OUString( "flush" ),
377 cppu::UnoType<void>::get()
381 return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
383 else
387 // Folder: Supported commands
391 static const ucb::CommandInfo aFolderCommandInfoTable[] =
394 // Required commands
396 ucb::CommandInfo(
397 OUString( "getCommandInfo" ),
399 cppu::UnoType<void>::get()
401 ucb::CommandInfo(
402 OUString( "getPropertySetInfo" ),
404 cppu::UnoType<void>::get()
406 ucb::CommandInfo(
407 OUString( "getPropertyValues" ),
409 cppu::UnoType<uno::Sequence< beans::Property >>::get()
411 ucb::CommandInfo(
412 OUString( "setPropertyValues" ),
414 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
417 // Optional standard commands
419 ucb::CommandInfo(
420 OUString( "delete" ),
422 cppu::UnoType<bool>::get()
424 ucb::CommandInfo(
425 OUString( "insert" ),
427 cppu::UnoType<void>::get()
429 ucb::CommandInfo(
430 OUString( "open" ),
432 cppu::UnoType<ucb::OpenCommandArgument2>::get()
434 ucb::CommandInfo(
435 OUString( "transfer" ),
437 cppu::UnoType<ucb::TransferInfo>::get()
439 ucb::CommandInfo(
440 OUString( "createNewContent" ),
442 cppu::UnoType<ucb::ContentInfo>::get()
445 // New commands
447 ucb::CommandInfo(
448 OUString( "flush" ),
450 cppu::UnoType<void>::get()
454 return MAKECMDSEQUENCE( aFolderCommandInfoTable );
457 else
461 // Stream: Supported commands
465 static const ucb::CommandInfo aStreamCommandInfoTable[] =
468 // Required commands
470 ucb::CommandInfo(
471 OUString( "getCommandInfo" ),
473 cppu::UnoType<void>::get()
475 ucb::CommandInfo(
476 OUString( "getPropertySetInfo" ),
478 cppu::UnoType<void>::get()
480 ucb::CommandInfo(
481 OUString( "getPropertyValues" ),
483 cppu::UnoType<uno::Sequence< beans::Property >>::get()
485 ucb::CommandInfo(
486 OUString( "setPropertyValues" ),
488 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
491 // Optional standard commands
493 ucb::CommandInfo(
494 OUString( "delete" ),
496 cppu::UnoType<bool>::get()
498 ucb::CommandInfo(
499 OUString( "insert" ),
501 cppu::UnoType<void>::get()
503 ucb::CommandInfo(
504 OUString( "open" ),
506 cppu::UnoType<ucb::OpenCommandArgument2>::get()
509 // New commands
513 return MAKECMDSEQUENCE( aStreamCommandInfoTable );
517 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */