Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / offapi / com / sun / star / resource / XStringResourceManager.idl
blobc602c7d7be195ab48695556fbacf94b267aa5fe6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 {
33 /**
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
44 localized dialogs.
47 interface XStringResourceManager: com::sun::star::resource::XStringResourceResolver
49 /**
50 Returns the resource's read only state
52 @return `TRUE` if the resource is read only, otherwise `FALSE`
54 boolean isReadOnly();
57 /** Sets the locale to be used
59 @param Locale
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
70 is thrown.
72 <p>If false: If the exact locale that should be set is not available
73 a com::sun::star::lang::IllegalArgumentException
74 is thrown.
76 void setCurrentLocale
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
86 @param Locale
87 Specifies the default locale to be used.
88 If this locale is not available a
89 com::sun::star::lang::IllegalArgumentException
90 is thrown.
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.
106 @param ResourceID
107 ID to address the string inside the resource for the current locale.
109 @param Str
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()
115 void setString
117 [in] string ResourceID,
118 [in] string Str
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.
133 @param ResourceID
134 ID to address the string inside the resource.
136 @param Str
137 String to be associated with the Resource ID.
139 @param locale
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,
150 [in] string Str,
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
158 the current locale.
160 @param ResourceID
161 The Resource ID to be removed for the current locale.
163 @throws
164 com::sun::star::resource::MissingResourceException
165 if the Resource ID is not valid.
167 @throws
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
178 s specific locale.
180 @param ResourceID
181 The Resource ID to be removed.
183 @param locale
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.
188 @throws
189 com::sun::star::resource::MissingResourceException
190 if the Resource ID is not valid.
192 @throws
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>
210 @throws
211 com::sun::star::container::ElementExistException
212 if the Locale already has been created.
214 @throws
215 com::sun::star::lang::IllegalArgumentException
216 if the Locale is not valid.
218 @throws
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.
232 @throws
233 com::sun::star::lang::IllegalArgumentException
234 if the Locale to be removed is not supported.
236 @throws
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
253 this method.
255 Examples:
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.
275 @throws
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 );
287 }; }; }; };
289 #endif
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */