extensions/source/propctrlr/fontdialog.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
New commits: commit 9dd21ea57a8e098f994a4c65d299480f5211a18e Author: Michael Weghorn <[email protected]> AuthorDate: Fri Jan 10 14:22:05 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jan 10 15:34:13 2025 +0100 tdf#164037 Check property exists before accessing it Only call XPropertySet::getPropertyValue with PROPERTY_STANDARD_THEME if the property set actually has such a property. This amends commit 2bf3cada925ca49e3ac6a249ec6c342954739986 Author: Michael Weghorn <[email protected]> Date: Fri Aug 2 15:09:54 2024 +0200 tdf#153343 Show settings for the actual default font in control properties Otherwise, calling XPropertySet::getPropertyValue triggers an UnknownPropertyException in OPropertySetHelper::getPropertyValue for the tdf#164037 sample macro dialog and the actual font properties are not shown in the dialog. Backtrace of how UnknownPropertyException gets thrown: 1 cppu::OPropertySetHelper::getPropertyValue propshlp.cxx 276 0x7fc251385a68 2 non-virtual thunk to cppu::OPropertySetHelper::getPropertyValue(rtl::OUString const&) 0x7fc251385bac 3 pcr::ControlCharacterDialog::translatePropertiesToItems fontdialog.cxx 232 0x7fc210c32b15 4 pcr::FormComponentPropertyHandler::impl_executeFontDialog_nothrow formcomponenthandler.cxx 2839 0x7fc210c4ccde 5 pcr::FormComponentPropertyHandler::onInteractivePropertySelection formcomponenthandler.cxx 1435 0x7fc210c49abd 6 pcr::OPropertyBrowserController::Clicked propcontroller.cxx 1259 0x7fc210cf3352 7 pcr::OBrowserListBox::buttonClicked browserlistbox.cxx 540 0x7fc210b9f19c 8 pcr::OBrowserLine::OnButtonClicked browserline.cxx 383 0x7fc210b969e0 9 pcr::OBrowserLine::LinkStubOnButtonClicked browserline.cxx 380 0x7fc210b9631d 10 Link<weld::Button&, void>::Call link.hxx 101 0x7fc24a462971 11 weld::Button::signal_clicked weld.hxx 1557 0x7fc24a43e78c 12 SalInstanceButton::ClickHdl salvtables.cxx 2955 0x7fc24a40f9b8 13 SalInstanceButton::LinkStubClickHdl salvtables.cxx 2943 0x7fc24a40ef0d 14 Link<Button *, void>::Call link.hxx 101 0x7fc249d154b1 15 Button::Click()::$_0::operator()() const button.cxx 130 0x7fc249d0cd02 16 std::__invoke_impl<void, Button::Click()::$_0&>(std::__invoke_other, Button::Click()::$_0&) invoke.h 61 0x7fc249d0ccd5 17 std::__invoke_r<void, Button::Click()::$_0&>(Button::Click()::$_0&) invoke.h 111 0x7fc249d0cc85 18 std::_Function_handler<void(), Button::Click()::$_0>::_M_invoke std_function.h 290 0x7fc249d0cbad 19 std::function<void()>::operator() std_function.h 591 0x7fc249d36f1e 20 Control::ImplCallEventListenersAndHandler ctrl.cxx 311 0x7fc249d350db ... <More> Change-Id: I2d34c2152238e2439e24e561435d6d6b5a1a985a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180073 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx index 59ca37b08eda..2adab8f069ba 100644 --- a/extensions/source/propctrlr/fontdialog.cxx +++ b/extensions/source/propctrlr/fontdialog.cxx @@ -226,10 +226,16 @@ namespace pcr // 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(); + css::uno::Reference<css::beans::XPropertySetInfo> xPropSetInfo + = _rxModel->getPropertySetInfo(); + if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(PROPERTY_STANDARD_THEME)) + { + 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);
