LCOV - code coverage report
Current view: top level - include/editeng - splwrap.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 9 66.7 %
Date: 2015-06-13 12:38:46 Functions: 5 8 62.5 %
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             : #ifndef INCLUDED_EDITENG_SPLWRAP_HXX
      20             : #define INCLUDED_EDITENG_SPLWRAP_HXX
      21             : 
      22             : #include <editeng/editengdllapi.h>
      23             : #include <editeng/svxenum.hxx>
      24             : #include <rtl/ustring.hxx>
      25             : #include <com/sun/star/uno/Reference.hxx>
      26             : #include <vcl/vclptr.hxx>
      27             : 
      28             : // forward ---------------------------------------------------------------
      29             : 
      30             : namespace com { namespace sun { namespace star { namespace linguistic2 {
      31             :     class XDictionary;
      32             :     class XSpellChecker1;
      33             :     class XHyphenator;
      34             : }}}}
      35             : 
      36             : namespace vcl { class Window; }
      37             : class SdrObject;
      38             : // misc functions ---------------------------------------------------------------
      39             : 
      40             : void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( OUString &rOldText, const OUString &rNewText );
      41             : 
      42             : /*--------------------------------------------------------------------
      43             :      Description: The SpellWrapper
      44             :  --------------------------------------------------------------------*/
      45             : 
      46             : class EDITENG_DLLPUBLIC SvxSpellWrapper {
      47             : private:
      48             :     friend class SvxSpellCheckDialog;
      49             :     friend class SvxHyphenWordDialog;
      50             :     friend struct SvxHyphenWordDialog_Impl;
      51             : 
      52             :     VclPtr<vcl::Window>     pWin;
      53             :     ::com::sun::star::uno::Reference<
      54             :         ::com::sun::star::uno::XInterface >             xLast;  // result of last spelling/hyphenation attempt
      55             :     ::com::sun::star::uno::Reference<
      56             :         ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
      57             :     ::com::sun::star::uno::Reference<
      58             :         ::com::sun::star::linguistic2::XHyphenator >    xHyph;
      59             :     SdrObject*  mpTextObj;
      60             :     bool        bOtherCntnt : 1; // set => Check special sections initially
      61             :     bool        bDialog     : 1; // Is pWin the Svx...Dialog?
      62             :     bool        bHyphen     : 1; // Split instead of spell checking
      63             :     bool        bAuto       : 1; // AutoCorrect available?
      64             :     bool        bReverse    : 1; // Reverse spell check
      65             :     bool        bStartDone  : 1; // Beginning already corrected
      66             :     bool        bEndDone    : 1; // End part already corrected
      67             :     bool        bStartChk   : 1; // Examine the beginning
      68             :     bool        bRevAllowed : 1; // Reverse spell check prohibited
      69             :     bool        bAllRight   : 1; // Record wrong words in the dedicated
      70             :                                  // dictionary and do not start the dialog.
      71             : 
      72             :     EDITENG_DLLPRIVATE bool     SpellNext();        // select next area
      73             :     bool    FindSpellError();   // Check for errors (over areas)
      74             : 
      75             : public:
      76             :     SvxSpellWrapper( vcl::Window* pWn,
      77             :                      ::com::sun::star::uno::Reference<
      78             :                          ::com::sun::star::linguistic2::XSpellChecker1 >  &xSpellChecker,
      79             :                      const bool bStart = false, const bool bIsAllRight = false,
      80             :                      const bool bOther = false, const bool bRevAllow = true );
      81             :     SvxSpellWrapper( vcl::Window* pWn,
      82             :                      ::com::sun::star::uno::Reference<
      83             :                          ::com::sun::star::linguistic2::XHyphenator >  &xHyphenator,
      84             :                      const bool bStart = false, const bool bOther = false );
      85             : 
      86             :     virtual ~SvxSpellWrapper();
      87             : 
      88             :     static sal_Int16    CheckSpellLang(
      89             :                             ::com::sun::star::uno::Reference<
      90             :                                 ::com::sun::star::linguistic2::XSpellChecker1 >  xSpell,
      91             :                             sal_Int16 nLang );
      92             :     static sal_Int16    CheckHyphLang(
      93             :                             ::com::sun::star::uno::Reference<
      94             :                                 ::com::sun::star::linguistic2::XHyphenator >  xHyph,
      95             :                             sal_Int16 nLang );
      96             : 
      97             :     static void         ShowLanguageErrors();
      98             : 
      99             :     void            SpellDocument();        // Perform Spell Checking
     100          84 :     inline bool     IsStartDone(){ return bStartDone; }
     101           0 :     inline bool     IsEndDone(){ return bEndDone; }
     102             :     inline bool     IsReverse(){ return bReverse; }
     103             :     inline bool     IsDialog(){ return bDialog; } // SvxSpellCheckDialog OnScreen
     104          84 :     inline bool     IsHyphen(){ return bHyphen; } // Split instead of Spell check
     105           0 :     inline void     SetHyphen( const bool bNew = true ){ bHyphen = bNew; }
     106             :     inline ::com::sun::star::uno::Reference<
     107             :         ::com::sun::star::linguistic2::XSpellChecker1 >
     108             :                     GetXSpellChecker() { return xSpell; }
     109             :     inline ::com::sun::star::uno::Reference<
     110             :         ::com::sun::star::linguistic2::XHyphenator >
     111             :                     GetXHyphenator()    { return xHyph; }
     112          84 :     inline bool     IsAllRight()        { return bAllRight; }
     113             :     inline vcl::Window*  GetWin() { return pWin; }
     114             :     inline void     EnableAutoCorrect() { bAuto = true; }
     115             : 
     116             : protected:
     117             :     ::com::sun::star::uno::Reference<
     118             :         ::com::sun::star::uno::XInterface >
     119         336 :                      GetLast()      { return xLast; }
     120          84 :     void             SetLast(const ::com::sun::star::uno::Reference<
     121             :                                 ::com::sun::star::uno::XInterface >  &xNewLast)
     122          84 :                             { xLast = xNewLast; }
     123             :     virtual bool SpellMore();               // examine further documents?
     124             :     virtual bool HasOtherCnt();             // Are there any special areas?
     125             :     virtual void SpellStart( SvxSpellArea eSpell ); // Preparing the area
     126             :     virtual bool SpellContinue();     // Check Areas
     127             :                                           // Result available through GetLast
     128             :     virtual void ReplaceAll( const OUString &rNewText, sal_Int16 nLanguage ); //Replace word from the replace list
     129             :     static ::com::sun::star::uno::Reference<
     130             :         ::com::sun::star::linguistic2::XDictionary >
     131             :                  GetAllRightDic();
     132             :     virtual void SpellEnd();                        // Finish area
     133             :     virtual void ScrollArea();                      // Set ScrollArea
     134             :     // Replace word
     135             :     virtual void ChangeWord( const OUString& rNewWord, const sal_uInt16 nLang );
     136             :     // Wort via Thesaurus ersetzen
     137             :     virtual void ChangeThesWord( const OUString& rNewWord );
     138             :     virtual void AutoCorrect( const OUString& rAktStr, const OUString& rNewStr );
     139             :     virtual void InsertHyphen( const sal_Int32 nPos ); // Insert hyphen
     140             : 
     141           0 :     void SetCurTextObj( SdrObject* pObj ) { mpTextObj = pObj; }
     142             :     SdrObject* GetCurTextObj() { return mpTextObj; }
     143             : };
     144             : 
     145             : #endif
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11