LCOV - code coverage report
Current view: top level - libreoffice/editeng/source/editeng - edtspell.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 7 42.9 %
Date: 2012-12-27 Functions: 4 8 50.0 %
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 _EDTSPELL_HXX
      21             : #define _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 <tools/link.hxx>
      29             : #include <vcl/outdev.hxx>
      30             : 
      31             : namespace com { namespace sun { namespace star { namespace linguistic2 {
      32             :     class XSpellChecker1;
      33             : }}}}
      34             : 
      35             : 
      36             : class EditView;
      37             : class EditEngine;
      38             : class ContentNode;
      39             : 
      40          12 : class EditSpellWrapper : public SvxSpellWrapper
      41             : {
      42             : private:
      43             :     EditView*               pEditView;
      44             :     void                    CheckSpellTo();
      45             : 
      46             : protected:
      47             :     virtual void            SpellStart( SvxSpellArea eArea );
      48             :     virtual sal_Bool            SpellContinue();    // Check area
      49             :     virtual void            ReplaceAll( const String &rNewText, sal_Int16 nLanguage );
      50             :     virtual void            SpellEnd();
      51             :     virtual sal_Bool            SpellMore();
      52             :     virtual sal_Bool            HasOtherCnt();
      53             :     virtual void            ScrollArea();
      54             :     virtual void            ChangeWord( const String& rNewWord, const sal_uInt16 nLang );
      55             :     virtual void            ChangeThesWord( const String& rNewWord );
      56             :     virtual void            AutoCorrect( const String& rOldWord, const String& rNewWord );
      57             : 
      58             : public:
      59             :     EditSpellWrapper( Window* pWin,
      60             :             ::com::sun::star::uno::Reference<
      61             :                 ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker,
      62             :             sal_Bool bIsStart,
      63             :             sal_Bool bIsAllRight, EditView* pView );
      64             : 
      65             : };
      66             : 
      67             : 
      68             : struct WrongRange
      69             : {
      70             :     sal_uInt16 nStart;
      71             :     sal_uInt16 nEnd;
      72             : 
      73           0 :     WrongRange( sal_uInt16 nS, sal_uInt16 nE ) { nStart = nS; nEnd = nE; }
      74             : };
      75             : 
      76             : class WrongList
      77             : {
      78             : private:
      79             :     std::vector<WrongRange> maRanges;
      80             :     sal_uInt16  nInvalidStart;
      81             :     sal_uInt16  nInvalidEnd;
      82             : 
      83             :     sal_Bool    DbgIsBuggy() const;
      84             : 
      85             : public:
      86             :     typedef std::vector<WrongRange>::iterator iterator;
      87             :     typedef std::vector<WrongRange>::const_iterator const_iterator;
      88             : 
      89             :     WrongList();
      90             :     WrongList(const WrongList& r);
      91             :     ~WrongList();
      92             : 
      93             :     bool    IsInvalid() const;
      94             :     void    SetValid();
      95             :     void    MarkInvalid( sal_uInt16 nS, sal_uInt16 nE );
      96             : 
      97           0 :     sal_uInt16  GetInvalidStart() const { return nInvalidStart; }
      98           6 :     sal_uInt16& GetInvalidStart()       { return nInvalidStart; }
      99             : 
     100           0 :     sal_uInt16  GetInvalidEnd() const   { return nInvalidEnd; }
     101           6 :     sal_uInt16& GetInvalidEnd()         { return nInvalidEnd; }
     102             : 
     103             :     void    TextInserted( sal_uInt16 nPos, sal_uInt16 nChars, sal_Bool bPosIsSep );
     104             :     void    TextDeleted( sal_uInt16 nPos, sal_uInt16 nChars );
     105             : 
     106             :     void    InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, sal_Bool bClearRange );
     107             :     sal_Bool    NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const;
     108             :     sal_Bool    HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const;
     109             :     sal_Bool    HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const;
     110             :     void    ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, const ContentNode* pNode );
     111             :     void    MarkWrongsInvalid();
     112             : 
     113             :     WrongList*  Clone() const;
     114             : 
     115             :     // #i102062#
     116             :     bool operator==(const WrongList& rCompare) const;
     117             : 
     118             :     bool empty() const;
     119             :     void push_back(const WrongRange& rRange);
     120             :     WrongRange& back();
     121             :     const WrongRange& back() const;
     122             : 
     123             :     iterator begin();
     124             :     iterator end();
     125             :     const_iterator begin() const;
     126             :     const_iterator end() const;
     127             : };
     128             : 
     129             : class EdtAutoCorrDoc : public SvxAutoCorrDoc
     130             : {
     131             :     EditEngine* mpEditEngine;
     132             :     ContentNode*    pCurNode;
     133             :     sal_uInt16          nCursor;
     134             : 
     135             :     sal_Bool            bAllowUndoAction;
     136             :     sal_Bool            bUndoAction;
     137             : 
     138             : protected:
     139             :     void            ImplStartUndoAction();
     140             : 
     141             : public:
     142             :     EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_uInt16 nCrsr, sal_Unicode cIns);
     143             :     ~EdtAutoCorrDoc();
     144             : 
     145             :     virtual sal_Bool    Delete( sal_uInt16 nStt, sal_uInt16 nEnd );
     146             :     virtual sal_Bool    Insert( sal_uInt16 nPos, const String& rTxt );
     147             :     virtual sal_Bool    Replace( sal_uInt16 nPos, const String& rTxt );
     148             :     virtual sal_Bool    ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt );
     149             : 
     150             :     virtual sal_Bool    SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, sal_uInt16 nSlotId, SfxPoolItem& );
     151             :     virtual sal_Bool    SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, const String& rURL );
     152             : 
     153             :     virtual sal_Bool    HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd );
     154             : 
     155             :     virtual const String* GetPrevPara( sal_Bool bAtNormalPos );
     156             : 
     157             :     virtual sal_Bool    ChgAutoCorrWord( sal_uInt16& rSttPos, sal_uInt16 nEndPos,
     158             :                                   SvxAutoCorrect& rACorrect, const String** ppPara );
     159             : 
     160             :     virtual LanguageType GetLanguage( sal_uInt16 nPos, sal_Bool bPrevPara = sal_False ) const;
     161             : 
     162           0 :     sal_uInt16          GetCursor() const { return nCursor; }
     163             : 
     164             : };
     165             : 
     166             : #endif  // EDTSPELL
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10