On 2/22/10, Carsten Driesner <carsten.dries...@sun.com> wrote: > Yan Wu wrote: >> Hi, >> >> On 2/10/10, Mathias Bauer <mathias.ba...@sun.com> wrote: >> >>> Carsten Driesner wrote: >>> >>> >>>> Yan Wu wrote: >>>> >>>>> Hi Carsten, >>>>> >>>>> For the findbar feature, a shortcut key(e.g.: Ctrl+G) is defined to >>>>> set the current cursor to the EditControl of the findbar, here are two >>>>> methods to dispatch the command(e.g.: .uno:SearchText, which can be >>>>> got by the Accelerators configuration): >>>>> >>>> Hi Yan, >>>> >>>>> 1)Define the command 'SearchText' and the corresponding slotID in sdi >>>>> files and handle them via shells in swriter/scalc/simpress. >>>>> >>>> This is not an option as we need to support this command in the future >>>> for all application modules (e.g. database). >>>> >>>> >>>>> 2)Implement a DispatchProvider for command .uno:SearchText, here are >>>>> the ideas how to implement this: >>>>> - add a new unocommandsdispatcher.hxx/cxx in >>>>> framework/source/dispatch/, implement a new UNO component >>>>> UnoCommandsDispatcher, which implements interfaces XDispatchProvider >>>>> and XDispatch. In the dispatch call we can set the cursor to the >>>>> EditControl of the findbar by such way: >>>>> getLayoutManager(m_xFrame)->getElement("private:resource/toolbar/findbar")->GetWindow()->GetItemWindow(nId)->GrabFocus(). >>>>> >>>> I am sorry, but I don't like this idea either. This is clearly a hack as >>>> we add special code in a generic implementation. Best way would be to >>>> implement a ProtocolHandler in svx for the find bar. That's something we >>>> can extend as we like and we don't need to change generic code. You can >>>> find more information about ProtocolHandler in the Developer's Guide. >>>> It's also possible to use the skeleton-maker from the OpenOfficr.org >>>> SDK. >>>> >>> Maybe a ProtocolHandler is a little bit too much for that? I agree that >>> special functionality shouldn't be implemented in a generic >>> implementation, but forwarding calls to a dispatcher for generic >>> commands isn't what I would call a "hack". >>> >>> The sfx2 based dispatch mechanism solved that problem with >>> implementation inheritance, our UNO based mechanism can't (and >>> shouldn't) do that. But what about this: our sfx based documents don't >>> implement the UNO Dispatch API themselves, the sfx provides a generic >>> implementation that maps the API to the old sfx dispatching (using >>> slots). We could add the said generic UnoCommandsDispatcher here and >>> Base could do the same in its own implementation of the UNO dispatch >>> API. Thus we replace implementation inheritance by containment. >>> >>> >> >> Currently we have to implement a new ProtocolHandler for a new >> functionality. Yes, I also think the said generic >> UnoCommandsDispatcher could be used to handle those commands which >> can't be mapped to the old sfx dispatching. >> And DispatchProvider::implts_queryFrameDispatch(...) should be the >> right place to forward such commands, >> e.g.:'.uno:SearchText'/'.uno:FocusToFindbar'/..., to the >> UnoCommandsDispatcher, which will be implemented in >> framework/source/dispatch/unocommandsdispatcher. Right? >> > Hi Yan, > > That could be a way to implement such a uno-command dispatcher. > Currently this is not as important as the find bar feature. I would like > you to help Shizhoubo exclusively to finalize the implementation. The > recovery effort can be put on hold as Frank already did most of the > necessary work. > Hi Carsten,
OK. The patch, which was sent to you by Shizhoubo before our vacation here, already contains the implementation of the ProtocolHandler for shortcut Ctrl+G and command vnd.sun.star.findbar:FocusToFindbar. The might be bugs will be fixed later. > Regards, > Carsten > Regards, Yan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@framework.openoffice.org For additional commands, e-mail: dev-h...@framework.openoffice.org