summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-06-09 23:17:41 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-06-10 08:30:12 +0200
commit159030991c70fc3c4018ef28abf1814902a0aebb (patch)
tree02f3b436f205a71e32b3fbaa9c4ab21d2ab5f830
parent36db408b9027da01464927e5853950435596ae05 (diff)
Simplify Sequences initializations (sot/stock/svl/svtools/svx)
Change-Id: Iec21851d69f4a8d5f557e9ed2d30e5f680cd62c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116943 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--sot/source/sdstor/ucbstorage.cxx10
-rw-r--r--stoc/test/testregistry.cxx7
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.cxx26
-rw-r--r--svtools/source/control/inettbc.cxx15
-rw-r--r--svx/source/accessibility/charmapacc.cxx8
-rw-r--r--svx/source/fmcomp/gridcell.cxx15
-rw-r--r--svx/source/form/formcontroller.cxx13
-rw-r--r--svx/source/xml/xmleohlp.cxx2
8 files changed, 25 insertions, 71 deletions
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 162748e5b5d2..460b3c650fe3 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1670,20 +1670,14 @@ void UCBStorage_Impl::ReadContent()
m_bListCreated = true;
- // create cursor for access to children
- Sequence< OUString > aProps(4);
- aProps[0] = "Title";
- aProps[1] = "IsFolder";
- aProps[2] = "MediaType";
- aProps[3] = "Size";
-
try
{
GetContent();
if ( !m_pContent )
return;
- Reference< XResultSet > xResultSet = m_pContent->createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
+ // create cursor for access to children
+ Reference< XResultSet > xResultSet = m_pContent->createCursor( { "Title", "IsFolder", "MediaType", "Size" }, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
Reference< XRow > xRow( xResultSet, UNO_QUERY );
if ( xResultSet.is() )
{
diff --git a/stoc/test/testregistry.cxx b/stoc/test/testregistry.cxx
index d81328ac6f37..ef0d0a91d551 100644
--- a/stoc/test/testregistry.cxx
+++ b/stoc/test/testregistry.cxx
@@ -513,12 +513,7 @@ void test_DefaultRegistry(
OSL_ENSURE( seqValue.getArray()[2] == "come",
"test_DefaultRegistry error 13" );
- Sequence<sal_Int32> seqLong(3);
- seqLong.getArray()[0] = 1234;
- seqLong.getArray()[1] = 4567;
- seqLong.getArray()[2] = 7890;
-
- xKey->setLongListValue(seqLong);
+ xKey->setLongListValue({ 1234, 4567, 7890 });
Sequence<sal_Int32> seqLongValue = xKey->getLongListValue();
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 596a6e413db3..99f94c5eb809 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -231,15 +231,11 @@ PassMap StorageItem::getInfo()
void StorageItem::setUseStorage( bool bUse )
{
- Sequence< OUString > sendNames(1);
Sequence< uno::Any > sendVals(1);
-
- sendNames[0] = "UseStorage";
-
sendVals[0] <<= bUse;
ConfigItem::SetModified();
- ConfigItem::PutProperties( sendNames, sendVals );
+ ConfigItem::PutProperties( { "UseStorage" }, sendVals );
}
@@ -293,18 +289,14 @@ bool StorageItem::getEncodedMP( OUString& aResult )
void StorageItem::setEncodedMP( const OUString& aEncoded, bool bAcceptEmpty )
{
- Sequence< OUString > sendNames(2);
Sequence< uno::Any > sendVals(2);
- sendNames[0] = "HasMaster";
- sendNames[1] = "Master";
-
bool bHasMaster = ( !aEncoded.isEmpty() || bAcceptEmpty );
sendVals[0] <<= bHasMaster;
sendVals[1] <<= aEncoded;
ConfigItem::SetModified();
- ConfigItem::PutProperties( sendNames, sendVals );
+ ConfigItem::PutProperties( { "HasMaster", "Master" }, sendVals );
hasEncoded = bHasMaster;
mEncoded = aEncoded;
@@ -313,13 +305,8 @@ void StorageItem::setEncodedMP( const OUString& aEncoded, bool bAcceptEmpty )
void StorageItem::remove( const OUString& aURL, const OUString& aName )
{
- std::vector < OUString > forIndex;
- forIndex.push_back( aURL );
- forIndex.push_back( aName );
-
- Sequence< OUString > sendSeq(1);
-
- sendSeq[0] = createIndex( forIndex );
+ std::vector < OUString > forIndex { aURL, aName };
+ Sequence< OUString > sendSeq { createIndex( forIndex ) };
ConfigItem::ClearNodeElements( "Store", sendSeq );
}
@@ -673,18 +660,15 @@ UrlRecord SAL_CALL PasswordContainer::findForName( const OUString& aURL, const O
Sequence< UserRecord > PasswordContainer::FindUsr( const std::vector< NamePassRecord >& userlist, std::u16string_view aName, const Reference< XInteractionHandler >& aHandler )
{
- sal_uInt32 nInd = 0;
for (auto const& aNPIter : userlist)
{
if( aNPIter.GetUserName() == aName )
{
- Sequence< UserRecord > aResult(1);
bool bTryToDecode = true;
- aResult[0] = CopyToUserRecord( aNPIter, bTryToDecode, aHandler );
+ Sequence< UserRecord > aResult { CopyToUserRecord( aNPIter, bTryToDecode, aHandler ) };
return aResult;
}
- ++nInd;
}
return Sequence< UserRecord >();
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 83953ef1a469..c027e45ea129 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -317,31 +317,20 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL,
uno::Reference< XProgressHandler >() ),
comphelper::getProcessComponentContext() );
uno::Reference< XResultSet > xResultSet;
- Sequence< OUString > aProps(2);
- OUString* pProps = aProps.getArray();
- pProps[0] = "Title";
- pProps[1] = "IsFolder";
try
{
ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS;
if ( bOnlyDirectories )
eInclude = INCLUDE_FOLDERS_ONLY;
- uno::Reference< XDynamicResultSet > xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude );
+ uno::Reference< XDynamicResultSet > xDynResultSet = aCnt.createDynamicCursor( { "Title", "IsFolder" }, eInclude );
uno::Reference < XAnyCompareFactory > xCompare;
uno::Reference < XSortedDynamicResultSetFactory > xSRSFac =
SortedDynamicResultSetFactory::create( ::comphelper::getProcessComponentContext() );
- Sequence< NumberedSortingInfo > aSortInfo( 2 );
- NumberedSortingInfo* pInfo = aSortInfo.getArray();
- pInfo[ 0 ].ColumnIndex = 2;
- pInfo[ 0 ].Ascending = false;
- pInfo[ 1 ].ColumnIndex = 1;
- pInfo[ 1 ].Ascending = true;
-
uno::Reference< XDynamicResultSet > xDynamicResultSet =
- xSRSFac->createSortedDynamicResultSet( xDynResultSet, aSortInfo, xCompare );
+ xSRSFac->createSortedDynamicResultSet( xDynResultSet, { { 2, false }, { 1, true } }, xCompare );
if ( xDynamicResultSet.is() )
{
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index b70927a1c626..0de91ccee450 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -287,18 +287,14 @@ Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleRows( )
{
OExternalLockGuard aGuard( this );
- Sequence< sal_Int32 > aSel(1);
- aSel[0] = SvxShowCharSet::GetRowPos(m_pParent->GetSelectIndexId());
- return aSel;
+ return { SvxShowCharSet::GetRowPos(m_pParent->GetSelectIndexId()) };
}
Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleColumns( )
{
OExternalLockGuard aGuard( this );
- Sequence< sal_Int32 > aSel(1);
- aSel[0] = SvxShowCharSet::GetColumnPos(m_pParent->GetSelectIndexId());
- return aSel;
+ return { SvxShowCharSet::GetColumnPos(m_pParent->GetSelectIndexId()) };
}
sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleRowSelected( sal_Int32 nRow )
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index e1f01621024e..cb5129e89326 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -53,7 +53,7 @@
#include <comphelper/types.hxx>
#include <connectivity/formattedcolumnvalue.hxx>
#include <i18nlangtag/lang.h>
-
+#include <o3tl/safeint.hxx>
#include <svl/numuno.hxx>
#include <svl/zforlist.hxx>
#include <svx/dialmgr.hxx>
@@ -4064,7 +4064,6 @@ sal_Int16 SAL_CALL FmXListBoxCell::getSelectedItemPos()
Sequence< sal_Int16 > SAL_CALL FmXListBoxCell::getSelectedItemsPos()
{
::osl::MutexGuard aGuard( m_aMutex );
- Sequence<sal_Int16> aSeq;
if (m_pBox)
{
@@ -4073,11 +4072,10 @@ Sequence< sal_Int16 > SAL_CALL FmXListBoxCell::getSelectedItemsPos()
auto nActive = rBox.get_active();
if (nActive != -1)
{
- aSeq = Sequence<sal_Int16>(1);
- aSeq.getArray()[0] = nActive;
+ return { o3tl::narrowing<short>(nActive) };
}
}
- return aSeq;
+ return {};
}
OUString SAL_CALL FmXListBoxCell::getSelectedItem()
@@ -4100,8 +4098,6 @@ css::uno::Sequence<OUString> SAL_CALL FmXListBoxCell::getSelectedItems()
{
::osl::MutexGuard aGuard( m_aMutex );
- css::uno::Sequence<OUString> aSeq;
-
if (m_pBox)
{
UpdateFromColumn();
@@ -4109,11 +4105,10 @@ css::uno::Sequence<OUString> SAL_CALL FmXListBoxCell::getSelectedItems()
auto nActive = rBox.get_active();
if (nActive != -1)
{
- aSeq = css::uno::Sequence<OUString>(1);
- aSeq.getArray()[0] = rBox.get_text(nActive);
+ return { rBox.get_text(nActive) };
}
}
- return aSeq;
+ return {};
}
void SAL_CALL FmXListBoxCell::selectItemPos(sal_Int16 nPos, sal_Bool bSelect)
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 84aef7b60d90..f71034f17348 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -4150,12 +4150,13 @@ void FormController::deleteInterceptor(const Reference< XDispatchProviderInterce
void FormController::implInvalidateCurrentControlDependentFeatures()
{
- Sequence< sal_Int16 > aCurrentControlDependentFeatures(4);
-
- aCurrentControlDependentFeatures[0] = FormFeature::SortAscending;
- aCurrentControlDependentFeatures[1] = FormFeature::SortDescending;
- aCurrentControlDependentFeatures[2] = FormFeature::AutoFilter;
- aCurrentControlDependentFeatures[3] = FormFeature::RefreshCurrentControl;
+ Sequence< sal_Int16 > aCurrentControlDependentFeatures
+ {
+ FormFeature::SortAscending,
+ FormFeature::SortDescending,
+ FormFeature::AutoFilter,
+ FormFeature::RefreshCurrentControl
+ };
invalidateFeatures( aCurrentControlDependentFeatures );
}
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index c63be9f109e0..1e850a2c0703 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -666,7 +666,7 @@ Any SAL_CALL SvXMLEmbeddedObjectHelper::getByName(
Sequence< OUString > SAL_CALL SvXMLEmbeddedObjectHelper::getElementNames()
{
- return Sequence< OUString >(0);
+ return {};
}
sal_Bool SAL_CALL SvXMLEmbeddedObjectHelper::hasByName( const OUString& rURLStr )