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