xref: /trunk/main/cui/source/dialogs/SpellAttrib.cxx (revision 2ee96f1c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26 
27 #include <SpellAttrib.hxx>
28 #include <vcl/font.hxx>
29 #include <com/sun/star/uno/Reference.hxx>
30 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
31 using namespace svx;
32 using namespace com::sun::star::linguistic2;
33 using namespace com::sun::star::uno;
34 
35 /*-- 26.06.2008 10:41:57---------------------------------------------------
36 
37   -----------------------------------------------------------------------*/
SpellErrorAttrib(const SpellErrorDescription & rDesc)38 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription& rDesc ) :
39     TextAttrib(TEXTATTR_SPELL_ERROR),
40     m_aSpellErrorDescription( rDesc )
41 {
42 }
43 
44 /*-- 10.09.2003 12:54:34---------------------------------------------------
45 
46   -----------------------------------------------------------------------*/
SpellErrorAttrib(const SpellErrorAttrib & rAttr)47 SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib& rAttr ) :
48     TextAttrib(TEXTATTR_SPELL_ERROR),
49     m_aSpellErrorDescription( rAttr.m_aSpellErrorDescription )
50 {
51 }
52 /*-- 10.09.2003 12:54:34---------------------------------------------------
53 
54   -----------------------------------------------------------------------*/
~SpellErrorAttrib()55 SpellErrorAttrib::~SpellErrorAttrib()
56 {
57 }
58 /*-- 10.09.2003 12:54:35---------------------------------------------------
59 
60   -----------------------------------------------------------------------*/
SetFont(Font &) const61 void SpellErrorAttrib::SetFont( Font&  ) const
62 {
63     //this attribute doesn't have a visual effect
64 }
65 /*-- 10.09.2003 12:54:35---------------------------------------------------
66 
67   -----------------------------------------------------------------------*/
Clone() const68 TextAttrib*     SpellErrorAttrib::Clone() const
69 {
70     return new SpellErrorAttrib(*this);
71 }
72 /*-- 10.09.2003 12:54:35---------------------------------------------------
73 
74   -----------------------------------------------------------------------*/
operator ==(const TextAttrib & rAttr) const75 int SpellErrorAttrib::operator==( const TextAttrib& rAttr ) const
76 {
77     return Which() == rAttr.Which() &&
78             m_aSpellErrorDescription == static_cast<const SpellErrorAttrib&>(rAttr).m_aSpellErrorDescription;
79 }
80 /*-- 10.09.2003 14:27:43---------------------------------------------------
81 
82   -----------------------------------------------------------------------*/
SpellLanguageAttrib(LanguageType eLang)83 SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang) :
84     TextAttrib(TEXTATTR_SPELL_LANGUAGE),
85     m_eLanguage(eLang)
86 {
87 }
88 /*-- 10.09.2003 14:27:43---------------------------------------------------
89 
90   -----------------------------------------------------------------------*/
SpellLanguageAttrib(const SpellLanguageAttrib & rAttr)91 SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ) :
92     TextAttrib(TEXTATTR_SPELL_LANGUAGE),
93     m_eLanguage(rAttr.m_eLanguage)
94 {
95 }
96 /*-- 10.09.2003 14:27:43---------------------------------------------------
97 
98   -----------------------------------------------------------------------*/
~SpellLanguageAttrib()99 SpellLanguageAttrib::~SpellLanguageAttrib()
100 {
101 }
102 /*-- 10.09.2003 14:27:43---------------------------------------------------
103 
104   -----------------------------------------------------------------------*/
SetFont(Font &) const105 void SpellLanguageAttrib::SetFont( Font&  ) const
106 {
107     //no visual effect
108 }
109 /*-- 10.09.2003 14:27:44---------------------------------------------------
110 
111   -----------------------------------------------------------------------*/
Clone() const112 TextAttrib* SpellLanguageAttrib::Clone() const
113 {
114     return new SpellLanguageAttrib(*this);
115 }
116 /*-- 10.09.2003 14:27:44---------------------------------------------------
117 
118   -----------------------------------------------------------------------*/
operator ==(const TextAttrib & rAttr) const119 int SpellLanguageAttrib::operator==( const TextAttrib& rAttr ) const
120 {
121     return Which() == rAttr.Which() &&
122             m_eLanguage == static_cast<const SpellLanguageAttrib&>(rAttr).m_eLanguage;
123 }
124 /*-- 31.10.2003 16:07:45---------------------------------------------------
125 
126   -----------------------------------------------------------------------*/
SpellBackgroundAttrib(const Color & rCol)127 SpellBackgroundAttrib::SpellBackgroundAttrib(const Color& rCol) :
128     TextAttrib(TEXTATTR_SPELL_BACKGROUND),
129     m_aBackgroundColor(rCol)
130 {
131 }
132 /*-- 31.10.2003 16:07:45---------------------------------------------------
133 
134   -----------------------------------------------------------------------*/
SpellBackgroundAttrib(const SpellBackgroundAttrib & rAttr)135 SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ) :
136     TextAttrib(TEXTATTR_SPELL_BACKGROUND),
137     m_aBackgroundColor(rAttr.m_aBackgroundColor)
138 {
139 }
140 /*-- 31.10.2003 16:07:46---------------------------------------------------
141 
142   -----------------------------------------------------------------------*/
~SpellBackgroundAttrib()143 SpellBackgroundAttrib::~SpellBackgroundAttrib()
144 {
145 }
146 /*-- 31.10.2003 16:07:46---------------------------------------------------
147 
148   -----------------------------------------------------------------------*/
SetFont(Font & rFont) const149 void SpellBackgroundAttrib::SetFont( Font& rFont ) const
150 {
151     rFont.SetFillColor(m_aBackgroundColor);
152 }
153 /*-- 31.10.2003 16:07:46---------------------------------------------------
154 
155   -----------------------------------------------------------------------*/
Clone() const156 TextAttrib* SpellBackgroundAttrib::Clone() const
157 {
158     return new SpellBackgroundAttrib(*this);
159 }
160 /*-- 31.10.2003 16:07:47---------------------------------------------------
161 
162   -----------------------------------------------------------------------*/
operator ==(const TextAttrib & rAttr) const163 int  SpellBackgroundAttrib::operator==( const TextAttrib& rAttr ) const
164 {
165     return Which() == rAttr.Which() &&
166             m_aBackgroundColor == static_cast<const SpellBackgroundAttrib&>(rAttr).m_aBackgroundColor;
167 }
168 
169