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#ifndef __com_sun_star_resource_XStringResourceManager_idl__ 24#define __com_sun_star_resource_XStringResourceManager_idl__ 25 26#ifndef __com_sun_star_resource_MissingResourceException_idl__ 27#include <com/sun/star/resource/MissingResourceException.idl> 28#endif 29 30#ifndef __com_sun_star_resource_XStringResourceResolver_idl__ 31#include <com/sun/star/resource/XStringResourceResolver.idl> 32#endif 33 34#ifndef __com_sun_star_container_ElementExistException_idl__ 35#include <com/sun/star/container/ElementExistException.idl> 36#endif 37 38#ifndef __com_sun_star_lang_Locale_idl__ 39#include <com/sun/star/lang/Locale.idl> 40#endif 41 42#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ 43#include <com/sun/star/lang/IllegalArgumentException.idl> 44#endif 45 46#ifndef __com_sun_star_lang_NoSupportException_idl__ 47#include <com/sun/star/lang/NoSupportException.idl> 48#endif 49 50 51//============================================================================= 52 53module com { module sun { module star { module resource { 54 55//============================================================================= 56/** 57 Interface to manage a resource string table containing a set of 58 strings for different locales. 59 60 The interface is derived from 61 <type scope="com::sun::star::resource">XStringResourceResolver</type> 62 that allows to access the string table but not to modify it. This 63 interface also allows to modify the string table. 64 65 It's designed to be used in the context of creating a string table, 66 e.g. from a string table editor or from a Dialog Editor designing 67 localized dialogs. 68 69*/ 70published interface XStringResourceManager: com::sun::star::resource::XStringResourceResolver 71{ 72 /** 73 Returns the resource's read only state 74 75 @return <TRUE/> if the resource is read only, otherwise <FALSE/> 76 */ 77 boolean isReadOnly(); 78 79 80 /** Sets the locale to be used 81 82 @param aLocale 83 Specifies the current locale to be used. 84 85 @param FindClosestMatch 86 <p>If true: If the exact locale that should be set is not available 87 the method tries to find the closest match. E.g. if en_US is re- 88 quired but not available, en would be the next choice. Finally 89 the default locale will be used <TRUE/>. 90 91 <p>If false: If the exact locale that should be set is not available 92 a <type scope="com::sun::star::lang">IllegalArgumentException</type> 93 is thrown. 94 95 <p>If false: If the exact locale that should be set is not available 96 a <type scope="com::sun::star::lang">IllegalArgumentException</type> 97 is thrown. 98 */ 99 void setCurrentLocale 100 ( 101 [in] com::sun::star::lang::Locale locale, 102 [in] boolean FindClosestMatch 103 ) 104 raises( com::sun::star::lang::IllegalArgumentException ); 105 106 107 /** Sets the default locale to be used 108 109 @param aLocale 110 Specifies the default locale to be used. 111 If this locale is not available a 112 <type scope="com::sun::star::lang">IllegalArgumentException</type> 113 is thrown. 114 115 @throws <type scope="com::sun::star::lang">NoSupportException</type> 116 if the resource is read only, see <member>isReadOnly</member> 117 */ 118 void setDefaultLocale( [in] com::sun::star::lang::Locale locale ) 119 raises( com::sun::star::lang::IllegalArgumentException, 120 com::sun::star::lang::NoSupportException ); 121 122 123 /** 124 Associates a String to a Resource ID for the current 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. 128 129 @param ResourceID 130 ID to address the string inside the resource for the current locale. 131 132 @param Str 133 String to be associated with the Resource ID. 134 135 @throws <type scope="com::sun::star::lang">NoSupportException</type> 136 if the resource is read only, see <member>isReadOnly</member> 137 */ 138 void setString 139 ( 140 [in] string ResourceID, 141 [in] string Str 142 ) 143 raises( com::sun::star::lang::NoSupportException ); 144 145 146 /** 147 Associates a String to a Resource ID for a specific locale. 148 If an entry for the Resource ID already exists, the string 149 associated with it will be overwritten, otherwise a new 150 entry will be created. 151 152 It's not recommended to use this method to get the best 153 performance as the implementation may be optimized for 154 the use of the current locale. 155 156 @param ResourceID 157 ID to address the string inside the resource. 158 159 @param Str 160 String to be associated with the Resource ID. 161 162 @param locale 163 The locale the string should be set for. 164 The locale has to match exactly with one of the locales provided by 165 <member>getLocales</member>. A closest match search is not supported. 166 167 @throws <type scope="com::sun::star::lang">NoSupportException</type> 168 if the resource is read only, see <member>isReadOnly</member> 169 */ 170 void setStringForLocale 171 ( 172 [in] string ResourceID, 173 [in] string Str, 174 [in] com::sun::star::lang::Locale locale 175 ) 176 raises( com::sun::star::lang::NoSupportException ); 177 178 179 /** 180 Removes a Resource ID including the corresponding string for 181 the current locale. 182 183 @param ResourceID 184 The Resource ID to be removed for the current locale. 185 186 @throws 187 <type scope="com::sun::star::resource">MissingResourceException</type> 188 if the Resource ID is not valid. 189 190 @throws 191 <type scope="com::sun::star::lang">NoSupportException</type> 192 if the resource is read only, see <member>isReadOnly</member> 193 */ 194 void removeId( [in] string ResourceID ) 195 raises( com::sun::star::resource::MissingResourceException, 196 com::sun::star::lang::NoSupportException ); 197 198 199 /** 200 Removes a Resource ID including the corresponding string for 201 s specific locale. 202 203 @param ResourceID 204 The Resource ID to be removed. 205 206 @param locale 207 The locale the Resource ID should be removed for. 208 The locale has to match exactly with one of the locales provided by 209 <member>getLocales</member>. A closest match search is not supported. 210 211 @throws 212 <type scope="com::sun::star::resource">MissingResourceException</type> 213 if the Resource ID is not valid. 214 215 @throws 216 <type scope="com::sun::star::lang">NoSupportException</type> 217 if the resource is read only, see <member>isReadOnly</member> 218 */ 219 void removeIdForLocale( [in] string ResourceID, [in] com::sun::star::lang::Locale locale ) 220 raises( com::sun::star::resource::MissingResourceException, 221 com::sun::star::lang::NoSupportException ); 222 223 224 /** 225 Creates a new locale. 226 227 <p>For each existing ResourceID an empty string 228 will be created. The first locale created will 229 automatically be the first default locale. 230 Otherwise strings for all already created IDs 231 will be copied from the default locale.</p> 232 233 @throws 234 <type scope="com::sun::star::container">ElementExistException</type> 235 if the Locale already has been created. 236 237 @throws 238 <type scope="com::sun::star::lang">IllegalArgumentException</type> 239 if the Locale is not valid. 240 241 @throws 242 <type scope="com::sun::star::lang">NoSupportException</type> 243 if the resource is read only, see <member>isReadOnly</member> 244 */ 245 void newLocale( [in] com::sun::star::lang::Locale locale ) 246 raises( com::sun::star::container::ElementExistException, 247 com::sun::star::lang::IllegalArgumentException, 248 com::sun::star::lang::NoSupportException ); 249 250 251 /** 252 Removes a locale completely including the corresponding 253 strings for each locale. 254 255 @throws 256 <type scope="com::sun::star::lang">IllegalArgumentException</type> 257 if the Locale to be removed is not supported. 258 259 @throws 260 <type scope="com::sun::star::lang">NoSupportException</type> 261 if the resource is read only, see <member>isReadOnly</member> 262 */ 263 void removeLocale( [in] com::sun::star::lang::Locale locale ) 264 raises( com::sun::star::lang::IllegalArgumentException, 265 com::sun::star::lang::NoSupportException ); 266 267 268 /** 269 Provides a numeric id that is unique within all Resource IDs 270 used in the string table. 271 272 This method takes into account all Resource IDs starting with 273 a decimal number and only evaluates the ID until the first non 274 digit character is reached. This allows to extend unique IDs 275 with individual identifiers without breaking the mechanism of 276 this method. 277 278 Examples: 279 ID "42" -> numeric id 42 280 ID "0foo" -> numeric id 0 281 ID "111.MyId.Something.Else" -> numeric id 111 282 ID "No Digits" -> not considered for numeric id 283 284 The id returned will be 0 for an empty string table and it will 285 be reset to 0 if all locales are removed. In all other cases 286 this method returns the maximum numeric id used so far at the 287 beginning of a Resource ID incremented by 1. When calling this 288 method more than once always the same number will be returned 289 until this number is really used at the beginning of a new 290 Resource ID passed to <member>setString</member> or 291 <member>setStringForLocale</member>. 292 293 As the numeric id is guaranteed to be unique for the complete 294 string table all locales are taken into account. So using this 295 methods will force the implementation to load all locale data 296 that may not have been loaded so far. 297 298 @throws 299 <type scope="com::sun::star::lang">NoSupportException</type> 300 if the next available id exceeds the range of type long. 301 So it's not recommended to use own Resource IDs starting 302 with a decimal number near to the maximum long value if 303 this methods should be used. 304 */ 305 long getUniqueNumericId() 306 raises( com::sun::star::lang::NoSupportException ); 307}; 308 309//============================================================================= 310 311}; }; }; }; 312 313#endif 314