1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: contentcaps.cxx,v $
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
;
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;
59 uno::Sequence
< beans::Property
> props(num
);
64 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
66 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
67 beans::PropertyAttribute::BOUND
68 | beans::PropertyAttribute::READONLY
);
72 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
75 beans::PropertyAttribute::BOUND
76 | beans::PropertyAttribute::READONLY
);
80 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsErrorDocument" ) ),
83 beans::PropertyAttribute::BOUND
84 | beans::PropertyAttribute::READONLY
);
88 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
91 beans::PropertyAttribute::BOUND
92 | beans::PropertyAttribute::READONLY
);
96 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
99 beans::PropertyAttribute::BOUND
100 | beans::PropertyAttribute::READONLY
);
104 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
106 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
107 beans::PropertyAttribute::BOUND
108 | beans::PropertyAttribute::READONLY
);
113 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
115 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
116 beans::PropertyAttribute::BOUND
117 | beans::PropertyAttribute::READONLY
);
123 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Order" ) ),
125 getCppuType( static_cast< sal_Int32
* >( 0 ) ),
126 beans::PropertyAttribute::BOUND
127 | beans::PropertyAttribute::READONLY
);
131 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeywordList" ) ),
134 static_cast< const uno::Sequence
< rtl::OUString
>* >(
136 beans::PropertyAttribute::BOUND
137 | beans::PropertyAttribute::READONLY
);
141 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeywordRef" ) ),
144 static_cast< const uno::Sequence
< uno::Sequence
< rtl::OUString
> >* >( 0 ) ),
145 beans::PropertyAttribute::BOUND
146 | beans::PropertyAttribute::READONLY
);
151 RTL_CONSTASCII_USTRINGPARAM( "KeywordTitleForRef" ) ),
154 static_cast< const uno::Sequence
< uno::Sequence
< rtl::OUString
> >* >( 0 ) ),
155 beans::PropertyAttribute::BOUND
156 | beans::PropertyAttribute::READONLY
);
161 RTL_CONSTASCII_USTRINGPARAM( "KeywordAnchorForRef" ) ),
164 static_cast< const uno::Sequence
< uno::Sequence
< rtl::OUString
> >* >( 0 ) ),
165 beans::PropertyAttribute::BOUND
166 | beans::PropertyAttribute::READONLY
);
170 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SearchScopes" ) ),
173 static_cast< const uno::Sequence
< rtl::OUString
>* >( 0 ) ),
174 beans::PropertyAttribute::BOUND
175 | beans::PropertyAttribute::READONLY
);
182 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnchorName" ) ),
184 getCppuType( static_cast< const rtl::OUString
* >( 0 ) ),
185 beans::PropertyAttribute::BOUND
186 | beans::PropertyAttribute::READONLY
);
194 //=========================================================================
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 ///////////////////////////////////////////////////////////////
213 ///////////////////////////////////////////////////////////////
214 star::ucb::CommandInfo(
215 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
219 star::ucb::CommandInfo(
221 RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
225 star::ucb::CommandInfo(
227 RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
230 static_cast< uno::Sequence
< beans::Property
> * >( 0 ) )
232 star::ucb::CommandInfo(
234 RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
237 static_cast< uno::Sequence
< beans::PropertyValue
> * >( 0 ) )
239 star::ucb::CommandInfo(
240 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
243 static_cast< star::ucb::OpenCommandArgument2
* >( 0 ) )
247 return uno::Sequence
< star::ucb::CommandInfo
>(
248 aCommandInfoTable
, COMMAND_COUNT
);