Simplify Sequences initializations (writerfilter/writerperfect/x*)

Change-Id: I1bd31fe6cf0f8aaf4f2cfe1d3d49e61a0633f361
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117057
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet 2021-06-11 14:52:29 +02:00
parent 92889bc98f
commit 57796f2724
17 changed files with 32 additions and 86 deletions

View File

@ -777,8 +777,7 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x
{
// use dummy protection key to forbid disabling of Record changes without a notice
// (extending the recent GrabBag support) TODO support password verification...
css::uno::Sequence<sal_Int8> aDummyKey(1);
aDummyKey[0] = 1;
css::uno::Sequence<sal_Int8> aDummyKey { 1 };
xDocProps->setPropertyValue("RedlineProtectionKey", uno::makeAny( aDummyKey ));
}
}

View File

@ -776,14 +776,11 @@ bool WPXSvInputStreamImpl::isZip()
try
{
Sequence<Any> aArgs(1);
aArgs[0] <<= mxStream;
const Reference<XComponentContext> xContext(comphelper::getProcessComponentContext(),
UNO_SET_THROW);
const Reference<packages::zip::XZipFileAccess2> xZip(
xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
"com.sun.star.packages.zip.ZipFileAccess", aArgs, xContext),
"com.sun.star.packages.zip.ZipFileAccess", { Any(mxStream) }, xContext),
UNO_QUERY_THROW);
mpZipStorage.reset(new ZipStorageImpl(xZip));
}

View File

@ -392,16 +392,11 @@ private:
uno::Reference< beans::XPropertySetInfo > SAL_CALL
ResultSetBase::getPropertySetInfo()
{
uno::Sequence< beans::Property > seq(2);
seq[0].Name = "RowCount";
seq[0].Handle = -1;
seq[0].Type = cppu::UnoType<sal_Int32>::get();
seq[0].Attributes = beans::PropertyAttribute::READONLY;
seq[1].Name = "IsRowCountFinal";
seq[1].Handle = -1;
seq[1].Type = cppu::UnoType<sal_Bool>::get();
seq[1].Attributes = beans::PropertyAttribute::READONLY;
uno::Sequence< beans::Property > seq
{
{ "RowCount", -1, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::READONLY },
{ "IsRowCountFinal", -1, cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::READONLY }
};
//t
return uno::Reference< beans::XPropertySetInfo > ( new XPropertySetInfoImpl( seq ) );

View File

@ -170,9 +170,7 @@ uno::Reference< beans::XPropertySet > SchXMLSeriesHelper::createOldAPISeriesProp
Reference< lang::XInitialization > xInit( xRet, uno::UNO_QUERY );
if(xInit.is())
{
Sequence< uno::Any > aArguments(1);
aArguments[0] <<= xSeries;
xInit->initialize(aArguments);
xInit->initialize( { uno::Any(xSeries) });
}
}
}
@ -204,10 +202,7 @@ uno::Reference< beans::XPropertySet > SchXMLSeriesHelper::createOldAPIDataPointP
Reference< lang::XInitialization > xInit( xRet, uno::UNO_QUERY );
if(xInit.is())
{
Sequence< uno::Any > aArguments(2);
aArguments[0] <<= xSeries;
aArguments[1] <<= nPointIndex;
xInit->initialize(aArguments);
xInit->initialize({ uno::Any(xSeries), uno::Any(nPointIndex) });
}
}
}

View File

@ -176,11 +176,8 @@ void DomBuilderContext::HandleAttributes(
case XML_NAMESPACE_UNKNOWN:
// unknown namespace: illegal input. Raise Warning.
{
Sequence<OUString> aSeq(2);
aSeq[0] = rLocalName;
aSeq[1] = aValue;
GetImport().SetError(
XMLERROR_FLAG_WARNING | XMLERROR_NAMESPACE_TROUBLE, aSeq );
XMLERROR_FLAG_WARNING | XMLERROR_NAMESPACE_TROUBLE, { rLocalName, aValue } );
}
break;
default:
@ -202,11 +199,8 @@ void DomBuilderContext::HandleAttributes(
if (!rUnknownAttrib.NamespaceURL.isEmpty())
{
// unknown namespace: illegal input. Raise Warning.
Sequence<OUString> aSeq(2);
aSeq[0] = rUnknownAttrib.Name;
aSeq[1] = rUnknownAttrib.Value;
GetImport().SetError(
XMLERROR_FLAG_WARNING | XMLERROR_NAMESPACE_TROUBLE, aSeq );
XMLERROR_FLAG_WARNING | XMLERROR_NAMESPACE_TROUBLE, { rUnknownAttrib.Name, rUnknownAttrib.Value } );
}
else
{

View File

@ -2255,9 +2255,8 @@ void SvXMLExport::IgnorableWhitespace()
}
catch (const SAXException& e)
{
Sequence<OUString> aPars(0);
SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
aPars, e.Message, nullptr );
{}, e.Message, nullptr );
}
}

View File

@ -501,8 +501,7 @@ XMLImageMapContext::XMLImageMapContext(
}
catch(const css::uno::Exception& e)
{
uno::Sequence<OUString> aSeq(0);
rImport.SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, nullptr );
rImport.SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, {}, e.Message, nullptr );
}
}

View File

@ -515,8 +515,7 @@ void SdXMLImport::SetViewSettings(const css::uno::Sequence<css::beans::PropertyV
catch(const css::uno::Exception&)
{
/* #i79978# since old documents may contain invalid view settings, this is nothing to worry the user about.
uno::Sequence<OUString> aSeq(0);
SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, {}, e.Message, NULL );
*/
}
}

View File

@ -490,9 +490,7 @@ void SdXMLShapeContext::AddShape(OUString const & serviceName)
|| serviceName == "com.sun.star.drawing.MediaShape"
|| serviceName == "com.sun.star.presentation.MediaShape")
{
css::uno::Sequence<css::uno::Any> args(1);
args[0] <<= GetImport().GetDocumentBase();
xShape.set( xServiceFact->createInstanceWithArguments(serviceName, args),
xShape.set( xServiceFact->createInstanceWithArguments(serviceName, { css::uno::Any(GetImport().GetDocumentBase()) }),
css::uno::UNO_QUERY);
}
else

View File

@ -1227,8 +1227,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAc
}
catch(const Exception& e)
{
uno::Sequence<OUString> aSeq(0);
const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, nullptr );
const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, {}, e.Message, nullptr );
}
}
@ -1267,8 +1266,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAc
}
catch( const Exception& e )
{
uno::Sequence<OUString> aSeq(0);
const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, nullptr );
const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, {}, e.Message, nullptr );
}
}
}

View File

@ -129,12 +129,10 @@ lcl_initDocumentProperties(SvXMLImport & rImport,
uno::Reference<xml::dom::XSAXDocumentBuilder2> const& xDocBuilder,
uno::Reference<document::XDocumentProperties> const& xDocProps)
{
uno::Sequence< uno::Any > aSeq(1);
aSeq[0] <<= xDocBuilder->getDocument();
uno::Reference< lang::XInitialization > const xInit(xDocProps,
uno::UNO_QUERY_THROW);
try {
xInit->initialize(aSeq);
xInit->initialize({ uno::Any(xDocBuilder->getDocument()) });
rImport.SetStatistics(xDocProps->getDocumentStatistics());
// convert all URLs from relative to absolute
xDocProps->setTemplateURL(rImport.GetAbsoluteReference(

View File

@ -140,13 +140,8 @@ SvXMLImportContext* XMLEventImportHelper::CreateContext(
{
pContext = new SvXMLImportContext(rImport);
Sequence<OUString> aMsgParams(2);
aMsgParams[0] = rXmlEventName;
aMsgParams[1] = rLanguage;
rImport.SetError(XMLERROR_FLAG_ERROR | XMLERROR_ILLEGAL_EVENT,
aMsgParams);
{ rXmlEventName, rLanguage });
}

View File

@ -480,15 +480,11 @@ void XMLPropStyleContext::Finish( bool bOverwrite )
// We can't set the parent style. For a proper
// Error-Message, we should pass in the name of the
// style, as well as the desired parent style.
Sequence<OUString> aSequence(2);
// getName() throws no non-Runtime exception:
aSequence[0] = mxStyle->getName();
aSequence[1] = sParent;
GetImport().SetError(
XMLERROR_FLAG_ERROR | XMLERROR_PARENT_STYLE_NOT_ALLOWED,
aSequence, e.Message, nullptr );
{ mxStyle->getName(), sParent }, e.Message, nullptr );
}
}

View File

@ -446,10 +446,12 @@ bool XMLColorPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, cons
sal_Int32 nIndex = 0;
Sequence< double > aHSL(3);
aHSL[0] = aTmp.getToken( 0, ',', nIndex ).toDouble();
aHSL[1] = aTmp.getToken( 0, ',', nIndex ).toDouble() / 100.0;
aHSL[2] = aTmp.getToken( 0, ',', nIndex ).toDouble() / 100.0;
Sequence< double > aHSL
{
aTmp.getToken( 0, ',', nIndex ).toDouble(),
aTmp.getToken( 0, ',', nIndex ).toDouble() / 100.0,
aTmp.getToken( 0, ',', nIndex ).toDouble() / 100.0
};
rValue <<= aHSL;
bRet = true;
}

View File

@ -93,20 +93,8 @@ void XMLSectionSourceDDEImportContext::startFastElement(sal_Int32 /*nElement*/,
return;
// use multi property set to force single update of connection #83654#
Sequence<OUString> aNames(4);
Sequence<Any> aValues(4);
aValues[0] <<= sApplication;
aNames[0] = "DDECommandFile";
aValues[1] <<= sTopic;
aNames[1] = "DDECommandType";
aValues[2] <<= sItem;
aNames[2] = "DDECommandElement";
aValues[3] <<= bAutomaticUpdate;
aNames[3] = "IsAutomaticUpdate";
Sequence<OUString> aNames { "DDECommandFile", "DDECommandType", "DDECommandElement", "IsAutomaticUpdate" };
Sequence<Any> aValues { Any(sApplication), Any(sTopic), Any(sItem), Any(bAutomaticUpdate) };
Reference<XMultiPropertySet> rMultiPropSet(rSectionPropertySet,
UNO_QUERY);

View File

@ -924,10 +924,7 @@ bool ImportContext::importDataAwareProperty(
aArg1.Name = "BoundCell";
aArg1.Value <<= aAddress;
uno::Sequence< uno::Any > aArgs(1);
aArgs[ 0 ] <<= aArg1;
uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( "com.sun.star.table.CellValueBinding" , aArgs ), uno::UNO_QUERY );
uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( "com.sun.star.table.CellValueBinding" , { uno::Any(aArg1) }), uno::UNO_QUERY );
xBindable->setValueBinding( xBinding );
bRes = true;
}
@ -946,10 +943,7 @@ bool ImportContext::importDataAwareProperty(
aArg1.Name = "CellRange";
aArg1.Value <<= aAddress;
uno::Sequence< uno::Any > aArgs(1);
aArgs[ 0 ] <<= aArg1;
uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( "com.sun.star.table.CellRangeListSource" , aArgs ), uno::UNO_QUERY );
uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( "com.sun.star.table.CellRangeListSource" , { uno::Any(aArg1) } ), uno::UNO_QUERY );
xListEntrySink->setListEntrySource( xSource );
bRes = true;
}

View File

@ -480,7 +480,7 @@ DocumentDigitalSignatures::ImplVerifySignatures(
SAL_WARN_IF(!bInit, "xmlsecurity.comp", "Error initializing security context!");
if (!bInit)
return uno::Sequence<security::DocumentSignatureInformation>(0);
return {};
if (!rxStorage.is())
{
@ -507,7 +507,7 @@ DocumentDigitalSignatures::ImplVerifySignatures(
}
if (!xInputStream.is() && aStreamHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
return Sequence< css::security::DocumentSignatureInformation >(0);
return {};
XMLSignatureHelper& rSignatureHelper = aSignatureManager.getSignatureHelper();