26#include <osl/process.h>
27#include <rtl/bootstrap.hxx>
35#include <config_buildid.h>
36#include <config_features.h>
45#include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
48#include <config_feature_opencl.h>
49#if HAVE_FEATURE_OPENCL
52#include <officecfg/Office/Calc.hxx>
53#include <officecfg/Office/Common.hxx>
58 : GenericDialogController(pParent,
"cui/ui/aboutdialog.ui",
"AboutDialog"),
59 m_pCreditsButton(m_xBuilder->weld_link_button(
"btnCredits")),
60 m_pWebsiteButton(m_xBuilder->weld_link_button(
"btnWebsite")),
61 m_pReleaseNotesButton(m_xBuilder->weld_link_button(
"btnReleaseNotes")),
62 m_pCloseButton(m_xBuilder->weld_button(
"btnClose")),
63 m_pCopyButton(m_xBuilder->weld_button(
"btnCopyVersion")),
64 m_pBrandImage(m_xBuilder->weld_image(
"imBrand")),
65 m_pAboutImage(m_xBuilder->weld_image(
"imAbout")),
66 m_pVersionLabel(m_xBuilder->weld_label(
"lbVersionString")),
67 m_pBuildCaption(m_xBuilder->weld_label(
"lbBuild")),
68 m_pBuildLabel(m_xBuilder->weld_link_button(
"lbBuildString")),
69 m_pEnvLabel(m_xBuilder->weld_label(
"lbEnvString")),
70 m_pUILabel(m_xBuilder->weld_label(
"lbUIString")),
71 m_pLocaleLabel(m_xBuilder->weld_label(
"lbLocaleString")),
72 m_pMiscLabel(m_xBuilder->weld_label(
"lbMiscString")),
73 m_pCopyrightLabel(m_xBuilder->weld_label(
"lbCopyright")) {
81 m_pBuildLabel->set_uri(
"https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h="
83 m_pBuildLabel->set_label(sbuildId.getLength() > nMaxChar ? sbuildId.replaceAt(
84 nMaxChar, sbuildId.getLength() - nMaxChar,
u"...")
105 ?
"shell/logo_inverted"
107 aBackgroundBitmap, nWidth * 0.8)) {
112 Graphic aGraphic(aBackgroundBitmap);
120 Graphic aGraphic(aBackgroundBitmap);
125 m_pCreditsButton->set_uri(officecfg::Office::Common::Menus::CreditsURL::get());
127 OUString sURL(officecfg::Office::Common::Help::StartCenter::InfoURL::get());
132 sURL = officecfg::Office::Common::Menus::ReleaseNotesURL::get() +
145 return std::all_of(hash.begin(), hash.end(),
146 [](
auto &rSymbol) { return std::isxdigit(rSymbol); });
151 auto const ok = rtl::Bootstrap::get(
"_ARCH", arch);
152 assert(ok); (void) ok;
153 OUString sVersion =
CuiResId(
TranslateId(
nullptr,
"%ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX")) +
" (" + arch +
")";
155#if HAVE_FEATURE_COMMUNITY_FLAVOR
156 sVersion +=
" / LibreOffice Community";
165 SAL_WARN_IF(sBuildId.isEmpty(),
"cui.dialogs",
"No BUILDID in bootstrap file");
175 osl_getProcessLocale(&
pLocale);
177 if (
pLocale->Country && rtl_uString_getLength(
pLocale->Country) > 0)
178 sLocaleStr = OUString::unacquired(&
pLocale->Language) +
"_" +
179 OUString::unacquired(&
pLocale->Country);
181 sLocaleStr = OUString(
pLocale->Language);
182 if (
pLocale->Variant && rtl_uString_getLength(
pLocale->Variant) > 0)
183 sLocaleStr += OUString(
pLocale->Variant);
189 OUString aUILocaleStr =
191 OUString sUILocaleStr;
193 sUILocaleStr =
CuiResId(RID_CUISTR_ABOUT_UILOCALE);
197 if (sUILocaleStr.indexOf(
"$LOCALE") == -1) {
198 SAL_WARN(
"cui.dialogs",
"translated uilocale string in translations "
199 "doesn't contain $LOCALE placeholder");
200 sUILocaleStr +=
" $LOCALE";
202 sUILocaleStr = sUILocaleStr.replaceAll(
"$LOCALE", aUILocaleStr);
204 return sLocaleStr +
"; " + sUILocaleStr;
211 bool const extra = EXTRA_BUILDID[0] !=
'\0';
214 sMisc = EXTRA_BUILDID
"\n";
219#if HAVE_FEATURE_OPENCL
224 static const bool bThreadingProhibited =
225 std::getenv(
"SC_NO_THREADED_CALCULATION");
226 bool bThreadedCalc = officecfg::Office::Calc::Formula::Calculation::
227 UseThreadedCalculationForFormulaGroups::get();
229 if (!bThreadingProhibited && bThreadedCalc) {
230 aCalcMode +=
" threaded";
233 if (officecfg::Office::Calc::Defaults::Sheet::JumboSheets::get())
235 aCalcMode +=
" Jumbo";
238 if (aCalcMode.isEmpty())
239 aCalcMode =
" default";
240 sMisc +=
"Calc:" + aCalcMode;
246 OUString sVendorTextStr(
CuiResId(RID_CUISTR_ABOUT_VENDOR));
247 OUString aCopyrightString =
248 sVendorTextStr +
"\n" +
CuiResId(RID_CUISTR_ABOUT_COPYRIGHT) +
"\n";
251 aCopyrightString +=
CuiResId(RID_CUISTR_ABOUT_BASED_ON);
253 aCopyrightString +=
CuiResId(RID_CUISTR_ABOUT_DERIVED);
255 return aCopyrightString;
261 css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
262 css::datatransfer::clipboard::SystemClipboard::create(
265 OUString sInfo =
"Version: " + m_pVersionLabel->get_label() +
"\n"
266 "Build ID: " + GetBuildString() +
"\n" +
268 "Locale: " + GetLocaleString(
false) +
"\n" +
IMPL_LINK_NOARG(AboutDialog, HandleClick, weld::Button &, void)
std::unique_ptr< weld::Label > m_pBuildCaption
std::unique_ptr< weld::Button > m_pCopyButton
std::unique_ptr< weld::Image > m_pAboutImage
std::unique_ptr< weld::Label > m_pMiscLabel
virtual ~AboutDialog() override
static OUString GetCopyrightString()
static bool IsStringValidGitHash(std::u16string_view hash)
static OUString GetLocaleString(bool bLocalized=true)
std::unique_ptr< weld::Label > m_pVersionLabel
std::unique_ptr< weld::Button > m_pCloseButton
std::unique_ptr< weld::Image > m_pBrandImage
std::unique_ptr< weld::LinkButton > m_pBuildLabel
std::unique_ptr< weld::Label > m_pCopyrightLabel
std::unique_ptr< weld::Label > m_pEnvLabel
std::unique_ptr< weld::Label > m_pLocaleLabel
std::unique_ptr< weld::LinkButton > m_pCreditsButton
std::unique_ptr< weld::LinkButton > m_pReleaseNotesButton
std::unique_ptr< weld::LinkButton > m_pWebsiteButton
static OUString GetBuildString()
static OUString GetVersionString()
AboutDialog(weld::Window *pParent)
std::unique_ptr< weld::Label > m_pUILabel
static OUString GetMiscString()
const LanguageTag & GetLanguageTag() const
const LanguageTag & GetUILanguageTag() const
static OUString GetHWOSConfInfo(const int bSelection=0, bool bLocalize=true)
static const AllSettings & GetSettings()
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
const OUString & getBcp47(bool bResolveSystem=true) const
static bool loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWidth)
static OUString getBuildIdData(OUString const &_sDefault)
static OUString getProductVersion()
static OUString getUILocale()
static OUString getProductName()
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, const vcl::ILibreOfficeKitNotifier *pNotifier=nullptr)
OUString CuiResId(TranslateId aKey)
SVT_DLLPUBLIC void localizeWebserviceURI(OUString &io_rURI)
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
std::locale Create(std::string_view aPrefixName, const LanguageTag &rLocale)
OUString get(TranslateId sContextAndId, const std::locale &loc)
Reference< XComponentContext > getProcessComponentContext()
static bool isOpenCLEnabled()