Simplify Sequences initializations (sw)
Change-Id: I02647bdb720620afe20284a069a71c19dbfcea05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116944 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
parent
b1fe17f280
commit
76a69fb0bb
11 changed files with 48 additions and 78 deletions
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) },
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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() :
|
||||
|
|
|
@ -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( )
|
||||
|
|
Loading…
Reference in a new issue