Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <com/sun/star/beans/Property.hpp>
21 : #include <com/sun/star/beans/PropertyAttribute.hpp>
22 : #include <com/sun/star/beans/PropertyValue.hpp>
23 : #include <com/sun/star/ucb/CommandInfo.hpp>
24 : #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
25 : #include <com/sun/star/uno/Sequence.hxx>
26 :
27 : #include "content.hxx"
28 :
29 : using namespace com::sun;
30 : using namespace com::sun::star;
31 :
32 : using namespace chelp;
33 :
34 : // virtual
35 0 : uno::Sequence< beans::Property > Content::getProperties(
36 : const uno::Reference< star::ucb::XCommandEnvironment > & /*xEnv*/ )
37 : {
38 0 : bool withMediaType = m_aURLParameter.isFile() || m_aURLParameter.isRoot();
39 0 : bool isModule = m_aURLParameter.isModule();
40 0 : bool isFile = m_aURLParameter.isFile();
41 :
42 0 : sal_Int32 num = withMediaType ? 7 : 6;
43 0 : if( isModule ) num+=6;
44 0 : if( isFile ) num++;
45 :
46 0 : uno::Sequence< beans::Property > props(num);
47 :
48 0 : sal_Int32 idx = 0;
49 0 : props[idx++] =
50 : beans::Property(
51 : "ContentType",
52 : -1,
53 0 : getCppuType( static_cast< const OUString * >( 0 ) ),
54 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
55 :
56 0 : props[idx++] =
57 : beans::Property(
58 : "IsReadOnly",
59 : -1,
60 0 : getCppuBooleanType(),
61 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
62 :
63 0 : props[idx++] =
64 : beans::Property(
65 : "IsErrorDocument",
66 : -1,
67 0 : getCppuBooleanType(),
68 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
69 :
70 0 : props[idx++] =
71 : beans::Property(
72 : "IsDocument",
73 : -1,
74 0 : getCppuBooleanType(),
75 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
76 :
77 0 : props[idx++] =
78 : beans::Property(
79 : "IsFolder",
80 : -1,
81 0 : getCppuBooleanType(),
82 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
83 :
84 0 : props[idx++] =
85 : beans::Property(
86 : "Title",
87 : -1,
88 0 : getCppuType( static_cast< const OUString * >( 0 ) ),
89 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
90 :
91 0 : if( withMediaType )
92 0 : props[idx++] =
93 : beans::Property(
94 : "MediaType",
95 : -1,
96 0 : getCppuType( static_cast< const OUString * >( 0 ) ),
97 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
98 :
99 0 : if( isModule )
100 : {
101 0 : props[idx++] =
102 : beans::Property(
103 : "Order",
104 : -1,
105 0 : getCppuType( static_cast< sal_Int32* >( 0 ) ),
106 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
107 :
108 0 : props[idx++] =
109 : beans::Property(
110 : "KeywordList",
111 : -1,
112 0 : getCppuType( static_cast< const uno::Sequence< OUString >* >( 0 ) ),
113 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
114 :
115 0 : props[idx++] =
116 : beans::Property(
117 : "KeywordRef",
118 : -1,
119 0 : getCppuType( static_cast< const uno::Sequence< uno::Sequence< OUString > >* >( 0 ) ),
120 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
121 :
122 0 : props[idx++] =
123 : beans::Property(
124 : "KeywordTitleForRef",
125 : -1,
126 0 : getCppuType( static_cast< const uno::Sequence< uno::Sequence< OUString > >* >( 0 ) ),
127 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
128 :
129 0 : props[idx++] =
130 : beans::Property(
131 : "KeywordAnchorForRef",
132 : -1,
133 0 : getCppuType( static_cast< const uno::Sequence< uno::Sequence< OUString > >* >( 0 ) ),
134 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
135 :
136 0 : props[idx++] =
137 : beans::Property(
138 : "SearchScopes",
139 : -1,
140 0 : getCppuType( static_cast< const uno::Sequence< OUString >* >( 0 ) ),
141 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
142 : }
143 :
144 0 : if( isFile )
145 : {
146 0 : props[idx++] =
147 : beans::Property(
148 : "AnchorName",
149 : -1,
150 0 : getCppuType( static_cast< const OUString * >( 0 ) ),
151 0 : beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
152 : }
153 :
154 0 : return props;
155 : }
156 :
157 : // virtual
158 0 : uno::Sequence< star::ucb::CommandInfo > Content::getCommands(
159 : const uno::Reference< star::ucb::XCommandEnvironment > & /*xEnv*/ )
160 : {
161 : // Supported commands
162 :
163 : #define COMMAND_COUNT 5
164 :
165 : static const star::ucb::CommandInfo aCommandInfoTable[] =
166 : {
167 : // Required commands
168 : star::ucb::CommandInfo(
169 : "getCommandInfo",
170 : -1,
171 0 : getCppuVoidType()
172 : ),
173 : star::ucb::CommandInfo(
174 : "getPropertySetInfo",
175 : -1,
176 0 : getCppuVoidType()
177 : ),
178 : star::ucb::CommandInfo(
179 : "getPropertyValues",
180 : -1,
181 0 : getCppuType( static_cast< uno::Sequence< beans::Property > * >( 0 ) )
182 : ),
183 : star::ucb::CommandInfo(
184 : "setPropertyValues",
185 : -1,
186 0 : getCppuType( static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
187 : ),
188 : star::ucb::CommandInfo(
189 : "open",
190 : -1,
191 0 : getCppuType( static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) )
192 : )
193 0 : };
194 :
195 : return uno::Sequence< star::ucb::CommandInfo >(
196 0 : aCommandInfoTable, COMMAND_COUNT );
197 : }
198 :
199 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|