cui/source/dialogs/hlmarkwn.cxx | 5 +- editeng/source/editeng/editview.cxx | 6 +-- editeng/source/items/numitem.cxx | 12 +++--- extensions/source/bibliography/bibconfig.cxx | 14 +++----- extensions/source/bibliography/framectr.cxx | 10 +++-- extensions/source/bibliography/toolbar.cxx | 47 +++++++++++---------------- 6 files changed, 42 insertions(+), 52 deletions(-)
New commits: commit 64c0569d8d1328091e1dfbd76afd86a3664a0da7 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Sun Feb 6 16:18:11 2022 +0100 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Sun Feb 6 19:35:34 2022 +0100 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 <serval2...@yahoo.fr> diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index 9c441629bb6b..616d5e7122bc 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -19,6 +19,7 @@ #include <dialmgr.hxx> #include <o3tl/any.hxx> +#include <comphelper/propertyvalue.hxx> #include <unotools/viewoptions.hxx> #include <vcl/graph.hxx> @@ -239,9 +240,7 @@ bool SvxHlinkDlgMarkWnd::RefreshFromDoc(const OUString& aURL) { try { - uno::Sequence< beans::PropertyValue > aArg(1); - aArg.getArray()[0].Name = "Hidden"; - aArg.getArray()[0].Value <<= true; + uno::Sequence< beans::PropertyValue > aArg { comphelper::makePropertyValue("Hidden", true) }; xComp = xDesktop->loadComponentFromURL( aURL, "_blank", 0, aArg ); } catch( const io::IOException& ) diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index c8d12f0388d3..b471eed01dc3 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -34,6 +34,7 @@ #include <svl/srchitem.hxx> #include "impedit.hxx" +#include <comphelper/propertyvalue.hxx> #include <editeng/editeng.hxx> #include <editeng/editview.hxx> #include <editeng/flditem.hxx> @@ -1017,10 +1018,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac // than returning e.g. 16 suggestions and using only the // first 7. Thus we hand down the value to use to that // implementation here by providing an additional parameter. - Sequence< PropertyValue > aPropVals(1); - PropertyValue &rVal = aPropVals.getArray()[0]; - rVal.Name = UPN_MAX_NUMBER_OF_SUGGESTIONS; - rVal.Value <<= sal_Int16(7); + Sequence< PropertyValue > aPropVals { comphelper::makePropertyValue(UPN_MAX_NUMBER_OF_SUGGESTIONS, sal_Int16(7)) }; // Are there any replace suggestions? Reference< linguistic2::XSpellAlternatives > xSpellAlt = diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 6823a6616d03..7d6fa5fe23ae 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -24,6 +24,7 @@ #include <editeng/numitem.hxx> #include <com/sun/star/text/VertOrientation.hpp> +#include <comphelper/propertyvalue.hxx> #include <editeng/brushitem.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/font.hxx> @@ -132,12 +133,11 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLoca return OUString('0'); else { - Sequence< PropertyValue > aProperties(2); - PropertyValue* pValues = aProperties.getArray(); - pValues[0].Name = "NumberingType"; - pValues[0].Value <<= static_cast<sal_uInt16>(nNumType); - pValues[1].Name = "Value"; - pValues[1].Value <<= nNo; + Sequence< PropertyValue > aProperties + { + comphelper::makePropertyValue("NumberingType", static_cast<sal_uInt16>(nNumType)), + comphelper::makePropertyValue("Value", nNo) + }; try { 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); }