diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2022-02-06 16:18:11 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2022-02-06 19:35:34 +0100 |
commit | 64c0569d8d1328091e1dfbd76afd86a3664a0da7 (patch) | |
tree | 3fa9e09a4f1ad735975f802d1e138b9f0d71d57f /extensions | |
parent | 049bc1e7d7ca44767dc826fdda161e01306bf17b (diff) |
Simplify sequence of PropertyValue in cui/editeng/extensions
Change-Id: I0c8f46d2671f3623ff3dd1ee6ec84cde7db41003
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129580
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/bibliography/bibconfig.cxx | 14 | ||||
-rw-r--r-- | extensions/source/bibliography/framectr.cxx | 10 | ||||
-rw-r--r-- | extensions/source/bibliography/toolbar.cxx | 47 |
3 files changed, 32 insertions, 39 deletions
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 1b9ce9e53d02..14203ae6c346 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <o3tl/any.hxx> using namespace ::com::sun::star::uno; @@ -235,14 +236,11 @@ void BibConfig::ImplCommit() !pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName.isEmpty()) { OUString sSubPrefix = sPrefix + "/_" + OUString::number(nFieldAssignment); - Sequence< PropertyValue > aAssignmentValues(2); - PropertyValue* pAssignmentValues = aAssignmentValues.getArray(); - pAssignmentValues[0].Name = sSubPrefix; - pAssignmentValues[0].Name += sFieldName; - pAssignmentValues[0].Value <<= pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName; - pAssignmentValues[1].Name = sSubPrefix; - pAssignmentValues[1].Name += sDatabaseFieldName; - pAssignmentValues[1].Value <<= pMapping->aColumnPairs[nFieldAssignment].sRealColumnName; + Sequence< PropertyValue > aAssignmentValues + { + comphelper::makePropertyValue(sSubPrefix + sFieldName, pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName), + comphelper::makePropertyValue(sSubPrefix + sDatabaseFieldName, pMapping->aColumnPairs[nFieldAssignment].sRealColumnName) + }; SetSetProperties( sPrefix, aAssignmentValues ); nFieldAssignment++; } diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 1c5f85c03f35..a273635d91cb 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -18,6 +18,7 @@ */ #include <comphelper/types.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include "framectr.hxx" #include "datman.hxx" @@ -393,10 +394,11 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen { try { - uno::Sequence< beans::PropertyValue > aNewDataSource(2); - beans::PropertyValue* pProps = aNewDataSource.getArray(); - pProps[0].Value <<= OUString(); - pProps[1].Value <<= aURL; + uno::Sequence< beans::PropertyValue > aNewDataSource + { + comphelper::makePropertyValue( {}, OUString() ), + comphelper::makePropertyValue( {}, aURL ) + }; ChangeDataSource(aNewDataSource); } catch(const Exception&) diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index 8d32a1f4d205..fd74a04e6442 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <comphelper/propertyvalue.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -348,14 +349,11 @@ void BibToolBar::Select() } else { - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name="QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nId,aPropVal); } } @@ -480,13 +478,11 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt ) sal_uInt16 nKey = aKeyCode.GetCode(); if(nKey == KEY_RETURN) { - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nTBC_BT_AUTOFILTER, aPropVal); return bResult; } @@ -505,11 +501,10 @@ IMPL_LINK_NOARG( BibToolBar, SelHdl, weld::ComboBox&, void ) IMPL_LINK_NOARG( BibToolBar, SendSelHdl, Timer*, void ) { - Sequence<PropertyValue> aPropVal(1); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "DataSourceName"; - OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( pLbSource->get_active_text() ) ); - pPropertyVal[0].Value <<= aEntry; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("DataSourceName", MnemonicGenerator::EraseAllMnemonicChars( pLbSource->get_active_text() )) + }; SendDispatch(nTBC_SOURCE, aPropVal); } @@ -533,13 +528,11 @@ IMPL_LINK_NOARG(BibToolBar, MenuHdl, ToolBox*, void) xPopupMenu->set_active(sId, true); sSelMenuItem = sId; aQueryField = MnemonicGenerator::EraseAllMnemonicChars(xPopupMenu->get_label(sId)); - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nTBC_BT_AUTOFILTER, aPropVal); } |