Am Dienstag, den 05.09.2006, 14:58 +0200 schrieb Frank Meies: > [...] > But both the 'xml files smarttags' and the complex smarttag libraries > will implement the SmartTagLib interface, is this correct? From this > point of view there actually is no difference between these two. So we > would have to focus on the design of the SmartTagLib interface and its > usage in the Writer, and the xml smarttags thing is first concrete > implementation of the interface, right?
Exactly! > [...] > Let me sum this up and add some comments to see if I understood your > design correctly: > > 1. If the user types a word, the SmartTagManager is called from the > Writer core to check if there are any SmartTags available in the current > word (or better paragraph and start/end indices to avoid string > operations? Could be done per paragraph during idle time. Should we pass > the current locale to the Recognize function?) I'm implementing the scanning procedure for smarttags in the same way like the procedure of the online spellchecker (that scans for misspelled words) is implemented. In case of spell checking the "isValid" method of the spellchecker is called. In the smarttag procedure the recognize function of the SmartTagManager is called. Yes, you are right: The locale should be passed on to the recognize method. Furthermore every smarttag library should have a "getLocale" method, so the SmartTagManager can decide if a specific smarttag is relevant for the word that was passed on to the recognize method. > 2. The SmartTagManager basically is a container for all currently > registered SmartTagLibraries. The SmartTagManager calls the 'Recognize' > methods of all registered SmartTagLibraries. Yes. > 3. If the recognize function of any of the registered SmartTagLibraries > returns 'true', the current text region is stored in a list similar to > the current wrong list. The regions stored in this list will be marked > in a special way during painting. Yes. > 4. If the user activates the context menu over a marked region, the > getSmartTagRefsByWord function is called to obtain a vector of > SmartTagReferences Yes. > 5. For each SmartTagReference in this vector, a string/action pair is > obtained from the associated SmartTagLibrary, the strings will appear in > the context menu and the invokeAction function will be triggered if a > context menu entry is invoked. A UNO textrange object can be passed as a > parameter of the invokeAction function to enable the SmartTagLibrary to > change the text etc. Passing a textrange... hmm, nice idea. At the moment I've just considered to pass the word as a string because this is what is needed for xml smarttags. But for complex smarttags passing a textrange object would be a better solution. > One more idea: What about separating the SmartTagLibrary interface into > a Recognizer and Action part, the way MS does? This way it would be > easier for external developers to implement new smart tag libraries for > both MS Office and OpenOffice.org. Yes, that's a good point :) Thanks for your comments! I'll take them into consideration. Best regards -- Jakob Lechner Research & Development Fabalabs Software GmbH Honauerstraße 4 A-4020 Linz Tel.: [+43] (70) 60 61 62 Fax: [+43] (70) 60 61 62-609 E-Mail: [EMAIL PROTECTED] Web: http://www.fabalabs.org --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
