1*76b6b121SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*76b6b121SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*76b6b121SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*76b6b121SAndrew Rist  * distributed with this work for additional information
6*76b6b121SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*76b6b121SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*76b6b121SAndrew Rist  * "License"); you may not use this file except in compliance
9*76b6b121SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*76b6b121SAndrew Rist  *
11*76b6b121SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*76b6b121SAndrew Rist  *
13*76b6b121SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*76b6b121SAndrew Rist  * software distributed under the License is distributed on an
15*76b6b121SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*76b6b121SAndrew Rist  * KIND, either express or implied.  See the License for the
17*76b6b121SAndrew Rist  * specific language governing permissions and limitations
18*76b6b121SAndrew Rist  * under the License.
19*76b6b121SAndrew Rist  *
20*76b6b121SAndrew Rist  *************************************************************/
21*76b6b121SAndrew Rist 
22*76b6b121SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package complex.imageManager;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.embed.XStorage;
27cdf0e10cSrcweir import com.sun.star.ui.XUIConfigurationPersistence;
28cdf0e10cSrcweir import lib.TestParameters;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir public class _XUIConfigurationPersistence {
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 
35cdf0e10cSrcweir     TestParameters tEnv = null;
36cdf0e10cSrcweir     public XUIConfigurationPersistence oObj;
37cdf0e10cSrcweir     private XStorage xStore = null;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir     public _XUIConfigurationPersistence(TestParameters tEnv, XUIConfigurationPersistence oObj) {
40cdf0e10cSrcweir 
41cdf0e10cSrcweir         this.tEnv = tEnv;
42cdf0e10cSrcweir         this.oObj = oObj;
43cdf0e10cSrcweir     }
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     public void before() {
46cdf0e10cSrcweir         xStore = (XStorage)tEnv.get("XUIConfigurationStorage.Storage");
47cdf0e10cSrcweir     }
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     public boolean _reload() {
50cdf0e10cSrcweir         try {
51cdf0e10cSrcweir             oObj.reload();
52cdf0e10cSrcweir         }
53cdf0e10cSrcweir         catch(com.sun.star.uno.Exception e) {
54cdf0e10cSrcweir 
55cdf0e10cSrcweir         }
56cdf0e10cSrcweir         return true;
57cdf0e10cSrcweir     }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     public boolean _store() {
60cdf0e10cSrcweir         try {
61cdf0e10cSrcweir             oObj.store();
62cdf0e10cSrcweir         }
63cdf0e10cSrcweir         catch(com.sun.star.uno.Exception e) {
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         }
66cdf0e10cSrcweir         return true;
67cdf0e10cSrcweir     }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     public boolean _storeToStorage() {
70cdf0e10cSrcweir         boolean result = true;
71cdf0e10cSrcweir         try {
72cdf0e10cSrcweir             oObj.storeToStorage(xStore);
73cdf0e10cSrcweir         }
74cdf0e10cSrcweir         catch(com.sun.star.uno.Exception e) {
75cdf0e10cSrcweir             result = false;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         }
78cdf0e10cSrcweir         return result;
79cdf0e10cSrcweir     }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     public boolean _isModified() {
82cdf0e10cSrcweir         return !oObj.isModified();
83cdf0e10cSrcweir     }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     public boolean _isReadOnly() {
86cdf0e10cSrcweir         return  !oObj.isReadOnly();
87cdf0e10cSrcweir     }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir }
90