Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <osl/diagnose.h>
30 : : #include <com/sun/star/uno/Type.hxx>
31 : : #include <com/sun/star/uno/Sequence.hxx>
32 : : #include <com/sun/star/uno/Reference.hxx>
33 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
34 : : #include <com/sun/star/ucb/CrossReference.hpp>
35 : : #include <com/sun/star/util/DateTime.hpp>
36 : : #include <com/sun/star/ucb/DocumentHeaderField.hpp>
37 : : #include <com/sun/star/ucb/RecipientInfo.hpp>
38 : : #include <com/sun/star/ucb/RuleSet.hpp>
39 : : #include <com/sun/star/ucb/SendInfo.hpp>
40 : : #include <com/sun/star/ucb/SendMediaTypes.hpp>
41 : : #include <com/sun/star/ucb/XDataContainer.hpp>
42 : : #include "ucbprops.hxx"
43 : :
44 : : using namespace com::sun::star::beans;
45 : : using namespace com::sun::star::lang;
46 : : using namespace com::sun::star::ucb;
47 : : using namespace com::sun::star::uno;
48 : : using namespace com::sun::star::util;
49 : :
50 : : using ::rtl::OUString;
51 : :
52 : : //=========================================================================
53 : : //
54 : : // struct PropertyTableEntry
55 : : //
56 : : //=========================================================================
57 : :
58 : : struct PropertyTableEntry
59 : : {
60 : : const char* pName;
61 : : sal_Int32 nHandle;
62 : : sal_Int16 nAttributes;
63 : : const com::sun::star::uno::Type& (*pGetCppuType)();
64 : : };
65 : :
66 : : //////////////////////////////////////////////////////////////////////////
67 : : //
68 : : // CPPU type access functions.
69 : : //
70 : : //////////////////////////////////////////////////////////////////////////
71 : :
72 : 319 : static const com::sun::star::uno::Type& OUString_getCppuType()
73 : : {
74 : 319 : return getCppuType( static_cast< const rtl::OUString * >( 0 ) );
75 : : }
76 : :
77 : 55 : static const com::sun::star::uno::Type& sal_uInt16_getCppuType()
78 : : {
79 : : // ! uInt -> Int, because of Java !!!
80 : 55 : return getCppuType( static_cast< const sal_Int16 * >( 0 ) );
81 : : }
82 : :
83 : 77 : static const com::sun::star::uno::Type& sal_uInt32_getCppuType()
84 : : {
85 : : // ! uInt -> Int, because of Java !!!
86 : 77 : return getCppuType( static_cast< const sal_Int32 * >( 0 ) );
87 : : }
88 : :
89 : 33 : static const com::sun::star::uno::Type& sal_uInt64_getCppuType()
90 : : {
91 : : // ! uInt -> Int, because of Java !!!
92 : 33 : return getCppuType( static_cast< const sal_Int64 * >( 0 ) );
93 : : }
94 : :
95 : 99 : static const com::sun::star::uno::Type& enum_getCppuType()
96 : : {
97 : : // ! enum -> Int, because of Java !!!
98 : 99 : return getCppuType( static_cast< const sal_Int16 * >( 0 ) );
99 : : }
100 : :
101 : 220 : static const com::sun::star::uno::Type& sal_Bool_getCppuType()
102 : : {
103 : 220 : return getCppuBooleanType();
104 : : }
105 : :
106 : 11 : static const com::sun::star::uno::Type& byte_getCppuType()
107 : : {
108 : 11 : return getCppuType( static_cast< const sal_Int8 * >( 0 ) );
109 : : }
110 : :
111 : 11 : static const com::sun::star::uno::Type& Sequence_CrossReference_getCppuType()
112 : : {
113 : : return getCppuType(
114 : : static_cast< com::sun::star::uno::Sequence<
115 : 11 : com::sun::star::ucb::CrossReference > * >( 0 ) );
116 : : }
117 : :
118 : 22 : static const com::sun::star::uno::Type& DateTime_getCppuType()
119 : : {
120 : : return getCppuType(
121 : 22 : static_cast< com::sun::star::util::DateTime * >( 0 ) );
122 : : }
123 : :
124 : 11 : static const com::sun::star::uno::Type& Sequence_byte_getCppuType()
125 : : {
126 : : return getCppuType(
127 : 11 : static_cast< com::sun::star::uno::Sequence< sal_Int8 > * >( 0 ) );
128 : : }
129 : :
130 : 11 : static const com::sun::star::uno::Type& Sequence_DocumentHeaderField_getCppuType()
131 : : {
132 : : return getCppuType(
133 : : static_cast< com::sun::star::uno::Sequence<
134 : 11 : com::sun::star::ucb::DocumentHeaderField > * >( 0 ) );
135 : : }
136 : :
137 : 11 : static const com::sun::star::uno::Type& XDataContainer_getCppuType()
138 : : {
139 : : return getCppuType(
140 : : static_cast< com::sun::star::uno::Reference<
141 : 11 : com::sun::star::ucb::XDataContainer > * >( 0 ) );
142 : : }
143 : :
144 : 11 : static const com::sun::star::uno::Type& Sequence_RecipientInfo_getCppuType()
145 : : {
146 : : return getCppuType(
147 : : static_cast< com::sun::star::uno::Sequence<
148 : 11 : com::sun::star::ucb::RecipientInfo > * >( 0 ) );
149 : : }
150 : :
151 : 22 : static const com::sun::star::uno::Type& RuleSet_getCppuType()
152 : : {
153 : : return getCppuType(
154 : 22 : static_cast< com::sun::star::ucb::RuleSet * >( 0 ) );
155 : : }
156 : :
157 : 66 : static const com::sun::star::uno::Type& Sequence_SendInfo_getCppuType()
158 : : {
159 : : return getCppuType(
160 : : static_cast< com::sun::star::uno::Sequence<
161 : 66 : com::sun::star::ucb::SendInfo > * >( 0 ) );
162 : : }
163 : :
164 : 11 : static const com::sun::star::uno::Type& Sequence_SendMediaTypes_getCppuType()
165 : : {
166 : : return getCppuType(
167 : : static_cast< com::sun::star::uno::Sequence<
168 : 11 : com::sun::star::ucb::SendMediaTypes > * >( 0 ) );
169 : : }
170 : :
171 : : //////////////////////////////////////////////////////////////////////////////////////////////////////////////
172 : : // A table with all well-known UCB properties.
173 : : //////////////////////////////////////////////////////////////////////////////////////////////////////////////
174 : :
175 : : #define ATTR_DEFAULT ( PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID | PropertyAttribute::MAYBEDEFAULT )
176 : :
177 : : static PropertyTableEntry __aPropertyTable[] =
178 : : {
179 : : { "Account", -1 /* WID_ACCOUNT */, ATTR_DEFAULT, &OUString_getCppuType },
180 : : { "AutoUpdateInterval", -1 /* WID_AUTOUPDATE_INTERVAL */, ATTR_DEFAULT, &sal_uInt32_getCppuType },
181 : : { "ConfirmEmpty", -1 /* WID_TRASHCAN_FLAG_CONFIRMEMPTY */,
182 : : ATTR_DEFAULT, &sal_Bool_getCppuType },
183 : : { "ConnectionLimit", -1 /* WID_HTTP_CONNECTION_LIMIT */, ATTR_DEFAULT, &byte_getCppuType },
184 : : { "ConnectionMode", -1 /* WID_CONNECTION_MODE */, ATTR_DEFAULT, &enum_getCppuType },
185 : : { "ContentCountLimit", -1 /* WID_SHOW_MSGS_TIMELIMIT */, ATTR_DEFAULT, &sal_uInt16_getCppuType },
186 : : { "ContentType", -1 /* WID_CONTENT_TYPE */, ATTR_DEFAULT, &OUString_getCppuType },
187 : : { "Cookie", -1 /* WID_HTTP_COOKIE */, ATTR_DEFAULT, &OUString_getCppuType },
188 : : { "CrossReferences", -1 /* WID_NEWS_XREFLIST */, ATTR_DEFAULT, &Sequence_CrossReference_getCppuType },
189 : : { "DateCreated", -1 /* WID_DATE_CREATED */, ATTR_DEFAULT, &DateTime_getCppuType },
190 : : { "DateModified", -1 /* WID_DATE_MODIFIED */, ATTR_DEFAULT, &DateTime_getCppuType },
191 : : { "DeleteOnServer", -1 /* WID_DELETE_ON_SERVER */, ATTR_DEFAULT, &sal_Bool_getCppuType },
192 : : { "DocumentBody", -1 /* WID_DOCUMENT_BODY */, ATTR_DEFAULT, &Sequence_byte_getCppuType },
193 : : { "DocumentCount", -1 /* WID_TOTALCONTENTCOUNT */, ATTR_DEFAULT | PropertyAttribute::READONLY,
194 : : &sal_uInt32_getCppuType },
195 : : { "DocumentCountMarked",
196 : : -1 /* WID_MARKED_DOCUMENT_COUNT */, ATTR_DEFAULT | PropertyAttribute::READONLY,
197 : : &sal_uInt32_getCppuType },
198 : : { "DocumentHeader", -1 /* WID_DOCUMENT_HEADER */, ATTR_DEFAULT, &Sequence_DocumentHeaderField_getCppuType },
199 : : { "DocumentStoreMode", -1 /* WID_MESSAGE_STOREMODE */, ATTR_DEFAULT, &enum_getCppuType },
200 : : { "DocumentViewMode", -1 /* WID_MESSAGEVIEW_MODE */, ATTR_DEFAULT, &enum_getCppuType },
201 : : { "FTPAccount", -1 /* WID_FTP_ACCOUNT */, ATTR_DEFAULT, &OUString_getCppuType },
202 : : { "Flags", -1 /* WID_FSYS_FLAGS */, ATTR_DEFAULT, &sal_uInt32_getCppuType },
203 : : { "FolderCount", -1 /* WID_FOLDER_COUNT */, ATTR_DEFAULT | PropertyAttribute::READONLY,
204 : : &sal_uInt32_getCppuType },
205 : : { "FolderViewMode", -1 /* WID_FOLDERVIEW_MODE */, ATTR_DEFAULT, &enum_getCppuType },
206 : : { "FreeSpace", -1 /* WID_FSYS_DISKSPACE_LEFT */, ATTR_DEFAULT | PropertyAttribute::READONLY,
207 : : &sal_uInt64_getCppuType },
208 : : { "HasDocuments", -1 /* WID_FLAG_HAS_MESSAGES */, ATTR_DEFAULT | PropertyAttribute::READONLY,
209 : : &sal_Bool_getCppuType },
210 : : { "HasFolders", -1 /* WID_FLAG_HAS_FOLDER */, ATTR_DEFAULT | PropertyAttribute::READONLY,
211 : : &sal_Bool_getCppuType },
212 : : { "IsAutoDelete", -1 /* WID_TRASHCAN_FLAG_AUTODELETE */,
213 : : ATTR_DEFAULT, &sal_Bool_getCppuType },
214 : : { "IsAutoUpdate", -1 /* WID_UPDATE_ENABLED */, ATTR_DEFAULT, &sal_Bool_getCppuType },
215 : : { "IsDocument", -1 /* WID_FLAG_IS_MESSAGE */, ATTR_DEFAULT | PropertyAttribute::READONLY,
216 : : &sal_Bool_getCppuType },
217 : : { "IsFolder", -1 /* WID_FLAG_IS_FOLDER */, ATTR_DEFAULT | PropertyAttribute::READONLY,
218 : : &sal_Bool_getCppuType },
219 : : { "IsKeepExpired", -1 /* WID_HTTP_KEEP_EXPIRED */, ATTR_DEFAULT, &sal_Bool_getCppuType },
220 : : { "IsLimitedContentCount",
221 : : -1 /* WID_SHOW_MSGS_HAS_TIMELIMIT */,
222 : : ATTR_DEFAULT, &sal_Bool_getCppuType },
223 : : { "IsMarked", -1 /* WID_IS_MARKED */, ATTR_DEFAULT, &sal_Bool_getCppuType },
224 : : { "IsRead", -1 /* WID_IS_READ */, ATTR_DEFAULT, &sal_Bool_getCppuType },
225 : : { "IsReadOnly", -1 /* WID_FLAG_READONLY */, ATTR_DEFAULT, &sal_Bool_getCppuType },
226 : : { "IsSubscribed", -1 /* WID_FLAG_SUBSCRIBED */, ATTR_DEFAULT, &sal_Bool_getCppuType },
227 : : // { "IsThreaded", -1 /* WID_THREADED */, ATTR_DEFAULT, &sal_Bool_getCppuType },
228 : : { "IsTimeLimitedStore", -1 /* WID_STORE_MSGS_HAS_TIMELIMIT */,
229 : : ATTR_DEFAULT, &sal_Bool_getCppuType },
230 : : { "Keywords", -1 /* WID_KEYWORDS */, ATTR_DEFAULT, &OUString_getCppuType },
231 : : { "LocalBase", -1 /* WID_LOCALBASE */, ATTR_DEFAULT, &OUString_getCppuType },
232 : : { "MessageBCC", -1 /* WID_BCC */, ATTR_DEFAULT, &OUString_getCppuType },
233 : : { "MessageBody", -1 /* WID_MESSAGEBODY */, ATTR_DEFAULT, &XDataContainer_getCppuType },
234 : : { "MessageCC", -1 /* WID_CC */, ATTR_DEFAULT, &OUString_getCppuType },
235 : : { "MessageFrom", -1 /* WID_FROM */, ATTR_DEFAULT, &OUString_getCppuType },
236 : : { "MessageId", -1 /* WID_MESSAGE_ID */, ATTR_DEFAULT, &OUString_getCppuType },
237 : : { "MessageInReplyTo", -1 /* WID_IN_REPLY_TO */, ATTR_DEFAULT, &OUString_getCppuType },
238 : : { "MessageReplyTo", -1 /* WID_REPLY_TO */, ATTR_DEFAULT, &OUString_getCppuType },
239 : : { "MessageTo", -1 /* WID_TO */, ATTR_DEFAULT, &OUString_getCppuType },
240 : : { "NewsGroups", -1 /* WID_NEWSGROUPS */, ATTR_DEFAULT, &OUString_getCppuType },
241 : : { "NoCacheList", -1 /* WID_HTTP_NOCACHE_LIST */, ATTR_DEFAULT, &OUString_getCppuType },
242 : : { "Origin", -1 /* WID_TRASH_ORIGIN */, ATTR_DEFAULT | PropertyAttribute::READONLY,
243 : : &OUString_getCppuType },
244 : : { "OutgoingMessageRecipients",
245 : : -1 /* WID_RECIPIENTLIST */, ATTR_DEFAULT, &Sequence_RecipientInfo_getCppuType },
246 : : { "OutgoingMessageState",
247 : : -1 /* WID_OUTMSGINTERNALSTATE */, ATTR_DEFAULT | PropertyAttribute::READONLY,
248 : : &enum_getCppuType },
249 : : { "OutgoingMessageViewMode",
250 : : -1 /* WID_SENTMESSAGEVIEW_MODE */,
251 : : ATTR_DEFAULT, &enum_getCppuType },
252 : : // { "OwnURL", -1 /* WID_OWN_URL */, ATTR_DEFAULT, &OUString_getCppuType },
253 : : { "Password", -1 /* WID_PASSWORD */, ATTR_DEFAULT, &OUString_getCppuType },
254 : : // { "PresentationURL", -1 /* WID_REAL_URL */, ATTR_DEFAULT | PropertyAttribute::READONLY,
255 : : // &OUString_getCppuType },
256 : : { "Priority", -1 /* WID_PRIORITY */, ATTR_DEFAULT, &enum_getCppuType },
257 : : { "References", -1 /* WID_REFERENCES */, ATTR_DEFAULT, &OUString_getCppuType },
258 : : { "Referer", -1 /* WID_HTTP_REFERER */, ATTR_DEFAULT, &OUString_getCppuType },
259 : : { "Rules", -1 /* WID_RULES */, ATTR_DEFAULT, &RuleSet_getCppuType },
260 : : { "SearchCriteria", -1 /* WID_SEARCH_CRITERIA */, ATTR_DEFAULT, &RuleSet_getCppuType },
261 : : { "SearchIndirections", -1 /* WID_SEARCH_INDIRECTIONS */, ATTR_DEFAULT, &sal_Bool_getCppuType },
262 : : { "SearchLocations", -1 /* WID_SEARCH_LOCATIONS */, ATTR_DEFAULT, &OUString_getCppuType },
263 : : { "SearchRecursive", -1 /* WID_SEARCH_RECURSIVE */, ATTR_DEFAULT, &sal_Bool_getCppuType },
264 : : { "SeenCount", -1 /* WID_SEENCONTENTCOUNT */, ATTR_DEFAULT | PropertyAttribute::READONLY,
265 : : &sal_uInt32_getCppuType },
266 : : { "SendCopyTarget", -1 /* WID_SEND_COPY_TARGET */, ATTR_DEFAULT, &Sequence_SendInfo_getCppuType },
267 : : { "SendFormats", -1 /* WID_SEND_FORMATS */, ATTR_DEFAULT, &Sequence_SendMediaTypes_getCppuType },
268 : : { "SendFroms", -1 /* WID_SEND_FROM_DEFAULT */, ATTR_DEFAULT, &Sequence_SendInfo_getCppuType },
269 : : { "SendPasswords", -1 /* WID_SEND_PASSWORD */, ATTR_DEFAULT, &Sequence_SendInfo_getCppuType },
270 : : { "SendProtocolPrivate",-1 /* WID_SEND_PRIVATE_PROT_ID */, ATTR_DEFAULT, &sal_uInt16_getCppuType },
271 : : { "SendProtocolPublic", -1 /* WID_SEND_PUBLIC_PROT_ID */, ATTR_DEFAULT, &sal_uInt16_getCppuType },
272 : : { "SendReplyTos", -1 /* WID_SEND_REPLY_TO_DEFAULT */, ATTR_DEFAULT, &Sequence_SendInfo_getCppuType },
273 : : { "SendServerNames", -1 /* WID_SEND_SERVERNAME */, ATTR_DEFAULT, &Sequence_SendInfo_getCppuType },
274 : : { "SendUserNames", -1 /* WID_SEND_USERNAME */, ATTR_DEFAULT, &Sequence_SendInfo_getCppuType },
275 : : { "SendVIMPostOfficePath",
276 : : -1 /* WID_SEND_VIM_POPATH */, ATTR_DEFAULT, &OUString_getCppuType },
277 : : { "ServerBase", -1 /* WID_SERVERBASE */, ATTR_DEFAULT, &OUString_getCppuType },
278 : : { "ServerName", -1 /* WID_SERVERNAME */, ATTR_DEFAULT, &OUString_getCppuType },
279 : : { "ServerPort", -1 /* WID_SERVERPORT */, ATTR_DEFAULT, &sal_uInt16_getCppuType },
280 : : { "Size", -1 /* WID_DOCUMENT_SIZE */, ATTR_DEFAULT | PropertyAttribute::READONLY,
281 : : &sal_uInt64_getCppuType },
282 : : { "SizeLimit", -1 /* WID_SIZE_LIMIT */, ATTR_DEFAULT, &sal_uInt64_getCppuType },
283 : : { "SubscribedCount", -1 /* WID_SUBSCRNEWSGROUPCOUNT */, ATTR_DEFAULT | PropertyAttribute::READONLY,
284 : : &sal_uInt32_getCppuType },
285 : : { "SynchronizePolicy", -1 /* WID_WHO_IS_MASTER */, ATTR_DEFAULT, &enum_getCppuType },
286 : : { "TargetFrames", -1 /* WID_TARGET_FRAMES */, ATTR_DEFAULT, &OUString_getCppuType },
287 : : { "TargetURL", -1 /* WID_TARGET_URL */, ATTR_DEFAULT, &OUString_getCppuType },
288 : : // { "ThreadingInfo", -1 /* WID_THREADING */, ATTR_DEFAULT, &Sequence_ThreadingInfo_getCppuType },
289 : : { "TimeLimitStore", -1 /* WID_STORE_MSGS_TIMELIMIT */, ATTR_DEFAULT, &sal_uInt16_getCppuType },
290 : : { "Title", -1 /* WID_TITLE */, ATTR_DEFAULT, &OUString_getCppuType },
291 : : { "UpdateOnOpen", -1 /* WID_FLAG_UPDATE_ON_OPEN */, ATTR_DEFAULT, &sal_Bool_getCppuType },
292 : : { "UseOutBoxPrivateProtocolSettings",
293 : : -1 /* WID_SEND_PRIVATE_OUTBOXPROPS */,
294 : : ATTR_DEFAULT, &sal_Bool_getCppuType },
295 : : { "UseOutBoxPublicProtocolSettings",
296 : : -1 /* WID_SEND_PUBLIC_OUTBOXPROPS */,
297 : : ATTR_DEFAULT, &sal_Bool_getCppuType },
298 : : { "UserName", -1 /* WID_USERNAME */, ATTR_DEFAULT, &OUString_getCppuType },
299 : : { "UserSortCriterium", -1 /* WID_USER_SORT_CRITERIUM */, ATTR_DEFAULT, &OUString_getCppuType },
300 : : { "VIMPostOfficePath", -1 /* WID_VIM_POPATH */, ATTR_DEFAULT, &OUString_getCppuType },
301 : : { "VerificationMode", -1 /* WID_HTTP_VERIFY_MODE */, ATTR_DEFAULT, &enum_getCppuType },
302 : :
303 : : //////////////////////////////////////////////////////////////////////////////////////////////////////////////
304 : : // EOT.
305 : : //////////////////////////////////////////////////////////////////////////////////////////////////////////////
306 : :
307 : : { 0, 0, 0, 0 }
308 : : };
309 : :
310 : : //=========================================================================
311 : : //=========================================================================
312 : : //
313 : : // UcbPropertiesManager Implementation.
314 : : //
315 : : //=========================================================================
316 : : //=========================================================================
317 : :
318 : 11 : UcbPropertiesManager::UcbPropertiesManager(
319 : : const Reference< XMultiServiceFactory >& )
320 [ + - ]: 11 : : m_pProps( 0 )
321 : : {
322 : 11 : }
323 : :
324 : : //=========================================================================
325 : : // virtual
326 [ + - ]: 11 : UcbPropertiesManager::~UcbPropertiesManager()
327 : : {
328 [ + - ][ + - ]: 11 : delete m_pProps;
329 [ - + ]: 22 : }
330 : :
331 : : //=========================================================================
332 : : //
333 : : // XInterface methods.
334 : : //
335 : : //=========================================================================
336 : :
337 [ + - ][ + + ]: 1120 : XINTERFACE_IMPL_3( UcbPropertiesManager,
[ + - ]
338 : : XTypeProvider,
339 : : XServiceInfo,
340 : : XPropertySetInfo );
341 : :
342 : : //=========================================================================
343 : : //
344 : : // XTypeProvider methods.
345 : : //
346 : : //=========================================================================
347 : :
348 [ # # ][ # # ]: 0 : XTYPEPROVIDER_IMPL_3( UcbPropertiesManager,
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
349 : : XTypeProvider,
350 : : XServiceInfo,
351 : : XPropertySetInfo );
352 : :
353 : : //=========================================================================
354 : : //
355 : : // XServiceInfo methods.
356 : : //
357 : : //=========================================================================
358 : :
359 [ + - ][ + - ]: 298 : XSERVICEINFO_IMPL_1( UcbPropertiesManager,
[ + - ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
360 : : OUString( "com.sun.star.comp.ucb.UcbPropertiesManager" ),
361 : 11 : OUString( PROPERTIES_MANAGER_SERVICE_NAME ) );
362 : :
363 : : //=========================================================================
364 : : //
365 : : // Service factory implementation.
366 : : //
367 : : //=========================================================================
368 : :
369 [ + - ][ + - ]: 11 : ONE_INSTANCE_SERVICE_FACTORY_IMPL( UcbPropertiesManager );
370 : :
371 : : //=========================================================================
372 : : //
373 : : // XPropertySetInfo methods.
374 : : //
375 : : //=========================================================================
376 : :
377 : : // virtual
378 : 148 : Sequence< Property > SAL_CALL UcbPropertiesManager::getProperties()
379 : : throw( RuntimeException )
380 : : {
381 [ + - ]: 148 : osl::Guard< osl::Mutex > aGuard( m_aMutex );
382 : :
383 [ + + ]: 148 : if ( !m_pProps )
384 : : {
385 [ + - ]: 11 : m_pProps = new Sequence< Property >( 128 );
386 [ + - ]: 11 : Property* pProps = m_pProps->getArray();
387 : 11 : sal_Int32 nPos = 0;
388 : 11 : sal_Int32 nSize = m_pProps->getLength();
389 : :
390 : : //////////////////////////////////////////////////////////////////
391 : : // Get info for well-known properties.
392 : : //////////////////////////////////////////////////////////////////
393 : :
394 : 11 : const PropertyTableEntry* pCurr = &__aPropertyTable[ 0 ];
395 [ + + ]: 1001 : while ( pCurr->pName )
396 : : {
397 [ - + ]: 990 : if ( nSize <= nPos )
398 : : {
399 : : OSL_FAIL( "UcbPropertiesManager::getProperties - "
400 : : "Initial size of property sequence too small!" );
401 : :
402 [ # # ]: 0 : m_pProps->realloc( 128 );
403 : 0 : nSize += 128;
404 : : }
405 : :
406 : 990 : Property& rProp = pProps[ nPos ];
407 : :
408 : 990 : rProp.Name = OUString::createFromAscii( pCurr->pName );
409 : 990 : rProp.Handle = pCurr->nHandle;
410 [ + - ]: 990 : rProp.Type = pCurr->pGetCppuType();
411 : 990 : rProp.Attributes = pCurr->nAttributes;
412 : :
413 : 990 : nPos++;
414 : 990 : pCurr++;
415 : : }
416 : :
417 [ + - ]: 11 : if ( nPos > 0 )
418 : : {
419 [ + - ]: 11 : m_pProps->realloc( nPos );
420 : 11 : nSize = m_pProps->getLength();
421 : : }
422 : : }
423 [ + - ][ + - ]: 148 : return *m_pProps;
424 : : }
425 : :
426 : : //=========================================================================
427 : : // virtual
428 : 4 : Property SAL_CALL UcbPropertiesManager::getPropertyByName( const OUString& aName )
429 : : throw( UnknownPropertyException, RuntimeException )
430 : : {
431 : 4 : Property aProp;
432 [ + + ][ + - ]: 4 : if ( queryProperty( aName, aProp ) )
433 : 2 : return aProp;
434 : :
435 [ + - ]: 2 : throw UnknownPropertyException();
436 : : }
437 : :
438 : : //=========================================================================
439 : : // virtual
440 : 4 : sal_Bool SAL_CALL UcbPropertiesManager::hasPropertyByName( const OUString& Name )
441 : : throw( RuntimeException )
442 : : {
443 : 4 : Property aProp;
444 [ + - ]: 4 : return queryProperty( Name, aProp );
445 : : }
446 : :
447 : : //=========================================================================
448 : : //
449 : : // Non-Interface methods.
450 : : //
451 : : //=========================================================================
452 : :
453 : 8 : sal_Bool UcbPropertiesManager::queryProperty(
454 : : const OUString& rName, Property& rProp )
455 : : {
456 [ + - ]: 8 : osl::Guard< osl::Mutex > aGuard( m_aMutex );
457 : :
458 [ + - ][ + - ]: 8 : getProperties();
459 : :
460 : 8 : const Property* pProps = m_pProps->getConstArray();
461 : 8 : sal_Int32 nCount = m_pProps->getLength();
462 [ + + ]: 368 : for ( sal_Int32 n = 0; n < nCount; ++n )
463 : : {
464 : 364 : const Property& rCurrProp = pProps[ n ];
465 [ + + ]: 364 : if ( rCurrProp.Name == rName )
466 : : {
467 : 4 : rProp = rCurrProp;
468 : 4 : return sal_True;
469 : : }
470 : : }
471 : :
472 [ + - ]: 8 : return sal_False;
473 : : }
474 : :
475 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|