bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / filter / html / htmlattr.cxx
blob686a35666c12a9402c2006cef5423f95c6965501
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/decoview.hxx>
24 #include <vcl/builderfactory.hxx>
26 SdHtmlAttrPreview::SdHtmlAttrPreview(vcl::Window* pParent, WinBits nStyle)
27 : Control(pParent, nStyle)
31 VCL_BUILDER_FACTORY_CONSTRUCTOR(SdHtmlAttrPreview, 0)
33 SdHtmlAttrPreview::~SdHtmlAttrPreview()
37 void SdHtmlAttrPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect)
39 DecorationView aDecoView(&rRenderContext);
41 ::tools::Rectangle aTextRect;
42 aTextRect.SetSize(GetOutputSize());
44 rRenderContext.SetLineColor(m_aBackColor);
45 rRenderContext.SetFillColor(m_aBackColor);
46 rRenderContext.DrawRect(rRect);
47 rRenderContext.SetFillColor();
49 int nHeight = (aTextRect.Bottom() - aTextRect.Top()) >> 2;
50 aTextRect.SetBottom( nHeight + aTextRect.Top() );
52 rRenderContext.SetTextColor(m_aTextColor);
53 rRenderContext.DrawText(aTextRect, SdResId(STR_HTMLATTR_TEXT), DrawTextFlags::Center | DrawTextFlags::VCenter);
55 aTextRect.Move(0,nHeight);
56 rRenderContext.SetTextColor(m_aLinkColor);
57 rRenderContext.DrawText(aTextRect, SdResId(STR_HTMLATTR_LINK), DrawTextFlags::Center | DrawTextFlags::VCenter);
59 aTextRect.Move(0,nHeight);
60 rRenderContext.SetTextColor(m_aALinkColor);
61 rRenderContext.DrawText(aTextRect, SdResId(STR_HTMLATTR_ALINK), DrawTextFlags::Center | DrawTextFlags::VCenter);
63 aTextRect.Move(0,nHeight);
64 rRenderContext.SetTextColor(m_aVLinkColor);
65 rRenderContext.DrawText(aTextRect, SdResId(STR_HTMLATTR_VLINK), DrawTextFlags::Center | DrawTextFlags::VCenter);
68 void SdHtmlAttrPreview::SetColors(Color const & aBack, Color const & aText, Color const & aLink,
69 Color const & aVLink, Color const & aALink)
71 m_aBackColor = aBack;
72 m_aTextColor = aText;
73 m_aLinkColor = aLink;
74 m_aVLinkColor = aVLink;
75 m_aALinkColor = aALink;
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */