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_XStringResourceResolver_idl__ 28*cdf0e10cSrcweir#define __com_sun_star_resource_XStringResourceResolver_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_util_XModifyBroadcaster_idl__ 35*cdf0e10cSrcweir#include <com/sun/star/util/XModifyBroadcaster.idl> 36*cdf0e10cSrcweir#endif 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir#ifndef __com_sun_star_lang_Locale_idl__ 39*cdf0e10cSrcweir#include <com/sun/star/lang/Locale.idl> 40*cdf0e10cSrcweir#endif 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir//============================================================================= 44*cdf0e10cSrcweir 45*cdf0e10cSrcweirmodule com { module sun { module star { module resource { 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir//============================================================================= 48*cdf0e10cSrcweir/** 49*cdf0e10cSrcweir Interface to access strings in a resource. 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir The interface is derived from 52*cdf0e10cSrcweir <type scope="com::sun::star::util">XModifyBroadcaster</type> 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir All registered <type scope="com::sun::star::util">XModifyListener</type> 55*cdf0e10cSrcweir interfaces will be notified if either the current locale changes or if 56*cdf0e10cSrcweir a string is added, changed or removed. This usually will only happen if 57*cdf0e10cSrcweir the implementing object also supports the interface 58*cdf0e10cSrcweir <type scope="com::sun::star::resource">XStringResourceManager</type> 59*cdf0e10cSrcweir and is used in the design mode of a Dialog or String table editor. 60*cdf0e10cSrcweir But also changing the locale at runtime can be supported in this way. 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir*/ 63*cdf0e10cSrcweirpublished interface XStringResourceResolver: com::sun::star::util::XModifyBroadcaster 64*cdf0e10cSrcweir{ 65*cdf0e10cSrcweir /** 66*cdf0e10cSrcweir Resolves the passed ResoureID for the current locale. This 67*cdf0e10cSrcweir locale is set during initalisation of the object implementing 68*cdf0e10cSrcweir this interface or - in case that also the interface 69*cdf0e10cSrcweir <type scope="com::sun::star::resource">XStringResourceManager</type> 70*cdf0e10cSrcweir is supported - by using the <code>XStringResourceManager::setLocale</code> 71*cdf0e10cSrcweir method. 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir @param ResourceID 74*cdf0e10cSrcweir ID to specify the string inside the resource. 75*cdf0e10cSrcweir The ID can - but not needs to - be a hierarchical 76*cdf0e10cSrcweir name like "foo.nothing.invalid". 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir @return the localized string for the specified ID 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir @throws ::com::sun::star::resource::MissingResourceException 81*cdf0e10cSrcweir if no entry exists for the given ResourceID 82*cdf0e10cSrcweir */ 83*cdf0e10cSrcweir string resolveString( [in] string ResourceID ) 84*cdf0e10cSrcweir raises( com::sun::star::resource::MissingResourceException ); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir /** Resolves the passed ResoureID for a specific locale. 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir It's not recommended to use this method to get the best 90*cdf0e10cSrcweir performance as the implementation may be optimized for 91*cdf0e10cSrcweir the use of the current locale. 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir @param ResourceID 94*cdf0e10cSrcweir ID to specify the string inside the resource. 95*cdf0e10cSrcweir The ID can - but not needs to - be a hierarchical 96*cdf0e10cSrcweir name like "foo.nothing.invalid". 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir @param locale 99*cdf0e10cSrcweir The locale the string should be resolved for. 100*cdf0e10cSrcweir The locale has to match exactly with one of the locales provided by 101*cdf0e10cSrcweir <member>getLocales</member>. A closest match search is not supported. 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir @return the localized string for the specified ID and Locale 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir @throws <type scope="com::sun::star::resource">MissingResourceException</type> 106*cdf0e10cSrcweir if no entry exists for the given ResourceID or locale 107*cdf0e10cSrcweir */ 108*cdf0e10cSrcweir string resolveStringForLocale( [in] string ResourceID, [in] com::sun::star::lang::Locale locale ) 109*cdf0e10cSrcweir raises( com::sun::star::resource::MissingResourceException ); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir /** 113*cdf0e10cSrcweir Checks if the resource contains an entry for the given ResourceID 114*cdf0e10cSrcweir and current locale. 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir @param ResourceID 117*cdf0e10cSrcweir ID to specify the string inside the resource. 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir @return <TRUE/> if an entry exists, otherwise <FALSE/> 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir */ 122*cdf0e10cSrcweir boolean hasEntryForId( [in] string ResourceID ); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir /** 126*cdf0e10cSrcweir Checks if the resource contains an entry for the given ResourceID and locale. 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir It's not recommended to use this method to get the best 129*cdf0e10cSrcweir performance as the implementation may be optimized for 130*cdf0e10cSrcweir the use of the current locale. 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir @param ResourceID 133*cdf0e10cSrcweir ID to specify the string inside the resource. 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir @param locale 136*cdf0e10cSrcweir The locale the entry should be checked for. 137*cdf0e10cSrcweir The locale has to match exactly with one of the locales provided by 138*cdf0e10cSrcweir <member>getLocales</member>. A closest match search is not supported. 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir @return <TRUE/> if an entry exists, otherwise <FALSE/> 141*cdf0e10cSrcweir */ 142*cdf0e10cSrcweir boolean hasEntryForIdAndLocale( [in] string ResourceID, [in] com::sun::star::lang::Locale locale ); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir /** 146*cdf0e10cSrcweir Returns a sequence of all valid Resource IDs for the current locale 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir @return a sequence of all valid Resource IDs 149*cdf0e10cSrcweir */ 150*cdf0e10cSrcweir sequence<string> getResourceIDs(); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir /** 154*cdf0e10cSrcweir Returns a sequence of all valid Resource IDs for a specific locale 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 locale 161*cdf0e10cSrcweir The locale the ResourceIDs should be returned for. 162*cdf0e10cSrcweir The locale has to match exactly with one of the locales provided by 163*cdf0e10cSrcweir <member>getLocales</member>. A closest match search is not supported. 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir @return a sequence of all valid Resource IDs 166*cdf0e10cSrcweir */ 167*cdf0e10cSrcweir sequence<string> getResourceIDsForLocale( [in] com::sun::star::lang::Locale locale ); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir /** Returns the current locale specified in the accessed resource. 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir If no locale is available, the returned Locale structure 173*cdf0e10cSrcweir only contains empty strings. 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir @returns the used locale 176*cdf0e10cSrcweir */ 177*cdf0e10cSrcweir com::sun::star::lang::Locale getCurrentLocale(); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir /** Returns the default locale of the accessed resource. In many 181*cdf0e10cSrcweir cases this will be the locale of the Office initially used 182*cdf0e10cSrcweir to create the resource. 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir @return the used locale 185*cdf0e10cSrcweir */ 186*cdf0e10cSrcweir com::sun::star::lang::Locale getDefaultLocale(); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir /** 190*cdf0e10cSrcweir Returns a sequence of all supported locales 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir @return a sequence of all supported locales 193*cdf0e10cSrcweir */ 194*cdf0e10cSrcweir sequence<com::sun::star::lang::Locale> getLocales(); 195*cdf0e10cSrcweir}; 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir//============================================================================= 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir}; }; }; }; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir#endif 202