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

Generated by: LCOV version 1.10