]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl
Merge remote-tracking branch 'origin/svn'
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / scl / Spreadsheet / All.scl
1 include "Simantics/DB"\r
2 include "Simantics/Ontologies"\r
3 include "Simantics/SCL"\r
4 include "Document/All"\r
5 include "File"\r
6 \r
7 importJava "org.simantics.spreadsheet.common.TableCell" where\r
8     data TableCell\r
9 \r
10 importJava "org.simantics.spreadsheet.common.TreeTableCell" where\r
11     data TreeTableCell\r
12 \r
13 importJava "org.simantics.spreadsheet.common.SpreadsheetCell" where\r
14     data SpreadsheetCell\r
15 \r
16 importJava "org.simantics.spreadsheet.graph.SCL" where\r
17     toVariant :: a -> Variant\r
18     modelsSourceContribution :: Resource -> <ReadGraph> [Variable]\r
19     modelsSourceContributionLabeler :: Variable -> <ReadGraph> String\r
20 \r
21 importJava "org.simantics.spreadsheet.graph.SpreadsheetGraphUtils" where\r
22     @JavaName "fullSynchronization"\r
23     fullSynchronizeSheet :: Variable -> <ReadGraph> Boolean\r
24     evaluateAll :: Variable -> <ReadGraph> ()\r
25     saveInitialCondition :: Variable -> Resource -> String -> <WriteGraph> Resource\r
26     findCell :: Variable -> String -> <ReadGraph> Maybe Variable\r
27     invalidateAll :: Variable -> <ReadGraph> ()\r
28 \r
29 importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where\r
30     createSheet :: Resource -> String -> <WriteGraph> Resource\r
31     queryCells :: a -> [TableCell]\r
32     modifyCells1 :: [TableCell] -> (TableCell -> TableCell) -> [TableCell]\r
33     modifyCells :: [TableCell] -> [(TableCell -> TableCell)] -> [TableCell]\r
34     organizeCells :: Integer -> [String] -> [TableCell] -> [TableCell]\r
35     applyFont :: IFont -> (TableCell -> Boolean) -> TableCell -> TableCell\r
36     applyAlign :: Integer -> (TableCell -> Boolean) -> TableCell -> TableCell\r
37     applyForeground :: IColor -> (TableCell -> Boolean) -> TableCell -> TableCell\r
38     applyBackground :: IColor -> (TableCell -> Boolean) -> TableCell -> TableCell\r
39     simpleFont :: String -> String -> Integer -> IFont\r
40     rgbColor :: Integer -> Integer -> Integer -> IColor\r
41     selectRow :: Integer -> TableCell -> Boolean\r
42     selectColumn :: Integer -> TableCell -> Boolean\r
43     setSCLLine :: Resource -> Integer -> String -> <WriteGraph> ()\r
44     sheetRun :: Resource -> Variable -> <ReadGraph> Variable\r
45     \r
46 importJava "org.simantics.spreadsheet.graph.ExcelImport" where\r
47     importBook :: Resource -> File -> <Proc> ()\r
48 \r
49 createSpreadsheetBookAction :: Resource -> <Proc> ()\r
50 createSpreadsheetBookAction res = do\r
51   syncWrite (\() -> createSpreadsheetBookDefault res)\r
52   ()\r
53   \r
54 createSpreadsheetSheetAction :: Resource -> <Proc> ()\r
55 createSpreadsheetSheetAction res = do\r
56   syncWrite (\() -> createSpreadsheetDefault res)\r
57   ()\r
58 \r
59 createSpreadsheetDefault :: Resource -> <WriteGraph> Resource\r
60 createSpreadsheetDefault library = createSheet library $ findFreshEscapedName "Sheet" library \r
61 \r
62 createSpreadsheetBookDefault :: Resource -> <WriteGraph> Resource\r
63 createSpreadsheetBookDefault library = createSpreadsheetBook library $ findFreshEscapedName "Book" library \r
64 \r
65 createRange :: Resource -> Resource -> String -> String -> <WriteGraph> Resource\r
66 createRange library type_ name expression = do\r
67     range = newResource ()\r
68     claim range L0.InstanceOf type_\r
69     claimRelatedValue range L0.HasName name\r
70     createSCLValue range SHEET.ExpressionRange.cells SHEET.SCLValue expression\r
71     claim range L0.PartOf library\r
72     range\r
73 \r
74 createSpreadsheetBook :: Resource -> String -> <WriteGraph> Resource\r
75 createSpreadsheetBook library name = do\r
76     markUndoPoint ()\r
77     book = newResource ()\r
78     claim book L0.InstanceOf SHEET.Book\r
79     claimRelatedValue book L0.HasName name\r
80     claim book L0.PartOf library\r
81     createSheet book "Sheet"\r
82     addCommentMetadata ("Created Spreadsheet Book " + name)\r
83     book\r
84