From 999e18ad24379abb2b3ea4abc154bdf804cc9dab Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Fri, 29 May 2026 11:47:26 +0200 Subject: [PATCH] Resolves tdf#172256 - Show a warning when using the gen VCL backend Infobar shown for gen AND Office::UI::Infobar::Enabled::WarnGenericVCL Change-Id: Ia4d42bb7c3ca9cc3da9b7564f7a0b6edce78ee31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205832 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- include/sfx2/strings.hrc | 2 ++ include/sfx2/viewfrm.hxx | 1 + .../org/openoffice/Office/UI/Infobar.xcs | 6 +++++ sfx2/source/dialog/infobar.cxx | 2 ++ sfx2/source/view/viewfrm.cxx | 27 ++++++++++++++++--- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc index 5e651c62cc61..36b9124ffba9 100644 --- a/include/sfx2/strings.hrc +++ b/include/sfx2/strings.hrc @@ -327,6 +327,8 @@ #define STR_MACROS NC_("STR_MACROS", "Show Macros") #define STR_SECURITY_OPTIONS NC_("STR_MACROS", "Show Security Options") #define STR_EVENTS NC_("STR_EVENTS", "Show Events") +#define STR_VCLGEN_TITLE NC_("STR_VCLGEN_TITLE", "You are using generic controls!") +#define STR_VCLGEN_TEXT NC_("STR_VCLGEN_TEXT", "Please check whether your distribution offers a better integration.") // Translators: default Impress template names #define STR_TEMPLATE_NAME1 NC_("STR_TEMPLATE_NAME1", "Grey Elegant") diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index a3d9781d0e2e..8a25aa39a73f 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -92,6 +92,7 @@ private: SAL_DLLPRIVATE static void InitInterface_Impl(); SAL_DLLPRIVATE void AppendContainsMacrosInfobar(); + SAL_DLLPRIVATE bool AppendGenericVCLInfobar(); public: SAL_DLLPRIVATE static void SetViewFrame( SfxViewFrame* ); diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs index 5e652b482419..867e64fd7b73 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Infobar.xcs @@ -72,6 +72,12 @@ true + + + Whether an Infobar is shown when the generic VCL is used. + + true + diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index f97e80f93dd2..f00c5f979d1f 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -486,6 +486,8 @@ bool SfxInfoBarContainerWindow::isInfobarEnabled(std::u16string_view sId) } if (sId == u"autocorr_leadtrail") return officecfg::Office::UI::Infobar::Enabled::AutoCorrLeadTrail::get(); + if (sId == u"VCL_gen") + return officecfg::Office::UI::Infobar::Enabled::WarnGenericVCL::get(); return true; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 02f60c408c32..b0a7d0016b88 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1343,6 +1343,7 @@ void SfxViewFrame::AppendAutoCorrLeadTrailInfobar() { weld::Button& rDontShowAgain = pInfoBar->addButton(); rDontShowAgain.set_label(SfxResId(STR_NOSHOWAGAIN)); + rDontShowAgain.set_buildable_name(u"autocorr_leadtrail"_ustr); // id in click handler rDontShowAgain.connect_clicked(LINK(this, SfxViewFrame, DontShowAgainHdl)); weld::Button& rChangeOptions = pInfoBar->addButton(); @@ -1476,6 +1477,20 @@ void SfxViewFrame::AppendContainsMacrosInfobar() } } +bool SfxViewFrame::AppendGenericVCLInfobar() +{ + auto pInfoBar = AppendInfoBar(u"VCL_gen"_ustr, SfxResId(STR_VCLGEN_TITLE), + SfxResId(STR_VCLGEN_TEXT), InfobarType::INFO); + if (pInfoBar) // false if not created in AppendInfoBar() after checking ::WarnGenericVCL::get() + { + weld::Button& rDontShowAgain = pInfoBar->addButton(); + rDontShowAgain.set_label(SfxResId(STR_NOSHOWAGAIN)); + rDontShowAgain.set_buildable_name(u"VCL_gen"_ustr); // id in click handler + rDontShowAgain.connect_clicked(LINK(this, SfxViewFrame, DontShowAgainHdl)); + } + + return pInfoBar; +} namespace { css::uno::Reference getLayoutManager(const SfxFrame& rFrame) @@ -1616,6 +1631,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) aHelper.UpdateInfobar(*this); } + if (Application::GetToolkit() == Toolkit::Gen) + bIsInfobarShown = AppendGenericVCLInfobar(); + // Add pending infobars std::vector& aPendingInfobars = m_xObjSh->getPendingInfobars(); while (!aPendingInfobars.empty()) @@ -2037,14 +2055,17 @@ IMPL_STATIC_LINK_NOARG(SfxViewFrame, HelpMasterPasswordHdl, weld::Button&, void) pHelp->Start(u"cui/ui/optsecuritypage/savepassword"_ustr); } -IMPL_LINK_NOARG(SfxViewFrame, DontShowAgainHdl, weld::Button&, void) +IMPL_LINK(SfxViewFrame, DontShowAgainHdl, weld::Button&, rButton, void) { std::shared_ptr batch( comphelper::ConfigurationChanges::create()); - officecfg::Office::UI::Infobar::Enabled::AutoCorrLeadTrail::set(false, batch); + if (rButton.get_buildable_name() == u"VCL_gen") + officecfg::Office::UI::Infobar::Enabled::WarnGenericVCL::set(false, batch); + else if (rButton.get_buildable_name() == u"autocorr_leadtrail") + officecfg::Office::UI::Infobar::Enabled::AutoCorrLeadTrail::set(false, batch); batch->commit(); - RemoveInfoBar(u"autocorr_leadtrail"); + RemoveInfoBar(rButton.get_buildable_name()); } IMPL_LINK_NOARG(SfxViewFrame, ChangeOptionsHdl, weld::Button&, void)