[Libreoffice] [REVIEW] calc, spellchecking selection

Caolán McNamara caolanm at redhat.com
Wed Jun 15 02:51:19 PDT 2011


So, looking at

https://bugs.freedesktop.org/show_bug.cgi?id=33636

I see a bit of a nest of horrors around calc selections. The fundamental
intent of the dialog seems clear however:

a) The spellchecking dialog isn't modal, so you can swap from the
spell-checking dialog back to the document and back to the dialog.
b) If you were spellchecking a selection, and changed the selection
while the dialog is open and return to it, it wants to change state to
"resume" to indicate that you have to spell-check the new selection from
scratch.

When the spellcheck dialog initalizes, it uses ScSelectionState to get
the original selection, and it gets a new ScSelectionState when it gains
focus and checks if their GetSheetSelections differ to determine if the
selection changed, in order to know that spellchecking may need to be
restarted, which seems reasonable.

Unfortunately if you launch the spell-checker dialog it activates an
editview, which it uses to traverse the cells being spellchecked, and so
ScSelectionState once the dialog is first initialized returns this
editview as the active selection, i.e. see
ScSelectionState::ScSelectionState so the act of opening the
spellchecker changes the selection as far as ScSelectionState is
concerned.

It's not massively clear to me how the calc selections are expected to
work, but my thinking is that GetMarkData is an apparently reliable sane
layer, and taking a FillRangeListWithMarks from that to use as the
comparison that the selection has changed avoids the problem, and
apparently works for me.

Thoughts ?, if no-one has a better view I'll take a punt and commit it
in a few days to master.

C.



More information about the LibreOffice mailing list