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.cxx,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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
37 #include <SpellAttrib.hxx>
38 #include <vcl/font.hxx>
39 #include <com/sun/star/uno/Reference.hxx>
40 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
42 using namespace com::sun::star::linguistic2
;
43 using namespace com::sun::star::uno
;
45 /*-- 26.06.2008 10:41:57---------------------------------------------------
47 -----------------------------------------------------------------------*/
48 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription
& rDesc
) :
49 TextAttrib(TEXTATTR_SPELL_ERROR
),
50 m_aSpellErrorDescription( rDesc
)
54 /*-- 10.09.2003 12:54:34---------------------------------------------------
56 -----------------------------------------------------------------------*/
57 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib
& rAttr
) :
58 TextAttrib(TEXTATTR_SPELL_ERROR
),
59 m_aSpellErrorDescription( rAttr
.m_aSpellErrorDescription
)
62 /*-- 10.09.2003 12:54:34---------------------------------------------------
64 -----------------------------------------------------------------------*/
65 SpellErrorAttrib::~SpellErrorAttrib()
68 /*-- 10.09.2003 12:54:35---------------------------------------------------
70 -----------------------------------------------------------------------*/
71 void SpellErrorAttrib::SetFont( Font
& ) const
73 //this attribute doesn't have a visual effect
75 /*-- 10.09.2003 12:54:35---------------------------------------------------
77 -----------------------------------------------------------------------*/
78 TextAttrib
* SpellErrorAttrib::Clone() const
80 return new SpellErrorAttrib(*this);
82 /*-- 10.09.2003 12:54:35---------------------------------------------------
84 -----------------------------------------------------------------------*/
85 int SpellErrorAttrib::operator==( const TextAttrib
& rAttr
) const
87 return Which() == rAttr
.Which() &&
88 m_aSpellErrorDescription
== static_cast<const SpellErrorAttrib
&>(rAttr
).m_aSpellErrorDescription
;
90 /*-- 10.09.2003 14:27:43---------------------------------------------------
92 -----------------------------------------------------------------------*/
93 SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang
) :
94 TextAttrib(TEXTATTR_SPELL_LANGUAGE
),
98 /*-- 10.09.2003 14:27:43---------------------------------------------------
100 -----------------------------------------------------------------------*/
101 SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib
& rAttr
) :
102 TextAttrib(TEXTATTR_SPELL_LANGUAGE
),
103 m_eLanguage(rAttr
.m_eLanguage
)
106 /*-- 10.09.2003 14:27:43---------------------------------------------------
108 -----------------------------------------------------------------------*/
109 SpellLanguageAttrib::~SpellLanguageAttrib()
112 /*-- 10.09.2003 14:27:43---------------------------------------------------
114 -----------------------------------------------------------------------*/
115 void SpellLanguageAttrib::SetFont( Font
& ) const
119 /*-- 10.09.2003 14:27:44---------------------------------------------------
121 -----------------------------------------------------------------------*/
122 TextAttrib
* SpellLanguageAttrib::Clone() const
124 return new SpellLanguageAttrib(*this);
126 /*-- 10.09.2003 14:27:44---------------------------------------------------
128 -----------------------------------------------------------------------*/
129 int SpellLanguageAttrib::operator==( const TextAttrib
& rAttr
) const
131 return Which() == rAttr
.Which() &&
132 m_eLanguage
== static_cast<const SpellLanguageAttrib
&>(rAttr
).m_eLanguage
;
134 /*-- 31.10.2003 16:07:45---------------------------------------------------
136 -----------------------------------------------------------------------*/
137 SpellBackgroundAttrib::SpellBackgroundAttrib(const Color
& rCol
) :
138 TextAttrib(TEXTATTR_SPELL_BACKGROUND
),
139 m_aBackgroundColor(rCol
)
142 /*-- 31.10.2003 16:07:45---------------------------------------------------
144 -----------------------------------------------------------------------*/
145 SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib
& rAttr
) :
146 TextAttrib(TEXTATTR_SPELL_BACKGROUND
),
147 m_aBackgroundColor(rAttr
.m_aBackgroundColor
)
150 /*-- 31.10.2003 16:07:46---------------------------------------------------
152 -----------------------------------------------------------------------*/
153 SpellBackgroundAttrib::~SpellBackgroundAttrib()
156 /*-- 31.10.2003 16:07:46---------------------------------------------------
158 -----------------------------------------------------------------------*/
159 void SpellBackgroundAttrib::SetFont( Font
& rFont
) const
161 rFont
.SetFillColor(m_aBackgroundColor
);
163 /*-- 31.10.2003 16:07:46---------------------------------------------------
165 -----------------------------------------------------------------------*/
166 TextAttrib
* SpellBackgroundAttrib::Clone() const
168 return new SpellBackgroundAttrib(*this);
170 /*-- 31.10.2003 16:07:47---------------------------------------------------
172 -----------------------------------------------------------------------*/
173 int SpellBackgroundAttrib::operator==( const TextAttrib
& rAttr
) const
175 return Which() == rAttr
.Which() &&
176 m_aBackgroundColor
== static_cast<const SpellBackgroundAttrib
&>(rAttr
).m_aBackgroundColor
;