fpicker/source/office/OfficeControlAccess.cxx | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
New commits: commit e524f3f9d616b04fdd7d994ad1a1ec65ab6bb2a7 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Nov 13 10:36:44 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Nov 13 12:49:43 2019 +0100 Resolves: tdf#128767 fpicker sets labels on buttons as well as labels Change-Id: Iedd543fe20cd713d49a9d62c256942639e44adf6 Reviewed-on: https://gerrit.libreoffice.org/82580 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index f4251bc03fd0..ae8569b72c8c 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -459,16 +459,29 @@ namespace svt void OControlAccess::setLabel( sal_Int16 nId, const OUString &rLabel ) { - weld::Label* pControl = dynamic_cast<weld::Label*>(m_pFilePickerController->getControl(nId, true)); - assert(pControl && "OControlAccess::GetValue: don't have this control in the current mode!"); - pControl->set_label(rLabel); + weld::Widget* pControl = m_pFilePickerController->getControl(nId, true); + if (weld::Label* pLabel = dynamic_cast<weld::Label*>(pControl)) + { + pLabel->set_label(rLabel); + return; + } + if (weld::Button* pButton = dynamic_cast<weld::Button*>(pControl)) + { + pButton->set_label(rLabel); + return; + } + assert(false && "OControlAccess::GetValue: don't have this control in the current mode!"); } OUString OControlAccess::getLabel( sal_Int16 nId ) const { - weld::Label* pControl = dynamic_cast<weld::Label*>(m_pFilePickerController->getControl(nId, true)); - assert(pControl && "OControlAccess::GetValue: don't have this control in the current mode!"); - return pControl->get_label(); + weld::Widget* pControl = m_pFilePickerController->getControl(nId, true); + if (weld::Label* pLabel = dynamic_cast<weld::Label*>(pControl)) + return pLabel->get_label(); + if (weld::Button* pButton = dynamic_cast<weld::Button*>(pControl)) + return pButton->get_label(); + assert(false && "OControlAccess::GetValue: don't have this control in the current mode!"); + return OUString(); } void OControlAccess::enableControl(sal_Int16 nId, bool bEnable) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits