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