1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "htmlattr.hxx"
21 #include <sdresid.hxx>
22 #include <strings.hrc>
23 #include <vcl/outdev.hxx>
25 SdHtmlAttrPreview::SdHtmlAttrPreview()
29 SdHtmlAttrPreview::~SdHtmlAttrPreview()
33 void SdHtmlAttrPreview::Paint(vcl::RenderContext
& rRenderContext
, const ::tools::Rectangle
& rRect
)
35 ::tools::Rectangle aTextRect
;
36 aTextRect
.SetSize(GetOutputSizePixel());
38 rRenderContext
.SetLineColor(m_aBackColor
);
39 rRenderContext
.SetFillColor(m_aBackColor
);
40 rRenderContext
.DrawRect(rRect
);
41 rRenderContext
.SetFillColor();
43 int nHeight
= (aTextRect
.Bottom() - aTextRect
.Top()) >> 2;
44 aTextRect
.SetBottom( nHeight
+ aTextRect
.Top() );
46 rRenderContext
.SetTextColor(m_aTextColor
);
47 rRenderContext
.DrawText(aTextRect
, SdResId(STR_HTMLATTR_TEXT
), DrawTextFlags::Center
| DrawTextFlags::VCenter
);
49 aTextRect
.Move(0,nHeight
);
50 rRenderContext
.SetTextColor(m_aLinkColor
);
51 rRenderContext
.DrawText(aTextRect
, SdResId(STR_HTMLATTR_LINK
), DrawTextFlags::Center
| DrawTextFlags::VCenter
);
53 aTextRect
.Move(0,nHeight
);
54 rRenderContext
.SetTextColor(m_aALinkColor
);
55 rRenderContext
.DrawText(aTextRect
, SdResId(STR_HTMLATTR_ALINK
), DrawTextFlags::Center
| DrawTextFlags::VCenter
);
57 aTextRect
.Move(0,nHeight
);
58 rRenderContext
.SetTextColor(m_aVLinkColor
);
59 rRenderContext
.DrawText(aTextRect
, SdResId(STR_HTMLATTR_VLINK
), DrawTextFlags::Center
| DrawTextFlags::VCenter
);
62 void SdHtmlAttrPreview::SetColors(Color
const & aBack
, Color
const & aText
, Color
const & aLink
,
63 Color
const & aVLink
, Color
const & aALink
)
68 m_aVLinkColor
= aVLink
;
69 m_aALinkColor
= aALink
;
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */