xref: /aoo42x/main/svtools/source/edit/txtattr.cxx (revision 5900e8ec)
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_svtools.hxx"
26 
27 #include <svtools/txtattr.hxx>
28 #include <vcl/font.hxx>
29 
30 
31 
32 
~TextAttrib()33 TextAttrib::~TextAttrib()
34 {
35 }
36 
SetFont(Font &) const37 void TextAttrib::SetFont( Font& ) const
38 {
39 }
40 
Clone() const41 TextAttrib* TextAttrib::Clone() const
42 {
43 	return NULL;
44 }
45 
operator ==(const TextAttrib & rAttr) const46 int TextAttrib::operator==( const TextAttrib& rAttr ) const
47 {
48 	return mnWhich == rAttr.mnWhich;
49 }
50 
51 
TextAttribFontColor(const Color & rColor)52 TextAttribFontColor::TextAttribFontColor( const Color& rColor )
53 	: TextAttrib( TEXTATTR_FONTCOLOR ), maColor( rColor )
54 {
55 }
56 
TextAttribFontColor(const TextAttribFontColor & rAttr)57 TextAttribFontColor::TextAttribFontColor( const TextAttribFontColor& rAttr )
58 	: TextAttrib( rAttr ), maColor( rAttr.maColor )
59 {
60 }
61 
~TextAttribFontColor()62 TextAttribFontColor::~TextAttribFontColor()
63 {
64 }
65 
SetFont(Font & rFont) const66 void TextAttribFontColor::SetFont( Font& rFont ) const
67 {
68 	rFont.SetColor( maColor );
69 }
70 
Clone() const71 TextAttrib* TextAttribFontColor::Clone() const
72 {
73 	return new TextAttribFontColor( *this );
74 }
75 
operator ==(const TextAttrib & rAttr) const76 int TextAttribFontColor::operator==( const TextAttrib& rAttr ) const
77 {
78 	return ( ( TextAttrib::operator==(rAttr ) ) &&
79 				( maColor == ((const TextAttribFontColor&)rAttr).maColor ) );
80 }
81 
TextAttribFontWeight(FontWeight eWeight)82 TextAttribFontWeight::TextAttribFontWeight( FontWeight eWeight )
83 	: TextAttrib( TEXTATTR_FONTWEIGHT ), meWeight( eWeight )
84 {
85 }
86 
TextAttribFontWeight(const TextAttribFontWeight & rAttr)87 TextAttribFontWeight::TextAttribFontWeight( const TextAttribFontWeight& rAttr )
88 	: TextAttrib( rAttr ), meWeight( rAttr.meWeight )
89 {
90 }
91 
~TextAttribFontWeight()92 TextAttribFontWeight::~TextAttribFontWeight()
93 {
94 }
95 
SetFont(Font & rFont) const96 void TextAttribFontWeight::SetFont( Font& rFont ) const
97 {
98 	rFont.SetWeight( meWeight );
99 }
100 
Clone() const101 TextAttrib* TextAttribFontWeight::Clone() const
102 {
103 	return new TextAttribFontWeight( *this );
104 }
105 
operator ==(const TextAttrib & rAttr) const106 int TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const
107 {
108 	return ( ( TextAttrib::operator==(rAttr ) ) &&
109 				( meWeight == ((const TextAttribFontWeight&)rAttr).meWeight ) );
110 }
111 
112 
TextAttribHyperLink(const XubString & rURL)113 TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL )
114 	: TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL )
115 {
116 	maColor = COL_BLUE;
117 }
118 
TextAttribHyperLink(const XubString & rURL,const XubString & rDescription)119 TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL, const XubString& rDescription )
120 	: TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ), maDescription( rDescription )
121 {
122 	maColor = COL_BLUE;
123 }
124 
TextAttribHyperLink(const TextAttribHyperLink & rAttr)125 TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr )
126 	: TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription )
127 {
128 	maColor = rAttr.maColor;
129 }
130 
~TextAttribHyperLink()131 TextAttribHyperLink::~TextAttribHyperLink()
132 {
133 }
134 
SetFont(Font & rFont) const135 void TextAttribHyperLink::SetFont( Font& rFont ) const
136 {
137 	rFont.SetColor( maColor );
138 	rFont.SetUnderline( UNDERLINE_SINGLE );
139 }
140 
Clone() const141 TextAttrib* TextAttribHyperLink::Clone() const
142 {
143 	return new TextAttribHyperLink( *this );
144 }
145 
operator ==(const TextAttrib & rAttr) const146 int TextAttribHyperLink::operator==( const TextAttrib& rAttr ) const
147 {
148 	return ( ( TextAttrib::operator==(rAttr ) ) &&
149 				( maURL == ((const TextAttribHyperLink&)rAttr).maURL ) &&
150 				( maDescription == ((const TextAttribHyperLink&)rAttr).maDescription ) &&
151 				( maColor == ((const TextAttribHyperLink&)rAttr).maColor ) );
152 }
153 
154 /*-- 24.06.2004 14:49:44---------------------------------------------------
155 
156   -----------------------------------------------------------------------*/
TextAttribProtect()157 TextAttribProtect::TextAttribProtect() :
158     TextAttrib( TEXTATTR_PROTECTED )
159 {
160 }
161 /*-- 24.06.2004 14:49:44---------------------------------------------------
162 
163   -----------------------------------------------------------------------*/
TextAttribProtect(const TextAttribProtect &)164 TextAttribProtect::TextAttribProtect( const TextAttribProtect&) :
165     TextAttrib( TEXTATTR_PROTECTED )
166 {
167 }
168 /*-- 24.06.2004 14:49:44---------------------------------------------------
169 
170   -----------------------------------------------------------------------*/
~TextAttribProtect()171 TextAttribProtect::~TextAttribProtect()
172 {
173 }
174 /*-- 24.06.2004 14:49:44---------------------------------------------------
175 
176   -----------------------------------------------------------------------*/
SetFont(Font &) const177 void TextAttribProtect::SetFont( Font& ) const
178 {
179 }
180 /*-- 24.06.2004 14:49:44---------------------------------------------------
181 
182   -----------------------------------------------------------------------*/
Clone() const183 TextAttrib*     TextAttribProtect::Clone() const
184 {
185     return new TextAttribProtect();
186 }
187 /*-- 24.06.2004 14:49:45---------------------------------------------------
188 
189   -----------------------------------------------------------------------*/
operator ==(const TextAttrib & rAttr) const190 int TextAttribProtect::operator==( const TextAttrib& rAttr ) const
191 {
192     return ( TextAttrib::operator==(rAttr ) );
193 }
194