From fae06bab169605f057601d0a5b719387cf188105 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 30 Apr 2020 17:31:37 +0100 Subject: Related: tdf#130505 strangely all these point to the same pair of widgets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icbfe4b56e1ec068197a0641a1364f392261ba80e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93227 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- fpicker/source/office/iodlg.cxx | 76 +++++++++++++++++--------------------- fpicker/source/office/iodlgimp.hxx | 13 +------ 2 files changed, 35 insertions(+), 54 deletions(-) diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 8a51fc97b518..d2dcef40a313 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -303,19 +303,13 @@ SvtFileDialog::SvtFileDialog(weld::Window* pParent, PickerFlags nStyle) m_xImpl->m_xCbPassword = m_xBuilder->weld_check_button("password"); m_xImpl->m_xCbGPGEncrypt = m_xBuilder->weld_check_button("gpgencrypt"); m_xImpl->m_xCbAutoExtension = m_xBuilder->weld_check_button("extension"); - m_xImpl->m_xFtFileVersion = m_xBuilder->weld_label("shared_label"); - m_xImpl->m_xLbFileVersion = m_xBuilder->weld_combo_box("shared"); - m_xImpl->m_xFtTemplates = m_xBuilder->weld_label("shared_label"); - m_xImpl->m_xLbTemplates = m_xBuilder->weld_combo_box("shared"); - m_xImpl->m_xFtImageTemplates = m_xBuilder->weld_label("shared_label"); - m_xImpl->m_xLbImageTemplates = m_xBuilder->weld_combo_box("shared"); - m_xImpl->m_xFtImageAnchor = m_xBuilder->weld_label("shared_label"); - m_xImpl->m_xLbImageAnchor = m_xBuilder->weld_combo_box("shared"); + m_xImpl->m_xSharedLabel = m_xBuilder->weld_label("shared_label"); + m_xImpl->m_xSharedListBox = m_xBuilder->weld_combo_box("shared"); // because the " (*.bmp,*...)" entry is too wide, // we need to disable the auto width feature of the filter box int nWidth = m_xImpl->m_xLbFilter->get_approximate_digit_width() * 60; - m_xImpl->m_xLbImageTemplates->set_size_request(nWidth, -1); + m_xImpl->m_xSharedListBox->set_size_request(nWidth, -1); m_xImpl->m_xLbFilter->set_size_request(nWidth, -1); m_xImpl->m_xBtnUp.reset(new SvtUpButton_Impl(m_xBuilder->weld_toolbar("up_bar"), @@ -445,12 +439,8 @@ SvtFileDialog::SvtFileDialog(weld::Window* pParent, PickerFlags nStyle) // for the extra use cases, and separated _pLbFileVersion // I did not find out in which cases the help ID is really needed HID_FILESAVE_TEMPLATE - all // tests I made lead to a dialog where _no_ of the three list boxes was present. - if ( m_xImpl->m_xLbFileVersion ) - m_xImpl->m_xLbFileVersion->set_help_id( HID_FILESAVE_TEMPLATE ); - if ( m_xImpl->m_xLbTemplates ) - m_xImpl->m_xLbTemplates->set_help_id( HID_FILESAVE_TEMPLATE ); - if ( m_xImpl->m_xLbImageTemplates ) - m_xImpl->m_xLbImageTemplates->set_help_id( HID_FILESAVE_TEMPLATE ); + if (m_xImpl->m_xSharedListBox) + m_xImpl->m_xSharedListBox->set_help_id( HID_FILESAVE_TEMPLATE ); if ( m_xImpl->m_xCbPassword ) m_xImpl->m_xCbPassword->set_help_id( HID_FILESAVE_SAVEWITHPASSWORD ); if ( m_xImpl->m_xCbAutoExtension ) m_xImpl->m_xCbAutoExtension->set_help_id( HID_FILESAVE_AUTOEXTENSION ); @@ -1964,42 +1954,42 @@ weld::Widget* SvtFileDialog::getControl( sal_Int16 nControlId, bool bLabelContro case LISTBOX_VERSION: pReturn = bLabelControl - ? static_cast(m_xImpl->m_xFtFileVersion.get()) - : static_cast(m_xImpl->m_xLbFileVersion.get()); + ? static_cast(m_xImpl->m_xSharedLabel.get()) + : static_cast(m_xImpl->m_xSharedListBox.get()); break; case LISTBOX_TEMPLATE: pReturn = bLabelControl - ? static_cast(m_xImpl->m_xFtTemplates.get()) - : static_cast(m_xImpl->m_xLbTemplates.get()); + ? static_cast(m_xImpl->m_xSharedLabel.get()) + : static_cast(m_xImpl->m_xSharedListBox.get()); break; case LISTBOX_IMAGE_TEMPLATE: pReturn = bLabelControl - ? static_cast(m_xImpl->m_xFtImageTemplates.get()) - : static_cast(m_xImpl->m_xLbImageTemplates.get()); + ? static_cast(m_xImpl->m_xSharedLabel.get()) + : static_cast(m_xImpl->m_xSharedListBox.get()); break; case LISTBOX_IMAGE_ANCHOR: pReturn = bLabelControl - ? static_cast(m_xImpl->m_xFtImageAnchor.get()) - : static_cast(m_xImpl->m_xLbImageAnchor.get()); + ? static_cast(m_xImpl->m_xSharedLabel.get()) + : static_cast(m_xImpl->m_xSharedListBox.get()); break; case LISTBOX_VERSION_LABEL: - pReturn = m_xImpl->m_xFtFileVersion.get(); + pReturn = m_xImpl->m_xSharedLabel.get(); break; case LISTBOX_TEMPLATE_LABEL: - pReturn = m_xImpl->m_xFtTemplates.get(); + pReturn = m_xImpl->m_xSharedLabel.get(); break; case LISTBOX_IMAGE_TEMPLATE_LABEL: - pReturn = m_xImpl->m_xFtImageTemplates.get(); + pReturn = m_xImpl->m_xSharedLabel.get(); break; case LISTBOX_IMAGE_ANCHOR_LABEL: - pReturn = m_xImpl->m_xFtImageAnchor.get(); + pReturn = m_xImpl->m_xSharedLabel.get(); break; case PUSHBUTTON_OK: @@ -2108,38 +2098,38 @@ void SvtFileDialog::AddControls_Impl( ) if ( m_nPickerFlags & PickerFlags::ShowVersions ) { - m_xImpl->m_xFtFileVersion->set_label( FpsResId( STR_SVT_FILEPICKER_VERSION ) ); - m_xImpl->m_xFtFileVersion->show(); + m_xImpl->m_xSharedLabel->set_label( FpsResId( STR_SVT_FILEPICKER_VERSION ) ); + m_xImpl->m_xSharedLabel->show(); - m_xImpl->m_xLbFileVersion->set_help_id( HID_FILEOPEN_VERSION ); - m_xImpl->m_xLbFileVersion->show(); + m_xImpl->m_xSharedListBox->set_help_id( HID_FILEOPEN_VERSION ); + m_xImpl->m_xSharedListBox->show(); } else if ( m_nPickerFlags & PickerFlags::Templates ) { - m_xImpl->m_xFtTemplates->set_label( FpsResId( STR_SVT_FILEPICKER_TEMPLATES ) ); - m_xImpl->m_xFtTemplates->show(); + m_xImpl->m_xSharedLabel->set_label( FpsResId( STR_SVT_FILEPICKER_TEMPLATES ) ); + m_xImpl->m_xSharedLabel->show(); - m_xImpl->m_xLbTemplates->set_help_id( HID_FILEOPEN_VERSION ); - m_xImpl->m_xLbTemplates->show(); + m_xImpl->m_xSharedListBox->set_help_id( HID_FILEOPEN_VERSION ); + m_xImpl->m_xSharedListBox->show(); // This is strange. During the re-factoring during 96930, I discovered that this help id // is set in the "Templates mode". This was hidden in the previous implementation. // Shouldn't this be a more meaningful help id. } else if ( m_nPickerFlags & PickerFlags::ImageTemplate ) { - m_xImpl->m_xFtImageTemplates->set_label( FpsResId( STR_SVT_FILEPICKER_IMAGE_TEMPLATE ) ); - m_xImpl->m_xFtImageTemplates->show(); + m_xImpl->m_xSharedLabel->set_label( FpsResId( STR_SVT_FILEPICKER_IMAGE_TEMPLATE ) ); + m_xImpl->m_xSharedLabel->show(); - m_xImpl->m_xLbImageTemplates->set_help_id( HID_FILEOPEN_IMAGE_TEMPLATE ); - m_xImpl->m_xLbImageTemplates->show(); + m_xImpl->m_xSharedListBox->set_help_id( HID_FILEOPEN_IMAGE_TEMPLATE ); + m_xImpl->m_xSharedListBox->show(); } else if ( m_nPickerFlags & PickerFlags::ImageAnchor ) { - m_xImpl->m_xFtImageAnchor->set_label( FpsResId( STR_SVT_FILEPICKER_IMAGE_ANCHOR ) ); - m_xImpl->m_xFtImageAnchor->show(); + m_xImpl->m_xSharedLabel->set_label( FpsResId( STR_SVT_FILEPICKER_IMAGE_ANCHOR ) ); + m_xImpl->m_xSharedLabel->show(); - m_xImpl->m_xLbImageAnchor->set_help_id( HID_FILEOPEN_IMAGE_ANCHOR ); - m_xImpl->m_xLbImageAnchor->show(); + m_xImpl->m_xSharedListBox->set_help_id( HID_FILEOPEN_IMAGE_ANCHOR ); + m_xImpl->m_xSharedListBox->show(); } m_xImpl->m_xPlaces.reset(new PlacesListBox(m_xBuilder->weld_tree_view("places"), diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index 2b200f466a7b..5546e4dd47d4 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -116,17 +116,8 @@ public: std::unique_ptr m_xFtFileName; std::unique_ptr m_xEdFileName; - std::unique_ptr m_xFtFileVersion; - std::unique_ptr m_xLbFileVersion; - - std::unique_ptr m_xFtTemplates; - std::unique_ptr m_xLbTemplates; - - std::unique_ptr m_xFtImageTemplates; - std::unique_ptr m_xLbImageTemplates; - - std::unique_ptr m_xFtImageAnchor; - std::unique_ptr m_xLbImageAnchor; + std::unique_ptr m_xSharedLabel; + std::unique_ptr m_xSharedListBox; std::unique_ptr m_xFtFileType; std::unique_ptr m_xLbFilter; -- cgit