1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 module com
{ module sun
{ module star
{ module resource
{
25 Interface to access strings in a resource.
27 The interface is derived from
28 com::sun::star::util::XModifyBroadcaster
30 All registered com::sun::star::util::XModifyListener
31 interfaces will be notified if either the current locale changes or if
32 a string is added, changed or removed. This usually will only happen if
33 the implementing object also supports the interface
34 com::sun::star::resource::XStringResourceManager
35 and is used in the design mode of a Dialog or String table editor.
36 But also changing the locale at runtime can be supported in this way.
39 interface XStringResourceResolver
: com
::sun
::star
::util
::XModifyBroadcaster
42 Resolves the passed ResourceID for the current locale. This
43 locale is set during initialization of the object implementing
44 this interface or - in case that also the interface
45 com::sun::star::resource::XStringResourceManager
46 is supported - by using the <code>XStringResourceManager::setLocale</code>
50 ID to specify the string inside the resource.
51 The ID can - but not needs to - be a hierarchical
52 name like "foo.nothing.invalid".
54 @return the localized string for the specified ID
56 @throws ::com::sun::star::resource::MissingResourceException
57 if no entry exists for the given ResourceID
59 string resolveString
( [in] string ResourceID
)
60 raises
( com
::sun
::star
::resource
::MissingResourceException
);
63 /** Resolves the passed ResourceID for a specific locale.
65 It's not recommended to use this method to get the best
66 performance as the implementation may be optimized for
67 the use of the current locale.
70 ID to specify the string inside the resource.
71 The ID can - but not needs to - be a hierarchical
72 name like "foo.nothing.invalid".
75 The locale the string should be resolved for.
76 The locale has to match exactly with one of the locales provided by
77 getLocales(). A closest match search is not supported.
79 @return the localized string for the specified ID and Locale
81 @throws com::sun::star::resource::MissingResourceException
82 if no entry exists for the given ResourceID or locale
84 string resolveStringForLocale
( [in] string ResourceID
, [in] com
::sun
::star
::lang
::Locale locale
)
85 raises
( com
::sun
::star
::resource
::MissingResourceException
);
89 Checks if the resource contains an entry for the given ResourceID
93 ID to specify the string inside the resource.
95 @return `TRUE` if an entry exists, otherwise `FALSE`
98 boolean hasEntryForId
( [in] string ResourceID
);
102 Checks if the resource contains an entry for the given ResourceID and locale.
104 It's not recommended to use this method to get the best
105 performance as the implementation may be optimized for
106 the use of the current locale.
109 ID to specify the string inside the resource.
112 The locale the entry should be checked for.
113 The locale has to match exactly with one of the locales provided by
114 getLocales(). A closest match search is not supported.
116 @return `TRUE` if an entry exists, otherwise `FALSE`
118 boolean hasEntryForIdAndLocale
( [in] string ResourceID
, [in] com
::sun
::star
::lang
::Locale locale
);
122 Returns a sequence of all valid Resource IDs for the current locale
124 @return a sequence of all valid Resource IDs
126 sequence
<string> getResourceIDs
();
130 Returns a sequence of all valid Resource IDs for a specific locale
132 It's not recommended to use this method to get the best
133 performance as the implementation may be optimized for
134 the use of the current locale.
137 The locale the ResourceIDs should be returned for.
138 The locale has to match exactly with one of the locales provided by
139 getLocales(). A closest match search is not supported.
141 @return a sequence of all valid Resource IDs
143 sequence
<string> getResourceIDsForLocale
( [in] com
::sun
::star
::lang
::Locale locale
);
146 /** Returns the current locale specified in the accessed resource.
148 If no locale is available, the returned Locale structure
149 only contains empty strings.
151 @returns the used locale
153 com
::sun
::star
::lang
::Locale getCurrentLocale
();
156 /** Returns the default locale of the accessed resource. In many
157 cases this will be the locale of the Office initially used
158 to create the resource.
160 @return the used locale
162 com
::sun
::star
::lang
::Locale getDefaultLocale
();
166 Returns a sequence of all supported locales
168 @return a sequence of all supported locales
170 sequence
<com
::sun
::star
::lang
::Locale
> getLocales
();
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */