Module Spreadsheet/All
This module is undocumented. This is a list of its definitions.
applyAlign :: Integer -> (TableCell -> Boolean) -> TableCell -> TableCell
applyAlign align f cell returns a copy of cell with its alignment set
to align if f cell holds, and cell unchanged otherwise.
applyBackground :: IColor -> (TableCell -> Boolean) -> TableCell -> TableCell
applyBackground color f cell returns a copy of cell with its background
colour set to color if f cell holds, and cell unchanged otherwise.
applyFont :: IFont -> (TableCell -> Boolean) -> TableCell -> TableCell
applyFont font f cell returns a copy of cell with its font set to
font if f cell holds, and cell unchanged otherwise. The filter is
typically selectRow or selectColumn applied
to a row or column number.
applyForeground :: IColor -> (TableCell -> Boolean) -> TableCell -> TableCell
applyForeground color f cell returns a copy of cell with its text
colour set to color if f cell holds, and cell unchanged otherwise.
bookRun :: Resource -> Variable -> <ReadGraph> Variable
The same function as sheetRun under a name that says more
accurately that the resource is a spreadsheet book, not a single sheet.
bookRunDefault :: Resource -> <ReadGraph> Variable
bookRunDefault book is bookRun with the book's own variable as
the context: the run of a book that is not attached to anything else.
cellColumn :: Variable -> <ReadGraph> Integer
Returns the column of the given cell variable, counted from 0. Fails if the
variable is not a cell of a spreadsheet run.
cellEditor :: Resource -> <ReadGraph> CellEditor
Returns the cell editor of the given sheet resource, with which the cells
of the sheet are edited.
cellEditorVariable :: Variable -> <ReadGraph> CellEditor
Returns the cell editor of the given sheet variable, with which the cells
of the sheet are edited.
createRange :: Resource -> Resource -> String -> String -> <WriteGraph> Resource
createRange library type name expression creates a range of the given type
under library with the given name, and gives its cells property the SCL
expression expression. With SHEET.ExpressionRange as the type, the
expression is what fills the range and must evaluate to a list of
TableCell.
createSheet :: Resource -> String -> <WriteGraph> Resource
createSheet book name creates a new sheet named name in book and
returns it. The sheet starts out with an empty B-tree of lines, a headers
component with no column labels or widths, and a dimensions component of
256 rows and 128 columns that does not fit itself to its content. Needs a
write transaction.
createSpreadsheetBook :: Resource -> String -> <WriteGraph> Resource
createSpreadsheetBook library name creates a new spreadsheet book named
name under library, with one sheet named Sheet in it, and returns the
book. An undo point is marked before the change and a comment is added to the
change metadata.
createSpreadsheetBookAction :: Resource -> <Proc> ()
Creates a new spreadsheet book with a fresh name under res, in a write
transaction of its own.
createSpreadsheetBookDefault :: Resource -> <WriteGraph> Resource
Creates a new spreadsheet book under library, named with the first free name
derived from Book.
createSpreadsheetDefault :: Resource -> <WriteGraph> Resource
Creates a new sheet under library, named with the first free name derived
from Sheet.
createSpreadsheetSheetAction :: Resource -> <Proc> ()
Creates a new sheet with a fresh name under res, in a write transaction of
its own.
createTreeTableCell :: String -> a -> Maybe b -> Integer -> Integer -> Integer -> Boolean -> <Proc> TreeTableCell
createTreeTableCell text data font parent row column editable builds a
tree table cell that shows text for the object data at the given row
and column, both counted from 0. parent is the row number of the row
this one hangs under, or -1 for a row at the top level. font is a JFace
font descriptor or Nothing, and anything that is not a font descriptor
leaves the cell without a font. Identifying the parent by row number is
obsolete; createTreeTableCell2 identifies it by
the parent row's data object instead.
createTreeTableCell2 :: String -> a -> Maybe b -> a -> Integer -> Integer -> Boolean -> <Proc> TreeTableCell
createTreeTableCell2 text data font parentData row column editable builds
a tree table cell as createTreeTableCell does, but
names the parent row by its data object rather than by its row number.
decodeRange :: String -> Range
decodeRange text parses a cell or cell block reference into a
Range. A1 gives the single cell A1, B2:D10 the block from B2
to D10 and the empty string the whole sheet. A $ before the column or the
row is accepted and ignored, so $B$2 is the same as B2. A reference of
the form _L3, _R3, _U3 or _D3 is relative and is resolved against
row 0 and column 0 here. Fails if the text is not a valid reference.
decodeRanges :: String -> String -> [Range]
decodeRanges text delimiter splits text by delimiter and parses each
piece with decodeRange. The delimiter is a regular
expression, not a literal, so a delimiter such as . matches anything.
editProperty :: Serializable a => CellEditor -> String -> String -> a -> Maybe Consumer -> <SpreadsheetTransaction> ()
editProperty editor location property value consumer sets one property of one
cell, serializing value with its own binding. See
editProperty_ of Spreadsheet/Solver for the cell reference
syntax, the property names and when the edit takes effect.
endColumn :: Range -> <Proc> Integer
Returns the last column of the range, counted from 0 and belonging to the
range. It is the largest Integer for a range that covers all columns.
endRow :: Range -> <Proc> Integer
Returns the last row of the range, counted from 0 and belonging to the
range. It is the largest Integer for a range that covers all rows.
evaluateAll :: Variable -> <ReadGraph> ()
Evaluates every cell of the book that run belongs to. A formula whose
result is still cached is left alone, so this recomputes exactly the cells
that have been invalidated since the last evaluation.
extRefActiveVariable :: Variable -> <ReadGraph> Variant
As extRefVariable, but the reference is resolved in the
context the book is being run against instead of pointing at var
directly: var is a configuration variable and the value read is that of
its counterpart under the run. If no counterpart can be found the cell
shows an error message instead of a value.
extRefVariable :: Variable -> <ReadGraph> Variant
Wraps var into an external reference that can be used as the content of a
cell, returned as a Variant of void binding. The cell then shows the
value of var itself and follows its changes, and editing the cell writes
back to var in a write transaction of its own.
findCell :: Variable -> String -> <ReadGraph> Maybe Variable
findCell run reference returns the cell variable named by reference,
which has the form Sheet!A1. The result is Nothing if the book has no
such sheet, if the row has no content or if the row has no such cell.
Fails if reference does not contain a !.
forRows :: Variable -> String -> Integer -> Integer -> (Variable -> <ReadGraph,Proc> ()) -> <ReadGraph> ()
forRows run sheetName min max f applies f to the variable of every row
of the named sheet whose row number r satisfies min <= r < max. Rows
are counted from 0 and rows without content do not exist, so they are
simply not visited. Nothing happens at all if the book has no sheet of that
name, and a row whose variable cannot be resolved is skipped without a
report.
fullSynchronizeSheet :: Variable -> <ReadGraph> Boolean
Synchronizes the whole spreadsheet configuration of the book that run
belongs to into the solver, creating, updating and removing sheets, rows
and cells until the solver matches the graph. Returns True if anything
actually changed.
getTreeTableCellData :: TreeTableCell -> <Proc> a
Returns the data object the cell carries, that is, the thing in the
underlying model that the row of the tree stands for.
importBook :: Resource -> File -> <Proc> ()
importBook container file reads an Excel workbook from file and creates
a spreadsheet book for it under container, named after the file with a
fresh name. The import runs in a write transaction of its own, so no
transaction is needed around the call, and failures are logged rather than
raised.
importSpreadsheetBookAction :: Resource -> <Proc> ()
Asks the user for an Excel file and imports it into res with
importBook. Does nothing if the dialog is cancelled.
invalidateAll :: Variable -> <ReadGraph> ()
Drops the cached result of every formula of the book that run belongs to
and refreshes the variables that show them, so that the next read
recomputes. Use it after changing something the book depends on that the
solver cannot see by itself.
modelsSourceContribution :: Resource -> <ReadGraph> [Variable]
The source contribution that offers every model of the current project as a
source a spreadsheet book can be evaluated against. The resource argument
is the book and is not used.
modelsSourceContributionLabeler :: Variable -> <ReadGraph> String
modifyCells :: [TableCell] -> [TableCell -> TableCell] -> [TableCell]
modifyCells cells fs applies every function of fs in turn to every cell
and returns the results in the same order.
modifyCells1 :: [TableCell] -> (TableCell -> TableCell) -> [TableCell]
modifyCells1 cells f applies f to every cell and returns the results in
the same order.
offsetCell :: Variable -> Integer -> Integer -> <ReadGraph> Maybe Variable
offsetCell cell columns rows returns the cell columns to the right and
rows below cell; negative offsets move left and up. Nothing if the
book has no row at that offset or that row has no cell in that column.
organizeCells :: Integer -> [String] -> [TableCell] -> [TableCell]
organizeCells columns headers cells reflows a table that has one name
column and any number of field columns so that at most columns columns
are used: the fields that do not fit are stacked into further blocks of
rows below the first, each block repeating the header row and the name
column. Row 0 of the input is taken as the header row and column 0 as the
name column. Fails if columns is less than 2. The headers argument is
not used.
possibleRow :: Variable -> String -> Integer -> <ReadGraph> Maybe Variable
possibleRow run sheetName rowNumber returns the variable of the row with
the given number, counted from 0, in the named sheet of the book that run
belongs to. Nothing if there is no such sheet or the row has no content.
queryCells :: a -> [TableCell]
Turns a value into the cells of a table. Each element of a list becomes one
row, counted from 0; a tuple or a list inside it becomes the cells of that
row, one per component and counted from 0, and any other element becomes a
single cell in column 0. The text of a cell is the printed form of the
value. A value that is not a list gives no cells at all. This is what the
cells expression of a query spreadsheet is usually built with.
rgbColor :: Integer -> Integer -> Integer -> IColor
rgbColor r g b describes a colour by its red, green and blue components,
each from 0 to 255.
rowCell :: Variable -> Integer -> <ReadGraph> Maybe Variable
rowCell row column returns the cell of the given row variable at the
given column, counted from 0. Nothing if the row has no cell there.
saveInitialCondition :: Variable -> Resource -> String -> <WriteGraph> Resource
saveInitialCondition run container name serializes the current state of
the solver book that run belongs to and stores it under container as an
initial condition named name. The new condition replaces whatever initial
condition the book had and becomes its default. Needs a write transaction
and returns the new initial condition.
selectColumn :: Integer -> TableCell -> Boolean
selectColumn column cell holds when cell is in the given column,
counted from 0. Meant as the filter of applyFont and the
other cell modifiers.
selectRow :: Integer -> TableCell -> Boolean
selectRow row cell holds when cell is on the given row, counted from 0.
Meant as the filter of applyFont and the other cell
modifiers.
setSCLLine :: Resource -> Integer -> String -> <WriteGraph> ()
setSCLLine sheet row expression adds a line at the given row number of
sheet whose content is an SCL expression. Needs a write transaction.
The expression argument is currently ignored and the content is always
set to the fixed expression [spreadsheetCell ].
sheetRun :: Resource -> Variable -> <ReadGraph> Variable
sheetRun book context returns the variable of the spreadsheet book
attached to context, that is, the run of the book against that context.
Cell values read under the returned variable are evaluated with context
as the input, so one book can be run against several inputs at once.
sheetRunDefault :: Resource -> <ReadGraph> Variable
simpleFont :: String -> String -> Integer -> IFont
simpleFont family style height describes a font by its family name, a
style name such as Bold or Italic, and its height in points.
spreadsheetBook :: Variable -> <Proc> SpreadsheetBook
Returns the solver book behind the given variable. The result is null
unless the variable is the book variable itself, which the signature does
not show.
startColumn :: Range -> <Proc> Integer
Returns the first column of the range, counted from 0, so column A is 0.
startRow :: Range -> <Proc> Integer
Returns the first row of the range, counted from 0.
syncExec :: CellEditor -> OperationMode -> <SpreadsheetTransaction,Proc> a -> <Proc> a
syncExec editor mode f opens a transaction on editor in the given mode,
runs f with that transaction in scope so that the cell edits f makes
are collected into it, and commits it before returning the result of f.
The transaction is committed even if f fails, and a failure of the commit
itself is logged rather than raised.
syncExecGraph :: CellEditor -> OperationMode -> <SpreadsheetTransaction,WriteGraph,Proc> a -> <WriteGraph,Proc> a
As syncExec, but the collected edits are written through the
write transaction in scope instead of through a new one of the session's.
Use it when the cell edits have to be part of a larger write.
toVariant :: a -> Variant
Wraps a value into a Variant, using the binding that follows from the
class of the value.
treeTableCellColumn :: TreeTableCell -> <Proc> Integer
Returns the column of the cell, counted from 0, so column A is 0.
treeTableCellFont :: TreeTableCell -> <Proc> Maybe IFont
Returns the font of the cell, or Nothing if it was created without one.
treeTableCellRow :: TreeTableCell -> <Proc> Integer
Returns the row of the cell, counted from 0.
treeTableCellText :: TreeTableCell -> <Proc> String
Returns the text drawn in the cell.
|