xref: /trunk/main/sd/source/filter/html/htmlattr.cxx (revision 79aad27f)
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_sd.hxx"
26 
27 #ifdef SD_DLLIMPLEMENTATION
28 #undef SD_DLLIMPLEMENTATION
29 #endif
30 
31 #include "htmlattr.hxx"
32 #include "htmlex.hxx"
33 #include <tools/link.hxx>
34 #include <vcl/decoview.hxx>
35 
36 
37 // =====================================================================
38 // =====================================================================
SdHtmlAttrPreview(Window * pParent,const ResId & rResId)39 SdHtmlAttrPreview::SdHtmlAttrPreview( Window* pParent, const ResId& rResId )
40 :Control( pParent, rResId )
41 {
42 //    SetMapMode( MAP_100TH_MM );
43 }
44 
45 // =====================================================================
46 // =====================================================================
~SdHtmlAttrPreview()47 SdHtmlAttrPreview::~SdHtmlAttrPreview()
48 {
49 }
50 
51 // =====================================================================
52 // =====================================================================
Paint(const Rectangle & rRect)53 void SdHtmlAttrPreview::Paint( const Rectangle& rRect )
54 {
55 	DecorationView aDecoView( this );
56 
57 	Rectangle aTextRect;
58 	aTextRect.SetSize(GetOutputSize());
59 
60 	SetLineColor(m_aBackColor);
61 	SetFillColor(m_aBackColor);
62 	DrawRect(rRect);
63 	SetFillColor();
64 
65 	int nHeight = (aTextRect.nBottom - aTextRect.nTop) >> 2;
66 	aTextRect.nBottom =  nHeight + aTextRect.nTop;
67 
68 	SetTextColor(m_aTextColor);
69 	DrawText( aTextRect, String(SdResId(STR_HTMLATTR_TEXT)),
70 						 TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
71 
72 	aTextRect.Move(0,nHeight);
73 	SetTextColor(m_aLinkColor);
74 	DrawText( aTextRect, String(SdResId(STR_HTMLATTR_LINK)),
75 						 TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
76 
77 	aTextRect.Move(0,nHeight);
78 	SetTextColor(m_aALinkColor);
79 	DrawText( aTextRect, String(SdResId(STR_HTMLATTR_ALINK)),
80 						 TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
81 
82 	aTextRect.Move(0,nHeight);
83 	SetTextColor(m_aVLinkColor);
84 	DrawText( aTextRect, String(SdResId(STR_HTMLATTR_VLINK)),
85 						 TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
86 }
87 
88 // =====================================================================
89 // =====================================================================
SetColors(Color & aBack,Color & aText,Color & aLink,Color & aVLink,Color & aALink)90 void SdHtmlAttrPreview::SetColors( Color& aBack, Color& aText, Color& aLink,
91 								   Color& aVLink, Color& aALink )
92 {
93 	m_aBackColor = aBack;
94 	m_aTextColor = aText;
95 	m_aLinkColor = aLink;
96 	m_aVLinkColor = aVLink;
97 	m_aALinkColor = aALink;
98 }
99