| 1 |
/* |
| 2 |
* This file is part of the LibreOffice project. |
| 3 |
* |
| 4 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 5 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 6 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 7 |
*/ |
| 8 |
|
| 9 |
import com.sun.star.uno.UnoRuntime; |
| 10 |
import com.sun.star.frame.XModel; |
| 11 |
import com.sun.star.sheet.XSpreadsheetDocument; |
| 12 |
import com.sun.star.sheet.XSpreadsheet; |
| 13 |
import com.sun.star.sheet.XSpreadsheets; |
| 14 |
import com.sun.star.container.XIndexAccess; |
| 15 |
import com.sun.star.sheet.XViewFreezable; |
| 16 |
import com.sun.star.sheet.XViewPane; |
| 17 |
|
| 18 |
oDoc = UnoRuntime.queryInterface(XModel.class,XSCRIPTCONTEXT.getInvocationContext()); |
| 19 |
if ( oDoc == null ) |
| 20 |
oDoc = XSCRIPTCONTEXT.getDocument(); |
| 21 |
|
| 22 |
XSpreadsheetDocument xDoc = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class,oDoc); |
| 23 |
XSpreadsheets xSheets = xDoc.getSheets(); |
| 24 |
XIndexAccess xSheetsIA = UnoRuntime.queryInterface(XIndexAccess.class, xSheets); |
| 25 |
XSpreadsheet xSheet = UnoRuntime.queryInterface(com.sun.star.sheet.XSpreadsheet.class, xSheetsIA.getByIndex(0)); |
| 26 |
|
| 27 |
XViewFreezable xFreeze = UnoRuntime.queryInterface(XViewFreezable.class, oDoc.getCurrentController() ); |
| 28 |
xFreeze.freezeAtPosition(2, 3); |
| 29 |
|
| 30 |
XViewPane xViewPane = UnoRuntime.queryInterface(XViewPane.class, oDoc.getCurrentController() ); |
| 31 |
xViewPane.setFirstVisibleColumn(12); |
| 32 |
xViewPane.setFirstVisibleRow(149); |
| 33 |
|
| 34 |
return 0; |