1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
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/DocumentStoreMode.hpp>
29 #include <com/sun/star/ucb/Priority.hpp>
30 #include <com/sun/star/ucb/RecipientInfo.hpp>
31 #include <com/sun/star/ucb/RuleSet.hpp>
32 #include <com/sun/star/ucb/SendInfo.hpp>
33 #include <com/sun/star/ucb/SendMediaTypes.hpp>
34 #include <com/sun/star/ucb/SynchronizePolicy.hpp>
35 #include <com/sun/star/ucb/VerificationMode.hpp>
36 #include <com/sun/star/ucb/XDataContainer.hpp>
38 #include "ucbprops.hxx"
40 using namespace com::sun::star::beans
;
41 using namespace com::sun::star::lang
;
42 using namespace com::sun::star::uno
;
44 #define ATTR_DEFAULT ( PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID | PropertyAttribute::MAYBEDEFAULT )
46 UcbPropertiesManager::UcbPropertiesManager()
48 { "Account", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
49 { "AutoUpdateInterval", -1, cppu::UnoType
<sal_Int32
>::get(), ATTR_DEFAULT
},
50 { "ConfirmEmpty", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
51 { "ConnectionLimit", -1, cppu::UnoType
<sal_Int16
>::get(), ATTR_DEFAULT
},
52 { "ConnectionMode", -1, cppu::UnoType
<sal_Int16
>::get(), ATTR_DEFAULT
},
53 { "ContentCountLimit", -1, cppu::UnoType
<sal_Int16
>::get(), ATTR_DEFAULT
},
54 { "ContentType", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
55 { "Cookie", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
56 { "CrossReferences", -1,
57 cppu::UnoType
<css::uno::Sequence
<css::ucb::CrossReference
>>::get(),
59 { "DateCreated", -1, cppu::UnoType
<css::util::DateTime
>::get(),
61 { "DateModified", -1, cppu::UnoType
<css::util::DateTime
>::get(),
63 { "DeleteOnServer", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
64 { "DocumentBody", -1, cppu::UnoType
<css::uno::Sequence
<sal_Int8
>>::get(),
66 { "DocumentCount", -1, cppu::UnoType
<sal_Int32
>::get(),
67 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
68 { "DocumentCountMarked", -1, cppu::UnoType
<sal_Int32
>::get(),
69 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
70 { "DocumentHeader", -1,
71 cppu::UnoType
<css::uno::Sequence
<css::ucb::DocumentHeaderField
>>::get(),
73 { "DocumentStoreMode", -1,
74 cppu::UnoType
<css::ucb::DocumentStoreMode
>::get(), ATTR_DEFAULT
},
75 { "DocumentViewMode", -1, cppu::UnoType
<sal_Int16
>::get(), ATTR_DEFAULT
},
76 { "FTPAccount", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
77 { "Flags", -1, cppu::UnoType
<sal_Int32
>::get(), ATTR_DEFAULT
},
78 { "FolderCount", -1, cppu::UnoType
<sal_Int32
>::get(),
79 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
80 { "FolderViewMode", -1, cppu::UnoType
<sal_Int16
>::get(), ATTR_DEFAULT
},
81 { "FreeSpace", -1, cppu::UnoType
<sal_Int64
>::get(),
82 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
83 { "HasDocuments", -1, cppu::UnoType
<bool>::get(),
84 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
85 { "HasFolders", -1, cppu::UnoType
<bool>::get(),
86 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
87 { "IsAutoDelete", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
88 { "IsAutoUpdate", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
89 { "IsDocument", -1, cppu::UnoType
<bool>::get(),
90 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
91 { "IsFolder", -1, cppu::UnoType
<bool>::get(),
92 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
93 { "IsKeepExpired", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
94 { "IsLimitedContentCount", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
95 { "IsMarked", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
96 { "IsRead", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
97 { "IsReadOnly", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
98 { "IsSubscribed", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
99 { "IsTimeLimitedStore", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
100 { "Keywords", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
101 { "LocalBase", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
102 { "MessageBCC", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
103 { "MessageBody", -1, cppu::UnoType
<css::ucb::XDataContainer
>::get(),
105 { "MessageCC", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
106 { "MessageFrom", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
107 { "MessageId", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
108 { "MessageInReplyTo", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
109 { "MessageReplyTo", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
110 { "MessageTo", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
111 { "NewsGroups", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
112 { "NoCacheList", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
113 { "Origin", -1, cppu::UnoType
<OUString
>::get(),
114 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
115 { "OutgoingMessageRecipients", -1,
116 cppu::UnoType
<css::uno::Sequence
<css::ucb::RecipientInfo
>>::get(),
118 { "OutgoingMessageState", -1,
119 cppu::UnoType
<css::ucb::OutgoingMessageState
>::get(),
120 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
121 { "OutgoingMessageViewMode", -1, cppu::UnoType
<sal_Int16
>::get(),
123 { "Password", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
124 { "Priority", -1, cppu::UnoType
<css::ucb::Priority
>::get(), ATTR_DEFAULT
},
125 { "References", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
126 { "Referer", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
127 { "Rules", -1, cppu::UnoType
<css::ucb::RuleSet
>::get(), ATTR_DEFAULT
},
128 { "SearchCriteria", -1, cppu::UnoType
<css::ucb::RuleSet
>::get(),
130 { "SearchIndirections", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
131 { "SearchLocations", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
132 { "SearchRecursive", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
133 { "SeenCount", -1, cppu::UnoType
<sal_Int32
>::get(),
134 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
135 { "SendCopyTarget", -1,
136 cppu::UnoType
<css::uno::Sequence
<css::ucb::SendInfo
>>::get(),
139 cppu::UnoType
<css::uno::Sequence
<css::ucb::SendMediaTypes
>>::get(),
142 cppu::UnoType
<css::uno::Sequence
<css::ucb::SendInfo
>>::get(),
144 { "SendPasswords", -1,
145 cppu::UnoType
<css::uno::Sequence
<css::ucb::SendInfo
>>::get(),
147 { "SendProtocolPrivate", -1, cppu::UnoType
<sal_Int16
>::get(),
149 { "SendProtocolPublic", -1, cppu::UnoType
<sal_Int16
>::get(), ATTR_DEFAULT
},
150 { "SendReplyTos", -1,
151 cppu::UnoType
<css::uno::Sequence
<css::ucb::SendInfo
>>::get(),
153 { "SendServerNames", -1,
154 cppu::UnoType
<css::uno::Sequence
<css::ucb::SendInfo
>>::get(),
156 { "SendUserNames", -1,
157 cppu::UnoType
<css::uno::Sequence
<css::ucb::SendInfo
>>::get(),
159 { "SendVIMPostOfficePath", -1, cppu::UnoType
<OUString
>::get(),
161 { "ServerBase", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
162 { "ServerName", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
163 { "ServerPort", -1, cppu::UnoType
<sal_Int16
>::get(), ATTR_DEFAULT
},
164 { "Size", -1, cppu::UnoType
<sal_Int64
>::get(),
165 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
166 { "SizeLimit", -1, cppu::UnoType
<sal_Int64
>::get(), ATTR_DEFAULT
},
167 { "SubscribedCount", -1, cppu::UnoType
<sal_Int32
>::get(),
168 ATTR_DEFAULT
| PropertyAttribute::READONLY
},
169 { "SynchronizePolicy", -1,
170 cppu::UnoType
<css::ucb::SynchronizePolicy
>::get(), ATTR_DEFAULT
},
171 { "TargetFrames", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
172 { "TargetURL", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
173 { "TimeLimitStore", -1, cppu::UnoType
<sal_Int16
>::get(), ATTR_DEFAULT
},
174 { "Title", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
175 { "UpdateOnOpen", -1, cppu::UnoType
<bool>::get(), ATTR_DEFAULT
},
176 { "UseOutBoxPrivateProtocolSettings", -1, cppu::UnoType
<bool>::get(),
178 { "UseOutBoxPublicProtocolSettings", -1, cppu::UnoType
<bool>::get(),
180 { "UserName", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
181 { "UserSortCriterium", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
182 { "VIMPostOfficePath", -1, cppu::UnoType
<OUString
>::get(), ATTR_DEFAULT
},
183 { "VerificationMode", -1, cppu::UnoType
<css::ucb::VerificationMode
>::get(),
190 UcbPropertiesManager::~UcbPropertiesManager()
195 // XServiceInfo methods.
197 XSERVICEINFO_COMMOM_IMPL( UcbPropertiesManager
,
198 OUString( "com.sun.star.comp.ucb.UcbPropertiesManager" ) )
199 /// @throws css::uno::Exception
200 static css::uno::Reference
< css::uno::XInterface
>
201 UcbPropertiesManager_CreateInstance( const css::uno::Reference
< css::lang::XMultiServiceFactory
> & /*rSMgr*/ )
203 css::lang::XServiceInfo
* pX
=
204 static_cast<css::lang::XServiceInfo
*>(new UcbPropertiesManager
);
205 return css::uno::Reference
< css::uno::XInterface
>::query( pX
);
207 css::uno::Sequence
< OUString
>
208 UcbPropertiesManager::getSupportedServiceNames_Static()
210 return { PROPERTIES_MANAGER_SERVICE_NAME
};
213 // Service factory implementation.
216 ONE_INSTANCE_SERVICE_FACTORY_IMPL( UcbPropertiesManager
);
219 // XPropertySetInfo methods.
223 Sequence
< Property
> SAL_CALL
UcbPropertiesManager::getProperties()
230 Property SAL_CALL
UcbPropertiesManager::getPropertyByName( const OUString
& aName
)
233 if ( queryProperty( aName
, aProp
) )
236 throw UnknownPropertyException();
241 sal_Bool SAL_CALL
UcbPropertiesManager::hasPropertyByName( const OUString
& Name
)
244 return queryProperty( Name
, aProp
);
248 // Non-Interface methods.
251 bool UcbPropertiesManager::queryProperty(
252 const OUString
& rName
, Property
& rProp
)
254 const Property
* pProps
= m_pProps
.getConstArray();
255 sal_Int32 nCount
= m_pProps
.getLength();
256 for ( sal_Int32 n
= 0; n
< nCount
; ++n
)
258 const Property
& rCurrProp
= pProps
[ n
];
259 if ( rCurrProp
.Name
== rName
)
269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */