22 #include <osl/process.h>
30 #include <config_buildid.h>
31 #include <config_features.h>
32 #include <dialmgr.hxx>
35 #include <strings.hrc>
40 #include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
43 #include <config_feature_opencl.h>
44 #if HAVE_FEATURE_OPENCL
47 #include <officecfg/Office/Calc.hxx>
48 #include <officecfg/Office/Common.hxx>
53 : GenericDialogController(pParent,
"cui/ui/aboutdialog.ui",
"AboutDialog"),
54 m_pCreditsButton(m_xBuilder->weld_link_button(
"btnCredits")),
55 m_pWebsiteButton(m_xBuilder->weld_link_button(
"btnWebsite")),
56 m_pReleaseNotesButton(m_xBuilder->weld_link_button(
"btnReleaseNotes")),
57 m_pCloseButton(m_xBuilder->weld_button(
"btnClose")),
58 m_pCopyButton(m_xBuilder->weld_button(
"btnCopyVersion")),
59 m_pBrandImage(m_xBuilder->weld_image(
"imBrand")),
60 m_pAboutImage(m_xBuilder->weld_image(
"imAbout")),
61 m_pVersionLabel(m_xBuilder->weld_label(
"lbVersionString")),
62 m_pBuildCaption(m_xBuilder->weld_label(
"lbBuild")),
63 m_pBuildLabel(m_xBuilder->weld_link_button(
"lbBuildString")),
64 m_pEnvLabel(m_xBuilder->weld_label(
"lbEnvString")),
65 m_pUILabel(m_xBuilder->weld_label(
"lbUIString")),
66 m_pLocaleLabel(m_xBuilder->weld_label(
"lbLocaleString")),
67 m_pMiscLabel(m_xBuilder->weld_label(
"lbMiscString")),
68 m_pCopyrightLabel(m_xBuilder->weld_label(
"lbCopyright")) {
76 m_pBuildLabel->set_uri(
"https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h="
78 m_pBuildLabel->set_label(sbuildId.getLength() > nMaxChar ? sbuildId.replaceAt(
79 nMaxChar, sbuildId.getLength() - nMaxChar,
u"...")
100 ?
"shell/logo_inverted"
102 aBackgroundBitmap, nWidth * 0.8)) {
105 m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel());
106 m_pVirDev->DrawBitmapEx(
Point(0, 0), aBackgroundBitmap);
113 m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel());
114 m_pVirDev->DrawBitmapEx(
Point(0, 0), aBackgroundBitmap);
120 m_pCreditsButton->set_uri(officecfg::Office::Common::Menus::CreditsURL::get());
122 OUString sURL(officecfg::Office::Common::Help::StartCenter::InfoURL::get());
127 sURL = officecfg::Office::Common::Menus::ReleaseNotesURL::get() +
140 for (
int i = 0;
i < hash.getLength();
i++) {
141 if (!std::isxdigit(hash[
i])) {
149 OUString sVersion =
CuiResId(
TranslateId(
nullptr,
"%ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX"));
152 sVersion +=
" (x64)";
153 #elif defined(_WIN32)
154 sVersion +=
" (x86)";
157 #if HAVE_FEATURE_COMMUNITY_FLAVOR
158 sVersion +=
" / LibreOffice Community";
167 SAL_WARN_IF(sBuildId.isEmpty(),
"cui.dialogs",
"No BUILDID in bootstrap file");
177 osl_getProcessLocale(&pLocale);
178 if (pLocale && pLocale->Language) {
179 if (pLocale->Country && rtl_uString_getLength(pLocale->Country) > 0)
180 sLocaleStr = OUString::unacquired(&pLocale->Language) +
"_" +
181 OUString::unacquired(&pLocale->Country);
183 sLocaleStr = OUString(pLocale->Language);
184 if (pLocale->Variant && rtl_uString_getLength(pLocale->Variant) > 0)
185 sLocaleStr += OUString(pLocale->Variant);
191 OUString aUILocaleStr =
193 OUString sUILocaleStr;
195 sUILocaleStr =
CuiResId(RID_CUISTR_ABOUT_UILOCALE);
199 if (sUILocaleStr.indexOf(
"$LOCALE") == -1) {
200 SAL_WARN(
"cui.dialogs",
"translated uilocale string in translations "
201 "doesn't contain $LOCALE placeholder");
202 sUILocaleStr +=
" $LOCALE";
204 sUILocaleStr = sUILocaleStr.replaceAll(
"$LOCALE", aUILocaleStr);
206 return sLocaleStr +
"; " + sUILocaleStr;
213 bool const extra = EXTRA_BUILDID[0] !=
'\0';
216 sMisc = EXTRA_BUILDID
"\n";
221 #if HAVE_FEATURE_OPENCL
226 const bool bOpenCL =
false;
229 static const bool bThreadingProhibited =
230 std::getenv(
"SC_NO_THREADED_CALCULATION");
231 bool bThreadedCalc = officecfg::Office::Calc::Formula::Calculation::
232 UseThreadedCalculationForFormulaGroups::get();
234 if (!bThreadingProhibited && !bOpenCL && bThreadedCalc) {
235 aCalcMode +=
" threaded";
238 if (officecfg::Office::Calc::Defaults::Sheet::JumboSheets::get())
240 aCalcMode +=
" Jumbo";
243 if (aCalcMode.isEmpty())
244 aCalcMode =
" default";
245 sMisc +=
"Calc:" + aCalcMode;
251 OUString sVendorTextStr(
CuiResId(RID_CUISTR_ABOUT_VENDOR));
252 OUString aCopyrightString =
253 sVendorTextStr +
"\n" +
CuiResId(RID_CUISTR_ABOUT_COPYRIGHT) +
"\n";
256 aCopyrightString +=
CuiResId(RID_CUISTR_ABOUT_BASED_ON);
258 aCopyrightString +=
CuiResId(RID_CUISTR_ABOUT_DERIVED);
260 return aCopyrightString;
266 css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
267 css::datatransfer::clipboard::SystemClipboard::create(
270 OUString sInfo =
"Version: " + m_pVersionLabel->get_label() +
"\n"
271 "Build ID: " + GetBuildString() +
"\n" +
273 "Locale: " + GetLocaleString(
false) +
"\n" +
#define LINK(Instance, Class, Member)
std::unique_ptr< weld::Label > m_pUILabel
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, const vcl::ILibreOfficeKitNotifier *pNotifier=nullptr)
static bool isOpenCLEnabled()
AboutDialog(weld::Window *pParent)
static OUString GetLocaleString(bool bLocalized=true)
std::unique_ptr< weld::Label > m_pCopyrightLabel
static bool IsStringValidGitHash(const OUString &hash)
std::unique_ptr< weld::Label > m_pLocaleLabel
const LanguageTag & GetUILanguageTag() const
std::unique_ptr< weld::Label > m_pVersionLabel
static const AllSettings & GetSettings()
const OUString & getBcp47(bool bResolveSystem=true) const
static OUString GetHWOSConfInfo(const int bSelection=0, bool bLocalize=true)
std::unique_ptr< weld::LinkButton > m_pBuildLabel
void localizeWebserviceURI(OUString &rURI)
static OUString GetMiscString()
IMPL_LINK_NOARG(AboutDialog, HandleClick, weld::Button &, void)
std::unique_ptr< weld::Button > m_pCloseButton
static OUString getProductVersion()
const LanguageTag & GetLanguageTag() const
std::locale Create(std::string_view aPrefixName, const LanguageTag &rLocale)
std::unique_ptr< weld::Label > m_pMiscLabel
OUString CuiResId(TranslateId aKey)
std::unique_ptr< weld::LinkButton > m_pReleaseNotesButton
static OUString getProductName()
std::unique_ptr< weld::Image > m_pAboutImage
std::unique_ptr< weld::LinkButton > m_pWebsiteButton
static OUString GetBuildString()
OUString get(TranslateId sContextAndId, const std::locale &loc)
static OUString GetCopyrightString()
std::unique_ptr< weld::Button > m_pCopyButton
static OUString getUILocale()
static OUString GetVersionString()
static bool loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWidth)
#define SAL_WARN_IF(condition, area, stream)
Reference< XComponentContext > getProcessComponentContext()
std::unique_ptr< weld::Image > m_pBrandImage
std::unique_ptr< weld::Label > m_pBuildCaption
VirtualDevice * get() const
std::unique_ptr< weld::LinkButton > m_pCreditsButton
#define SAL_WARN(area, stream)
static OUString getBuildIdData(OUString const &_sDefault)
std::unique_ptr< weld::Label > m_pEnvLabel
virtual ~AboutDialog() override