xref: /aoo41x/main/cui/source/dialogs/SpellAttrib.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
30 
31 #include <SpellAttrib.hxx>
32 #include <vcl/font.hxx>
33 #include <com/sun/star/uno/Reference.hxx>
34 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
35 using namespace svx;
36 using namespace com::sun::star::linguistic2;
37 using namespace com::sun::star::uno;
38 
39 /*-- 26.06.2008 10:41:57---------------------------------------------------
40 
41   -----------------------------------------------------------------------*/
42 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription& rDesc ) :
43     TextAttrib(TEXTATTR_SPELL_ERROR),
44     m_aSpellErrorDescription( rDesc )
45 {
46 }
47 
48 /*-- 10.09.2003 12:54:34---------------------------------------------------
49 
50   -----------------------------------------------------------------------*/
51 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib& rAttr ) :
52     TextAttrib(TEXTATTR_SPELL_ERROR),
53     m_aSpellErrorDescription( rAttr.m_aSpellErrorDescription )
54 {
55 }
56 /*-- 10.09.2003 12:54:34---------------------------------------------------
57 
58   -----------------------------------------------------------------------*/
59 SpellErrorAttrib::~SpellErrorAttrib()
60 {
61 }
62 /*-- 10.09.2003 12:54:35---------------------------------------------------
63 
64   -----------------------------------------------------------------------*/
65 void SpellErrorAttrib::SetFont( Font&  ) const
66 {
67     //this attribute doesn't have a visual effect
68 }
69 /*-- 10.09.2003 12:54:35---------------------------------------------------
70 
71   -----------------------------------------------------------------------*/
72 TextAttrib*     SpellErrorAttrib::Clone() const
73 {
74     return new SpellErrorAttrib(*this);
75 }
76 /*-- 10.09.2003 12:54:35---------------------------------------------------
77 
78   -----------------------------------------------------------------------*/
79 int SpellErrorAttrib::operator==( const TextAttrib& rAttr ) const
80 {
81     return Which() == rAttr.Which() &&
82             m_aSpellErrorDescription == static_cast<const SpellErrorAttrib&>(rAttr).m_aSpellErrorDescription;
83 }
84 /*-- 10.09.2003 14:27:43---------------------------------------------------
85 
86   -----------------------------------------------------------------------*/
87 SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang) :
88     TextAttrib(TEXTATTR_SPELL_LANGUAGE),
89     m_eLanguage(eLang)
90 {
91 }
92 /*-- 10.09.2003 14:27:43---------------------------------------------------
93 
94   -----------------------------------------------------------------------*/
95 SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ) :
96     TextAttrib(TEXTATTR_SPELL_LANGUAGE),
97     m_eLanguage(rAttr.m_eLanguage)
98 {
99 }
100 /*-- 10.09.2003 14:27:43---------------------------------------------------
101 
102   -----------------------------------------------------------------------*/
103 SpellLanguageAttrib::~SpellLanguageAttrib()
104 {
105 }
106 /*-- 10.09.2003 14:27:43---------------------------------------------------
107 
108   -----------------------------------------------------------------------*/
109 void SpellLanguageAttrib::SetFont( Font&  ) const
110 {
111     //no visual effect
112 }
113 /*-- 10.09.2003 14:27:44---------------------------------------------------
114 
115   -----------------------------------------------------------------------*/
116 TextAttrib* SpellLanguageAttrib::Clone() const
117 {
118     return new SpellLanguageAttrib(*this);
119 }
120 /*-- 10.09.2003 14:27:44---------------------------------------------------
121 
122   -----------------------------------------------------------------------*/
123 int SpellLanguageAttrib::operator==( const TextAttrib& rAttr ) const
124 {
125     return Which() == rAttr.Which() &&
126             m_eLanguage == static_cast<const SpellLanguageAttrib&>(rAttr).m_eLanguage;
127 }
128 /*-- 31.10.2003 16:07:45---------------------------------------------------
129 
130   -----------------------------------------------------------------------*/
131 SpellBackgroundAttrib::SpellBackgroundAttrib(const Color& rCol) :
132     TextAttrib(TEXTATTR_SPELL_BACKGROUND),
133     m_aBackgroundColor(rCol)
134 {
135 }
136 /*-- 31.10.2003 16:07:45---------------------------------------------------
137 
138   -----------------------------------------------------------------------*/
139 SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ) :
140     TextAttrib(TEXTATTR_SPELL_BACKGROUND),
141     m_aBackgroundColor(rAttr.m_aBackgroundColor)
142 {
143 }
144 /*-- 31.10.2003 16:07:46---------------------------------------------------
145 
146   -----------------------------------------------------------------------*/
147 SpellBackgroundAttrib::~SpellBackgroundAttrib()
148 {
149 }
150 /*-- 31.10.2003 16:07:46---------------------------------------------------
151 
152   -----------------------------------------------------------------------*/
153 void SpellBackgroundAttrib::SetFont( Font& rFont ) const
154 {
155     rFont.SetFillColor(m_aBackgroundColor);
156 }
157 /*-- 31.10.2003 16:07:46---------------------------------------------------
158 
159   -----------------------------------------------------------------------*/
160 TextAttrib* SpellBackgroundAttrib::Clone() const
161 {
162     return new SpellBackgroundAttrib(*this);
163 }
164 /*-- 31.10.2003 16:07:47---------------------------------------------------
165 
166   -----------------------------------------------------------------------*/
167 int  SpellBackgroundAttrib::operator==( const TextAttrib& rAttr ) const
168 {
169     return Which() == rAttr.Which() &&
170             m_aBackgroundColor == static_cast<const SpellBackgroundAttrib&>(rAttr).m_aBackgroundColor;
171 }
172 
173