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