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 .
21 #include <vcl/txtattr.hxx>
22 #include <vcl/font.hxx>
27 TextAttrib::~TextAttrib()
31 int TextAttrib::operator==( const TextAttrib
& rAttr
) const
33 return mnWhich
== rAttr
.mnWhich
;
37 TextAttribFontColor::TextAttribFontColor( const Color
& rColor
)
38 : TextAttrib( TEXTATTR_FONTCOLOR
), maColor( rColor
)
42 TextAttribFontColor::TextAttribFontColor( const TextAttribFontColor
& rAttr
)
43 : TextAttrib( rAttr
), maColor( rAttr
.maColor
)
47 TextAttribFontColor::~TextAttribFontColor()
51 void TextAttribFontColor::SetFont( Font
& rFont
) const
53 rFont
.SetColor( maColor
);
56 TextAttrib
* TextAttribFontColor::Clone() const
58 return new TextAttribFontColor( *this );
61 int TextAttribFontColor::operator==( const TextAttrib
& rAttr
) const
63 return ( ( TextAttrib::operator==(rAttr
) ) &&
64 ( maColor
== ((const TextAttribFontColor
&)rAttr
).maColor
) );
67 TextAttribFontWeight::TextAttribFontWeight( FontWeight eWeight
)
68 : TextAttrib( TEXTATTR_FONTWEIGHT
), meWeight( eWeight
)
72 TextAttribFontWeight::TextAttribFontWeight( const TextAttribFontWeight
& rAttr
)
73 : TextAttrib( rAttr
), meWeight( rAttr
.meWeight
)
77 TextAttribFontWeight::~TextAttribFontWeight()
81 void TextAttribFontWeight::SetFont( Font
& rFont
) const
83 rFont
.SetWeight( meWeight
);
86 TextAttrib
* TextAttribFontWeight::Clone() const
88 return new TextAttribFontWeight( *this );
91 int TextAttribFontWeight::operator==( const TextAttrib
& rAttr
) const
93 return ( ( TextAttrib::operator==(rAttr
) ) &&
94 ( meWeight
== ((const TextAttribFontWeight
&)rAttr
).meWeight
) );
98 TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink
& rAttr
)
99 : TextAttrib( rAttr
), maURL( rAttr
.maURL
), maDescription( rAttr
.maDescription
)
101 maColor
= rAttr
.maColor
;
104 TextAttribHyperLink::~TextAttribHyperLink()
108 void TextAttribHyperLink::SetFont( Font
& rFont
) const
110 rFont
.SetColor( maColor
);
111 rFont
.SetUnderline( UNDERLINE_SINGLE
);
114 TextAttrib
* TextAttribHyperLink::Clone() const
116 return new TextAttribHyperLink( *this );
119 int TextAttribHyperLink::operator==( const TextAttrib
& rAttr
) const
121 return ( ( TextAttrib::operator==(rAttr
) ) &&
122 ( maURL
== ((const TextAttribHyperLink
&)rAttr
).maURL
) &&
123 ( maDescription
== ((const TextAttribHyperLink
&)rAttr
).maDescription
) &&
124 ( maColor
== ((const TextAttribHyperLink
&)rAttr
).maColor
) );
127 TextAttribProtect::TextAttribProtect() :
128 TextAttrib( TEXTATTR_PROTECTED
)
132 TextAttribProtect::TextAttribProtect( const TextAttribProtect
&) :
133 TextAttrib( TEXTATTR_PROTECTED
)
137 TextAttribProtect::~TextAttribProtect()
141 void TextAttribProtect::SetFont( Font
& ) const
145 TextAttrib
* TextAttribProtect::Clone() const
147 return new TextAttribProtect();
150 int TextAttribProtect::operator==( const TextAttrib
& rAttr
) const
152 return ( TextAttrib::operator==(rAttr
) );
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */