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>
22 #include <com/sun/star/uno/Reference.hxx>
23 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
25 using namespace com::sun::star::linguistic2
;
26 using namespace com::sun::star::uno
;
30 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription
& rDesc
) :
31 TextAttrib(TEXTATTR_SPELL_ERROR
),
32 m_aSpellErrorDescription( rDesc
)
38 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib
& rAttr
) :
39 TextAttrib(TEXTATTR_SPELL_ERROR
),
40 m_aSpellErrorDescription( rAttr
.m_aSpellErrorDescription
)
45 SpellErrorAttrib::~SpellErrorAttrib()
50 void SpellErrorAttrib::SetFont( vcl::Font
& ) const
52 //this attribute doesn't have a visual effect
56 TextAttrib
* SpellErrorAttrib::Clone() const
58 return new SpellErrorAttrib(*this);
62 bool SpellErrorAttrib::operator==( const TextAttrib
& rAttr
) const
64 return Which() == rAttr
.Which() &&
65 m_aSpellErrorDescription
== static_cast<const SpellErrorAttrib
&>(rAttr
).m_aSpellErrorDescription
;
69 SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang
) :
70 TextAttrib(TEXTATTR_SPELL_LANGUAGE
),
76 SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib
& rAttr
) :
77 TextAttrib(TEXTATTR_SPELL_LANGUAGE
),
78 m_eLanguage(rAttr
.m_eLanguage
)
83 SpellLanguageAttrib::~SpellLanguageAttrib()
88 void SpellLanguageAttrib::SetFont( vcl::Font
& ) const
94 TextAttrib
* SpellLanguageAttrib::Clone() const
96 return new SpellLanguageAttrib(*this);
100 bool SpellLanguageAttrib::operator==( const TextAttrib
& rAttr
) const
102 return Which() == rAttr
.Which() &&
103 m_eLanguage
== static_cast<const SpellLanguageAttrib
&>(rAttr
).m_eLanguage
;
107 SpellBackgroundAttrib::SpellBackgroundAttrib(const Color
& rCol
) :
108 TextAttrib(TEXTATTR_SPELL_BACKGROUND
),
109 m_aBackgroundColor(rCol
)
114 SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib
& rAttr
) :
115 TextAttrib(TEXTATTR_SPELL_BACKGROUND
),
116 m_aBackgroundColor(rAttr
.m_aBackgroundColor
)
121 SpellBackgroundAttrib::~SpellBackgroundAttrib()
126 void SpellBackgroundAttrib::SetFont( vcl::Font
& rFont
) const
128 rFont
.SetFillColor(m_aBackgroundColor
);
132 TextAttrib
* SpellBackgroundAttrib::Clone() const
134 return new SpellBackgroundAttrib(*this);
138 bool SpellBackgroundAttrib::operator==( const TextAttrib
& rAttr
) const
140 return Which() == rAttr
.Which() &&
141 m_aBackgroundColor
== static_cast<const SpellBackgroundAttrib
&>(rAttr
).m_aBackgroundColor
;
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */