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