xref: /trunk/main/ucb/source/core/ucbprops.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_ucb.hxx"
30 #include <osl/diagnose.h>
31 #include <com/sun/star/uno/Type.hxx>
32 #include <com/sun/star/uno/Sequence.hxx>
33 #include <com/sun/star/uno/Reference.hxx>
34 #include <com/sun/star/beans/PropertyAttribute.hpp>
35 #include <com/sun/star/ucb/CrossReference.hpp>
36 #include <com/sun/star/util/DateTime.hpp>
37 #include <com/sun/star/ucb/DocumentHeaderField.hpp>
38 #include <com/sun/star/ucb/RecipientInfo.hpp>
39 #include <com/sun/star/ucb/RuleSet.hpp>
40 #include <com/sun/star/ucb/SendInfo.hpp>
41 #include <com/sun/star/ucb/SendMediaTypes.hpp>
42 #include <com/sun/star/ucb/XDataContainer.hpp>
43 #include "ucbprops.hxx"
44 
45 using namespace rtl;
46 using namespace com::sun::star::beans;
47 using namespace com::sun::star::lang;
48 using namespace com::sun::star::ucb;
49 using namespace com::sun::star::uno;
50 using namespace com::sun::star::util;
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 static const com::sun::star::uno::Type& OUString_getCppuType()
73 {
74     return getCppuType( static_cast< const rtl::OUString * >( 0 ) );
75 }
76 
77 static const com::sun::star::uno::Type& sal_uInt16_getCppuType()
78 {
79     // ! uInt -> Int, because of Java !!!
80     return getCppuType( static_cast< const sal_Int16 * >( 0 ) );
81 }
82 
83 static const com::sun::star::uno::Type& sal_uInt32_getCppuType()
84 {
85     // ! uInt -> Int, because of Java !!!
86     return getCppuType( static_cast< const sal_Int32 * >( 0 ) );
87 }
88 
89 static const com::sun::star::uno::Type& sal_uInt64_getCppuType()
90 {
91     // ! uInt -> Int, because of Java !!!
92     return getCppuType( static_cast< const sal_Int64 * >( 0 ) );
93 }
94 
95 static const com::sun::star::uno::Type& enum_getCppuType()
96 {
97     // ! enum -> Int, because of Java !!!
98     return getCppuType( static_cast< const sal_Int16 * >( 0 ) );
99 }
100 
101 static const com::sun::star::uno::Type& sal_Bool_getCppuType()
102 {
103     return getCppuBooleanType();
104 }
105 
106 static const com::sun::star::uno::Type& byte_getCppuType()
107 {
108     return getCppuType( static_cast< const sal_Int8 * >( 0 ) );
109 }
110 
111 static const com::sun::star::uno::Type& Sequence_CrossReference_getCppuType()
112 {
113     return getCppuType(
114         static_cast< com::sun::star::uno::Sequence<
115                         com::sun::star::ucb::CrossReference > * >( 0 ) );
116 }
117 
118 static const com::sun::star::uno::Type& DateTime_getCppuType()
119 {
120     return getCppuType(
121         static_cast< com::sun::star::util::DateTime * >( 0 ) );
122 }
123 
124 static const com::sun::star::uno::Type& Sequence_byte_getCppuType()
125 {
126     return getCppuType(
127         static_cast< com::sun::star::uno::Sequence< sal_Int8 > * >( 0 ) );
128 }
129 
130 static const com::sun::star::uno::Type& Sequence_DocumentHeaderField_getCppuType()
131 {
132     return getCppuType(
133         static_cast< com::sun::star::uno::Sequence<
134                         com::sun::star::ucb::DocumentHeaderField > * >( 0 ) );
135 }
136 
137 static const com::sun::star::uno::Type& XDataContainer_getCppuType()
138 {
139     return getCppuType(
140         static_cast< com::sun::star::uno::Reference<
141             com::sun::star::ucb::XDataContainer > * >( 0 ) );
142 }
143 
144 static const com::sun::star::uno::Type& Sequence_RecipientInfo_getCppuType()
145 {
146     return getCppuType(
147         static_cast< com::sun::star::uno::Sequence<
148                         com::sun::star::ucb::RecipientInfo > * >( 0 ) );
149 }
150 
151 static const com::sun::star::uno::Type& RuleSet_getCppuType()
152 {
153     return getCppuType(
154         static_cast< com::sun::star::ucb::RuleSet * >( 0 ) );
155 }
156 
157 static const com::sun::star::uno::Type& Sequence_SendInfo_getCppuType()
158 {
159     return getCppuType(
160         static_cast< com::sun::star::uno::Sequence<
161                         com::sun::star::ucb::SendInfo > * >( 0 ) );
162 }
163 
164 static const com::sun::star::uno::Type& Sequence_SendMediaTypes_getCppuType()
165 {
166     return getCppuType(
167         static_cast< com::sun::star::uno::Sequence<
168                         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 UcbPropertiesManager::UcbPropertiesManager(
319                         const Reference< XMultiServiceFactory >& )
320 : m_pProps( 0 )
321 {
322 }
323 
324 //=========================================================================
325 // virtual
326 UcbPropertiesManager::~UcbPropertiesManager()
327 {
328     delete m_pProps;
329 }
330 
331 //=========================================================================
332 //
333 // XInterface methods.
334 //
335 //=========================================================================
336 
337 XINTERFACE_IMPL_3( UcbPropertiesManager,
338                    XTypeProvider,
339                    XServiceInfo,
340                    XPropertySetInfo );
341 
342 //=========================================================================
343 //
344 // XTypeProvider methods.
345 //
346 //=========================================================================
347 
348 XTYPEPROVIDER_IMPL_3( UcbPropertiesManager,
349                       XTypeProvider,
350                       XServiceInfo,
351                       XPropertySetInfo );
352 
353 //=========================================================================
354 //
355 // XServiceInfo methods.
356 //
357 //=========================================================================
358 
359 XSERVICEINFO_IMPL_1( UcbPropertiesManager,
360                      OUString::createFromAscii(
361                         "com.sun.star.comp.ucb.UcbPropertiesManager" ),
362                      OUString::createFromAscii(
363                         PROPERTIES_MANAGER_SERVICE_NAME ) );
364 
365 //=========================================================================
366 //
367 // Service factory implementation.
368 //
369 //=========================================================================
370 
371 ONE_INSTANCE_SERVICE_FACTORY_IMPL( UcbPropertiesManager );
372 
373 //=========================================================================
374 //
375 // XPropertySetInfo methods.
376 //
377 //=========================================================================
378 
379 // virtual
380 Sequence< Property > SAL_CALL UcbPropertiesManager::getProperties()
381     throw( RuntimeException )
382 {
383     osl::Guard< osl::Mutex > aGuard( m_aMutex );
384 
385     if ( !m_pProps )
386     {
387         m_pProps = new Sequence< Property >( 128 );
388         Property* pProps = m_pProps->getArray();
389         sal_Int32 nPos  = 0;
390         sal_Int32 nSize = m_pProps->getLength();
391 
392         //////////////////////////////////////////////////////////////////
393         // Get info for well-known properties.
394         //////////////////////////////////////////////////////////////////
395 
396         const PropertyTableEntry* pCurr = &__aPropertyTable[ 0 ];
397         while ( pCurr->pName )
398         {
399             if ( nSize <= nPos )
400             {
401                 OSL_ENSURE( sal_False,
402                             "UcbPropertiesManager::getProperties - "
403                             "Initial size of property sequence too small!" );
404 
405                 m_pProps->realloc( 128 );
406                 nSize += 128;
407             }
408 
409             Property& rProp = pProps[ nPos ];
410 
411             rProp.Name       = OUString::createFromAscii( pCurr->pName );
412             rProp.Handle     = pCurr->nHandle;
413             rProp.Type       = pCurr->pGetCppuType();
414             rProp.Attributes = pCurr->nAttributes;
415 
416             nPos++;
417             pCurr++;
418         }
419 
420         if ( nPos > 0 )
421         {
422             m_pProps->realloc( nPos );
423             nSize = m_pProps->getLength();
424         }
425     }
426     return *m_pProps;
427 }
428 
429 //=========================================================================
430 // virtual
431 Property SAL_CALL UcbPropertiesManager::getPropertyByName( const OUString& aName )
432     throw( UnknownPropertyException, RuntimeException )
433 {
434     Property aProp;
435     if ( queryProperty( aName, aProp ) )
436         return aProp;
437 
438     throw UnknownPropertyException();
439 }
440 
441 //=========================================================================
442 // virtual
443 sal_Bool SAL_CALL UcbPropertiesManager::hasPropertyByName( const OUString& Name )
444     throw( RuntimeException )
445 {
446     Property aProp;
447     return queryProperty( Name, aProp );
448 }
449 
450 //=========================================================================
451 //
452 // Non-Interface methods.
453 //
454 //=========================================================================
455 
456 sal_Bool UcbPropertiesManager::queryProperty(
457                                 const OUString& rName, Property& rProp )
458 {
459     osl::Guard< osl::Mutex > aGuard( m_aMutex );
460 
461     getProperties();
462 
463     const Property* pProps = m_pProps->getConstArray();
464     sal_Int32 nCount = m_pProps->getLength();
465     for ( sal_Int32 n = 0; n < nCount; ++n )
466     {
467         const Property& rCurrProp = pProps[ n ];
468         if ( rCurrProp.Name == rName )
469         {
470             rProp = rCurrProp;
471             return sal_True;
472         }
473     }
474 
475     return sal_False;
476 }
477 
478