diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2021-10-15 16:33:00 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2021-10-16 12:37:19 +0200 |
commit | 4fd5dc6340ecd6ac09f239507622152691911d59 (patch) | |
tree | 23d067f941ff9593666f333304d7341c1d3176b6 /cui/source | |
parent | 17ac33abe4eb1d406da1060f772562655f973e51 (diff) |
Simplify vector initialization in cui
Change-Id: I9c1b793f02eff56251cf13959e88c4648db4ab0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123665
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/customize/acccfg.cxx | 3 | ||||
-rw-r--r-- | cui/source/customize/macropg.cxx | 9 | ||||
-rw-r--r-- | cui/source/dialogs/linkdlg.cxx | 11 | ||||
-rw-r--r-- | cui/source/options/connpooloptions.cxx | 9 | ||||
-rw-r--r-- | cui/source/options/dbregister.cxx | 13 | ||||
-rw-r--r-- | cui/source/options/fontsubs.cxx | 5 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 11 | ||||
-rw-r--r-- | cui/source/options/optdict.cxx | 7 | ||||
-rw-r--r-- | cui/source/options/optfltr.cxx | 8 | ||||
-rw-r--r-- | cui/source/options/optjava.cxx | 9 | ||||
-rw-r--r-- | cui/source/options/webconninfo.cxx | 7 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 17 | ||||
-rw-r--r-- | cui/source/tabpages/macroass.cxx | 8 |
13 files changed, 74 insertions, 43 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index dbe8eff7c832..9745120f3591 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -889,8 +889,7 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage(weld::Container* pPage, auto nNewTab = nMaxWidth + 5; // additional space // initialize Entriesbox - std::vector<int> aWidths; - aWidths.push_back(nNewTab); + std::vector<int> aWidths{ nNewTab }; m_xEntriesBox->set_column_fixed_widths(aWidths); //Initialize search util diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index 6f03188e285c..2074060a957a 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -27,6 +27,7 @@ #include <helpids.h> #include <headertablistbox.hxx> #include "macropg_impl.hxx" +#include <o3tl/safeint.hxx> #include <svl/macitem.hxx> #include <svx/svxids.hrc> #include <strings.hrc> @@ -500,9 +501,11 @@ void SvxMacroTabPage_::InitAndSetHandler( const Reference< container::XNameRepla mpImpl->xEventLB->connect_row_activated( LINK(this, SvxMacroTabPage_, DoubleClickHdl_Impl ) ); mpImpl->xEventLB->connect_changed( LINK( this, SvxMacroTabPage_, SelectEvent_Impl )); - std::vector<int> aWidths; - aWidths.push_back(mpImpl->xEventLB->get_approximate_digit_width() * 32); - aWidths.push_back(mpImpl->xEventLB->get_checkbox_column_width()); + std::vector<int> aWidths + { + o3tl::narrowing<int>(mpImpl->xEventLB->get_approximate_digit_width() * 32), + mpImpl->xEventLB->get_checkbox_column_width() + }; mpImpl->xEventLB->set_column_fixed_widths(aWidths); mpImpl->xEventLB->show(); diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx index b4a494a20886..01026742da15 100644 --- a/cui/source/dialogs/linkdlg.cxx +++ b/cui/source/dialogs/linkdlg.cxx @@ -18,6 +18,7 @@ */ #include <linkdlg.hxx> +#include <o3tl/safeint.hxx> #include <vcl/svapp.hxx> #include <tools/diagnose_ex.h> @@ -102,10 +103,12 @@ SvBaseLinksDlg::SvBaseLinksDlg(weld::Window * pParent, LinkManager* pMgr, bool b m_xTbLinks->set_selection_mode(SelectionMode::Multiple); - std::vector<int> aWidths; - aWidths.push_back(m_xTbLinks->get_approximate_digit_width() * 30); - aWidths.push_back(m_xTbLinks->get_approximate_digit_width() * 20); - aWidths.push_back(m_xTbLinks->get_approximate_digit_width() * 20); + std::vector<int> aWidths + { + o3tl::narrowing<int>(m_xTbLinks->get_approximate_digit_width() * 30), + o3tl::narrowing<int>(m_xTbLinks->get_approximate_digit_width() * 20), + o3tl::narrowing<int>(m_xTbLinks->get_approximate_digit_width() * 20) + }; m_xTbLinks->set_column_fixed_widths(aWidths); // UpdateTimer for DDE-/Grf-links, which are waited for diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx index a478d9a652c3..1e1fa02a5529 100644 --- a/cui/source/options/connpooloptions.cxx +++ b/cui/source/options/connpooloptions.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include "connpooloptions.hxx" #include "connpoolsettings.hxx" @@ -60,9 +61,11 @@ namespace offapp m_xDriverList->get_height_rows(15)); m_xDriverList->show(); - std::vector<int> aWidths; - aWidths.push_back(m_xDriverList->get_approximate_digit_width() * 50); - aWidths.push_back(m_xDriverList->get_approximate_digit_width() * 8); + std::vector<int> aWidths + { + o3tl::narrowing<int>(m_xDriverList->get_approximate_digit_width() * 50), + o3tl::narrowing<int>(m_xDriverList->get_approximate_digit_width() * 8) + }; m_xDriverList->set_column_fixed_widths(aWidths); m_xEnablePooling->connect_toggled( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) ); diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx index add9eda6e93c..889691422346 100644 --- a/cui/source/options/dbregister.cxx +++ b/cui/source/options/dbregister.cxx @@ -19,6 +19,7 @@ #include <dbregister.hxx> #include "dbregistersettings.hxx" +#include <o3tl/safeint.hxx> #include <svl/filenotation.hxx> #include <helpids.h> #include <tools/debug.hxx> @@ -93,8 +94,10 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage(weld::Container* pPage, wel m_xPathBox->get_height_rows(12)); m_xPathBox->set_size_request(aControlSize.Width(), aControlSize.Height()); - std::vector<int> aWidths; - aWidths.push_back(m_xPathBox->get_approximate_digit_width() * 20); + std::vector<int> aWidths + { + o3tl::narrowing<int>(m_xPathBox->get_approximate_digit_width() * 20) + }; m_xPathBox->set_column_fixed_widths(aWidths); m_xNew->connect_clicked( LINK( this, DbRegistrationOptionsPage, NewHdl ) ); @@ -169,8 +172,10 @@ void DbRegistrationOptionsPage::Reset( const SfxItemSet* rSet ) { sal_Int32 nIdx {0}; // restore column width - std::vector<int> aWidths; - aWidths.push_back(aUserData.getToken(0, ';', nIdx).toInt32()); + std::vector<int> aWidths + { + aUserData.getToken(0, ';', nIdx).toInt32() + }; m_xPathBox->set_column_fixed_widths(aWidths); // restore sort direction bool bUp = aUserData.getToken(0, ';', nIdx).toInt32() != 0; diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx index 05e540a44221..67a34dec489e 100644 --- a/cui/source/options/fontsubs.cxx +++ b/cui/source/options/fontsubs.cxx @@ -121,10 +121,7 @@ void SvxFontSubstTabPage::setColSizes(const Size& rSize) nMax = std::max(nMax, nMin); const int nDoubleMax = 2*nMax; const int nRest = rSize.Width() - nDoubleMax; - std::vector<int> aWidths; - aWidths.push_back(nMax); - aWidths.push_back(nMax); - aWidths.push_back(nRest/2); + std::vector<int> aWidths { nMax, nMax, nRest/2 }; m_xCheckLB->set_column_fixed_widths(aWidths); } diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 8a976277ca7c..1f5adbf73b11 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -7,6 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <o3tl/safeint.hxx> #include "optaboutconfig.hxx" #include <comphelper/processfactory.hxx> @@ -155,10 +156,12 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage(weld::Window* pParent) util::SearchFlags::REG_NOT_ENDOFLINE); float fWidth = m_xPrefBox->get_approximate_digit_width(); - std::vector<int> aWidths; - aWidths.push_back(fWidth * 65); - aWidths.push_back(fWidth * 20); - aWidths.push_back(fWidth * 8); + std::vector<int> aWidths + { + o3tl::narrowing<int>(fWidth * 65), + o3tl::narrowing<int>(fWidth * 20), + o3tl::narrowing<int>(fWidth * 8) + }; m_xPrefBox->set_column_fixed_widths(aWidths); } diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 945202e75ce6..7e3ebc7a9ced 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -18,6 +18,7 @@ */ #include <editeng/unolingu.hxx> +#include <o3tl/safeint.hxx> #include <svx/dialmgr.hxx> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/linguistic2/XDictionary.hpp> @@ -235,8 +236,10 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, std::u16 m_xSingleColumnLB->connect_changed(LINK(this, SvxEditDictionaryDialog, SelectHdl)); m_xDoubleColumnLB->connect_changed(LINK(this, SvxEditDictionaryDialog, SelectHdl)); - std::vector<int> aWidths; - aWidths.push_back(m_xDoubleColumnLB->get_approximate_digit_width() * 22); + std::vector<int> aWidths + { + o3tl::narrowing<int>(m_xDoubleColumnLB->get_approximate_digit_width() * 22) + }; m_xDoubleColumnLB->set_column_fixed_widths(aWidths); // install handler diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index 8624675f0b26..607f7759b614 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -137,9 +137,11 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2(weld::Container* pPage, weld::DialogCon , m_xShadingRB(m_xBuilder->weld_radio_button("shading")) , m_xMSOLockFileCB(m_xBuilder->weld_check_button("mso_lockfile")) { - std::vector<int> aWidths; - aWidths.push_back(m_xCheckLB->get_checkbox_column_width()); - aWidths.push_back(m_xCheckLB->get_checkbox_column_width()); + std::vector<int> aWidths + { + m_xCheckLB->get_checkbox_column_width(), + m_xCheckLB->get_checkbox_column_width() + }; m_xCheckLB->set_column_fixed_widths(aWidths); } diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 0d1414026364..ce535b9f6a6c 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/safeint.hxx> #include <sal/config.h> #include <sal/log.hxx> @@ -91,9 +92,11 @@ SvxJavaOptionsPage::SvxJavaOptionsPage(weld::Container* pPage, weld::DialogContr m_xJavaList->connect_toggled( LINK( this, SvxJavaOptionsPage, CheckHdl_Impl ) ); m_xJavaList->connect_changed( LINK( this, SvxJavaOptionsPage, SelectHdl_Impl ) ); - std::vector<int> aWidths; - aWidths.push_back(m_xJavaList->get_checkbox_column_width()); - aWidths.push_back(m_xJavaList->get_pixel_size("Sun Microsystems Inc.").Width()); + std::vector<int> aWidths + { + m_xJavaList->get_checkbox_column_width(), + o3tl::narrowing<int>(m_xJavaList->get_pixel_size("Sun Microsystems Inc.").Width()) + }; m_xJavaList->set_column_fixed_widths(aWidths); m_xJavaEnableCB->connect_toggled( LINK( this, SvxJavaOptionsPage, EnableHdl_Impl ) ); diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx index b8ae35dba1e3..d9acbd18f537 100644 --- a/cui/source/options/webconninfo.cxx +++ b/cui/source/options/webconninfo.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/safeint.hxx> #include "webconninfo.hxx" #include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/PasswordContainer.hpp> @@ -41,8 +42,10 @@ WebConnectionInfoDialog::WebConnectionInfoDialog(weld::Window* pParent) , m_xChangeBtn(m_xBuilder->weld_button("change")) , m_xPasswordsLB(m_xBuilder->weld_tree_view("logins")) { - std::vector<int> aWidths; - aWidths.push_back(m_xPasswordsLB->get_approximate_digit_width() * 50); + std::vector<int> aWidths + { + o3tl::narrowing<int>(m_xPasswordsLB->get_approximate_digit_width() * 50) + }; m_xPasswordsLB->set_column_fixed_widths(aWidths); m_xPasswordsLB->set_size_request(m_xPasswordsLB->get_approximate_digit_width() * 70, m_xPasswordsLB->get_height_rows(8)); diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 881ef8b53454..b340a9954db1 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -18,6 +18,7 @@ */ #include <i18nutil/unicode.hxx> +#include <o3tl/safeint.hxx> #include <vcl/event.hxx> #include <vcl/keycodes.hxx> #include <vcl/settings.hxx> @@ -377,9 +378,11 @@ OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage(weld::Container* pPage, weld::D m_xCheckLB->connect_row_activated(LINK(this, OfaSwAutoFmtOptionsPage, DoubleClickEditHdl)); m_xCheckLB->enable_toggle_buttons(weld::ColumnToggleType::Check); - std::vector<int> aWidths; - aWidths.push_back(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(0)).Width() * 2); - aWidths.push_back(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(1)).Width() * 2); + std::vector<int> aWidths + { + o3tl::narrowing<int>(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(0)).Width() * 2), + o3tl::narrowing<int>(m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(1)).Width() * 2) + }; m_xCheckLB->set_column_fixed_widths(aWidths); m_xEditPB->connect_clicked(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); @@ -1584,9 +1587,11 @@ OfaQuoteTabPage::OfaQuoteTabPage(weld::Container* pPage, weld::DialogController* if ( bShowSWOptions ) { m_xSwCheckLB->enable_toggle_buttons(weld::ColumnToggleType::Check); - std::vector<int> aWidths; - aWidths.push_back(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(0)).Width() * 2); - aWidths.push_back(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(1)).Width() * 2); + std::vector<int> aWidths + { + o3tl::narrowing<int>(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(0)).Width() * 2), + o3tl::narrowing<int>(m_xSwCheckLB->get_pixel_size(m_xSwCheckLB->get_column_title(1)).Width() * 2) + }; m_xSwCheckLB->set_column_fixed_widths(aWidths); m_xCheckLB->hide(); } diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index 9d4c176810d2..94143e310ebd 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -18,7 +18,7 @@ */ #include <macroass.hxx> - +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <comphelper/string.hxx> #include <comphelper/processfactory.hxx> @@ -326,8 +326,10 @@ void SfxMacroTabPage::InitAndSetHandler() mpImpl->m_xGroupLB->connect_changed(LINK(this, SfxMacroTabPage, SelectGroup_Impl)); mpImpl->m_xMacroLB->connect_changed(LINK(this, SfxMacroTabPage, SelectMacro_Impl)); - std::vector<int> aWidths; - aWidths.push_back(rListBox.get_approximate_digit_width() * 35); + std::vector<int> aWidths + { + o3tl::narrowing<int>(rListBox.get_approximate_digit_width() * 35) + }; rListBox.set_column_fixed_widths(aWidths); mpImpl->m_xEventLB->show(); |