1*d4cc1e8cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*d4cc1e8cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d4cc1e8cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d4cc1e8cSAndrew Rist * distributed with this work for additional information 6*d4cc1e8cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d4cc1e8cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d4cc1e8cSAndrew Rist * "License"); you may not use this file except in compliance 9*d4cc1e8cSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*d4cc1e8cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*d4cc1e8cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d4cc1e8cSAndrew Rist * software distributed under the License is distributed on an 15*d4cc1e8cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d4cc1e8cSAndrew Rist * KIND, either express or implied. See the License for the 17*d4cc1e8cSAndrew Rist * specific language governing permissions and limitations 18*d4cc1e8cSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*d4cc1e8cSAndrew Rist *************************************************************/ 21*d4cc1e8cSAndrew Rist 22*d4cc1e8cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package com.sun.star.comp.beans; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 27cdf0e10cSrcweir 28cdf0e10cSrcweir //========================================================================== 29cdf0e10cSrcweir /** Wrapper class for service OfficeDocument which emulates the upcoming 30cdf0e10cSrcweir mode of automatic runtime Java classes to get rid of the need for 31cdf0e10cSrcweir queryInterface. 32cdf0e10cSrcweir 33cdf0e10cSrcweir See further information on the wrapping and compatibility limitations 34cdf0e10cSrcweir in the base class Wrapper. 35cdf0e10cSrcweir 36cdf0e10cSrcweir @since OOo 2.0.0 37cdf0e10cSrcweir */ 38cdf0e10cSrcweir public class OfficeDocument extends Wrapper 39cdf0e10cSrcweir implements 40cdf0e10cSrcweir com.sun.star.frame.XModel, 41cdf0e10cSrcweir com.sun.star.util.XModifiable, 42cdf0e10cSrcweir com.sun.star.frame.XStorable, 43cdf0e10cSrcweir com.sun.star.view.XPrintable 44cdf0e10cSrcweir { 45cdf0e10cSrcweir private com.sun.star.frame.XModel xModel; 46cdf0e10cSrcweir private com.sun.star.util.XModifiable xModifiable; 47cdf0e10cSrcweir private com.sun.star.view.XPrintable xPrintable; 48cdf0e10cSrcweir private com.sun.star.frame.XStorable xStorable; 49cdf0e10cSrcweir OfficeDocument( com.sun.star.frame.XModel xModel )50cdf0e10cSrcweir public OfficeDocument( com.sun.star.frame.XModel xModel ) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir super( xModel ); 53cdf0e10cSrcweir 54cdf0e10cSrcweir this.xModel = xModel; 55cdf0e10cSrcweir this.xModifiable = (com.sun.star.util.XModifiable) 56cdf0e10cSrcweir UnoRuntime.queryInterface( 57cdf0e10cSrcweir com.sun.star.util.XModifiable.class, xModel ); 58cdf0e10cSrcweir this.xPrintable = (com.sun.star.view.XPrintable) 59cdf0e10cSrcweir UnoRuntime.queryInterface( 60cdf0e10cSrcweir com.sun.star.view.XPrintable.class, xModel ); 61cdf0e10cSrcweir this.xStorable = (com.sun.star.frame.XStorable) 62cdf0e10cSrcweir UnoRuntime.queryInterface( 63cdf0e10cSrcweir com.sun.star.frame.XStorable.class, xModel ); 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir //========================================================== 67cdf0e10cSrcweir // com.sun.star.frame.XModel 68cdf0e10cSrcweir //---------------------------------------------------------- 69cdf0e10cSrcweir attachResource( String aURL, com.sun.star.beans.PropertyValue[] aArguments )70cdf0e10cSrcweir public boolean attachResource( /*IN*/String aURL, 71cdf0e10cSrcweir /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) 72cdf0e10cSrcweir { 73cdf0e10cSrcweir return xModel.attachResource( aURL, aArguments ); 74cdf0e10cSrcweir } 75cdf0e10cSrcweir getURL( )76cdf0e10cSrcweir public String getURL( ) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir return xModel.getURL(); 79cdf0e10cSrcweir } 80cdf0e10cSrcweir getArgs( )81cdf0e10cSrcweir public com.sun.star.beans.PropertyValue[] getArgs( ) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir return xModel.getArgs(); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir connectController( com.sun.star.frame.XController xController )86cdf0e10cSrcweir public void connectController( 87cdf0e10cSrcweir /*IN*/ com.sun.star.frame.XController xController ) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir xModel.connectController( xController ); 90cdf0e10cSrcweir } 91cdf0e10cSrcweir disconnectController( com.sun.star.frame.XController xController )92cdf0e10cSrcweir public void disconnectController( 93cdf0e10cSrcweir /*IN*/ com.sun.star.frame.XController xController ) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir xModel.disconnectController( xController ); 96cdf0e10cSrcweir } 97cdf0e10cSrcweir lockControllers( )98cdf0e10cSrcweir public void lockControllers( ) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir xModel.lockControllers(); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir unlockControllers( )103cdf0e10cSrcweir public void unlockControllers( ) 104cdf0e10cSrcweir { 105cdf0e10cSrcweir xModel.unlockControllers(); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir hasControllersLocked( )108cdf0e10cSrcweir public boolean hasControllersLocked( ) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir return xModel.hasControllersLocked(); 111cdf0e10cSrcweir } 112cdf0e10cSrcweir getCurrentController( )113cdf0e10cSrcweir public com.sun.star.frame.XController getCurrentController( ) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir return xModel.getCurrentController(); 116cdf0e10cSrcweir } 117cdf0e10cSrcweir setCurrentController( com.sun.star.frame.XController xController )118cdf0e10cSrcweir public void setCurrentController( 119cdf0e10cSrcweir /*IN*/ com.sun.star.frame.XController xController ) 120cdf0e10cSrcweir throws com.sun.star.container.NoSuchElementException 121cdf0e10cSrcweir { 122cdf0e10cSrcweir xModel.setCurrentController( xController ); 123cdf0e10cSrcweir } 124cdf0e10cSrcweir getCurrentSelection( )125cdf0e10cSrcweir public java.lang.Object getCurrentSelection( ) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir return xModel.getCurrentSelection(); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir //========================================================== 131cdf0e10cSrcweir // com.sun.star.util.XModifyBroadcaster 132cdf0e10cSrcweir //---------------------------------------------------------- 133cdf0e10cSrcweir addModifyListener( com.sun.star.util.XModifyListener xListener )134cdf0e10cSrcweir public void addModifyListener( 135cdf0e10cSrcweir /*IN*/ com.sun.star.util.XModifyListener xListener ) 136cdf0e10cSrcweir { 137cdf0e10cSrcweir xModifiable.addModifyListener( xListener ); 138cdf0e10cSrcweir } 139cdf0e10cSrcweir removeModifyListener( com.sun.star.util.XModifyListener xListener )140cdf0e10cSrcweir public void removeModifyListener( 141cdf0e10cSrcweir /*IN*/ com.sun.star.util.XModifyListener xListener ) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir xModifiable.removeModifyListener( xListener ); 144cdf0e10cSrcweir } 145cdf0e10cSrcweir 146cdf0e10cSrcweir //========================================================== 147cdf0e10cSrcweir // com.sun.star.util.XModifiable 148cdf0e10cSrcweir //---------------------------------------------------------- 149cdf0e10cSrcweir isModified( )150cdf0e10cSrcweir public boolean isModified( ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir return xModifiable.isModified(); 153cdf0e10cSrcweir } 154cdf0e10cSrcweir setModified( boolean bModified )155cdf0e10cSrcweir public void setModified( /*IN*/boolean bModified ) 156cdf0e10cSrcweir throws com.sun.star.beans.PropertyVetoException 157cdf0e10cSrcweir { 158cdf0e10cSrcweir xModifiable.setModified( bModified ); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir //========================================================== 162cdf0e10cSrcweir // com.sun.star.view.XPrintable 163cdf0e10cSrcweir //---------------------------------------------------------- 164cdf0e10cSrcweir getPrinter( )165cdf0e10cSrcweir public com.sun.star.beans.PropertyValue[] getPrinter( ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir return xPrintable.getPrinter(); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir setPrinter( com.sun.star.beans.PropertyValue[] aPrinter )170cdf0e10cSrcweir public void setPrinter( /*IN*/ com.sun.star.beans.PropertyValue[] aPrinter ) 171cdf0e10cSrcweir throws com.sun.star.lang.IllegalArgumentException 172cdf0e10cSrcweir { 173cdf0e10cSrcweir xPrintable.setPrinter( aPrinter ); 174cdf0e10cSrcweir } 175cdf0e10cSrcweir print( com.sun.star.beans.PropertyValue[] xOptions )176cdf0e10cSrcweir public void print( /*IN*/ com.sun.star.beans.PropertyValue[] xOptions ) 177cdf0e10cSrcweir throws com.sun.star.lang.IllegalArgumentException 178cdf0e10cSrcweir { 179cdf0e10cSrcweir xPrintable.print( xOptions ); 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir //========================================================== 183cdf0e10cSrcweir // com.sun.star.frame.XStorable 184cdf0e10cSrcweir //---------------------------------------------------------- 185cdf0e10cSrcweir hasLocation( )186cdf0e10cSrcweir public boolean hasLocation( ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir return xStorable.hasLocation(); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir getLocation( )191cdf0e10cSrcweir public String getLocation( ) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir return xStorable.getLocation(); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir isReadonly( )196cdf0e10cSrcweir public boolean isReadonly( ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir return xStorable.isReadonly(); 199cdf0e10cSrcweir } 200cdf0e10cSrcweir store( )201cdf0e10cSrcweir public void store( ) 202cdf0e10cSrcweir throws com.sun.star.io.IOException 203cdf0e10cSrcweir { 204cdf0e10cSrcweir xStorable.store(); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir storeAsURL( String aURL, com.sun.star.beans.PropertyValue[] aArguments )207cdf0e10cSrcweir public void storeAsURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments ) 208cdf0e10cSrcweir throws com.sun.star.io.IOException 209cdf0e10cSrcweir { 210cdf0e10cSrcweir xStorable.storeAsURL( aURL, aArguments ); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir storeToURL( String aURL, com.sun.star.beans.PropertyValue[] aArguments )213cdf0e10cSrcweir public void storeToURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments ) 214cdf0e10cSrcweir throws com.sun.star.io.IOException 215cdf0e10cSrcweir { 216cdf0e10cSrcweir xStorable.storeToURL( aURL, aArguments ); 217cdf0e10cSrcweir } 218cdf0e10cSrcweir 219cdf0e10cSrcweir }; 220cdf0e10cSrcweir 221cdf0e10cSrcweir 222cdf0e10cSrcweir 223