LibreOffice Module linguistic (master) 1
|
#include <gciterator.hxx>
Public Member Functions | |
void | DequeueAndCheck () |
GrammarCheckingIterator () | |
virtual | ~GrammarCheckingIterator () override |
virtual void SAL_CALL | startProofreading (const css::uno::Reference< css::uno::XInterface > &xDocument, const css::uno::Reference< css::text::XFlatParagraphIteratorProvider > &xIteratorProvider) override |
virtual css::linguistic2::ProofreadingResult SAL_CALL | checkSentenceAtPosition (const css::uno::Reference< css::uno::XInterface > &xDocument, const css::uno::Reference< css::text::XFlatParagraph > &xFlatParagraph, const OUString &aText, const css::lang::Locale &aLocale, ::sal_Int32 nStartOfSentencePosition, ::sal_Int32 nSuggestedBehindEndOfSentencePosition, ::sal_Int32 nErrorPositionInParagraph) override |
virtual void SAL_CALL | resetIgnoreRules () override |
virtual sal_Bool SAL_CALL | isProofreading (const css::uno::Reference< css::uno::XInterface > &xDocument) override |
virtual void SAL_CALL | processLinguServiceEvent (const css::linguistic2::LinguServiceEvent &aLngSvcEvent) override |
virtual sal_Bool SAL_CALL | addLinguServiceEventListener (const css::uno::Reference< css::linguistic2::XLinguServiceEventListener > &xLstnr) override |
virtual sal_Bool SAL_CALL | removeLinguServiceEventListener (const css::uno::Reference< css::linguistic2::XLinguServiceEventListener > &xLstnr) override |
virtual void SAL_CALL | dispose () override |
virtual void SAL_CALL | addEventListener (const css::uno::Reference< css::lang::XEventListener > &xListener) override |
virtual void SAL_CALL | removeEventListener (const css::uno::Reference< css::lang::XEventListener > &aListener) override |
virtual void SAL_CALL | disposing (const css::lang::EventObject &Source) override |
virtual OUString SAL_CALL | getImplementationName () override |
virtual sal_Bool SAL_CALL | supportsService (const OUString &ServiceName) override |
virtual css::uno::Sequence< OUString > SAL_CALL | getSupportedServiceNames () override |
virtual void | SetServiceList (const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames) override |
virtual css::uno::Sequence< OUString > | GetServiceList (const css::lang::Locale &rLocale) const override |
virtual void | SetServiceList (const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames)=0 |
virtual css::uno::Sequence< OUString > | GetServiceList (const css::lang::Locale &rLocale) const =0 |
Private Types | |
typedef std::deque< FPEntry > | FPQueue_t |
typedef std::map< XComponent *, OUString > | DocMap_t |
typedef std::map< OUString, OUString > | GCImplNames_t |
typedef std::map< OUString, css::uno::Reference< css::linguistic2::XProofreader > > | GCReferences_t |
Private Member Functions | |
void | TerminateThread () |
sal_Int32 | NextDocId () |
OUString | GetOrCreateDocId (const css::uno::Reference< css::lang::XComponent > &xComp) |
void | AddEntry (const css::uno::Reference< css::text::XFlatParagraphIterator > &xFlatParaIterator, const css::uno::Reference< css::text::XFlatParagraph > &xFlatPara, const OUString &rDocId, sal_Int32 nStartIndex, bool bAutomatic) |
void | ProcessResult (const css::linguistic2::ProofreadingResult &rRes, const css::uno::Reference< css::text::XFlatParagraphIterator > &rxFlatParagraphIterator, bool bIsAutomaticChecking) |
sal_Int32 | GetSuggestedEndOfSentence (const OUString &rText, sal_Int32 nSentenceStartPos, const css::lang::Locale &rLocale) |
void | GetConfiguredGCSvcs_Impl () |
css::uno::Reference< css::linguistic2::XProofreader > | GetGrammarChecker (css::lang::Locale &rLocale) |
css::uno::Reference< css::util::XChangesBatch > const & | GetUpdateAccess () const |
GrammarCheckingIterator (const GrammarCheckingIterator &)=delete | |
GrammarCheckingIterator & | operator= (const GrammarCheckingIterator &)=delete |
std::pair< OUString, std::optional< OUString > > | getServiceForLocale (const css::lang::Locale &rLocale) const |
Static Private Member Functions | |
static osl::Mutex & | MyMutex () |
beware of initialization order! More... | |
Private Attributes | |
FPQueue_t | m_aFPEntriesQueue |
bool | m_bEnd |
DocMap_t | m_aDocIdMap |
GCImplNames_t | m_aGCImplNamesByLang |
GCReferences_t | m_aGCReferencesByService |
OUString | m_aCurCheckedDocId |
bool | m_bGCServicesChecked |
sal_Int32 | m_nDocIdCounter |
osl::Condition | m_aWakeUpThread |
oslThread | m_thread |
comphelper::OInterfaceContainerHelper3< css::lang::XEventListener > | m_aEventListeners |
comphelper::OInterfaceContainerHelper3< css::linguistic2::XLinguServiceEventListener > | m_aNotifyListeners |
css::uno::Reference< css::i18n::XBreakIterator > | m_xBreakIterator |
css::uno::Reference< css::util::XChangesBatch > | m_xUpdateAccess |
Additional Inherited Members | |
Protected Member Functions inherited from LinguDispatcher | |
~LinguDispatcher () | |
Definition at line 74 of file gciterator.hxx.
|
private |
Definition at line 96 of file gciterator.hxx.
|
private |
Definition at line 87 of file gciterator.hxx.
|
private |
Definition at line 101 of file gciterator.hxx.
|
private |
Definition at line 105 of file gciterator.hxx.
|
privatedelete |
|
explicit |
Definition at line 281 of file gciterator.cxx.
|
overridevirtual |
Definition at line 292 of file gciterator.cxx.
References TerminateThread().
|
private |
Definition at line 347 of file gciterator.cxx.
References lcl_workerfunc(), FPEntry::m_aDocId, m_aFPEntriesQueue, m_aWakeUpThread, FPEntry::m_bAutomatic, FPEntry::m_nStartIndex, m_thread, FPEntry::m_xPara, FPEntry::m_xParaIterator, and MyMutex().
Referenced by DequeueAndCheck(), ProcessResult(), and startProofreading().
|
overridevirtual |
Definition at line 1022 of file gciterator.cxx.
References comphelper::OInterfaceContainerHelper3< class ListenerT >::addInterface(), and m_aEventListeners.
|
overridevirtual |
Definition at line 973 of file gciterator.cxx.
References comphelper::OInterfaceContainerHelper3< class ListenerT >::addInterface(), and m_aNotifyListeners.
|
overridevirtual |
! work-around to prevent looping if the grammar checker ! failed to properly identify the sentence end
Definition at line 763 of file gciterator.cxx.
References DBG_ASSERT, GetGrammarChecker(), GetOrCreateDocId(), GetSuggestedEndOfSentence(), lcl_BacktraceWhiteSpaces(), lcl_GetPrimaryLanguageOfSentence(), lcl_makeProperties(), lcl_SkipWhiteSpaces(), MyMutex(), PROOFINFO_GET_PROOFRESULT, and SAL_WARN.
void GrammarCheckingIterator::DequeueAndCheck | ( | ) |
! work-around to prevent looping if the grammar checker ! failed to properly identify the sentence end
Definition at line 589 of file gciterator.cxx.
References AddEntry(), DBG_ASSERT, GetGrammarChecker(), GetSuggestedEndOfSentence(), lcl_BacktraceWhiteSpaces(), lcl_GetPrimaryLanguageOfSentence(), lcl_makeProperties(), lcl_SkipWhiteSpaces(), m_aCurCheckedDocId, FPEntry::m_aDocId, m_aFPEntriesQueue, m_aWakeUpThread, FPEntry::m_bAutomatic, m_bEnd, FPEntry::m_nStartIndex, FPEntry::m_xPara, FPEntry::m_xParaIterator, MyMutex(), ProcessResult(), PROOFINFO_MARK_PARAGRAPH, SAL_WARN, and TOOLS_WARN_EXCEPTION.
|
overridevirtual |
Definition at line 995 of file gciterator.cxx.
References comphelper::OInterfaceContainerHelper3< class ListenerT >::disposeAndClear(), m_aDocIdMap, m_aEventListeners, m_aFPEntriesQueue, m_aGCReferencesByService, m_xBreakIterator, MyMutex(), and TerminateThread().
|
overridevirtual |
! There is no need to remove entries from the queue that are from this document ! since the respectives xFlatParagraphs should become invalid (isModified() == true) ! and the call to xFlatParagraphIterator->getNextPara() will result in an empty reference. ! And if an entry is currently checked by a grammar checker upon return the results ! should be ignored. ! Also GetOrCreateDocId will not use that very same Id again... ! All of the above resulting in that we only have to get rid of the implementation pointer here.
Definition at line 1042 of file gciterator.cxx.
References m_aDocIdMap, and MyMutex().
|
private |
Definition at line 1093 of file gciterator.cxx.
References GetUpdateAccess(), m_aGCImplNamesByLang, MyMutex(), SAL_WARN, and TOOLS_WARN_EXCEPTION.
Referenced by GetGrammarChecker().
|
private |
Definition at line 509 of file gciterator.cxx.
References LanguageTag::convertToBcp47(), LanguageTag::convertToLocale(), GetConfiguredGCSvcs_Impl(), comphelper::getProcessComponentContext(), getServiceForLocale(), m_aGCReferencesByService, m_bGCServicesChecked, MyMutex(), SAL_INFO, and SAL_WARN.
Referenced by checkSentenceAtPosition(), and DequeueAndCheck().
|
overridevirtual |
Definition at line 1144 of file gciterator.cxx.
|
private |
Definition at line 322 of file gciterator.cxx.
References m_aDocIdMap, and NextDocId().
Referenced by checkSentenceAtPosition(), and startProofreading().
|
private |
Definition at line 488 of file gciterator.cxx.
References LanguageTag::convertToBcp47(), and m_aGCImplNamesByLang.
Referenced by GetGrammarChecker(), and GetServiceList().
|
overridevirtual |
Implements LinguDispatcher.
Definition at line 1177 of file gciterator.cxx.
References getServiceForLocale(), and MyMutex().
|
private |
Definition at line 849 of file gciterator.cxx.
References m_xBreakIterator.
Referenced by checkSentenceAtPosition(), and DequeueAndCheck().
|
overridevirtual |
Definition at line 1150 of file gciterator.cxx.
|
private |
Definition at line 1063 of file gciterator.cxx.
References comphelper::getProcessComponentContext(), and m_xUpdateAccess.
Referenced by GetConfiguredGCSvcs_Impl().
|
overridevirtual |
Definition at line 902 of file gciterator.cxx.
References i, m_aCurCheckedDocId, m_aDocIdMap, m_aFPEntriesQueue, and MyMutex().
|
staticprivate |
beware of initialization order!
Definition at line 275 of file gciterator.cxx.
Referenced by AddEntry(), checkSentenceAtPosition(), DequeueAndCheck(), dispose(), disposing(), GetConfiguredGCSvcs_Impl(), GetGrammarChecker(), GetServiceList(), isProofreading(), NextDocId(), SetServiceList(), startProofreading(), and TerminateThread().
|
private |
Definition at line 314 of file gciterator.cxx.
References m_nDocIdCounter, and MyMutex().
Referenced by GetOrCreateDocId().
|
privatedelete |
|
overridevirtual |
Definition at line 947 of file gciterator.cxx.
References aEvent, m_aNotifyListeners, comphelper::OInterfaceContainerHelper3< class ListenerT >::notifyEach(), and TOOLS_WARN_EXCEPTION.
|
private |
Definition at line 377 of file gciterator.cxx.
References AddEntry(), DBG_ASSERT, and TOOLS_WARN_EXCEPTION.
Referenced by DequeueAndCheck().
|
overridevirtual |
Definition at line 1032 of file gciterator.cxx.
References m_aEventListeners, and comphelper::OInterfaceContainerHelper3< class ListenerT >::removeInterface().
|
overridevirtual |
Definition at line 984 of file gciterator.cxx.
References m_aNotifyListeners, and comphelper::OInterfaceContainerHelper3< class ListenerT >::removeInterface().
|
overridevirtual |
Definition at line 891 of file gciterator.cxx.
References m_aGCReferencesByService.
|
overridevirtual |
Implements LinguDispatcher.
Definition at line 1156 of file gciterator.cxx.
References LanguageTag::convertToBcp47(), linguistic::LinguIsUnspecified(), m_aGCImplNamesByLang, and MyMutex().
Referenced by LngSvcMgr::SetCfgServiceLists().
|
overridevirtual |
Definition at line 739 of file gciterator.cxx.
References AddEntry(), GetOrCreateDocId(), and MyMutex().
|
overridevirtual |
Definition at line 1137 of file gciterator.cxx.
References cppu::supportsService().
|
private |
Definition at line 297 of file gciterator.cxx.
References m_aWakeUpThread, m_bEnd, m_thread, MyMutex(), and t.
Referenced by dispose(), and ~GrammarCheckingIterator().
|
private |
Definition at line 108 of file gciterator.hxx.
Referenced by DequeueAndCheck(), and isProofreading().
|
private |
Definition at line 97 of file gciterator.hxx.
Referenced by dispose(), disposing(), GetOrCreateDocId(), and isProofreading().
|
private |
Definition at line 116 of file gciterator.hxx.
Referenced by addEventListener(), dispose(), and removeEventListener().
|
private |
Definition at line 90 of file gciterator.hxx.
Referenced by AddEntry(), DequeueAndCheck(), dispose(), and isProofreading().
|
private |
Definition at line 102 of file gciterator.hxx.
Referenced by GetConfiguredGCSvcs_Impl(), getServiceForLocale(), and SetServiceList().
|
private |
Definition at line 106 of file gciterator.hxx.
Referenced by dispose(), GetGrammarChecker(), and resetIgnoreRules().
|
private |
Definition at line 117 of file gciterator.hxx.
Referenced by addLinguServiceEventListener(), processLinguServiceEvent(), and removeLinguServiceEventListener().
|
private |
Definition at line 111 of file gciterator.hxx.
Referenced by AddEntry(), DequeueAndCheck(), and TerminateThread().
|
private |
Definition at line 93 of file gciterator.hxx.
Referenced by DequeueAndCheck(), and TerminateThread().
|
private |
Definition at line 109 of file gciterator.hxx.
Referenced by GetGrammarChecker().
|
private |
Definition at line 110 of file gciterator.hxx.
Referenced by NextDocId().
|
private |
Definition at line 112 of file gciterator.hxx.
Referenced by AddEntry(), and TerminateThread().
|
private |
Definition at line 119 of file gciterator.hxx.
Referenced by dispose(), and GetSuggestedEndOfSentence().
|
mutableprivate |
Definition at line 120 of file gciterator.hxx.
Referenced by GetUpdateAccess().