xref: /AOO41X/main/bean/com/sun/star/comp/beans/OfficeDocument.java (revision 8809db7a87f97847b57a57f4cd2b0104b2b83182)
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 
24 package com.sun.star.comp.beans;
25 
26 import com.sun.star.uno.UnoRuntime;
27 
28 //==========================================================================
29 /** Wrapper class for service OfficeDocument which emulates the upcoming
30     mode of automatic runtime Java classes to get rid of the need for
31     queryInterface.
32 
33     See further information on the wrapping and compatibility limitations
34     in the base class Wrapper.
35 
36     @since OOo 2.0.0
37  */
38 public class OfficeDocument extends Wrapper
39     implements
40         com.sun.star.frame.XModel,
41         com.sun.star.util.XModifiable,
42         com.sun.star.frame.XStorable,
43         com.sun.star.view.XPrintable
44 {
45     private com.sun.star.frame.XModel xModel;
46     private com.sun.star.util.XModifiable xModifiable;
47     private com.sun.star.view.XPrintable xPrintable;
48     private com.sun.star.frame.XStorable xStorable;
49 
50     public OfficeDocument( com.sun.star.frame.XModel xModel )
51     {
52         super( xModel );
53 
54         this.xModel = xModel;
55         this.xModifiable = (com.sun.star.util.XModifiable)
56             UnoRuntime.queryInterface(
57                 com.sun.star.util.XModifiable.class, xModel );
58         this.xPrintable = (com.sun.star.view.XPrintable)
59             UnoRuntime.queryInterface(
60                 com.sun.star.view.XPrintable.class, xModel );
61         this.xStorable = (com.sun.star.frame.XStorable)
62             UnoRuntime.queryInterface(
63                 com.sun.star.frame.XStorable.class, xModel );
64     }
65 
66     //==========================================================
67     // com.sun.star.frame.XModel
68     //----------------------------------------------------------
69 
70     public boolean attachResource( /*IN*/String aURL,
71             /*IN*/com.sun.star.beans.PropertyValue[] aArguments )
72     {
73         return xModel.attachResource( aURL, aArguments );
74     }
75 
76     public String getURL(  )
77     {
78         return xModel.getURL();
79     }
80 
81     public com.sun.star.beans.PropertyValue[] getArgs(  )
82     {
83         return xModel.getArgs();
84     }
85 
86     public void connectController(
87         /*IN*/ com.sun.star.frame.XController xController )
88     {
89         xModel.connectController( xController );
90     }
91 
92     public void disconnectController(
93         /*IN*/ com.sun.star.frame.XController xController )
94     {
95         xModel.disconnectController( xController );
96     }
97 
98     public void lockControllers(  )
99     {
100         xModel.lockControllers();
101     }
102 
103     public void unlockControllers(  )
104     {
105         xModel.unlockControllers();
106     }
107 
108     public boolean hasControllersLocked(  )
109     {
110         return xModel.hasControllersLocked();
111     }
112 
113     public com.sun.star.frame.XController getCurrentController(  )
114     {
115         return xModel.getCurrentController();
116     }
117 
118     public void setCurrentController(
119         /*IN*/ com.sun.star.frame.XController xController )
120         throws com.sun.star.container.NoSuchElementException
121     {
122         xModel.setCurrentController( xController );
123     }
124 
125     public java.lang.Object getCurrentSelection(  )
126     {
127         return xModel.getCurrentSelection();
128     }
129 
130     //==========================================================
131     // com.sun.star.util.XModifyBroadcaster
132     //----------------------------------------------------------
133 
134     public void addModifyListener(
135         /*IN*/ com.sun.star.util.XModifyListener xListener )
136     {
137         xModifiable.addModifyListener( xListener );
138     }
139 
140     public void removeModifyListener(
141         /*IN*/ com.sun.star.util.XModifyListener xListener )
142     {
143         xModifiable.removeModifyListener( xListener );
144     }
145 
146     //==========================================================
147     // com.sun.star.util.XModifiable
148     //----------------------------------------------------------
149 
150     public boolean isModified(  )
151     {
152         return xModifiable.isModified();
153     }
154 
155     public void setModified( /*IN*/boolean bModified )
156         throws com.sun.star.beans.PropertyVetoException
157     {
158         xModifiable.setModified( bModified );
159     }
160 
161     //==========================================================
162     // com.sun.star.view.XPrintable
163     //----------------------------------------------------------
164 
165     public com.sun.star.beans.PropertyValue[] getPrinter(  )
166     {
167         return xPrintable.getPrinter();
168     }
169 
170     public void setPrinter( /*IN*/ com.sun.star.beans.PropertyValue[] aPrinter )
171         throws com.sun.star.lang.IllegalArgumentException
172     {
173         xPrintable.setPrinter( aPrinter );
174     }
175 
176     public void print( /*IN*/ com.sun.star.beans.PropertyValue[] xOptions )
177         throws com.sun.star.lang.IllegalArgumentException
178     {
179         xPrintable.print( xOptions );
180     }
181 
182     //==========================================================
183     // com.sun.star.frame.XStorable
184     //----------------------------------------------------------
185 
186     public boolean hasLocation(  )
187     {
188         return xStorable.hasLocation();
189     }
190 
191     public String getLocation(  )
192     {
193         return xStorable.getLocation();
194     }
195 
196     public boolean isReadonly(  )
197     {
198         return xStorable.isReadonly();
199     }
200 
201     public void store(  )
202         throws com.sun.star.io.IOException
203     {
204         xStorable.store();
205     }
206 
207     public void storeAsURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments )
208         throws com.sun.star.io.IOException
209     {
210         xStorable.storeAsURL( aURL, aArguments );
211     }
212 
213     public void storeToURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments )
214         throws com.sun.star.io.IOException
215     {
216         xStorable.storeToURL( aURL, aArguments );
217     }
218 
219 };
220 
221 
222 
223