[Libreoffice-commits] core.git: writerfilter/source writerperfect/source xmlhelp/source xmloff/source xmlscript/source xmlsecurity/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 11 14:04:00 UTC 2021


 writerfilter/source/dmapper/SettingsTable.cxx              |    3 --
 writerperfect/source/common/WPXSvInputStream.cxx           |    5 ----
 xmlhelp/source/cxxhelp/provider/resultsetbase.cxx          |   15 ++++--------
 xmloff/source/chart/SchXMLSeriesHelper.cxx                 |    9 +------
 xmloff/source/core/DomBuilderContext.cxx                   |   10 +-------
 xmloff/source/core/xmlexp.cxx                              |    3 --
 xmloff/source/draw/XMLImageMapContext.cxx                  |    3 --
 xmloff/source/draw/sdxmlimp.cxx                            |    3 --
 xmloff/source/draw/ximpshap.cxx                            |    4 ---
 xmloff/source/draw/ximpstyl.cxx                            |    6 +---
 xmloff/source/meta/xmlmetai.cxx                            |    4 ---
 xmloff/source/script/XMLEventImportHelper.cxx              |    7 -----
 xmloff/source/style/prstylei.cxx                           |    6 ----
 xmloff/source/style/xmlbahdl.cxx                           |   10 ++++----
 xmloff/source/text/XMLSectionSourceDDEImportContext.cxx    |   16 +------------
 xmlscript/source/xmldlg_imexp/xmldlg_import.cxx            |   10 +-------
 xmlsecurity/source/component/documentdigitalsignatures.cxx |    4 +--
 17 files changed, 32 insertions(+), 86 deletions(-)

New commits:
commit 57796f2724f004679f78eb144a93b9a03968317c
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Fri Jun 11 14:52:29 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri Jun 11 16:03:10 2021 +0200

    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 at yahoo.fr>

diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index 12ec66a54152..47a2d7269efd 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -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 ));
         }
     }
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index 9f7ea9caecf1..22d7dc8d3950 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -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));
         }
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
index 90c928bbc789..ddb982985c65 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
@@ -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 ) );
diff --git a/xmloff/source/chart/SchXMLSeriesHelper.cxx b/xmloff/source/chart/SchXMLSeriesHelper.cxx
index 380830b40fc6..9bccc3f83950 100644
--- a/xmloff/source/chart/SchXMLSeriesHelper.cxx
+++ b/xmloff/source/chart/SchXMLSeriesHelper.cxx
@@ -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) });
                 }
             }
         }
diff --git a/xmloff/source/core/DomBuilderContext.cxx b/xmloff/source/core/DomBuilderContext.cxx
index b0ddefea764d..066d8e6038c4 100644
--- a/xmloff/source/core/DomBuilderContext.cxx
+++ b/xmloff/source/core/DomBuilderContext.cxx
@@ -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
         {
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index d355e4a0ff28..05d44229e321 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -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 );
     }
 }
 
diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx
index 2f848115d69a..09958b7ca7f5 100644
--- a/xmloff/source/draw/XMLImageMapContext.cxx
+++ b/xmloff/source/draw/XMLImageMapContext.cxx
@@ -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 );
     }
 }
 
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index b768eaf14d32..2776880934ec 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -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 );
 */
     }
 }
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index a1fdad1cc41c..068205635e75 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -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
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index a702872a736b..c9449a900b1f 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -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 );
         }
     }
 }
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 89dbc505fac5..457e2da4bff0 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -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(
diff --git a/xmloff/source/script/XMLEventImportHelper.cxx b/xmloff/source/script/XMLEventImportHelper.cxx
index 18b795ee1f3d..9796224f902d 100644
--- a/xmloff/source/script/XMLEventImportHelper.cxx
+++ b/xmloff/source/script/XMLEventImportHelper.cxx
@@ -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 });
 
     }
 
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 3bf2c8ad8af6..e9ca87595f2b 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -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 );
         }
     }
 
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index 7f928dfbf499..b1fa0c891c86 100644
--- a/xmloff/source/style/xmlbahdl.cxx
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -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;
         }
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
index 3e98f5114100..e2d8f1ce8468 100644
--- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
@@ -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);
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index a801943bfacf..51fcc91d7467 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -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;
             }
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 6dfb9799190d..5a353c39924b 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -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();


More information about the Libreoffice-commits mailing list