1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SpellAttrib.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_SPELL_ATTRIB
31 #define _SVX_SPELL_ATTRIB
33 #include <svtools/txtattr.hxx>
34 #include <i18npool/lang.h>
35 #include <com/sun/star/uno/Reference.h>
36 #include <com/sun/star/uno/Sequence.h>
37 #include <com/sun/star/lang/Locale.hpp>
38 #include <com/sun/star/linguistic2/XProofreader.hpp>
39 #include <tools/color.hxx>
40 //namespace com{ namespace sun{ namespace star{ namespace linguistic2{
41 // class XSpellAlternatives;
44 #define TEXTATTR_SPELL_ERROR (TEXTATTR_USER_START + 1)
45 #define TEXTATTR_SPELL_LANGUAGE (TEXTATTR_USER_START + 2)
46 #define TEXTATTR_SPELL_BACKGROUND (TEXTATTR_USER_START + 3)
49 struct SpellErrorDescription
52 ::rtl::OUString sErrorText
;
53 ::rtl::OUString sDialogTitle
;
54 ::rtl::OUString sExplanation
;
55 ::com::sun::star::lang::Locale aLocale
;
56 ::com::sun::star::uno::Reference
< ::com::sun::star::linguistic2::XProofreader
> xGrammarChecker
;
57 ::rtl::OUString sServiceName
; //service name of GrammarChecker/SpellChecker
58 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSuggestions
;
59 ::rtl::OUString sRuleId
;
61 SpellErrorDescription() :
62 bIsGrammarError( false ){}
64 SpellErrorDescription( bool bGrammar
,
65 const ::rtl::OUString
& rText
,
66 const ::com::sun::star::lang::Locale
& rLocale
,
67 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& rSuggestions
,
68 ::com::sun::star::uno::Reference
< ::com::sun::star::linguistic2::XProofreader
> rxGrammarChecker
,
69 const ::rtl::OUString
& rServiceName
,
70 const ::rtl::OUString
* pDialogTitle
= 0,
71 const ::rtl::OUString
* pExplanation
= 0,
72 const ::rtl::OUString
* pRuleId
= 0 ) :
73 bIsGrammarError( bGrammar
),
76 xGrammarChecker( rxGrammarChecker
),
77 sServiceName( rServiceName
),
78 aSuggestions( rSuggestions
)
81 sDialogTitle
= *pDialogTitle
;
83 sExplanation
= *pExplanation
;
88 int operator==( const SpellErrorDescription
& rDesc
) const
90 return bIsGrammarError
== rDesc
.bIsGrammarError
&&
91 sErrorText
.equals( rDesc
.sErrorText
) &&
92 aLocale
.Language
.equals( rDesc
.aLocale
.Language
) &&
93 aLocale
.Country
.equals( rDesc
.aLocale
.Country
) &&
94 aLocale
.Variant
.equals( rDesc
.aLocale
.Variant
) &&
95 aSuggestions
== rDesc
.aSuggestions
&&
96 xGrammarChecker
== rDesc
.xGrammarChecker
&&
97 sDialogTitle
.equals( rDesc
.sDialogTitle
) &&
98 sExplanation
.equals( rDesc
.sExplanation
) &&
99 sRuleId
== rDesc
.sRuleId
;
102 /* -----------------10.09.2003 14:23-----------------
104 --------------------------------------------------*/
105 class SpellErrorAttrib
: public TextAttrib
110 //com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> m_xAlternatives;
111 SpellErrorDescription m_aSpellErrorDescription
;
116 // SpellErrorAttrib(com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> xAlternatives);
117 SpellErrorAttrib( const SpellErrorDescription
& );
118 SpellErrorAttrib( const SpellErrorAttrib
& rAttr
);
121 const SpellErrorDescription
& GetErrorDescription() const { return m_aSpellErrorDescription
; }
124 virtual void SetFont( Font
& rFont
) const;
125 virtual TextAttrib
* Clone() const;
126 virtual int operator==( const TextAttrib
& rAttr
) const;
128 /* -----------------10.09.2003 14:23-----------------
130 --------------------------------------------------*/
131 class SpellLanguageAttrib
: public TextAttrib
133 LanguageType m_eLanguage
;
136 SpellLanguageAttrib();
139 SpellLanguageAttrib(LanguageType eLanguage
);
140 SpellLanguageAttrib( const SpellLanguageAttrib
& rAttr
);
141 ~SpellLanguageAttrib();
143 LanguageType
GetLanguage() const {return m_eLanguage
;}
144 void SetLanguage(LanguageType eLang
)
145 {m_eLanguage
= eLang
;}
148 virtual void SetFont( Font
& rFont
) const;
149 virtual TextAttrib
* Clone() const;
150 virtual int operator==( const TextAttrib
& rAttr
) const;
152 /* -----------------31.10.2003 16:01-----------------
154 --------------------------------------------------*/
155 class SpellBackgroundAttrib
: public TextAttrib
157 Color m_aBackgroundColor
;
160 SpellBackgroundAttrib();
163 SpellBackgroundAttrib(const Color
& rCol
);
164 SpellBackgroundAttrib( const SpellBackgroundAttrib
& rAttr
);
165 ~SpellBackgroundAttrib();
167 const Color
& GetColor() const { return m_aBackgroundColor
;}
168 void SetColor( const Color
& rNewCol
){m_aBackgroundColor
= rNewCol
;}
171 virtual void SetFont( Font
& rFont
) const;
172 virtual TextAttrib
* Clone() const;
173 virtual int operator==( const TextAttrib
& rAttr
) const;