merge the formfield patch from ooo-build
[ooovba.git] / xmlhelp / source / cxxhelp / provider / contentcaps.cxx
blob2c3590b827ae57cb255a0ff5bd12c7443879cdae
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: contentcaps.cxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmlhelp.hxx"
33 #include <com/sun/star/beans/Property.hpp>
34 #include <com/sun/star/beans/PropertyAttribute.hpp>
35 #include <com/sun/star/beans/PropertyValue.hpp>
36 #include <com/sun/star/ucb/CommandInfo.hpp>
37 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
38 #include <com/sun/star/uno/Sequence.hxx>
40 #include "content.hxx"
42 using namespace com::sun;
43 using namespace com::sun::star;
45 using namespace chelp;
47 // virtual
48 uno::Sequence< beans::Property > Content::getProperties(
49 const uno::Reference< star::ucb::XCommandEnvironment > & /*xEnv*/ )
51 bool withMediaType = m_aURLParameter.isFile() || m_aURLParameter.isRoot();
52 bool isModule = m_aURLParameter.isModule();
53 bool isFile = m_aURLParameter.isFile();
55 sal_Int32 num = withMediaType ? 7 : 6;
56 if( isModule ) num+=6;
57 if( isFile ) num++;
59 uno::Sequence< beans::Property > props(num);
61 sal_Int32 idx = 0;
62 props[idx++] =
63 beans::Property(
64 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
65 -1,
66 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
67 beans::PropertyAttribute::BOUND
68 | beans::PropertyAttribute::READONLY );
70 props[idx++] =
71 beans::Property(
72 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
73 -1,
74 getCppuBooleanType(),
75 beans::PropertyAttribute::BOUND
76 | beans::PropertyAttribute::READONLY );
78 props[idx++] =
79 beans::Property(
80 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsErrorDocument" ) ),
81 -1,
82 getCppuBooleanType(),
83 beans::PropertyAttribute::BOUND
84 | beans::PropertyAttribute::READONLY );
86 props[idx++] =
87 beans::Property(
88 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
89 -1,
90 getCppuBooleanType(),
91 beans::PropertyAttribute::BOUND
92 | beans::PropertyAttribute::READONLY );
94 props[idx++] =
95 beans::Property(
96 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
97 -1,
98 getCppuBooleanType(),
99 beans::PropertyAttribute::BOUND
100 | beans::PropertyAttribute::READONLY );
102 props[idx++] =
103 beans::Property(
104 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
106 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
107 beans::PropertyAttribute::BOUND
108 | beans::PropertyAttribute::READONLY );
110 if( withMediaType )
111 props[idx++] =
112 beans::Property(
113 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
115 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
116 beans::PropertyAttribute::BOUND
117 | beans::PropertyAttribute::READONLY );
119 if( isModule )
121 props[idx++] =
122 beans::Property(
123 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Order" ) ),
125 getCppuType( static_cast< sal_Int32* >( 0 ) ),
126 beans::PropertyAttribute::BOUND
127 | beans::PropertyAttribute::READONLY );
129 props[idx++] =
130 beans::Property(
131 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeywordList" ) ),
133 getCppuType(
134 static_cast< const uno::Sequence< rtl::OUString >* >(
135 0 ) ),
136 beans::PropertyAttribute::BOUND
137 | beans::PropertyAttribute::READONLY );
139 props[idx++] =
140 beans::Property(
141 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeywordRef" ) ),
143 getCppuType(
144 static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ),
145 beans::PropertyAttribute::BOUND
146 | beans::PropertyAttribute::READONLY );
148 props[idx++] =
149 beans::Property(
150 rtl::OUString(
151 RTL_CONSTASCII_USTRINGPARAM( "KeywordTitleForRef" ) ),
153 getCppuType(
154 static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ),
155 beans::PropertyAttribute::BOUND
156 | beans::PropertyAttribute::READONLY );
158 props[idx++] =
159 beans::Property(
160 rtl::OUString(
161 RTL_CONSTASCII_USTRINGPARAM( "KeywordAnchorForRef" ) ),
163 getCppuType(
164 static_cast< const uno::Sequence< uno::Sequence< rtl::OUString > >* >( 0 ) ),
165 beans::PropertyAttribute::BOUND
166 | beans::PropertyAttribute::READONLY );
168 props[idx++] =
169 beans::Property(
170 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SearchScopes" ) ),
172 getCppuType(
173 static_cast< const uno::Sequence< rtl::OUString >* >( 0 ) ),
174 beans::PropertyAttribute::BOUND
175 | beans::PropertyAttribute::READONLY );
178 if( isFile )
180 props[idx++] =
181 beans::Property(
182 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnchorName" ) ),
184 getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
185 beans::PropertyAttribute::BOUND
186 | beans::PropertyAttribute::READONLY );
189 return props;
194 //=========================================================================
195 // virtual
196 uno::Sequence< star::ucb::CommandInfo > Content::getCommands(
197 const uno::Reference< star::ucb::XCommandEnvironment > & /*xEnv*/ )
199 // osl::MutexGuard aGuard( m_aMutex );
201 //=================================================================
203 // Supported commands
205 //=================================================================
207 #define COMMAND_COUNT 5
209 static const star::ucb::CommandInfo aCommandInfoTable[] =
211 ///////////////////////////////////////////////////////////////
212 // Required commands
213 ///////////////////////////////////////////////////////////////
214 star::ucb::CommandInfo(
215 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
217 getCppuVoidType()
219 star::ucb::CommandInfo(
220 rtl::OUString(
221 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
223 getCppuVoidType()
225 star::ucb::CommandInfo(
226 rtl::OUString(
227 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
229 getCppuType(
230 static_cast< uno::Sequence< beans::Property > * >( 0 ) )
232 star::ucb::CommandInfo(
233 rtl::OUString(
234 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
236 getCppuType(
237 static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
239 star::ucb::CommandInfo(
240 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
242 getCppuType(
243 static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) )
247 return uno::Sequence< star::ucb::CommandInfo >(
248 aCommandInfoTable, COMMAND_COUNT );