defer finding dialog parent until we need it
[LibreOffice.git] / xmlhelp / source / cxxhelp / provider / contentcaps.cxx
blob840dd043db37d5aa50290f4bda75ffc963630763
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
27 #include "content.hxx"
29 using namespace com::sun::star;
31 using namespace chelp;
33 // virtual
34 uno::Sequence< beans::Property > Content::getProperties(
35 const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
37 bool withMediaType = m_aURLParameter.isFile() || m_aURLParameter.isRoot();
38 bool isModule = m_aURLParameter.isModule();
39 bool isFile = m_aURLParameter.isFile();
41 sal_Int32 num = withMediaType ? 7 : 6;
42 if( isModule ) num+=6;
43 if( isFile ) num++;
45 uno::Sequence< beans::Property > props(num);
46 auto pprops = props.getArray();
48 sal_Int32 idx = 0;
49 pprops[idx++] =
50 beans::Property(
51 u"ContentType"_ustr,
52 -1,
53 cppu::UnoType<OUString>::get(),
54 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
56 pprops[idx++] =
57 beans::Property(
58 u"IsReadOnly"_ustr,
59 -1,
60 cppu::UnoType<bool>::get(),
61 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
63 pprops[idx++] =
64 beans::Property(
65 u"IsErrorDocument"_ustr,
66 -1,
67 cppu::UnoType<bool>::get(),
68 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
70 pprops[idx++] =
71 beans::Property(
72 u"IsDocument"_ustr,
73 -1,
74 cppu::UnoType<bool>::get(),
75 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
77 pprops[idx++] =
78 beans::Property(
79 u"IsFolder"_ustr,
80 -1,
81 cppu::UnoType<bool>::get(),
82 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
84 pprops[idx++] =
85 beans::Property(
86 u"Title"_ustr,
87 -1,
88 cppu::UnoType<OUString>::get(),
89 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
91 if( withMediaType )
92 pprops[idx++] =
93 beans::Property(
94 u"MediaType"_ustr,
95 -1,
96 cppu::UnoType<OUString>::get(),
97 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
99 if( isModule )
101 pprops[idx++] =
102 beans::Property(
103 u"Order"_ustr,
105 cppu::UnoType<sal_Int32>::get(),
106 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
108 pprops[idx++] =
109 beans::Property(
110 u"KeywordList"_ustr,
112 cppu::UnoType<uno::Sequence< OUString >>::get(),
113 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
115 pprops[idx++] =
116 beans::Property(
117 u"KeywordRef"_ustr,
119 cppu::UnoType<uno::Sequence< uno::Sequence< OUString > >>::get(),
120 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
122 pprops[idx++] =
123 beans::Property(
124 u"KeywordTitleForRef"_ustr,
126 cppu::UnoType<uno::Sequence< uno::Sequence< OUString > >>::get(),
127 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
129 pprops[idx++] =
130 beans::Property(
131 u"KeywordAnchorForRef"_ustr,
133 cppu::UnoType<uno::Sequence< uno::Sequence< OUString > >>::get(),
134 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
136 pprops[idx++] =
137 beans::Property(
138 u"SearchScopes"_ustr,
140 cppu::UnoType<uno::Sequence< OUString >>::get(),
141 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
144 if( isFile )
146 pprops[idx++] =
147 beans::Property(
148 u"AnchorName"_ustr,
150 cppu::UnoType<OUString>::get(),
151 beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY );
154 return props;
157 // virtual
158 uno::Sequence< ucb::CommandInfo > Content::getCommands(
159 const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
161 // Supported commands
163 #define COMMAND_COUNT 5
165 static const ucb::CommandInfo aCommandInfoTable[] =
167 // Required commands
168 ucb::CommandInfo(
169 u"getCommandInfo"_ustr,
171 cppu::UnoType<void>::get()
173 ucb::CommandInfo(
174 u"getPropertySetInfo"_ustr,
176 cppu::UnoType<void>::get()
178 ucb::CommandInfo(
179 u"getPropertyValues"_ustr,
181 cppu::UnoType<uno::Sequence< beans::Property >>::get()
183 ucb::CommandInfo(
184 u"setPropertyValues"_ustr,
186 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get()
188 ucb::CommandInfo(
189 u"open"_ustr,
191 cppu::UnoType<ucb::OpenCommandArgument2>::get()
195 return uno::Sequence< ucb::CommandInfo >(
196 aCommandInfoTable, COMMAND_COUNT );
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */