1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtattr.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
34 #include <txtattr.hxx>
35 #include <vcl/font.hxx>
40 TextAttrib::~TextAttrib()
44 void TextAttrib::SetFont( Font
& ) const
48 TextAttrib
* TextAttrib::Clone() const
53 int TextAttrib::operator==( const TextAttrib
& rAttr
) const
55 return mnWhich
== rAttr
.mnWhich
;
59 TextAttribFontColor::TextAttribFontColor( const Color
& rColor
)
60 : TextAttrib( TEXTATTR_FONTCOLOR
), maColor( rColor
)
64 TextAttribFontColor::TextAttribFontColor( const TextAttribFontColor
& rAttr
)
65 : TextAttrib( rAttr
), maColor( rAttr
.maColor
)
69 TextAttribFontColor::~TextAttribFontColor()
73 void TextAttribFontColor::SetFont( Font
& rFont
) const
75 rFont
.SetColor( maColor
);
78 TextAttrib
* TextAttribFontColor::Clone() const
80 return new TextAttribFontColor( *this );
83 int TextAttribFontColor::operator==( const TextAttrib
& rAttr
) const
85 return ( ( TextAttrib::operator==(rAttr
) ) &&
86 ( maColor
== ((const TextAttribFontColor
&)rAttr
).maColor
) );
89 TextAttribFontWeight::TextAttribFontWeight( FontWeight eWeight
)
90 : TextAttrib( TEXTATTR_FONTWEIGHT
), meWeight( eWeight
)
94 TextAttribFontWeight::TextAttribFontWeight( const TextAttribFontWeight
& rAttr
)
95 : TextAttrib( rAttr
), meWeight( rAttr
.meWeight
)
99 TextAttribFontWeight::~TextAttribFontWeight()
103 void TextAttribFontWeight::SetFont( Font
& rFont
) const
105 rFont
.SetWeight( meWeight
);
108 TextAttrib
* TextAttribFontWeight::Clone() const
110 return new TextAttribFontWeight( *this );
113 int TextAttribFontWeight::operator==( const TextAttrib
& rAttr
) const
115 return ( ( TextAttrib::operator==(rAttr
) ) &&
116 ( meWeight
== ((const TextAttribFontWeight
&)rAttr
).meWeight
) );
120 TextAttribHyperLink::TextAttribHyperLink( const XubString
& rURL
)
121 : TextAttrib( TEXTATTR_HYPERLINK
), maURL( rURL
)
126 TextAttribHyperLink::TextAttribHyperLink( const XubString
& rURL
, const XubString
& rDescription
)
127 : TextAttrib( TEXTATTR_HYPERLINK
), maURL( rURL
), maDescription( rDescription
)
132 TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink
& rAttr
)
133 : TextAttrib( rAttr
), maURL( rAttr
.maURL
), maDescription( rAttr
.maDescription
)
135 maColor
= rAttr
.maColor
;
138 TextAttribHyperLink::~TextAttribHyperLink()
142 void TextAttribHyperLink::SetFont( Font
& rFont
) const
144 rFont
.SetColor( maColor
);
145 rFont
.SetUnderline( UNDERLINE_SINGLE
);
148 TextAttrib
* TextAttribHyperLink::Clone() const
150 return new TextAttribHyperLink( *this );
153 int TextAttribHyperLink::operator==( const TextAttrib
& rAttr
) const
155 return ( ( TextAttrib::operator==(rAttr
) ) &&
156 ( maURL
== ((const TextAttribHyperLink
&)rAttr
).maURL
) &&
157 ( maDescription
== ((const TextAttribHyperLink
&)rAttr
).maDescription
) &&
158 ( maColor
== ((const TextAttribHyperLink
&)rAttr
).maColor
) );
161 /*-- 24.06.2004 14:49:44---------------------------------------------------
163 -----------------------------------------------------------------------*/
164 TextAttribProtect::TextAttribProtect() :
165 TextAttrib( TEXTATTR_PROTECTED
)
168 /*-- 24.06.2004 14:49:44---------------------------------------------------
170 -----------------------------------------------------------------------*/
171 TextAttribProtect::TextAttribProtect( const TextAttribProtect
&) :
172 TextAttrib( TEXTATTR_PROTECTED
)
175 /*-- 24.06.2004 14:49:44---------------------------------------------------
177 -----------------------------------------------------------------------*/
178 TextAttribProtect::~TextAttribProtect()
181 /*-- 24.06.2004 14:49:44---------------------------------------------------
183 -----------------------------------------------------------------------*/
184 void TextAttribProtect::SetFont( Font
& ) const
187 /*-- 24.06.2004 14:49:44---------------------------------------------------
189 -----------------------------------------------------------------------*/
190 TextAttrib
* TextAttribProtect::Clone() const
192 return new TextAttribProtect();
194 /*-- 24.06.2004 14:49:45---------------------------------------------------
196 -----------------------------------------------------------------------*/
197 int TextAttribProtect::operator==( const TextAttrib
& rAttr
) const
199 return ( TextAttrib::operator==(rAttr
) );