/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_LINGUISTIC_SOURCE_GCITERATOR_HXX #define INCLUDED_LINGUISTIC_SOURCE_GCITERATOR_HXX #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defs.hxx" struct FPEntry { // flat paragraph iterator css::uno::Reference< css::text::XFlatParagraphIterator > m_xParaIterator; // flat paragraph css::uno::WeakReference< css::text::XFlatParagraph > m_xPara; // document ID to identify different documents OUString m_aDocId; // the starting position to be checked sal_Int32 m_nStartIndex; // the flag to identify whether the document does automatic grammar checking bool m_bAutomatic; FPEntry() : m_aDocId() , m_nStartIndex( 0 ) , m_bAutomatic( false ) { } }; class GrammarCheckingIterator: public cppu::WeakImplHelper < css::linguistic2::XProofreadingIterator, css::linguistic2::XLinguServiceEventListener, css::linguistic2::XLinguServiceEventBroadcaster, css::lang::XComponent, css::lang::XServiceInfo >, public LinguDispatcher { //the queue is keeping track of all sentences to be checked //every element of this queue is a FlatParagraphEntry struct-object typedef std::deque< FPEntry > FPQueue_t; // queue for entries to be processed FPQueue_t m_aFPEntriesQueue; // the flag to end the endless loop bool m_bEnd; // Note that it must be the pointer and not the uno-reference to check if it is the same implementation object typedef std::map< XComponent *, OUString > DocMap_t; DocMap_t m_aDocIdMap; // language -> implname mapping typedef std::map< LanguageType, OUString > GCImplNames_t; GCImplNames_t m_aGCImplNamesByLang; // implname -> UNO reference mapping typedef std::map< OUString, css::uno::Reference< css::linguistic2::XProofreader > > GCReferences_t; GCReferences_t m_aGCReferencesByService; OUString m_aCurCheckedDocId; bool m_bGCServicesChecked; sal_Int32 m_nDocIdCounter; osl::Condition m_aWakeUpThread; oslThread m_thread; //! beware of initialization order! struct MyMutex : public rtl::Static< osl::Mutex, MyMutex > {}; comphelper::OInterfaceContainerHelper2 m_aEventListeners; comphelper::OInterfaceContainerHelper2 m_aNotifyListeners; css::uno::Reference< css::i18n::XBreakIterator > m_xBreakIterator; mutable css::uno::Reference< css::util::XChangesBatch > m_xUpdateAccess; void TerminateThread(); sal_Int32 NextDocId(); OUString GetOrCreateDocId( const css::uno::Reference< css::lang::XComponent > &xComp ); void AddEntry( const css::uno::WeakReference< css::text::XFlatParagraphIterator >& xFlatParaIterator, const css::uno::WeakReference< 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( const css::lang::Locale & rLocale ); css::uno::Reference< css::util::XChangesBatch > const & GetUpdateAccess() const; GrammarCheckingIterator( const GrammarCheckingIterator & ) = delete; GrammarCheckingIterator & operator = ( const GrammarCheckingIterator & ) = delete; public: void DequeueAndCheck(); explicit GrammarCheckingIterator(); virtual ~GrammarCheckingIterator() override; // XProofreadingIterator 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; // XLinguServiceEventListener virtual void SAL_CALL processLinguServiceEvent( const css::linguistic2::LinguServiceEvent& aLngSvcEvent ) override; // XLinguServiceEventBroadcaster 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; // XComponent 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; // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; // XServiceInfo 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; // LinguDispatcher 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; }; /** Implementation of the css::container::XStringKeyMap interface */ class LngXStringKeyMap : public ::cppu::WeakImplHelper { public: LngXStringKeyMap(); virtual css::uno::Any SAL_CALL getValue(const OUString& aKey) override; virtual sal_Bool SAL_CALL hasValue(const OUString& aKey) override; virtual void SAL_CALL insertValue(const OUString& aKey, const css::uno::Any& aValue) override; virtual ::sal_Int32 SAL_CALL getCount() override; virtual OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) override; virtual css::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) override; private: LngXStringKeyMap(LngXStringKeyMap const &) = delete; void operator=(LngXStringKeyMap const &) = delete; ~LngXStringKeyMap() override{}; std::map maMap; }; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ value='distro/ubuntu/oneiric-3.4-all'>distro/ubuntu/oneiric-3.4-all LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2024-07-20cid#1554791 COPY_INSTEAD_OF_MOVECaolán McNamara
2024-05-08loplugin:ostr in embeddedobjNoel Grandin
2021-04-08tdf#141529 sync linked OLE save(s) with hosting file save(s)Armin Le Grand (Allotropia)
2018-08-01Add missing sal/log.hxx headersGabor Kelemen
2018-06-28Fix typosAndrea Gelmini
2017-10-01throw more useful uno::Exception'sNoel Grandin
2017-09-21loplugin:flatten in editeng..extensionsNoel Grandin
2017-06-26Resolves: tdf#108643 don't restore orig size on first chart activateCaolán McNamara
2017-02-15Some simplifications, using UNO_QUERY_THROWStephan Bergmann
2017-02-06Add missing #includesStephan Bergmann
2017-01-31teach lolugin:stringconstant about calling constructorsNoel Grandin
2017-01-26Remove dynamic exception specificationsStephan Bergmann
2017-01-23use rtl::Reference in OCommonEmbeddedObjectNoel Grandin
2016-09-16embeddedobj: add a comment why the original size is restoredMichael Stahl
2016-09-15disable generation of ole previews in ODF format until after loadCaolán McNamara
2015-06-23Resolves: tdf#91683 Revert avoid activating chart objects...Caolán McNamara
2015-04-01Replace remaining getCppuType et al with cppu::UnoTypeStephan Bergmann
2015-03-27avoid activating chart objects just to get their mapunit or set visual sizeCaolán McNamara
2014-05-27remove unnecessary use of Reference constructor in throwNoel Grandin
2014-05-27remove unnecessary use of OUString constructor when throwingNoel Grandin
2014-04-22embeddedobj: sal_Bool->boolNoel Grandin
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann
2013-09-29don't use SAL_WARN to log callsMarkus Mohrhard
2013-05-31fdo#63690 - replace RTL_CONTEXT_ macros with SAL_INFORadu Ioan
2013-05-06remove usage of RTL_CONSTASCII_USTRINGPARAMLuboš Luňák
2013-04-07mass removal of rtl:: prefixes for O(U)String*Luboš Luňák
2013-03-19automated removal of RTL_CONSTASCII_USTRINGPARAM for quoted OUStringsThomas Arnhold
2012-09-29re-base on ALv2 code.Michael Meeks
2011-11-23Yet another empty pch file; in embeddedobj this time.Joseph Powers
2011-03-29drop bogus executable flag from [ch]xx/bas/asm filesFrancisco Saito
2011-03-12Merge commit 'ooo/DEV300_m101' into integration/dev300_m101Thorsten Behrens
2010-11-20RTL_CONSTASCII_USTRINGPARAM improvementsJulien Nabet
2010-10-13Add vim/emacs modelines to all source filesSebastian Spaeth
2010-02-12changefileheader2: #i109125#: change source file copyright notice from Sun Mi...Jens-Heiner Rechtien
2009-04-23CWS-TOOLING: integrate CWS mav50_DEV300Ivo Hinkelmann
2008-04-11INTEGRATION: CWS changefileheader (1.13.20); FILE MERGEDRüdiger Timm
2007-08-02INTEGRATION: CWS fwk69 (1.12.14); FILE MERGEDJens-Heiner Rechtien
2007-05-22INTEGRATION: CWS chart2mst3 (1.4.30); FILE MERGEDVladimir Glazounov
2006-10-16#100000# resolve problems of merging with warning free cws changesMikhail Voitenko
2006-10-13INTEGRATION: CWS opofxmlstorage (1.6.14); FILE MERGEDOliver Bolte
2006-10-12INTEGRATION: CWS sb59 (1.7.22); FILE MERGEDOliver Bolte
2006-09-16INTEGRATION: CWS pchfix02 (1.7.16); FILE MERGEDOliver Bolte
2006-06-19INTEGRATION: CWS warnings01 (1.5.10); FILE MERGEDJens-Heiner Rechtien
2006-01-20INTEGRATION: CWS optstor2 (1.4.56); FILE MERGEDOliver Bolte
2005-09-08INTEGRATION: CWS ooo19126 (1.4.50); FILE MERGEDRüdiger Timm
2005-01-31INTEGRATION: CWS mav15 (1.3.38); FILE MERGEDRüdiger Timm
2004-10-04INTEGRATION: CWS mav09 (1.1.2); FILE MERGEDKurt Zenker
2004-05-10INTEGRATION: CWS fwkbugfix02 (1.1.10); FILE MERGEDJens-Heiner Rechtien
2003-10-27#112739# initial versionMikhail Voitenko