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