extensions/source/propctrlr/fontdialog.cxx | 12 +++++++++++- extensions/source/propctrlr/formstrings.hxx | 1 + include/vcl/vclenum.hxx | 7 +++++-- svx/source/form/fmcontrollayout.cxx | 2 +- toolkit/source/controls/unocontrol.cxx | 6 ++++++ vcl/source/window/brdwin.cxx | 2 +- 6 files changed, 25 insertions(+), 5 deletions(-)
New commits: commit 2bf3cada925ca49e3ac6a249ec6c342954739986 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Aug 2 15:09:54 2024 +0200 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sat Aug 3 23:32:32 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 (cherry picked from commit 7247f3ad59d64c85dc891bd5195b83c714ce1ce4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171410 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> 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(); commit 7f50f18b0fc1e9d52bf2d8f929be8c5e4518ced8 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Aug 1 15:58:21 2024 +0200 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sat Aug 3 23:32:20 2024 +0200 tdf#155636 tdf#155637 tdf#156962 Consistently use non-native controls Since commit ea36e0502c0bc381577cfa1b1a7fedf0f05d1d72 Date: Tue Oct 4 12:42:33 2022 +0100 tdf#150786 use a 'standard' theme for form controls i.e. ignore system theme so we get the same results on export to pdf regardless of the theme (esp dark) and don't follow the system theme when hosted with a writer/calc/impress document (do continue to use system theme for StarBasic dialogs as seen in BasicIDE) Didn't reuse 'NativeWidgetLook' for this because is currently defaults off, while we currently do use the colors derived from the system theme even when this is off, its really the NWF flag to render using the platform theming engine , form controls in Writer/Calc/Impress documents are supposed to no longer make use of the system theme, but use style settings independent of the platform and system style/theme set. However, `ImplSmallBorderWindowView::Init` could still decide to enable native drawing of borders, in which case it would enable transparency for the control and the control background color would no longer be seen with at least the Qt-based VCL plugins after commit 0e14dbc9ecdf6abae3ae3089e3b4e22f27dd4cb1 Date: Thu May 4 10:24:53 2023 +0100 Resolves: tdf#155029 set StandardStyles before updateFromModel e.g. for the multiline edit control in attachment 195659 from tdf#155637, where `mbNWFBorder = true;` would be set like this: #0 ImplSmallBorderWindowView::Init(OutputDevice*, long, long) (this=0x55af6388e700, pDev=0x55af62d49770, nWidth=214, nHeight=365) at vcl/source/window/brdwin.cxx:458 #1 0x00007fed4de9f168 in ImplBorderWindow::InitView() (this=0x55af638bdb50) at vcl/source/window/brdwin.cxx:1793 #2 0x00007fed4dea08f4 in ImplBorderWindow::UpdateView(bool, Size const&) (this=0x55af638bdb50, bNewView=true, rNewOutSize=Size = {...}) at vcl/source/window/brdwin.cxx:1808 #3 0x00007fed4dea0847 in ImplBorderWindow::DataChanged(DataChangedEvent const&) (this=0x55af638bdb50, rDCEvt=...) at vcl/source/window/brdwin.cxx:1771 #4 0x00007fed4de6fc32 in vcl::WindowOutputDevice::SetSettings(AllSettings const&, bool) (this=0x55af62d49770, rSettings=..., bChild=false) at vcl/source/window/settings.cxx:68 #5 0x00007fed4de6fb19 in vcl::WindowOutputDevice::SetSettings(AllSettings const&, bool) (this=0x55af62d49420, rSettings=..., bChild=false) at vcl/source/window/settings.cxx:52 #6 0x00007fed4de6fa8f in vcl::WindowOutputDevice::SetSettings(AllSettings const&) (this=0x55af62d49420, rSettings=...) at vcl/source/window/settings.cxx:44 #7 0x00007fed4e12d376 in vcl::Window::SetSettings(AllSettings const&) (this=0x55af62fbb530, rSettings=...) at vcl/source/window/window3.cxx:209 #8 0x00007fed501e3374 in UnoControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&) (this=0x55af62c79380, rxToolkit=empty uno::Reference, rParentPeer=uno::Reference to (VCLXContainer *) 0x55af61cbc178) at toolkit/source/controls/unocontrol.cxx:1299 #9 0x00007fed5023dc39 in UnoEditControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&) (this=0x55af62c79380, rxToolkit=empty uno::Reference, rParentPeer=uno::Reference to (VCLXContainer *) 0x55af61cbc178) at toolkit/source/controls/unocontrols.cxx:241 #10 0x00007fed05f6009f in frm::ORichTextControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&) (this=0x55af62c79380, _rToolkit=empty uno::Reference, _rParentPeer=uno::Reference to (VCLXContainer *) 0x55af61cbc178) at forms/source/richtext/richtextcontrol.cxx:163 #11 0x00007fed05e34126 in frm::OControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&) (this=0x55af61e17c60, _rxToolkit=empty uno::Reference, _rxParent=uno::Reference to (VCLXContainer *) 0x55af61cbc178) at forms/source/component/FormComponent.cxx:272 #12 0x00007fed50201095 in UnoControlContainer::impl_createControlPeerIfNecessary(com::sun::star::uno::Reference<com::sun::star::awt::XControl> const&) (this=0x55af5eb108c0, _rxControl=uno::Reference to (frm::OEditControl *) 0x55af61e17cc8) at toolkit/source/controls/unocontrolcontainer.cxx:595 #13 0x00007fed501ff973 in UnoControlContainer::impl_addControl(com::sun::star::uno::Reference<com::sun::star::awt::XControl> const&, rtl::OUString const*) (this=0x55af5eb108c0, _rxControl=uno::Reference to (frm::OEditControl *) 0x55af61e17cc8, _pName=0x55af5f0d2670) at toolkit/source/controls/unocontrolcontainer.cxx:608 #14 0x00007fed50201183 in UnoControlContainer::addControl(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::awt::XControl> const&) (this=0x55af5eb108c0, rName="com.sun.star.form.control.TextField", rControl=uno::Reference to (frm::OEditControl *) 0x55af61e17cc8) at toolkit/source/controls/unocontrolcontainer.cxx:628 #15 0x00007fed517f1aff in sdr::contact::ViewObjectContactOfUnoControl_Impl::createControlForDevice(sdr::contact::(anonymous namespace)::IPageViewAccess const&, OutputDevice const&, SdrUnoObj const&, basegfx::B2DHomMatrix const&, basegfx::B2DHomMatrix const&, sdr::contact::(anonymous namespace)::ControlHolder&) (_rPageView=..., _rDevice=..., _rUnoObject=..., _rInitialViewTransformation=..., _rInitialZoomNormalization=..., _out_rControl=...) at svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx:1126 #16 0x00007fed517ee55b in sdr::contact::ViewObjectContactOfUnoControl_Impl::impl_ensureControl_nothrow(sdr::contact::(anonymous namespace)::IPageViewAccess const&, OutputDevice const&, basegfx::B2DHomMatrix const&) (this=0x55af6389c6b0, _rPageView=..., _rDevice=..., _rInitialViewTransformation=...) at svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx:1044 #17 0x00007fed517ee1d2 in sdr::contact::ViewObjectContactOfUnoControl_Impl::ensureControl(basegfx::B2DHomMatrix const*) (this=0x55af6389c6b0, _pInitialViewTransformationOrNULL=0x55af6380a1f0) at svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx:960 #18 0x00007fed517f36a1 in sdr::contact::(anonymous namespace)::LazyControlCreationPrimitive2D::create2DDecomposition(drawinglayer::geometry::ViewInformation2D const&) const (this=0x55af61d38c40, _rViewInformation=...) at svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx:1545 #19 0x00007fed5467691a in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const (this=0x55af61d38c40, rVisitor=..., rViewInformation=...) at drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:133 #20 0x00007fed517f358c in sdr::contact::(anonymous namespace)::LazyControlCreationPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const (this=0x55af61d38c40, rVisitor=..., _rViewInformation=...) at svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx:1530 [...] Introduce a new flag `WindowBorderStyle::NONATIVEBORDER` and set it for the newly created control in `UnoControl::createPeer` if the use of the "standard theme" instead of the system style is enabled. Evaluate the flag in `ImplSmallBorderWindowView::Init` to never enable native drawing if it is set to consistently not apply system styling for such controls. Change-Id: Ib12685a3cf98acba035899221feb536f40cda84c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171396 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins (cherry picked from commit 001c0934aab5c33b37a75798deb84c20b4b9d365) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171409 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx index c8f27fb9da52..a2a8c562a203 100644 --- a/include/vcl/vclenum.hxx +++ b/include/vcl/vclenum.hxx @@ -111,11 +111,14 @@ enum class WindowBorderStyle : sal_Int16 MENU = 0x0010, NWF = 0x0020, NOBORDER = 0x1000, - REMOVEBORDER = 0x2000 + REMOVEBORDER = 0x2000, + // Never use native border, used to ensure consistency of form controls + // inside documents across platforms and in pdf/print output + NONATIVEBORDER = 0x4000, }; namespace o3tl { - template<> struct typed_flags<WindowBorderStyle> : is_typed_flags<WindowBorderStyle, 0x3033> {}; + template<> struct typed_flags<WindowBorderStyle> : is_typed_flags<WindowBorderStyle, 0x7033> {}; } enum class TimeFormat diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index b13ffa02d20f..1065ca2f14ac 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -1292,6 +1292,11 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer if (bUseStandardTheme) { VclPtr<vcl::Window> pVclPeer = VCLUnoHelper::GetWindow(getPeer()); + + WindowBorderStyle nStyle = pVclPeer->GetBorderStyle(); + nStyle |= WindowBorderStyle::NONATIVEBORDER; + pVclPeer->SetBorderStyle(nStyle); + AllSettings aAllSettings = pVclPeer->GetSettings(); StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); aStyleSettings.SetStandardStyles(); diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index fb7c3a1b2db4..8429ee33b52d 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -428,7 +428,7 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, tools::Long nWidth, to // control this border belongs to ControlType aCtrlType = ControlType::Generic; ControlPart aCtrlPart = ControlPart::Entire; - if (pCtrl) + if (pCtrl && !(pCtrl->GetBorderStyle() & WindowBorderStyle::NONATIVEBORDER)) { switch( pCtrl->GetType() ) {