LCOV - code coverage report
Current view: top level - cui/source/dialogs - SpellAttrib.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 26 0.0 %
Date: 2014-11-03 Functions: 0 6 0.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             : #ifndef INCLUDED_CUI_SOURCE_DIALOGS_SPELLATTRIB_HXX
      20             : #define INCLUDED_CUI_SOURCE_DIALOGS_SPELLATTRIB_HXX
      21             : 
      22             : #include <vcl/txtattr.hxx>
      23             : #include <i18nlangtag/lang.h>
      24             : #include <com/sun/star/uno/Reference.h>
      25             : #include <com/sun/star/uno/Sequence.h>
      26             : #include <com/sun/star/lang/Locale.hpp>
      27             : #include <com/sun/star/linguistic2/XProofreader.hpp>
      28             : #include <tools/color.hxx>
      29             : 
      30             : #define TEXTATTR_SPELL_ERROR            (TEXTATTR_USER_START + 1)
      31             : #define TEXTATTR_SPELL_LANGUAGE         (TEXTATTR_USER_START + 2)
      32             : #define TEXTATTR_SPELL_BACKGROUND       (TEXTATTR_USER_START + 3)
      33             : 
      34             : namespace svx{
      35           0 : struct SpellErrorDescription
      36             : {
      37             :     bool                                                bIsGrammarError;
      38             :     OUString                                     sErrorText;
      39             :     OUString                                     sDialogTitle;
      40             :     OUString                                     sExplanation;
      41             :     OUString                                     sExplanationURL;
      42             :     ::com::sun::star::lang::Locale                      aLocale;
      43             :     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
      44             :     OUString                                     sServiceName; ///< service name of GrammarChecker/SpellChecker
      45             :     ::com::sun::star::uno::Sequence< OUString >  aSuggestions;
      46             :     OUString                                     sRuleId;
      47             : 
      48             :     SpellErrorDescription() :
      49             :         bIsGrammarError( false ){}
      50             : 
      51           0 :     SpellErrorDescription( bool bGrammar,
      52             :                       const OUString& rText,
      53             :                       const ::com::sun::star::lang::Locale& rLocale,
      54             :                       const ::com::sun::star::uno::Sequence< OUString >& rSuggestions,
      55             :                       ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > rxGrammarChecker,
      56             :                       const OUString& rServiceName,
      57             :                       const OUString* pDialogTitle = 0,
      58             :                       const OUString* pExplanation = 0,
      59             :                       const OUString* pRuleId = 0,
      60             :                       const OUString* pExplanationURL = 0 ) :
      61             :         bIsGrammarError( bGrammar ),
      62             :         sErrorText( rText ),
      63             :         sDialogTitle( ),
      64             :         sExplanation( ),
      65             :         sExplanationURL( ),
      66             :         aLocale( rLocale ),
      67             :         xGrammarChecker( rxGrammarChecker ),
      68             :         sServiceName( rServiceName ),
      69           0 :         aSuggestions( rSuggestions )
      70             :         {
      71           0 :             if( pDialogTitle )
      72           0 :                 sDialogTitle = *pDialogTitle;
      73           0 :             if( pExplanation )
      74           0 :                 sExplanation = *pExplanation;
      75           0 :             if( pExplanationURL )
      76           0 :                 sExplanationURL = *pExplanationURL;
      77           0 :             if( pRuleId )
      78           0 :                 sRuleId = *pRuleId;
      79           0 :         };
      80             : 
      81           0 :     bool operator==( const SpellErrorDescription& rDesc ) const
      82             :     {
      83           0 :         return bIsGrammarError == rDesc.bIsGrammarError &&
      84           0 :                 sErrorText.equals( rDesc.sErrorText ) &&
      85           0 :                 aLocale.Language.equals( rDesc.aLocale.Language ) &&
      86           0 :                 aLocale.Country.equals( rDesc.aLocale.Country ) &&
      87           0 :                 aLocale.Variant.equals( rDesc.aLocale.Variant ) &&
      88           0 :                 aSuggestions == rDesc.aSuggestions &&
      89           0 :                 xGrammarChecker == rDesc.xGrammarChecker &&
      90           0 :                 sDialogTitle.equals( rDesc.sDialogTitle ) &&
      91           0 :                 sExplanation.equals( rDesc.sExplanation ) &&
      92           0 :                 sExplanationURL.equals( rDesc.sExplanationURL ) &&
      93           0 :                 sRuleId == rDesc.sRuleId;
      94             :     }
      95             : };
      96             : 
      97             : 
      98             : class SpellErrorAttrib : public TextAttrib
      99             : {
     100             : public:
     101             : 
     102             : private:
     103             :     SpellErrorDescription        m_aSpellErrorDescription;
     104             : 
     105             :                             //not accessible
     106             :                             SpellErrorAttrib();
     107             : public:
     108             :                             SpellErrorAttrib( const SpellErrorDescription& );
     109             :                             SpellErrorAttrib( const SpellErrorAttrib& rAttr );
     110             :                             virtual ~SpellErrorAttrib();
     111             : 
     112           0 :     const SpellErrorDescription& GetErrorDescription() const { return m_aSpellErrorDescription; }
     113             : 
     114             : 
     115             :     virtual void            SetFont( vcl::Font& rFont ) const SAL_OVERRIDE;
     116             :     virtual TextAttrib*     Clone() const SAL_OVERRIDE;
     117             :     virtual bool            operator==( const TextAttrib& rAttr ) const SAL_OVERRIDE;
     118             : };
     119             : 
     120             : 
     121             : class SpellLanguageAttrib : public TextAttrib
     122             : {
     123             :     LanguageType m_eLanguage;
     124             : 
     125             :                             //not accessible
     126             :                             SpellLanguageAttrib();
     127             : 
     128             : public:
     129             :                             SpellLanguageAttrib(LanguageType eLanguage);
     130             :                             SpellLanguageAttrib( const SpellLanguageAttrib& rAttr );
     131             :                             virtual ~SpellLanguageAttrib();
     132             : 
     133           0 :     LanguageType            GetLanguage() const {return m_eLanguage;}
     134             :     void                    SetLanguage(LanguageType eLang)
     135             :                                         {m_eLanguage = eLang;}
     136             : 
     137             : 
     138             :     virtual void            SetFont( vcl::Font& rFont ) const SAL_OVERRIDE;
     139             :     virtual TextAttrib*     Clone() const SAL_OVERRIDE;
     140             :     virtual bool            operator==( const TextAttrib& rAttr ) const SAL_OVERRIDE;
     141             : };
     142             : 
     143             : 
     144             : class SpellBackgroundAttrib : public TextAttrib
     145             : {
     146             :     Color   m_aBackgroundColor;
     147             : 
     148             :                             //not accessible
     149             :                             SpellBackgroundAttrib();
     150             : 
     151             : public:
     152             :                             SpellBackgroundAttrib(const Color& rCol);
     153             :                             SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr );
     154             :                             virtual ~SpellBackgroundAttrib();
     155             : 
     156             :     const   Color&          GetColor() const { return m_aBackgroundColor;}
     157             :     void                    SetColor( const Color& rNewCol ){m_aBackgroundColor = rNewCol;}
     158             : 
     159             : 
     160             :     virtual void            SetFont( vcl::Font& rFont ) const SAL_OVERRIDE;
     161             :     virtual TextAttrib*     Clone() const SAL_OVERRIDE;
     162             :     virtual bool            operator==( const TextAttrib& rAttr ) const SAL_OVERRIDE;
     163             : };
     164             : }//namespace svx
     165             : #endif
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10