1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_resource_XStringResourcePersistence_idl__
24#define __com_sun_star_resource_XStringResourcePersistence_idl__
25
26#ifndef __com_sun_star_resource_XStringResourceManager_idl__
27#include <com/sun/star/resource/XStringResourceManager.idl>
28#endif
29
30#ifndef __com_sun_star_embed_XStorage_idl__
31#include <com/sun/star/embed/XStorage.idl>
32#endif
33
34#ifndef __com_sun_star_task_XInteractionHandler_idl__
35#include <com/sun/star/task/XInteractionHandler.idl>
36#endif
37
38
39//=============================================================================
40
41module com { module sun { module star { module resource {
42
43//=============================================================================
44/**
45	Interface derived from XStringResourceManager containing
46	basic persistence functionality limited to operations that
47	are independend from a associated location or storage.
48
49	@see <type>XStringResourceManager</type>.
50*/
51published interface XStringResourcePersistence: com::sun::star::resource::XStringResourceManager
52{
53    /**
54		Stores all string table data respectively all data modified since
55		the last call to <member>store</member> to the location or storage
56		associated with the StringResourceManager. Each locale is stored
57		in a single file following the format of Java properties files.
58
59		This interface is supported by the services
60		<type>StringResourceWithLocation</type> and
61		<type>StringResourceWithStorage</type>
62
63		The StringResourceWithLocation is initialised with an URL
64		specifying a location used to load data from and store data to,
65		see <type>StringResourceWithLocation</type>.
66
67		The StringResourceWithStorage is initialised with an in-
68		stance of <type scope="com::sun::star::embed">XStorage</type>
69		used to load data from and store data to,
70		see <type>StringResourceWithStorage</type>.
71
72		If the string table isn't modified (see <member>isModified</member>)
73		this method does nothing.
74
75		This method can throw all exceptions thrown by the methods of
76		<type scope="com::sun::star::embed">XStorage</type> respectively
77		a <type scope="com::sun::star::ucb">CommandAbortedException in
78		case of a StringResourceWithLocation for all exceptions that are
79		not handled by a previously specified
80		<type scope="com::sun::star::task">XInteractionHandler</type>.
81		The handler to be used for the store operation can be specified
82		during initialisation of <type>StringResourceWithLocation</type>.
83
84		@throws <type scope="com::sun::star::lang">NoSupportException</type>
85			if no URL or no valid storage are provided.
86    */
87    void store()
88		raises( com::sun::star::lang::NoSupportException,
89				com::sun::star::uno::Exception );
90
91
92     /**
93		provides the current modify state of the StringResourceManager instance.
94
95        @return
96            <TRUE/> if the string table has changed since the last call to
97            <member>store</member> or, if supported
98			<code>XStringResourceWithStorage::storeAsStorage</code>.
99			<FALSE/> if the table hasn't changed.
100    */
101    boolean isModified();
102
103
104    /**
105		Sets the comment stored first in each locale data file.
106
107		This interface method can be used to overwrite the comment used
108		during initialisation of the services
109		<type>StringResourceWithLocation</type> or
110		<type>StringResourceWithStorage</type>
111
112        @param Comment
113            Comment stored first in each properties file followed by a line
114			feed character. The line feed character is added automatically
115			and hasn't to be part of the comment string. The caller is re-
116			sponsible that the passed string is a valid comment in a Java
117			properties file, e.g. "# My strings". The string may be empty.
118    */
119    void setComment( [in] string Comment );
120
121
122    /**
123		Stores all string table data to the provided storage.
124
125		Calling this method does not affect the association with a location
126		(in case of a <type>StringResourceWithLocation</type> instance)
127		repectively with a storage (in case of a
128		<type>StringResourceWithStorage</type> instance).
129		The modified state isn't affected either.
130
131		This method can be used to make a copy of the current string
132		table data to a storage. This method can throw all exceptions
133		thrown by the methods of <type scope="com::sun::star::embed">XStorage</type>
134
135        @param Storage
136            all string table data will be stored to this storage.
137
138        @param BaseName
139            Base string for the file names used to store the locale data.
140			The locale data is stored in Java properties files also following
141			the corresponding naming sceme. The files will be named like this:
142			"[BaseName]_[Language]_[Country].properties",
143			e.g. "MyBaseName_en_US.properties"
144			If an empty string is passed for BaseName, "strings" will be used
145			as BaseName.
146
147        @param Comment
148            Comment stored first in each properties file,
149			for a detailed description see <member>setComment</member>.
150
151		This method can throw all exceptions thrown by the methods of
152		<type scope="com::sun::star::embed">XStorage</type>
153    */
154    void storeToStorage( [in] ::com::sun::star::embed::XStorage Storage,
155		[in] string BaseName, [in] string Comment )
156			raises ( com::sun::star::uno::Exception );
157
158
159    /**
160		Stores all string table data to the location specified by the
161		passed URL string.
162
163		Calling this method does not affect the association with a location
164		(in case of a <type>StringResourceWithLocation</type> instance)
165		repectively with a storage (in case of a
166		<type>StringResourceWithStorage</type> instance).
167		The modified state isn't affected either.
168
169		This method can be used to make a copy of the current string
170		table data to a location.
171
172        @param URL
173            the location the string table data should be stored to.
174
175        @param BaseName
176            Base string for the file names used to store the locale data.
177			The locale data is stored in Java properties files also following
178			the corresponding naming sceme. The files will be named like this:
179			"[BaseName]_[Language]_[Country].properties",
180			e.g. "MyBaseName_en_US.properties"
181			If an empty string is passed for BaseName, "strings" will be used
182			as BaseName.
183
184        @param Comment
185            Comment stored first in each properties file,
186			for a detailed description see <member>setComment</member>.
187
188        @param Handler
189			a <type scope="com::sun::star::task">XInteractionHandler</type>.
190			It will be passed to ucb handle exceptions. Exceptions not processed
191			by this handler will be passed as com::sun::star::uno::Exception. If
192			this parameter is null this applies to all exceptions thrown by ucb.
193
194	    @see com::sun::star::task::InteractionHandler
195	*/
196	void storeToURL( [in] string URL, [in] string BaseName, [in] string Comment,
197		[in] com::sun::star::task::XInteractionHandler Handler )
198			raises( com::sun::star::uno::Exception );
199
200
201	/**
202		Returns a sequence of byte representing the complete string resource
203		in a binary format.
204
205		This method is intended to support datatransfer functionality, e.g. provided
206		by <type scope="com::sun::star::datatransfer">XTransferable</type> and
207		related interfaces.
208
209		See <member>importBinary</member>).
210
211		@return  a sequence of byte representing the string resource.
212	*/
213	sequence<byte> exportBinary();
214
215
216	/**
217		Initializes the string resource with binary data. This method
218		expects the data format returned by <member>exportBinary</member>.
219
220		All locales and strings previously added to the string resource
221		will be deleted. So after calling this method the string resource
222		only contains the locales and strings specified in the binary data.
223
224		This method is intended to support datatransfer functionality, e.g. provided
225		by <type scope="com::sun::star::datatransfer">XTransferable</type> and
226		related interfaces.
227
228		See <member>importBinary</member>).
229
230		@throws com::sun::star::lang::IllegalArgumentException
231		if Data is empty or does not meet the binary format returned by
232		the current or earlier version of <member>exportBinary</member>).
233	*/
234	void importBinary( [in] sequence<byte> Data )
235		raises ( com::sun::star::lang::IllegalArgumentException );
236
237};
238
239//=============================================================================
240
241}; }; }; };
242
243#endif
244