xref: /aoo41x/main/svtools/source/edit/txtattr.cxx (revision 5900e8ec)
1*5900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5900e8ecSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5900e8ecSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5900e8ecSAndrew Rist  * distributed with this work for additional information
6*5900e8ecSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5900e8ecSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5900e8ecSAndrew Rist  * "License"); you may not use this file except in compliance
9*5900e8ecSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5900e8ecSAndrew Rist  *
11*5900e8ecSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5900e8ecSAndrew Rist  *
13*5900e8ecSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5900e8ecSAndrew Rist  * software distributed under the License is distributed on an
15*5900e8ecSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5900e8ecSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5900e8ecSAndrew Rist  * specific language governing permissions and limitations
18*5900e8ecSAndrew Rist  * under the License.
19*5900e8ecSAndrew Rist  *
20*5900e8ecSAndrew Rist  *************************************************************/
21*5900e8ecSAndrew Rist 
22*5900e8ecSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svtools/txtattr.hxx>
28cdf0e10cSrcweir #include <vcl/font.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 
~TextAttrib()33cdf0e10cSrcweir TextAttrib::~TextAttrib()
34cdf0e10cSrcweir {
35cdf0e10cSrcweir }
36cdf0e10cSrcweir 
SetFont(Font &) const37cdf0e10cSrcweir void TextAttrib::SetFont( Font& ) const
38cdf0e10cSrcweir {
39cdf0e10cSrcweir }
40cdf0e10cSrcweir 
Clone() const41cdf0e10cSrcweir TextAttrib* TextAttrib::Clone() const
42cdf0e10cSrcweir {
43cdf0e10cSrcweir 	return NULL;
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
operator ==(const TextAttrib & rAttr) const46cdf0e10cSrcweir int TextAttrib::operator==( const TextAttrib& rAttr ) const
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 	return mnWhich == rAttr.mnWhich;
49cdf0e10cSrcweir }
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
TextAttribFontColor(const Color & rColor)52cdf0e10cSrcweir TextAttribFontColor::TextAttribFontColor( const Color& rColor )
53cdf0e10cSrcweir 	: TextAttrib( TEXTATTR_FONTCOLOR ), maColor( rColor )
54cdf0e10cSrcweir {
55cdf0e10cSrcweir }
56cdf0e10cSrcweir 
TextAttribFontColor(const TextAttribFontColor & rAttr)57cdf0e10cSrcweir TextAttribFontColor::TextAttribFontColor( const TextAttribFontColor& rAttr )
58cdf0e10cSrcweir 	: TextAttrib( rAttr ), maColor( rAttr.maColor )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
~TextAttribFontColor()62cdf0e10cSrcweir TextAttribFontColor::~TextAttribFontColor()
63cdf0e10cSrcweir {
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
SetFont(Font & rFont) const66cdf0e10cSrcweir void TextAttribFontColor::SetFont( Font& rFont ) const
67cdf0e10cSrcweir {
68cdf0e10cSrcweir 	rFont.SetColor( maColor );
69cdf0e10cSrcweir }
70cdf0e10cSrcweir 
Clone() const71cdf0e10cSrcweir TextAttrib* TextAttribFontColor::Clone() const
72cdf0e10cSrcweir {
73cdf0e10cSrcweir 	return new TextAttribFontColor( *this );
74cdf0e10cSrcweir }
75cdf0e10cSrcweir 
operator ==(const TextAttrib & rAttr) const76cdf0e10cSrcweir int TextAttribFontColor::operator==( const TextAttrib& rAttr ) const
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	return ( ( TextAttrib::operator==(rAttr ) ) &&
79cdf0e10cSrcweir 				( maColor == ((const TextAttribFontColor&)rAttr).maColor ) );
80cdf0e10cSrcweir }
81cdf0e10cSrcweir 
TextAttribFontWeight(FontWeight eWeight)82cdf0e10cSrcweir TextAttribFontWeight::TextAttribFontWeight( FontWeight eWeight )
83cdf0e10cSrcweir 	: TextAttrib( TEXTATTR_FONTWEIGHT ), meWeight( eWeight )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir }
86cdf0e10cSrcweir 
TextAttribFontWeight(const TextAttribFontWeight & rAttr)87cdf0e10cSrcweir TextAttribFontWeight::TextAttribFontWeight( const TextAttribFontWeight& rAttr )
88cdf0e10cSrcweir 	: TextAttrib( rAttr ), meWeight( rAttr.meWeight )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
~TextAttribFontWeight()92cdf0e10cSrcweir TextAttribFontWeight::~TextAttribFontWeight()
93cdf0e10cSrcweir {
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
SetFont(Font & rFont) const96cdf0e10cSrcweir void TextAttribFontWeight::SetFont( Font& rFont ) const
97cdf0e10cSrcweir {
98cdf0e10cSrcweir 	rFont.SetWeight( meWeight );
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
Clone() const101cdf0e10cSrcweir TextAttrib* TextAttribFontWeight::Clone() const
102cdf0e10cSrcweir {
103cdf0e10cSrcweir 	return new TextAttribFontWeight( *this );
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
operator ==(const TextAttrib & rAttr) const106cdf0e10cSrcweir int TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	return ( ( TextAttrib::operator==(rAttr ) ) &&
109cdf0e10cSrcweir 				( meWeight == ((const TextAttribFontWeight&)rAttr).meWeight ) );
110cdf0e10cSrcweir }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 
TextAttribHyperLink(const XubString & rURL)113cdf0e10cSrcweir TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL )
114cdf0e10cSrcweir 	: TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL )
115cdf0e10cSrcweir {
116cdf0e10cSrcweir 	maColor = COL_BLUE;
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
TextAttribHyperLink(const XubString & rURL,const XubString & rDescription)119cdf0e10cSrcweir TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL, const XubString& rDescription )
120cdf0e10cSrcweir 	: TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ), maDescription( rDescription )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	maColor = COL_BLUE;
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
TextAttribHyperLink(const TextAttribHyperLink & rAttr)125cdf0e10cSrcweir TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr )
126cdf0e10cSrcweir 	: TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir 	maColor = rAttr.maColor;
129cdf0e10cSrcweir }
130cdf0e10cSrcweir 
~TextAttribHyperLink()131cdf0e10cSrcweir TextAttribHyperLink::~TextAttribHyperLink()
132cdf0e10cSrcweir {
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
SetFont(Font & rFont) const135cdf0e10cSrcweir void TextAttribHyperLink::SetFont( Font& rFont ) const
136cdf0e10cSrcweir {
137cdf0e10cSrcweir 	rFont.SetColor( maColor );
138cdf0e10cSrcweir 	rFont.SetUnderline( UNDERLINE_SINGLE );
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
Clone() const141cdf0e10cSrcweir TextAttrib* TextAttribHyperLink::Clone() const
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	return new TextAttribHyperLink( *this );
144cdf0e10cSrcweir }
145cdf0e10cSrcweir 
operator ==(const TextAttrib & rAttr) const146cdf0e10cSrcweir int TextAttribHyperLink::operator==( const TextAttrib& rAttr ) const
147cdf0e10cSrcweir {
148cdf0e10cSrcweir 	return ( ( TextAttrib::operator==(rAttr ) ) &&
149cdf0e10cSrcweir 				( maURL == ((const TextAttribHyperLink&)rAttr).maURL ) &&
150cdf0e10cSrcweir 				( maDescription == ((const TextAttribHyperLink&)rAttr).maDescription ) &&
151cdf0e10cSrcweir 				( maColor == ((const TextAttribHyperLink&)rAttr).maColor ) );
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir /*-- 24.06.2004 14:49:44---------------------------------------------------
155cdf0e10cSrcweir 
156cdf0e10cSrcweir   -----------------------------------------------------------------------*/
TextAttribProtect()157cdf0e10cSrcweir TextAttribProtect::TextAttribProtect() :
158cdf0e10cSrcweir     TextAttrib( TEXTATTR_PROTECTED )
159cdf0e10cSrcweir {
160cdf0e10cSrcweir }
161cdf0e10cSrcweir /*-- 24.06.2004 14:49:44---------------------------------------------------
162cdf0e10cSrcweir 
163cdf0e10cSrcweir   -----------------------------------------------------------------------*/
TextAttribProtect(const TextAttribProtect &)164cdf0e10cSrcweir TextAttribProtect::TextAttribProtect( const TextAttribProtect&) :
165cdf0e10cSrcweir     TextAttrib( TEXTATTR_PROTECTED )
166cdf0e10cSrcweir {
167cdf0e10cSrcweir }
168cdf0e10cSrcweir /*-- 24.06.2004 14:49:44---------------------------------------------------
169cdf0e10cSrcweir 
170cdf0e10cSrcweir   -----------------------------------------------------------------------*/
~TextAttribProtect()171cdf0e10cSrcweir TextAttribProtect::~TextAttribProtect()
172cdf0e10cSrcweir {
173cdf0e10cSrcweir }
174cdf0e10cSrcweir /*-- 24.06.2004 14:49:44---------------------------------------------------
175cdf0e10cSrcweir 
176cdf0e10cSrcweir   -----------------------------------------------------------------------*/
SetFont(Font &) const177cdf0e10cSrcweir void TextAttribProtect::SetFont( Font& ) const
178cdf0e10cSrcweir {
179cdf0e10cSrcweir }
180cdf0e10cSrcweir /*-- 24.06.2004 14:49:44---------------------------------------------------
181cdf0e10cSrcweir 
182cdf0e10cSrcweir   -----------------------------------------------------------------------*/
Clone() const183cdf0e10cSrcweir TextAttrib*     TextAttribProtect::Clone() const
184cdf0e10cSrcweir {
185cdf0e10cSrcweir     return new TextAttribProtect();
186cdf0e10cSrcweir }
187cdf0e10cSrcweir /*-- 24.06.2004 14:49:45---------------------------------------------------
188cdf0e10cSrcweir 
189cdf0e10cSrcweir   -----------------------------------------------------------------------*/
operator ==(const TextAttrib & rAttr) const190cdf0e10cSrcweir int TextAttribProtect::operator==( const TextAttrib& rAttr ) const
191cdf0e10cSrcweir {
192cdf0e10cSrcweir     return ( TextAttrib::operator==(rAttr ) );
193cdf0e10cSrcweir }
194