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