<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jlechner</id>
	<title>Apache OpenOffice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jlechner"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/Jlechner"/>
	<updated>2026-11-28T18:50:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=26130</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=26130"/>
		<updated>2007-02-28T20:03:03Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: /* XML based Smart Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and furthermore allow to execute certain actions for a recognized word. Experimental support for smart tags is included in the OpenOffice.org 2.2 release, thanks to a code contribution by [http://www.fabalabs.org Fabalabs Software GmbH]. In order to use this functionality, external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your installation of OpenOffice.org. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because they are still work in progress. So be aware that you may have to modify the code of your components if you want to use them with the next release of OpenOffice.org. Smart tag extensions (aka packages) must set the version dependency to 2.2.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in OpenOffice.org its recognize() method will be invoked by OpenOffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in OpenOffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XML based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In some cases you just want to match a list of words or regular expressions and open some URL associated with these words. For such simple smart tag components Microsoft Office provides the possiblity to define a recognizer or an action library with a XML schema. These simple smart tag descriptions are called &amp;quot;Microsoft Office Smart Tag Lists&amp;quot; (MOSTL). Below you can find an example XML description which defines some OOo related terms and some actions involving OOo websites. The XML description is pretty self-explanatory. As mentioned it is also possible to specify regular expressions in order to recognize certain word patterns. If you want to see how regular expressions are defined have a look at this [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/odc_regex_smarttags_2003.asp site].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;FL:smarttaglist xmlns:FL=&amp;quot;http://schemas.microsoft.com/office/smarttags/2003/mostl&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FL:name&amp;gt;OOo Smart Tags&amp;lt;/FL:name&amp;gt; &lt;br /&gt;
&amp;lt;FL:lcid&amp;gt;1033&amp;lt;/FL:lcid&amp;gt;&lt;br /&gt;
&amp;lt;FL:description&amp;gt;OOo Smart Tags&amp;lt;/FL:description&amp;gt;&lt;br /&gt;
&amp;lt;FL:smarttag type=&amp;quot;urn:schemas-openoffice-org:smarttags#ooo&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;FL:caption&amp;gt;OOo Smart Tags&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
    &amp;lt;FL:terms&amp;gt;&lt;br /&gt;
        &amp;lt;FL:termlist&amp;gt;OpenOffice.org, Writer, OOo, UNO&amp;lt;/FL:termlist&amp;gt;&lt;br /&gt;
    &amp;lt;/FL:terms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;FL:actions&amp;gt;&lt;br /&gt;
        &amp;lt;FL:action id=&amp;quot;ooo1&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;OpenOffice.org Homepage&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://www.openoffice.org&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
        &amp;lt;FL:action id=&amp;quot;ooo2&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;Download OpenOffice.org&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://download.openoffice.org/index.html&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
	&amp;lt;FL:action id=&amp;quot;ooo3&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;Search in OOo Wiki&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://wiki.services.openoffice.org/wiki/Special:Search?search={TEXT}&amp;amp;amp;fulltext=Search&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
    &amp;lt;/FL:actions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/FL:smarttag&amp;gt;&lt;br /&gt;
&amp;lt;/FL:smarttaglist&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to use XML based smart tags with OpenOffice.org a smart tag component was written which implements the Recognizer and Action Library interfaces as described in the sections above. This component parses XML files which comply with the MOSTL schema. The behavior of the recognize and the invokeAction methods is determined by the given XML description. The XML files currently have to reside in a subfolder called &amp;quot;smarttags&amp;quot; in the &amp;quot;share&amp;quot; folder of your OOo installation. For each XML file in this directory OOo Writer creates an instance of the MOSTL Smart Tag component.&lt;br /&gt;
&lt;br /&gt;
The source code of the MOSTL Smart Tag component can be found here: [[Media:mostl.tar.gz]]&lt;br /&gt;
&lt;br /&gt;
The MOSTL component depends on the [http://xmlsoft.org/ libxml] library and can be compiled with [http://download.openoffice.org/index.html OpenOffice.org SDK].&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
*[[Constructing_Components|Great tutorial about constucting UNO components]]&lt;br /&gt;
*[http://blogs.sun.com/GullFOSS/entry/successful_community_project_smart_tags Blog entry about smart tag project]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=26129</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=26129"/>
		<updated>2007-02-28T19:56:53Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: /* XML based Smart Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and furthermore allow to execute certain actions for a recognized word. Experimental support for smart tags is included in the OpenOffice.org 2.2 release, thanks to a code contribution by [http://www.fabalabs.org Fabalabs Software GmbH]. In order to use this functionality, external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your installation of OpenOffice.org. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because they are still work in progress. So be aware that you may have to modify the code of your components if you want to use them with the next release of OpenOffice.org. Smart tag extensions (aka packages) must set the version dependency to 2.2.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in OpenOffice.org its recognize() method will be invoked by OpenOffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in OpenOffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XML based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In some cases you just want to match a list of words or regular expressions and open some URL associated with these words. For such simple smart tag components Microsoft Office provides the possiblity to define a recognizer or an action library with a xml schema. These simple smart tag descriptions are called &amp;quot;Microsoft Office Smart Tag Lists&amp;quot; (MOSTL). Below you can find an xml description which defines some OOo related terms and some actions involving OOo websites. The xml description is pretty self-explanatory. As mentioned it is also possible to specify regular expressions in order to recognize certain word patterns. If you want to see how regular expressions are defined have a look at this [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/odc_regex_smarttags_2003.asp site].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;FL:smarttaglist xmlns:FL=&amp;quot;http://schemas.microsoft.com/office/smarttags/2003/mostl&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FL:name&amp;gt;OOo Smart Tags&amp;lt;/FL:name&amp;gt; &lt;br /&gt;
&amp;lt;FL:lcid&amp;gt;1033&amp;lt;/FL:lcid&amp;gt;&lt;br /&gt;
&amp;lt;FL:description&amp;gt;OOo Smart Tags&amp;lt;/FL:description&amp;gt;&lt;br /&gt;
&amp;lt;FL:smarttag type=&amp;quot;urn:schemas-openoffice-org:smarttags#ooo&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;FL:caption&amp;gt;OOo Smart Tags&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
    &amp;lt;FL:terms&amp;gt;&lt;br /&gt;
        &amp;lt;FL:termlist&amp;gt;OpenOffice.org, Writer, OOo, UNO&amp;lt;/FL:termlist&amp;gt;&lt;br /&gt;
    &amp;lt;/FL:terms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;FL:actions&amp;gt;&lt;br /&gt;
        &amp;lt;FL:action id=&amp;quot;ooo1&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;OpenOffice.org Homepage&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://www.openoffice.org&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
        &amp;lt;FL:action id=&amp;quot;ooo2&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;Download OpenOffice.org&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://download.openoffice.org/index.html&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
	&amp;lt;FL:action id=&amp;quot;ooo3&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;Search in OOo Wiki&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://wiki.services.openoffice.org/wiki/Special:Search?search={TEXT}&amp;amp;amp;fulltext=Search&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
    &amp;lt;/FL:actions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/FL:smarttag&amp;gt;&lt;br /&gt;
&amp;lt;/FL:smarttaglist&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to use XML based smart tags with OpenOffice.org a smart tag component was written which implements the Recognizer and Action Library interfaces as described in the sections above. This component parses xml files which comply with the MOSTL schema. The behavior of the recognize and the invokeAction methods is determined by the given xml description. The xml files currrently have to reside in a subfolder called &amp;quot;smarttags&amp;quot; in the &amp;quot;share&amp;quot; folder of your OOo installation. For each xml file in this directory OOo Writer creates an instance of the MOSTL Smart Tag component.&lt;br /&gt;
&lt;br /&gt;
The source code of the MOSTL Smart Tag component can be found here: [[Media:mostl.tar.gz]]&lt;br /&gt;
&lt;br /&gt;
The MOSTL component depends on the libxml library and can be compiled with OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
*[[Constructing_Components|Great tutorial about constucting UNO components]]&lt;br /&gt;
*[http://blogs.sun.com/GullFOSS/entry/successful_community_project_smart_tags Blog entry about smart tag project]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=26127</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=26127"/>
		<updated>2007-02-28T19:54:35Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: /* XML based Smart Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and furthermore allow to execute certain actions for a recognized word. Experimental support for smart tags is included in the OpenOffice.org 2.2 release, thanks to a code contribution by [http://www.fabalabs.org Fabalabs Software GmbH]. In order to use this functionality, external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your installation of OpenOffice.org. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because they are still work in progress. So be aware that you may have to modify the code of your components if you want to use them with the next release of OpenOffice.org. Smart tag extensions (aka packages) must set the version dependency to 2.2.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in OpenOffice.org its recognize() method will be invoked by OpenOffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in OpenOffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XML based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In some cases you just want to match a list of words or regular expressions and open some URL associated with these words. For such simple smart tag components Microsoft Office provides the possiblity to define a recognizer or an action library with a xml schema. These simple smart tag descriptions are called &amp;quot;Microsoft Office Smart Tag Lists&amp;quot; (MOSTL). Below you can find an xml description which defines some OOo related terms and some actions involving OOo websites. The xml description is pretty self-explanatory. As mentioned it is also possible to specify regular expressions in order to recognize certain word patterns. If you want to see how regular expressions are defined have a look at this [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/odc_regex_smarttags_2003.asp site].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[xml]&lt;br /&gt;
&amp;lt;FL:smarttaglist xmlns:FL=&amp;quot;http://schemas.microsoft.com/office/smarttags/2003/mostl&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;FL:name&amp;gt;OOo Smart Tags&amp;lt;/FL:name&amp;gt; &lt;br /&gt;
&amp;lt;FL:lcid&amp;gt;1033&amp;lt;/FL:lcid&amp;gt;&lt;br /&gt;
&amp;lt;FL:description&amp;gt;OOo Smart Tags&amp;lt;/FL:description&amp;gt;&lt;br /&gt;
&amp;lt;FL:smarttag type=&amp;quot;urn:schemas-openoffice-org:smarttags#ooo&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;FL:caption&amp;gt;OOo Smart Tags&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
    &amp;lt;FL:terms&amp;gt;&lt;br /&gt;
        &amp;lt;FL:termlist&amp;gt;OpenOffice.org, Writer, OOo, UNO&amp;lt;/FL:termlist&amp;gt;&lt;br /&gt;
    &amp;lt;/FL:terms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;FL:actions&amp;gt;&lt;br /&gt;
        &amp;lt;FL:action id=&amp;quot;ooo1&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;OpenOffice.org Homepage&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://www.openoffice.org&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
        &amp;lt;FL:action id=&amp;quot;ooo2&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;Download OpenOffice.org&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://download.openoffice.org/index.html&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
	&amp;lt;FL:action id=&amp;quot;ooo3&amp;quot;&amp;gt; &lt;br /&gt;
          &amp;lt;FL:caption&amp;gt;Search in OOo Wiki&amp;lt;/FL:caption&amp;gt;&lt;br /&gt;
          &amp;lt;FL:url&amp;gt;http://wiki.services.openoffice.org/wiki/Special:Search?search={TEXT}&amp;amp;amp;fulltext=Search&amp;lt;/FL:url&amp;gt;&lt;br /&gt;
        &amp;lt;/FL:action&amp;gt;&lt;br /&gt;
    &amp;lt;/FL:actions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/FL:smarttag&amp;gt;&lt;br /&gt;
&amp;lt;/FL:smarttaglist&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to use XML based smart tags with OpenOffice.org a smart tag component was written which implements the Recognizer and Action Library interfaces as described in the sections above. This component parses xml files which comply with the MOSTL schema. The behavior of the recognize and the invokeAction methods is determined by the given xml description. The xml files currrently have to reside in a subfolder called &amp;quot;smarttags&amp;quot; in the &amp;quot;share&amp;quot; folder of your OOo installation. For each xml file in this directory OOo Writer creates an instance of the MOSTL Smart Tag component.&lt;br /&gt;
&lt;br /&gt;
The source code of the MOSTL Smart Tag component can be found here: [[Media:mostl.tar.gz]]&lt;br /&gt;
The MOSTL component depends on the libxml library and can be compiled with OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
*[[Constructing_Components|Great tutorial about constucting UNO components]]&lt;br /&gt;
*[http://blogs.sun.com/GullFOSS/entry/successful_community_project_smart_tags Blog entry about smart tag project]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=25678</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=25678"/>
		<updated>2007-02-22T13:37:27Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and furthermore allow to execute certain actions for a recognized word. Experimental support for smart tags is included in the OpenOffice.org 2.2 release, thanks to a code contribution by [http://www.fabalabs.org Fabalabs Software GmbH]. In order to use this functionality, external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your installation of OpenOffice.org. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because they are still work in progress. So be aware that you may have to modify the code of your components if you want to use them with the next release of OpenOffice.org. Smart tag extensions (aka packages) must set the version dependency to 2.2.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in OpenOffice.org its recognize() method will be invoked by OpenOffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in OpenOffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XML based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In some cases you just want to match a list of words or regular expressions and open some URL associated with these words. For such simple smart tag components Microsoft Office provides the possiblity to define a recognizer or an action library with a xml schema. These simple smart tag descriptions are called &amp;quot;Microsoft Office Smart Tag Lists&amp;quot; (MOSTL).&lt;br /&gt;
&lt;br /&gt;
In order to use XML based smart tags with OpenOffice.org a smart tag component was written which implements the Recognizer and Action Library interfaces as described above. This component parses xml files which comply with the MOSTL schema. The behavior of the recognize and the invokeAction methods is determined by the given xml description. The xml files currrently have to reside in a subfolder called &amp;quot;smarttags&amp;quot; in the &amp;quot;share&amp;quot; folder of your OOo installation. For each xml file in this directory OOo Writer creates an instance of the MOSTL Smart Tag component.&lt;br /&gt;
&lt;br /&gt;
The source code of the MOSTL Smart Tag component can be found here ... TODO!&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
*[[Constructing_Components|Great tutorial about constucting UNO components]]&lt;br /&gt;
*[http://blogs.sun.com/GullFOSS/entry/successful_community_project_smart_tags Blog entry about smart tag project]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=25191</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=25191"/>
		<updated>2007-02-14T19:04:51Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Description of MOSTL smart tags&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and furthermore allow to execute certain actions for a recognized word. Experimental support for smart tags is included in the OpenOffice.org 2.2 release. In order to use this functionality, external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your installation of OpenOffice.org. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because they are still work in progress. So be aware that you may have to modify the code of your components if you want to use them with the next release of OpenOffice.org. Smart tag extensions (aka packages) must set the version dependency to 2.2.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in OpenOffice.org its recognize() method will be invoked by OpenOffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in OpenOffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XML based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In some cases you just want to match a list of words or regular expressions and open some URL associated with these words. For such simple smart tag components Microsoft Office provides the possiblity to define a recognizer or an action library with a xml schema. These simple smart tag descriptions are called &amp;quot;Microsoft Office Smart Tag Lists&amp;quot; (MOSTL).&lt;br /&gt;
&lt;br /&gt;
In order to use XML based smart tags with OpenOffice.org a smart tag component was written which implements the Recognizer and Action Library interfaces as described above. This component parses xml files which comply with the MOSTL schema. The behavior of the recognize and the invokeAction methods is determined by the given xml description. The xml files currrently have to reside in a subfolder called &amp;quot;smarttags&amp;quot; in the &amp;quot;share&amp;quot; folder of your OOo installation. For each xml file in this directory OOo Writer creates an instance of the MOSTL Smart Tag component.&lt;br /&gt;
&lt;br /&gt;
The source code of the MOSTL Smart Tag component can be found here ... TODO!&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
*[[Constructing_Components|Great tutorial about constucting UNO components]]&lt;br /&gt;
*[http://blogs.sun.com/GullFOSS/entry/successful_community_project_smart_tags Blog entry about smart tag project]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24102</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24102"/>
		<updated>2007-01-30T14:44:51Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and furthermore allow to execute certain actions for a recognized word. Experimental support for smart tags is included in the OpenOffice.org 2.2 release. In order to use this functionality, external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your installation of OpenOffice.org. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because they are still work in progress. So be aware that you may have to modify the code of your components if you want to use them with the next release of OpenOffice.org. Smart tag extensions (aka packages) must set the version dependency to 2.2.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in OpenOffice.org its recognize() method will be invoked by OpenOffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in OpenOffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by OpenOffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Xml based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In this section recognizer and action components for xml based smart tags are presented. In some cases you just want to match a list of words or regular expressions and open some URL associated with these words....&lt;br /&gt;
TODO!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
*[[Constructing_Components|Great tutorial about constucting UNO components]]&lt;br /&gt;
*[http://blogs.sun.com/GullFOSS/entry/successful_community_project_smart_tags Blog entry about smart tag project]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24099</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24099"/>
		<updated>2007-01-30T14:41:53Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and furthermore allow to execute certain actions for a recognized word. Experimental support for smart tags is included in the OpenOffice.org 2.2 release. In order to use this functionality, external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your installation of OpenOffice.org. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because they are still work in progress. So be aware that you may have to modify the code of your components if you want to use them with the next release of OpenOffice.org. Smart tag extensions (aka packages) must set the version dependency to 2.2.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Xml based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In this section recognizer and action components for xml based smart tags are presented. In some cases you just want to match a list of words or regular expressions and open some URL associated with these words....&lt;br /&gt;
TODO!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
*[[Constructing_Components|Great tutorial about constucting UNO components]]&lt;br /&gt;
*[http://blogs.sun.com/GullFOSS/entry/successful_community_project_smart_tags Blog entry about smart tag project]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24096</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24096"/>
		<updated>2007-01-30T12:07:32Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Added &amp;quot;see also&amp;quot; section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Xml based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In this section recognizer and action components for xml based smart tags are presented. In some cases you just want to match a list of words or regular expressions and open some URL associated with these words....&lt;br /&gt;
TODO!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
*[[Constructing_Components|Great tutorial about constucting UNO components]]&lt;br /&gt;
*[http://blogs.sun.com/GullFOSS/entry/successful_community_project_smart_tags Blog entry about smart tag project]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24095</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24095"/>
		<updated>2007-01-30T12:03:12Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Added section for xml based smart tags&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Xml based Smart Tags==&lt;br /&gt;
&lt;br /&gt;
In this section recognizer and action components for xml based smart tags are presented. In some cases you just want to match a list of words or regular expressions and open some URL associated with these words....&lt;br /&gt;
TODO!&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24094</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24094"/>
		<updated>2007-01-30T11:57:04Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Added code listing for example action lib&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document Properties Smart Tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. With different implementation names multiple recognizer components can be installed on your system in parallel. The implementation name of this example is  &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Action Library===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing an action library is quite similar to implementing the recognizer. Of course you have to support the action service instead of the recongizer service. Thus the appropriate service name is &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;. The implementation name of the action component has to be different too. In this expample the name &amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot; was chosen. But the name of the smart tag this components provides actions for has to be the same name used in the recognizer component (i.e. &amp;quot;example_smarttag&amp;quot;). Since this component just provides actions for one smart tag type the getSmartTagCount() method returns 1. And for this single smart tag the component just provides one action, as you can see in the invokeAction() method. This action retrieves the value of document property which was recognized and inserts it just behind the recognized word.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Class definition of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
class ExampleActionlib : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagAction, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleActionlib();&lt;br /&gt;
  &lt;br /&gt;
  // XSmartTagAction&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName( sal_Int32 nSmartTagIndex ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getActionCount( sal_Int32 nSmartTagIndex,&lt;br /&gt;
					   const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual OUString SAL_CALL getActionCaption( sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
					    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL invokeAction (sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
				      const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Method implementation of ExampleActionlib&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.action.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_ACTION  &amp;quot;com.sun.star.smarttags.SmartTagAction&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleActionlib::ExampleActionlib(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							  const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Int32 SAL_CALL ExampleActionlib::getActionCount(sal_Int32 nSmartTagIndex,&lt;br /&gt;
						    const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) &lt;br /&gt;
    return 1;&lt;br /&gt;
  else&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getActionCaption(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex,&lt;br /&gt;
						     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    switch (nActionIndex) {&lt;br /&gt;
    case 0:&lt;br /&gt;
      return C2U(&amp;quot;Insert document property value&amp;quot;);&lt;br /&gt;
      break;&lt;br /&gt;
    default:&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL ExampleActionlib::invokeAction(sal_Int32 nSmartTagIndex, sal_Int32 nActionIndex, &lt;br /&gt;
					     const Reference&amp;lt; XTextRange &amp;gt;&amp;amp; xRange, &lt;br /&gt;
					     const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  &lt;br /&gt;
  if (!xController.is()) return;&lt;br /&gt;
  Reference&amp;lt;XModel&amp;gt; xModel = xController-&amp;gt;getModel();&lt;br /&gt;
  if (!xModel.is()) return;&lt;br /&gt;
  Reference&amp;lt;XTextDocument&amp;gt; xTextDocument (xModel, UNO_QUERY);&lt;br /&gt;
  if (!xTextDocument.is()) return;&lt;br /&gt;
&lt;br /&gt;
  if (nSmartTagIndex == 0) {&lt;br /&gt;
    if (nActionIndex == 0) {&lt;br /&gt;
      Reference&amp;lt;XDocumentInfoSupplier&amp;gt; xDocInfoSupplier (xTextDocument, UNO_QUERY);&lt;br /&gt;
      if(!xDocInfoSupplier.is()) return;&lt;br /&gt;
      Reference&amp;lt;XDocumentInfo&amp;gt; xDocInfo = xDocInfoSupplier-&amp;gt;getDocumentInfo();&lt;br /&gt;
      if(!xDocInfo.is()) return;&lt;br /&gt;
      Reference&amp;lt;XPropertySet&amp;gt; xProps (xDocInfo, UNO_QUERY);&lt;br /&gt;
      if (!xProps.is()) return;&lt;br /&gt;
      Any a = xProps-&amp;gt;getPropertyValue(xRange-&amp;gt;getString());&lt;br /&gt;
      OUString s;&lt;br /&gt;
      a &amp;gt;&amp;gt;= s;&lt;br /&gt;
      if (s) {&lt;br /&gt;
	Reference&amp;lt;XTextCursor&amp;gt; xCursor = xRange-&amp;gt;getText()-&amp;gt;createTextCursorByRange(xRange-&amp;gt;getEnd());&lt;br /&gt;
	// check if colon follows word&lt;br /&gt;
	xCursor-&amp;gt;goRight(1, sal_True);&lt;br /&gt;
	if (xCursor-&amp;gt;getString().indexOf(C2U(&amp;quot;:&amp;quot;)) != -1)  {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xCursor-&amp;gt;getEnd(), C2U(&amp;quot; &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
	  xTextDocument-&amp;gt;getText()-&amp;gt;insertString(xRange-&amp;gt;getEnd(), C2U(&amp;quot;: &amp;quot;) + s, sal_False);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
      }   &lt;br /&gt;
    }   &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleActionlib::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleActionlib::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleActionlib::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleActionlib::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleActionlib::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleActionlib::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_ACTION );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleActionlib::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleActionlib::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleActionlib_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagAction*&amp;gt;(new ExampleActionlib(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleActionlib::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleActionlib::getImplementationName_Static(),&lt;br /&gt;
           ExampleActionlib_create,&lt;br /&gt;
           ExampleActionlib::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24090</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24090"/>
		<updated>2007-01-30T11:22:44Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Added code listing for example recognizer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;br /&gt;
&lt;br /&gt;
==Document properties smart tag==&lt;br /&gt;
&lt;br /&gt;
===Recognizer===&lt;br /&gt;
&lt;br /&gt;
As described above the recognizer matches document property keywords like title, author, description etc. The matching of scanned words of the current document is done by the Recognize() method as you can see below. This recognizer component contains just one smart tag type. Thus the getSmartTagCount() method returns 1. The name of this recognizer (&amp;quot;example_smarttag&amp;quot;) is returned by the method getSmartTagName(). Of course this component needs to suuport the SmartTagRecognizer service. Therefore the getSupportedServiceNames() method has to return a sequence containing the appropriate service name (&amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;). Each UNO component needs an unique implementation name. You can write different recognizer components with different implmentation names and install them all in the same Openoffice. The implementation name of this example is &amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
&lt;br /&gt;
// Listing: Class definition of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
class ExampleRecognizer : public ::cppu::WeakImplHelper2&amp;lt;&lt;br /&gt;
  com::sun::star::smarttags::XSmartTagRecognizer, XServiceInfo&amp;gt; {&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  OUString aName;&lt;br /&gt;
  OUString aDescription;&lt;br /&gt;
  Reference&amp;lt; XMultiServiceFactory &amp;gt; xServiceManager;&lt;br /&gt;
public:&lt;br /&gt;
  ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager);&lt;br /&gt;
  ~ExampleRecognizer();&lt;br /&gt;
&lt;br /&gt;
  // XSmartTagRecognizer&lt;br /&gt;
  virtual inline OUString SAL_CALL getName() throw (RuntimeException) { return aName; }&lt;br /&gt;
  virtual OUString SAL_CALL getDescription() throw (RuntimeException) { return aDescription; }&lt;br /&gt;
  virtual sal_Int32 SAL_CALL getSmartTagCount() throw (RuntimeException) { return 1; }  &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagName (sal_Int32 nSmartTagIndex) throw (RuntimeException); &lt;br /&gt;
  virtual OUString SAL_CALL getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController ) throw (RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex,&lt;br /&gt;
				      const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException);&lt;br /&gt;
  virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence&amp;lt; ::com::sun::star::uno::Any &amp;gt;&amp;amp; aArguments ) &lt;br /&gt;
             throw (RuntimeException);&lt;br /&gt;
&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
  // Service specific part&lt;br /&gt;
  ////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
  // XServiceInfo&lt;br /&gt;
  virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);&lt;br /&gt;
  virtual sal_Bool SAL_CALL supportsService( const OUString&amp;amp; rServiceName ) &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  virtual Sequence&amp;lt; OUString &amp;gt; SAL_CALL getSupportedServiceNames() &lt;br /&gt;
    throw(RuntimeException);&lt;br /&gt;
  static inline OUString getImplementationName_Static() throw();&lt;br /&gt;
  static Sequence&amp;lt; OUString &amp;gt; getSupportedServiceNames_Static() throw();&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// Listing: Methods implementation of ExampleRecognizer&lt;br /&gt;
&lt;br /&gt;
#define C2U(cChar) OUString::createFromAscii(cChar)&lt;br /&gt;
&lt;br /&gt;
#define IMPLNAME	&amp;quot;org.openoffice.comp.smarttags.recognizer.example&amp;quot;&lt;br /&gt;
#define SN_SMARTTAG_RECOGNIZER  &amp;quot;com.sun.star.smarttags.SmartTagRecognizer&amp;quot;&lt;br /&gt;
#define SMARTTAG_NAME C2U(&amp;quot;example_smarttag&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ExampleRecognizer::ExampleRecognizer(Reference&amp;lt; XMultiServiceFactory &amp;gt; _xServiceManager) {&lt;br /&gt;
  xServiceManager = _xServiceManager;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagName( sal_Int32 nSmartTagIndex) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex == 0)&lt;br /&gt;
    return SMARTTAG_NAME;&lt;br /&gt;
  else&lt;br /&gt;
    return C2U(&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getSmartTagCaption( sal_Int32 nSmartTagIndex,&lt;br /&gt;
							 const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  return C2U(&amp;quot;Document Properties&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::Recognize(const OUString&amp;amp; aWord, sal_Int32 nSmartTagIndex, &lt;br /&gt;
						const Reference&amp;lt; XController &amp;gt;&amp;amp; xController) throw (RuntimeException) {&lt;br /&gt;
  if (nSmartTagIndex !=  0) return sal_False;&lt;br /&gt;
&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Title&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Author&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Keywords&amp;quot;))) return sal_True;&lt;br /&gt;
  if (aWord.equalsIgnoreAsciiCase(C2U(&amp;quot;Description&amp;quot;))) return sal_True;&lt;br /&gt;
  return sal_False;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void ExampleRecognizer::initialize( const Sequence&amp;lt; Any &amp;gt;&amp;amp; aArguments ) throw (RuntimeException) {&lt;br /&gt;
  // empty&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Service specific part&lt;br /&gt;
///////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
OUString SAL_CALL ExampleRecognizer::getImplementationName() throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getImplementationName_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
inline OUString ExampleRecognizer::getImplementationName_Static() throw()&lt;br /&gt;
{&lt;br /&gt;
  return C2U(IMPLNAME);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sal_Bool SAL_CALL ExampleRecognizer::supportsService( const OUString&amp;amp; ServiceName )&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNL = getSupportedServiceNames();&lt;br /&gt;
  const OUString * pArray = aSNL.getConstArray();&lt;br /&gt;
  for( INT32 i = 0; i &amp;lt; aSNL.getLength(); i++ )&lt;br /&gt;
    if( pArray[i] == ServiceName )&lt;br /&gt;
      return TRUE;&lt;br /&gt;
  return FALSE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; SAL_CALL ExampleRecognizer::getSupportedServiceNames()&lt;br /&gt;
  throw(RuntimeException)&lt;br /&gt;
{&lt;br /&gt;
  return getSupportedServiceNames_Static();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; ExampleRecognizer::getSupportedServiceNames_Static() &lt;br /&gt;
  throw()&lt;br /&gt;
{&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; aSNS( 1 );&lt;br /&gt;
  aSNS.getArray()[0] = C2U( SN_SMARTTAG_RECOGNIZER );&lt;br /&gt;
  return aSNS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/,&lt;br /&gt;
					 registry::XRegistryKey * pRegistryKey ) {&lt;br /&gt;
  try {&lt;br /&gt;
    String aImpl( &amp;#039;/&amp;#039; );&lt;br /&gt;
    aImpl += ExampleRecognizer::getImplementationName_Static().getStr();&lt;br /&gt;
    aImpl.AppendAscii( &amp;quot;/UNO/SERVICES&amp;quot; );&lt;br /&gt;
    Reference&amp;lt; registry::XRegistryKey &amp;gt; xNewKey =&lt;br /&gt;
      pRegistryKey-&amp;gt;createKey( aImpl );&lt;br /&gt;
    Sequence&amp;lt; OUString &amp;gt; aServices =&lt;br /&gt;
      ExampleRecognizer::getSupportedServiceNames_Static();&lt;br /&gt;
    for( INT32 i = 0; i &amp;lt; aServices.getLength(); i++ )&lt;br /&gt;
      xNewKey-&amp;gt;createKey( aServices.getConstArray()[i] );&lt;br /&gt;
    &lt;br /&gt;
    return sal_True;&lt;br /&gt;
  }&lt;br /&gt;
  catch(Exception &amp;amp;) {&lt;br /&gt;
    return sal_False;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XInterface &amp;gt; SAL_CALL ExampleRecognizer_create(&lt;br /&gt;
	const Reference&amp;lt; XMultiServiceFactory &amp;gt; &amp;amp; xMgr )&lt;br /&gt;
{&lt;br /&gt;
  Reference&amp;lt;XInterface&amp;gt; ref (static_cast&amp;lt;XSmartTagRecognizer*&amp;gt;(new ExampleRecognizer(xMgr)));&lt;br /&gt;
  return ref;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
extern &amp;quot;C&amp;quot; void * SAL_CALL component_getFactory(&lt;br /&gt;
    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )&lt;br /&gt;
{&lt;br /&gt;
    void * pRet = 0;&lt;br /&gt;
    // which implementation is required?&lt;br /&gt;
    if (pServiceManager &amp;amp;&amp;amp; ( !ExampleRecognizer::getImplementationName_Static().compareToAscii( pImplName ) ) )&lt;br /&gt;
    {&lt;br /&gt;
        Reference&amp;lt; XSingleServiceFactory &amp;gt; xFactory(&lt;br /&gt;
           cppu::createSingleFactory( // helper function from cppuhelper lib&lt;br /&gt;
           reinterpret_cast&amp;lt; XMultiServiceFactory * &amp;gt;( pServiceManager ),&lt;br /&gt;
           ExampleRecognizer::getImplementationName_Static(),&lt;br /&gt;
           ExampleRecognizer_create,&lt;br /&gt;
           ExampleRecognizer::getSupportedServiceNames_Static() ) );&lt;br /&gt;
        if (xFactory.is())&lt;br /&gt;
        {&lt;br /&gt;
           xFactory-&amp;gt;acquire();&lt;br /&gt;
           pRet = xFactory.get();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return pRet;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24089</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24089"/>
		<updated>2007-01-30T10:48:51Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Added examples chapter&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Example implementations=&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24088</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24088"/>
		<updated>2007-01-30T10:44:13Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Added interface description for action libraries&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Action Library Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the action library interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagAction.idl page].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the action library component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this action component. This name is needed to associate the actions of a smart tag with the corresponding recognizer.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this action component. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getActionCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the number of available actions of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getActionCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This function returns the caption of an action of one specific smart tag in this action library.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void invokeAction()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;4&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nActionIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted action. Value needs to be between 0 and the number of actions available for the specified smart tag (nSmartTagIndex).&lt;br /&gt;
 |-&lt;br /&gt;
 | string aWord: Word that was recognized as actionable.&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the action library component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24087</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24087"/>
		<updated>2007-01-30T10:24:41Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Added interface description for recognizers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;br /&gt;
&lt;br /&gt;
Next sections explain the interfaces of recognizer and action components in detail.&lt;br /&gt;
&lt;br /&gt;
==The Recognizer Interface==&lt;br /&gt;
&lt;br /&gt;
For a look at the recognizer interface definition go to this [http://go-ooo.org/lxr/source/api/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl page].&lt;br /&gt;
&lt;br /&gt;
This interface is comprised of 7 methods which have to be implemented by a recognizer component.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Retuns the name of the Regonizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getDescription()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns a textual description of the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | long getSmartTagCount()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | The return value indicates how many smart tags are included in the recognizer component.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagName()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the name of one specific smart tag in this recognizer. This name is needed to associate the recognizer part of a smart tag with the action part. Thus there mustn&amp;#039;t be two recognizer components installed that include a recognizer withthe same name.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | string getSmartTagCaption()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;2&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns the caption of one specific smart tag in this recognizer. The caption will be display by Openoffice.org Writer in the context menu.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | boolean Recognize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;3&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | OUString &amp;#039;&amp;#039;&amp;#039;aWord&amp;#039;&amp;#039;&amp;#039;: Word that shall be checked by smarttag.&lt;br /&gt;
 |-&lt;br /&gt;
 | sal_Int32 &amp;#039;&amp;#039;&amp;#039;nSmartTagIndex&amp;#039;&amp;#039;&amp;#039;: Index of the wanted smart tag. Value needs to be between 0 and the number of smart tags available (exclusively).&lt;br /&gt;
 |-&lt;br /&gt;
 | XController &amp;#039;&amp;#039;&amp;#039;xController&amp;#039;&amp;#039;&amp;#039;: The reference to the controller of the current document.&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | Returns true if the passed word has a special meaning to the smart tag. Otherwise false is returned.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1 cellspacing=0 cellpadding=5 style=&amp;quot;width:75%&amp;quot;&lt;br /&gt;
 ! colspan=&amp;quot;2&amp;quot; style=&amp;quot;background:#ffdead;&amp;quot; | void initialize()&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | This method is used for initializing the recognizer component and is currently needed by Writer to use xml based smart tags (see example below). For your own smart tag components you can implement this method with an empty body.&lt;br /&gt;
 |-&lt;br /&gt;
 | rowspan=&amp;quot;1&amp;quot; style=&amp;quot;width:15%&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Arguments&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | sequence&amp;lt;any&amp;gt; &amp;#039;&amp;#039;&amp;#039;aArguments&amp;#039;&amp;#039;&amp;#039;: Initialization arguments&lt;br /&gt;
 |-&lt;br /&gt;
 | &amp;#039;&amp;#039;&amp;#039;Return Value&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 | None.&lt;br /&gt;
 |}&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24080</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24080"/>
		<updated>2007-01-30T09:42:51Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
=Basic functionality of Smart Tags=&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
=The Services=&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
=The Interfaces=&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24078</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24078"/>
		<updated>2007-01-30T09:40:21Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: /* The Services */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Developing Smart Tag Components for Openoffice.org=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
==Basic functionality of Smart Tags==&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
==The Services==&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
&lt;br /&gt;
* com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
* com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
==The Interfaces==&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=File:Stag_screenshot1.gif&amp;diff=24077</id>
		<title>File:Stag screenshot1.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=File:Stag_screenshot1.gif&amp;diff=24077"/>
		<updated>2007-01-30T09:39:08Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Screenshot of example smart tag component in Openoffice Writer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Screenshot of example smart tag component in Openoffice Writer&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24075</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24075"/>
		<updated>2007-01-30T09:37:57Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: /* Basic functionality of Smart Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Developing Smart Tag Components for Openoffice.org=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
==Basic functionality of Smart Tags==&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
&lt;br /&gt;
* A recognizer&lt;br /&gt;
* An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
==The Services==&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
- com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
- com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
==The Interfaces==&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24070</id>
		<title>Writer/Smart Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Writer/Smart_Tags&amp;diff=24070"/>
		<updated>2007-01-30T09:35:55Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: Draft for description of smart tag components&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Developing Smart Tag Components for Openoffice.org=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Smart Tags were introduced in Microsoft Office XP and allow to recognize words that have a special meaning to the user and futhermore allow to execute certain actions for a recognized word.&lt;br /&gt;
Support for smart tags is included in the Openoffice 2.2 release as a new feature. In order to use this feature external UNO components (so-called smart tag libraries) have to be installed. This document explains how to write own smart tag libraries and how to integrate them into your Openoffice. The necessary interfaces for smart tag libraries currently have the status &amp;quot;unpublished&amp;quot; because there are still some minor enhancements planned. Nevertheless smart tag libraries are fully supported in Openoffice Writer 2.2. Just be aware that you have may have to modify the code of your components if you want to use them with the next release of Openoffice.org.&lt;br /&gt;
&lt;br /&gt;
==Basic functionality of Smart Tags==&lt;br /&gt;
&lt;br /&gt;
Basically smart tags UNO components consist of two parts:&lt;br /&gt;
1. A recognizer&lt;br /&gt;
2. An action library.&lt;br /&gt;
&lt;br /&gt;
If a recognizer component is installed in openoffice its recognize() method will be invoked by Openoffice.org Writer for every word found in the opened document. The recognize method then decides if the word has some specific meaning and returns true or false. Recognized words will be underlined violet in Openoffice.org Writer. If the control key is pressed and the mouse is moved over a underlined word the mouse cursor changes to a hand. When you click on the word with the left mouse button (still holding the control key) a context menu is opened. This is where action libraries come into play. An action library provides actions for recognized words. The captions of available actions are displayed in the context menu. When you click on one entry in the context menu the invokeAction() method of the action library component is called. This method subsequently executes the appropriate action (a simple action might be opening some URL in the browser).&lt;br /&gt;
&lt;br /&gt;
Here is a sceenshot of an example smart tag component which recognizes document property keywords like author, subject, title etc. There is only one action defined. This action inserts the value of the recognized document property into the text document.&lt;br /&gt;
&lt;br /&gt;
[[Image:stag_screenshot1.gif]]&lt;br /&gt;
&lt;br /&gt;
==The Services==&lt;br /&gt;
&lt;br /&gt;
For supporting external smart tag components two new service definitions have been added to offapi: &lt;br /&gt;
- com.sun.star.smarttags.SmartTagRecognizer &lt;br /&gt;
- com.sun.star.smarttags.SmartTagAction &lt;br /&gt;
&lt;br /&gt;
The SmartTagRecognizer service exports the interface XSmartTagRecognizer. Accordingly the service SmartTagAction&lt;br /&gt;
exports the interface XSmartTagAction.&lt;br /&gt;
&lt;br /&gt;
==The Interfaces==&lt;br /&gt;
&lt;br /&gt;
Recognizer and action components are collections of smart tags. This means a smart tag component can contain recognizers or actions for different topics, e.g. a smart tag for recognizing email addresses and another one for recognizing dates and times can be packed into one single recognizer component (accordingly actions for both the email and the date smart tag can be combined in one action component).&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DomainDeveloper&amp;diff=22640</id>
		<title>DomainDeveloper</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DomainDeveloper&amp;diff=22640"/>
		<updated>2006-12-28T12:59:13Z</updated>

		<summary type="html">&lt;p&gt;Jlechner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A mapping of names to OOo accounts.&lt;br /&gt;
&lt;br /&gt;
Abbrev.:&lt;br /&gt;
&lt;br /&gt;
* PL : Project Lead&lt;br /&gt;
* CL : Project Co-Lead&lt;br /&gt;
* CC : Community Council Member&lt;br /&gt;
* ESC : Engineering Steering Committee Member &lt;br /&gt;
* CVS : has write access to the OOo CVS repository&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Developers ===&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;2&amp;quot; cellpadding=&amp;quot;4&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;margin: 1em 1em 1em 0; background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name || CVS || @openoffice.org || [[IRC Communication]] || Notes || Affiliation&lt;br /&gt;
|-&lt;br /&gt;
|      ||     ||                 ||          ||       ||  &lt;br /&gt;
|-&lt;br /&gt;
| Volker Ahrendt|| X || va||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Kai Ahrens|| X || ka || Kai_Ahrens ||PL Graphic Applications||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Gene Anaya||   || ganaya||||||&lt;br /&gt;
|-&lt;br /&gt;
| Joost Andrae|| X || ja||ja||CL qa, release testing en-US builds and releasing builds||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Eric Bachard|| X || ericb||ericb2||Mac OSX/Linux PPC ports/CL porting||French OOo project&lt;br /&gt;
|-&lt;br /&gt;
| Kai Backman||  || kaib ||KaiB||||&lt;br /&gt;
|-&lt;br /&gt;
| Sascha Ballach|| X || sab||||||&lt;br /&gt;
|-&lt;br /&gt;
| Jayant Balraj Madavi||   || jayant_madavi||aZEN_JM||Connectivity / Database||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Jörg Barfurth|| X || jb||JoergB||Configuration Util||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Mathias Bauer|| X || mba||||PL Framework, XML||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Thorsten Behrens|| X || thb||thorsten||vcl/impress/toolkit visionary||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Thomas Benisch|| X || tbe||||Scripting framework||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Stefan Bergmann|| X || sb||||CL UDK, tools&amp;amp;amp;UCB hacker||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Andreas Bille|| X || abi||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Éric Bischoff|| X || ebischoff||ebischoff||KDE A/B driver||Bureau Cornavin&lt;br /&gt;
|-&lt;br /&gt;
| Nick Blievers|| X || nick||||IRIX||&lt;br /&gt;
|-&lt;br /&gt;
| Daniel Boelzle|| X || dbo||||UNO core/bridges/packages||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Oliver Bolte|| X || obo||||RE||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Rafaella Braconi||   || coni||||CL l10n, globalization program manager||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Michael Brauer|| X || mib||||PL XML||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Oliver Braun|| X || obr||obr||System Integration/Accessibility Hacker||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Andreas Bregas|| X || ab||||StarBasic||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Jörg Brunsmann||   || jbrunsmann||||UDK||&lt;br /&gt;
|-&lt;br /&gt;
| Jörg Budischewski||   || jbu||PyUNO hacker||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Peter Burow|| X  || pb||UI||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Aidan Butler||   || aidan||||XML filters||&lt;br /&gt;
|-&lt;br /&gt;
| Giuseppe Castagno || X || beppec56 || beppec56_  or beppe_c || PDF output&lt;br /&gt;
|-&lt;br /&gt;
| Scott Carr||   || kcarr||kcarr||Documentation||Progbits&lt;br /&gt;
|-&lt;br /&gt;
| Colin Charles||   || drbyte||bytee||Malaysian native-lang project||bytebot.net&lt;br /&gt;
|-&lt;br /&gt;
| Behrend Cornelius|| X || bc||||Wizards||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Michael Cziebalski||   || mci||||||&lt;br /&gt;
|-&lt;br /&gt;
| [[User:pdefilippis|Pierre de Filippis]]|| X || pdefilippis||aliscafo||Mac OSX native porting||&lt;br /&gt;
|-&lt;br /&gt;
| Andrew Dent|| X ||ace_dent||ace_dent||ui/custom_images||&lt;br /&gt;
|-&lt;br /&gt;
| Naren Devaiah||   || ||ndev||Performance||Intel Corporation&lt;br /&gt;
|-&lt;br /&gt;
| Nitin Dongre||   || ||nitin_BITS||||Novell, Inc.(intern)&lt;br /&gt;
|-&lt;br /&gt;
| Radek Doulik||   || radekdoulik||rodo_||Canvas hacker||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Carsten Driesner|| X || cd||||Framework||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Herbert Duerr|| X || hdu||hdu_hh||GSL||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Oliver Düsterhoff|| X || od||Writer||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Bernd Eilers|| X || bei||rfc821||EIS||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| René Engelhard|| X || rene||_rene_||config_office, Debian packager||Debian&lt;br /&gt;
|-&lt;br /&gt;
| Andre Fischer|| X || af||||Impress||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Uwe Fischer || || ufi || || || Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Ken Foskey||   || waratah||waratah||config_office/dmake man||slug.org.au&lt;br /&gt;
|-&lt;br /&gt;
| Duncan Foster||   || dfoster||||||&lt;br /&gt;
|-&lt;br /&gt;
| David Fraser||   || davidfraser||davidfraser||South African translations, multilingual builds||translate.org.za&lt;br /&gt;
|-&lt;br /&gt;
| Nils Fuhrmann||   || nf||||Localization||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Martin Gallwey|| X || mtg||marty_||XML/Writer/packaging||&lt;br /&gt;
|-&lt;br /&gt;
| Pierre-Andre Galmes || || pagalmes || pagalmes || Chart2 ||&lt;br /&gt;
|-&lt;br /&gt;
| Tony Galmiche|| X || tonygalmiche||||CL FR native-lang project||&lt;br /&gt;
|-&lt;br /&gt;
| Sunil Gandhi||   || ||tyro||||NOSIP&lt;br /&gt;
|-&lt;br /&gt;
| Sophie Gautier|| X || sgauti|| sophi ||PL FR native-lang project, CC ||.&lt;br /&gt;
|-&lt;br /&gt;
| Vladimir Glazounov|| X || vg||||RE||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Laurent Godard || X || laurentgodard || lgodard || CC, PL Extensions, Fr Native-lang Project || inDesko/Nuxeo &lt;br /&gt;
|-&lt;br /&gt;
| Jody Goldberg|| X || jodygoldberg||jody||[[Calc]] spreadsheet-ness||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Dirk Grobler|| X || dg||||Database Access||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Bettina Haberer||   || bh||||RFEOwner||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Ingrid Halama|| X || iha||||Chart||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Chris Halls|| X || haggai||haggai||Debian packager&amp;amp;amp;misc. hacker||Credativ Ltd., Debian&lt;br /&gt;
|-&lt;br /&gt;
| Gregor Hartmann|| X || gh|| Lachs ||Testtool||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Bustamam Harun||   || bustamam||||Malaysian stuff||&lt;br /&gt;
|-&lt;br /&gt;
| Kevin Hendricks|| X || khendricks||||PL Lingucomponent, PowerPC||&lt;br /&gt;
|-&lt;br /&gt;
| Con Hennessy||   || cphennessy||cph2 or cph_||hacker &amp;amp;amp; former council person||OpenApp&lt;br /&gt;
|-&lt;br /&gt;
| Ivo Hinkelmann|| X || ihi||ivo||l10n tooling/general/RE||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Eric Hoch|| X || maveric||mav_eric||Mac Porting||&lt;br /&gt;
|-&lt;br /&gt;
| [[User:Lutz_Hoeger|Lutz Hoeger]]||   || lho||lutzh||[[User Experience]]||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Jan Holešovský|| X || kendy||kendy||KDE integration||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Martin Hollmichel|| X || mh||Ratte/Nesshof||Build Maestro, PL External, Tools, Porting, CC||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Karl Hong|| X || khong||||i18n, CJK expert||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Matthias Huetsch|| X || mhu||||Performance/strategy, PL UCB, CC, ESC||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Michael Hönnig|| X || mi||||PL API||&lt;br /&gt;
|-&lt;br /&gt;
| [[User:icobgr|Hristo Hristov]] ||   || icobgr || icobgr || PL Bulgarian native-lang project ||&lt;br /&gt;
|-&lt;br /&gt;
| Sven Jacobi|| X || sj||||Escherwizard||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Jörg Jahnke||   || jj||||Internal tooling||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Christian Jansen||   || cj ||||Menu and Toolbar?||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Ocke Janssen|| X || oj||Base||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Pavel Janík|| X || pjanik||paveljanik||PL Czech native-lang project, CL l10n, CC, ESC, l10n builds||&lt;br /&gt;
|-&lt;br /&gt;
| Berry Jia|| X || berryjia||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Pascal Junck||   || pjunck||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Peter Junge|| X || pj|| peter13j|| OOo community contact for my Chinese Employer, QA||Beijing Redflag CH2000&lt;br /&gt;
|-&lt;br /&gt;
| Christian Junker||   || Cyb||christianju||API||Trees For Life&lt;br /&gt;
|-&lt;br /&gt;
| Hirano Kazunari||   || khirano||||Japanese||&lt;br /&gt;
|-&lt;br /&gt;
| Dhananjay Keskar|| X || dkeskar ||dkeskar||Performance,Buildbot,cat-herder||Intel Corporation&lt;br /&gt;
|-&lt;br /&gt;
| Robert Kinsella||   || rkinsella||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Volodymyr Khrystynych||   || volody||||XML Filter||&lt;br /&gt;
|-&lt;br /&gt;
| Matthias Klose||   || doko||doko||Ubuntu, gcc, python packager||Canonical, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Laszlo Kovacs||   || lkovacs||||Documentation||&lt;br /&gt;
|-&lt;br /&gt;
| Martin Kretzschmar|| X || mkretzschmar||martink||Gnome / Debian||Student&lt;br /&gt;
|-&lt;br /&gt;
| Will Lachance||   || wlach||wlach_||Word Perfect File Filters||Net Integration Technologies, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Thomas Lange|| X || tl||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Lars Langhans|| X || lla||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Hans-Joachim Lankenau|| X || hjs||ause||dmake makefile expert, RE||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Németh László|| X || nemeth||||PL lingucomponent||&lt;br /&gt;
|-&lt;br /&gt;
| Jakob Lechner|| X || jakob_lechner||||Writer||Fabalabs&lt;br /&gt;
|-&lt;br /&gt;
| Michael Leibowitz||  X || mikeleib ||mikeleib||performance||Intel Corporation&lt;br /&gt;
|-&lt;br /&gt;
| Wind Li|| X || windly||||Address books||&lt;br /&gt;
|-&lt;br /&gt;
| Ping Liao||   || pliao||||||&lt;br /&gt;
|-&lt;br /&gt;
| Tor Lillqvist|| X || tml||tml_||||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Joachim Lingner|| X || jl||||Java, CLI||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Christian Lippka|| X || cl||ChristianL||Graphic Applications||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Mindy Liu||   || mindyliu||||||&lt;br /&gt;
|-&lt;br /&gt;
| Dieter Loeschky|| X || ||||Localization||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Philipp Lohmann|| X || pl||pl_hh||VCL/X11 (GSL) hacker||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Jackson Low|| X || xxjack12xx||||Porting||&lt;br /&gt;
|-&lt;br /&gt;
| Patrick Luby||   || pluby||||Mac||&lt;br /&gt;
|-&lt;br /&gt;
| Prasad Madhav || X || pmadhav || pmadhav || Buildbot || Intern@Intel &lt;br /&gt;
|-&lt;br /&gt;
| Babak Mahbod||   || bmahbod||||||&lt;br /&gt;
|-&lt;br /&gt;
| Martin Maher||   || mmaher||||Writer &amp;amp;amp; Filter chap||&lt;br /&gt;
|-&lt;br /&gt;
| Nakata Maho|| X || maho||_maho_||PL QA, FreeBSD guy||Independent&lt;br /&gt;
|-&lt;br /&gt;
| John Marmion|| X || jmarmion||||||&lt;br /&gt;
|-&lt;br /&gt;
| Andreas Martens|| X || ama||||PL Writer||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| [[User:smsm1|Shaun McDonald]] || X || smsm1 || shaunmcdonald || Mac Port, buildbot MacPort1 || Student&lt;br /&gt;
|-&lt;br /&gt;
| Caolán McNamara|| X || cmc||caolan||CL Writer &amp;amp;amp; Filter man||RedHat, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Michael Meeks|| X || mmeeks||michael_||ugly hack-er, ESC||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Frank Meies|| X || fme||||Writer||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Federico Mena-Quintero||   || federicomena||federico||perfectionist||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Michael Mi||   || mmi||||||&lt;br /&gt;
|-&lt;br /&gt;
| Björn Milcke|| X || bm||bm_||Chart||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Petr Mladek||   || pmladek||pmladek||SUSE RPMs, ooo-build releases||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Cyrille Moureaux|| X || cyrillem||Cyrille||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| [[User:Mmp|Matthias Müller-Prove]]|| || mmp|| mprove|| [[User Experience]] Engineer, http://ui.openoffice.org || Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Niklas Nebel|| X || nn||||PL [[Calc]]||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Christoph Neumann|| X || cn||||API tests||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| NicelKM|| X || mnicel||nicel||||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Bertram Nolte||   || bnolte||||||&lt;br /&gt;
|-&lt;br /&gt;
| Tomas O&amp;#039;Connor||   || toconnor||||Scripting Framework||&lt;br /&gt;
|-&lt;br /&gt;
| Lars Oppermann|| X || lo||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Rodrigo Parra Novo|| X || rodarvus||rodarvus||Gnumeric/Abiword OpenDocument Format support and port to Maemo||INdT (Instituto Nokia de Tecnologia)&lt;br /&gt;
|-&lt;br /&gt;
| Edward Peterlin|| X || OPENSTEP||||Mac||&lt;br /&gt;
|-&lt;br /&gt;
| Frank Peters|| X || fpe||||Documentation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Christof Pintaske|| X || cp||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Ron Piterman||   || rpiterman||||||&lt;br /&gt;
|-&lt;br /&gt;
| Noel Power||   || npower||noelp||VBA Interop, Scripting||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Nikolai Pretzell|| X || np || ||Autodoc, code quality||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Volker Quetschke|| X || vq||vq||W32-tcsh/bash build environment and dmake Hacker, ESC||Gravity Waves&lt;br /&gt;
|-&lt;br /&gt;
| Tino Rachui|| X || tra||tinor||GSL/Unix Hacker||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| [[User:Kr|Kay Ramme]]|| X || kr||||PL UDK||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| [[User:ErAck|Eike Rathke]]|| X || er||erAck||CL [[Calc]], engine; CL i18n; stricken with number formatter||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Michael Rauch|| X || mrauch||||NetBSD||&lt;br /&gt;
|-&lt;br /&gt;
| Jens-Heiner Rechtien|| X || hr||blauwal||RE; OOo SCM (CVS, CWS tooling); Porting; Compilers||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Daniel Rentz|| X || dr||||[[Calc]] Excel filter, UI||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Florian Reuter|| X || flr||||Writer filters||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Georg Richter|| X || grichter||georg||Base, native MySQL driver||MySQL AB&lt;br /&gt;
|-&lt;br /&gt;
| G. Roderick Singleton||   || grsingleton||grsingleton||Documentation||pathtech.org&lt;br /&gt;
|-&lt;br /&gt;
| Hennes Rohling|| X || hro||||GSL &amp;amp;amp; Util||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Bibek Sahu||   || Bibek||bibek||Impress pieces||Trees For Life&lt;br /&gt;
|-&lt;br /&gt;
| Andreas Schlüns|| X || as||||Framework||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Ingo Schmidt|| X || is||||(Native) Installation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| [[User:Jsc|J&amp;amp;uuml;rgen Schmidt]]|| X || jsc||jsc||PL API, CL Extensions, UNO, SDK||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Stephan Schäfer|| X || ssa||ssa||VCL||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Frank Schönheit|| X || fs||FrankS||Database Access, Forms||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Julian Seward || || sewardj || || valgrind ||&lt;br /&gt;
|-&lt;br /&gt;
| Darragh Sherwin||   || dsherwin||darragh||E-Legislation / E-GovSystems||Propylon&lt;br /&gt;
|-&lt;br /&gt;
| Raul Siddhartha||   || rsiddhartha||raul||GTK File Selector||Novell, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Sarah Smith||   || ssmith||||||&lt;br /&gt;
|-&lt;br /&gt;
| Rajesh Sola||   || rajeshsola||sola||misc.||NOSIP&lt;br /&gt;
|-&lt;br /&gt;
| Kai Sommerfeld|| X || kso||||manager &amp;amp;amp; hacker||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Oliver Specht|| X || os||||PL UI||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Jörg Spindler||   || jspindler||||||&lt;br /&gt;
|-&lt;br /&gt;
| Fridrich Štrba|| X || fridrich_strba||Fridrich||Word Perfect Hacker||&lt;br /&gt;
|-&lt;br /&gt;
| Ulf Stroehler||   || us||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Muthu Subramanian||   || muthusuba||muthusuba||misc.||&lt;br /&gt;
|-&lt;br /&gt;
| Louis Suárez-Potts||   || louis||louis||Community Manager||Collab.net&lt;br /&gt;
|-&lt;br /&gt;
| Claus Sørensen||   || cs||c26n,cHBs,chbs||Danish Localization and Project Management Tool(oopm)||ProFOSS&lt;br /&gt;
|-&lt;br /&gt;
| Stefan Taxhet|| X || st||stx12||CC, interpersonal problem fixer||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Armin Theissen||   || armin||||||&lt;br /&gt;
|-&lt;br /&gt;
| Caio Tiago Oliveira|| X || asrail||asrail||CL QA||Independent&lt;br /&gt;
|-&lt;br /&gt;
| Jan Tietjens||   || tietjens||||||&lt;br /&gt;
|-&lt;br /&gt;
| Rüdiger Timm|| X || rt||||RE||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Malte Timmermann|| X || mt||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Gerhard Tonn||   || tonn||||s390||&lt;br /&gt;
|-&lt;br /&gt;
| Willem van Dorp||   || willem.vandorp||||||&lt;br /&gt;
|-&lt;br /&gt;
| Tom Verbeek|| X || tv||||Wizards, Art team||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Sander Vesik||   || svesik||||||&lt;br /&gt;
|-&lt;br /&gt;
| Daniel Vogelheim|| X || dvo||||XML||&lt;br /&gt;
|-&lt;br /&gt;
| Mikhail Voitenko|| X || mav||Framework||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Robert Vojta|| X || rvojta||rvojta||VBA Interop||&lt;br /&gt;
|-&lt;br /&gt;
| Dirk Völzke|| X || dv||||Installation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| [[User:Sparcmoz|Jim Watson]]|| X || sparcmoz|| sparcmoz||GNU Linux sparc porter||clug.org.au&lt;br /&gt;
|-&lt;br /&gt;
| Armin Weiss|| X || aw||||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Dan Williams|| X || fa||dcbw||Mac et. al. hacker||RedHat, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| Stephan Wunderlich|| X || sw||||||&lt;br /&gt;
|-&lt;br /&gt;
| Kohei Yoshida|| X || kohei||kohei_||[[Calc]] hacker, Calc optimization solver developer||SlickEdit, Inc.&lt;br /&gt;
|-&lt;br /&gt;
| George Zahopoulos|| X || georgez||||||&lt;br /&gt;
|-&lt;br /&gt;
| Kurt Zenker|| X || kz||smoketester||RE||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Claudio F Filho||   || filhocf||filhocf||Brazilian portuguese Localization||BrOffice.org&lt;br /&gt;
|-&lt;br /&gt;
| Xiaoyang Yu||   || || ||Disk block reordering||Intel Corporation &lt;br /&gt;
|- &lt;br /&gt;
| Antonio Xu|| X || antoxu || antoxu || Async dialogs, PRC improvements || Intel Corporation&lt;br /&gt;
|-&lt;br /&gt;
| Rail Aliev || X  || rail || rail ||  Ru and Tr NL Co-lead || Infra-Resource &lt;br /&gt;
|-&lt;br /&gt;
| Jeremy Zheng|| X || zhiming || Jeremy || Async dialogs, PRC improvements || Intel Corporation&lt;br /&gt;
|-&lt;br /&gt;
| [[User:Schmidtm|Matthias Schmidt]] ||   || schmidtm || schmidtm || Mac OSX Aqua Port || Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Yuri Dario ||   || ydario || Paperino || OS/2 Port || Serenity Systems intl&lt;br /&gt;
|-&lt;br /&gt;
| Wei Zhao ||   || weiz ||   || Chinese Localization  || Beijing Redflag CH2000&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== QA Engineers ===&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;2&amp;quot; cellpadding=&amp;quot;4&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;margin: 1em 1em 1em 0; background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name ||CVS||@openoffice.org || [[IRC Communication]] || Interested modules || Notes || Affiliation&lt;br /&gt;
|-&lt;br /&gt;
| Stefan Baltzer||||sba||||writer||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Thorsten Bosbach||X||tbo||||framework, qa/qatesttool||QA Framework / Automation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Oliver Craemer||X||oc||||[[Calc]]||QA Calc / Automation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Helge Delfs||X||hde||||writer, qa/qatesttool||QA Writer / Automation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Fredrik Haegg||X||fha||||draw, impress, qa/qatesttool||QA Graphics / Automation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Hasan Ilter||||hi||||writer, printing, pdf export||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Michael Rüß||||mru||||writer, word im/export||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Éric Savary||||es||||writer, accessibility||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| [[User:jsi|Joerg Sievers]]||X||jsi||jogi||qa/qatesttool, [[Calc]]||Automation / QA Calc||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Joerg Skottke||X||jsk||skotti||framework, qa/qatesttool||QA Framework / Automation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Marc Neumann||X||msc||||database, qa/qatesttool||QA Base / Automation||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Chris Lukasiak||||clu||||database||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Frank Stecher||||fst||||[[Calc]]||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Jack Warchold|||| jw||||writer, import/export filters||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Uwe Luebbers||||ul||||framework||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Thorsten Martens||||tm||||framework||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Olaf Felka|||| of||||framework, installation||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Thomas Klarhoefer||||kla||||chart||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Wolfram Garten|||| wg||||draw, impress||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| Christian Guenther||||cgu||||draw, impress||||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
| [[User:Thorsten_Ziehm|Thorsten Ziehm]]||||| thorstenziehm||||||QA lead||Sun Microsystems&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are tracking pending JCAs in the document [[Pending JCAs]].&lt;br /&gt;
&lt;br /&gt;
== Related Pages ==&lt;br /&gt;
* [[User Experience Community]]&lt;br /&gt;
* A map of OOo developers around the world is available at http://www.frappr.com/ooodev, please add yourself to the map if you&amp;#039;re involved in OOo development. It&amp;#039;s just fun to see who&amp;#039;s where :-)&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jlechner</name></author>
	</entry>
</feed>