LibreOffice Module vcl (master)  1
aboutdialog.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 
10 #include <vcl/layout.hxx>
11 #include <vcl/svapp.hxx>
12 #include <vcl/settings.hxx>
13 #include <aboutdialog.hxx>
14 
15 using namespace ::com::sun::star::uno;
16 using namespace ::com::sun::star::beans;
17 using namespace ::com::sun::star;
18 using namespace vcl;
19 
21  : Dialog(pParent, nStyle, eFlag)
22  , m_xBuilder(new VclBuilder(this, getUIRootDir(), "vcl/ui/aboutbox.ui"))
23 {
24  m_xBuilder->get(m_xContents, "about");
25  m_xBuilder->get(m_xLogoReplacement, "logoreplacement");
26  m_xBuilder->get(m_xLogoImage, "logo");
27  m_xBuilder->get(m_xVersion, "version");
28  m_xBuilder->get(m_xDescriptionText, "description");
29  m_xBuilder->get(m_xCopyrightText, "copyright");
30  m_xBuilder->get(m_xBuildIdLink, "buildIdLink");
31 
32 #ifndef MACOSX
34 #endif
35 }
36 
38 {
40 
41  // move it now that the content area exists
42  m_xContents->SetParent(pBox);
43 
44  StyleControls();
45 }
46 
48 
50 {
51  m_xVersion.clear();
58  m_xBuilder.reset();
60 }
61 
63 {
64  // Make all the controls have a transparent background
70 
71  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
72 
73  const vcl::Font& aLabelFont = rStyleSettings.GetLabelFont();
74  vcl::Font aLargeFont = aLabelFont;
75  aLargeFont.SetFontSize(Size(0, aLabelFont.GetFontSize().Height() * 3));
76 
77  // Logo Replacement Text
79 
80  // Description Text
81  aLargeFont.SetFontSize(Size(0, aLabelFont.GetFontSize().Height() * 1.3));
83 }
84 
85 void AboutDialog::SetLogo(const Image& rLogoBitmap)
86 {
87  if (!rLogoBitmap)
88  {
89  m_xLogoImage->Hide();
91  }
92  else
93  {
95  m_xLogoImage->SetImage(rLogoBitmap);
96  m_xLogoImage->Show();
97  }
98 }
99 
100 void AboutDialog::SetBackground(const Image& rBackgroundBitmap)
101 {
102  m_aBackgroundBitmap = rBackgroundBitmap.GetBitmapEx();
103  Invalidate();
104 }
105 
106 void AboutDialog::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& /*rRect*/)
107 {
108  Size aSize(GetOutputSizePixel());
109  Point aPos(aSize.Width() - m_aBackgroundBitmap.GetSizePixel().Width(),
111 
112  rRenderContext.DrawBitmapEx(aPos, m_aBackgroundBitmap);
113 }
114 
115 bool AboutDialog::set_property(const OString& rKey, const OUString& rValue)
116 {
117  if (rKey == "version")
118  m_xVersion->SetText(rValue);
119  else if (rKey == "copyright")
120  m_xCopyrightText->SetText(rValue);
121  else if (rKey == "comments")
122  m_xDescriptionText->SetText(rValue);
123  else if (rKey == "website")
124  m_xBuildIdLink->SetURL(rValue);
125  else if (rKey == "website_label")
126  m_xBuildIdLink->SetText(rValue);
127  else if (rKey == "program_name")
128  m_xLogoReplacement->SetText(rValue);
129  else
130  return Dialog::set_property(rKey, rValue);
131  return true;
132 }
133 
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
long Width() const
void SetFontSize(const Size &)
Definition: font/font.cxx:116
BitmapEx m_aBackgroundBitmap
Definition: aboutdialog.hxx:24
long Height() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
Gets the application's settings.
Definition: svapp.cxx:705
VclPtr< FixedText > m_xDescriptionText
Definition: aboutdialog.hxx:30
VclPtr< FixedText > m_xCopyrightText
Definition: aboutdialog.hxx:31
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: aboutdialog.cxx:49
virtual bool set_property(const OString &rKey, const OUString &rValue) override
sal_Int64 WinBits
void SetBackground()
void SetControlFont()
Definition: window2.cxx:409
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: dialog.cxx:621
const vcl::Font & GetLabelFont() const
VclPtr< VclMultiLineEdit > m_xVersion
Definition: aboutdialog.hxx:28
void Hide()
Definition: window.hxx:930
std::unique_ptr< VclBuilder > m_xBuilder
Definition: aboutdialog.hxx:26
void clear()
Definition: vclptr.hxx:190
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: dialog.cxx:1379
virtual void SetText(const OUString &rStr) override
Definition: ctrl.cxx:95
void SetParent(vcl::Window *pNewParent)
Definition: stacking.cxx:831
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1153
VclPtr< VclContainer > m_xContents
Definition: aboutdialog.hxx:27
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
const Size & GetFontSize() const
Definition: font/font.cxx:669
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1015
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
void SetImage(const Image &rImage)
Definition: fixed.cxx:933
void SetLogo(const Image &rLogoBitmap)
Definition: aboutdialog.cxx:85
void RequestDoubleBuffering(bool bRequest)
Enable/disable double-buffering of the frame window and all its children.
Definition: window.cxx:3697
InitFlag
Definition: dialog.hxx:37
VclPtr< FixedText > m_xLogoReplacement
Definition: aboutdialog.hxx:33
VclPtr< FixedHyperlink > m_xBuildIdLink
Definition: aboutdialog.hxx:29
Definition: image.hxx:51
VclPtr< FixedImage > m_xLogoImage
Definition: aboutdialog.hxx:32
virtual void set_content_area(VclBox *pBox)
Definition: dialog.cxx:601
AboutDialog(vcl::Window *pParent, WinBits nStyle=WB_STDDIALOG, InitFlag eFlag=InitFlag::Default)
Definition: aboutdialog.cxx:20
BitmapEx GetBitmapEx() const
Definition: Image.cxx:83
virtual void set_content_area(VclBox *pBox) override
Definition: aboutdialog.cxx:37
virtual ~AboutDialog() override
Definition: aboutdialog.cxx:47
const Size & GetSizePixel() const
Definition: bitmapex.hxx:83
virtual void SetText(const OUString &rStr) override
Definition: vclmedit.cxx:1111
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2150
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override