LibreOffice Module svx (master) 1
|
The smart tag manager maintains all installed action and recognizer services. More...
#include <SmartTagMgr.hxx>
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, ActionReference > | maSmartTagMap |
css::uno::Reference< css::i18n::XBreakIterator > | mxBreakIter |
css::uno::Reference< css::uno::XComponentContext > | mxContext |
css::uno::Reference< css::beans::XPropertySet > | mxConfigurationSettings |
bool | mbLabelTextWithSmartTags |
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.
SmartTagMgr::SmartTagMgr | ( | OUString | aApplicationName | ) |
Definition at line 50 of file SmartTagMgr.cxx.
References getProcessComponentContext(), and mxContext.
|
overridevirtual |
Definition at line 57 of file SmartTagMgr.cxx.
|
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().
|
overridevirtual |
Definition at line 293 of file SmartTagMgr.cxx.
References ReadConfiguration().
|
overridevirtual |
Definition at line 266 of file SmartTagMgr.cxx.
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.
rSmartTagTypes | The list of types |
rActionComponentsSequence | Output parameter |
rActionIndicesSequence | Output parameter |
Definition at line 136 of file SmartTagMgr.cxx.
References i, and maSmartTagMap.
|
inline |
Returns the name of the application this instance has been created by.
Definition at line 218 of file SmartTagMgr.hxx.
|
inline |
OUString SmartTagMgr::GetSmartTagCaption | ( | const OUString & | rSmartTagType, |
const css::lang::Locale & | rLocale | ||
) | const |
Returns the caption for a smart tag type.
rSmartTagType | The given smart tag type. |
rLocale | The locale. |
Definition at line 172 of file SmartTagMgr.cxx.
References maSmartTagMap, ActionReference::mnSmartTagIndex, and ActionReference::mxSmartTagAction.
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().
|
inline |
Enable or disable smart tags.
Definition at line 195 of file SmartTagMgr.hxx.
|
inline |
Is smart tag recognition active?
Definition at line 208 of file SmartTagMgr.hxx.
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().
|
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().
|
overridevirtual |
Definition at line 254 of file SmartTagMgr.cxx.
References LoadLibraries(), maActionList, maRecognizerList, and maSmartTagMap.
|
inline |
Returns the number of registered recognizers.
Definition at line 199 of file SmartTagMgr.hxx.
|
private |
Prepare configuration access.
Definition at line 376 of file SmartTagMgr.cxx.
References aArguments, Any, mxConfigurationSettings, and mxContext.
Referenced by Init().
|
private |
Reads the configuration data.
Definition at line 417 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.
rText | The string to be scanned by the recognizers. |
xMarkup | The object allows the recognizers to store any found smart tags. |
xController | The current controller of the document. |
rLocale | The locale of rText. |
nStart | The start offset of the text to be scanned in rText. |
nLen | The length of the text to be scanned. |
Definition at line 71 of file SmartTagMgr.cxx.
References IsSmartTagTypeEnabled(), maApplicationName, maRecognizerList, mxBreakIter, mxContext, and xController.
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 105 of file SmartTagMgr.cxx.
References IsSmartTagTypeEnabled(), maApplicationName, maRecognizerList, and xController.
|
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().
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.
|
private |
Definition at line 93 of file SmartTagMgr.hxx.
Referenced by AssociateActionsWithRecognizers(), LoadLibraries(), and modified().
|
private |
Definition at line 91 of file SmartTagMgr.hxx.
Referenced by RecognizeString(), and RecognizeTextRange().
|
private |
Definition at line 94 of file SmartTagMgr.hxx.
Referenced by IsSmartTagTypeEnabled(), and ReadConfiguration().
|
private |
Definition at line 92 of file SmartTagMgr.hxx.
Referenced by AssociateActionsWithRecognizers(), LoadLibraries(), modified(), RecognizeString(), and RecognizeTextRange().
|
private |
Definition at line 95 of file SmartTagMgr.hxx.
Referenced by AssociateActionsWithRecognizers(), GetActionSequences(), GetSmartTagCaption(), and modified().
|
private |
Definition at line 99 of file SmartTagMgr.hxx.
Referenced by ReadConfiguration().
|
mutableprivate |
Definition at line 96 of file SmartTagMgr.hxx.
Referenced by RecognizeString().
|
private |
Definition at line 98 of file SmartTagMgr.hxx.
Referenced by PrepareConfiguration(), ReadConfiguration(), RegisterListener(), and WriteConfiguration().
|
private |
Definition at line 97 of file SmartTagMgr.hxx.
Referenced by LoadLibraries(), PrepareConfiguration(), RecognizeString(), and RegisterListener().