basctl/source/dlged/dlged.cxx     |   14 +--
 basic/qa/cppunit/test_vba.cxx     |    8 +
 basic/source/classes/sbxmod.cxx   |   12 +-
 basic/source/runtime/methods1.cxx |  166 +++++++++++++++++++++-----------------
 4 files changed, 114 insertions(+), 86 deletions(-)

New commits:
commit cf3971a9414f52b116c1c21f267128ffa67f171b
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sun Oct 17 13:18:11 2021 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sun Oct 17 14:13:10 2021 +0200

    Simplify Sequence in b*
    
    Change-Id: I0817d9a35a9c3fc43badb6cc60727de69849b063
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123720
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 34467260c140..203fa9cc44b9 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -763,10 +763,8 @@ void DlgEditor::Copy()
         xStream2->closeInput();
 
         // Old format contains dialog with replaced ids
-        Sequence< Any > aSeqData(2);
         Any aNoResourceDialogModelBytesAny;
         aNoResourceDialogModelBytesAny <<= NoResourceDialogModelBytes;
-        aSeqData[0] = aNoResourceDialogModelBytesAny;
 
         // New format contains dialog and resource
         Sequence< sal_Int8 > aResData = 
xStringResourcePersistence->exportBinary();
@@ -792,18 +790,18 @@ void DlgEditor::Copy()
         memcpy( pCombinedData + 4, DialogModelBytes.getConstArray(), 
nDialogDataLen );
         memcpy( pCombinedData + nResOffset, aResData.getConstArray(), 
nResDataLen );
 
-        aSeqData[1] <<= aCombinedData;
+        Sequence< Any > aSeqData
+        {
+            aNoResourceDialogModelBytesAny,
+            makeAny(aCombinedData)
+        };
 
         pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavorsResource, 
aSeqData );
     }
     else
     {
         // No resource, support only old format
-        Sequence< Any > aSeqData(1);
-        Any aDialogModelBytesAny;
-        aDialogModelBytesAny <<= DialogModelBytes;
-        aSeqData[0] = aDialogModelBytesAny;
-        pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavors , aSeqData 
);
+        pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavors , { 
makeAny(DialogModelBytes) } );
     }
     SolarMutexReleaser aReleaser;
     xClipboard->setContents( pTrans , pTrans );
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 9ea572201a30..e4436632fd84 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -226,13 +226,15 @@ void VBATest::testMiscOLEStuff()
 
     OUString sMacroPathURL = 
m_directories.getURLFromSrc(u"/basic/qa/vba_tests/");
 
-    uno::Sequence< uno::Any > aArgs(2);
     // path to test document
     OUString sPath = 
m_directories.getPathFromSrc(u"/basic/qa/vba_tests/data/ADODBdata.xls");
     sPath = sPath.replaceAll( "/", "\\" );
 
-    aArgs[ 0 ] <<= sPath;
-    aArgs[ 1 ] <<= OUString(o3tl::toU(pODBCDriverName));
+    uno::Sequence< uno::Any > aArgs
+    {
+        makeAny(sPath),
+        makeAny(OUString(o3tl::toU(pODBCDriverName)))
+    };
 
     for ( sal_uInt32  i=0; i<SAL_N_ELEMENTS( macroSource ); ++i )
     {
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index df69b7dc6e6b..7771c0575f61 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2609,11 +2609,13 @@ void SbUserFormModule::InitObject()
             m_xDialog = xProvider->createDialog( sDialogUrl );
 
             // create vba api object
-            uno::Sequence< uno::Any > aArgs(4);
-            aArgs[ 0 ] = uno::Any();
-            aArgs[ 1 ] <<= m_xDialog;
-            aArgs[ 2 ] <<= m_xModel;
-            aArgs[ 3 ] <<= GetParent()->GetName();
+            uno::Sequence< uno::Any > aArgs
+            {
+                uno::Any(),
+                makeAny(m_xDialog),
+                makeAny(m_xModel),
+                makeAny(GetParent()->GetName())
+            };
             pDocObject = new SbUnoObject( GetName(), uno::Any( 
xVBAFactory->createInstanceWithArguments( "ooo.vba.msforms.UserForm", aArgs  ) 
) );
 
             uno::Reference< lang::XComponent > xComponent( m_xDialog, 
uno::UNO_QUERY_THROW );
diff --git a/basic/source/runtime/methods1.cxx 
b/basic/source/runtime/methods1.cxx
index e750627943d6..8351100c9b62 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -2448,11 +2448,13 @@ void SbRtl_SYD(StarBASIC *, SbxArray & rPar, bool)
 
     // retrieve non-optional params
 
-    Sequence< Any > aParams( 4 );
-    aParams[0] <<= rPar.Get(1)->GetDouble();
-    aParams[1] <<= rPar.Get(2)->GetDouble();
-    aParams[2] <<= rPar.Get(3)->GetDouble();
-    aParams[3] <<= rPar.Get(4)->GetDouble();
+    Sequence< Any > aParams
+    {
+        makeAny(rPar.Get(1)->GetDouble()),
+        makeAny(rPar.Get(2)->GetDouble()),
+        makeAny(rPar.Get(3)->GetDouble()),
+        makeAny(rPar.Get(4)->GetDouble())
+    };
 
     CallFunctionAccessFunction(aParams, "SYD", rPar.Get(0));
 }
@@ -2469,10 +2471,12 @@ void SbRtl_SLN(StarBASIC *, SbxArray & rPar, bool)
 
     // retrieve non-optional params
 
-    Sequence< Any > aParams( 3 );
-    aParams[0] <<= rPar.Get(1)->GetDouble();
-    aParams[1] <<= rPar.Get(2)->GetDouble();
-    aParams[2] <<= rPar.Get(3)->GetDouble();
+    Sequence< Any > aParams
+    {
+        makeAny(rPar.Get(1)->GetDouble()),
+        makeAny(rPar.Get(2)->GetDouble()),
+        makeAny(rPar.Get(3)->GetDouble())
+    };
 
     CallFunctionAccessFunction(aParams, "SLN", rPar.Get(0));
 }
@@ -2509,12 +2513,14 @@ void SbRtl_Pmt(StarBASIC *, SbxArray & rPar, bool)
             type = rPar.Get(5)->GetDouble();
     }
 
-    Sequence< Any > aParams( 5 );
-    aParams[ 0 ] <<= rate;
-    aParams[ 1 ] <<= nper;
-    aParams[ 2 ] <<= pmt;
-    aParams[ 3 ] <<= fv;
-    aParams[ 4 ] <<= type;
+    Sequence< Any > aParams
+    {
+        makeAny(rate),
+        makeAny(nper),
+        makeAny(pmt),
+        makeAny(fv),
+        makeAny(type)
+    };
 
     CallFunctionAccessFunction(aParams, "Pmt", rPar.Get(0));
 }
@@ -2552,13 +2558,15 @@ void SbRtl_PPmt(StarBASIC *, SbxArray & rPar, bool)
             type = rPar.Get(6)->GetDouble();
     }
 
-    Sequence< Any > aParams( 6 );
-    aParams[ 0 ] <<= rate;
-    aParams[ 1 ] <<= per;
-    aParams[ 2 ] <<= nper;
-    aParams[ 3 ] <<= pv;
-    aParams[ 4 ] <<= fv;
-    aParams[ 5 ] <<= type;
+    Sequence< Any > aParams
+    {
+        makeAny(rate),
+        makeAny(per),
+        makeAny(nper),
+        makeAny(pv),
+        makeAny(fv),
+        makeAny(type)
+    };
 
     CallFunctionAccessFunction(aParams, "PPmt", rPar.Get(0));
 }
@@ -2595,12 +2603,14 @@ void SbRtl_PV(StarBASIC *, SbxArray & rPar, bool)
             type = rPar.Get(5)->GetDouble();
     }
 
-    Sequence< Any > aParams( 5 );
-    aParams[ 0 ] <<= rate;
-    aParams[ 1 ] <<= nper;
-    aParams[ 2 ] <<= pmt;
-    aParams[ 3 ] <<= fv;
-    aParams[ 4 ] <<= type;
+    Sequence< Any > aParams
+    {
+        makeAny(rate),
+        makeAny(nper),
+        makeAny(pmt),
+        makeAny(fv),
+        makeAny(type)
+    };
 
     CallFunctionAccessFunction(aParams, "PV", rPar.Get(0));
 }
@@ -2615,8 +2625,6 @@ void SbRtl_NPV(StarBASIC *, SbxArray & rPar, bool)
         return;
     }
 
-    Sequence< Any > aParams( 2 );
-    aParams[0] <<= rPar.Get(1)->GetDouble();
     Any aValues = sbxToUnoValue(rPar.Get(2),
                 cppu::UnoType<Sequence<double>>::get() );
 
@@ -2625,7 +2633,11 @@ void SbRtl_NPV(StarBASIC *, SbxArray & rPar, bool)
     aValues >>= sValues[ 0 ];
     aValues <<= sValues;
 
-    aParams[ 1 ] = aValues;
+    Sequence< Any > aParams
+    {
+        makeAny(rPar.Get(1)->GetDouble()),
+        aValues
+    };
 
     CallFunctionAccessFunction(aParams, "NPV", rPar.Get(0));
 }
@@ -2662,12 +2674,14 @@ void SbRtl_NPer(StarBASIC *, SbxArray & rPar, bool)
             type = rPar.Get(5)->GetDouble();
     }
 
-    Sequence< Any > aParams( 5 );
-    aParams[ 0 ] <<= rate;
-    aParams[ 1 ] <<= pmt;
-    aParams[ 2 ] <<= pv;
-    aParams[ 3 ] <<= fv;
-    aParams[ 4 ] <<= type;
+    Sequence< Any > aParams
+    {
+        makeAny(rate),
+        makeAny(pmt),
+        makeAny(pv),
+        makeAny(fv),
+        makeAny(type)
+    };
 
     CallFunctionAccessFunction(aParams, "NPer", rPar.Get(0));
 }
@@ -2684,7 +2698,6 @@ void SbRtl_MIRR(StarBASIC *, SbxArray & rPar, bool)
 
     // retrieve non-optional params
 
-    Sequence< Any > aParams( 3 );
     Any aValues = sbxToUnoValue(rPar.Get(1),
                 cppu::UnoType<Sequence<double>>::get() );
 
@@ -2693,9 +2706,12 @@ void SbRtl_MIRR(StarBASIC *, SbxArray & rPar, bool)
     aValues >>= sValues[ 0 ];
     aValues <<= sValues;
 
-    aParams[ 0 ] = aValues;
-    aParams[1] <<= rPar.Get(2)->GetDouble();
-    aParams[2] <<= rPar.Get(3)->GetDouble();
+    Sequence< Any > aParams
+    {
+        aValues,
+        makeAny(rPar.Get(2)->GetDouble()),
+        makeAny(rPar.Get(3)->GetDouble())
+    };
 
     CallFunctionAccessFunction(aParams, "MIRR", rPar.Get(0));
 }
@@ -2727,9 +2743,11 @@ void SbRtl_IRR(StarBASIC *, SbxArray & rPar, bool)
             guess = rPar.Get(2)->GetDouble();
     }
 
-    Sequence< Any > aParams( 2 );
-    aParams[ 0 ] = aValues;
-    aParams[ 1 ] <<= guess;
+    Sequence< Any > aParams
+    {
+        aValues,
+        makeAny(guess)
+    };
 
     CallFunctionAccessFunction(aParams, "IRR", rPar.Get(0));
 }
@@ -2767,13 +2785,15 @@ void SbRtl_IPmt(StarBASIC *, SbxArray & rPar, bool)
             type = rPar.Get(6)->GetDouble();
     }
 
-    Sequence< Any > aParams( 6 );
-    aParams[ 0 ] <<= rate;
-    aParams[ 1 ] <<= per;
-    aParams[ 2 ] <<= nper;
-    aParams[ 3 ] <<= pv;
-    aParams[ 4 ] <<= fv;
-    aParams[ 5 ] <<= type;
+    Sequence< Any > aParams
+    {
+        makeAny(rate),
+        makeAny(per),
+        makeAny(nper),
+        makeAny(pv),
+        makeAny(fv),
+        makeAny(type)
+    };
 
     CallFunctionAccessFunction(aParams, "IPmt", rPar.Get(0));
 }
@@ -2810,12 +2830,14 @@ void SbRtl_FV(StarBASIC *, SbxArray & rPar, bool)
             type = rPar.Get(5)->GetDouble();
     }
 
-    Sequence< Any > aParams( 5 );
-    aParams[ 0 ] <<= rate;
-    aParams[ 1 ] <<= nper;
-    aParams[ 2 ] <<= pmt;
-    aParams[ 3 ] <<= pv;
-    aParams[ 4 ] <<= type;
+    Sequence< Any > aParams
+    {
+        makeAny(rate),
+        makeAny(nper),
+        makeAny(pmt),
+        makeAny(pv),
+        makeAny(type)
+    };
 
     CallFunctionAccessFunction(aParams, "FV", rPar.Get(0));
 }
@@ -2846,12 +2868,14 @@ void SbRtl_DDB(StarBASIC *, SbxArray & rPar, bool)
             factor = rPar.Get(5)->GetDouble();
     }
 
-    Sequence< Any > aParams( 5 );
-    aParams[ 0 ] <<= cost;
-    aParams[ 1 ] <<= salvage;
-    aParams[ 2 ] <<= life;
-    aParams[ 3 ] <<= period;
-    aParams[ 4 ] <<= factor;
+    Sequence< Any > aParams
+    {
+        makeAny(cost),
+        makeAny(salvage),
+        makeAny(life),
+        makeAny(period),
+        makeAny(factor)
+    };
 
     CallFunctionAccessFunction(aParams, "DDB", rPar.Get(0));
 }
@@ -2901,13 +2925,15 @@ void SbRtl_Rate(StarBASIC *, SbxArray & rPar, bool)
             guess = rPar.Get(6)->GetDouble();
     }
 
-    Sequence< Any > aParams( 6 );
-    aParams[ 0 ] <<= nper;
-    aParams[ 1 ] <<= pmt;
-    aParams[ 2 ] <<= pv;
-    aParams[ 3 ] <<= fv;
-    aParams[ 4 ] <<= type;
-    aParams[ 5 ] <<= guess;
+    Sequence< Any > aParams
+    {
+        makeAny(nper),
+        makeAny(pmt),
+        makeAny(pv),
+        makeAny(fv),
+        makeAny(type),
+        makeAny(guess)
+    };
 
     CallFunctionAccessFunction(aParams, "Rate", rPar.Get(0));
 }

Reply via email to