1*ae15d43aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ae15d43aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ae15d43aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ae15d43aSAndrew Rist * distributed with this work for additional information 6*ae15d43aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ae15d43aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ae15d43aSAndrew Rist * "License"); you may not use this file except in compliance 9*ae15d43aSAndrew Rist * with the License. You may obtain a copy of the License at 10*ae15d43aSAndrew Rist * 11*ae15d43aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ae15d43aSAndrew Rist * 13*ae15d43aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ae15d43aSAndrew Rist * software distributed under the License is distributed on an 15*ae15d43aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ae15d43aSAndrew Rist * KIND, either express or implied. See the License for the 17*ae15d43aSAndrew Rist * specific language governing permissions and limitations 18*ae15d43aSAndrew Rist * under the License. 19*ae15d43aSAndrew Rist * 20*ae15d43aSAndrew Rist *************************************************************/ 21*ae15d43aSAndrew Rist 22*ae15d43aSAndrew Rist 23cdf0e10cSrcweir /* 24cdf0e10cSrcweir * SpreadsheetView.java 25cdf0e10cSrcweir * 26cdf0e10cSrcweir * Created on 2. Oktober 2003, 14:02 27cdf0e10cSrcweir */ 28cdf0e10cSrcweir 29cdf0e10cSrcweir import com.sun.star.uno.*; 30cdf0e10cSrcweir import com.sun.star.lang.*; 31cdf0e10cSrcweir import com.sun.star.frame.*; 32cdf0e10cSrcweir import com.sun.star.sheet.*; 33cdf0e10cSrcweir import com.sun.star.container.*; 34cdf0e10cSrcweir 35cdf0e10cSrcweir /** 36cdf0e10cSrcweir * 37cdf0e10cSrcweir * @author fs93730 38cdf0e10cSrcweir */ 39cdf0e10cSrcweir public class SpreadsheetView extends DocumentViewHelper 40cdf0e10cSrcweir { 41cdf0e10cSrcweir 42cdf0e10cSrcweir /** Creates a new instance of SpreadsheetView */ SpreadsheetView( XMultiServiceFactory orb, DocumentHelper document, XController controller )43cdf0e10cSrcweir public SpreadsheetView( XMultiServiceFactory orb, DocumentHelper document, XController controller ) 44cdf0e10cSrcweir { 45cdf0e10cSrcweir super( orb, document, controller ); 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir /** activates the sheet with the given index 49cdf0e10cSrcweir */ activateSheet( int sheetIndex )50cdf0e10cSrcweir void activateSheet( int sheetIndex ) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir try 53cdf0e10cSrcweir { 54cdf0e10cSrcweir // get the sheet to activate 55cdf0e10cSrcweir XSpreadsheetDocument doc = (XSpreadsheetDocument)UnoRuntime.queryInterface( 56cdf0e10cSrcweir XSpreadsheetDocument.class, getDocument().getDocument() ); 57cdf0e10cSrcweir XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface( 58cdf0e10cSrcweir XIndexAccess.class, doc.getSheets() ); 59cdf0e10cSrcweir 60cdf0e10cSrcweir XSpreadsheet sheet = (XSpreadsheet)UnoRuntime.queryInterface( 61cdf0e10cSrcweir XSpreadsheet.class, sheets.getByIndex( sheetIndex ) ); 62cdf0e10cSrcweir 63cdf0e10cSrcweir // activate 64cdf0e10cSrcweir XSpreadsheetView view = (XSpreadsheetView)UnoRuntime.queryInterface( 65cdf0e10cSrcweir XSpreadsheetView.class, getController() ); 66cdf0e10cSrcweir view.setActiveSheet( sheet ); 67cdf0e10cSrcweir } 68cdf0e10cSrcweir catch( com.sun.star.uno.Exception e ) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir } 71cdf0e10cSrcweir } 72cdf0e10cSrcweir } 73