diff options
Diffstat (limited to 'offapi/com/sun/star/resource')
11 files changed, 1376 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 000000000..9650d57ab --- /dev/null +++ b/offapi/com/sun/star/resource/MissingResourceException.idl @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_resource_MissingResourceException_idl__ +#define __com_sun_star_resource_MissingResourceException_idl__ + +#include <com/sun/star/uno/RuntimeException.idl> + + + +module com { module sun { module star { module resource { + + +/** is used to signal that a resource is missing. + + @see XStringResourceResolver + */ +published exception MissingResourceException: com::sun::star::uno::RuntimeException +{ +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/StringResource.idl b/offapi/com/sun/star/resource/StringResource.idl new file mode 100644 index 000000000..f60cf1a3c --- /dev/null +++ b/offapi/com/sun/star/resource/StringResource.idl @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_resource_StringResource_idl__ +#define __com_sun_star_resource_StringResource_idl__ + +#include <com/sun/star/resource/XStringResourcePersistence.idl> + + + +module com { module sun { module star { module resource { + + +/** specifies a service providing access to a resource string table implementing the + com::sun::star::awt::XDialog interface. + */ +service StringResource : com::sun::star::resource::XStringResourcePersistence; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/StringResourceWithLocation.idl b/offapi/com/sun/star/resource/StringResourceWithLocation.idl new file mode 100644 index 000000000..a3eced0d4 --- /dev/null +++ b/offapi/com/sun/star/resource/StringResourceWithLocation.idl @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_resource_StringResourceWithLocation_idl__ +#define __com_sun_star_resource_StringResourceWithLocation_idl__ + +#include <com/sun/star/resource/XStringResourceWithLocation.idl> + + + +module com { module sun { module star { module resource { + + +/** specifies a service providing access to a resource string table implementing the + com::sun::star::resource::XStringResourceWithLocation 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 scheme. 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 + responsible 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 com::sun::star::task::XInteractionHandler + to be passed to ucb. This may be a null interface. + + @throws com::sun::star::lang::IllegalArgumentException + 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/StringResourceWithStorage.idl b/offapi/com/sun/star/resource/StringResourceWithStorage.idl new file mode 100644 index 000000000..e99a70409 --- /dev/null +++ b/offapi/com/sun/star/resource/StringResourceWithStorage.idl @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_resource_StringResourceWithStorage_idl__ +#define __com_sun_star_resource_StringResourceWithStorage_idl__ + +#include <com/sun/star/resource/XStringResourceWithStorage.idl> + + + +module com { module sun { module star { module resource { + + +/** specifies a service providing access to a resource string table implementing the + com::sun::star::resource::XStringResourceWithStorage 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 scheme. 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 + responsible that the passed string is a valid comment in a Java + properties file, e.g. "# My strings". The string may be empty. + + @throws com::sun::star::lang::IllegalArgumentException + 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/XLocale.idl b/offapi/com/sun/star/resource/XLocale.idl new file mode 100644 index 000000000..562307d82 --- /dev/null +++ b/offapi/com/sun/star/resource/XLocale.idl @@ -0,0 +1,208 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_resource_XLocale_idl__ +#define __com_sun_star_resource_XLocale_idl__ + +#include <com/sun/star/uno/XInterface.idl> + +#include <com/sun/star/lang/Locale.idl> + +#include <com/sun/star/resource/MissingResourceException.idl> + + + + module com { module sun { module star { module resource { + +/** offers some operations on com::sun::star::lang::Locale + structures. + @see Locale + */ +published interface XLocale: com::sun::star::uno::XInterface +{ + /** 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 ); + + /** 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(); + + /** 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 ); + + /** @returns + a sequence of all locales which are available in the system. + */ + sequence<com::sun::star::lang::Locale> getAvailableLocales(); + + /** @returns + a sequence of all ISO country codes known to the component. + */ + sequence<string> getISOCountries(); + + /** @returns + a sequence of all ISO language codes known to the component. + */ + sequence<string> getISOLanguages(); + + /** @returns + a sequence for language codes which are valid within the + given country. + */ + sequence<string> getLanguagesForCountry( [in] string country ); + + /** @returns + the ISO language code for the specified locale. + */ + string getISO3Language( [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::resource::MissingResourceException ); + + /** @returns + the ISO country code for the specified locale. + */ + string getISO3Country( [in] com::sun::star::lang::Locale locale ) + raises( com::sun::star::resource::MissingResourceException ); + + /** @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 ); + + + /** @return + language code for display of field to user. If the localized + name is not found, returns the ISO codes. + + @param locale the locale. + + @param inLocale + specifies the desired user language. + */ + string getDisplayLanguage( [in] com::sun::star::lang::Locale locale, + [in] com::sun::star::lang::Locale inLocale ); + + /** @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 ); + + /** @returns + country code for display of field to user. If the localized + name is not found, returns the ISO codes. + + @param locale the locale. + + @param inLocale + specifies the desired user country. + */ + string getDisplayCountry( [in] com::sun::star::lang::Locale locale, + [in] com::sun::star::lang::Locale inLocale ); + + /** @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 ); + + /** @returns + variant code for display of field to user. If the localized + name is not found, returns the ISO codes. + + @param locale the locale. + + @param inLocale + specifies the desired user variant. + */ + string getDisplayVariant( [in] com::sun::star::lang::Locale locale, + [in] com::sun::star::lang::Locale inLocale ); + + /** @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. + + @param locale the locale. + */ + string getDisplayName_Default( [in] com::sun::star::lang::Locale locale ); + + /** @returns + a string to display the entire locale to user. If the localized + name is not found, uses the ISO codes. + + @param locale the locale. + + @param inLocale + specifies the desired user locale. + */ + string getDisplayName( [in] com::sun::star::lang::Locale locale, + [in] com::sun::star::lang::Locale inLocale ); + + /** @returns + `TRUE` if the com::sun::star::lang::Locale <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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/XStringResourceManager.idl b/offapi/com/sun/star/resource/XStringResourceManager.idl new file mode 100644 index 000000000..c602c7d7b --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceManager.idl @@ -0,0 +1,291 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_resource_XStringResourceManager_idl__ +#define __com_sun_star_resource_XStringResourceManager_idl__ + +#include <com/sun/star/resource/MissingResourceException.idl> +#include <com/sun/star/resource/XStringResourceResolver.idl> +#include <com/sun/star/container/ElementExistException.idl> +#include <com/sun/star/lang/Locale.idl> +#include <com/sun/star/lang/IllegalArgumentException.idl> +#include <com/sun/star/lang/NoSupportException.idl> + + + +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 + com::sun::star::resource::XStringResourceResolver + 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 Locale + 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 com::sun::star::lang::IllegalArgumentException + is thrown. + + <p>If false: If the exact locale that should be set is not available + a com::sun::star::lang::IllegalArgumentException + 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 Locale + Specifies the default locale to be used. + If this locale is not available a + com::sun::star::lang::IllegalArgumentException + is thrown. + + @throws com::sun::star::lang::NoSupportException + if the resource is read only, see isReadOnly() + */ + 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 com::sun::star::lang::NoSupportException + if the resource is read only, see isReadOnly() + */ + 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 + getLocales(). A closest match search is not supported. + + @throws com::sun::star::lang::NoSupportException + if the resource is read only, see isReadOnly() + */ + 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 + com::sun::star::resource::MissingResourceException + if the Resource ID is not valid. + + @throws + com::sun::star::lang::NoSupportException + if the resource is read only, see isReadOnly() + */ + 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 + getLocales(). A closest match search is not supported. + + @throws + com::sun::star::resource::MissingResourceException + if the Resource ID is not valid. + + @throws + com::sun::star::lang::NoSupportException + if the resource is read only, see isReadOnly() + */ + 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 + com::sun::star::container::ElementExistException + if the Locale already has been created. + + @throws + com::sun::star::lang::IllegalArgumentException + if the Locale is not valid. + + @throws + com::sun::star::lang::NoSupportException + if the resource is read only, see isReadOnly() + */ + 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 + com::sun::star::lang::IllegalArgumentException + if the Locale to be removed is not supported. + + @throws + com::sun::star::lang::NoSupportException + if the resource is read only, see isReadOnly() + */ + 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 setString() or + setStringForLocale(). + + 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 + com::sun::star::lang::NoSupportException + 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/XStringResourcePersistence.idl b/offapi/com/sun/star/resource/XStringResourcePersistence.idl new file mode 100644 index 000000000..496ec3456 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourcePersistence.idl @@ -0,0 +1,230 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_resource_XStringResourcePersistence_idl__ +#define __com_sun_star_resource_XStringResourcePersistence_idl__ + +#include <com/sun/star/resource/XStringResourceManager.idl> +#include <com/sun/star/embed/XStorage.idl> +#include <com/sun/star/task/XInteractionHandler.idl> + + + +module com { module sun { module star { module resource { + +/** + Interface derived from XStringResourceManager containing + basic persistence functionality limited to operations that + are independent from an associated location or storage. + + @see XStringResourceManager. +*/ +interface XStringResourcePersistence: com::sun::star::resource::XStringResourceManager +{ + /** + Stores all string table data respectively all data modified since + the last call to store() 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 + StringResourceWithLocation and + StringResourceWithStorage + + The StringResourceWithLocation is initialized with a URL + specifying a location used to load data from and store data to, + see StringResourceWithLocation. + + The StringResourceWithStorage is initialized with an instance + of com::sun::star::embed::XStorage + used to load data from and store data to, + see StringResourceWithStorage. + + If the string table isn't modified (see isModified()) + this method does nothing. + + This method can throw all exceptions thrown by the methods of + com::sun::star::embed::XStorage respectively + a com::sun::star::ucb::CommandAbortedException in + case of a StringResourceWithLocation for all exceptions that are + not handled by a previously specified + com::sun::star::task::XInteractionHandler. + The handler to be used for the store operation can be specified + during initialization of StringResourceWithLocation. + + @throws com::sun::star::lang::NoSupportException + 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 + store() 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 initialization of the services + StringResourceWithLocation or + StringResourceWithStorage + + @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 + responsible 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 StringResourceWithLocation instance) + respectively with a storage (in case of a + StringResourceWithStorage 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 com::sun::star::embed::XStorage + + @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 scheme. 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 setComment(). + + This method can throw all exceptions thrown by the methods of + com::sun::star::embed::XStorage + */ + 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 StringResourceWithLocation instance) + respectively with a storage (in case of a + StringResourceWithStorage 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 scheme. 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 setComment(). + + @param Handler + a com::sun::star::task::XInteractionHandler. + 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 com::sun::star::datatransfer::XTransferable and + related interfaces. + + See importBinary()). + + @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 exportBinary(). + + 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 com::sun::star::datatransfer::XTransferable and + related interfaces. + + See importBinary()). + + @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 exportBinary()). + */ + void importBinary( [in] sequence<byte> Data ) + raises ( com::sun::star::lang::IllegalArgumentException ); + +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/XStringResourceResolver.idl b/offapi/com/sun/star/resource/XStringResourceResolver.idl new file mode 100644 index 000000000..f56605987 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceResolver.idl @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_resource_XStringResourceResolver_idl__ +#define __com_sun_star_resource_XStringResourceResolver_idl__ + +#include <com/sun/star/resource/MissingResourceException.idl> +#include <com/sun/star/util/XModifyBroadcaster.idl> +#include <com/sun/star/lang/Locale.idl> + + + +module com { module sun { module star { module resource { + +/** + Interface to access strings in a resource. + + The interface is derived from + com::sun::star::util::XModifyBroadcaster + + All registered com::sun::star::util::XModifyListener + 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 + com::sun::star::resource::XStringResourceManager + 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 ResourceID for the current locale. This + locale is set during initialization of the object implementing + this interface or - in case that also the interface + com::sun::star::resource::XStringResourceManager + 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 ResourceID 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 + getLocales(). A closest match search is not supported. + + @return the localized string for the specified ID and Locale + + @throws com::sun::star::resource::MissingResourceException + 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 + getLocales(). 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 + getLocales(). 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/XStringResourceSupplier.idl b/offapi/com/sun/star/resource/XStringResourceSupplier.idl new file mode 100644 index 000000000..5889dee83 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceSupplier.idl @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_resource_XStringResourceSupplier_idl__ +#define __com_sun_star_resource_XStringResourceSupplier_idl__ + +#include <com/sun/star/resource/XStringResourceResolver.idl> + + + +module com { module sun { module star { module resource { + + +/** + Provides access to a string resource represented by a + com::sun::star::resource::XStringResourceResolver. + */ +interface XStringResourceSupplier: com::sun::star::uno::XInterface +{ + + /** + Provides access to a string resource. + Depending on the context the returned object may also support + com::sun::star::resource::XStringResourceManager or + com::sun::star::resource::XStringResourcePersistence or + com::sun::star::resource::XStringResourceWithStorage + + @returns an interface + com::sun::star::resource::XStringResourceResolver + */ + com::sun::star::resource::XStringResourceResolver getStringResource(); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/XStringResourceWithLocation.idl b/offapi/com/sun/star/resource/XStringResourceWithLocation.idl new file mode 100644 index 000000000..3a5a215ba --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceWithLocation.idl @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_resource_XStringResourceWithLocation_idl__ +#define __com_sun_star_resource_XStringResourceWithLocation_idl__ + +#include <com/sun/star/resource/XStringResourcePersistence.idl> + + +module com { module sun { module star { module resource { + +/** + Extends XStringResourcePersistence by methods to handle an + associated location. + + @see XStringResourcePersistence. +*/ +interface XStringResourceWithLocation: com::sun::star::resource::XStringResourcePersistence +{ + /** + Stores all string table data to a location and associates this location + to this instance as if setLocation() 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 store(). + + @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. storeAsURL() should + be preferred as it directly stores the data to the new location + and afterwards this location is in sync with the resource data. + </p> + + @throws com::sun::star::lang::IllegalArgumentException + if an empty string is passed as URL + + @throws com::sun::star::lang::NoSupportException + if the location is readonly + */ + void setURL( [in] string URL ) + raises( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::NoSupportException ); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/resource/XStringResourceWithStorage.idl b/offapi/com/sun/star/resource/XStringResourceWithStorage.idl new file mode 100644 index 000000000..41f1f2c31 --- /dev/null +++ b/offapi/com/sun/star/resource/XStringResourceWithStorage.idl @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_resource_XStringResourceWithStorage_idl__ +#define __com_sun_star_resource_XStringResourceWithStorage_idl__ + +#include <com/sun/star/resource/XStringResourcePersistence.idl> + + + +module com { module sun { module star { module resource { + +/** + Extends XStringResourcePersistence by methods to handle an + associated com::sun::star::embed::XStorage instance. + + @see XStringResourcePersistence. +*/ +interface XStringResourceWithStorage: com::sun::star::resource::XStringResourcePersistence +{ + /** + Stores all string table data to a storage and associates this storage + to this instance as if setStorage() 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 + com::sun::star::embed::XStorage + */ + 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 store(). + + @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. storeAsStorage() should be preferred + as it directly stores the data to the new storage and afterwards + this storage is in sync with the resource data. + </p> + + @throws com::sun::star::lang::IllegalArgumentException + if a null interface is passed as Storage + */ + void setStorage( [in] ::com::sun::star::embed::XStorage Storage ) + raises( ::com::sun::star::lang::IllegalArgumentException ); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |