LibreOffice Module svx (master)  1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SmartTagMgr Class Reference

The smart tag manager maintains all installed action and recognizer services. More...

#include <SmartTagMgr.hxx>

Inheritance diagram for SmartTagMgr:
[legend]
Collaboration diagram for SmartTagMgr:
[legend]

Public Member Functions

 SmartTagMgr (const OUString &rApplicationName)
 
virtual ~SmartTagMgr () override
 
void Init (const OUString &rConfigurationGroupName)
 Triggers configuration reading, library loading and listener registration NOTE: MUST BE CALLED AFTER CONSTRUCTION! More...
 
void RecognizeString (const OUString &rText, const css::uno::Reference< css::text::XTextMarkup > &rMarkup, const css::uno::Reference< css::frame::XController > &rController, const css::lang::Locale &rLocale, sal_uInt32 nStart, sal_uInt32 nLen) const
 Dispatches the recognize call to all installed smart tag recognizers. More...
 
void RecognizeTextRange (const css::uno::Reference< css::text::XTextRange > &rRange, const css::uno::Reference< css::text::XTextMarkup > &rMarkup, const css::uno::Reference< css::frame::XController > &rController) const
 
void GetActionSequences (std::vector< OUString > &rSmartTagTypes, css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > &rActionComponentsSequence, css::uno::Sequence< css::uno::Sequence< sal_Int32 > > &rActionIndicesSequence) const
 Returns all action references associated with a given list of smart tag types. More...
 
OUString GetSmartTagCaption (const OUString &rSmartTagType, const css::lang::Locale &rLocale) const
 Returns the caption for a smart tag type. More...
 
bool IsSmartTagTypeEnabled (const OUString &rSmartTagType) const
 Returns true if the given smart tag type is enabled. More...
 
bool IsLabelTextWithSmartTags () const
 Enable or disable smart tags. More...
 
sal_uInt32 NumberOfRecognizers () const
 Returns the number of registered recognizers. More...
 
css::uno::Reference< css::smarttags::XSmartTagRecognizer > const & GetRecognizer (sal_uInt32 i) const
 Returns a recognizer. More...
 
bool IsSmartTagsEnabled () const
 Is smart tag recognition active? More...
 
void WriteConfiguration (const bool *bLabelTextWithSmartTags, const std::vector< OUString > *pDisabledTypes) const
 Writes configuration settings. More...
 
const OUString & GetApplicationName () const
 Returns the name of the application this instance has been created by. More...
 
virtual void SAL_CALL disposing (const css::lang::EventObject &Source) override
 
virtual void SAL_CALL modified (const css::lang::EventObject &aEvent) override
 
virtual void SAL_CALL changesOccurred (const css::util::ChangesEvent &Event) override
 

Private Member Functions

void LoadLibraries ()
 Checks for installed smart tag recognizers/actions and stores them in maRecognizerList and maActionList. More...
 
void PrepareConfiguration (const OUString &rConfigurationGroupName)
 Prepare configuration access. More...
 
void ReadConfiguration (bool bExcludedTypes, bool bRecognize)
 Reads the configuration data. More...
 
void RegisterListener ()
 Registers the smart tag manager as listener at the package manager. More...
 
void AssociateActionsWithRecognizers ()
 Sets up a map that maps smart tag type names to actions references. More...
 

Private Attributes

const OUString maApplicationName
 
std::vector< css::uno::Reference< css::smarttags::XSmartTagRecognizer > > maRecognizerList
 
std::vector< css::uno::Reference< css::smarttags::XSmartTagAction > > maActionList
 
std::set< OUString > maDisabledSmartTagTypes
 
std::multimap< OUString, ActionReferencemaSmartTagMap
 
css::uno::Reference< css::i18n::XBreakIterator > mxBreakIter
 
css::uno::Reference< css::uno::XComponentContext > mxContext
 
css::uno::Reference< css::beans::XPropertySet > mxConfigurationSettings
 
bool mbLabelTextWithSmartTags
 

Detailed Description

The smart tag manager maintains all installed action and recognizer services.

This class organizes the available smarttag libraries and provides access functions to these libraries. The smart tag manager is a singleton.

Definition at line 84 of file SmartTagMgr.hxx.

Constructor & Destructor Documentation

SmartTagMgr::SmartTagMgr ( const OUString &  rApplicationName)

Definition at line 55 of file SmartTagMgr.cxx.

References getProcessComponentContext().

SmartTagMgr::~SmartTagMgr ( )
overridevirtual

Definition at line 66 of file SmartTagMgr.cxx.

Member Function Documentation

void SmartTagMgr::AssociateActionsWithRecognizers ( )
private

Sets up a map that maps smart tag type names to actions references.

Definition at line 481 of file SmartTagMgr.cxx.

References i, maActionList, maRecognizerList, and maSmartTagMap.

Referenced by LoadLibraries().

void SmartTagMgr::changesOccurred ( const css::util::ChangesEvent &  Event)
overridevirtual

Definition at line 298 of file SmartTagMgr.cxx.

References ReadConfiguration().

void SmartTagMgr::disposing ( const css::lang::EventObject &  Source)
overridevirtual

Definition at line 271 of file SmartTagMgr.cxx.

References Exception, and xModel.

void SmartTagMgr::GetActionSequences ( std::vector< OUString > &  rSmartTagTypes,
css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > &  rActionComponentsSequence,
css::uno::Sequence< css::uno::Sequence< sal_Int32 > > &  rActionIndicesSequence 
) const

Returns all action references associated with a given list of smart tag types.

Parameters
rSmartTagTypesThe list of types
rActionComponentsSequenceOutput parameter
rActionIndicesSequenceOutput parameter

Definition at line 145 of file SmartTagMgr.cxx.

References i, and maSmartTagMap.

const OUString& SmartTagMgr::GetApplicationName ( ) const
inline

Returns the name of the application this instance has been created by.

Definition at line 216 of file SmartTagMgr.hxx.

css::uno::Reference< css::smarttags::XSmartTagRecognizer > const& SmartTagMgr::GetRecognizer ( sal_uInt32  i) const
inline

Returns a recognizer.

Definition at line 202 of file SmartTagMgr.hxx.

OUString SmartTagMgr::GetSmartTagCaption ( const OUString &  rSmartTagType,
const css::lang::Locale &  rLocale 
) const

Returns the caption for a smart tag type.

Parameters
rSmartTagTypeThe given smart tag type.
rLocaleThe locale.

Definition at line 177 of file SmartTagMgr.cxx.

References maSmartTagMap, ActionReference::mnSmartTagIndex, and ActionReference::mxSmartTagAction.

void SmartTagMgr::Init ( const OUString &  rConfigurationGroupName)

Triggers configuration reading, library loading and listener registration NOTE: MUST BE CALLED AFTER CONSTRUCTION!

Definition at line 70 of file SmartTagMgr.cxx.

References LoadLibraries(), PrepareConfiguration(), ReadConfiguration(), and RegisterListener().

bool SmartTagMgr::IsLabelTextWithSmartTags ( ) const
inline

Enable or disable smart tags.

Definition at line 193 of file SmartTagMgr.hxx.

bool SmartTagMgr::IsSmartTagsEnabled ( ) const
inline

Is smart tag recognition active?

Definition at line 206 of file SmartTagMgr.hxx.

bool SmartTagMgr::IsSmartTagTypeEnabled ( const OUString &  rSmartTagType) const

Returns true if the given smart tag type is enabled.

Definition at line 201 of file SmartTagMgr.cxx.

References maDisabledSmartTagTypes.

Referenced by RecognizeString(), and RecognizeTextRange().

void SmartTagMgr::LoadLibraries ( )
private

Checks for installed smart tag recognizers/actions and stores them in maRecognizerList and maActionList.

Definition at line 319 of file SmartTagMgr.cxx.

References Any, AssociateActionsWithRecognizers(), maActionList, maRecognizerList, and mxContext.

Referenced by Init(), and modified().

void SmartTagMgr::modified ( const css::lang::EventObject &  aEvent)
overridevirtual

Definition at line 259 of file SmartTagMgr.cxx.

References LoadLibraries(), maActionList, maRecognizerList, and maSmartTagMap.

sal_uInt32 SmartTagMgr::NumberOfRecognizers ( ) const
inline

Returns the number of registered recognizers.

Definition at line 197 of file SmartTagMgr.hxx.

void SmartTagMgr::PrepareConfiguration ( const OUString &  rConfigurationGroupName)
private

Prepare configuration access.

Definition at line 381 of file SmartTagMgr.cxx.

References Any, makeAny(), mxConfigurationSettings, and mxContext.

Referenced by Init().

void SmartTagMgr::ReadConfiguration ( bool  bExcludedTypes,
bool  bRecognize 
)
private

Reads the configuration data.

Definition at line 422 of file SmartTagMgr.cxx.

References Any, maDisabledSmartTagTypes, mbLabelTextWithSmartTags, and mxConfigurationSettings.

Referenced by changesOccurred(), and Init().

void SmartTagMgr::RecognizeString ( const OUString &  rText,
const css::uno::Reference< css::text::XTextMarkup > &  rMarkup,
const css::uno::Reference< css::frame::XController > &  rController,
const css::lang::Locale &  rLocale,
sal_uInt32  nStart,
sal_uInt32  nLen 
) const

Dispatches the recognize call to all installed smart tag recognizers.

Parameters
rTextThe string to be scanned by the recognizers.
xMarkupThe object allows the recognizers to store any found smart tags.
xControllerThe current controller of the document.
rLocaleThe locale of rText.
nStartThe start offset of the text to be scanned in rText.
nLenThe length of the text to be scanned.

Definition at line 80 of file SmartTagMgr.cxx.

References IsSmartTagTypeEnabled(), maApplicationName, maRecognizerList, mxBreakIter, and mxContext.

void SmartTagMgr::RecognizeTextRange ( const css::uno::Reference< css::text::XTextRange > &  rRange,
const css::uno::Reference< css::text::XTextMarkup > &  rMarkup,
const css::uno::Reference< css::frame::XController > &  rController 
) const

Definition at line 114 of file SmartTagMgr.cxx.

References IsSmartTagTypeEnabled(), maApplicationName, and maRecognizerList.

void SmartTagMgr::RegisterListener ( )
private

Registers the smart tag manager as listener at the package manager.

Definition at line 449 of file SmartTagMgr.cxx.

References mxConfigurationSettings, and mxContext.

Referenced by Init().

void SmartTagMgr::WriteConfiguration ( const bool *  bLabelTextWithSmartTags,
const std::vector< OUString > *  pDisabledTypes 
) const

Writes configuration settings.

Writes currently disabled smart tag types to configuration.

Definition at line 208 of file SmartTagMgr.cxx.

References Any, comphelper::containerToSequence(), makeAny(), and mxConfigurationSettings.

Member Data Documentation

std::vector< css::uno::Reference< css::smarttags::XSmartTagAction > > SmartTagMgr::maActionList
private

Definition at line 91 of file SmartTagMgr.hxx.

Referenced by AssociateActionsWithRecognizers(), LoadLibraries(), and modified().

const OUString SmartTagMgr::maApplicationName
private

Definition at line 89 of file SmartTagMgr.hxx.

Referenced by RecognizeString(), and RecognizeTextRange().

std::set< OUString > SmartTagMgr::maDisabledSmartTagTypes
private

Definition at line 92 of file SmartTagMgr.hxx.

Referenced by IsSmartTagTypeEnabled(), and ReadConfiguration().

std::vector< css::uno::Reference< css::smarttags::XSmartTagRecognizer > > SmartTagMgr::maRecognizerList
private
std::multimap< OUString, ActionReference > SmartTagMgr::maSmartTagMap
private
bool SmartTagMgr::mbLabelTextWithSmartTags
private

Definition at line 97 of file SmartTagMgr.hxx.

Referenced by ReadConfiguration().

css::uno::Reference< css::i18n::XBreakIterator > SmartTagMgr::mxBreakIter
mutableprivate

Definition at line 94 of file SmartTagMgr.hxx.

Referenced by RecognizeString().

css::uno::Reference< css::beans::XPropertySet > SmartTagMgr::mxConfigurationSettings
private
css::uno::Reference< css::uno::XComponentContext> SmartTagMgr::mxContext
private

The documentation for this class was generated from the following files: