Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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>
24 : using namespace svx;
25 : using namespace com::sun::star::linguistic2;
26 : using namespace com::sun::star::uno;
27 :
28 :
29 : //-----------------------------------------------------------------------
30 0 : SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription& rDesc ) :
31 : TextAttrib(TEXTATTR_SPELL_ERROR),
32 0 : m_aSpellErrorDescription( rDesc )
33 : {
34 0 : }
35 :
36 :
37 : //-----------------------------------------------------------------------
38 0 : SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib& rAttr ) :
39 : TextAttrib(TEXTATTR_SPELL_ERROR),
40 0 : m_aSpellErrorDescription( rAttr.m_aSpellErrorDescription )
41 : {
42 0 : }
43 :
44 : //-----------------------------------------------------------------------
45 0 : SpellErrorAttrib::~SpellErrorAttrib()
46 : {
47 0 : }
48 :
49 : //-----------------------------------------------------------------------
50 0 : void SpellErrorAttrib::SetFont( Font& ) const
51 : {
52 : //this attribute doesn't have a visual effect
53 0 : }
54 :
55 : //-----------------------------------------------------------------------
56 0 : TextAttrib* SpellErrorAttrib::Clone() const
57 : {
58 0 : return new SpellErrorAttrib(*this);
59 : }
60 :
61 : //-----------------------------------------------------------------------
62 0 : int SpellErrorAttrib::operator==( const TextAttrib& rAttr ) const
63 : {
64 0 : return Which() == rAttr.Which() &&
65 0 : m_aSpellErrorDescription == static_cast<const SpellErrorAttrib&>(rAttr).m_aSpellErrorDescription;
66 : }
67 :
68 : //-----------------------------------------------------------------------
69 0 : SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang) :
70 : TextAttrib(TEXTATTR_SPELL_LANGUAGE),
71 0 : m_eLanguage(eLang)
72 : {
73 0 : }
74 :
75 : //-----------------------------------------------------------------------
76 0 : SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ) :
77 : TextAttrib(TEXTATTR_SPELL_LANGUAGE),
78 0 : m_eLanguage(rAttr.m_eLanguage)
79 : {
80 0 : }
81 :
82 : //-----------------------------------------------------------------------
83 0 : SpellLanguageAttrib::~SpellLanguageAttrib()
84 : {
85 0 : }
86 :
87 : //-----------------------------------------------------------------------
88 0 : void SpellLanguageAttrib::SetFont( Font& ) const
89 : {
90 : //no visual effect
91 0 : }
92 :
93 : //-----------------------------------------------------------------------
94 0 : TextAttrib* SpellLanguageAttrib::Clone() const
95 : {
96 0 : return new SpellLanguageAttrib(*this);
97 : }
98 :
99 : //-----------------------------------------------------------------------
100 0 : int SpellLanguageAttrib::operator==( const TextAttrib& rAttr ) const
101 : {
102 0 : return Which() == rAttr.Which() &&
103 0 : m_eLanguage == static_cast<const SpellLanguageAttrib&>(rAttr).m_eLanguage;
104 : }
105 :
106 : //-----------------------------------------------------------------------
107 0 : SpellBackgroundAttrib::SpellBackgroundAttrib(const Color& rCol) :
108 : TextAttrib(TEXTATTR_SPELL_BACKGROUND),
109 0 : m_aBackgroundColor(rCol)
110 : {
111 0 : }
112 :
113 : //-----------------------------------------------------------------------
114 0 : SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ) :
115 : TextAttrib(TEXTATTR_SPELL_BACKGROUND),
116 0 : m_aBackgroundColor(rAttr.m_aBackgroundColor)
117 : {
118 0 : }
119 :
120 : //-----------------------------------------------------------------------
121 0 : SpellBackgroundAttrib::~SpellBackgroundAttrib()
122 : {
123 0 : }
124 :
125 : //-----------------------------------------------------------------------
126 0 : void SpellBackgroundAttrib::SetFont( Font& rFont ) const
127 : {
128 0 : rFont.SetFillColor(m_aBackgroundColor);
129 0 : }
130 :
131 : //-----------------------------------------------------------------------
132 0 : TextAttrib* SpellBackgroundAttrib::Clone() const
133 : {
134 0 : return new SpellBackgroundAttrib(*this);
135 : }
136 :
137 : //-----------------------------------------------------------------------
138 0 : int SpellBackgroundAttrib::operator==( const TextAttrib& rAttr ) const
139 : {
140 0 : return Which() == rAttr.Which() &&
141 0 : m_aBackgroundColor == static_cast<const SpellBackgroundAttrib&>(rAttr).m_aBackgroundColor;
142 : }
143 :
144 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|