[Libreoffice-commits] core.git: desktop/source embeddedobj/source embeddedobj/test eventattacher/source filter/source forms/source formula/source fpicker/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 8 15:08:56 UTC 2021


 desktop/source/deployment/gui/dp_gui_updatedialog.cxx |   15 ++++++------
 embeddedobj/source/msole/oleembed.cxx                 |    4 ---
 embeddedobj/test/mtexecutor/bitmapcreator.cxx         |    9 ++++---
 embeddedobj/test/mtexecutor/mainthreadexecutor.cxx    |    9 ++++---
 eventattacher/source/eventattacher.cxx                |    3 --
 filter/source/msfilter/mstoolbar.cxx                  |    3 --
 filter/source/pdf/pdfdecomposer.cxx                   |    7 +-----
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx  |   21 ++++++++----------
 forms/source/component/ListBox.cxx                    |   20 ++++++++---------
 formula/source/ui/dlg/formula.cxx                     |   13 +++--------
 fpicker/source/office/iodlg.cxx                       |    4 ---
 11 files changed, 48 insertions(+), 60 deletions(-)

New commits:
commit c7a9a1dbe2b30afb564953ce1e856b95e3ec9436
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Tue Jun 8 13:35:11 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Tue Jun 8 17:08:06 2021 +0200

    Simplify Sequences initializations (desktop/e*/filter/forms/formula/fpicker)
    
    includes removing of unused TOKEN_SEP
    
    Change-Id: Ic72d9d94bd8d07232699ee4d948f3b203d524491
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116833
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 1e48fa7182f8..ae47ec42b22f 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -664,24 +664,25 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly )
         sal_Int32 nCount = 0;
         for (sal_uInt16 i = 0, nItemCount = m_xUpdates->n_children(); i < nItemCount; ++i)
         {
-            uno::Sequence< OUString > aItem(2);
 
             UpdateDialog::Index const * p = reinterpret_cast< UpdateDialog::Index const * >(m_xUpdates->get_id(i).toInt64());
 
             if ( p->m_eKind == ENABLED_UPDATE )
             {
                 dp_gui::UpdateData aUpdData = m_enabledUpdates[ p->m_nIndex ];
-                aItem[0] = dp_misc::getIdentifier( aUpdData.aInstalledPackage );
 
                 dp_misc::DescriptionInfoset aInfoset( m_context, aUpdData.aUpdateInfo );
-                aItem[1] = aInfoset.getVersion();
+                uno::Sequence< OUString > aItem
+                {
+                    dp_misc::getIdentifier( aUpdData.aInstalledPackage ),
+                    aInfoset.getVersion()
+                };
+                aItemList.realloc( nCount + 1 );
+                aItemList[ nCount ] = aItem;
+                nCount += 1;
             }
             else
                 continue;
-
-            aItemList.realloc( nCount + 1 );
-            aItemList[ nCount ] = aItem;
-            nCount += 1;
         }
     }
 
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 926f5b9e9393..8c23a4429895 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -91,9 +91,7 @@ void OleEmbeddedObject::SwitchComponentToRunningState_Impl()
 uno::Sequence< sal_Int32 > OleEmbeddedObject::GetReachableStatesList_Impl(
                                                         const uno::Sequence< embed::VerbDescriptor >& aVerbList )
 {
-    uno::Sequence< sal_Int32 > aStates(2);
-    aStates[0] = embed::EmbedStates::LOADED;
-    aStates[1] = embed::EmbedStates::RUNNING;
+    uno::Sequence< sal_Int32 > aStates { embed::EmbedStates::LOADED, embed::EmbedStates::RUNNING };
     for ( embed::VerbDescriptor const & vd : aVerbList )
         if ( vd.VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN )
         {
diff --git a/embeddedobj/test/mtexecutor/bitmapcreator.cxx b/embeddedobj/test/mtexecutor/bitmapcreator.cxx
index 458c085ae111..60a89f8cd078 100644
--- a/embeddedobj/test/mtexecutor/bitmapcreator.cxx
+++ b/embeddedobj/test/mtexecutor/bitmapcreator.cxx
@@ -29,10 +29,11 @@ using namespace ::com::sun::star;
 
 uno::Sequence< OUString > SAL_CALL VCLBitmapCreator::impl_staticGetSupportedServiceNames()
 {
-    uno::Sequence< OUString > aRet(2);
-    aRet[0] = "com.sun.star.embed.BitmapCreator";
-    aRet[1] = "com.sun.star.comp.embed.BitmapCreator";
-    return aRet;
+    return
+    {
+        "com.sun.star.embed.BitmapCreator",
+        "com.sun.star.comp.embed.BitmapCreator"
+    };
 }
 
 
diff --git a/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx b/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx
index 1fc7d2e3cc31..82a124a2c969 100644
--- a/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx
+++ b/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx
@@ -27,10 +27,11 @@ using namespace ::com::sun::star;
 
 uno::Sequence< OUString > SAL_CALL MainThreadExecutor::impl_staticGetSupportedServiceNames()
 {
-    uno::Sequence< OUString > aRet(2);
-    aRet[0] = "com.sun.star.thread.MainThreadExecutor";
-    aRet[1] = "com.sun.star.comp.thread.MainThreadExecutor";
-    return aRet;
+    return
+    {
+        "com.sun.star.thread.MainThreadExecutor",
+        "com.sun.star.comp.thread.MainThreadExecutor"
+    }
 }
 
 
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 399062a530af..8a3b3af93338 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -96,8 +96,7 @@ static Reference< XInterface > createAllListenerAdapter
         Reference< XInvocation > xInvocationToAllListenerMapper =
             new InvocationToAllListenerMapper(xListenerType, xListener, Helper);
         Type aListenerType( xListenerType->getTypeClass(), xListenerType->getName());
-        Sequence<Type> arg2(1);
-        arg2[0] = aListenerType;
+        Sequence<Type> arg2 { aListenerType };
         xAdapter = xInvocationAdapterFactory->createAdapter( xInvocationToAllListenerMapper, arg2 );
     }
     return xAdapter;
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 817844e2364b..d857c611719d 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -53,8 +53,7 @@ void CustomToolBarImportHelper::applyIcons()
     for (auto const& concommand : iconcommands)
     {
         uno::Sequence<OUString> commands { concommand.sCommand };
-        uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
-        images[ 0 ] = concommand.image;
+        uno::Sequence< uno::Reference< graphic::XGraphic > > images { concommand.image };
 
         uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
         sal_uInt16 nColor = ui::ImageType::COLOR_NORMAL;
diff --git a/filter/source/pdf/pdfdecomposer.cxx b/filter/source/pdf/pdfdecomposer.cxx
index f4572f93742a..1118021a6377 100644
--- a/filter/source/pdf/pdfdecomposer.cxx
+++ b/filter/source/pdf/pdfdecomposer.cxx
@@ -89,11 +89,8 @@ XPdfDecomposer::getDecomposition(const uno::Reference<util::XBinaryDataContainer
         0));
 
     // create primitive
-    uno::Sequence<uno::Reference<graphic::XPrimitive2D>> aSequence(1);
-    aSequence[0] = new drawinglayer::primitive2d::BitmapPrimitive2D(
-        VCLUnoHelper::CreateVCLXBitmap(aReplacement), aBitmapTransform);
-
-    return aSequence;
+    return { new drawinglayer::primitive2d::BitmapPrimitive2D(
+        VCLUnoHelper::CreateVCLXBitmap(aReplacement), aBitmapTransform) };
 }
 
 OUString SAL_CALL XPdfDecomposer::getImplementationName()
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 3124ee5b9855..c06a9ec1b5cc 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -1306,17 +1306,16 @@ bool filter_info_impl::operator==( const filter_info_impl& r ) const
 
 Sequence< OUString > filter_info_impl::getFilterUserData() const
 {
-    Sequence< OUString > aUserData(8);
-
-    aUserData[0] = "com.sun.star.documentconversion.XSLTFilter";
-    aUserData[1] = OUString::boolean( mbNeedsXSLT2 );
-    aUserData[2] = maImportService;
-    aUserData[3] = maExportService;
-    aUserData[4] = maImportXSLT;
-    aUserData[5] = maExportXSLT;
-    aUserData[7] = maComment;
-
-    return aUserData;
+    return
+    {
+        "com.sun.star.documentconversion.XSLTFilter",
+        OUString::boolean( mbNeedsXSLT2 ),
+        maImportService,
+        maExportService,
+        maImportXSLT,
+        maExportXSLT,
+        maComment
+    };
 }
 
 OUString string_encode( const OUString & rText )
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index 42dc08aee90d..e998e701f57c 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -1271,8 +1271,7 @@ namespace frm
             aValue <<= m_aDefaultSelectSeq;
         else if (m_nNULLPos != -1)  // bound Listbox
         {
-            Sequence<sal_Int16> aSeq(1);
-            aSeq.getArray()[0] = m_nNULLPos;
+            Sequence<sal_Int16> aSeq { m_nNULLPos };
             aValue <<= aSeq;
         }
         else
@@ -1707,14 +1706,15 @@ namespace frm
 
     Sequence< Type > OListBoxModel::getSupportedBindingTypes()
     {
-        Sequence< Type > aTypes(6);
-        aTypes[0] = cppu::UnoType<Sequence< Any >>::get();
-        aTypes[1] = cppu::UnoType<Any>::get();
-        aTypes[2] = cppu::UnoType<Sequence< sal_Int32 >>::get();
-        aTypes[3] = cppu::UnoType<sal_Int32>::get();
-        aTypes[4] = cppu::UnoType<Sequence< OUString >>::get();
-        aTypes[5] = cppu::UnoType<OUString>::get();
-        return aTypes;
+        return
+        {
+            cppu::UnoType<Sequence< Any >>::get(),
+            cppu::UnoType<Any>::get(),
+            cppu::UnoType<Sequence< sal_Int32 >>::get(),
+            cppu::UnoType<sal_Int32>::get(),
+            cppu::UnoType<Sequence< OUString >>::get(),
+            cppu::UnoType<OUString>::get()
+        };
     }
 
 
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 22b79396d3d3..81931d8d586b 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -50,7 +50,6 @@
 // For tab page
 #define TOKEN_OPEN  0
 #define TOKEN_CLOSE 1
-#define TOKEN_SEP   2
 namespace formula
 {
 
@@ -355,10 +354,8 @@ void FormulaDlg_Impl::InitFormulaOpCodeMapper()
     m_aFunctionOpCodes = m_xOpCodeMapper->getAvailableMappings( sheet::FormulaLanguage::ODFF, sheet::FormulaMapGroup::FUNCTIONS);
     m_pFunctionOpCodesEnd = m_aFunctionOpCodes.getConstArray() + m_aFunctionOpCodes.getLength();
 
-    uno::Sequence< OUString > aArgs(3);
-    aArgs[TOKEN_OPEN]   = "(";
-    aArgs[TOKEN_CLOSE]  = ")";
-    aArgs[TOKEN_SEP]    = ";";
+    // 0:TOKEN_OPEN, 1:TOKEN_CLOSE, 2:TOKEN_SEP
+    uno::Sequence< OUString > aArgs { "(", ")", ";" };
     m_aSeparatorsOpCodes = m_xOpCodeMapper->getMappings( aArgs, sheet::FormulaLanguage::ODFF);
 
     m_aSpecialOpCodes = m_xOpCodeMapper->getAvailableMappings( sheet::FormulaLanguage::ODFF, sheet::FormulaMapGroup::SPECIAL);
@@ -395,8 +392,7 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
         while ( pIter != pEnd )
         {
             const sal_Int32 eOp = pIter->OpCode;
-            uno::Sequence<sheet::FormulaToken> aArgs(1);
-            aArgs[0] = *pIter;
+            uno::Sequence<sheet::FormulaToken> aArgs { *pIter };
             const OUString aString = xParser->printFormula( aArgs, aRefPos);
             const sheet::FormulaToken* pNextToken = pIter + 1;
 
@@ -593,12 +589,11 @@ void FormulaDlg_Impl::MakeTree(StructPage* _pTree, weld::TreeIter* pParent, cons
 
     // #i101512# for output, the original token is needed
     const FormulaToken* pOrigToken = (_pToken->GetType() == svFAP) ? _pToken->GetFAPOrigToken() : _pToken;
-    uno::Sequence<sheet::FormulaToken> aArgs(1);
     ::std::map<const FormulaToken*, sheet::FormulaToken>::const_iterator itr = m_aTokenMap.find(pOrigToken);
     if (itr == m_aTokenMap.end())
         return;
 
-    aArgs[0] = itr->second;
+    uno::Sequence<sheet::FormulaToken> aArgs { itr->second };
     try
     {
         const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index acbe04e43d54..2f22d3d48b19 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -1462,9 +1462,7 @@ bool SvtFileDialog::PrepareExecute()
                                                     INetURLObject::DecodeMechanism::NONE ),
                                  Reference< XCommandEnvironment >(),
                                  comphelper::getProcessComponentContext() );
-            Sequence< OUString > aProps(2);
-            aProps[0] = "IsVolume";
-            aProps[1] = "IsRemoveable";
+            Sequence< OUString > aProps { "IsVolume", "IsRemoveable" };
 
             Reference< XResultSet > xResultSet
                 = aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_ONLY );


More information about the Libreoffice-commits mailing list