LibreOffice Module vcl (master)  1
txtattr.cxx
Go to the documentation of this file.
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 <vcl/txtattr.hxx>
21 #include <vcl/font.hxx>
22 
24 {
25 }
26 
27 bool TextAttrib::operator==( const TextAttrib& rAttr ) const
28 {
29  return mnWhich == rAttr.mnWhich;
30 }
31 
33  : TextAttrib( TEXTATTR_FONTCOLOR ), maColor( rColor )
34 {
35 }
36 
38 {
39  rFont.SetColor( maColor );
40 }
41 
42 std::unique_ptr<TextAttrib> TextAttribFontColor::Clone() const
43 {
44  return std::unique_ptr<TextAttrib>(new TextAttribFontColor( *this ));
45 }
46 
47 bool TextAttribFontColor::operator==( const TextAttrib& rAttr ) const
48 {
49  return ( ( TextAttrib::operator==(rAttr ) ) &&
50  ( maColor == static_cast<const TextAttribFontColor&>(rAttr).maColor ) );
51 }
52 
54  : TextAttrib( TEXTATTR_FONTWEIGHT ), meWeight( eWeight )
55 {
56 }
57 
59 {
60  rFont.SetWeight( meWeight );
61 }
62 
63 std::unique_ptr<TextAttrib> TextAttribFontWeight::Clone() const
64 {
65  return std::unique_ptr<TextAttrib>(new TextAttribFontWeight( *this ));
66 }
67 
68 bool TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const
69 {
70  return ( ( TextAttrib::operator==(rAttr ) ) &&
71  ( meWeight == static_cast<const TextAttribFontWeight&>(rAttr).meWeight ) );
72 }
73 
76 {
77 }
78 
80 {
81 }
82 
83 std::unique_ptr<TextAttrib> TextAttribProtect::Clone() const
84 {
85  return std::unique_ptr<TextAttrib>(new TextAttribProtect());
86 }
87 
88 bool TextAttribProtect::operator==( const TextAttrib& rAttr ) const
89 {
90  return TextAttrib::operator==(rAttr );
91 }
92 
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool operator==(const TextAttrib &rAttr) const override
Definition: txtattr.cxx:47
void SetWeight(FontWeight)
Definition: font/font.cxx:214
#define TEXTATTR_PROTECTED
Definition: txtattr.hxx:35
virtual void SetFont(vcl::Font &rFont) const override
Definition: txtattr.cxx:58
FontWeight const meWeight
Definition: txtattr.hxx:80
virtual bool operator==(const TextAttrib &rAttr) const override
Definition: txtattr.cxx:88
Color const maColor
Definition: txtattr.hxx:64
virtual void SetFont(vcl::Font &rFont) const override
Definition: txtattr.cxx:79
virtual std::unique_ptr< TextAttrib > Clone() const override
Definition: txtattr.cxx:63
virtual std::unique_ptr< TextAttrib > Clone() const override
Definition: txtattr.cxx:42
virtual ~TextAttrib()
Definition: txtattr.cxx:23
void SetColor(const Color &)
Definition: font/font.cxx:79
FontWeight
virtual bool operator==(const TextAttrib &rAttr) const =0
Definition: txtattr.cxx:27
#define TEXTATTR_FONTWEIGHT
Definition: txtattr.hxx:32
TextAttribFontColor(const Color &rColor)
Definition: txtattr.cxx:32
TextAttribFontWeight(FontWeight eWeight)
Definition: txtattr.cxx:53
sal_uInt16 const mnWhich
Definition: txtattr.hxx:41
virtual void SetFont(vcl::Font &rFont) const override
Definition: txtattr.cxx:37
virtual bool operator==(const TextAttrib &rAttr) const override
Definition: txtattr.cxx:68
virtual std::unique_ptr< TextAttrib > Clone() const override
Definition: txtattr.cxx:83
#define TEXTATTR_FONTCOLOR
Definition: txtattr.hxx:31