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