--- /dev/null
+include "Simantics/DB"\r
+include "Simantics/Ontologies"\r
+include "Simantics/SCL"\r
+include "Document/All"\r
+include "File"\r
+\r
+importJava "org.simantics.spreadsheet.common.TableCell" where\r
+ data TableCell\r
+\r
+importJava "org.simantics.spreadsheet.common.SpreadsheetCell" where\r
+ data SpreadsheetCell\r
+\r
+importJava "org.simantics.spreadsheet.graph.SCL" where\r
+ toVariant :: a -> Variant\r
+ modelsSourceContribution :: Resource -> <ReadGraph> [Variable]\r
+ modelsSourceContributionLabeler :: Variable -> <ReadGraph> String\r
+\r
+importJava "org.simantics.spreadsheet.graph.SpreadsheetGraphUtils" where\r
+ @JavaName "fullSynchronization"\r
+ fullSynchronizeSheet :: Variable -> <ReadGraph> Boolean\r
+ evaluateAll :: Variable -> <ReadGraph> ()\r
+ saveInitialCondition :: Variable -> Resource -> String -> <WriteGraph> Resource\r
+ findCell :: Variable -> String -> <ReadGraph> Maybe Variable\r
+ invalidateAll :: Variable -> <ReadGraph> ()\r
+\r
+importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where\r
+ createSheet :: Resource -> String -> <WriteGraph> Resource\r
+ queryCells :: a -> [TableCell]\r
+ modifyCells1 :: [TableCell] -> (TableCell -> TableCell) -> [TableCell]\r
+ modifyCells :: [TableCell] -> [(TableCell -> TableCell)] -> [TableCell]\r
+ organizeCells :: Integer -> [String] -> [TableCell] -> [TableCell]\r
+ applyFont :: IFont -> (TableCell -> Boolean) -> TableCell -> TableCell\r
+ applyAlign :: Integer -> (TableCell -> Boolean) -> TableCell -> TableCell\r
+ applyForeground :: IColor -> (TableCell -> Boolean) -> TableCell -> TableCell\r
+ applyBackground :: IColor -> (TableCell -> Boolean) -> TableCell -> TableCell\r
+ simpleFont :: String -> String -> Integer -> IFont\r
+ rgbColor :: Integer -> Integer -> Integer -> IColor\r
+ selectRow :: Integer -> TableCell -> Boolean\r
+ selectColumn :: Integer -> TableCell -> Boolean\r
+ setSCLLine :: Resource -> Integer -> String -> <WriteGraph> ()\r
+ sheetRun :: Resource -> Variable -> <ReadGraph> Variable\r
+ \r
+importJava "org.simantics.spreadsheet.graph.ExcelImport" where\r
+ importBook :: Resource -> File -> <Proc> ()\r
+\r
+createSpreadsheetBookAction :: Resource -> <Proc> ()\r
+createSpreadsheetBookAction res = do\r
+ syncWrite (\() -> createSpreadsheetBookDefault res)\r
+ ()\r
+ \r
+createSpreadsheetSheetAction :: Resource -> <Proc> ()\r
+createSpreadsheetSheetAction res = do\r
+ syncWrite (\() -> createSpreadsheetDefault res)\r
+ ()\r
+\r
+createSpreadsheetDefault :: Resource -> <WriteGraph> Resource\r
+createSpreadsheetDefault library = createSheet library $ findFreshEscapedName "Sheet" library \r
+\r
+createSpreadsheetBookDefault :: Resource -> <WriteGraph> Resource\r
+createSpreadsheetBookDefault library = createSpreadsheetBook library $ findFreshEscapedName "Book" library \r
+\r
+createRange :: Resource -> Resource -> String -> String -> <WriteGraph> Resource\r
+createRange library type_ name expression = do\r
+ range = newResource ()\r
+ claim range L0.InstanceOf type_\r
+ claimRelatedValue range L0.HasName name\r
+ createSCLValue range SHEET.ExpressionRange.cells SHEET.SCLValue expression\r
+ claim range L0.PartOf library\r
+ range\r
+\r
+createSpreadsheetBook :: Resource -> String -> <WriteGraph> Resource\r
+createSpreadsheetBook library name = do\r
+ markUndoPoint ()\r
+ book = newResource ()\r
+ claim book L0.InstanceOf SHEET.Book\r
+ claimRelatedValue book L0.HasName name\r
+ claim book L0.PartOf library\r
+ createSheet book "Sheet"\r
+ addCommentMetadata ("Created Spreadsheet Book " + name)\r
+ book\r
+
\ No newline at end of file