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