1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_svtools.hxx" 30 31 #include <svtools/txtattr.hxx> 32 #include <vcl/font.hxx> 33 34 35 36 37 TextAttrib::~TextAttrib() 38 { 39 } 40 41 void TextAttrib::SetFont( Font& ) const 42 { 43 } 44 45 TextAttrib* TextAttrib::Clone() const 46 { 47 return NULL; 48 } 49 50 int TextAttrib::operator==( const TextAttrib& rAttr ) const 51 { 52 return mnWhich == rAttr.mnWhich; 53 } 54 55 56 TextAttribFontColor::TextAttribFontColor( const Color& rColor ) 57 : TextAttrib( TEXTATTR_FONTCOLOR ), maColor( rColor ) 58 { 59 } 60 61 TextAttribFontColor::TextAttribFontColor( const TextAttribFontColor& rAttr ) 62 : TextAttrib( rAttr ), maColor( rAttr.maColor ) 63 { 64 } 65 66 TextAttribFontColor::~TextAttribFontColor() 67 { 68 } 69 70 void TextAttribFontColor::SetFont( Font& rFont ) const 71 { 72 rFont.SetColor( maColor ); 73 } 74 75 TextAttrib* TextAttribFontColor::Clone() const 76 { 77 return new TextAttribFontColor( *this ); 78 } 79 80 int TextAttribFontColor::operator==( const TextAttrib& rAttr ) const 81 { 82 return ( ( TextAttrib::operator==(rAttr ) ) && 83 ( maColor == ((const TextAttribFontColor&)rAttr).maColor ) ); 84 } 85 86 TextAttribFontWeight::TextAttribFontWeight( FontWeight eWeight ) 87 : TextAttrib( TEXTATTR_FONTWEIGHT ), meWeight( eWeight ) 88 { 89 } 90 91 TextAttribFontWeight::TextAttribFontWeight( const TextAttribFontWeight& rAttr ) 92 : TextAttrib( rAttr ), meWeight( rAttr.meWeight ) 93 { 94 } 95 96 TextAttribFontWeight::~TextAttribFontWeight() 97 { 98 } 99 100 void TextAttribFontWeight::SetFont( Font& rFont ) const 101 { 102 rFont.SetWeight( meWeight ); 103 } 104 105 TextAttrib* TextAttribFontWeight::Clone() const 106 { 107 return new TextAttribFontWeight( *this ); 108 } 109 110 int TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const 111 { 112 return ( ( TextAttrib::operator==(rAttr ) ) && 113 ( meWeight == ((const TextAttribFontWeight&)rAttr).meWeight ) ); 114 } 115 116 117 TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL ) 118 : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ) 119 { 120 maColor = COL_BLUE; 121 } 122 123 TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL, const XubString& rDescription ) 124 : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ), maDescription( rDescription ) 125 { 126 maColor = COL_BLUE; 127 } 128 129 TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr ) 130 : TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription ) 131 { 132 maColor = rAttr.maColor; 133 } 134 135 TextAttribHyperLink::~TextAttribHyperLink() 136 { 137 } 138 139 void TextAttribHyperLink::SetFont( Font& rFont ) const 140 { 141 rFont.SetColor( maColor ); 142 rFont.SetUnderline( UNDERLINE_SINGLE ); 143 } 144 145 TextAttrib* TextAttribHyperLink::Clone() const 146 { 147 return new TextAttribHyperLink( *this ); 148 } 149 150 int TextAttribHyperLink::operator==( const TextAttrib& rAttr ) const 151 { 152 return ( ( TextAttrib::operator==(rAttr ) ) && 153 ( maURL == ((const TextAttribHyperLink&)rAttr).maURL ) && 154 ( maDescription == ((const TextAttribHyperLink&)rAttr).maDescription ) && 155 ( maColor == ((const TextAttribHyperLink&)rAttr).maColor ) ); 156 } 157 158 /*-- 24.06.2004 14:49:44--------------------------------------------------- 159 160 -----------------------------------------------------------------------*/ 161 TextAttribProtect::TextAttribProtect() : 162 TextAttrib( TEXTATTR_PROTECTED ) 163 { 164 } 165 /*-- 24.06.2004 14:49:44--------------------------------------------------- 166 167 -----------------------------------------------------------------------*/ 168 TextAttribProtect::TextAttribProtect( const TextAttribProtect&) : 169 TextAttrib( TEXTATTR_PROTECTED ) 170 { 171 } 172 /*-- 24.06.2004 14:49:44--------------------------------------------------- 173 174 -----------------------------------------------------------------------*/ 175 TextAttribProtect::~TextAttribProtect() 176 { 177 } 178 /*-- 24.06.2004 14:49:44--------------------------------------------------- 179 180 -----------------------------------------------------------------------*/ 181 void TextAttribProtect::SetFont( Font& ) const 182 { 183 } 184 /*-- 24.06.2004 14:49:44--------------------------------------------------- 185 186 -----------------------------------------------------------------------*/ 187 TextAttrib* TextAttribProtect::Clone() const 188 { 189 return new TextAttribProtect(); 190 } 191 /*-- 24.06.2004 14:49:45--------------------------------------------------- 192 193 -----------------------------------------------------------------------*/ 194 int TextAttribProtect::operator==( const TextAttrib& rAttr ) const 195 { 196 return ( TextAttrib::operator==(rAttr ) ); 197 } 198