LCOV - code coverage report
Current view: top level - editeng/source/editeng - edtspell.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 7 57.1 %
Date: 2012-08-25 Functions: 5 8 62.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _EDTSPELL_HXX
      30                 :            : #define _EDTSPELL_HXX
      31                 :            : 
      32                 :            : #include <com/sun/star/uno/Reference.h>
      33                 :            : #include <editeng/editengdllapi.h>
      34                 :            : #include <editeng/splwrap.hxx>
      35                 :            : #include <editeng/svxacorr.hxx>
      36                 :            : #include <editeng/svxenum.hxx>
      37                 :            : #include <tools/link.hxx>
      38                 :            : #include <vcl/outdev.hxx>
      39                 :            : 
      40                 :            : namespace com { namespace sun { namespace star { namespace linguistic2 {
      41                 :            :     class XSpellChecker1;
      42                 :            : }}}}
      43                 :            : 
      44                 :            : 
      45                 :            : class EditView;
      46                 :            : class EditEngine;
      47                 :            : class ContentNode;
      48                 :            : 
      49         [ -  + ]:         36 : class EditSpellWrapper : public SvxSpellWrapper
      50                 :            : {
      51                 :            : private:
      52                 :            :     EditView*               pEditView;
      53                 :            :     void                    CheckSpellTo();
      54                 :            : 
      55                 :            : protected:
      56                 :            :     virtual void            SpellStart( SvxSpellArea eArea );
      57                 :            :     virtual sal_Bool            SpellContinue();    // Check area
      58                 :            :     virtual void            ReplaceAll( const String &rNewText, sal_Int16 nLanguage );
      59                 :            :     virtual void            SpellEnd();
      60                 :            :     virtual sal_Bool            SpellMore();
      61                 :            :     virtual sal_Bool            HasOtherCnt();
      62                 :            :     virtual void            ScrollArea();
      63                 :            :     virtual void            ChangeWord( const String& rNewWord, const sal_uInt16 nLang );
      64                 :            :     virtual void            ChangeThesWord( const String& rNewWord );
      65                 :            :     virtual void            AutoCorrect( const String& rOldWord, const String& rNewWord );
      66                 :            : 
      67                 :            : public:
      68                 :            :     EditSpellWrapper( Window* pWin,
      69                 :            :             ::com::sun::star::uno::Reference<
      70                 :            :                 ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker,
      71                 :            :             sal_Bool bIsStart,
      72                 :            :             sal_Bool bIsAllRight, EditView* pView );
      73                 :            : 
      74                 :            : };
      75                 :            : 
      76                 :            : 
      77                 :            : struct WrongRange
      78                 :            : {
      79                 :            :     sal_uInt16 nStart;
      80                 :            :     sal_uInt16 nEnd;
      81                 :            : 
      82                 :        197 :     WrongRange( sal_uInt16 nS, sal_uInt16 nE ) { nStart = nS; nEnd = nE; }
      83                 :            : };
      84                 :            : 
      85                 :            : class WrongList
      86                 :            : {
      87                 :            : private:
      88                 :            :     std::vector<WrongRange> maRanges;
      89                 :            :     sal_uInt16  nInvalidStart;
      90                 :            :     sal_uInt16  nInvalidEnd;
      91                 :            : 
      92                 :            :     sal_Bool    DbgIsBuggy() const;
      93                 :            : 
      94                 :            : public:
      95                 :            :     typedef std::vector<WrongRange>::iterator iterator;
      96                 :            :     typedef std::vector<WrongRange>::const_iterator const_iterator;
      97                 :            : 
      98                 :            :     WrongList();
      99                 :            :     WrongList(const WrongList& r);
     100                 :            :     ~WrongList();
     101                 :            : 
     102                 :            :     bool    IsInvalid() const;
     103                 :            :     void    SetValid();
     104                 :            :     void    MarkInvalid( sal_uInt16 nS, sal_uInt16 nE );
     105                 :            : 
     106                 :          0 :     sal_uInt16  GetInvalidStart() const { return nInvalidStart; }
     107                 :       2544 :     sal_uInt16& GetInvalidStart()       { return nInvalidStart; }
     108                 :            : 
     109                 :          0 :     sal_uInt16  GetInvalidEnd() const   { return nInvalidEnd; }
     110                 :       2544 :     sal_uInt16& GetInvalidEnd()         { return nInvalidEnd; }
     111                 :            : 
     112                 :            :     void    TextInserted( sal_uInt16 nPos, sal_uInt16 nChars, sal_Bool bPosIsSep );
     113                 :            :     void    TextDeleted( sal_uInt16 nPos, sal_uInt16 nChars );
     114                 :            : 
     115                 :            :     void    InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, sal_Bool bClearRange );
     116                 :            :     sal_Bool    NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const;
     117                 :            :     sal_Bool    HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const;
     118                 :            :     sal_Bool    HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const;
     119                 :            :     void    ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, const ContentNode* pNode );
     120                 :            :     void    MarkWrongsInvalid();
     121                 :            : 
     122                 :            :     WrongList*  Clone() const;
     123                 :            : 
     124                 :            :     // #i102062#
     125                 :            :     bool operator==(const WrongList& rCompare) const;
     126                 :            : 
     127                 :            :     bool empty() const;
     128                 :            :     void push_back(const WrongRange& rRange);
     129                 :            :     WrongRange& back();
     130                 :            :     const WrongRange& back() const;
     131                 :            : 
     132                 :            :     iterator begin();
     133                 :            :     iterator end();
     134                 :            :     const_iterator begin() const;
     135                 :            :     const_iterator end() const;
     136                 :            : };
     137                 :            : 
     138                 :            : class EdtAutoCorrDoc : public SvxAutoCorrDoc
     139                 :            : {
     140                 :            :     EditEngine* mpEditEngine;
     141                 :            :     ContentNode*    pCurNode;
     142                 :            :     sal_uInt16          nCursor;
     143                 :            : 
     144                 :            :     sal_Bool            bAllowUndoAction;
     145                 :            :     sal_Bool            bUndoAction;
     146                 :            : 
     147                 :            : protected:
     148                 :            :     void            ImplStartUndoAction();
     149                 :            : 
     150                 :            : public:
     151                 :            :     EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_uInt16 nCrsr, sal_Unicode cIns);
     152                 :            :     ~EdtAutoCorrDoc();
     153                 :            : 
     154                 :            :     virtual sal_Bool    Delete( sal_uInt16 nStt, sal_uInt16 nEnd );
     155                 :            :     virtual sal_Bool    Insert( sal_uInt16 nPos, const String& rTxt );
     156                 :            :     virtual sal_Bool    Replace( sal_uInt16 nPos, const String& rTxt );
     157                 :            :     virtual sal_Bool    ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt );
     158                 :            : 
     159                 :            :     virtual sal_Bool    SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, sal_uInt16 nSlotId, SfxPoolItem& );
     160                 :            :     virtual sal_Bool    SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, const String& rURL );
     161                 :            : 
     162                 :            :     virtual sal_Bool    HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd );
     163                 :            : 
     164                 :            :     virtual const String* GetPrevPara( sal_Bool bAtNormalPos );
     165                 :            : 
     166                 :            :     virtual sal_Bool    ChgAutoCorrWord( sal_uInt16& rSttPos, sal_uInt16 nEndPos,
     167                 :            :                                   SvxAutoCorrect& rACorrect, const String** ppPara );
     168                 :            : 
     169                 :            :     virtual LanguageType GetLanguage( sal_uInt16 nPos, sal_Bool bPrevPara = sal_False ) const;
     170                 :            : 
     171                 :          0 :     sal_uInt16          GetCursor() const { return nCursor; }
     172                 :            : 
     173                 :            : };
     174                 :            : 
     175                 :            : #endif  // EDTSPELL
     176                 :            : 
     177                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10