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