fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / hierarchy / hierarchycontentcaps.cxx
blob8595d7284c3012614e229399d9e65fb0677a1b48
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 **************************************************************************
27 Props/Commands:
29 root folder folder link link
30 (new) (new)
31 ----------------------------------------------------------------
32 ContentType x x x x x
33 IsDocument x x x x x
34 IsFolder x x x x x
35 Title x x x x x
36 TargetURL x x
37 CreatableContentsInfo x x x x x
39 getCommandInfo x x x x x
40 getPropertySetInfo x x x x x
41 getPropertyValues x x x x x
42 setPropertyValues x x x x x
43 createNewContent x x
44 insert x x
45 delete x x
46 open x x
47 transfer x x
49 *************************************************************************/
51 #include <com/sun/star/beans/Property.hpp>
52 #include <com/sun/star/beans/PropertyAttribute.hpp>
53 #include <com/sun/star/beans/PropertyValue.hpp>
54 #include <com/sun/star/ucb/CommandInfo.hpp>
55 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
56 #include <com/sun/star/ucb/TransferInfo.hpp>
57 #include <com/sun/star/uno/Sequence.hxx>
58 #include <sal/macros.h>
59 #include "hierarchycontent.hxx"
61 using namespace com::sun::star;
62 using namespace hierarchy_ucp;
66 // HierarchyContent implementation.
70 #define MAKEPROPSEQUENCE( a ) \
71 uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
73 #define MAKECMDSEQUENCE( a ) \
74 uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
78 // IMPORTANT: If any property data ( name / type / ... ) are changed, then
79 // HierarchyContent::getPropertyValues(...) must be adapted too!
83 // virtual
84 uno::Sequence< beans::Property > HierarchyContent::getProperties(
85 const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
87 osl::Guard< osl::Mutex > aGuard( m_aMutex );
89 if ( m_eKind == LINK )
93 // Link: Supported properties
97 if ( isReadOnly() )
99 static const beans::Property aLinkPropertyInfoTable[] =
102 // Required properties
104 beans::Property(
105 OUString( "ContentType" ),
107 cppu::UnoType<OUString>::get(),
108 beans::PropertyAttribute::BOUND
109 | beans::PropertyAttribute::READONLY
111 beans::Property(
112 OUString( "IsDocument" ),
114 cppu::UnoType<bool>::get(),
115 beans::PropertyAttribute::BOUND
116 | beans::PropertyAttribute::READONLY
118 beans::Property(
119 OUString( "IsFolder" ),
121 cppu::UnoType<bool>::get(),
122 beans::PropertyAttribute::BOUND
123 | beans::PropertyAttribute::READONLY
125 beans::Property(
126 OUString( "Title" ),
128 cppu::UnoType<OUString>::get(),
129 beans::PropertyAttribute::BOUND
130 | beans::PropertyAttribute::READONLY
133 // Optional standard properties
135 beans::Property(
136 OUString( "TargetURL" ),
138 cppu::UnoType<OUString>::get(),
139 beans::PropertyAttribute::BOUND
140 | beans::PropertyAttribute::READONLY
142 beans::Property(
143 OUString(
144 "CreatableContentsInfo" ),
146 cppu::UnoType<uno::Sequence< ucb::ContentInfo >>::get(),
147 beans::PropertyAttribute::BOUND
148 | beans::PropertyAttribute::READONLY )
150 // New properties
153 return MAKEPROPSEQUENCE( aLinkPropertyInfoTable );
155 else
157 static const beans::Property aLinkPropertyInfoTable[] =
160 // Required properties
162 beans::Property(
163 OUString( "ContentType" ),
165 cppu::UnoType<OUString>::get(),
166 beans::PropertyAttribute::BOUND
167 | beans::PropertyAttribute::READONLY
169 beans::Property(
170 OUString( "IsDocument" ),
172 cppu::UnoType<bool>::get(),
173 beans::PropertyAttribute::BOUND
174 | beans::PropertyAttribute::READONLY
176 beans::Property(
177 OUString( "IsFolder" ),
179 cppu::UnoType<bool>::get(),
180 beans::PropertyAttribute::BOUND
181 | beans::PropertyAttribute::READONLY
183 beans::Property(
184 OUString( "Title" ),
186 cppu::UnoType<OUString>::get(),
187 beans::PropertyAttribute::BOUND
190 // Optional standard properties
192 beans::Property(
193 OUString( "TargetURL" ),
195 cppu::UnoType<OUString>::get(),
196 beans::PropertyAttribute::BOUND
198 beans::Property(
199 OUString(
200 "CreatableContentsInfo" ),
202 cppu::UnoType<uno::Sequence< ucb::ContentInfo >>::get(),
203 beans::PropertyAttribute::BOUND
204 | beans::PropertyAttribute::READONLY )
206 // New properties
209 return MAKEPROPSEQUENCE( aLinkPropertyInfoTable );
212 else if ( m_eKind == FOLDER )
216 // Folder: Supported properties
220 if ( isReadOnly() )
222 static const beans::Property aFolderPropertyInfoTable[] =
225 // Required properties
227 beans::Property(
228 OUString( "ContentType" ),
230 cppu::UnoType<OUString>::get(),
231 beans::PropertyAttribute::BOUND
232 | beans::PropertyAttribute::READONLY
234 beans::Property(
235 OUString( "IsDocument" ),
237 cppu::UnoType<bool>::get(),
238 beans::PropertyAttribute::BOUND
239 | beans::PropertyAttribute::READONLY
241 beans::Property(
242 OUString( "IsFolder" ),
244 cppu::UnoType<bool>::get(),
245 beans::PropertyAttribute::BOUND
246 | beans::PropertyAttribute::READONLY
248 beans::Property(
249 OUString( "Title" ),
251 cppu::UnoType<OUString>::get(),
252 beans::PropertyAttribute::BOUND
253 | beans::PropertyAttribute::READONLY
256 // Optional standard properties
258 beans::Property(
259 OUString(
260 "CreatableContentsInfo" ),
262 cppu::UnoType<uno::Sequence< ucb::ContentInfo >>::get(),
263 beans::PropertyAttribute::BOUND
264 | beans::PropertyAttribute::READONLY )
266 // New properties
269 return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
271 else
273 static const beans::Property aFolderPropertyInfoTable[] =
276 // Required properties
278 beans::Property(
279 OUString( "ContentType" ),
281 cppu::UnoType<OUString>::get(),
282 beans::PropertyAttribute::BOUND
283 | beans::PropertyAttribute::READONLY
285 beans::Property(
286 OUString( "IsDocument" ),
288 cppu::UnoType<bool>::get(),
289 beans::PropertyAttribute::BOUND
290 | beans::PropertyAttribute::READONLY
292 beans::Property(
293 OUString( "IsFolder" ),
295 cppu::UnoType<bool>::get(),
296 beans::PropertyAttribute::BOUND
297 | beans::PropertyAttribute::READONLY
299 beans::Property(
300 OUString( "Title" ),
302 cppu::UnoType<OUString>::get(),
303 beans::PropertyAttribute::BOUND
306 // Optional standard properties
308 beans::Property(
309 OUString(
310 "CreatableContentsInfo" ),
312 cppu::UnoType<uno::Sequence< ucb::ContentInfo >>::get(),
313 beans::PropertyAttribute::BOUND
314 | beans::PropertyAttribute::READONLY )
316 // New properties
319 return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
322 else
326 // Root Folder: Supported properties
330 // Currently no difference between reonly /read-write
331 // -> all props ar read-only
333 static const beans::Property aRootFolderPropertyInfoTable[] =
336 // Required properties
338 beans::Property(
339 OUString( "ContentType" ),
341 cppu::UnoType<OUString>::get(),
342 beans::PropertyAttribute::BOUND
343 | beans::PropertyAttribute::READONLY
345 beans::Property(
346 OUString( "IsDocument" ),
348 cppu::UnoType<bool>::get(),
349 beans::PropertyAttribute::BOUND
350 | beans::PropertyAttribute::READONLY
352 beans::Property(
353 OUString( "IsFolder" ),
355 cppu::UnoType<bool>::get(),
356 beans::PropertyAttribute::BOUND
357 | beans::PropertyAttribute::READONLY
359 beans::Property(
360 OUString( "Title" ),
362 cppu::UnoType<OUString>::get(),
363 beans::PropertyAttribute::BOUND
364 | beans::PropertyAttribute::READONLY
367 // Optional standard properties
369 beans::Property(
370 OUString(
371 "CreatableContentsInfo" ),
373 cppu::UnoType<uno::Sequence< ucb::ContentInfo >>::get(),
374 beans::PropertyAttribute::BOUND
375 | beans::PropertyAttribute::READONLY )
377 // New properties
380 return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable );
385 // virtual
386 uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
387 const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
389 osl::Guard< osl::Mutex > aGuard( m_aMutex );
391 if ( m_eKind == LINK )
395 // Link: Supported commands
399 if ( isReadOnly() )
401 static const ucb::CommandInfo aLinkCommandInfoTable[] =
404 // Required commands
406 ucb::CommandInfo(
407 OUString( "getCommandInfo" ),
409 cppu::UnoType<void>::get()
411 ucb::CommandInfo(
412 OUString( "getPropertySetInfo" ),
414 cppu::UnoType<void>::get()
416 ucb::CommandInfo(
417 OUString( "getPropertyValues" ),
419 cppu::UnoType<uno::Sequence< beans::Property >>::get()
421 ucb::CommandInfo(
422 OUString( "setPropertyValues" ),
424 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
427 // Optional standard commands
431 // New commands
434 return MAKECMDSEQUENCE( aLinkCommandInfoTable );
436 else
438 static const ucb::CommandInfo aLinkCommandInfoTable[] =
441 // Required commands
443 ucb::CommandInfo(
444 OUString( "getCommandInfo" ),
446 cppu::UnoType<void>::get()
448 ucb::CommandInfo(
449 OUString( "getPropertySetInfo" ),
451 cppu::UnoType<void>::get()
453 ucb::CommandInfo(
454 OUString( "getPropertyValues" ),
456 cppu::UnoType<uno::Sequence< beans::Property >>::get()
458 ucb::CommandInfo(
459 OUString( "setPropertyValues" ),
461 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
464 // Optional standard commands
466 ucb::CommandInfo(
467 OUString( "delete" ),
469 cppu::UnoType<bool>::get()
471 ucb::CommandInfo(
472 OUString( "insert" ),
474 cppu::UnoType<void>::get()
477 // New commands
480 return MAKECMDSEQUENCE( aLinkCommandInfoTable );
483 else if ( m_eKind == FOLDER )
487 // Folder: Supported commands
491 if ( isReadOnly() )
493 static const ucb::CommandInfo aFolderCommandInfoTable[] =
496 // Required commands
498 ucb::CommandInfo(
499 OUString( "getCommandInfo" ),
501 cppu::UnoType<void>::get()
503 ucb::CommandInfo(
504 OUString( "getPropertySetInfo" ),
506 cppu::UnoType<void>::get()
508 ucb::CommandInfo(
509 OUString( "getPropertyValues" ),
511 cppu::UnoType<uno::Sequence< beans::Property >>::get()
513 ucb::CommandInfo(
514 OUString( "setPropertyValues" ),
516 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
519 // Optional standard commands
521 ucb::CommandInfo(
522 OUString( "open" ),
524 cppu::UnoType<ucb::OpenCommandArgument2>::get()
527 // New commands
530 return MAKECMDSEQUENCE( aFolderCommandInfoTable );
532 else
534 static const ucb::CommandInfo aFolderCommandInfoTable[] =
537 // Required commands
539 ucb::CommandInfo(
540 OUString( "getCommandInfo" ),
542 cppu::UnoType<void>::get()
544 ucb::CommandInfo(
545 OUString( "getPropertySetInfo" ),
547 cppu::UnoType<void>::get()
549 ucb::CommandInfo(
550 OUString( "getPropertyValues" ),
552 cppu::UnoType<uno::Sequence< beans::Property >>::get()
554 ucb::CommandInfo(
555 OUString( "setPropertyValues" ),
557 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
560 // Optional standard commands
562 ucb::CommandInfo(
563 OUString( "delete" ),
565 cppu::UnoType<bool>::get()
567 ucb::CommandInfo(
568 OUString( "insert" ),
570 cppu::UnoType<void>::get()
572 ucb::CommandInfo(
573 OUString( "open" ),
575 cppu::UnoType<ucb::OpenCommandArgument2>::get()
577 ucb::CommandInfo(
578 OUString( "transfer" ),
580 cppu::UnoType<ucb::TransferInfo>::get()
582 ucb::CommandInfo(
583 OUString( "createNewContent" ),
585 cppu::UnoType<ucb::ContentInfo>::get()
588 // New commands
591 return MAKECMDSEQUENCE( aFolderCommandInfoTable );
594 else
598 // Root Folder: Supported commands
602 if ( isReadOnly() )
604 static const ucb::CommandInfo aRootFolderCommandInfoTable[] =
607 // Required commands
609 ucb::CommandInfo(
610 OUString( "getCommandInfo" ),
612 cppu::UnoType<void>::get()
614 ucb::CommandInfo(
615 OUString( "getPropertySetInfo" ),
617 cppu::UnoType<void>::get()
619 ucb::CommandInfo(
620 OUString( "getPropertyValues" ),
622 cppu::UnoType<uno::Sequence< beans::Property >>::get()
624 ucb::CommandInfo(
625 OUString( "setPropertyValues" ),
627 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
630 // Optional standard commands
632 ucb::CommandInfo(
633 OUString( "open" ),
635 cppu::UnoType<ucb::OpenCommandArgument2>::get()
638 // New commands
641 return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
643 else
645 static const ucb::CommandInfo aRootFolderCommandInfoTable[] =
648 // Required commands
650 ucb::CommandInfo(
651 OUString( "getCommandInfo" ),
653 cppu::UnoType<void>::get()
655 ucb::CommandInfo(
656 OUString( "getPropertySetInfo" ),
658 cppu::UnoType<void>::get()
660 ucb::CommandInfo(
661 OUString( "getPropertyValues" ),
663 cppu::UnoType<uno::Sequence< beans::Property >>::get()
665 ucb::CommandInfo(
666 OUString( "setPropertyValues" ),
668 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
671 // Optional standard commands
673 ucb::CommandInfo(
674 OUString( "open" ),
676 cppu::UnoType<ucb::OpenCommandArgument2>::get()
678 ucb::CommandInfo(
679 OUString( "transfer" ),
681 cppu::UnoType<ucb::TransferInfo>::get()
683 ucb::CommandInfo(
684 OUString( "createNewContent" ),
686 cppu::UnoType<ucb::ContentInfo>::get()
689 // New commands
692 return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
697 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */