Line data Source code
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 :
21 : #ifdef SD_DLLIMPLEMENTATION
22 : #undef SD_DLLIMPLEMENTATION
23 : #endif
24 :
25 : #include "htmlattr.hxx"
26 : #include "htmlex.hxx"
27 : #include <vcl/decoview.hxx>
28 :
29 :
30 : // =====================================================================
31 : // =====================================================================
32 0 : SdHtmlAttrPreview::SdHtmlAttrPreview( Window* pParent, const ResId& rResId )
33 0 : :Control( pParent, rResId )
34 : {
35 0 : }
36 :
37 : // =====================================================================
38 : // =====================================================================
39 0 : SdHtmlAttrPreview::~SdHtmlAttrPreview()
40 : {
41 0 : }
42 :
43 : // =====================================================================
44 : // =====================================================================
45 0 : void SdHtmlAttrPreview::Paint( const Rectangle& rRect )
46 : {
47 0 : DecorationView aDecoView( this );
48 :
49 0 : Rectangle aTextRect;
50 0 : aTextRect.SetSize(GetOutputSize());
51 :
52 0 : SetLineColor(m_aBackColor);
53 0 : SetFillColor(m_aBackColor);
54 0 : DrawRect(rRect);
55 0 : SetFillColor();
56 :
57 0 : int nHeight = (aTextRect.Bottom() - aTextRect.Top()) >> 2;
58 0 : aTextRect.Bottom() = nHeight + aTextRect.Top();
59 :
60 0 : SetTextColor(m_aTextColor);
61 : DrawText( aTextRect, String(SdResId(STR_HTMLATTR_TEXT)),
62 0 : TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
63 :
64 0 : aTextRect.Move(0,nHeight);
65 0 : SetTextColor(m_aLinkColor);
66 : DrawText( aTextRect, String(SdResId(STR_HTMLATTR_LINK)),
67 0 : TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
68 :
69 0 : aTextRect.Move(0,nHeight);
70 0 : SetTextColor(m_aALinkColor);
71 : DrawText( aTextRect, String(SdResId(STR_HTMLATTR_ALINK)),
72 0 : TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
73 :
74 0 : aTextRect.Move(0,nHeight);
75 0 : SetTextColor(m_aVLinkColor);
76 : DrawText( aTextRect, String(SdResId(STR_HTMLATTR_VLINK)),
77 0 : TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
78 0 : }
79 :
80 : // =====================================================================
81 : // =====================================================================
82 0 : void SdHtmlAttrPreview::SetColors( Color& aBack, Color& aText, Color& aLink,
83 : Color& aVLink, Color& aALink )
84 : {
85 0 : m_aBackColor = aBack;
86 0 : m_aTextColor = aText;
87 0 : m_aLinkColor = aLink;
88 0 : m_aVLinkColor = aVLink;
89 0 : m_aALinkColor = aALink;
90 0 : }
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|