forms/source/component/DatabaseForm.cxx   |   29 +++++++++++++----------------
 forms/source/component/clickableimage.cxx |    5 +----
 2 files changed, 14 insertions(+), 20 deletions(-)

New commits:
commit 6dcd73f505eca7d0ea31555564855dd4cd0813b4
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sun Feb 6 21:47:14 2022 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Mon Feb 7 07:56:16 2022 +0100

     Simplify sequence of PropertyValue in forms
    
    Change-Id: Iab1af5c8d8d824ef2a4be471395f174cadabfc1e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129583
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/forms/source/component/DatabaseForm.cxx 
b/forms/source/component/DatabaseForm.cxx
index 6ba5a380ee9c..e22acf270fb5 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -29,6 +29,7 @@
 #include "GroupManager.hxx"
 #include <property.hxx>
 #include <services.hxx>
+#include <comphelper/propertyvalue.hxx>
 
 #include <com/sun/star/awt/XControlContainer.hpp>
 #include <com/sun/star/awt/XTextComponent.hpp>
@@ -2103,9 +2104,6 @@ static void lcl_dispatch(const Reference< XFrame >& 
xFrame,const Reference<XURLT
     if (!xDisp.is())
         return;
 
-    Sequence<PropertyValue> aArgs(2);
-    aArgs.getArray()[0].Name = "Referer";
-    aArgs.getArray()[0].Value <<= aReferer;
 
     // build a sequence from the to-be-submitted string
     OString a8BitData(OUStringToOString(aData, _eEncoding));
@@ -2113,8 +2111,11 @@ static void lcl_dispatch(const Reference< XFrame >& 
xFrame,const Reference<XURLT
     Sequence< sal_Int8 > aPostData(reinterpret_cast<const 
sal_Int8*>(a8BitData.getStr()), a8BitData.getLength());
     Reference< XInputStream > xPostData = new SequenceInputStream(aPostData);
 
-    aArgs.getArray()[1].Name = "PostData";
-    aArgs.getArray()[1].Value <<= xPostData;
+    Sequence<PropertyValue> aArgs
+    {
+        comphelper::makePropertyValue("Referer", aReferer),
+        comphelper::makePropertyValue("PostData", xPostData)
+    };
 
     xDisp->dispatch(aURL, aArgs);
 }
@@ -2193,9 +2194,7 @@ void ODatabaseForm::submit_impl(const 
Reference<XControl>& Control, const css::a
 
             if (xDisp.is())
             {
-                Sequence<PropertyValue> aArgs(1);
-                aArgs.getArray()->Name = "Referer";
-                aArgs.getArray()->Value <<= aReferer;
+                Sequence<PropertyValue> aArgs { 
comphelper::makePropertyValue("Referer", aReferer) };
                 xDisp->dispatch(aURL, aArgs);
             }
         }
@@ -2226,17 +2225,15 @@ void ODatabaseForm::submit_impl(const 
Reference<XControl>& Control, const css::a
             if (!aData.hasElements())
                 return;
 
-            Sequence<PropertyValue> aArgs(3);
-            aArgs.getArray()[0].Name = "Referer";
-            aArgs.getArray()[0].Value <<= aReferer;
-            aArgs.getArray()[1].Name = "ContentType";
-            aArgs.getArray()[1].Value <<= aContentType;
-
             // build a sequence from the to-be-submitted string
             Reference< XInputStream > xPostData = new 
SequenceInputStream(aData);
 
-            aArgs.getArray()[2].Name = "PostData";
-            aArgs.getArray()[2].Value <<= xPostData;
+            Sequence<PropertyValue> aArgs
+            {
+                comphelper::makePropertyValue("Referer", aReferer),
+                comphelper::makePropertyValue("ContentType", aContentType),
+                comphelper::makePropertyValue("PostData", xPostData)
+            };
 
             xDisp->dispatch(aURL, aArgs);
         }
diff --git a/forms/source/component/clickableimage.cxx 
b/forms/source/component/clickableimage.cxx
index c84ba34cfb95..6a1ec1120192 100644
--- a/forms/source/component/clickableimage.cxx
+++ b/forms/source/component/clickableimage.cxx
@@ -301,10 +301,7 @@ namespace frm
                             FrameSearchFlag::SELF | FrameSearchFlag::PARENT |
                             FrameSearchFlag::SIBLINGS | 
FrameSearchFlag::CREATE );
 
-                    Sequence<PropertyValue> aArgs(1);
-                    PropertyValue& rProp = aArgs.getArray()[0];
-                    rProp.Name = "Referer";
-                    rProp.Value <<= xModel->getURL();
+                    Sequence<PropertyValue> aArgs { 
comphelper::makePropertyValue("Referer", xModel->getURL()) };
 
                     if (xDisp.is())
                         xDisp->dispatch( aURL, aArgs );

Reply via email to