[Libreoffice-commits] core.git: sw/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 11 12:55:40 UTC 2021
sw/source/core/text/frmform.cxx | 9 +++------
sw/source/core/unocore/unofield.cxx | 4 +---
sw/source/core/unocore/unoframe.cxx | 15 ++++++++-------
sw/source/core/unocore/unoobj.cxx | 30 +++++++-----------------------
sw/source/core/unocore/unoparagraph.cxx | 4 +---
sw/source/filter/xml/xmlimp.cxx | 15 ++++++++++-----
sw/source/ui/dbui/dbinsdlg.cxx | 27 +++++++++++----------------
sw/source/uibase/dbui/dbmgr.cxx | 7 ++++---
sw/source/uibase/docvw/srcedtw.cxx | 5 +----
sw/source/uibase/envelp/labelcfg.cxx | 8 +-------
sw/source/uibase/uno/unotxvw.cxx | 2 +-
11 files changed, 48 insertions(+), 78 deletions(-)
New commits:
commit 76a69fb0bb1d849a2a7e76e209a30db149d79cdd
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Thu Jun 10 00:02:28 2021 +0200
Commit: Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri Jun 11 14:54:36 2021 +0200
Simplify Sequences initializations (sw)
Change-Id: I02647bdb720620afe20284a069a71c19dbfcea05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116944
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 12a4492bbec7..82f2a8dcd893 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -517,9 +517,6 @@ void SwTextFrame::AdjustFrame( const SwTwips nChgHght, bool bHasToFit )
css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips CurrentPos )
{
- css::uno::Sequence< css::style::TabStop > tabs(1);
- css::style::TabStop ts;
-
SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this );
SwTextFormatter aLine( this, &aInf );
SwTextCursor TextCursor( this, &aInf );
@@ -533,10 +530,11 @@ css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips C
if( !pTS )
{
- return css::uno::Sequence< css::style::TabStop >();
+ return {};
}
// copy tab stop information into a Sequence, which only contains one element.
+ css::style::TabStop ts;
ts.Position = pTS->GetTabPos();
ts.DecimalChar = pTS->GetDecimal();
ts.FillChar = pTS->GetFill();
@@ -550,8 +548,7 @@ css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips C
default: break; // prevent warning
}
- tabs[0] = ts;
- return tabs;
+ return { ts };
}
// AdjustFollow expects the following situation:
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 07a5b0bed2cc..a4f4cb597415 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2336,9 +2336,7 @@ uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName)
break;
case FN_UNO_ANCHOR_TYPES:
{
- uno::Sequence<text::TextContentAnchorType> aTypes(1);
- text::TextContentAnchorType* pArray = aTypes.getArray();
- pArray[0] = text::TextContentAnchorType_AS_CHARACTER;
+ uno::Sequence<text::TextContentAnchorType> aTypes { text::TextContentAnchorType_AS_CHARACTER };
aRet <<= aTypes;
}
break;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index e5c8fb7e1515..a430d92f5b7f 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1988,13 +1988,14 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
if(FN_UNO_ANCHOR_TYPES == pEntry->nWID)
{
- uno::Sequence<text::TextContentAnchorType> aTypes(5);
- text::TextContentAnchorType* pArray = aTypes.getArray();
- pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
- pArray[1] = text::TextContentAnchorType_AS_CHARACTER;
- pArray[2] = text::TextContentAnchorType_AT_PAGE;
- pArray[3] = text::TextContentAnchorType_AT_FRAME;
- pArray[4] = text::TextContentAnchorType_AT_CHARACTER;
+ uno::Sequence<text::TextContentAnchorType> aTypes
+ {
+ text::TextContentAnchorType_AT_PARAGRAPH,
+ text::TextContentAnchorType_AS_CHARACTER,
+ text::TextContentAnchorType_AT_PAGE,
+ text::TextContentAnchorType_AT_FRAME,
+ text::TextContentAnchorType_AT_CHARACTER
+ };
aAny <<= aTypes;
}
else if(pFormat)
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 56ad0c297eec..4cb772142e16 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2527,9 +2527,6 @@ SwUnoCursorHelper::CreateSortDescriptor(const bool bFromTable)
pArray[3] = beans::PropertyValue("MaxSortFieldsCount", -1, aVal,
beans::PropertyState_DIRECT_VALUE);
- uno::Sequence< table::TableSortField > aFields(3);
- table::TableSortField* pFields = aFields.getArray();
-
lang::Locale aLang( SvtSysLocale().GetLanguageTag().getLocale());
// get collator algorithm to be used for the locale
uno::Sequence< OUString > aSeq(
@@ -2542,26 +2539,13 @@ SwUnoCursorHelper::CreateSortDescriptor(const bool bFromTable)
aCollAlg = aSeq.getConstArray()[0];
}
- pFields[0].Field = 1;
- pFields[0].IsAscending = true;
- pFields[0].IsCaseSensitive = false;
- pFields[0].FieldType = table::TableSortFieldType_ALPHANUMERIC;
- pFields[0].CollatorLocale = aLang;
- pFields[0].CollatorAlgorithm = aCollAlg;
-
- pFields[1].Field = 1;
- pFields[1].IsAscending = true;
- pFields[1].IsCaseSensitive = false;
- pFields[1].FieldType = table::TableSortFieldType_ALPHANUMERIC;
- pFields[1].CollatorLocale = aLang;
- pFields[1].CollatorAlgorithm = aCollAlg;
-
- pFields[2].Field = 1;
- pFields[2].IsAscending = true;
- pFields[2].IsCaseSensitive = false;
- pFields[2].FieldType = table::TableSortFieldType_ALPHANUMERIC;
- pFields[2].CollatorLocale = aLang;
- pFields[2].CollatorAlgorithm = aCollAlg;
+ uno::Sequence< table::TableSortField > aFields
+ {
+ // Field, IsAscending, IsCaseSensitive, FieldType, CollatorLocale, CollatorAlgorithm
+ { 1, true, false, table::TableSortFieldType_ALPHANUMERIC, aLang, aCollAlg },
+ { 1, true, false, table::TableSortFieldType_ALPHANUMERIC, aLang, aCollAlg },
+ { 1, true, false, table::TableSortFieldType_ALPHANUMERIC, aLang, aCollAlg }
+ };
aVal <<= aFields;
pArray[4] = beans::PropertyValue("SortFields", -1, aVal,
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 249956dd17c9..5b7d3ab08c17 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -856,9 +856,7 @@ bool ::sw::GetDefaultTextContentValue(
case FN_UNO_TEXT_WRAP: rAny <<= text::WrapTextMode_NONE; break;
case FN_UNO_ANCHOR_TYPE: rAny <<= text::TextContentAnchorType_AT_PARAGRAPH; break;
case FN_UNO_ANCHOR_TYPES:
- { uno::Sequence<text::TextContentAnchorType> aTypes(1);
- text::TextContentAnchorType* pArray = aTypes.getArray();
- pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
+ { uno::Sequence<text::TextContentAnchorType> aTypes { text::TextContentAnchorType_AT_PARAGRAPH };
rAny <<= aTypes;
}
break;
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 5951a8e36724..4fd946b8f0e5 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1763,11 +1763,16 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportFODT(SvStream &rStream)
uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.XmlFilterAdaptor"), uno::UNO_SET_THROW);
- css::uno::Sequence<OUString> aUserData(7);
- aUserData[0] = "com.sun.star.comp.filter.OdfFlatXml";
- aUserData[2] = "com.sun.star.comp.Writer.XMLOasisImporter";
- aUserData[3] = "com.sun.star.comp.Writer.XMLOasisExporter";
- aUserData[6] = "true";
+ css::uno::Sequence<OUString> aUserData
+ {
+ "com.sun.star.comp.filter.OdfFlatXml",
+ "",
+ "com.sun.star.comp.Writer.XMLOasisImporter",
+ "com.sun.star.comp.Writer.XMLOasisExporter",
+ "",
+ "",
+ "true"
+ };
uno::Sequence<beans::PropertyValue> aAdaptorArgs(comphelper::InitPropertySequence(
{
{ "UserData", uno::Any(aUserData) },
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 50a7d212b42d..c057865aa1d2 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -1442,15 +1442,15 @@ static Sequence<OUString> lcl_createSourceNames(std::u16string_view rNodeName)
static Sequence<OUString> lcl_CreateSubNames(std::u16string_view rSubNodeName)
{
- Sequence<OUString> aSubSourceNames(6);
- OUString* pNames = aSubSourceNames.getArray();
- pNames[0] = OUString::Concat(rSubNodeName) + "/ColumnName";
- pNames[1] = OUString::Concat(rSubNodeName) + "/ColumnIndex";
- pNames[2] = OUString::Concat(rSubNodeName) + "/IsNumberFormat";
- pNames[3] = OUString::Concat(rSubNodeName) + "/IsNumberFormatFromDataBase";
- pNames[4] = OUString::Concat(rSubNodeName) + "/NumberFormat";
- pNames[5] = OUString::Concat(rSubNodeName) + "/NumberFormatLocale";
- return aSubSourceNames;
+ return
+ {
+ OUString::Concat(rSubNodeName) + "/ColumnName",
+ OUString::Concat(rSubNodeName) + "/ColumnIndex",
+ OUString::Concat(rSubNodeName) + "/IsNumberFormat",
+ OUString::Concat(rSubNodeName) + "/IsNumberFormatFromDataBase",
+ OUString::Concat(rSubNodeName) + "/NumberFormat",
+ OUString::Concat(rSubNodeName) + "/NumberFormatLocale"
+ };
}
static OUString lcl_CreateUniqueName(const Sequence<OUString>& aNames)
@@ -1472,19 +1472,14 @@ void SwInsertDBColAutoPilot::ImplCommit()
//remove entries that contain this data source + table at first
for(OUString const & nodeName : std::as_const(aNames))
{
- Sequence<OUString> aSourceNames(2);
- OUString* pSourceNames = aSourceNames.getArray();
- pSourceNames[0] = nodeName + "/DataSource";
- pSourceNames[1] = nodeName + "/Command";
- Sequence<Any> aSourceProperties = GetProperties(aSourceNames);
+ Sequence<Any> aSourceProperties = GetProperties({ nodeName + "/DataSource", nodeName + "/Command" });
const Any* pSourceProps = aSourceProperties.getArray();
OUString sSource, sCommand;
pSourceProps[0] >>= sSource;
pSourceProps[1] >>= sCommand;
if(sSource==aDBData.sDataSource && sCommand==aDBData.sCommand)
{
- Sequence<OUString> aElements { nodeName };
- ClearNodeElements(OUString(), aElements);
+ ClearNodeElements(OUString(), { nodeName });
}
}
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 367647037e4c..475388d2134e 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2654,7 +2654,6 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference
uno::Any aInfoAny;
bool bStore = true;
OUString sFind;
- uno::Sequence<OUString> aFilters(1);
uno::Any aURLAny = GetDBunoURI(rURL, type);
switch (type) {
@@ -2668,8 +2667,10 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference
case DBConnURIType::FLAT:
case DBConnURIType::DBASE:
//set the filter to the file name without extension
- aFilters[0] = rURL.getBase(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset);
- aTableFilterAny <<= aFilters;
+ {
+ uno::Sequence<OUString> aFilters { rURL.getBase(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset) };
+ aTableFilterAny <<= aFilters;
+ }
break;
case DBConnURIType::MSJET:
case DBConnURIType::MSACE:
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index 071ba6d64233..55c6753c6023 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -260,10 +260,7 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView )
osl::MutexGuard g(mutex_);
m_xNotifier = n;
}
- css::uno::Sequence< OUString > s(2);
- s[0] = "FontHeight";
- s[1] = "FontName";
- n->addPropertiesChangeListener(s, m_xListener);
+ n->addPropertiesChangeListener({ "FontHeight", "FontName" }, m_xListener);
}
SwSrcEditWindow::~SwSrcEditWindow()
diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx
index ee5ac99f25e4..e0fbe142f688 100644
--- a/sw/source/uibase/envelp/labelcfg.cxx
+++ b/sw/source/uibase/envelp/labelcfg.cxx
@@ -63,13 +63,7 @@ static OUString lcl_getValue(xmlreader::XmlReader& reader,
static Sequence<OUString> lcl_CreatePropertyNames(const OUString& rPrefix)
{
- Sequence<OUString> aProperties(2);
- OUString* pProperties = aProperties.getArray();
- std::fill(aProperties.begin(), aProperties.end(), rPrefix);
-
- pProperties[ 0] += "Name";
- pProperties[ 1] += "Measure";
- return aProperties;
+ return { OUString::Concat(rPrefix) + "Name", OUString::Concat(rPrefix) + "Measure" };
}
SwLabelConfig::SwLabelConfig() :
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 17e29ec02ade..d1acaa8f9e10 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -741,7 +741,7 @@ void SwXTextView::NotifyDBChanged()
aURL.Complete = OUString::createFromAscii(SwXDispatch::GetDBChangeURL());
m_SelChangedListeners.forEach<XDispatch>(
- DispatchListener(aURL, Sequence<PropertyValue>(0)));
+ DispatchListener(aURL, {}));
}
uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetInfo( )
More information about the Libreoffice-commits
mailing list