More work on LibreOffice support.

This commit is contained in:
Storm Dragon committed 2026-10-15 00:50:49 -04:00
1 parent e0c8c6198c
commit 4ac59d4ced
25 files changed
+392 -57

No files matched your search

+27
View File
@@ -49,3 +49,30 @@ func libreOfficeFocusSnapshot(snapshot atspi.Snapshot, options Options) atspi.Sn
}
return snapshot
}
// LibreOfficeCellFormula limits Office presentation to verified Calc cells.
func LibreOfficeCellFormula(snapshot atspi.Snapshot) string {
context := snapshot.LibreOffice
if !atspi.IsLibreOfficeProcess(snapshot.ApplicationProcess) || snapshot.Defunct ||
snapshot.Role != "table cell" || context == nil || !context.InSpreadsheet || !context.Cell {
return ""
}
return context.Formula
}
// LibreOfficeFormulaText follows Orca's explicit formula command: non-formula
// cells report their value, including "empty" when there is no value.
func LibreOfficeFormulaText(snapshot atspi.Snapshot) string {
context := snapshot.LibreOffice
if !atspi.IsLibreOfficeProcess(snapshot.ApplicationProcess) || snapshot.Defunct ||
snapshot.Role != "table cell" || context == nil || !context.InSpreadsheet || !context.Cell {
return "Not in a table."
}
if formula := LibreOfficeCellFormula(snapshot); formula != "" {
return formula
}
if strings.TrimSpace(context.CellText) != "" {
return context.CellText
}
return "empty"
}