diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-11-13 10:36:44 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-11-13 12:49:43 +0100 |
commit | e524f3f9d616b04fdd7d994ad1a1ec65ab6bb2a7 (patch) | |
tree | 216386ad53a414d5a02a26fe3711ae75ab6dca6f /fpicker | |
parent | a474e2267cdcb1707333acdea1353d883d58c801 (diff) |
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 <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/OfficeControlAccess.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
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) |