Oliver Specht - Sun Germany -Hamburg wrote: >> 2) Is there an automated way to set the toolbar buttons such as bold, >> italic etc based on the current cursor position of my EditEngine, >> instead of doing it manually for all the attributes after each cursor >> movement? > The connection between editing states and toolbars/menus is done in > shells. These shells (class SfxShell) are pushed on a stack at the > SfxDispatcher (in SwView::SelectShell). Each state/execute combination > is defined in an sdi-file which determines how so called slots are > connected to the shells.
Documentation about this can be found at http://wiki.services.openoffice.org/wiki/Framework/Article/Implementation_of_the_Dispatch_API_In_SFX2 It describes how commands (e.g. buttons in toolbars) are bound to contexts implemented by classes deriving from SfxShell. >> As the writer frame does both of my questions perfectly, any hint to >> this class and relevant source code would be also helpful. > The relevant code in Writer is almost everything in sfx2/sdi/sfx.sdi, > svx/sdi/svx.sdi, sw/sdi/*.sdi, sw/source/ui/shells/*.cxx and > sw/source/ui/uiview/view.cxx SwView::SelectShell(). The "role model" implementation for a potential shell class serving your Outliner instance is the SwDrawTextShell, I assume. It serves the text editing in a Drawing Object. That should be similar to your case. A comparable shell class implementation can be used to forward everything to your outliner(s) as the SwDrawTextShell does to the EditEngine of the Drawing Object. An instance of this class must be pushed to the dispatcher stack when the focus is put into one of your Outliner instances (and some other shells must be removed from there). Once the focus is removed the shell must be popped from the stack again (and some other shells have to be pushed again, depending on where the cursor/selection is). This is the SFX style of implementing a context switch. This is what the SelectShell() method mentioned by Oliver does. > The dispatcher code is mostly in sfx2/source/control But fortunately you don't know to undestand or even read that code to use the Dispatcher. :-) Ciao, Mathias -- Mathias Bauer (mba) - Project Lead OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS Please don't reply to "[EMAIL PROTECTED]". I use it for the OOo lists and only rarely read other mails sent to it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
