Spreadsheet Document Controller
The com.sun.star.sheet.SpreadsheetView service is the spreadsheet's extension of the com.sun.star.frame.Controller service and represents a table editing view for a spreadsheet document.
The view object is the spreadsheet application's controller object as described in the chapter Frame-Controller-Model Paradigm in OpenOffice.org. The com.sun.star.frame.XController, com.sun.star.frame.XDispatchProvider and com.sun.star.ui.XContextMenuInterception interfaces work as described in that chapter.
The com.sun.star.view.XSelectionSupplier interface queries and modifies the view's selection. The selection in a spreadsheet view can be a com.sun.star.sheet.SheetCell, com.sun.star.sheet.SheetCellRange, com.sun.star.sheet.SheetCellRanges, com.sun.star.drawing.Shape or com.sun.star.drawing.Shapes object.
The com.sun.star.sheet.XSpreadsheetView interface gives access to the spreadsheet that is displayed in the view. The
getActiveSheet() method returns the active sheet's object, the
setActiveSheet() method switches to a different sheet. The parameter to
setActiveSheet() must be a sheet of the view's document.
The com.sun.star.sheet.XViewSplitable interface splits a view into two parts or panes, horizontally and vertically. The
splitAtPosition() method splits the view at the specified pixel positions. To remove the split, a position of 0 is passed. The
getIsWindowSplit() method returns true if the view is split, the
getSplitVertical() methods return the pixel positions where the view is split. The
getSplitRow() methods return the cell column or row that corresponds to the split position, and are used with frozen panes as discussed below.
The com.sun.star.sheet.XViewFreezable interface is used to freeze a number of columns and rows in the left and upper part of the view. The
freezeAtPosition() method freezes the specified number of columns and rows. This also sets the split positions accordingly. The
hasFrozenPanes() method returns true if the columns or rows are frozen. A view can only have frozen columns or rows, or normal split panes at a time.
If a view is split or frozen, it has up to four view pane objects that represent the individual parts. These are accessed using the com.sun.star.container.XIndexAccess interface. If a view is not split, it contains only one pane object. The active pane of a spreadsheet view is also accessed using the com.sun.star.sheet.SpreadsheetViewPane service's interfaces directly with the com.sun.star.sheet.SpreadsheetView service that inherits them.
The com.sun.star.sheet.XRangeSelection interface is explained in the "Range Selection" chapter below.
The following example uses the com.sun.star.sheet.XViewFreezable interface to freeze the first column and the first two rows:
// freeze the first column and first two rows com.sun.star.sheet.XViewFreezable xFreeze = (com.sun.star.sheet.XViewFreezable) UnoRuntime.queryInterface(com.sun.star.sheet.XViewFreezable.class, xController); xFreeze.freezeAtPosition(1, 2);
|Content on this page is licensed under the Public Documentation License (PDL).|