diff --git a/bin/gla11y b/bin/gla11y index 1ae67b173959..b1d98c7c0fb8 100755 --- a/bin/gla11y +++ b/bin/gla11y @@ -47,7 +47,6 @@ widgets_toplevel = [ 'GtkOffscreenWindow', 'GtkApplicationWindow', 'GtkDialog', - 'GtkAboutDialog', 'GtkFileChooserDialog', 'GtkColorChooserDialog', 'GtkFontChooserDialog', diff --git a/compilerplugins/clang/constantparam.booleans.results b/compilerplugins/clang/constantparam.booleans.results index ec68cb590a62..9c78e715448a 100644 --- a/compilerplugins/clang/constantparam.booleans.results +++ b/compilerplugins/clang/constantparam.booleans.results @@ -1778,10 +1778,6 @@ include/vcl/weld.hxx:2102 class std::unique_ptr > weld::Builder::weld_dialog(const class rtl::OString &,_Bool) _Bool bTakeOwnership 1 -include/vcl/weld.hxx:2103 - class std::unique_ptr > weld::Builder::weld_about_dialog(const class rtl::OString &,_Bool) - _Bool bTakeOwnership - 1 include/vcl/weld.hxx:2106 class std::unique_ptr > weld::Builder::weld_assistant(const class rtl::OString &,_Bool) _Bool bTakeOwnership @@ -4210,10 +4206,6 @@ vcl/qa/cppunit/BitmapTest.cxx:68 void assertColorsAreSimilar(int,const class std::__cxx11::basic_string, class std::allocator > &,const class BitmapColor &,const class BitmapColor &) int maxDifference 1 -vcl/source/app/salvtables.cxx:1624 - void (anonymous namespace)::SalInstanceAboutDialog::SalInstanceAboutDialog(class vcl::AboutDialog *,class SalInstanceBuilder *,_Bool) - _Bool bTakeOwnership - 0 vcl/source/app/salvtables.cxx:1694 void (anonymous namespace)::SalInstanceAssistant::SalInstanceAssistant(class vcl::RoadmapWizard *,class SalInstanceBuilder *,_Bool) _Bool bTakeOwnership diff --git a/configure.ac b/configure.ac index b8b40177e98e..f1539c699b1f 100644 --- a/configure.ac +++ b/configure.ac @@ -2186,7 +2186,7 @@ AC_ARG_WITH(branding, AS_HELP_STRING([--with-branding=/path/to/images], [Use given path to retrieve branding images set.]) [ - Search for intro.png about.svg and flat_logo.svg. + Search for intro.png about.svg and logo.svg. If any is missing, default ones will be used instead. Search also progress.conf for progress @@ -12553,8 +12553,8 @@ dnl branding dnl =================================================================== AC_MSG_CHECKING([for alternative branding images directory]) # initialize mapped arrays -BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png" -brand_files="$BRAND_INTRO_IMAGES about.svg" +BRAND_INTRO_IMAGES="intro.png intro-highres.png" +brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg about.svg" if test -z "$with_branding" -o "$with_branding" = "no"; then AC_MSG_RESULT([none]) diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index 70b06199e700..9c81a8e104f9 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -390,9 +390,6 @@ #define RID_SVXSTR_ABOUT_DERIVED NC_("aboutdialog|derived", "%PRODUCTNAME is derived from LibreOffice which was based on OpenOffice.org") #define RID_SVXSTR_ABOUT_LOCALE NC_("aboutdialog|locale", "Locale: $LOCALE") #define RID_SVXSTR_ABOUT_UILOCALE NC_("aboutdialog|uilocale", "UI-Language: $LOCALE") -#define RID_SVXSTR_ABOUT_RELEASE_NOTES NC_("aboutdialog|releasenotes", "~Release Notes") -#define RID_SVXSTR_ABOUT_WEBSITE NC_("aboutdialog|website", "~Website") -#define RID_SVXSTR_ABOUT_CREDITS NC_("aboutdialog|credits", "Cre~dits") #define RID_SVXSTR_EDIT_PATHS NC_("optpathspage|editpaths", "Edit Paths: %1") diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 625adf9f9a7c..ec5d6b98930b 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -17,324 +17,228 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - #include -#include -#include -#include -#include +#include //OSL_ENSURE +#include //osl_getProcessLocale +#include //rtl::isAsciiHexDigit +#include //SAL_WARN +#include //GetSettings +#include +#include //Application:: +#include //VirtualDevice + +#include +#include +#include //utl::Bootstrap::getBuildVersion +#include //ConfigManager:: +#include //EXTRA_BUILDID +#include //CuiResId +#include //SfxApplication::loadBrandSvg +#include + +#include #if HAVE_FEATURE_OPENCL #include #endif -#include #include +#include using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star; -AboutDialog::AboutDialog(weld::Window* pParent) - : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/aboutdialog.ui")) - , m_xDialog(m_xBuilder->weld_about_dialog("AboutDialog")) - , m_xContentArea(m_xDialog->weld_content_area()) -{ - m_xDialog->add_button(GetStandardText(StandardButtonType::Close), RET_CLOSE); - m_xDialog->add_button(CuiResId(RID_SVXSTR_ABOUT_CREDITS), 101); - m_xDialog->add_button(CuiResId(RID_SVXSTR_ABOUT_WEBSITE), 102); - m_xDialog->add_button(CuiResId(RID_SVXSTR_ABOUT_RELEASE_NOTES), 103); +AboutDialog::AboutDialog(weld::Window *pParent) + : GenericDialogController(pParent, "cui/ui/aboutdialog.ui", "AboutDialog"), + m_pCreditsButton(m_xBuilder->weld_link_button("btnCredits")), + m_pWebsiteButton(m_xBuilder->weld_link_button("btnWebsite")), + m_pReleaseNotesButton(m_xBuilder->weld_link_button("btnReleaseNotes")), + m_pCloseButton(m_xBuilder->weld_button("btnClose")), + m_pBrandImage(m_xBuilder->weld_image("imBrand")), + m_pAboutImage(m_xBuilder->weld_image("imAbout")), + m_pVersionLabel(m_xBuilder->weld_label("lbVersion")), + m_pCopyrightLabel(m_xBuilder->weld_label("lbCopyright")) { + m_pVersionLabel->set_label(GetVersionString()); + m_pCopyrightLabel->set_label(GetCopyrightString()); - m_xCreditsButton.reset(m_xDialog->weld_widget_for_response(101)); - m_xCreditsButton->set_secondary(true); - m_xWebsiteButton.reset(m_xDialog->weld_widget_for_response(102)); - m_xWebsiteButton->set_secondary(true); - m_xReleaseNotesButton.reset(m_xDialog->weld_widget_for_response(103)); - m_xReleaseNotesButton->set_secondary(true); - m_xCloseButton.reset(m_xDialog->weld_widget_for_response(RET_CLOSE)); + //Images + const Size nWidth(m_pVersionLabel->get_preferred_size()); + BitmapEx aBackgroundBitmap; - m_buildIdLinkString = m_xDialog->get_website_label(); + if (SfxApplication::loadBrandSvg(Application::GetSettings() + .GetStyleSettings() + .GetDialogColor() + .IsDark() + ? "shell/logo_inverted" + : "shell/logo", + aBackgroundBitmap, + nWidth.getWidth() * 0.8)) { + ScopedVclPtr m_pVirDev = + m_pBrandImage->create_virtual_device(); + m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel()); + m_pVirDev->DrawBitmapEx(Point(0, 0), aBackgroundBitmap); + m_pBrandImage->set_image(m_pVirDev.get()); + m_pVirDev.disposeAndClear(); + } + if (SfxApplication::loadBrandSvg("shell/about", aBackgroundBitmap, + nWidth.getWidth())) { + ScopedVclPtr m_pVirDev = + m_pAboutImage->create_virtual_device(); + m_pVirDev->SetOutputSizePixel(aBackgroundBitmap.GetSizePixel()); + m_pVirDev->DrawBitmapEx(Point(0, 0), aBackgroundBitmap); + m_pAboutImage->set_image(m_pVirDev.get()); + m_pVirDev.disposeAndClear(); + } - m_xDialog->set_version(GetVersionString()); - m_xDialog->set_copyright(GetCopyrightString()); + //Links + m_pCreditsButton->set_uri(CuiResId(RID_SVXSTR_ABOUT_CREDITS_URL)); - SetBuildIdLink(); + OUString sURL(officecfg::Office::Common::Help::StartCenter::InfoURL::get()); + localizeWebserviceURI(sURL); + m_pWebsiteButton->set_uri(sURL); - SetLogo(); + sURL = officecfg::Office::Common::Menus::ReleaseNotesURL::get() + + "?LOvers=" + utl::ConfigManager::getProductVersion() + "&LOlocale=" + + LanguageTag(utl::ConfigManager::getUILocale()).getLanguage(); + m_pReleaseNotesButton->set_uri(sURL); - m_xDialog->connect_size_allocate(LINK(this, AboutDialog, SizeAllocHdl)); - - // Connect all handlers - m_xCreditsButton->connect_clicked( LINK( this, AboutDialog, HandleClick ) ); - m_xWebsiteButton->connect_clicked( LINK( this, AboutDialog, HandleClick ) ); - m_xReleaseNotesButton->connect_clicked( LINK( this, AboutDialog, HandleClick ) ); - m_xCloseButton->grab_focus(); + //Handler + m_pCloseButton->grab_focus(); } -AboutDialog::~AboutDialog() -{ -} +AboutDialog::~AboutDialog() {} -IMPL_LINK(AboutDialog, HandleClick, weld::Button&, rButton, void) -{ - OUString sURL = ""; - - // Find which button was pressed and from this, get the URL to be opened - if (&rButton == m_xCreditsButton.get()) - sURL = CuiResId(RID_SVXSTR_ABOUT_CREDITS_URL); - else if (&rButton == m_xWebsiteButton.get()) - { - sURL = officecfg::Office::Common::Help::StartCenter::InfoURL::get(); - localizeWebserviceURI(sURL); - } - else if (&rButton == m_xReleaseNotesButton.get()) - { - sURL = officecfg::Office::Common::Menus::ReleaseNotesURL::get() + - "?LOvers=" + utl::ConfigManager::getProductVersion() + - "&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getLanguage(); - } - - // If the URL is empty, don't do anything - if ( sURL.isEmpty() ) - return; - try - { - Reference< css::system::XSystemShellExecute > xSystemShellExecute( - css::system::SystemShellExecute::create(::comphelper::getProcessComponentContext() ) ); - xSystemShellExecute->execute( sURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY ); - } - catch (const Exception&) - { - Any exc( ::cppu::getCaughtException() ); - OUString msg( ::comphelper::anyToString( exc ) ); - const SolarMutexGuard guard; - std::unique_ptr xErrorBox(Application::CreateMessageDialog(getDialog(), - VclMessageType::Warning, VclButtonsType::Ok, msg)); - xErrorBox->set_title(m_xDialog->get_title()); - xErrorBox->run(); - } -} - -void AboutDialog::SetBuildIdLink() -{ - const OUString buildId = GetBuildId(); - - if (IsStringValidGitHash(buildId)) - { - if (m_buildIdLinkString.indexOf("$GITHASH") == -1) - { - SAL_WARN( "cui.dialogs", "translated git hash string in translations doesn't contain $GITHASH placeholder" ); - m_buildIdLinkString += " $GITHASH"; - } - - m_xDialog->set_website_label(m_buildIdLinkString.replaceAll("$GITHASH", buildId)); - m_xDialog->set_website("https://hub.libreoffice.org/git-core/" + buildId); - } - else - { - m_xDialog->set_website_label(OUString()); - m_xDialog->set_website(OUString()); - } -} - -void AboutDialog::SetLogo() -{ - auto nWidth = m_xContentArea->get_preferred_size().Width(); - - // fdo#67401 set AntiAliasing for SVG logo - SvtOptionsDrawinglayer aDrawOpt; - bool bOldAntiAliasSetting = aDrawOpt.IsAntiAliasing(); - aDrawOpt.SetAntiAliasing(true); - - // load svg logo, specify desired width, scale height isotropically - SfxApplication::loadBrandSvg("flat_logo", aLogoBitmap, nWidth); - - aDrawOpt.SetAntiAliasing(bOldAntiAliasSetting); - - if (!aLogoBitmap) - m_xDialog->set_logo(nullptr); - else - { - Graphic aGraphic(aLogoBitmap); - m_xDialog->set_logo(aGraphic.GetXGraphic()); - } -} - -IMPL_LINK(AboutDialog, SizeAllocHdl, const Size&, rSize, void) -{ - if (rSize.Width() == aBackgroundBitmap.GetSizePixel().Width()) - return; - // Load background image - if (!(Application::GetSettings().GetStyleSettings().GetHighContrastMode())) - { - SfxApplication::loadBrandSvg("shell/about", aBackgroundBitmap, rSize.Width()); - Graphic aGraphic(aBackgroundBitmap); - m_xDialog->set_background(aGraphic.GetXGraphic()); - } -} - -OUString AboutDialog::GetBuildId() -{ - OUString sDefault; - OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault)); - if (!sBuildId.isEmpty()) - return sBuildId; - - sBuildId = utl::Bootstrap::getBuildIdData(sDefault); - - if (!sBuildId.isEmpty()) - { - return sBuildId.getToken( 0, '-' ); - } - - OSL_ENSURE( !sBuildId.isEmpty(), "No BUILDID in bootstrap file" ); +OUString AboutDialog::GetBuildId() { + OUString sDefault; + OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault)); + if (!sBuildId.isEmpty()) return sBuildId; + + sBuildId = utl::Bootstrap::getBuildIdData(sDefault); + + if (!sBuildId.isEmpty()) { + return sBuildId.getToken(0, '-'); + } + + OSL_ENSURE(!sBuildId.isEmpty(), "No BUILDID in bootstrap file"); + return sBuildId; } -OUString AboutDialog::GetLocaleString() -{ - OUString aLocaleStr; - rtl_Locale * pLocale; +OUString AboutDialog::GetLocaleString() { + OUString aLocaleStr; + rtl_Locale *pLocale; - osl_getProcessLocale( &pLocale ); + osl_getProcessLocale(&pLocale); - if ( pLocale && pLocale->Language ) - { - if (pLocale->Country && rtl_uString_getLength( pLocale->Country) > 0) - aLocaleStr = OUString::unacquired(&pLocale->Language) + "_" + OUString::unacquired(&pLocale->Country); - else - aLocaleStr = OUString(pLocale->Language); - if (pLocale->Variant && rtl_uString_getLength( pLocale->Variant) > 0) - aLocaleStr += OUString(pLocale->Variant); + if (pLocale && pLocale->Language) { + if (pLocale->Country && rtl_uString_getLength(pLocale->Country) > 0) + aLocaleStr = OUString::unacquired(&pLocale->Language) + "_" + + OUString::unacquired(&pLocale->Country); + else + aLocaleStr = OUString(pLocale->Language); + if (pLocale->Variant && rtl_uString_getLength(pLocale->Variant) > 0) + aLocaleStr += OUString(pLocale->Variant); + } + + return aLocaleStr; +} + +bool AboutDialog::IsStringValidGitHash(const OUString &hash) { + for (int i = 0; i < hash.getLength(); i++) { + if (!rtl::isAsciiHexDigit(hash[i])) { + return false; } + } - return aLocaleStr; + return true; } -bool AboutDialog::IsStringValidGitHash(const OUString& hash) -{ - for (int i = 0; i < hash.getLength(); i++) - { - if (!rtl::isAsciiHexDigit(hash[i])) - { - return false; - } - } - - return true; -} - -OUString AboutDialog::GetVersionString() -{ - OUString sVersion = CuiResId(RID_SVXSTR_ABOUT_VERSION); +OUString AboutDialog::GetVersionString() { + OUString sVersion = CuiResId(RID_SVXSTR_ABOUT_VERSION); #ifdef _WIN64 - sVersion += " (x64)"; + sVersion += " (x64)"; #elif defined(_WIN32) - sVersion += " (x86)"; + sVersion += " (x86)"; #endif - OUString sBuildId = GetBuildId(); + OUString sBuildId = GetBuildId(); - OUString aLocaleStr = Application::GetSettings().GetLanguageTag().getBcp47() + " (" + GetLocaleString() + ")"; - OUString aUILocaleStr = Application::GetSettings().GetUILanguageTag().getBcp47(); + OUString aLocaleStr = Application::GetSettings().GetLanguageTag().getBcp47() + + " (" + GetLocaleString() + ")"; + OUString aUILocaleStr = + Application::GetSettings().GetUILanguageTag().getBcp47(); - if (!sBuildId.trim().isEmpty()) - { - sVersion += "\n"; - OUString sBuildStr = CuiResId(RID_SVXSTR_ABOUT_BUILDID); - if (sBuildStr.indexOf("$BUILDID") == -1) - { - SAL_WARN( "cui.dialogs", "translated Build Id string in translations doesn't contain $BUILDID placeholder" ); - sBuildStr += " $BUILDID"; - } - sVersion += sBuildStr.replaceAll("$BUILDID", sBuildId); + if (!sBuildId.trim().isEmpty()) { + sVersion += "\n"; + OUString sBuildStr = CuiResId(RID_SVXSTR_ABOUT_BUILDID); + if (sBuildStr.indexOf("$BUILDID") == -1) { + SAL_WARN("cui.dialogs", "translated Build Id string in translations " + "doesn't contain $BUILDID placeholder"); + sBuildStr += " $BUILDID"; } + sVersion += sBuildStr.replaceAll("$BUILDID", sBuildId); + } - sVersion += "\n" + Application::GetHWOSConfInfo(); + sVersion += "\n" + Application::GetHWOSConfInfo(); - bool const extra = EXTRA_BUILDID[0] != '\0'; - // extracted from the 'if' to avoid Clang -Wunreachable-code - if (extra) - { - sVersion += "\n" EXTRA_BUILDID; - } + bool const extra = EXTRA_BUILDID[0] != '\0'; + // extracted from the 'if' to avoid Clang -Wunreachable-code + if (extra) { + sVersion += "\n" EXTRA_BUILDID; + } - OUString sLocaleStr(CuiResId(RID_SVXSTR_ABOUT_LOCALE)); - if (sLocaleStr.indexOf("$LOCALE") == -1) - { - SAL_WARN( "cui.dialogs", "translated locale string in translations doesn't contain $LOCALE placeholder" ); - sLocaleStr += " $LOCALE"; - } - sVersion += "\n" + sLocaleStr.replaceAll("$LOCALE", aLocaleStr); + OUString sLocaleStr(CuiResId(RID_SVXSTR_ABOUT_LOCALE)); + if (sLocaleStr.indexOf("$LOCALE") == -1) { + SAL_WARN("cui.dialogs", "translated locale string in translations doesn't " + "contain $LOCALE placeholder"); + sLocaleStr += " $LOCALE"; + } + sVersion += "\n" + sLocaleStr.replaceAll("$LOCALE", aLocaleStr); - OUString sUILocaleStr(CuiResId(RID_SVXSTR_ABOUT_UILOCALE)); - if (sUILocaleStr.indexOf("$LOCALE") == -1) - { - SAL_WARN( "cui.dialogs", "translated uilocale string in translations doesn't contain $LOCALE placeholder" ); - sUILocaleStr += " $LOCALE"; - } - sVersion += "; " + sUILocaleStr.replaceAll("$LOCALE", aUILocaleStr); + OUString sUILocaleStr(CuiResId(RID_SVXSTR_ABOUT_UILOCALE)); + if (sUILocaleStr.indexOf("$LOCALE") == -1) { + SAL_WARN("cui.dialogs", "translated uilocale string in translations " + "doesn't contain $LOCALE placeholder"); + sUILocaleStr += " $LOCALE"; + } + sVersion += "; " + sUILocaleStr.replaceAll("$LOCALE", aUILocaleStr); - OUString aCalcMode = "Calc: "; // Calc calculation mode + OUString aCalcMode = "Calc: "; // Calc calculation mode #if HAVE_FEATURE_OPENCL - bool bOpenCL = openclwrapper::GPUEnv::isOpenCLEnabled(); - if (bOpenCL) - aCalcMode += "CL"; + bool bOpenCL = openclwrapper::GPUEnv::isOpenCLEnabled(); + if (bOpenCL) + aCalcMode += "CL"; #else - const bool bOpenCL = false; + const bool bOpenCL = false; #endif - static const bool bThreadingProhibited = std::getenv("SC_NO_THREADED_CALCULATION"); - bool bThreadedCalc = officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get(); + static const bool bThreadingProhibited = + std::getenv("SC_NO_THREADED_CALCULATION"); + bool bThreadedCalc = officecfg::Office::Calc::Formula::Calculation:: + UseThreadedCalculationForFormulaGroups::get(); - if (!bThreadingProhibited && !bOpenCL && bThreadedCalc) - { - if (!aCalcMode.endsWith(" ")) - aCalcMode += " "; - aCalcMode += "threaded"; - } + if (!bThreadingProhibited && !bOpenCL && bThreadedCalc) { + if (!aCalcMode.endsWith(" ")) + aCalcMode += " "; + aCalcMode += "threaded"; + } - sVersion += "\n" + aCalcMode; + sVersion += "\n" + aCalcMode; - return sVersion; + return sVersion; } -OUString AboutDialog::GetCopyrightString() -{ - OUString sVendorTextStr(CuiResId(RID_SVXSTR_ABOUT_VENDOR)); - OUString aCopyrightString = sVendorTextStr + "\n" - + CuiResId(RID_SVXSTR_ABOUT_COPYRIGHT) + "\n"; +OUString AboutDialog::GetCopyrightString() { + OUString sVendorTextStr(CuiResId(RID_SVXSTR_ABOUT_VENDOR)); + OUString aCopyrightString = + sVendorTextStr + "\n" + CuiResId(RID_SVXSTR_ABOUT_COPYRIGHT) + "\n"; - if (utl::ConfigManager::getProductName() == "LibreOffice") - aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_BASED_ON); - else - aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_DERIVED); + if (utl::ConfigManager::getProductName() == "LibreOffice") + aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_BASED_ON); + else + aCopyrightString += CuiResId(RID_SVXSTR_ABOUT_DERIVED); - return aCopyrightString; + return aCopyrightString; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index d7868049d4c7..e7282b3c197a 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -20,6 +20,7 @@ #include #include "dlgfact.hxx" +#include #include #include #include @@ -85,7 +86,6 @@ #include #include #include -#include #include #include @@ -1022,11 +1022,6 @@ VclPtr AbstractDialogFactory_Impl::CreateVclDialog(weld::Wind return nullptr; } -VclPtr AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent) -{ - return VclPtr::Create(std::make_unique(pParent)); -} - VclPtr AbstractDialogFactory_Impl::CreateFrameDialog(weld::Window* pParent, const Reference< frame::XFrame >& rxFrame, sal_uInt32 nResId, const OUString& rParameter ) { @@ -1421,6 +1416,11 @@ short SvxMacroAssignDialog::Execute() return m_xDialog->run(); } +short AbstractAboutDialog_Impl::Execute() +{ + return m_xDlg->run(); +} + short AbstractTipOfTheDayDialog_Impl::Execute() { return m_xDlg->run(); @@ -1676,6 +1676,13 @@ VclPtr AbstractDialogFactory_Impl::CreateQrCodeGenDialo std::make_unique(pParent, xModel, bEditExisting)); } +VclPtr +AbstractDialogFactory_Impl::CreateAboutDialog(weld::Window* pParent) +{ + return VclPtr::Create( + std::make_unique(pParent)); +} + VclPtr AbstractDialogFactory_Impl::CreateTipOfTheDayDialog(weld::Window* pParent) { diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index cd4b4d36a9dd..5ddcce87f0db 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -738,6 +739,20 @@ public: virtual short Execute() override; }; +class AboutDialog; +class AbstractAboutDialog_Impl : public AbstractAboutDialog +{ +protected: + std::unique_ptr m_xDlg; + +public: + explicit AbstractAboutDialog_Impl(std::unique_ptr p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; +}; + class TipOfTheDayDialog; class AbstractTipOfTheDayDialog_Impl : public AbstractTipOfTheDayDialog { @@ -774,8 +789,6 @@ class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory public: virtual VclPtr CreateVclDialog(weld::Window* pParent, sal_uInt32 nResId) override; - virtual VclPtr CreateAboutDialog(weld::Window* pParent) override; - virtual VclPtr CreateSfxDialog( weld::Window* pParent, const SfxItemSet& rAttr, const SdrView* pView, @@ -954,6 +967,8 @@ public: CreateQrCodeGenDialog(weld::Window* pParent, const css::uno::Reference xModel, bool bEditExisting) override; + virtual VclPtr CreateAboutDialog(weld::Window* pParent) override; + virtual VclPtr CreateTipOfTheDayDialog(weld::Window* pParent) override; virtual VclPtr CreateDiagramDialog( diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx index aeda433cb2bd..ab03768a27df 100644 --- a/cui/source/inc/about.hxx +++ b/cui/source/inc/about.hxx @@ -22,24 +22,18 @@ #include #include -class AboutDialog : public weld::DialogController +class AboutDialog : public weld::GenericDialogController { private: - std::unique_ptr m_xBuilder; - std::shared_ptr m_xDialog; - std::unique_ptr m_xContentArea; - std::unique_ptr m_xCreditsButton; - std::unique_ptr m_xWebsiteButton; - std::unique_ptr m_xReleaseNotesButton; - std::unique_ptr m_xCloseButton; + std::unique_ptr m_pCreditsButton; + std::unique_ptr m_pWebsiteButton; + std::unique_ptr m_pReleaseNotesButton; + std::unique_ptr m_pCloseButton; - BitmapEx aLogoBitmap; - BitmapEx aBackgroundBitmap; - - OUString m_buildIdLinkString; - - void SetBuildIdLink(); - void SetLogo(); + std::unique_ptr m_pBrandImage; + std::unique_ptr m_pAboutImage; + std::unique_ptr m_pVersionLabel; + std::unique_ptr m_pCopyrightLabel; static OUString GetBuildId(); static OUString GetVersionString(); @@ -49,11 +43,7 @@ private: public: AboutDialog(weld::Window* pParent); - virtual weld::Dialog* getDialog() override { return m_xDialog.get(); } virtual ~AboutDialog() override; - - DECL_LINK(HandleClick, weld::Button&, void); - DECL_LINK(SizeAllocHdl, const Size&, void); }; #endif // INCLUDED_CUI_SOURCE_INC_ABOUT_HXX diff --git a/cui/uiconfig/ui/aboutdialog.ui b/cui/uiconfig/ui/aboutdialog.ui index 21d9725b11bb..da99da4e5f51 100644 --- a/cui/uiconfig/ui/aboutdialog.ui +++ b/cui/uiconfig/ui/aboutdialog.ui @@ -1,36 +1,44 @@ - + - - + + False 6 About %PRODUCTNAME False True - 0 - 0 + center-on-parent dialog - %PRODUCTNAME - %PRODUCTNAME is a modern, easy-to-use, open source productivity suite for word processing, spreadsheets, presentations and more. - https://www.libreoffice.org/ - See Log: $GITHASH - image-missing - + - + False vertical - 6 + 12 - - True + False + 12 + True end - + + gtk-close + True + True + True + True + True + + + True + True + end + 3 + @@ -40,7 +48,172 @@ 0 + + + True + False + True + True + + + True + False + 12 + True + + + 0 + 0 + 5 + + + + + True + False + 24 + 24 + 24 + 0 + + + 1 + 0 + + + + + True + False + start + 6 + True + True + This release was supplied by The Document Foundation. +Copyright (c) 1980-2020 LibreOffice contributors. +LibreOffice was based on OpenOffice.org + True + 50 + 0 + + + 1 + 3 + + + + + True + False + end + 12 + 12 + True + True + %PRODUCTNAME is a modern, easy-to-use, open source productivity suite for word processing, spreadsheets, presentations and more. + True + 50 + 0 + + + + + + 1 + 2 + + + + + True + False + end + True + True + Version: 7.0 +Build ID: 7.0 +CPU threads +Locale: +Calc: + True + True + end + 50 + 0 + + + 1 + 1 + + + + + True + False + True + + + Credits + True + True + True + none + 0 + + + False + True + 0 + + + + + Website + True + True + True + none + 0 + https://www.libreoffice.org/ + + + False + True + 1 + + + + + Release Notes + True + True + True + none + 0 + + + False + True + 2 + + + + + 1 + 4 + + + + + False + True + 1 + + + + btnClose + diff --git a/icon-themes/colibre/brand/flat_logo.svg b/icon-themes/colibre/brand/flat_logo.svg index e24705a37057..dc9279be615f 100644 --- a/icon-themes/colibre/brand/flat_logo.svg +++ b/icon-themes/colibre/brand/flat_logo.svg @@ -1 +1,1187 @@ - \ No newline at end of file + +image/svg+xml \ No newline at end of file diff --git a/icon-themes/colibre/brand/shell/about.svg b/icon-themes/colibre/brand/shell/about.svg index d3e1035576e2..d9f951caf20f 100644 --- a/icon-themes/colibre/brand/shell/about.svg +++ b/icon-themes/colibre/brand/shell/about.svg @@ -1 +1,6416 @@ - \ No newline at end of file + + + + + LibreOffice 7 about dialog design + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + LibreOffice 7 about dialog design + + + Bayu Rizaldhan Rayes + + + + + Bayu Rizaldhan Rayes + + + Artwork for LibreOffice 7 about dialog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icon-themes/colibre/brand/shell/logo.svg b/icon-themes/colibre/brand/shell/logo.svg new file mode 100644 index 000000000000..3b919b6a6c01 --- /dev/null +++ b/icon-themes/colibre/brand/shell/logo.svg @@ -0,0 +1,271 @@ + +image/svg+xml \ No newline at end of file diff --git a/icon-themes/colibre/brand/shell/logo_inverted.svg b/icon-themes/colibre/brand/shell/logo_inverted.svg new file mode 100644 index 000000000000..81b8555ae49c --- /dev/null +++ b/icon-themes/colibre/brand/shell/logo_inverted.svg @@ -0,0 +1,271 @@ + +image/svg+xml \ No newline at end of file diff --git a/icon-themes/colibre/sfx2/res/logo.png b/icon-themes/colibre/sfx2/res/logo.png deleted file mode 100644 index 3ae20b710bba..000000000000 Binary files a/icon-themes/colibre/sfx2/res/logo.png and /dev/null differ diff --git a/icon-themes/karasa_jaga/sfx2/res/logo.png b/icon-themes/karasa_jaga/sfx2/res/logo.png deleted file mode 100644 index 9ba6acaaaa0d..000000000000 Binary files a/icon-themes/karasa_jaga/sfx2/res/logo.png and /dev/null differ diff --git a/icon-themes/sukapura/sfx2/res/logo.png b/icon-themes/sukapura/sfx2/res/logo.png deleted file mode 100644 index 0fe85e328489..000000000000 Binary files a/icon-themes/sukapura/sfx2/res/logo.png and /dev/null differ diff --git a/icon-themes/tango/sfx2/res/logo.png b/icon-themes/tango/sfx2/res/logo.png deleted file mode 100644 index 9ba6acaaaa0d..000000000000 Binary files a/icon-themes/tango/sfx2/res/logo.png and /dev/null differ diff --git a/include/sfx2/sfxdlg.hxx b/include/sfx2/sfxdlg.hxx index 4515dc9266ca..6d03dc0f80b0 100644 --- a/include/sfx2/sfxdlg.hxx +++ b/include/sfx2/sfxdlg.hxx @@ -135,7 +135,6 @@ public: virtual VclPtr CreatePasteDialog(weld::Window* pParent) = 0; virtual VclPtr CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML=false, sfx2::SvBaseLink* p=nullptr) = 0; virtual VclPtr CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) = 0; - virtual VclPtr CreateAboutDialog(weld::Window* pParent) = 0; virtual VclPtr CreateScriptSelectorDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame) = 0; diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index 645f1da4b301..459abf4d39a7 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -125,6 +125,12 @@ protected: virtual ~AbstractQrCodeGenDialog() override = default; }; +class VCL_DLLPUBLIC AbstractAboutDialog : public VclAbstractDialog +{ +protected: + virtual ~AbstractAboutDialog() override = default; +}; + class VCL_DLLPUBLIC AbstractTipOfTheDayDialog : public VclAbstractDialog { protected: @@ -173,6 +179,10 @@ public: virtual VclPtr CreateScreenshotAnnotationDlg( weld::Dialog& rParentDialog) = 0; + // create about dialog + virtual VclPtr + CreateAboutDialog(weld::Window* pParent) = 0; + // create info dialog to show tip-of-the-day virtual VclPtr CreateTipOfTheDayDialog(weld::Window* pParent) = 0; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 18eeb67f38a1..951b591f654b 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -2132,9 +2132,6 @@ public: bool bTakeOwnership = true) = 0; virtual std::unique_ptr weld_dialog(const OString& id, bool bTakeOwnership = true) = 0; - virtual std::unique_ptr weld_about_dialog(const OString& id, - bool bTakeOwnership = true) - = 0; virtual std::unique_ptr weld_assistant(const OString& id, bool bTakeOwnership = true) = 0; virtual std::unique_ptr weld_window(const OString& id, bool bTakeOwnership = true) = 0; diff --git a/sc/qa/uitest/calc_tests7/tdf106667.py b/sc/qa/uitest/calc_tests7/tdf106667.py index 5f07e904269b..5475c76808bb 100644 --- a/sc/qa/uitest/calc_tests7/tdf106667.py +++ b/sc/qa/uitest/calc_tests7/tdf106667.py @@ -28,7 +28,7 @@ class tdf106667(UITestCase): self.ui_test.execute_dialog_through_command(".uno:About") xAboutDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xAboutDlg.getChild("close") + xCloseBtn = xAboutDlg.getChild("btnClose") self.ui_test.close_dialog_through_button(xCloseBtn) self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") diff --git a/sfx2/inc/bitmaps.hlst b/sfx2/inc/bitmaps.hlst index 9dbdfb4da5d4..28e16d920513 100644 --- a/sfx2/inc/bitmaps.hlst +++ b/sfx2/inc/bitmaps.hlst @@ -75,7 +75,6 @@ #define SFX_FILE_THUMBNAIL_MATH "res/math128.png" #define SFX_FILE_THUMBNAIL_DEFAULT "res/main128.png" -#define BMP_WELCOME "sfx2/res/logo.png" #define BMP_RECENTDOC_REMOVE "res/recentdoc_remove.png" #define BMP_RECENTDOC_REMOVE_HIGHLIGHTED "res/recentdoc_remove_highlighted.png" #define BMP_DEFAULT "res/templatestar.png" diff --git a/sfx2/inc/recentdocsview.hxx b/sfx2/inc/recentdocsview.hxx index ff21644a9940..95b9386cd0ec 100644 --- a/sfx2/inc/recentdocsview.hxx +++ b/sfx2/inc/recentdocsview.hxx @@ -89,7 +89,7 @@ private: size_t mnLastMouseDownItem; /// Image that appears when there is no recent document. - Image maWelcomeImage; + BitmapEx maWelcomeImage; OUString maWelcomeLine1; OUString maWelcomeLine2; }; diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index f6fcc99bdb18..ada8f86eed04 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -101,6 +102,29 @@ bool SfxApplication::IsDowning() const { return pImpl->bDowning; } SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return pImpl->pAppDispat; } SfxSlotPool& SfxApplication::GetAppSlotPool_Impl() const { return *pImpl->pSlotPool; } +static bool FileExists( const INetURLObject& rURL ) +{ + bool bRet = false; + + if( rURL.GetProtocol() != INetProtocol::NotValid ) + { + try + { + ::ucbhelper::Content aCnt( rURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); + OUString aTitle; + + aCnt.getPropertyValue("Title") >>= aTitle; + bRet = ( !aTitle.isEmpty() ); + } + catch(const Exception&) + { + return false; + } + } + + return bRet; +} + bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWidth) { // Load from disk @@ -109,7 +133,11 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid OUString uri = "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER + aBaseName + ".svg"; rtl::Bootstrap::expandMacros( uri ); + INetURLObject aObj( uri ); + if ( !FileExists(aObj) ) + return false; + VectorGraphicData aVectorGraphicData(aObj.PathToFileName(), VectorGraphicDataType::Svg); // transform into [0,0,width,width*aspect] std dimensions @@ -175,8 +203,7 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid BitmapEx SfxApplication::GetApplicationLogo(long nWidth) { BitmapEx aBitmap; - SfxApplication::loadBrandSvg("flat_logo", aBitmap, nWidth); - (void)Application::LoadBrandBitmap ("about", aBitmap); + SfxApplication::loadBrandSvg("shell/about", aBitmap, nWidth); return aBitmap; } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 912363d7da75..6dd813fdf7be 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -653,7 +653,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_ABOUT: { - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); ScopedVclPtr pDlg(pFact->CreateAboutDialog(rReq.GetFrameWeld())); pDlg->Execute(); bDone = true; diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index e9120d355a01..b4b5fea1c2ec 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -39,6 +39,7 @@ #include #include #include "recentdocsviewitem.hxx" +#include #include @@ -124,7 +125,7 @@ RecentDocsView::RecentDocsView( vcl::Window* pParent ) : ThumbnailView(pParent) , mnFileTypes(ApplicationType::TYPE_NONE) , mnLastMouseDownItem(THUMBNAILVIEW_ITEM_NOTFOUND) - , maWelcomeImage(StockImage::Yes, BMP_WELCOME) + , maWelcomeImage() , maWelcomeLine1(SfxResId(STR_WELCOME_LINE1)) , maWelcomeLine2(SfxResId(STR_WELCOME_LINE2)) { @@ -135,6 +136,8 @@ RecentDocsView::RecentDocsView( vcl::Window* pParent ) setItemMaxTextLength( 30 ); setItemDimensions( mnItemMaxSize, mnItemMaxSize, gnTextHeight, gnItemPadding ); + maWelcomeImage = SfxApplication::GetApplicationLogo(500); + maFillColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsBackgroundColor::get()); maTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsTextColor::get()); maHighlightColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightColor::get()); @@ -365,13 +368,13 @@ void RecentDocsView::Paint(vcl::RenderContext& rRenderContext, const tools::Rect const int nX = (rSize.Width() - rImgSize.Width())/2; int nY = (rSize.Height() - 3 * nTextHeight - rImgSize.Height())/2; Point aImgPoint(nX, nY); - rRenderContext.DrawImage(aImgPoint, rImgSize, maWelcomeImage); + rRenderContext.DrawBitmapEx(aImgPoint, rImgSize, maWelcomeImage); nY = nY + rImgSize.Height(); - rRenderContext.DrawText(tools::Rectangle(0, nY, rSize.Width(), nY + nTextHeight), + rRenderContext.DrawText(tools::Rectangle(0, nY + 1 * nTextHeight, rSize.Width(), nY + nTextHeight), maWelcomeLine1, DrawTextFlags::Center); - rRenderContext.DrawText(tools::Rectangle(0, nY + 1.5 * nTextHeight, rSize.Width(), rSize.Height()), + rRenderContext.DrawText(tools::Rectangle(0, nY + 2 * nTextHeight, rSize.Width(), rSize.Height()), maWelcomeLine2, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Center); diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index 7d71d2e109ad..763ab34f58ad 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -1,3 +1,8 @@ +cui/uiconfig/ui/aboutdialog.ui://GtkImage[@id='imAbout'] no-labelled-by +cui/uiconfig/ui/aboutdialog.ui://GtkImage[@id='imBrand'] no-labelled-by +cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='lbCopyright'] orphan-label +cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='lbAbout'] orphan-label +cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='lbVersion'] orphan-label cui/uiconfig/ui/aboutconfigdialog.ui://GtkEntry[@id='searchEntry'] no-labelled-by cui/uiconfig/ui/acorexceptpage.ui://GtkEntry[@id='abbrev'] no-labelled-by cui/uiconfig/ui/acorexceptpage.ui://GtkEntry[@id='double'] no-labelled-by diff --git a/sw/qa/uitest/writer_tests5/about_test.py b/sw/qa/uitest/writer_tests5/about_test.py index 159107275b58..7005dbb65221 100644 --- a/sw/qa/uitest/writer_tests5/about_test.py +++ b/sw/qa/uitest/writer_tests5/about_test.py @@ -17,7 +17,7 @@ class AboutDlgTest(UITestCase): xAboutDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xAboutDlg.getChild("close") + xCloseBtn = xAboutDlg.getChild("btnClose") self.ui_test.close_dialog_through_button(xCloseBtn) self.ui_test.close_doc() diff --git a/uitest/calc_tests/about_test.py b/uitest/calc_tests/about_test.py index a5082ee6c8e2..c6dc75b939dc 100644 --- a/uitest/calc_tests/about_test.py +++ b/uitest/calc_tests/about_test.py @@ -17,7 +17,7 @@ class AboutDlgTest(UITestCase): xAboutDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xAboutDlg.getChild("close") + xCloseBtn = xAboutDlg.getChild("btnClose") self.ui_test.close_dialog_through_button(xCloseBtn) self.ui_test.close_doc() diff --git a/uitest/demo_ui/hierarchy.py b/uitest/demo_ui/hierarchy.py index 5f7b3c25bed6..f5434366fda4 100644 --- a/uitest/demo_ui/hierarchy.py +++ b/uitest/demo_ui/hierarchy.py @@ -27,7 +27,7 @@ class CheckBoxTest(UITestCase): print(json_content) print(json.dumps(json_content, indent=4)) - closeBtn = xAboutDlg.getChild("close") + closeBtn = xAboutDlg.getChild("btnClose") self.ui_test.close_dialog_through_button(closeBtn) self.ui_test.close_doc() diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index dd3575b79c38..1553538ea932 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -22,9 +22,6 @@ public: virtual std::unique_ptr weld_message_dialog(const OString& id, bool bTakeOwnership = true) override; - virtual std::unique_ptr - weld_about_dialog(const OString& id, bool bTakeOwnership = true) override; - virtual std::unique_ptr weld_dialog(const OString& id, bool bTakeOwnership = true) override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 13f596d5bc36..ed219871af24 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1615,48 +1615,6 @@ public: } }; -class SalInstanceAboutDialog : public SalInstanceDialog, public virtual weld::AboutDialog -{ -private: - VclPtr m_xAboutDialog; - -public: - SalInstanceAboutDialog(vcl::AboutDialog* pDialog, SalInstanceBuilder* pBuilder, - bool bTakeOwnership) - : SalInstanceDialog(pDialog, pBuilder, bTakeOwnership) - , m_xAboutDialog(pDialog) - { - } - virtual void set_version(const OUString& rVersion) override - { - m_xAboutDialog->SetVersion(rVersion); - } - virtual void set_copyright(const OUString& rCopyright) override - { - m_xAboutDialog->SetCopyright(rCopyright); - } - virtual void set_website(const OUString& rURL) override - { - m_xAboutDialog->SetWebsiteLink(rURL); - } - virtual void set_website_label(const OUString& rLabel) override - { - m_xAboutDialog->SetWebsiteLabel(rLabel); - } - virtual OUString get_website_label() const override - { - return m_xAboutDialog->GetWebsiteLabel(); - } - virtual void set_logo(const css::uno::Reference& rImage) override - { - m_xAboutDialog->SetLogo(Image(rImage)); - } - virtual void set_background(const css::uno::Reference& rImage) override - { - m_xAboutDialog->SetBackground(Image(rImage)); - } -}; - class SalInstanceAssistant : public SalInstanceDialog, public virtual weld::Assistant { private: @@ -6270,21 +6228,6 @@ std::unique_ptr SalInstanceBuilder::weld_message_dialog(con return pRet; } -std::unique_ptr SalInstanceBuilder::weld_about_dialog(const OString& id, - bool bTakeOwnership) -{ - vcl::AboutDialog* pAboutDialog = m_xBuilder->get(id); - std::unique_ptr pRet( - pAboutDialog ? new SalInstanceAboutDialog(pAboutDialog, this, false) : nullptr); - if (bTakeOwnership && pAboutDialog) - { - assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed"); - m_aOwnedToplevel.set(pAboutDialog); - m_xBuilder->drop_ownership(pAboutDialog); - } - return pRet; -} - std::unique_ptr SalInstanceBuilder::weld_dialog(const OString& id, bool bTakeOwnership) { diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 361953129edd..020182cbe055 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1842,7 +1842,7 @@ VclPtr VclBuilder::makeObject(vcl::Window *pParent, const OString & extractButtonImage(id, rMap, name == "GtkRadioButton"); VclPtr xWindow; - if (name == "GtkDialog" || name == "GtkAboutDialog" || name == "GtkAssistant") + if (name == "GtkDialog" || name == "GtkAssistant") { // WB_ALLOWMENUBAR because we don't know in advance if we will encounter // a menubar, and menubars need a BorderWindow in the toplevel, and @@ -1855,8 +1855,6 @@ VclPtr VclBuilder::makeObject(vcl::Window *pParent, const OString & Dialog::InitFlag eInit = !pParent ? Dialog::InitFlag::NoParent : Dialog::InitFlag::Default; if (name == "GtkAssistant") xWindow = VclPtr::Create(pParent, nBits, eInit); - else if (name == "GtkAboutDialog") - xWindow = VclPtr::Create(pParent, nBits, eInit); else xWindow = VclPtr::Create(pParent, nBits, eInit); #if HAVE_FEATURE_DESKTOP diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 584741d17e11..070958751aed 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -4730,103 +4730,6 @@ public: } }; -class GtkInstanceAboutDialog final : public GtkInstanceDialog, public virtual weld::AboutDialog -{ -private: - GtkAboutDialog* m_pAboutDialog; - GtkCssProvider* m_pCssProvider; - std::unique_ptr mxBackgroundImage; -public: - GtkInstanceAboutDialog(GtkAboutDialog* pAboutDialog, GtkInstanceBuilder* pBuilder, bool bTakeOwnership) - : GtkInstanceDialog(GTK_WINDOW(pAboutDialog), pBuilder, bTakeOwnership) - , m_pAboutDialog(pAboutDialog) - , m_pCssProvider(nullptr) - { - // in GtkAboutDialog apply_use_header_bar if headerbar is false it - // automatically adds a default close button which it doesn't if - // headerbar is true and which doesn't appear in the .ui - if (GtkWidget* pDefaultButton = gtk_dialog_get_widget_for_response(GTK_DIALOG(pAboutDialog), GTK_RESPONSE_DELETE_EVENT)) - gtk_widget_destroy(pDefaultButton); - } - - virtual void set_version(const OUString& rVersion) override - { - gtk_about_dialog_set_version(m_pAboutDialog, OUStringToOString(rVersion, RTL_TEXTENCODING_UTF8).getStr()); - } - - virtual void set_copyright(const OUString& rCopyright) override - { - gtk_about_dialog_set_copyright(m_pAboutDialog, OUStringToOString(rCopyright, RTL_TEXTENCODING_UTF8).getStr()); - } - - virtual void set_website(const OUString& rURL) override - { - OString sURL(OUStringToOString(rURL, RTL_TEXTENCODING_UTF8)); - gtk_about_dialog_set_website(m_pAboutDialog, sURL.isEmpty() ? nullptr : sURL.getStr()); - } - - virtual void set_website_label(const OUString& rLabel) override - { - OString sLabel(OUStringToOString(rLabel, RTL_TEXTENCODING_UTF8)); - gtk_about_dialog_set_website_label(m_pAboutDialog, sLabel.isEmpty() ? nullptr : sLabel.getStr()); - } - - virtual OUString get_website_label() const override - { - const gchar* pText = gtk_about_dialog_get_website_label(m_pAboutDialog); - return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); - } - - virtual void set_logo(const css::uno::Reference& rImage) override - { - GdkPixbuf* pixbuf = rImage.is() ? getPixbuf(rImage) : nullptr; - if (!pixbuf) - gtk_about_dialog_set_logo(m_pAboutDialog, nullptr); - else - { - gtk_about_dialog_set_logo(m_pAboutDialog, pixbuf); - g_object_unref(pixbuf); - } - } - - virtual void set_background(const css::uno::Reference& rImage) override - { - GtkStyleContext *pStyleContext = gtk_widget_get_style_context(GTK_WIDGET(m_pAboutDialog)); - if (m_pCssProvider) - { - gtk_style_context_remove_provider(pStyleContext, GTK_STYLE_PROVIDER(m_pCssProvider)); - m_pCssProvider= nullptr; - } - - mxBackgroundImage.reset(); - - if (rImage.is()) - { - mxBackgroundImage.reset(new utl::TempFile()); - mxBackgroundImage->EnableKillingFile(true); - - Image aImage(rImage); - - vcl::PNGWriter aPNGWriter(aImage.GetBitmapEx()); - SvStream* pStream = mxBackgroundImage->GetStream(StreamMode::WRITE); - aPNGWriter.Write(*pStream); - mxBackgroundImage->CloseStream(); - - m_pCssProvider = gtk_css_provider_new(); - OUString aBuffer = "* { background-image: url(\"" + mxBackgroundImage->GetURL() + "\"); }"; - OString aResult = OUStringToOString(aBuffer, RTL_TEXTENCODING_UTF8); - gtk_css_provider_load_from_data(m_pCssProvider, aResult.getStr(), aResult.getLength(), nullptr); - gtk_style_context_add_provider(pStyleContext, GTK_STYLE_PROVIDER(m_pCssProvider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } - } - - virtual ~GtkInstanceAboutDialog() override - { - set_background(nullptr); - } -}; - class GtkInstanceAssistant : public GtkInstanceDialog, public virtual weld::Assistant { private: @@ -14117,24 +14020,6 @@ private: set_primary_text(pMessageDialog, (*m_pStringReplace)(get_primary_text(pMessageDialog))); set_secondary_text(pMessageDialog, (*m_pStringReplace)(get_secondary_text(pMessageDialog))); } - else if (GTK_IS_ABOUT_DIALOG(pWindow)) - { - GtkAboutDialog* pAboutDialog = GTK_ABOUT_DIALOG(pWindow); - const gchar *pComments = gtk_about_dialog_get_comments(pAboutDialog); - if (pComments) - { - OUString sComments(pComments, strlen(pComments), RTL_TEXTENCODING_UTF8); - sComments = (*m_pStringReplace)(sComments); - gtk_about_dialog_set_comments(pAboutDialog, OUStringToOString(sComments, RTL_TEXTENCODING_UTF8).getStr()); - } - const gchar *pProgramName = gtk_about_dialog_get_program_name(pAboutDialog); - if (pProgramName) - { - OUString sProgramName(pProgramName, strlen(pProgramName), RTL_TEXTENCODING_UTF8); - sProgramName = (*m_pStringReplace)(sProgramName); - gtk_about_dialog_set_program_name(pAboutDialog, OUStringToOString(sProgramName, RTL_TEXTENCODING_UTF8).getStr()); - } - } } } } @@ -14283,15 +14168,6 @@ public: return std::make_unique(pMessageDialog, this, bTakeOwnership); } - virtual std::unique_ptr weld_about_dialog(const OString &id, bool bTakeOwnership) override - { - GtkAboutDialog* pAboutDialog = GTK_ABOUT_DIALOG(gtk_builder_get_object(m_pBuilder, id.getStr())); - if (!pAboutDialog) - return nullptr; - gtk_window_set_transient_for(GTK_WINDOW(pAboutDialog), GTK_WINDOW(gtk_widget_get_toplevel(m_pParentWidget))); - return std::make_unique(pAboutDialog, this, bTakeOwnership); - } - virtual std::unique_ptr weld_assistant(const OString &id, bool bTakeOwnership) override { GtkAssistant* pAssistant = GTK_ASSISTANT(gtk_builder_get_object(m_pBuilder, id.getStr()));