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 :
158 :
159 : //=========================================================================
160 : // virtual
161 0 : uno::Sequence< star::ucb::CommandInfo > Content::getCommands(
162 : const uno::Reference< star::ucb::XCommandEnvironment > & /*xEnv*/ )
163 : {
164 : //=================================================================
165 : //
166 : // Supported commands
167 : //
168 : //=================================================================
169 :
170 : #define COMMAND_COUNT 5
171 :
172 : static const star::ucb::CommandInfo aCommandInfoTable[] =
173 : {
174 : ///////////////////////////////////////////////////////////////
175 : // Required commands
176 : ///////////////////////////////////////////////////////////////
177 : star::ucb::CommandInfo(
178 : "getCommandInfo",
179 : -1,
180 0 : getCppuVoidType()
181 : ),
182 : star::ucb::CommandInfo(
183 : "getPropertySetInfo",
184 : -1,
185 0 : getCppuVoidType()
186 : ),
187 : star::ucb::CommandInfo(
188 : "getPropertyValues",
189 : -1,
190 0 : getCppuType( static_cast< uno::Sequence< beans::Property > * >( 0 ) )
191 : ),
192 : star::ucb::CommandInfo(
193 : "setPropertyValues",
194 : -1,
195 0 : getCppuType( static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
196 : ),
197 : star::ucb::CommandInfo(
198 : "open",
199 : -1,
200 0 : getCppuType( static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) )
201 : )
202 0 : };
203 :
204 : return uno::Sequence< star::ucb::CommandInfo >(
205 0 : aCommandInfoTable, COMMAND_COUNT );
206 : }
207 :
208 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|