Branch data 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 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
52 : : -1,
53 [ # # ]: 0 : getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
54 : : beans::PropertyAttribute::BOUND
55 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
56 : :
57 [ # # ]: 0 : props[idx++] =
58 : : beans::Property(
59 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
60 : : -1,
61 [ # # ]: 0 : getCppuBooleanType(),
62 : : beans::PropertyAttribute::BOUND
63 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
64 : :
65 [ # # ]: 0 : props[idx++] =
66 : : beans::Property(
67 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsErrorDocument" ) ),
68 : : -1,
69 [ # # ]: 0 : getCppuBooleanType(),
70 : : beans::PropertyAttribute::BOUND
71 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
72 : :
73 [ # # ]: 0 : props[idx++] =
74 : : beans::Property(
75 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
76 : : -1,
77 [ # # ]: 0 : getCppuBooleanType(),
78 : : beans::PropertyAttribute::BOUND
79 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
80 : :
81 [ # # ]: 0 : props[idx++] =
82 : : beans::Property(
83 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
84 : : -1,
85 [ # # ]: 0 : getCppuBooleanType(),
86 : : beans::PropertyAttribute::BOUND
87 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
88 : :
89 [ # # ]: 0 : props[idx++] =
90 : : beans::Property(
91 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
92 : : -1,
93 [ # # ]: 0 : getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
94 : : beans::PropertyAttribute::BOUND
95 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
96 : :
97 [ # # ]: 0 : if( withMediaType )
98 [ # # ]: 0 : props[idx++] =
99 : : beans::Property(
100 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
101 : : -1,
102 [ # # ]: 0 : getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
103 : : beans::PropertyAttribute::BOUND
104 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
105 : :
106 [ # # ]: 0 : if( isModule )
107 : : {
108 [ # # ]: 0 : props[idx++] =
109 : : beans::Property(
110 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Order" ) ),
111 : : -1,
112 [ # # ]: 0 : getCppuType( static_cast< sal_Int32* >( 0 ) ),
113 : : beans::PropertyAttribute::BOUND
114 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
115 : :
116 [ # # ]: 0 : props[idx++] =
117 : : beans::Property(
118 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeywordList" ) ),
119 : : -1,
120 : : getCppuType(
121 : : static_cast< const uno::Sequence< rtl::OUString >* >(
122 [ # # ]: 0 : 0 ) ),
123 : : beans::PropertyAttribute::BOUND
124 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
125 : :
126 [ # # ]: 0 : props[idx++] =
127 : : beans::Property(
128 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeywordRef" ) ),
129 : : -1,
130 : : getCppuType(
131 [ # # ]: 0 : static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ),
132 : : beans::PropertyAttribute::BOUND
133 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
134 : :
135 [ # # ]: 0 : props[idx++] =
136 : : beans::Property(
137 : : rtl::OUString(
138 : : RTL_CONSTASCII_USTRINGPARAM( "KeywordTitleForRef" ) ),
139 : : -1,
140 : : getCppuType(
141 [ # # ]: 0 : static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ),
142 : : beans::PropertyAttribute::BOUND
143 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
144 : :
145 [ # # ]: 0 : props[idx++] =
146 : : beans::Property(
147 : : rtl::OUString(
148 : : RTL_CONSTASCII_USTRINGPARAM( "KeywordAnchorForRef" ) ),
149 : : -1,
150 : : getCppuType(
151 [ # # ]: 0 : static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ),
152 : : beans::PropertyAttribute::BOUND
153 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
154 : :
155 [ # # ]: 0 : props[idx++] =
156 : : beans::Property(
157 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SearchScopes" ) ),
158 : : -1,
159 : : getCppuType(
160 [ # # ]: 0 : static_cast< const uno::Sequence< rtl::OUString >* >( 0 ) ),
161 : : beans::PropertyAttribute::BOUND
162 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
163 : : }
164 : :
165 [ # # ]: 0 : if( isFile )
166 : : {
167 [ # # ]: 0 : props[idx++] =
168 : : beans::Property(
169 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnchorName" ) ),
170 : : -1,
171 [ # # ]: 0 : getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
172 : : beans::PropertyAttribute::BOUND
173 [ # # ]: 0 : | beans::PropertyAttribute::READONLY );
174 : : }
175 : :
176 : 0 : return props;
177 : : }
178 : :
179 : :
180 : :
181 : : //=========================================================================
182 : : // virtual
183 : 0 : uno::Sequence< star::ucb::CommandInfo > Content::getCommands(
184 : : const uno::Reference< star::ucb::XCommandEnvironment > & /*xEnv*/ )
185 : : {
186 : : //=================================================================
187 : : //
188 : : // Supported commands
189 : : //
190 : : //=================================================================
191 : :
192 : : #define COMMAND_COUNT 5
193 : :
194 : : static const star::ucb::CommandInfo aCommandInfoTable[] =
195 : : {
196 : : ///////////////////////////////////////////////////////////////
197 : : // Required commands
198 : : ///////////////////////////////////////////////////////////////
199 : : star::ucb::CommandInfo(
200 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
201 : : -1,
202 [ # # ]: 0 : getCppuVoidType()
203 : : ),
204 : : star::ucb::CommandInfo(
205 : : rtl::OUString(
206 : : RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
207 : : -1,
208 [ # # ]: 0 : getCppuVoidType()
209 : : ),
210 : : star::ucb::CommandInfo(
211 : : rtl::OUString(
212 : : RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
213 : : -1,
214 : : getCppuType(
215 [ # # ]: 0 : static_cast< uno::Sequence< beans::Property > * >( 0 ) )
216 : : ),
217 : : star::ucb::CommandInfo(
218 : : rtl::OUString(
219 : : RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
220 : : -1,
221 : : getCppuType(
222 [ # # ]: 0 : static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
223 : : ),
224 : : star::ucb::CommandInfo(
225 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
226 : : -1,
227 : : getCppuType(
228 [ # # ]: 0 : static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) )
229 : : )
230 [ # # ][ # # ]: 0 : };
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
[ # # ]
231 : :
232 : : return uno::Sequence< star::ucb::CommandInfo >(
233 : 0 : aCommandInfoTable, COMMAND_COUNT );
234 : : }
235 : :
236 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|