List Info

Thread: Smart Tags in Openoffice Writer




Smart Tags in Openoffice Writer
user name
2006-09-05 12:58:30
Hi Jakob,

On 09/01/06 14:54, Jakob Lechner wrote:

> We would like to implement "Smart
Tags"-like functionality in
> Openoffice Writer.
> 
> According to our current plans we want to realize this
feature as 
> described below:
> 
> 3.  In case of MS Office there are simple and complex
smarttag 
>     libraries. For simple libraries just a xml smarttag
specification
>     has to be provided (see [1]). Complex libraries
require a COM DLL 
>     that implements a special interface [2]. The
actions that can be 
>     specified with xml smarttags facilitate basically
the invokation of
>     an URL. It is though possible to include the
recognized smarttag
>     word as a parameter in the URL. In smart tag DLLs
of course
>     arbitrary actions can be programmed. In a first
step we want to
>     provide support for xml smarttags.

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?

> 6.  In order to be able to provide access to multiple
smarttag
>     libraries there should also be a Smarttag manager.
This class loads
>     available smarttag libraries implementing the
specified interface
>     and constitutes the access point to smarttag
libraries for the other
>     parts of the program. The smarttag manager should
be able handle xml
>     smarttags but later on it could be extended to deal
with UNO
>     components as well. 

See comments to 3.

> 9.  Implementation details:
> 
>     The smarttag implementation consists of three
parts:
> 
>     1. Underlining recognized smarttag terms in the
opened document.
>     2. Xml smarttag classes that process xml files,
provide the 
>         recognize function and execute the defined
actions.
>     3. GUI integration of applicable actions by a popup
menu.
> 
>     The process of recognizing and underlining words is
very similar to
>     the online spell checking function. Therefore we
would implement 
>     another list just like the wrong list that is used
for maintaining
>     misspelled words.

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?)

2. The SmartTagManager basically is a container for all
currently 
registered SmartTagLibraries. The SmartTagManager calls the
'Recognize' 
methods of all registered SmartTagLibraries.

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.

4. If the user activates the context menu over a marked
region, the 
getSmartTagRefsByWord function is called to obtain a vector
of 
SmartTagReferences

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.

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.

Best Regards,

Frank

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesw.openoffice.org
For additional commands, e-mail: dev-helpsw.openoffice.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )