More LibreOffice work.

This commit is contained in:
Storm Dragon committed 2026-10-15 01:10:43 -04:00
1 parent 4ac59d4ced
commit b5a5b86dda
15 files changed
+768 -28

No files matched your search

+19 -3
View File
@@ -11,15 +11,31 @@ import "C"
import "unsafe"
// libreOfficeFocusTarget resolves only a Calc editor's direct text children.
// F2 focuses its temporary panel; the paragraph can appear later, on typing.
// libreOfficeFocusTarget resolves a Calc editor's direct text children and
// preserves the sheet source for selection events. F2 focuses its temporary
// panel; the paragraph can appear later, on typing.
// The callback owns and releases the returned reference. No sheet is walked.
func (adapter *Adapter) libreOfficeFocusTarget(event *C.AtspiEvent, eventType string) *C.AtspiAccessible {
if eventType != FocusEvent && eventType != FocusedStateEvent ||
if eventType != FocusEvent && eventType != FocusedStateEvent && eventType != SelectionChangedEvent ||
!IsLibreOfficeProcess(adapter.applicationProcess(event.source)) {
return nil
}
role := C.atspi_accessible_get_role(event.source, nil)
if eventType == SelectionChangedEvent {
// Keep the sheet as the selection source. Its first selected cell
// is not necessarily the active cell (and can be far offscreen).
if role == C.ATSPI_ROLE_TABLE {
parent := C.atspi_accessible_get_parent(event.source, nil)
if parent != nil {
spreadsheet := C.atspi_accessible_get_role(parent, nil) == C.ATSPI_ROLE_DOCUMENT_SPREADSHEET
C.g_object_unref(C.gpointer(parent))
if spreadsheet {
return (*C.AtspiAccessible)(C.g_object_ref(C.gpointer(event.source)))
}
}
}
return nil
}
if role == C.ATSPI_ROLE_TABLE {
parent := C.atspi_accessible_get_parent(event.source, nil)
if parent != nil {