bump product version to 6.4.0.3
[LibreOffice.git] / vcl / source / window / aboutdialog.cxx
blob882b47b0979042937fe935191cb921b932f19be9
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.
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 */
10 #include <vcl/layout.hxx>
11 #include <vcl/svapp.hxx>
12 #include <vcl/settings.hxx>
13 #include <aboutdialog.hxx>
15 using namespace ::com::sun::star::uno;
16 using namespace ::com::sun::star::beans;
17 using namespace ::com::sun::star;
18 using namespace vcl;
20 AboutDialog::AboutDialog(vcl::Window* pParent, WinBits nStyle, Dialog::InitFlag eFlag)
21 : Dialog(pParent, nStyle, eFlag)
22 , m_xBuilder(new VclBuilder(this, getUIRootDir(), "vcl/ui/aboutbox.ui"))
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");
32 // tdf#127148 so tabbing into the widget will auto select-all
33 AllSettings aSettings = m_xVersion->GetSettings();
34 StyleSettings aStyleSettings = aSettings.GetStyleSettings();
35 aStyleSettings.SetSelectionOptions(aStyleSettings.GetSelectionOptions()
36 | SelectionOptions::Focus);
37 aSettings.SetStyleSettings(aStyleSettings);
38 m_xVersion->SetSettings(aSettings, true);
40 #ifndef MACOSX
41 m_xVersion->RequestDoubleBuffering(true);
42 #endif
45 void AboutDialog::set_content_area(VclBox* pBox)
47 Dialog::set_content_area(pBox);
49 // move it now that the content area exists
50 m_xContents->SetParent(pBox);
52 StyleControls();
55 AboutDialog::~AboutDialog() { disposeOnce(); }
57 void AboutDialog::dispose()
59 m_xVersion.clear();
60 m_xDescriptionText.clear();
61 m_xCopyrightText.clear();
62 m_xLogoImage.clear();
63 m_xLogoReplacement.clear();
64 m_xBuildIdLink.clear();
65 m_xContents.clear();
66 m_xBuilder.reset();
67 Dialog::dispose();
70 void AboutDialog::StyleControls()
72 // Make all the controls have a transparent background
73 m_xLogoImage->SetBackground();
74 m_xLogoReplacement->SetPaintTransparent(true);
75 m_xVersion->SetPaintTransparent(true);
76 m_xDescriptionText->SetPaintTransparent(true);
77 m_xCopyrightText->SetPaintTransparent(true);
79 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
81 const vcl::Font& aLabelFont = rStyleSettings.GetLabelFont();
82 vcl::Font aLargeFont = aLabelFont;
83 aLargeFont.SetFontSize(Size(0, aLabelFont.GetFontSize().Height() * 3));
85 // Logo Replacement Text
86 m_xLogoReplacement->SetControlFont(aLargeFont);
88 // Description Text
89 aLargeFont.SetFontSize(Size(0, aLabelFont.GetFontSize().Height() * 1.3));
90 m_xDescriptionText->SetControlFont(aLargeFont);
93 void AboutDialog::SetLogo(const Image& rLogoBitmap)
95 if (!rLogoBitmap)
97 m_xLogoImage->Hide();
98 m_xLogoReplacement->Show();
100 else
102 m_xLogoReplacement->Hide();
103 m_xLogoImage->SetImage(rLogoBitmap);
104 m_xLogoImage->Show();
108 void AboutDialog::SetBackground(const Image& rBackgroundBitmap)
110 m_aBackgroundBitmap = rBackgroundBitmap.GetBitmapEx();
111 Invalidate();
114 void AboutDialog::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& /*rRect*/)
116 Size aSize(GetOutputSizePixel());
117 Point aPos(aSize.Width() - m_aBackgroundBitmap.GetSizePixel().Width(),
118 aSize.Height() - m_aBackgroundBitmap.GetSizePixel().Height());
120 rRenderContext.DrawBitmapEx(aPos, m_aBackgroundBitmap);
123 bool AboutDialog::set_property(const OString& rKey, const OUString& rValue)
125 if (rKey == "version")
126 m_xVersion->SetText(rValue);
127 else if (rKey == "copyright")
128 m_xCopyrightText->SetText(rValue);
129 else if (rKey == "comments")
130 m_xDescriptionText->SetText(rValue);
131 else if (rKey == "website")
132 m_xBuildIdLink->SetURL(rValue);
133 else if (rKey == "website_label")
134 m_xBuildIdLink->SetText(rValue);
135 else if (rKey == "program_name")
136 m_xLogoReplacement->SetText(rValue);
137 else
138 return Dialog::set_property(rKey, rValue);
139 return true;
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */