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 33 TextAttrib::~TextAttrib() 34 { 35 } 36 37 void TextAttrib::SetFont( Font& ) const 38 { 39 } 40 41 TextAttrib* TextAttrib::Clone() const 42 { 43 return NULL; 44 } 45 46 int TextAttrib::operator==( const TextAttrib& rAttr ) const 47 { 48 return mnWhich == rAttr.mnWhich; 49 } 50 51 52 TextAttribFontColor::TextAttribFontColor( const Color& rColor ) 53 : TextAttrib( TEXTATTR_FONTCOLOR ), maColor( rColor ) 54 { 55 } 56 57 TextAttribFontColor::TextAttribFontColor( const TextAttribFontColor& rAttr ) 58 : TextAttrib( rAttr ), maColor( rAttr.maColor ) 59 { 60 } 61 62 TextAttribFontColor::~TextAttribFontColor() 63 { 64 } 65 66 void TextAttribFontColor::SetFont( Font& rFont ) const 67 { 68 rFont.SetColor( maColor ); 69 } 70 71 TextAttrib* TextAttribFontColor::Clone() const 72 { 73 return new TextAttribFontColor( *this ); 74 } 75 76 int TextAttribFontColor::operator==( const TextAttrib& rAttr ) const 77 { 78 return ( ( TextAttrib::operator==(rAttr ) ) && 79 ( maColor == ((const TextAttribFontColor&)rAttr).maColor ) ); 80 } 81 82 TextAttribFontWeight::TextAttribFontWeight( FontWeight eWeight ) 83 : TextAttrib( TEXTATTR_FONTWEIGHT ), meWeight( eWeight ) 84 { 85 } 86 87 TextAttribFontWeight::TextAttribFontWeight( const TextAttribFontWeight& rAttr ) 88 : TextAttrib( rAttr ), meWeight( rAttr.meWeight ) 89 { 90 } 91 92 TextAttribFontWeight::~TextAttribFontWeight() 93 { 94 } 95 96 void TextAttribFontWeight::SetFont( Font& rFont ) const 97 { 98 rFont.SetWeight( meWeight ); 99 } 100 101 TextAttrib* TextAttribFontWeight::Clone() const 102 { 103 return new TextAttribFontWeight( *this ); 104 } 105 106 int TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const 107 { 108 return ( ( TextAttrib::operator==(rAttr ) ) && 109 ( meWeight == ((const TextAttribFontWeight&)rAttr).meWeight ) ); 110 } 111 112 113 TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL ) 114 : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ) 115 { 116 maColor = COL_BLUE; 117 } 118 119 TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL, const XubString& rDescription ) 120 : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ), maDescription( rDescription ) 121 { 122 maColor = COL_BLUE; 123 } 124 125 TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr ) 126 : TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription ) 127 { 128 maColor = rAttr.maColor; 129 } 130 131 TextAttribHyperLink::~TextAttribHyperLink() 132 { 133 } 134 135 void TextAttribHyperLink::SetFont( Font& rFont ) const 136 { 137 rFont.SetColor( maColor ); 138 rFont.SetUnderline( UNDERLINE_SINGLE ); 139 } 140 141 TextAttrib* TextAttribHyperLink::Clone() const 142 { 143 return new TextAttribHyperLink( *this ); 144 } 145 146 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 -----------------------------------------------------------------------*/ 157 TextAttribProtect::TextAttribProtect() : 158 TextAttrib( TEXTATTR_PROTECTED ) 159 { 160 } 161 /*-- 24.06.2004 14:49:44--------------------------------------------------- 162 163 -----------------------------------------------------------------------*/ 164 TextAttribProtect::TextAttribProtect( const TextAttribProtect&) : 165 TextAttrib( TEXTATTR_PROTECTED ) 166 { 167 } 168 /*-- 24.06.2004 14:49:44--------------------------------------------------- 169 170 -----------------------------------------------------------------------*/ 171 TextAttribProtect::~TextAttribProtect() 172 { 173 } 174 /*-- 24.06.2004 14:49:44--------------------------------------------------- 175 176 -----------------------------------------------------------------------*/ 177 void TextAttribProtect::SetFont( Font& ) const 178 { 179 } 180 /*-- 24.06.2004 14:49:44--------------------------------------------------- 181 182 -----------------------------------------------------------------------*/ 183 TextAttrib* TextAttribProtect::Clone() const 184 { 185 return new TextAttribProtect(); 186 } 187 /*-- 24.06.2004 14:49:45--------------------------------------------------- 188 189 -----------------------------------------------------------------------*/ 190 int TextAttribProtect::operator==( const TextAttrib& rAttr ) const 191 { 192 return ( TextAttrib::operator==(rAttr ) ); 193 } 194