diff options
Diffstat (limited to 'offapi/com/sun/star/resource')
15 files changed, 2050 insertions, 0 deletions
diff --git a/offapi/com/sun/star/resource/MissingResourceException.idl b/offapi/com/sun/star/resource/MissingResourceException.idl new file mode 100644 index 000000000000..7453f89c8e96 --- /dev/null +++ b/offapi/com/sun/star/resource/MissingResourceException.idl @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_MissingResourceException_idl__ +#define __com_sun_star_resource_MissingResourceException_idl__ + +#ifndef __com_sun_star_uno_RuntimeException_idl__ +#include <com/sun/star/uno/RuntimeException.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= + +/** is used to signal that a resource is missing. + + @see XResourceBundle + */ +published exception MissingResourceException: com::sun::star::uno::RuntimeException +{ +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/OfficeResourceLoader.idl b/offapi/com/sun/star/resource/OfficeResourceLoader.idl new file mode 100644 index 000000000000..7930a34e5571 --- /dev/null +++ b/offapi/com/sun/star/resource/OfficeResourceLoader.idl @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_resource_OfficeResourceLoader_idl__ +#define __com_sun_star_resource_OfficeResourceLoader_idl__ + +#ifndef __com_sun_star_resource_XResourceBundleLoader_idl__ +#include <com/sun/star/resource/XResourceBundleLoader.idl> +#endif + +//============================================================================= +module com { module sun { module star { module resource { +//============================================================================= + +/** describes a <type>XResourceBundleLoader</type> which provides access to the OpenOffice.org + resource files. + + <p>An OpenOffice.org installation comes with a number of resource files in an proprietary + format, located insisde the installation's program/resource directory. The <type>OfficeResoureLoader</type> + singleton (available at a component context as value with the key + <code>/singletons/com.sun.star.resource.OfficeResourceLoader</code>), provides access to some + types of resources within those files.</p> + + <p>Clients have to specifiy the resource file base name in the call to + <member>XResourceBundleLoader::loadBundle</member> resp. <member>XResourceBundleLoader::loadBundle_Default</member> + method. The loader will extent this base name so that the resulting name conforms to the OpenOffice.org + resource file naming conventions, and look up the respective resource file, for the requested locale, + in OpenOffice.org's installation.</p> + + <p>The lookup process uses the fallback mechanism as described at the <type>XResourceBundle</type> interface, + except that <code>Locale.getDefault()</code> is not used.</p> + + <p>Resource keys, as passed to the <member>XResourceBundle::getDirectElement</member> or + <member scope="com::sun::star::container">XNameAccess::getByName</member>, have the following format: + <code><resource_type>:<numeric_identifier></code>, where <code><resource_type> specifies + the type of the requested resource (see below) and <code><numeric_identifier></code> is the numeric + identifier of the resource.</p> + + <p>The following resource types are currently supported: + <ul> + <li><em>string</em>: denotes a string resource</li> + </ul> + </p> + + <p>Since the numeric resource identifiers are highly build-dependent (e.g. can change with any next + OpenOffice.org build), you are <strong>strongly</strong> discouraged from using the <type>OfficeResoureLoader</type> + service in a component which targets more than one particular OpenOffice.org build.</p> + + @since OpenOffice.org 2.0.3 +*/ +singleton OfficeResourceLoader : XResourceBundleLoader; + +//============================================================================= +}; }; }; }; +//============================================================================= + +#endif diff --git a/offapi/com/sun/star/resource/StringResource.idl b/offapi/com/sun/star/resource/StringResource.idl new file mode 100644 index 000000000000..2c53e6a3cdc2 --- /dev/null +++ b/offapi/com/sun/star/resource/StringResource.idl @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_resource_StringResourceManager_idl__ +#define __com_sun_star_resource_StringResourceManager_idl__ + +#ifndef __com_sun_star_resource_XStringResourcePersistence_idl__ +#include <com/sun/star/resource/XStringResourcePersistence.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= + +/** specifies a service providing access to a resource string table implementing the + <type scope="com::sun::star::awt">XDialog</type> interface. + */ +service StringResource : com::sun::star::resource::XStringResourcePersistence; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/StringResourceWithLocation.idl b/offapi/com/sun/star/resource/StringResourceWithLocation.idl new file mode 100644 index 000000000000..9115d9e22758 --- /dev/null +++ b/offapi/com/sun/star/resource/StringResourceWithLocation.idl @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_resource_StringResourceWithLocation_idl__ +#define __com_sun_star_resource_StringResourceWithLocation_idl__ + +#ifndef __com_sun_star_resource_XStringResourceWithLocation_idl__ +#include <com/sun/star/resource/XStringResourceWithLocation.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= + +/** specifies a service providing access to a resource string table implementing the + <type scope="com::sun::star::resource">XStringResourceWithLocation</type> interface. + */ +service StringResourceWithLocation : com::sun::star::resource::XStringResourceWithLocation +{ + /** is used to initialize the object on its creation. + + @param URL + Specifies the location used to load and store - if + the ReadOnly state allows it - the string table data. + + @param ReadOnly + Specifies if the resource should be read only, + see <code>XStringResourceManager::isReadOnly</code> + + @param locale + Specifies if the locale first to be used as current locale. Internally + the <code>XStringResourceManager::setCurrentLocale</code> method is + called with FindClosestMatch=true. + see <code>XStringResourceManager::setCurrentLocale</code> + + @param BaseName + Base string for the file names used to store the locale data. + The locale data is stored in Java properties files also following + the corresponding naming sceme. The files will be named like this: + "[BaseName]_[Language]_[Country].properties", + e.g. "MyBaseName_en_US.properties" + If an empty string is passed for BaseName, "strings" will be used + as BaseName. + + @param Comment + Comment stored first in each properties file followed by a line + feed character. The line feed character is added automatically + and hasn't to be part of the comment string. The caller is re- + sponsible that the passed string is a valid comment in a Java + properties file, e.g. "# My strings". The string may be empty. + + @param Handler + a <type scope="com::sun::star::task">XInteractionHandler</type> + to be passed to ucb. This may be a null interface. + + @throws <type scope="com::sun::star::lang">IllegalArgumentException</type> + if no string or an empty string is passed as URL + */ + create( [in] string URL, [in] boolean ReadOnly, + [in] com::sun::star::lang::Locale locale, + [in] string BaseName, [in] string Comment, + [in] com::sun::star::task::XInteractionHandler Handler ) + raises( ::com::sun::star::lang::IllegalArgumentException ); +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/StringResourceWithStorage.idl b/offapi/com/sun/star/resource/StringResourceWithStorage.idl new file mode 100644 index 000000000000..0d8c0678a97a --- /dev/null +++ b/offapi/com/sun/star/resource/StringResourceWithStorage.idl @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_resource_StringResourceWithStorage_idl__ +#define __com_sun_star_resource_StringResourceWithStorage_idl__ + +#ifndef __com_sun_star_resource_XStringResourceWithStorage_idl__ +#include <com/sun/star/resource/XStringResourceWithStorage.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= + +/** specifies a service providing access to a resource string table implementing the + <type scope="com::sun::star::resource">XStringResourceWithStorage</type> interface. + */ +service StringResourceWithStorage : com::sun::star::resource::XStringResourceWithStorage +{ + /** is used to initialize the object on its creation. + + @param Storage + Specifies the storage used to load and store - if + the ReadOnly state allows it - the string table data. + + @param ReadOnly + Specifies if the resource should be read only, + see <code>XStringResourceManager::isReadOnly</code> + + @param locale + Specifies if the locale first to be used as current locale. Internally + the <code>XStringResourceManager::setCurrentLocale</code> method is + called with FindClosestMatch=true. + see <code>XStringResourceManager::setCurrentLocale</code> + + @param BaseName + Base string for the file names used to store the locale data. + The locale data is stored in Java properties files also following + the corresponding naming sceme. The files will be named like this: + "[BaseName]_[Language]_[Country].properties", + e.g. "MyBaseName_en_US.properties" + If an empty string is passed for BaseName, "strings" will be used + as BaseName. + + @param Comment + Comment stored first in each properties file followed by a line + feed character. The line feed character is added automatically + and hasn't to be part of the comment string. The caller is re- + sponsible that the passed string is a valid comment in a Java + properties file, e.g. "# My strings". The string may be empty. + + @throws <type scope="com::sun::star::lang">IllegalArgumentException</type> + if a null interface is passed as Storage + */ + create( [in] ::com::sun::star::embed::XStorage Storage, + [in] boolean ReadOnly, [in] com::sun::star::lang::Locale locale, + [in] string BaseName, [in] string Comment ) + raises( ::com::sun::star::lang::IllegalArgumentException ); +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/XLocale.idl b/offapi/com/sun/star/resource/XLocale.idl new file mode 100644 index 000000000000..9ae947b1c474 --- /dev/null +++ b/offapi/com/sun/star/resource/XLocale.idl @@ -0,0 +1,275 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_XLocale_idl__ +#define __com_sun_star_resource_XLocale_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __com_sun_star_lang_Locale_idl__ +#include <com/sun/star/lang/Locale.idl> +#endif + +#ifndef __com_sun_star_resource_MissingResourceException_idl__ +#include <com/sun/star/resource/MissingResourceException.idl> +#endif + + +//============================================================================= + + module com { module sun { module star { module resource { + +//============================================================================= + +// DocMerge from xml: interface com::sun::star::resource::XLocale +/** offers some operations on <type scope="com::sun::star::lang">Locale</type> + structures.@see XResourceBundle + @see Locale + */ +published interface XLocale: com::sun::star::uno::XInterface +{ + //------------------------------------------------------------------------- + + // DocMerge from xml: method com::sun::star::resource::XLocale::create + /** creates a locale from language, country, and variant. + + <p>NOTE: ISO 639 is not a stable standard; some of the + language codes it defines (specifically iw, ji, and in) have + changed. This constructor accepts both the old codes (iw, ji, + and in) and the new codes (he, yi, and id), but all other API + on XLocale will return only the <b>NEW</b> codes. + </p> + <p>Note: The Java class <code>Locale</code> returns the <strong>old</strong> codes. + + </p> + */ + com::sun::star::lang::Locale create( [in] string aLanguage, + [in] string aCountry, + [in] string aVariant ); + + //------------------------------------------------------------------------- + + // DocMerge from xml: method com::sun::star::resource::XLocale::getDefault + /** the common method of getting the current default locale. + + <p>It is used for the presentation (for menus, dialogs, etc.). + It is, generally, set once when your applet or application is + initialized, then never reset. (If you do reset the default + locale, you probably want to reload your GUI, so that the + change is reflected in your interface.) + </p> + <p>More advanced programs allow users to use different locales + for different fields, for example, in a spreadsheet. + + <br>Note that the initial setting will match the host system.</p> + */ + com::sun::star::lang::Locale getDefault(); + + //------------------------------------------------------------------------- + + // DocMerge from xml: method com::sun::star::resource::XLocale::setDefault + /** sets the default locale for the whole environment. + + <p>It is normally set once at the beginning of an application, + then never reset. <code>setDefault</code> does not reset the host + locale. + + </p> + */ + void setDefault( [in] com::sun::star::lang::Locale newLocale ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getAvailableLocales + /** @returns + a sequence of all locales which are available in the system. + */ + sequence<com::sun::star::lang::Locale> getAvailableLocales(); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getISOCountries + /** @returns + a sequence of all ISO country codes known to the component. + */ + sequence<string> getISOCountries(); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getISOLanguages + /** @returns + a sequence of all ISO language codes known to the component. + */ + sequence<string> getISOLanguages(); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getLanguagesForCountry + /** @returns + a sequence for language codes which are valid within the + given country. + */ + sequence<string> getLanguagesForCountry( [in] string country ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getISO3Language + /** @returns + the ISO language code for the specified locale. + */ + string getISO3Language( [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::resource::MissingResourceException ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getISO3Country + /** @returns + the ISO country code for the specified locale. + */ + string getISO3Country( [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::resource::MissingResourceException ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getDisplayLanguage_Default + /** @returns + language code for display of field to user. If the localized + name is not found, returns the ISO code. The desired user language + is from the default locale. + */ + string getDisplayLanguage_Default( [in] com::sun::star::lang::Locale locale ); + + //------------------------------------------------------------------------- + + + // DocMerge from idl: method com::sun::star::resource::XLocale::getDisplayLanguage + /** @return + language code for display of field to user. If the localized + name is not found, returns the ISO codes. + + @param inLocale + specifies the desired user language. + + @example + "English (UK)", "Deutch", "Germany" + */ + string getDisplayLanguage( [in] com::sun::star::lang::Locale locale, + [in] com::sun::star::lang::Locale inLocale ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getDisplayCountry_Default + /** @returns + country code for display of field to user. If the localized + name is not found, returns the ISO code. The desired user country + is from the default locale. + */ + string getDisplayCountry_Default( [in] com::sun::star::lang::Locale locale ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getDisplayCountry + /** @returns + country code for display of field to user. If the localized + name is not found, returns the ISO codes. + + @param inLocale + specifies the desired user country. + */ + string getDisplayCountry( [in] com::sun::star::lang::Locale locale, + [in] com::sun::star::lang::Locale inLocale ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getDisplayVariant_Default + /** @returns + variant code for display of field to user. The desired user variant + is from the default locale. + */ + string getDisplayVariant_Default( [in] com::sun::star::lang::Locale locale ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getDisplayVariant + /** @returns + variant code for display of field to user. If the localized + name is not found, returns the ISO codes. + + @param inLocale + specifies the desired user variant. + */ + string getDisplayVariant( [in] com::sun::star::lang::Locale locale, + [in] com::sun::star::lang::Locale inLocale ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getDisplayName_Default + /** @returns + a string to display the entire locale to user. If the localized + name is not found, uses the ISO codes. The default locale is used + for the presentation language. + */ + string getDisplayName_Default( [in] com::sun::star::lang::Locale locale ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::getDisplayName + /** @returns + a string to display the entire locale to user. If the localized + name is not found, uses the ISO codes. + + @param inLocale + specifies the desired user locale. + */ + string getDisplayName( [in] com::sun::star::lang::Locale locale, + [in] com::sun::star::lang::Locale inLocale ); + + //------------------------------------------------------------------------- + + // DocMerge from idl: method com::sun::star::resource::XLocale::equals + /** @returns + <TRUE/> if the <type scope="com::sun::star::lang">Locale</type> <var>l1</var> is equal to the + other one. + + <p>A locale is deemed equal to another locale with identical + language, country, and variant, and unequal to all other + objects. + */ + boolean equals( [in] com::sun::star::lang::Locale l1, + [in] com::sun::star::lang::Locale l2 ); + +}; + +//============================================================================= + +}; }; }; }; + +/*============================================================================= + +=============================================================================*/ +#endif diff --git a/offapi/com/sun/star/resource/XResourceBundle.idl b/offapi/com/sun/star/resource/XResourceBundle.idl new file mode 100644 index 000000000000..15ff639663c3 --- /dev/null +++ b/offapi/com/sun/star/resource/XResourceBundle.idl @@ -0,0 +1,243 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_XResourceBundle_idl__ +#define __com_sun_star_resource_XResourceBundle_idl__ + +#ifndef __com_sun_star_container_XNameAccess_idl__ +#include <com/sun/star/container/XNameAccess.idl> +#endif + +#ifndef __com_sun_star_lang_Locale_idl__ +#include <com/sun/star/lang/Locale.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= +/** Resource bundles contain locale-specific objects. + + <p>When your program needs a locale-specific resource, such as + <code>String</code> for example, your program can load it from the + resource bundle that is appropriate for the current user's locale. In + this way, you can write program code that is largely independent of + the user's locale, which isolates most, if not all, of the + locale-specific information in resource bundles. + + <p>This allows you to write programs that can: + + <UL type=SQUARE> + + <LI> be easily localized, or translated, into different + languages. + + <LI> handle multiple locales at once. + + <LI> be easily modified, later, to support even more locales. + + </UL> + + <P> One resource bundle is, conceptually, a set of related services + that supports <code>XResourceBundle</code>. Each related service of + <code>XResourceBundle</code> has the same base name plus an + additional component that identifies its locale. For example, suppose + your resource bundle is named <code>MyResources</code>. The first + service you are likely to implement is the default resource bundle, + which has the same name as its family--<code>MyResources</code>. You + can also provide as many related locale-specific services as you need. + + For example, perhaps you would provide a German one named + <code>MyResources_de</code>. + + <P> + Each related implementation of <code>XResourceBundle</code> contains + the same items, but the items have been translated for the locale + represented by that <code>XResourceBundle</code> implementation. For + example, both <code>MyResources</code> and <code>MyResources_de</code> + may have a <code>String</code> that is used on a button for + confirming operations. In <code>MyResources</code> the + <code>String</code> may contain <code>OK</code> and in + <code>MyResources_de</code> it may contain <code>Gut</code>. + + <P> + If there are different resources for different countries, you + can make specializations: for example, <code>MyResources_de_CH</code> + is the German language (de) in Switzerland (CH). If you only want to + modify some of the resources in the specialization, you can do so. + + <P> + When your program needs a locale-specific object, it loads + + the <code>XResourceBundle</code> implementation using the + <type>XResourceBundleLoader</type> service: + + <listing> + XResourceBundle myResources = xLoader.getBundle("MyResources", currentLocale); + </listing> + + <p>The first argument specifies the family name of the resource + bundle that contains the object in question. The second argument + indicates the desired locale. <code>getBundle</code> uses these two + arguments to construct the name of the <code>ResourceBundle</code> + subclass it should load according to the following specifications. + + <P>The resource bundle lookup searches for services with various + suffixes on the basis of (1) the desired locale and (2) the current + default locale as returned by Locale.getDefault(), and (3) the root + resource bundle (baseclass), in the following order from lower-level + (more specific) to parent-level (less specific): + <p> baseclass + "_" + language1 + "_" + country1 + "_" + variant1 + <BR> baseclass + "_" + language1 + "_" + country1 + <BR> baseclass + "_" + language1 + <BR> baseclass + "_" + language2 + "_" + country2 + "_" + variant2 + <BR> baseclass + "_" + language2 + "_" + country2 + <BR> baseclass + "_" + language2 + <BR> baseclass + + <P> For example, if the current default locale is <TT>en_US</TT>, the + locale that the caller is interested in is <TT>fr_CH</TT>, and the + resource bundle name is <TT>MyResources</TT>; resource bundle lookup + will search for the following services, in order: + <BR> <TT>MyResources_fr_CH + <BR> MyResources_fr + <BR> MyResources_en_US + <BR> MyResources_en + <BR> MyResources</TT> + + <P> The result of the lookup is a service, but that service may be + backed by a property file on disk. If a lookup fails, + <code>getBundle()</code> throws a + <code>MissingResourceException</code>. + + <P> The base service <strong>must</strong> be fully qualified (for + example, <code>myPackage::MyResources</code>, not just + <code>MyResources</code>). + + <P> Resource bundles contain key/value pairs. The keys uniquely + identify a locale-specific object in the bundle. Here is an + example of a <code>XResourceBundle</code> implementation that contains + two key/value pairs: + + <listing> + class MyResource extends com.sun.star.resource.XResourceBundle + { + // some queryInterface stuff + // ... + public final Object getDirectElement(String key) + { + if (key.equals("okKey")) return "Ok"; + if (key.equals("cancelKey")) return "Cancel"; + return null; + } + } + </listing> + + <p>Keys are always <code>String</code>s. In this example, the keys + are <code>OkKey</code> and <code>CancelKey</code>. In the above + example, the values are also <code>String</code>s--<code>OK</code> + and <code>Cancel</code>--but they do not have to be. The values can + be any type of object. + + <P> You retrieve an object from resource bundle using the appropriate + get method. Because <code>OkKey</code> and <code>CancelKey</code> + are both strings, you use <code>getByName</code> to retrieve them: + + <listing> + button1 = new Button(myResourceBundle.getByName("OkKey").getString()); + button2 = new Button(myResourceBundle.getByName("CancelKey").getString()); + </listing> + + <p>The get methods all require the key as an argument and return + the object if found. If the object is not found, the get methods + throw a <type scope="com::sun::star::container">NoSuchElementException</type>. + + <P> <STRONG>NOTE:</STRONG> You should always supply a base service + with no suffixes. This will be the class of "last resort" if a + locale is requested that does not exist. In fact, you must provide + <I>all</I> of the services in any given inheritance chain for which + you provide a resource. For example, if you provide + <TT>MyResources_fr_BE</TT>, you must provide <I>both</I> + <TT>MyResources</TT> <I>and</I> <TT>MyResources_fr</TT>, or the + resource bundle lookup will not work right. + + <P>You do not have to restrict yourself to using a single family of + <code>ResourceBundle</code>s. For example, you could have a set of + bundles for exception messages, <code>ExceptionResources</code> + (<code>ExceptionResources_fr</code>, <code>ExceptionResources_de</code>, ...), + and one for widgets, <code>WidgetResource</code> (<code>WidgetResources_fr</code>, + <code>WidgetResources_de</code>, ...); breaking up the resources however you like. + + @see MissingResourceException + @see Locale + @version 0.1 26 May 1999 + @author Mark Davis + @author Markus Meyer + @deprecated draft +*/ +published interface XResourceBundle: com::sun::star::container::XNameAccess +{ + //------------------------------------------------------------------------- + /** contains the parent bundle of this bundle. + + <p>The parent bundle is searched by the method + <method scope="com::sun::star::container">XNameAccess::getByName</method> + when this bundle does not contain a particular resource. + */ + [attribute] XResourceBundle Parent; + + //------------------------------------------------------------------------- + /** @returns + the locale for this resource bundle. + + <p>This function can be used to determine whether the + resource bundle that is returned really corresponds to the + requested locale or is a fallback. + + */ + com::sun::star::lang::Locale getLocale(); + + //------------------------------------------------------------------------- + /** @returns + an object from a resource bundle or NULL if no resource + exists. + + <p>It does not look in the parents. + + @param key + specifies the element. + */ + any getDirectElement( [in] string key ); + +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/XResourceBundleLoader.idl b/offapi/com/sun/star/resource/XResourceBundleLoader.idl new file mode 100644 index 000000000000..4440dbfdbdb7 --- /dev/null +++ b/offapi/com/sun/star/resource/XResourceBundleLoader.idl @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_XResourceBundleLoader_idl__ +#define __com_sun_star_resource_XResourceBundleLoader_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __com_sun_star_resource_XResourceBundle_idl__ +#include <com/sun/star/resource/XResourceBundle.idl> +#endif + +#ifndef __com_sun_star_resource_MissingResourceException_idl__ +#include <com/sun/star/resource/MissingResourceException.idl> +#endif + +#ifndef __com_sun_star_lang_Locale_idl__ +#include <com/sun/star/lang/Locale.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= + +/** makes it possible to load resource bundles. + + <p>The search algorithm is specified in the documentation of + <type>XResourceBundle</type>. The implementations must follow + the name scheme, but it is allowed to search in several locations. + + @see MissingResourceException + @see XResourceBundle + @see Locale + */ +published interface XResourceBundleLoader: com::sun::star::uno::XInterface +{ + //------------------------------------------------------------------------- + + /** loads the appropriate resource bundle. + */ + com::sun::star::resource::XResourceBundle loadBundle_Default( [in] string aBaseName ) + raises( com::sun::star::resource::MissingResourceException ); + + //------------------------------------------------------------------------- + + /** loads the appropriate resource bundle subclass. + */ + com::sun::star::resource::XResourceBundle loadBundle( [in] string abaseName, + [in] com::sun::star::lang::Locale aLocale ) + raises( com::sun::star::resource::MissingResourceException ); + +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/XStringResourceManager.idl b/offapi/com/sun/star/resource/XStringResourceManager.idl new file mode 100644 index 000000000000..140c6e832a59 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceManager.idl @@ -0,0 +1,317 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_XStringResourceManager_idl__ +#define __com_sun_star_resource_XStringResourceManager_idl__ + +#ifndef __com_sun_star_resource_MissingResourceException_idl__ +#include <com/sun/star/resource/MissingResourceException.idl> +#endif + +#ifndef __com_sun_star_resource_XStringResourceResolver_idl__ +#include <com/sun/star/resource/XStringResourceResolver.idl> +#endif + +#ifndef __com_sun_star_container_ElementExistException_idl__ +#include <com/sun/star/container/ElementExistException.idl> +#endif + +#ifndef __com_sun_star_lang_Locale_idl__ +#include <com/sun/star/lang/Locale.idl> +#endif + +#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ +#include <com/sun/star/lang/IllegalArgumentException.idl> +#endif + +#ifndef __com_sun_star_lang_NoSupportException_idl__ +#include <com/sun/star/lang/NoSupportException.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= +/** + Interface to manage a resource string table containing a set of + strings for different locales. + + The interface is derived from + <type scope="com::sun::star::resource">XStringResourceResolver</type> + that allows to access the string table but not to modify it. This + interface also allows to modify the string table. + + It's designed to be used in the context of creating a string table, + e.g. from a string table editor or from a Dialog Editor designing + localized dialogs. + +*/ +interface XStringResourceManager: com::sun::star::resource::XStringResourceResolver +{ + /** + Returns the resource's read only state + + @return <TRUE/> if the resource is read only, otherwise <FALSE/> + */ + boolean isReadOnly(); + + + /** Sets the locale to be used + + @param aLocale + Specifies the current locale to be used. + + @param FindClosestMatch + <p>If true: If the exact locale that should be set is not available + the method tries to find the closest match. E.g. if en_US is re- + quired but not available, en would be the next choice. Finally + the default locale will be used <TRUE/>. + + <p>If false: If the exact locale that should be set is not available + a <type scope="com::sun::star::lang">IllegalArgumentException</type> + is thrown. + + <p>If false: If the exact locale that should be set is not available + a <type scope="com::sun::star::lang">IllegalArgumentException</type> + is thrown. + */ + void setCurrentLocale + ( + [in] com::sun::star::lang::Locale locale, + [in] boolean FindClosestMatch + ) + raises( com::sun::star::lang::IllegalArgumentException ); + + + /** Sets the default locale to be used + + @param aLocale + Specifies the default locale to be used. + If this locale is not available a + <type scope="com::sun::star::lang">IllegalArgumentException</type> + is thrown. + + @throws <type scope="com::sun::star::lang">NoSupportException</type> + if the resource is read only, see <member>isReadOnly</member> + */ + void setDefaultLocale( [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + + + /** + Associates a String to a Resource ID for the current locale. + If an entry for the Resource ID already exists, the string + associated with it will be overwritten, otherwise a new + entry will be created. + + @param ResourceID + ID to address the string inside the resource for the current locale. + + @param Str + String to be associated with the Resource ID. + + @throws <type scope="com::sun::star::lang">NoSupportException</type> + if the resource is read only, see <member>isReadOnly</member> + */ + void setString + ( + [in] string ResourceID, + [in] string Str + ) + raises( com::sun::star::lang::NoSupportException ); + + + /** + Associates a String to a Resource ID for a specific locale. + If an entry for the Resource ID already exists, the string + associated with it will be overwritten, otherwise a new + entry will be created. + + It's not recommended to use this method to get the best + performance as the implementation may be optimized for + the use of the current locale. + + @param ResourceID + ID to address the string inside the resource. + + @param Str + String to be associated with the Resource ID. + + @param locale + The locale the string should be set for. + The locale has to match exactly with one of the locales provided by + <member>getLocales</member>. A closest match search is not supported. + + @throws <type scope="com::sun::star::lang">NoSupportException</type> + if the resource is read only, see <member>isReadOnly</member> + */ + void setStringForLocale + ( + [in] string ResourceID, + [in] string Str, + [in] com::sun::star::lang::Locale locale + ) + raises( com::sun::star::lang::NoSupportException ); + + + /** + Removes a Resource ID including the corresponding string for + the current locale. + + @param ResourceID + The Resource ID to be removed for the current locale. + + @throws + <type scope="com::sun::star::resource">MissingResourceException</type> + if the Resource ID is not valid. + + @throws + <type scope="com::sun::star::lang">NoSupportException</type> + if the resource is read only, see <member>isReadOnly</member> + */ + void removeId( [in] string ResourceID ) + raises( com::sun::star::resource::MissingResourceException, + com::sun::star::lang::NoSupportException ); + + + /** + Removes a Resource ID including the corresponding string for + s specific locale. + + @param ResourceID + The Resource ID to be removed. + + @param locale + The locale the Resource ID should be removed for. + The locale has to match exactly with one of the locales provided by + <member>getLocales</member>. A closest match search is not supported. + + @throws + <type scope="com::sun::star::resource">MissingResourceException</type> + if the Resource ID is not valid. + + @throws + <type scope="com::sun::star::lang">NoSupportException</type> + if the resource is read only, see <member>isReadOnly</member> + */ + void removeIdForLocale( [in] string ResourceID, [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::resource::MissingResourceException, + com::sun::star::lang::NoSupportException ); + + + /** + Creates a new locale. + + <p>For each existing ResourceID an empty string + will be created. The first locale created will + automatically be the first default locale. + Otherwise strings for all already created IDs + will be copied from the default locale.</p> + + @throws + <type scope="com::sun::star::container">ElementExistException</type> + if the Locale already has been created. + + @throws + <type scope="com::sun::star::lang">IllegalArgumentException</type> + if the Locale is not valid. + + @throws + <type scope="com::sun::star::lang">NoSupportException</type> + if the resource is read only, see <member>isReadOnly</member> + */ + void newLocale( [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::container::ElementExistException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + + + /** + Removes a locale completely including the corresponding + strings for each locale. + + @throws + <type scope="com::sun::star::lang">IllegalArgumentException</type> + if the Locale to be removed is not supported. + + @throws + <type scope="com::sun::star::lang">NoSupportException</type> + if the resource is read only, see <member>isReadOnly</member> + */ + void removeLocale( [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + + + /** + Provides a numeric id that is unique within all Resource IDs + used in the string table. + + This method takes into account all Resource IDs starting with + a decimal number and only evaluates the ID until the first non + digit character is reached. This allows to extend unique IDs + with individual identifiers without breaking the mechanism of + this method. + + Examples: + ID "42" -> numeric id 42 + ID "0foo" -> numeric id 0 + ID "111.MyId.Something.Else" -> numeric id 111 + ID "No Digits" -> not considered for numeric id + + The id returned will be 0 for an empty string table and it will + be reset to 0 if all locales are removed. In all other cases + this method returns the maximum numeric id used so far at the + beginning of a Resource ID incremented by 1. When calling this + method more than once always the same number will be returned + until this number is really used at the beginning of a new + Resource ID passed to <member>setString</member> or + <member>setStringForLocale</member>. + + As the numeric id is guaranteed to be unique for the complete + string table all locales are taken into account. So using this + methods will force the implementation to load all locale data + that may not have been loaded so far. + + @throws + <type scope="com::sun::star::lang">NoSupportException</type> + if the next available id exceeds the range of type long. + So it's not recommended to use own Resource IDs starting + with a decimal number near to the maximum long value if + this methods should be used. + */ + long getUniqueNumericId() + raises( com::sun::star::lang::NoSupportException ); +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/XStringResourcePersistence.idl b/offapi/com/sun/star/resource/XStringResourcePersistence.idl new file mode 100644 index 000000000000..880ff903e8b5 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourcePersistence.idl @@ -0,0 +1,247 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_XStringResourcePersistence_idl__ +#define __com_sun_star_resource_XStringResourcePersistence_idl__ + +#ifndef __com_sun_star_resource_XStringResourceManager_idl__ +#include <com/sun/star/resource/XStringResourceManager.idl> +#endif + +#ifndef __com_sun_star_embed_XStorage_idl__ +#include <com/sun/star/embed/XStorage.idl> +#endif + +#ifndef __com_sun_star_task_XInteractionHandler_idl__ +#include <com/sun/star/task/XInteractionHandler.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= +/** + Interface derived from XStringResourceManager containing + basic persistence functionality limited to operations that + are independend from a associated location or storage. + + @see <type>XStringResourceManager</type>. +*/ +interface XStringResourcePersistence: com::sun::star::resource::XStringResourceManager +{ + /** + Stores all string table data respectively all data modified since + the last call to <member>store</member> to the location or storage + associated with the StringResourceManager. Each locale is stored + in a single file following the format of Java properties files. + + This interface is supported by the services + <type>StringResourceWithLocation</type> and + <type>StringResourceWithStorage</type> + + The StringResourceWithLocation is initialised with an URL + specifying a location used to load data from and store data to, + see <type>StringResourceWithLocation</type>. + + The StringResourceWithStorage is initialised with an in- + stance of <type scope="com::sun::star::embed">XStorage</type> + used to load data from and store data to, + see <type>StringResourceWithStorage</type>. + + If the string table isn't modified (see <member>isModified</member>) + this method does nothing. + + This method can throw all exceptions thrown by the methods of + <type scope="com::sun::star::embed">XStorage</type> respectively + a <type scope="com::sun::star::ucb">CommandAbortedException in + case of a StringResourceWithLocation for all exceptions that are + not handled by a previously specified + <type scope="com::sun::star::task">XInteractionHandler</type>. + The handler to be used for the store operation can be specified + during initialisation of <type>StringResourceWithLocation</type>. + + @throws <type scope="com::sun::star::lang">NoSupportException</type> + if no URL or no valid storage are provided. + */ + void store() + raises( com::sun::star::lang::NoSupportException, + com::sun::star::uno::Exception ); + + + /** + provides the current modify state of the StringResourceManager instance. + + @return + <TRUE/> if the string table has changed since the last call to + <member>store</member> or, if supported + <code>XStringResourceWithStorage::storeAsStorage</code>. + <FALSE/> if the table hasn't changed. + */ + boolean isModified(); + + + /** + Sets the comment stored first in each locale data file. + + This interface method can be used to overwrite the comment used + during initialisation of the services + <type>StringResourceWithLocation</type> or + <type>StringResourceWithStorage</type> + + @param Comment + Comment stored first in each properties file followed by a line + feed character. The line feed character is added automatically + and hasn't to be part of the comment string. The caller is re- + sponsible that the passed string is a valid comment in a Java + properties file, e.g. "# My strings". The string may be empty. + */ + void setComment( [in] string Comment ); + + + /** + Stores all string table data to the provided storage. + + Calling this method does not affect the association with a location + (in case of a <type>StringResourceWithLocation</type> instance) + repectively with a storage (in case of a + <type>StringResourceWithStorage</type> instance). + The modified state isn't affected either. + + This method can be used to make a copy of the current string + table data to a storage. This method can throw all exceptions + thrown by the methods of <type scope="com::sun::star::embed">XStorage</type> + + @param Storage + all string table data will be stored to this storage. + + @param BaseName + Base string for the file names used to store the locale data. + The locale data is stored in Java properties files also following + the corresponding naming sceme. The files will be named like this: + "[BaseName]_[Language]_[Country].properties", + e.g. "MyBaseName_en_US.properties" + If an empty string is passed for BaseName, "strings" will be used + as BaseName. + + @param Comment + Comment stored first in each properties file, + for a detailed description see <member>setComment</member>. + + This method can throw all exceptions thrown by the methods of + <type scope="com::sun::star::embed">XStorage</type> + */ + void storeToStorage( [in] ::com::sun::star::embed::XStorage Storage, + [in] string BaseName, [in] string Comment ) + raises ( com::sun::star::uno::Exception ); + + + /** + Stores all string table data to the location specified by the + passed URL string. + + Calling this method does not affect the association with a location + (in case of a <type>StringResourceWithLocation</type> instance) + repectively with a storage (in case of a + <type>StringResourceWithStorage</type> instance). + The modified state isn't affected either. + + This method can be used to make a copy of the current string + table data to a location. + + @param URL + the location the string table data should be stored to. + + @param BaseName + Base string for the file names used to store the locale data. + The locale data is stored in Java properties files also following + the corresponding naming sceme. The files will be named like this: + "[BaseName]_[Language]_[Country].properties", + e.g. "MyBaseName_en_US.properties" + If an empty string is passed for BaseName, "strings" will be used + as BaseName. + + @param Comment + Comment stored first in each properties file, + for a detailed description see <member>setComment</member>. + + @param Handler + a <type scope="com::sun::star::task">XInteractionHandler</type>. + It will be passed to ucb handle exceptions. Exceptions not processed + by this handler will be passed as com::sun::star::uno::Exception. If + this parameter is null this applies to all exceptions thrown by ucb. + + @see com::sun::star::task::InteractionHandler + */ + void storeToURL( [in] string URL, [in] string BaseName, [in] string Comment, + [in] com::sun::star::task::XInteractionHandler Handler ) + raises( com::sun::star::uno::Exception ); + + + /** + Returns a sequence of byte representing the complete string resource + in a binary format. + + This method is intended to support datatransfer functionality, e.g. provided + by <type scope="com::sun::star::datatransfer">XTransferable</type> and + related interfaces. + + See <member>importBinary</member>). + + @return a sequence of byte representing the string resource. + */ + sequence<byte> exportBinary(); + + + /** + Initializes the string resource with binary data. This method + expects the data format returned by <member>exportBinary</member>. + + All locales and strings previously added to the string resource + will be deleted. So after calling this method the string resource + only contains the locales and strings specified in the binary data. + + This method is intended to support datatransfer functionality, e.g. provided + by <type scope="com::sun::star::datatransfer">XTransferable</type> and + related interfaces. + + See <member>importBinary</member>). + + @throws com::sun::star::lang::IllegalArgumentException + if Data is empty or does not meet the binary format returned by + the current or earlier version of <member>exportBinary</member>). + */ + void importBinary( [in] sequence<byte> Data ) + raises ( com::sun::star::lang::IllegalArgumentException ); + +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/XStringResourceResolver.idl b/offapi/com/sun/star/resource/XStringResourceResolver.idl new file mode 100644 index 000000000000..f386c73abd08 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceResolver.idl @@ -0,0 +1,201 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_XStringResourceResolver_idl__ +#define __com_sun_star_resource_XStringResourceResolver_idl__ + +#ifndef __com_sun_star_resource_MissingResourceException_idl__ +#include <com/sun/star/resource/MissingResourceException.idl> +#endif + +#ifndef __com_sun_star_util_XModifyBroadcaster_idl__ +#include <com/sun/star/util/XModifyBroadcaster.idl> +#endif + +#ifndef __com_sun_star_lang_Locale_idl__ +#include <com/sun/star/lang/Locale.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= +/** + Interface to access strings in a resource. + + The interface is derived from + <type scope="com::sun::star::util">XModifyBroadcaster</type> + + All registered <type scope="com::sun::star::util">XModifyListener</type> + interfaces will be notified if either the current locale changes or if + a string is added, changed or removed. This usually will only happen if + the implementing object also supports the interface + <type scope="com::sun::star::resource">XStringResourceManager</type> + and is used in the design mode of a Dialog or String table editor. + But also changing the locale at runtime can be supported in this way. + +*/ +interface XStringResourceResolver: com::sun::star::util::XModifyBroadcaster +{ + /** + Resolves the passed ResoureID for the current locale. This + locale is set during initalisation of the object implementing + this interface or - in case that also the interface + <type scope="com::sun::star::resource">XStringResourceManager</type> + is supported - by using the <code>XStringResourceManager::setLocale</code> + method. + + @param ResourceID + ID to specify the string inside the resource. + The ID can - but not needs to - be a hierarchical + name like "foo.nothing.invalid". + + @return the localized string for the specified ID + + @throws ::com::sun::star::resource::MissingResourceException + if no entry exists for the given ResourceID + */ + string resolveString( [in] string ResourceID ) + raises( com::sun::star::resource::MissingResourceException ); + + + /** Resolves the passed ResoureID for a specific locale. + + It's not recommended to use this method to get the best + performance as the implementation may be optimized for + the use of the current locale. + + @param ResourceID + ID to specify the string inside the resource. + The ID can - but not needs to - be a hierarchical + name like "foo.nothing.invalid". + + @param locale + The locale the string should be resolved for. + The locale has to match exactly with one of the locales provided by + <member>getLocales</member>. A closest match search is not supported. + + @return the localized string for the specified ID and Locale + + @throws <type scope="com::sun::star::resource">MissingResourceException</type> + if no entry exists for the given ResourceID or locale + */ + string resolveStringForLocale( [in] string ResourceID, [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::resource::MissingResourceException ); + + + /** + Checks if the resource contains an entry for the given ResourceID + and current locale. + + @param ResourceID + ID to specify the string inside the resource. + + @return <TRUE/> if an entry exists, otherwise <FALSE/> + + */ + boolean hasEntryForId( [in] string ResourceID ); + + + /** + Checks if the resource contains an entry for the given ResourceID and locale. + + It's not recommended to use this method to get the best + performance as the implementation may be optimized for + the use of the current locale. + + @param ResourceID + ID to specify the string inside the resource. + + @param locale + The locale the entry should be checked for. + The locale has to match exactly with one of the locales provided by + <member>getLocales</member>. A closest match search is not supported. + + @return <TRUE/> if an entry exists, otherwise <FALSE/> + */ + boolean hasEntryForIdAndLocale( [in] string ResourceID, [in] com::sun::star::lang::Locale locale ); + + + /** + Returns a sequence of all valid Resource IDs for the current locale + + @return a sequence of all valid Resource IDs + */ + sequence<string> getResourceIDs(); + + + /** + Returns a sequence of all valid Resource IDs for a specific locale + + It's not recommended to use this method to get the best + performance as the implementation may be optimized for + the use of the current locale. + + @param locale + The locale the ResourceIDs should be returned for. + The locale has to match exactly with one of the locales provided by + <member>getLocales</member>. A closest match search is not supported. + + @return a sequence of all valid Resource IDs + */ + sequence<string> getResourceIDsForLocale( [in] com::sun::star::lang::Locale locale ); + + + /** Returns the current locale specified in the accessed resource. + + If no locale is available, the returned Locale structure + only contains empty strings. + + @returns the used locale + */ + com::sun::star::lang::Locale getCurrentLocale(); + + + /** Returns the default locale of the accessed resource. In many + cases this will be the locale of the Office initially used + to create the resource. + + @return the used locale + */ + com::sun::star::lang::Locale getDefaultLocale(); + + + /** + Returns a sequence of all supported locales + + @return a sequence of all supported locales + */ + sequence<com::sun::star::lang::Locale> getLocales(); +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/XStringResourceSupplier.idl b/offapi/com/sun/star/resource/XStringResourceSupplier.idl new file mode 100644 index 000000000000..1c56010b8ca2 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceSupplier.idl @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_resource_XStringResourceSupplier_idl__ +#define __com_sun_star_resource_XStringResourceSupplier_idl__ + +#ifndef __com_sun_star_resource_XStringResourceResolver_idl__ +#include <com/sun/star/resource/XStringResourceResolver.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= + +/** + Provides access to a string resource represented by a + <type scope="com::sun::star::resource">XStringResourceResolver</type>. + */ +interface XStringResourceSupplier: com::sun::star::uno::XInterface +{ + //------------------------------------------------------------------------- + + /** + Provides access to a string resource. + Depending on the context the returned object may also support + <type scope="com::sun::star::resource">XStringResourceManager</type> or + <type scope="com::sun::star::resource">XStringResourcePersistence</type> or + <type scope="com::sun::star::resource">XStringResourceWithStorage</type> + + @returns an interface + <type scope="com::sun::star::resource">XStringResourceResolver</type> + */ + com::sun::star::resource::XStringResourceResolver getStringResource(); +}; + +//============================================================================= + +}; }; }; }; + +/*============================================================================= + +=============================================================================*/ +#endif diff --git a/offapi/com/sun/star/resource/XStringResourceWithLocation.idl b/offapi/com/sun/star/resource/XStringResourceWithLocation.idl new file mode 100644 index 000000000000..642187897ed3 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceWithLocation.idl @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_XStringResourceWithLocation_idl__ +#define __com_sun_star_resource_XStringResourceWithLocation_idl__ + +#ifndef __com_sun_star_resource_XStringResourcePersistence_idl__ +#include <com/sun/star/resource/XStringResourcePersistence.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= +/** + Extends <type>XStringResourcePersistence</type> by methods to handle an + associated location. + + @see <type>XStringResourcePersistence</type>. +*/ +interface XStringResourceWithLocation: com::sun::star::resource::XStringResourcePersistence +{ + /** + Stores all string table data to a location and associates this location + to this instance as if <member>setLocation</member> was called with this + location. The modified state will be unmodified after the call. + + @param URL + the location the string table data should be stored to. + */ + void storeAsURL( [in] string URL ) + raises( com::sun::star::uno::Exception ); + + + /** + Associates a location to the StringResourceWithStorage instance + which is used on subsequent calls of <member>store</member>. + + @param URL + the location to be associated to the StringResourceManager + + <p> + This call has to be used carefully as it removes the location + previously connected to the StringResourceWithStorage. It may + force the implementation to reload data from the previous + location before releasing it. The StringResourceManager will + be modified after calling this method as the data isn't stored + to the new location yet. <member>storeAsURL</member> should + be prefered as it directly stores the data to the new location + and afterwards this location is in sync with the resource data. + </p> + + @throws <type scope="com::sun::star::lang">IllegalArgumentException</type> + if an empty string is passed as URL + */ + void setURL( [in] string URL ) + raises( ::com::sun::star::lang::IllegalArgumentException ); +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/XStringResourceWithStorage.idl b/offapi/com/sun/star/resource/XStringResourceWithStorage.idl new file mode 100644 index 000000000000..b4e5dd803efa --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceWithStorage.idl @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_resource_XStringResourceWithStorage_idl__ +#define __com_sun_star_resource_XStringResourceWithStorage_idl__ + +#ifndef __com_sun_star_resource_XStringResourcePersistence_idl__ +#include <com/sun/star/resource/XStringResourcePersistence.idl> +#endif + + +//============================================================================= + +module com { module sun { module star { module resource { + +//============================================================================= +/** + Extends <type>XStringResourcePersistence</type> by methods to handle an + associated <type scope="com::sun::star::embed">XStorage</type> instance. + + @see <type>XStringResourcePersistence</type>. +*/ +interface XStringResourceWithStorage: com::sun::star::resource::XStringResourcePersistence +{ + /** + Stores all string table data to a storage and associates this storage + to this instance as if <member>setStorage</member> was called with + this storage. The modified state will be unmodified after the call. + + This method can throw all exceptions thrown by the methods of + <type scope="com::sun::star::embed">XStorage</type> + */ + void storeAsStorage( [in] ::com::sun::star::embed::XStorage Storage ) + raises( com::sun::star::uno::Exception ); + + + /** + Associates a storage to the StringResourceWithStorage instance + which is used on subsequent calls of <member>store</member>. + + @param Storage + the storage to be associated to the StringResourceManager + + <p> + This call has to be used carefully as it removes the storage + previously connected to the StringResourceWithStorage. It may + force the implementation to reload data from the previous storage + before releasing it. The StringResourceManager will be modified + after calling this method as the data isn't stored to the new + storage yet. <member>storeAsStorage</member> should be prefered + as it directly stores the data to the new storage and afterwards + this storage is in sync with the resource data. + </p> + + @throws <type scope="com::sun::star::lang">IllegalArgumentException</type> + if a null interface is passed as Storage + */ + void setStorage( [in] ::com::sun::star::embed::XStorage Storage ) + raises( ::com::sun::star::lang::IllegalArgumentException ); +}; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/resource/makefile.mk b/offapi/com/sun/star/resource/makefile.mk new file mode 100644 index 000000000000..b255b2f2efb3 --- /dev/null +++ b/offapi/com/sun/star/resource/makefile.mk @@ -0,0 +1,59 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. + +PRJNAME=offapi + +TARGET=cssresource +PACKAGE=com$/sun$/star$/resource + +# --- Settings ----------------------------------------------------- +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# ------------------------------------------------------------------------ + +IDLFILES=\ + MissingResourceException.idl\ + OfficeResourceLoader.idl\ + XLocale.idl\ + XResourceBundle.idl\ + XResourceBundleLoader.idl\ + XStringResourceResolver.idl\ + XStringResourceManager.idl\ + XStringResourcePersistence.idl\ + XStringResourceWithStorage.idl\ + XStringResourceWithLocation.idl\ + XStringResourceSupplier.idl\ + StringResource.idl\ + StringResourceWithLocation.idl\ + StringResourceWithStorage.idl\ + +# ------------------------------------------------------------------ + +.INCLUDE : target.mk +.INCLUDE : $(PRJ)$/util$/target.pmk |