summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-10-16 13:43:59 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-10-16 18:13:21 +0200
commit9d98fadd5e943f4c3f87d0c269815c7a0feee217 (patch)
tree74827bbbed43efe0c55b472adccb8f392179de81 /svx
parentedf82470de0f7796992666a0c2b5c56dc66c94fd (diff)
Simplify vector initialization in svx
Change-Id: I139776f74fb93f90dae787eeae18e4a2a2ed7351 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123700 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'svx')
-rw-r--r--svx/qa/unit/svdraw/test_SdrTextObject.cxx7
-rw-r--r--svx/source/dialog/ctredlin.cxx23
-rw-r--r--svx/source/dialog/docrecovery.cxx11
-rw-r--r--svx/source/form/datanavi.cxx7
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx5
-rw-r--r--svx/source/sidebar/inspector/InspectorTextPanel.cxx4
-rw-r--r--svx/source/tbxctrls/PaletteManager.cxx7
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx9
8 files changed, 41 insertions, 32 deletions
diff --git a/svx/qa/unit/svdraw/test_SdrTextObject.cxx b/svx/qa/unit/svdraw/test_SdrTextObject.cxx
index 93b06272fd3d..218db2a52f0e 100644
--- a/svx/qa/unit/svdraw/test_SdrTextObject.cxx
+++ b/svx/qa/unit/svdraw/test_SdrTextObject.cxx
@@ -27,11 +27,8 @@ public:
void SdrTextObjTest::AllFamiliesCanBeRestoredFromSavedString()
{
- std::vector<SfxStyleFamily> allFamilies;
- allFamilies.push_back(SfxStyleFamily::Char);
- allFamilies.push_back(SfxStyleFamily::Para);
- allFamilies.push_back(SfxStyleFamily::Page);
- allFamilies.push_back(SfxStyleFamily::Pseudo);
+ std::vector<SfxStyleFamily> allFamilies{ SfxStyleFamily::Char, SfxStyleFamily::Para,
+ SfxStyleFamily::Page, SfxStyleFamily::Pseudo };
for (SfxStyleFamily family : allFamilies)
{
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 3797df20d398..78b9974ec05d 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -20,6 +20,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <o3tl/safeint.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/weldutils.hxx>
@@ -358,10 +359,12 @@ void SvxRedlinTable::SetWriterView()
pTreeView = xWriterTreeView.get();
auto nDigitWidth = pTreeView->get_approximate_digit_width();
- std::vector<int> aWidths;
- aWidths.push_back(nDigitWidth * 10);
- aWidths.push_back(nDigitWidth * 20);
- aWidths.push_back(nDigitWidth * 20);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(nDigitWidth * 10),
+ o3tl::narrowing<int>(nDigitWidth * 20),
+ o3tl::narrowing<int>(nDigitWidth * 20)
+ };
pTreeView->set_column_fixed_widths(aWidths);
}
@@ -374,11 +377,13 @@ void SvxRedlinTable::SetCalcView()
pTreeView = xCalcTreeView.get();
auto nDigitWidth = pTreeView->get_approximate_digit_width();
- std::vector<int> aWidths;
- aWidths.push_back(nDigitWidth * 20);
- aWidths.push_back(nDigitWidth * 20);
- aWidths.push_back(nDigitWidth * 20);
- aWidths.push_back(nDigitWidth * 20);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(nDigitWidth * 20),
+ o3tl::narrowing<int>(nDigitWidth * 20),
+ o3tl::narrowing<int>(nDigitWidth * 20),
+ o3tl::narrowing<int>(nDigitWidth * 20)
+ };
pTreeView->set_column_fixed_widths(aWidths);
}
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 1c86f078042f..94130ae491e7 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -24,6 +24,7 @@
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/safeint.hxx>
#include <svtools/imagemgr.hxx>
#include <sfx2/filedlghelper.hxx>
#include <tools/urlobj.hxx>
@@ -657,10 +658,12 @@ RecoveryDialog::RecoveryDialog(weld::Window* pParent, RecoveryCore* pCore)
m_xProgressBar->set_size_request(m_xProgressBar->get_approximate_digit_width() * 50, -1);
m_xProgress = new PluginProgress(m_xProgressBar.get());
- std::vector<int> aWidths;
- aWidths.push_back(m_xFileListLB->get_checkbox_column_width());
- aWidths.push_back(60 * nWidth / 100);
- aWidths.push_back(m_xFileListLB->get_checkbox_column_width());
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xFileListLB->get_checkbox_column_width()),
+ o3tl::narrowing<int>(60 * nWidth / 100),
+ o3tl::narrowing<int>(m_xFileListLB->get_checkbox_column_width())
+ };
m_xFileListLB->set_column_fixed_widths(aWidths);
m_xNextBtn->set_sensitive(true);
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 45d7f8ab284e..4d5ac51af1d3 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -27,6 +27,7 @@
#include <bitmaps.hlst>
#include <fpicker/strings.hrc>
+#include <o3tl/safeint.hxx>
#include <o3tl/string_view.hxx>
#include <svx/svxids.hrc>
#include <tools/diagnose_ex.h>
@@ -2636,8 +2637,10 @@ namespace svxform
m_xNamespacesList->set_size_request(m_xNamespacesList->get_approximate_digit_width() * 80,
m_xNamespacesList->get_height_rows(8));
- std::vector<int> aWidths;
- aWidths.push_back(m_xNamespacesList->get_approximate_digit_width() * 20);
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_xNamespacesList->get_approximate_digit_width() * 20)
+ };
m_xNamespacesList->set_column_fixed_widths(aWidths);
m_xNamespacesList->connect_changed( LINK( this, NamespaceItemDialog, SelectHdl ) );
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index dd76b03eb251..cea6791b2c8a 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -498,10 +498,7 @@ basegfx::B2DRange getTextAnchorRange(const attribute::SdrTextAttribute& rText,
pNew.clear();
// create a new animatedInterpolatePrimitive and add it
- std::vector< basegfx::B2DHomMatrix > aMatrixStack;
- aMatrixStack.push_back(aLeft);
- aMatrixStack.push_back(aRight);
- Primitive2DReference xRefA(new AnimatedInterpolatePrimitive2D(aMatrixStack, aAnimationList, std::move(aAnimSequence)));
+ Primitive2DReference xRefA(new AnimatedInterpolatePrimitive2D({ aLeft, aRight }, aAnimationList, std::move(aAnimSequence)));
Primitive2DContainer aContent { xRefA };
// scrolling needs an encapsulating clipping primitive
diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
index 3bcf30be9698..bdd87eef538d 100644
--- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx
+++ b/svx/source/sidebar/inspector/InspectorTextPanel.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 <string_view>
@@ -51,8 +52,7 @@ InspectorTextPanel::InspectorTextPanel(weld::Widget* pParent)
{
mpListBoxStyles->set_size_request(MinimumPanelWidth, -1);
float fWidth = mpListBoxStyles->get_approximate_digit_width();
- std::vector<int> aWidths;
- aWidths.push_back(fWidth * 29);
+ std::vector<int> aWidths{ o3tl::narrowing<int>(fWidth * 29) };
// 2nd column will fill remaining space
mpListBoxStyles->set_column_fixed_widths(aWidths);
}
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 7bb067952438..22ee2ef483a5 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -178,9 +178,10 @@ void PaletteManager::ReloadRecentColorSet(SvxColorValueSet& rColorSet)
std::vector<OUString> PaletteManager::GetPaletteList()
{
- std::vector<OUString> aPaletteNames;
-
- aPaletteNames.push_back( SvxResId( RID_SVXSTR_CUSTOM_PAL ) );
+ std::vector<OUString> aPaletteNames
+ {
+ SvxResId( RID_SVXSTR_CUSTOM_PAL )
+ };
for (auto const& it : m_Palettes)
{
aPaletteNames.push_back( (*it).GetName() );
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index 6e164ff56ed8..345a0ce803e8 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/linguistic2/XConversionPropertyType.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include <com/sun/star/lang/Locale.hpp>
+#include <o3tl/safeint.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/linguprops.hxx>
#include <osl/diagnose.h>
@@ -278,9 +279,11 @@ void DictionaryList::init(const Reference< linguistic2::XConversionDictionary>&
m_xControl->set_sort_column(0);
m_xControl->set_sort_indicator(TRISTATE_TRUE, 0);
- std::vector<int> aWidths;
- aWidths.push_back(m_pED_Term->get_preferred_size().Width());
- aWidths.push_back(m_pED_Mapping->get_preferred_size().Width());
+ std::vector<int> aWidths
+ {
+ o3tl::narrowing<int>(m_pED_Term->get_preferred_size().Width()),
+ o3tl::narrowing<int>(m_pED_Mapping->get_preferred_size().Width())
+ };
m_xControl->set_column_fixed_widths(aWidths);
}