bump product version to 6.3.0.0.beta1
[LibreOffice.git] / cui / source / dialogs / SpellAttrib.hxx
blob2a458166b42dbbcb6528d287ef6e8de368b3b9a0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CUI_SOURCE_DIALOGS_SPELLATTRIB_HXX
20 #define INCLUDED_CUI_SOURCE_DIALOGS_SPELLATTRIB_HXX
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>
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)
34 namespace svx{
35 struct SpellErrorDescription
37 bool bIsGrammarError;
38 OUString sErrorText;
39 OUString sDialogTitle;
40 OUString sExplanation;
41 OUString sExplanationURL;
42 css::lang::Locale aLocale;
43 css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker;
44 css::uno::Sequence< OUString > aSuggestions;
45 OUString sRuleId;
47 SpellErrorDescription( bool bGrammar,
48 const OUString& rText,
49 const css::lang::Locale& rLocale,
50 const css::uno::Sequence< OUString >& rSuggestions,
51 css::uno::Reference< css::linguistic2::XProofreader > const & rxGrammarChecker,
52 const OUString* pDialogTitle = nullptr,
53 const OUString* pExplanation = nullptr,
54 const OUString* pRuleId = nullptr,
55 const OUString* pExplanationURL = nullptr ) :
56 bIsGrammarError( bGrammar ),
57 sErrorText( rText ),
58 sDialogTitle( ),
59 sExplanation( ),
60 sExplanationURL( ),
61 aLocale( rLocale ),
62 xGrammarChecker( rxGrammarChecker ),
63 aSuggestions( rSuggestions )
65 if( pDialogTitle )
66 sDialogTitle = *pDialogTitle;
67 if( pExplanation )
68 sExplanation = *pExplanation;
69 if( pExplanationURL )
70 sExplanationURL = *pExplanationURL;
71 if( pRuleId )
72 sRuleId = *pRuleId;
75 bool operator==( const SpellErrorDescription& rDesc ) const
77 return bIsGrammarError == rDesc.bIsGrammarError &&
78 sErrorText == rDesc.sErrorText &&
79 aLocale.Language == rDesc.aLocale.Language &&
80 aLocale.Country == rDesc.aLocale.Country &&
81 aLocale.Variant == rDesc.aLocale.Variant &&
82 aSuggestions == rDesc.aSuggestions &&
83 xGrammarChecker == rDesc.xGrammarChecker &&
84 sDialogTitle == rDesc.sDialogTitle &&
85 sExplanation == rDesc.sExplanation &&
86 sExplanationURL == rDesc.sExplanationURL &&
87 sRuleId == rDesc.sRuleId;
92 class SpellErrorAttrib : public TextAttrib
94 public:
96 private:
97 SpellErrorDescription m_aSpellErrorDescription;
99 public:
100 SpellErrorAttrib( const SpellErrorDescription& );
102 const SpellErrorDescription& GetErrorDescription() const { return m_aSpellErrorDescription; }
105 virtual void SetFont( vcl::Font& rFont ) const override;
106 virtual std::unique_ptr<TextAttrib> Clone() const override;
107 virtual bool operator==( const TextAttrib& rAttr ) const override;
111 class SpellLanguageAttrib : public TextAttrib
113 LanguageType m_eLanguage;
115 public:
116 SpellLanguageAttrib(LanguageType eLanguage);
118 LanguageType GetLanguage() const {return m_eLanguage;}
120 virtual void SetFont( vcl::Font& rFont ) const override;
121 virtual std::unique_ptr<TextAttrib> Clone() const override;
122 virtual bool operator==( const TextAttrib& rAttr ) const override;
126 class SpellBackgroundAttrib : public TextAttrib
128 Color m_aBackgroundColor;
130 public:
131 SpellBackgroundAttrib(const Color& rCol);
133 virtual void SetFont( vcl::Font& rFont ) const override;
134 virtual std::unique_ptr<TextAttrib> Clone() const override;
135 virtual bool operator==( const TextAttrib& rAttr ) const override;
137 }//namespace svx
138 #endif
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */