office-gobmx/svx
Michael Weghorn 790730a9b7 a11y: Fix focused state for special char dialog item
As mentioned/worked around in Colomban's pending Gerrit change
to implement an a11y test for the "Special Characters" dialog [1],
the selected item in the character table was incorrectly still
reporting the "focused" state even if keyboard focus already
moved on from the parent widget to another one.

Fix this by checking the item is not only selected, but its
parent also has child focus.

Tested by running this pyatspi script after a sleep and using
the time before the script actually runs to interact with the
dialog to test the different scenarios for the focused state,
using the "!" character in the dialog):

    #!/usr/bin/python3
    import pyatspi
    def get_soffice_app():
        registry = pyatspi.registry.Registry()
        apps = list(registry.getDesktop(0))
        for app in apps:
            if app.name == 'soffice' or app.name == 'soffice.bin':
                return app
        print("soffice app not found")
        exit(1)
    def get_exclamation_mark_button(acc):
        i = 0
        while i < acc.get_child_count():
            child = acc.get_child_at_index(i)
            try:
                if child.name == '!':
                    return child
            except NotImplementedError:
                pass
            recursive_child = get_exclamation_mark_button(child)
            if recursive_child:
                return recursive_child
            i = i + 1
        return None
    app = get_soffice_app()
    obj = get_exclamation_mark_button(app)
    assert obj
    states = obj.get_state_set().get_states()
    print("states:")
    print(states)

[1] https://gerrit.libreoffice.org/c/core/+/142260/22/sw/qa/extras/accessibility/dialogs.cxx

Change-Id: I277890105e3ff84ed35100b7cd7dc2ff40510921
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147660
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-24 22:29:27 +00:00
..
doc
inc BaseMutex in AccessibleTableHeaderShape is unused 2023-02-24 07:13:01 +00:00
qa SfxViewFrame* arg of SfxRequest ctor always dereferenced 2023-02-17 08:49:11 +00:00
sdi
source a11y: Fix focused state for special char dialog item 2023-02-24 22:29:27 +00:00
uiconfig/ui Fix typo 2023-02-16 10:12:14 +00:00
util
AllLangMoTarget_svx.mk
CppunitTest_svx_core.mk
CppunitTest_svx_dialogs_test.mk
CppunitTest_svx_gallery_test.mk
CppunitTest_svx_removewhichrange.mk
CppunitTest_svx_styles.mk
CppunitTest_svx_unit.mk
Executable_gengal.mk
IwyuFilter_svx.yaml
JunitTest_svx_unoapi.mk
Library_svx.mk
Library_svxcore.mk
Library_textconversiondlgs.mk
Makefile
Module_svx.mk
Package_gengal.mk
README.md
UIConfig_svx.mk
UITest_svx_table.mk

Graphics Related Helper Code

Contains graphics related helper code. Lots of the draw and impress code is in this shared library.

  • xoutdev

    this is where a lot of wht work would happen to move to the canvas. (what does that mean?)

  • svdraw

    transparent gradient stuff. [seriously? surely much more, too]

SdrObject

The shapes you can see in LibreOffice (like rectangle, etc.) are SdrObjects. They are declared as a hierarchy:

SdrObject <- SdrAttrObj <- E3dObject <- E3dCompoundObject <- E3dCubeObj
    ^ ^ ^             ^            ^              | | ^ ^
    | | |             |            |              | | | +--- E3dExtrudeObj
    | | |             |            |              | | +----- E3dLatheObj
    | | |             |            |              | +------- E3dPolygonObj
    | | |             |            |              +--------- E3dSphereObj
    | | |             |            +--- E3dScene...
    | | |             |
    | | |             +--- SdrTextObj <- SdrObjCustomShape...
    | | |                   ^ ^ ^ ^ ^
    | | |                   | | | | +--- SdrEdgeObj...
    | | |                   | | | +----- SdrMeasureObj...
    | | |                   | | +------- SdrPathObj...
    | | |                   | +--------- SdrRectObj...
    | | |                   +----------- SdrTableObj...
    | | +--- SdrObjGroup...
    | + ---- SdrPageObj...
    +------- SdrVirtObj...

The above is incomplete of course.

SdrModel / SdrView

Copied from svdview.hxx:

First of all the app creates a SdrModel. Then it opens a Win and creates a SdrView. ShowSdrPage() announces a page at SdrView. It's possible to show SdrView in any Wins at once.

SdrView can show as many Wins as it wants at once. Pages are announced or checked out with the help of ShowSdrPage()/HideSdrPage(). For every announced page there is a SdrPageView instance in container aPages. If more than one page is showed, you have to pay attention that the offset parameter of ShowSdrPage() is conformed to the size of the page (to prevent overlapping of two pages).

SdrView itself is inherited from many objects in a chain of inheritance (all that starts with SdrPaintView - that is itself inherited from few classes too):

SdrPaintView <- SdrSnapView <- SdrMarkView <- SdrEditView <- SdrPolyEditView
                                                                 ^
+----------------------------------------------------------------+
|
SdrGlueEditView <- SdrObjEditView <- SdrExchangeView <- SdrDragView
                                                                 ^
+----------------------------------------------------------------+
|
SdrCreateView <- SdrView

From SdrView on, it is not flat, but a real hierarchy again.

Drawing Layer / SdrObject(s)

See drawinglayer/README.md for general information about drawinglayer.

Below is the class diagram that comes from https://web.archive.org/web/20160827020830if_/http://www.openoffice.org:80/marketing/ooocon2006/presentations/wednesday_g11.odp slide number 6.

.------- Model --------------.      .------- View -----------------------------------------.
| SdrObject - ViewContact    | 1..* | ViewObjectContact                                    |
|              getChild()    |------|    getPrimitiveList()  -----> Object(s) ---> SdrView |
|              getVOC()      |      |    getRecPrimitiveList()      Contact                |
|              getViewInd... |      |________|_____________________________________________|
| ...ependentPrimitiveList() |               |
|____________________________|            generates
                                             |           ______
                                             V          /      |
                                   .----------------------.    |
                                   | basePrimitive        |    |
                                   |   getRange()         |<---'
                                   |   getDecomposition() |
                                   |______________________|

For SdrObjects, there are own DrawingLayer primitives in svx/source/sdr/primitive2d

The ViewContact / ViewObject / ViewObjectContact are in svx/source/sdr/contact Decomposes the SdrObjects, and does all sort of operations on them.

If the number of visualizable objects (e.g. SdrObjects) is X, and the number of SdrViews is Y, then:

  • there are X ViewContact instances (1:1 relation with a visualizable object)
  • there are Y ObjectContact instances (1:1 relation with an SdrView)
  • there are X*Y ViewObjectContact instances (1:N relation to both visualizable objects and SdrViews)