1d1766043SAndrew Rist/************************************************************** 2d1766043SAndrew Rist * 3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4d1766043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5d1766043SAndrew Rist * distributed with this work for additional information 6d1766043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8d1766043SAndrew Rist * "License"); you may not use this file except in compliance 9d1766043SAndrew Rist * with the License. You may obtain a copy of the License at 10d1766043SAndrew Rist * 11d1766043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12d1766043SAndrew Rist * 13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14d1766043SAndrew Rist * software distributed under the License is distributed on an 15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16d1766043SAndrew Rist * KIND, either express or implied. See the License for the 17d1766043SAndrew Rist * specific language governing permissions and limitations 18d1766043SAndrew Rist * under the License. 19d1766043SAndrew Rist * 20d1766043SAndrew Rist *************************************************************/ 21d1766043SAndrew Rist 22d1766043SAndrew Rist 23cdf0e10cSrcweir#ifndef __com_sun_star_resource_XStringResourceResolver_idl__ 24cdf0e10cSrcweir#define __com_sun_star_resource_XStringResourceResolver_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_util_XModifyBroadcaster_idl__ 31cdf0e10cSrcweir#include <com/sun/star/util/XModifyBroadcaster.idl> 32cdf0e10cSrcweir#endif 33cdf0e10cSrcweir 34cdf0e10cSrcweir#ifndef __com_sun_star_lang_Locale_idl__ 35cdf0e10cSrcweir#include <com/sun/star/lang/Locale.idl> 36cdf0e10cSrcweir#endif 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39cdf0e10cSrcweir//============================================================================= 40cdf0e10cSrcweir 41cdf0e10cSrcweirmodule com { module sun { module star { module resource { 42cdf0e10cSrcweir 43cdf0e10cSrcweir//============================================================================= 44cdf0e10cSrcweir/** 45cdf0e10cSrcweir Interface to access strings in a resource. 46cdf0e10cSrcweir 47cdf0e10cSrcweir The interface is derived from 48cdf0e10cSrcweir <type scope="com::sun::star::util">XModifyBroadcaster</type> 49cdf0e10cSrcweir 50cdf0e10cSrcweir All registered <type scope="com::sun::star::util">XModifyListener</type> 51cdf0e10cSrcweir interfaces will be notified if either the current locale changes or if 52cdf0e10cSrcweir a string is added, changed or removed. This usually will only happen if 53cdf0e10cSrcweir the implementing object also supports the interface 54cdf0e10cSrcweir <type scope="com::sun::star::resource">XStringResourceManager</type> 55cdf0e10cSrcweir and is used in the design mode of a Dialog or String table editor. 56cdf0e10cSrcweir But also changing the locale at runtime can be supported in this way. 57cdf0e10cSrcweir 58cdf0e10cSrcweir*/ 59cdf0e10cSrcweirpublished interface XStringResourceResolver: com::sun::star::util::XModifyBroadcaster 60cdf0e10cSrcweir{ 61cdf0e10cSrcweir /** 62cdf0e10cSrcweir Resolves the passed ResoureID for the current locale. This 63*6e9cccf4Smseidel locale is set during initialization of the object implementing 64cdf0e10cSrcweir this interface or - in case that also the interface 65cdf0e10cSrcweir <type scope="com::sun::star::resource">XStringResourceManager</type> 66cdf0e10cSrcweir is supported - by using the <code>XStringResourceManager::setLocale</code> 67cdf0e10cSrcweir method. 68cdf0e10cSrcweir 69cdf0e10cSrcweir @param ResourceID 70cdf0e10cSrcweir ID to specify the string inside the resource. 71cdf0e10cSrcweir The ID can - but not needs to - be a hierarchical 72cdf0e10cSrcweir name like "foo.nothing.invalid". 73cdf0e10cSrcweir 74cdf0e10cSrcweir @return the localized string for the specified ID 75cdf0e10cSrcweir 76cdf0e10cSrcweir @throws ::com::sun::star::resource::MissingResourceException 77cdf0e10cSrcweir if no entry exists for the given ResourceID 78cdf0e10cSrcweir */ 79cdf0e10cSrcweir string resolveString( [in] string ResourceID ) 80cdf0e10cSrcweir raises( com::sun::star::resource::MissingResourceException ); 81cdf0e10cSrcweir 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** Resolves the passed ResoureID for a specific locale. 84cdf0e10cSrcweir 85cdf0e10cSrcweir It's not recommended to use this method to get the best 86cdf0e10cSrcweir performance as the implementation may be optimized for 87cdf0e10cSrcweir the use of the current locale. 88cdf0e10cSrcweir 89cdf0e10cSrcweir @param ResourceID 90cdf0e10cSrcweir ID to specify the string inside the resource. 91cdf0e10cSrcweir The ID can - but not needs to - be a hierarchical 92cdf0e10cSrcweir name like "foo.nothing.invalid". 93cdf0e10cSrcweir 94cdf0e10cSrcweir @param locale 95cdf0e10cSrcweir The locale the string should be resolved for. 96cdf0e10cSrcweir The locale has to match exactly with one of the locales provided by 97cdf0e10cSrcweir <member>getLocales</member>. A closest match search is not supported. 98cdf0e10cSrcweir 99cdf0e10cSrcweir @return the localized string for the specified ID and Locale 100cdf0e10cSrcweir 101cdf0e10cSrcweir @throws <type scope="com::sun::star::resource">MissingResourceException</type> 102cdf0e10cSrcweir if no entry exists for the given ResourceID or locale 103cdf0e10cSrcweir */ 104cdf0e10cSrcweir string resolveStringForLocale( [in] string ResourceID, [in] com::sun::star::lang::Locale locale ) 105cdf0e10cSrcweir raises( com::sun::star::resource::MissingResourceException ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir 108cdf0e10cSrcweir /** 109cdf0e10cSrcweir Checks if the resource contains an entry for the given ResourceID 110cdf0e10cSrcweir and current locale. 111cdf0e10cSrcweir 112cdf0e10cSrcweir @param ResourceID 113cdf0e10cSrcweir ID to specify the string inside the resource. 114cdf0e10cSrcweir 115cdf0e10cSrcweir @return <TRUE/> if an entry exists, otherwise <FALSE/> 116cdf0e10cSrcweir 117cdf0e10cSrcweir */ 118cdf0e10cSrcweir boolean hasEntryForId( [in] string ResourceID ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir 121cdf0e10cSrcweir /** 122cdf0e10cSrcweir Checks if the resource contains an entry for the given ResourceID and locale. 123cdf0e10cSrcweir 124cdf0e10cSrcweir It's not recommended to use this method to get the best 125cdf0e10cSrcweir performance as the implementation may be optimized for 126cdf0e10cSrcweir the use of the current locale. 127cdf0e10cSrcweir 128cdf0e10cSrcweir @param ResourceID 129cdf0e10cSrcweir ID to specify the string inside the resource. 130cdf0e10cSrcweir 131cdf0e10cSrcweir @param locale 132cdf0e10cSrcweir The locale the entry should be checked for. 133cdf0e10cSrcweir The locale has to match exactly with one of the locales provided by 134cdf0e10cSrcweir <member>getLocales</member>. A closest match search is not supported. 135cdf0e10cSrcweir 136cdf0e10cSrcweir @return <TRUE/> if an entry exists, otherwise <FALSE/> 137cdf0e10cSrcweir */ 138cdf0e10cSrcweir boolean hasEntryForIdAndLocale( [in] string ResourceID, [in] com::sun::star::lang::Locale locale ); 139cdf0e10cSrcweir 140cdf0e10cSrcweir 141cdf0e10cSrcweir /** 142cdf0e10cSrcweir Returns a sequence of all valid Resource IDs for the current locale 143cdf0e10cSrcweir 144cdf0e10cSrcweir @return a sequence of all valid Resource IDs 145cdf0e10cSrcweir */ 146cdf0e10cSrcweir sequence<string> getResourceIDs(); 147cdf0e10cSrcweir 148cdf0e10cSrcweir 149cdf0e10cSrcweir /** 150cdf0e10cSrcweir Returns a sequence of all valid Resource IDs for a specific locale 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 locale 157cdf0e10cSrcweir The locale the ResourceIDs should be returned for. 158cdf0e10cSrcweir The locale has to match exactly with one of the locales provided by 159cdf0e10cSrcweir <member>getLocales</member>. A closest match search is not supported. 160cdf0e10cSrcweir 161cdf0e10cSrcweir @return a sequence of all valid Resource IDs 162cdf0e10cSrcweir */ 163cdf0e10cSrcweir sequence<string> getResourceIDsForLocale( [in] com::sun::star::lang::Locale locale ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir 166cdf0e10cSrcweir /** Returns the current locale specified in the accessed resource. 167cdf0e10cSrcweir 168cdf0e10cSrcweir If no locale is available, the returned Locale structure 169cdf0e10cSrcweir only contains empty strings. 170cdf0e10cSrcweir 171cdf0e10cSrcweir @returns the used locale 172cdf0e10cSrcweir */ 173cdf0e10cSrcweir com::sun::star::lang::Locale getCurrentLocale(); 174cdf0e10cSrcweir 175cdf0e10cSrcweir 176cdf0e10cSrcweir /** Returns the default locale of the accessed resource. In many 177cdf0e10cSrcweir cases this will be the locale of the Office initially used 178cdf0e10cSrcweir to create the resource. 179cdf0e10cSrcweir 180cdf0e10cSrcweir @return the used locale 181cdf0e10cSrcweir */ 182cdf0e10cSrcweir com::sun::star::lang::Locale getDefaultLocale(); 183cdf0e10cSrcweir 184cdf0e10cSrcweir 185cdf0e10cSrcweir /** 186cdf0e10cSrcweir Returns a sequence of all supported locales 187cdf0e10cSrcweir 188cdf0e10cSrcweir @return a sequence of all supported locales 189cdf0e10cSrcweir */ 190cdf0e10cSrcweir sequence<com::sun::star::lang::Locale> getLocales(); 191cdf0e10cSrcweir}; 192cdf0e10cSrcweir 193cdf0e10cSrcweir//============================================================================= 194cdf0e10cSrcweir 195cdf0e10cSrcweir}; }; }; }; 196cdf0e10cSrcweir 197cdf0e10cSrcweir#endif 198