extensions/source/propctrlr/fontdialog.cxx | 12 +++++++++++- extensions/source/propctrlr/formstrings.hxx | 1 + svx/source/form/fmcontrollayout.cxx | 2 +- toolkit/source/controls/unocontrol.cxx | 1 + 4 files changed, 14 insertions(+), 2 deletions(-)
New commits: commit 7247f3ad59d64c85dc891bd5195b83c714ce1ce4 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Aug 2 15:09:54 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Aug 2 18:34:08 2024 +0200 tdf#153343 Show settings for the actual default font in control properties Since commit ea36e0502c0bc381577cfa1b1a7fedf0f05d1d72 Date: Tue Oct 4 12:42:33 2022 +0100 tdf#150786 use a 'standard' theme for form controls , form controls in Writer/Calc/Impress documents are supposed to no longer make use of the system style, but use style settings independent of the platform and system style/theme. Edits in forms actually use the standard font (set in `ImplStyleData::SetStandardStyles`) by default since that commit. However, the font dialog in the control properties was still showing data for the application default font that depends on the system style for font attributes not explicitly set for the control, which was incorrect and inconsistent with the visual appearance of the font actually used. Take `PROPERTY_STANDARD_THEME` introduced in the above-mentioned commit into account for the dialog as well when deciding what default font to use. Add inline comments that the 2 places setting and making assumptions about the default style of controls need to be kept in sync. With this in place, the actually used font height of 8 (as set in `ImplStyleData::SetStandardStyles`) is now displayed in the dialog for a newly inserted edit in Writer instead of something dependent on the style (e.g. 10 for the kf5 VCL plugin with the Breeze style in use, or 9 for the qt6 VCL plugin with the Fusion style). For the font family, the dialog now shows "Segoe UI;Tahoma;Arial Unicode MS;Lucida Sans Unicode;DejaVu Sans;Albany AMT;Albany;Arial;Nimbus Sans L;Interface User;Geneva;Dialog;Lucida;Helvetica;Helmet;Interface System;Sans Serif" (and "This font has not been installed. The closest available font will be used.") instead of "Noto Sans", which seems a bit odd, but is presumably "correct" based on the standard style font. (In order to change that, it would potentially be necessary to adjust what style settings are set in the "standard style settings" for controls.) Change-Id: I1fbee69fdcd6f73a126df64294eb1bcc44078642 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171426 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx index f9bc9bd93b61..59ca37b08eda 100644 --- a/extensions/source/propctrlr/fontdialog.cxx +++ b/extensions/source/propctrlr/fontdialog.cxx @@ -221,7 +221,17 @@ namespace pcr OFontPropertyExtractor aPropExtractor(_rxModel); // some items, which may be in default state, have to be filled with non-void information - vcl::Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont(); + StyleSettings aStyleSettings + = Application::GetDefaultDevice()->GetSettings().GetStyleSettings(); + + // if PROPERTY_STANDARD_THEME is set, use style settings independent of platform (theme) + // KEEP IN SYNC WITH UnoControl::createPeer + bool bStandardTheme = false; + css::uno::Any aAnyStandardTheme = _rxModel->getPropertyValue(PROPERTY_STANDARD_THEME); + if ((aAnyStandardTheme >>= bStandardTheme) && bStandardTheme) + aStyleSettings.SetStandardStyles(); + + const vcl::Font aDefaultVCLFont = aStyleSettings.GetAppFont(); css::awt::FontDescriptor aDefaultFont = VCLUnoHelper::CreateFontDescriptor(aDefaultVCLFont); // get the current properties diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx index 41deed74c8fb..495e178f842e 100644 --- a/extensions/source/propctrlr/formstrings.hxx +++ b/extensions/source/propctrlr/formstrings.hxx @@ -198,6 +198,7 @@ inline constexpr OUString PROPERTY_NOLABEL = u"NoLabel"_ustr; inline constexpr OUString PROPERTY_URL = u"URL"_ustr; inline constexpr OUString PROPERTY_SELECTION_TYPE = u"SelectionType"_ustr; +inline constexpr OUString PROPERTY_STANDARD_THEME = u"StandardTheme"_ustr; inline constexpr OUString PROPERTY_ROOT_DISPLAYED = u"RootDisplayed"_ustr; inline constexpr OUString PROPERTY_SHOWS_HANDLES = u"ShowsHandles"_ustr; inline constexpr OUString PROPERTY_SHOWS_ROOT_HANDLES = u"ShowsRootHandles"_ustr; diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 8368070a754c..e54bf5433ba2 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -271,7 +271,7 @@ namespace svxform } // the font (only if we use the document's ref devices for rendering control text, otherwise, the - // default font of VCL controls is assumed to be fine) + // default font from application or standard style is assumed to be fine) if ( useDocumentReferenceDevice( _eDocType ) && xPSI->hasPropertyByName( FM_PROP_FONT ) ) diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 1065ca2f14ac..f4757f5d79b6 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -1297,6 +1297,7 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer nStyle |= WindowBorderStyle::NONATIVEBORDER; pVclPeer->SetBorderStyle(nStyle); + // KEEP IN SYNC WITH ControlCharacterDialog::translatePropertiesToItems AllSettings aAllSettings = pVclPeer->GetSettings(); StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); aStyleSettings.SetStandardStyles();