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 .
19 #ifndef __com_sun_star_resource_XStringResourceManager_idl__
20 #define __com_sun_star_resource_XStringResourceManager_idl__
22 #include
<com
/sun
/star
/resource
/MissingResourceException.idl
>
23 #include
<com
/sun
/star
/resource
/XStringResourceResolver.idl
>
24 #include
<com
/sun
/star
/container
/ElementExistException.idl
>
25 #include
<com
/sun
/star
/lang
/Locale.idl
>
26 #include
<com
/sun
/star
/lang
/IllegalArgumentException.idl
>
27 #include
<com
/sun
/star
/lang
/NoSupportException.idl
>
31 module com
{ module sun
{ module star
{ module resource
{
34 Interface to manage a resource string table containing a set of
35 strings for different locales.
37 The interface is derived from
38 com::sun::star::resource::XStringResourceResolver
39 that allows to access the string table but not to modify it. This
40 interface also allows to modify the string table.
42 It's designed to be used in the context of creating a string table,
43 e.g. from a string table editor or from a Dialog Editor designing
47 interface XStringResourceManager
: com
::sun
::star
::resource
::XStringResourceResolver
50 Returns the resource's read only state
52 @return `TRUE` if the resource is read only, otherwise `FALSE`
57 /** Sets the locale to be used
60 Specifies the current locale to be used.
62 @param FindClosestMatch
63 <p>If true: If the exact locale that should be set is not available
64 the method tries to find the closest match. E.g. if en_US is re-
65 quired but not available, en would be the next choice. Finally
66 the default locale will be used `TRUE`.
68 <p>If false: If the exact locale that should be set is not available
69 a com::sun::star::lang::IllegalArgumentException
72 <p>If false: If the exact locale that should be set is not available
73 a com::sun::star::lang::IllegalArgumentException
78 [in] com
::sun
::star
::lang
::Locale Locale
,
79 [in] boolean FindClosestMatch
81 raises
( com
::sun
::star
::lang
::IllegalArgumentException
);
84 /** Sets the default locale to be used
87 Specifies the default locale to be used.
88 If this locale is not available a
89 com::sun::star::lang::IllegalArgumentException
92 @throws com::sun::star::lang::NoSupportException
93 if the resource is read only, see isReadOnly()
95 void setDefaultLocale
( [in] com
::sun
::star
::lang
::Locale Locale
)
96 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
97 com
::sun
::star
::lang
::NoSupportException
);
101 Associates a String to a Resource ID for the current locale.
102 If an entry for the Resource ID already exists, the string
103 associated with it will be overwritten, otherwise a new
104 entry will be created.
107 ID to address the string inside the resource for the current locale.
110 String to be associated with the Resource ID.
112 @throws com::sun::star::lang::NoSupportException
113 if the resource is read only, see isReadOnly()
117 [in] string ResourceID
,
120 raises
( com
::sun
::star
::lang
::NoSupportException
);
124 Associates a String to a Resource ID for a specific locale.
125 If an entry for the Resource ID already exists, the string
126 associated with it will be overwritten, otherwise a new
127 entry will be created.
129 It's not recommended to use this method to get the best
130 performance as the implementation may be optimized for
131 the use of the current locale.
134 ID to address the string inside the resource.
137 String to be associated with the Resource ID.
140 The locale the string should be set for.
141 The locale has to match exactly with one of the locales provided by
142 getLocales(). A closest match search is not supported.
144 @throws com::sun::star::lang::NoSupportException
145 if the resource is read only, see isReadOnly()
147 void setStringForLocale
149 [in] string ResourceID
,
151 [in] com
::sun
::star
::lang
::Locale locale
153 raises
( com
::sun
::star
::lang
::NoSupportException
);
157 Removes a Resource ID including the corresponding string for
161 The Resource ID to be removed for the current locale.
164 com::sun::star::resource::MissingResourceException
165 if the Resource ID is not valid.
168 com::sun::star::lang::NoSupportException
169 if the resource is read only, see isReadOnly()
171 void removeId
( [in] string ResourceID
)
172 raises
( com
::sun
::star
::resource
::MissingResourceException
,
173 com
::sun
::star
::lang
::NoSupportException
);
177 Removes a Resource ID including the corresponding string for
181 The Resource ID to be removed.
184 The locale the Resource ID should be removed for.
185 The locale has to match exactly with one of the locales provided by
186 getLocales(). A closest match search is not supported.
189 com::sun::star::resource::MissingResourceException
190 if the Resource ID is not valid.
193 com::sun::star::lang::NoSupportException
194 if the resource is read only, see isReadOnly()
196 void removeIdForLocale
( [in] string ResourceID
, [in] com
::sun
::star
::lang
::Locale locale
)
197 raises
( com
::sun
::star
::resource
::MissingResourceException
,
198 com
::sun
::star
::lang
::NoSupportException
);
202 Creates a new locale.
204 <p>For each existing ResourceID an empty string
205 will be created. The first locale created will
206 automatically be the first default locale.
207 Otherwise strings for all already created IDs
208 will be copied from the default locale.</p>
211 com::sun::star::container::ElementExistException
212 if the Locale already has been created.
215 com::sun::star::lang::IllegalArgumentException
216 if the Locale is not valid.
219 com::sun::star::lang::NoSupportException
220 if the resource is read only, see isReadOnly()
222 void newLocale
( [in] com
::sun
::star
::lang
::Locale locale
)
223 raises
( com
::sun
::star
::container
::ElementExistException
,
224 com
::sun
::star
::lang
::IllegalArgumentException
,
225 com
::sun
::star
::lang
::NoSupportException
);
229 Removes a locale completely including the corresponding
230 strings for each locale.
233 com::sun::star::lang::IllegalArgumentException
234 if the Locale to be removed is not supported.
237 com::sun::star::lang::NoSupportException
238 if the resource is read only, see isReadOnly()
240 void removeLocale
( [in] com
::sun
::star
::lang
::Locale locale
)
241 raises
( com
::sun
::star
::lang
::IllegalArgumentException
,
242 com
::sun
::star
::lang
::NoSupportException
);
246 Provides a numeric id that is unique within all Resource IDs
247 used in the string table.
249 This method takes into account all Resource IDs starting with
250 a decimal number and only evaluates the ID until the first non
251 digit character is reached. This allows to extend unique IDs
252 with individual identifiers without breaking the mechanism of
256 ID "42" -> numeric id 42
257 ID "0foo" -> numeric id 0
258 ID "111.MyId.Something.Else" -> numeric id 111
259 ID "No Digits" -> not considered for numeric id
261 The id returned will be 0 for an empty string table and it will
262 be reset to 0 if all locales are removed. In all other cases
263 this method returns the maximum numeric id used so far at the
264 beginning of a Resource ID incremented by 1. When calling this
265 method more than once always the same number will be returned
266 until this number is really used at the beginning of a new
267 Resource ID passed to setString() or
268 setStringForLocale().
270 As the numeric id is guaranteed to be unique for the complete
271 string table all locales are taken into account. So using this
272 methods will force the implementation to load all locale data
273 that may not have been loaded so far.
276 com::sun::star::lang::NoSupportException
277 if the next available id exceeds the range of type long.
278 So it's not recommended to use own Resource IDs starting
279 with a decimal number near to the maximum long value if
280 this methods should be used.
282 long getUniqueNumericId
()
283 raises
( com
::sun
::star
::lang
::NoSupportException
);
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */