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
;
29 //-----------------------------------------------------------------------
30 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription
& rDesc
) :
31 TextAttrib(TEXTATTR_SPELL_ERROR
),
32 m_aSpellErrorDescription( rDesc
)
37 //-----------------------------------------------------------------------
38 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib
& rAttr
) :
39 TextAttrib(TEXTATTR_SPELL_ERROR
),
40 m_aSpellErrorDescription( rAttr
.m_aSpellErrorDescription
)
44 //-----------------------------------------------------------------------
45 SpellErrorAttrib::~SpellErrorAttrib()
49 //-----------------------------------------------------------------------
50 void SpellErrorAttrib::SetFont( Font
& ) const
52 //this attribute doesn't have a visual effect
55 //-----------------------------------------------------------------------
56 TextAttrib
* SpellErrorAttrib::Clone() const
58 return new SpellErrorAttrib(*this);
61 //-----------------------------------------------------------------------
62 int SpellErrorAttrib::operator==( const TextAttrib
& rAttr
) const
64 return Which() == rAttr
.Which() &&
65 m_aSpellErrorDescription
== static_cast<const SpellErrorAttrib
&>(rAttr
).m_aSpellErrorDescription
;
68 //-----------------------------------------------------------------------
69 SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang
) :
70 TextAttrib(TEXTATTR_SPELL_LANGUAGE
),
75 //-----------------------------------------------------------------------
76 SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib
& rAttr
) :
77 TextAttrib(TEXTATTR_SPELL_LANGUAGE
),
78 m_eLanguage(rAttr
.m_eLanguage
)
82 //-----------------------------------------------------------------------
83 SpellLanguageAttrib::~SpellLanguageAttrib()
87 //-----------------------------------------------------------------------
88 void SpellLanguageAttrib::SetFont( Font
& ) const
93 //-----------------------------------------------------------------------
94 TextAttrib
* SpellLanguageAttrib::Clone() const
96 return new SpellLanguageAttrib(*this);
99 //-----------------------------------------------------------------------
100 int SpellLanguageAttrib::operator==( const TextAttrib
& rAttr
) const
102 return Which() == rAttr
.Which() &&
103 m_eLanguage
== static_cast<const SpellLanguageAttrib
&>(rAttr
).m_eLanguage
;
106 //-----------------------------------------------------------------------
107 SpellBackgroundAttrib::SpellBackgroundAttrib(const Color
& rCol
) :
108 TextAttrib(TEXTATTR_SPELL_BACKGROUND
),
109 m_aBackgroundColor(rCol
)
113 //-----------------------------------------------------------------------
114 SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib
& rAttr
) :
115 TextAttrib(TEXTATTR_SPELL_BACKGROUND
),
116 m_aBackgroundColor(rAttr
.m_aBackgroundColor
)
120 //-----------------------------------------------------------------------
121 SpellBackgroundAttrib::~SpellBackgroundAttrib()
125 //-----------------------------------------------------------------------
126 void SpellBackgroundAttrib::SetFont( Font
& rFont
) const
128 rFont
.SetFillColor(m_aBackgroundColor
);
131 //-----------------------------------------------------------------------
132 TextAttrib
* SpellBackgroundAttrib::Clone() const
134 return new SpellBackgroundAttrib(*this);
137 //-----------------------------------------------------------------------
138 int 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: */