1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OfficeDocument.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package com
.sun
.star
.comp
.beans
;
33 import com
.sun
.star
.uno
.UnoRuntime
;
35 //==========================================================================
36 /** Wrapper class for service OfficeDocument which emulates the upcoming
37 mode of automatic runtime Java classes to get rid of the need for
40 See further information on the wrapping and compatibility limitations
41 in the base class Wrapper.
45 public class OfficeDocument
extends Wrapper
47 com
.sun
.star
.frame
.XModel
,
48 com
.sun
.star
.util
.XModifiable
,
49 com
.sun
.star
.frame
.XStorable
,
50 com
.sun
.star
.view
.XPrintable
52 private com
.sun
.star
.frame
.XModel xModel
;
53 private com
.sun
.star
.util
.XModifiable xModifiable
;
54 private com
.sun
.star
.view
.XPrintable xPrintable
;
55 private com
.sun
.star
.frame
.XStorable xStorable
;
57 public OfficeDocument( com
.sun
.star
.frame
.XModel xModel
)
62 this.xModifiable
= (com
.sun
.star
.util
.XModifiable
)
63 UnoRuntime
.queryInterface(
64 com
.sun
.star
.util
.XModifiable
.class, xModel
);
65 this.xPrintable
= (com
.sun
.star
.view
.XPrintable
)
66 UnoRuntime
.queryInterface(
67 com
.sun
.star
.view
.XPrintable
.class, xModel
);
68 this.xStorable
= (com
.sun
.star
.frame
.XStorable
)
69 UnoRuntime
.queryInterface(
70 com
.sun
.star
.frame
.XStorable
.class, xModel
);
73 //==========================================================
74 // com.sun.star.frame.XModel
75 //----------------------------------------------------------
77 public boolean attachResource( /*IN*/String aURL
,
78 /*IN*/com
.sun
.star
.beans
.PropertyValue
[] aArguments
)
80 return xModel
.attachResource( aURL
, aArguments
);
83 public String
getURL( )
85 return xModel
.getURL();
88 public com
.sun
.star
.beans
.PropertyValue
[] getArgs( )
90 return xModel
.getArgs();
93 public void connectController(
94 /*IN*/ com
.sun
.star
.frame
.XController xController
)
96 xModel
.connectController( xController
);
99 public void disconnectController(
100 /*IN*/ com
.sun
.star
.frame
.XController xController
)
102 xModel
.disconnectController( xController
);
105 public void lockControllers( )
107 xModel
.lockControllers();
110 public void unlockControllers( )
112 xModel
.unlockControllers();
115 public boolean hasControllersLocked( )
117 return xModel
.hasControllersLocked();
120 public com
.sun
.star
.frame
.XController
getCurrentController( )
122 return xModel
.getCurrentController();
125 public void setCurrentController(
126 /*IN*/ com
.sun
.star
.frame
.XController xController
)
127 throws com
.sun
.star
.container
.NoSuchElementException
129 xModel
.setCurrentController( xController
);
132 public java
.lang
.Object
getCurrentSelection( )
134 return xModel
.getCurrentSelection();
137 //==========================================================
138 // com.sun.star.util.XModifyBroadcaster
139 //----------------------------------------------------------
141 public void addModifyListener(
142 /*IN*/ com
.sun
.star
.util
.XModifyListener xListener
)
144 xModifiable
.addModifyListener( xListener
);
147 public void removeModifyListener(
148 /*IN*/ com
.sun
.star
.util
.XModifyListener xListener
)
150 xModifiable
.removeModifyListener( xListener
);
153 //==========================================================
154 // com.sun.star.util.XModifiable
155 //----------------------------------------------------------
157 public boolean isModified( )
159 return xModifiable
.isModified();
162 public void setModified( /*IN*/boolean bModified
)
163 throws com
.sun
.star
.beans
.PropertyVetoException
165 xModifiable
.setModified( bModified
);
168 //==========================================================
169 // com.sun.star.view.XPrintable
170 //----------------------------------------------------------
172 public com
.sun
.star
.beans
.PropertyValue
[] getPrinter( )
174 return xPrintable
.getPrinter();
177 public void setPrinter( /*IN*/ com
.sun
.star
.beans
.PropertyValue
[] aPrinter
)
178 throws com
.sun
.star
.lang
.IllegalArgumentException
180 xPrintable
.setPrinter( aPrinter
);
183 public void print( /*IN*/ com
.sun
.star
.beans
.PropertyValue
[] xOptions
)
184 throws com
.sun
.star
.lang
.IllegalArgumentException
186 xPrintable
.print( xOptions
);
189 //==========================================================
190 // com.sun.star.frame.XStorable
191 //----------------------------------------------------------
193 public boolean hasLocation( )
195 return xStorable
.hasLocation();
198 public String
getLocation( )
200 return xStorable
.getLocation();
203 public boolean isReadonly( )
205 return xStorable
.isReadonly();
209 throws com
.sun
.star
.io
.IOException
214 public void storeAsURL( /*IN*/ String aURL
, /*IN*/ com
.sun
.star
.beans
.PropertyValue
[] aArguments
)
215 throws com
.sun
.star
.io
.IOException
217 xStorable
.storeAsURL( aURL
, aArguments
);
220 public void storeToURL( /*IN*/ String aURL
, /*IN*/ com
.sun
.star
.beans
.PropertyValue
[] aArguments
)
221 throws com
.sun
.star
.io
.IOException
223 xStorable
.storeToURL( aURL
, aArguments
);