These last days, I dived into the way OpenOffice.org toolbars are defined in Writer to help Maja on her problems (( See her blog post)). There are several points which were hard to guess, but the navigation toolbar is now nice and connected to the C++ code:

  • As Maja has stated it, it is necessary to set Properties node in the command definition in the XCU file. This is really strange and completely stupid, but it works.

    :::diff + + + Forward + + + 1 + +

  • The file sfx2/source/appl/workwin.cxx had to be completed to help make the equivalence between the resource ID and the toolbar name in the XML configuration.

    :::diff diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index b5a26d6..6780959 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -143,6 +143,7 @@ static const ResIdToResName pToolBarResToName[] = { 23031, "mediaobjectbar" }, //draw/impress { 25060, "mediaobjectbar" }, //calc { 23311, "mediaobjectbar" }, //writer + { 23313, "navigationobjectbar" }, //writer { 0, "" } };

The value here isn't taken out of my hat, but is the value of the RID_NAVIGATION_TOOLBOX constant registered with the navigation shell.

  • The class SwNavigationShell had to be instanciated in the SwView::SelectShell method.

The complete patch is available on my freedesktop.org account for those who want to see the code:
http://people.freedesktop.org/~cbosdo/gsoc/navigation.diff

Many thanks Thorsten to have helped me understand the horror of the toolbars.