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 (OUString aApplicationName)
 
virtual ~SmartTagMgr () override
 
void Init (std::u16string_view 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 (std::u16string_view 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 86 of file SmartTagMgr.hxx.

Constructor & Destructor Documentation

◆ SmartTagMgr()

SmartTagMgr::SmartTagMgr ( OUString  aApplicationName)

Definition at line 50 of file SmartTagMgr.cxx.

References getProcessComponentContext(), and mxContext.

◆ ~SmartTagMgr()

SmartTagMgr::~SmartTagMgr ( )
overridevirtual

Definition at line 57 of file SmartTagMgr.cxx.

Member Function Documentation

◆ AssociateActionsWithRecognizers()

void SmartTagMgr::AssociateActionsWithRecognizers ( )
private

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

Definition at line 476 of file SmartTagMgr.cxx.

References i, maActionList, maRecognizerList, and maSmartTagMap.

Referenced by LoadLibraries().

◆ changesOccurred()

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

Definition at line 293 of file SmartTagMgr.cxx.

References ReadConfiguration().

◆ disposing()

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

Definition at line 266 of file SmartTagMgr.cxx.

References Exception, and xModel.

◆ GetActionSequences()

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 136 of file SmartTagMgr.cxx.

References i, and maSmartTagMap.

◆ GetApplicationName()

const OUString & SmartTagMgr::GetApplicationName ( ) const
inline

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

Definition at line 218 of file SmartTagMgr.hxx.

◆ GetRecognizer()

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

Returns a recognizer.

Definition at line 204 of file SmartTagMgr.hxx.

References i.

◆ GetSmartTagCaption()

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 172 of file SmartTagMgr.cxx.

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

◆ Init()

void SmartTagMgr::Init ( std::u16string_view  rConfigurationGroupName)

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

Definition at line 61 of file SmartTagMgr.cxx.

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

◆ IsLabelTextWithSmartTags()

bool SmartTagMgr::IsLabelTextWithSmartTags ( ) const
inline

Enable or disable smart tags.

Definition at line 195 of file SmartTagMgr.hxx.

◆ IsSmartTagsEnabled()

bool SmartTagMgr::IsSmartTagsEnabled ( ) const
inline

Is smart tag recognition active?

Definition at line 208 of file SmartTagMgr.hxx.

◆ IsSmartTagTypeEnabled()

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

Returns true if the given smart tag type is enabled.

Definition at line 196 of file SmartTagMgr.cxx.

References maDisabledSmartTagTypes.

Referenced by RecognizeString(), and RecognizeTextRange().

◆ LoadLibraries()

void SmartTagMgr::LoadLibraries ( )
private

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

Definition at line 314 of file SmartTagMgr.cxx.

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

Referenced by Init(), and modified().

◆ modified()

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

Definition at line 254 of file SmartTagMgr.cxx.

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

◆ NumberOfRecognizers()

sal_uInt32 SmartTagMgr::NumberOfRecognizers ( ) const
inline

Returns the number of registered recognizers.

Definition at line 199 of file SmartTagMgr.hxx.

◆ PrepareConfiguration()

void SmartTagMgr::PrepareConfiguration ( std::u16string_view  rConfigurationGroupName)
private

Prepare configuration access.

Definition at line 376 of file SmartTagMgr.cxx.

References aArguments, Any, mxConfigurationSettings, and mxContext.

Referenced by Init().

◆ ReadConfiguration()

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

Reads the configuration data.

Definition at line 417 of file SmartTagMgr.cxx.

References Any, maDisabledSmartTagTypes, mbLabelTextWithSmartTags, and mxConfigurationSettings.

Referenced by changesOccurred(), and Init().

◆ RecognizeString()

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 71 of file SmartTagMgr.cxx.

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

◆ RecognizeTextRange()

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

◆ RegisterListener()

void SmartTagMgr::RegisterListener ( )
private

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

Definition at line 444 of file SmartTagMgr.cxx.

References mxConfigurationSettings, and mxContext.

Referenced by Init().

◆ WriteConfiguration()

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 203 of file SmartTagMgr.cxx.

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

Member Data Documentation

◆ maActionList

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

Definition at line 93 of file SmartTagMgr.hxx.

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

◆ maApplicationName

const OUString SmartTagMgr::maApplicationName
private

Definition at line 91 of file SmartTagMgr.hxx.

Referenced by RecognizeString(), and RecognizeTextRange().

◆ maDisabledSmartTagTypes

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

Definition at line 94 of file SmartTagMgr.hxx.

Referenced by IsSmartTagTypeEnabled(), and ReadConfiguration().

◆ maRecognizerList

std::vector< css::uno::Reference< css::smarttags::XSmartTagRecognizer > > SmartTagMgr::maRecognizerList
private

◆ maSmartTagMap

std::multimap< OUString, ActionReference > SmartTagMgr::maSmartTagMap
private

◆ mbLabelTextWithSmartTags

bool SmartTagMgr::mbLabelTextWithSmartTags
private

Definition at line 99 of file SmartTagMgr.hxx.

Referenced by ReadConfiguration().

◆ mxBreakIter

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

Definition at line 96 of file SmartTagMgr.hxx.

Referenced by RecognizeString().

◆ mxConfigurationSettings

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

◆ mxContext

css::uno::Reference< css::uno::XComponentContext> SmartTagMgr::mxContext
private

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