LCOV - code coverage report
Current view: top level - editeng/source/editeng - edtspell.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 5 80.0 %
Date: 2015-06-13 12:38:46 Functions: 5 6 83.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_EDITENG_SOURCE_EDITENG_EDTSPELL_HXX
      21             : #define INCLUDED_EDITENG_SOURCE_EDITENG_EDTSPELL_HXX
      22             : 
      23             : #include <com/sun/star/uno/Reference.h>
      24             : #include <editeng/editengdllapi.h>
      25             : #include <editeng/splwrap.hxx>
      26             : #include <editeng/svxacorr.hxx>
      27             : #include <editeng/svxenum.hxx>
      28             : #include "editeng/misspellrange.hxx"
      29             : #include <tools/link.hxx>
      30             : #include <vcl/outdev.hxx>
      31             : 
      32             : namespace com { namespace sun { namespace star { namespace linguistic2 {
      33             :     class XSpellChecker1;
      34             : }}}}
      35             : 
      36             : 
      37             : class EditView;
      38             : class EditEngine;
      39             : class ContentNode;
      40             : 
      41         168 : class EditSpellWrapper : public SvxSpellWrapper
      42             : {
      43             : private:
      44             :     EditView*               pEditView;
      45             :     void                    CheckSpellTo();
      46             : 
      47             : protected:
      48             :     virtual void            SpellStart( SvxSpellArea eArea ) SAL_OVERRIDE;
      49             :     virtual bool            SpellContinue() SAL_OVERRIDE;    // Check area
      50             :     virtual void            ReplaceAll( const OUString &rNewText, sal_Int16 nLanguage ) SAL_OVERRIDE;
      51             :     virtual void            SpellEnd() SAL_OVERRIDE;
      52             :     virtual bool            SpellMore() SAL_OVERRIDE;
      53             :     virtual bool            HasOtherCnt() SAL_OVERRIDE;
      54             :     virtual void            ScrollArea() SAL_OVERRIDE;
      55             :     virtual void            ChangeWord( const OUString& rNewWord, const sal_uInt16 nLang ) SAL_OVERRIDE;
      56             :     virtual void            ChangeThesWord( const OUString& rNewWord ) SAL_OVERRIDE;
      57             :     virtual void            AutoCorrect( const OUString& rOldWord, const OUString& rNewWord ) SAL_OVERRIDE;
      58             : 
      59             : public:
      60             :     EditSpellWrapper( vcl::Window* pWin,
      61             :             ::com::sun::star::uno::Reference<
      62             :                 ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker,
      63             :             bool bIsStart,
      64             :             bool bIsAllRight, EditView* pView );
      65             : 
      66             : };
      67             : 
      68             : /**
      69             :  * Keeps track of misspelled ranges in paragraph.
      70             :  */
      71             : class WrongList
      72             : {
      73             :     static size_t Valid;
      74             : 
      75             :     std::vector<editeng::MisspellRange> maRanges;
      76             :     size_t mnInvalidStart;
      77             :     size_t mnInvalidEnd;
      78             : 
      79             :     bool DbgIsBuggy() const;
      80             : 
      81             : public:
      82             :     typedef std::vector<editeng::MisspellRange>::iterator iterator;
      83             :     typedef std::vector<editeng::MisspellRange>::const_iterator const_iterator;
      84             : 
      85             :     WrongList();
      86             :     WrongList(const WrongList& r);
      87             :     ~WrongList();
      88             : 
      89           5 :     const std::vector<editeng::MisspellRange>& GetRanges() const { return maRanges;}
      90             :     void SetRanges( const std::vector<editeng::MisspellRange>& rRanges );
      91             : 
      92             :     bool IsValid() const;
      93             :     void SetValid();
      94             :     void SetInvalidRange( size_t nStart, size_t nEnd );
      95             :     void ResetInvalidRange( size_t nStart, size_t nEnd );
      96             : 
      97        1067 :     size_t GetInvalidStart() const { return mnInvalidStart; }
      98        1067 :     size_t GetInvalidEnd() const   { return mnInvalidEnd; }
      99             : 
     100             :     void TextInserted( size_t nPos, size_t nLength, bool bPosIsSep );
     101             :     void TextDeleted( size_t nPos, size_t nLength );
     102             : 
     103             :     void InsertWrong( size_t nStart, size_t nEnd );
     104             :     bool NextWrong( size_t& rnStart, size_t& rnEnd ) const;
     105             :     bool HasWrong( size_t nStart, size_t nEnd ) const;
     106             :     bool HasAnyWrong( size_t nStart, size_t nEnd ) const;
     107             :     void ClearWrongs( size_t nStart, size_t nEnd, const ContentNode* pNode );
     108             :     void MarkWrongsInvalid();
     109             : 
     110             :     WrongList*  Clone() const;
     111             : 
     112             :     // #i102062#
     113             :     bool operator==(const WrongList& rCompare) const;
     114             : 
     115             :     bool empty() const;
     116             :     void push_back(const editeng::MisspellRange& rRange);
     117             :     editeng::MisspellRange& back();
     118             :     const editeng::MisspellRange& back() const;
     119             : 
     120             :     iterator begin();
     121             :     iterator end();
     122             :     const_iterator begin() const;
     123             :     const_iterator end() const;
     124             : };
     125             : 
     126             : class EdtAutoCorrDoc : public SvxAutoCorrDoc
     127             : {
     128             :     EditEngine* mpEditEngine;
     129             :     ContentNode*    pCurNode;
     130             :     sal_uInt16          nCursor;
     131             : 
     132             :     bool            bAllowUndoAction;
     133             :     bool            bUndoAction;
     134             : 
     135             : protected:
     136             :     void            ImplStartUndoAction();
     137             : 
     138             : public:
     139             :     EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_uInt16 nCrsr, sal_Unicode cIns);
     140             :     virtual ~EdtAutoCorrDoc();
     141             : 
     142             :     virtual bool    Delete( sal_Int32 nStt, sal_Int32 nEnd ) SAL_OVERRIDE;
     143             :     virtual bool    Insert( sal_Int32 nPos, const OUString& rTxt ) SAL_OVERRIDE;
     144             :     virtual bool    Replace( sal_Int32 nPos, const OUString& rTxt ) SAL_OVERRIDE;
     145             :     virtual bool    ReplaceRange( sal_Int32 nPos, sal_Int32 nLen, const OUString& rTxt ) SAL_OVERRIDE;
     146             : 
     147             :     virtual bool    SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId, SfxPoolItem& ) SAL_OVERRIDE;
     148             :     virtual bool    SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL ) SAL_OVERRIDE;
     149             : 
     150             :     virtual OUString const* GetPrevPara(bool bAtNormalPos) SAL_OVERRIDE;
     151             : 
     152             :     virtual bool        ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
     153             :                                   SvxAutoCorrect& rACorrect, OUString* pPara ) SAL_OVERRIDE;
     154             : 
     155             :     virtual LanguageType GetLanguage( sal_Int32 nPos, bool bPrevPara = false ) const SAL_OVERRIDE;
     156             : 
     157           0 :     sal_uInt16          GetCursor() const { return nCursor; }
     158             : 
     159             : };
     160             : 
     161             : #endif  // EDTSPELL
     162             : 
     163             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11