1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #include "SpellAttrib.hxx"
21 #include <vcl/font.hxx>
24 using namespace com::sun::star::linguistic2
;
25 using namespace com::sun::star::uno
;
28 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription
& rDesc
) :
29 TextAttrib(TEXTATTR_SPELL_ERROR
),
30 m_aSpellErrorDescription( rDesc
)
35 void SpellErrorAttrib::SetFont( vcl::Font
& ) const
37 //this attribute doesn't have a visual effect
41 std::unique_ptr
<TextAttrib
> SpellErrorAttrib::Clone() const
43 return std::unique_ptr
<TextAttrib
>(new SpellErrorAttrib(*this));
47 bool SpellErrorAttrib::operator==( const TextAttrib
& rAttr
) const
49 return Which() == rAttr
.Which() &&
50 m_aSpellErrorDescription
== static_cast<const SpellErrorAttrib
&>(rAttr
).m_aSpellErrorDescription
;
54 SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang
) :
55 TextAttrib(TEXTATTR_SPELL_LANGUAGE
),
61 void SpellLanguageAttrib::SetFont( vcl::Font
& ) const
67 std::unique_ptr
<TextAttrib
> SpellLanguageAttrib::Clone() const
69 return std::unique_ptr
<TextAttrib
>(new SpellLanguageAttrib(*this));
73 bool SpellLanguageAttrib::operator==( const TextAttrib
& rAttr
) const
75 return Which() == rAttr
.Which() &&
76 m_eLanguage
== static_cast<const SpellLanguageAttrib
&>(rAttr
).m_eLanguage
;
80 SpellBackgroundAttrib::SpellBackgroundAttrib(const Color
& rCol
) :
81 TextAttrib(TEXTATTR_SPELL_BACKGROUND
),
82 m_aBackgroundColor(rCol
)
87 void SpellBackgroundAttrib::SetFont( vcl::Font
& rFont
) const
89 rFont
.SetFillColor(m_aBackgroundColor
);
93 std::unique_ptr
<TextAttrib
> SpellBackgroundAttrib::Clone() const
95 return std::unique_ptr
<TextAttrib
>(new SpellBackgroundAttrib(*this));
99 bool SpellBackgroundAttrib::operator==( const TextAttrib
& rAttr
) const
101 return Which() == rAttr
.Which() &&
102 m_aBackgroundColor
== static_cast<const SpellBackgroundAttrib
&>(rAttr
).m_aBackgroundColor
;
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */