diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:13:01 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-31 15:49:07 +0100 |
commit | 5b54ba7084d6b575814af26be30cf5af5dfca12c (patch) | |
tree | 38f1fd7bfca54886c34f6bcbdd9220d3f1a90f13 /svx/source/tbxctrls | |
parent | 3d469248ada8632a9d86efc80f2ac97dcb617c27 (diff) |
Prepare for removal of non-const operator[] from Sequence in svx
Change-Id: Ib5fda9469f9a1987cf9071c0e228c582cfb3dfa1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124397
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 13 | ||||
-rw-r--r-- | svx/source/tbxctrls/StylesPreviewWindow.cxx | 21 | ||||
-rw-r--r-- | svx/source/tbxctrls/colrctrl.cxx | 10 | ||||
-rw-r--r-- | svx/source/tbxctrls/extrusioncontrols.cxx | 41 | ||||
-rw-r--r-- | svx/source/tbxctrls/fontworkgallery.cxx | 21 | ||||
-rw-r--r-- | svx/source/tbxctrls/formatpaintbrushctrl.cxx | 6 | ||||
-rw-r--r-- | svx/source/tbxctrls/grafctrl.cxx | 12 | ||||
-rw-r--r-- | svx/source/tbxctrls/itemwin.cxx | 5 | ||||
-rw-r--r-- | svx/source/tbxctrls/layctrl.cxx | 17 | ||||
-rw-r--r-- | svx/source/tbxctrls/lboxctrl.cxx | 6 | ||||
-rw-r--r-- | svx/source/tbxctrls/linectrl.cxx | 22 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 57 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunocontroller.cxx | 6 |
13 files changed, 105 insertions, 132 deletions
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 22ee2ef483a5..d2395778ff8f 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -19,6 +19,8 @@ #include <memory> #include <svx/PaletteManager.hxx> + +#include <comphelper/propertyvalue.hxx> #include <tools/urlobj.hxx> #include <osl/file.hxx> #include <unotools/pathoptions.hxx> @@ -275,11 +277,13 @@ void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& r else maRecentColors.emplace_back(rRecentColor, rName); css::uno::Sequence< sal_Int32 > aColorList(maRecentColors.size()); + auto aColorListRange = asNonConstRange(aColorList); css::uno::Sequence< OUString > aColorNameList(maRecentColors.size()); + auto aColorNameListRange = asNonConstRange(aColorNameList); for (size_t i = 0; i < maRecentColors.size(); ++i) { - aColorList[i] = static_cast<sal_Int32>(maRecentColors[i].first); - aColorNameList[i] = maRecentColors[i].second; + aColorListRange[i] = static_cast<sal_Int32>(maRecentColors[i].first); + aColorNameListRange[i] = maRecentColors[i].second; } std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); officecfg::Office::Common::UserColors::RecentColor::set(aColorList, batch); @@ -334,9 +338,8 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedC INetURLObject aObj( aCommand ); - Sequence<PropertyValue> aArgs(1); - aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value <<= sal_Int32(rColor.first); + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue(aObj.GetURLPath(), + sal_Int32(rColor.first)) }; URL aTargetURL; aTargetURL.Complete = aCommand; diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index d1a43c135848..228e322be50a 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -19,6 +19,7 @@ #include <StylesPreviewWindow.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <sfx2/objsh.hxx> @@ -375,12 +376,10 @@ IMPL_LINK(StylesPreviewWindow_Base, Selected, weld::IconView&, rIconView, void) { OUString sStyleName = rIconView.get_selected_text(); - css::uno::Sequence<css::beans::PropertyValue> aArgs(2); - aArgs[0].Value <<= sStyleName; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16(SfxStyleFamily::Para); - - aArgs[0].Name = "Template"; + css::uno::Sequence<css::beans::PropertyValue> aArgs{ + comphelper::makePropertyValue("Template", sStyleName), + comphelper::makePropertyValue("Family", sal_Int16(SfxStyleFamily::Para)) + }; SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs); } @@ -388,12 +387,10 @@ IMPL_LINK(StylesPreviewWindow_Base, DoubleClick, weld::IconView&, rIconView, boo { OUString sStyleName = rIconView.get_selected_text(); - css::uno::Sequence<css::beans::PropertyValue> aArgs(2); - aArgs[0].Name = "Param"; - aArgs[0].Value <<= sStyleName; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16(SfxStyleFamily::Para); - + css::uno::Sequence<css::beans::PropertyValue> aArgs{ + comphelper::makePropertyValue("Param", sStyleName), + comphelper::makePropertyValue("Family", sal_Int16(SfxStyleFamily::Para)) + }; SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:EditStyle", aArgs); return true; diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 06b9c87700bc..521b6fb73888 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -162,14 +162,14 @@ bool SvxColorValueSet_docking::StartDrag() ? drawing::FillStyle_NONE : drawing::FillStyle_SOLID); - uno::Sequence<beans::NamedValue> props(2); XFillColorItem const color(sItemText, aItemColor); - props[0].Name = "FillColor"; - color.QueryValue(props[0].Value, 0); XFillStyleItem const style(eStyle); - props[1].Name = "FillStyle"; - style.QueryValue(props[1].Value, 0); + uno::Any c, s; + color.QueryValue(c, 0); + style.QueryValue(s, 0); + uno::Sequence<beans::NamedValue> props{ { "FillColor", std::move(c) }, + { "FillStyle", std::move(s) } }; m_xHelper->SetData(props); return false; diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index face95949f88..f30c123a42b0 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -21,6 +21,7 @@ #include <string_view> +#include <comphelper/propertyvalue.hxx> #include <svtools/toolbarmenu.hxx> #include <vcl/toolbox.hxx> @@ -223,9 +224,9 @@ void ExtrusionDirectionWindow::statusChanged( IMPL_LINK_NOARG(ExtrusionDirectionWindow, SelectValueSetHdl, ValueSet*, void) { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionDirection).copy(5); - aArgs[0].Value <<= gSkewList[mxDirectionSet->GetSelectedItemId()-1]; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionDirection).copy(5), + gSkewList[mxDirectionSet->GetSelectedItemId()-1]) }; mxControl->dispatchCommand( g_sExtrusionDirection, aArgs ); @@ -236,9 +237,8 @@ IMPL_LINK_NOARG(ExtrusionDirectionWindow, SelectToolbarMenuHdl, weld::Toggleable { int nProjection = mxPerspective->get_active() ? 0 : 1; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionProjection).copy(5); - aArgs[0].Value <<= static_cast<sal_Int32>(nProjection); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionProjection).copy(5), static_cast<sal_Int32>(nProjection)) }; mxControl->dispatchCommand( g_sExtrusionProjection, aArgs ); implSetProjection( nProjection, true ); @@ -447,11 +447,10 @@ void ExtrusionDepthWindow::statusChanged( void ExtrusionDepthWindow::DispatchDepthDialog() { - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "Depth"; - aArgs[0].Value <<= mfDepth; - aArgs[1].Name = "Metric"; - aArgs[1].Value <<= static_cast<sal_Int32>( meUnit ); + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue("Depth", mfDepth), + comphelper::makePropertyValue("Metric", static_cast<sal_Int32>( meUnit )) + }; rtl::Reference<svt::PopupWindowController> xControl(mxControl); xControl->EndPopupMode(); @@ -497,9 +496,8 @@ IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::Toggleable&, rButton, void) fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; } - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsExtrusionDepth).copy(5); - aArgs[0].Value <<= fDepth; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsExtrusionDepth).copy(5), fDepth) }; mxControl->dispatchCommand( gsExtrusionDepth, aArgs ); mbCommandDispatched = true; @@ -728,9 +726,8 @@ IMPL_LINK_NOARG(ExtrusionLightingWindow, SelectValueSetHdl, ValueSet*, void) { nDirection--; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionLightingDirection).copy(5); - aArgs[0].Value <<= nDirection; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionLightingDirection).copy(5), nDirection) }; mxControl->dispatchCommand( g_sExtrusionLightingDirection, aArgs ); @@ -753,9 +750,8 @@ IMPL_LINK(ExtrusionLightingWindow, SelectToolbarMenuHdl, weld::Toggleable&, rBut else nLevel = 2; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionLightingIntensity).copy(5); - aArgs[0].Value <<= static_cast<sal_Int32>(nLevel); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionLightingIntensity).copy(5), static_cast<sal_Int32>(nLevel)) }; mxControl->dispatchCommand( g_sExtrusionLightingIntensity, aArgs ); @@ -892,9 +888,8 @@ IMPL_LINK(ExtrusionSurfaceWindow, SelectHdl, weld::Toggleable&, rButton, void) else nSurface = 3; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionSurface).copy(5); - aArgs[0].Value <<= nSurface; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionSurface).copy(5), nSurface) }; mxControl->dispatchCommand( g_sExtrusionSurface, aArgs ); diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 7bfec4b860c0..de42c5f639c4 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/text/WritingMode.hpp> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/toolbox.hxx> #include <vcl/virdev.hxx> @@ -368,9 +369,8 @@ IMPL_LINK(FontworkAlignmentWindow, SelectHdl, weld::Toggleable&, rButton, void) else nAlignment = 4; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkAlignment).copy(5); - aArgs[0].Value <<= nAlignment; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsFontworkAlignment).copy(5), nAlignment) }; mxControl->dispatchCommand( gsFontworkAlignment, aArgs ); @@ -616,10 +616,9 @@ IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, KernSelectHdl, weld::Toggleable& if (mbSettingValue) return; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkKernCharacterPairs).copy(5); bool bKernOnOff = mxKernPairs->get_active(); - aArgs[0].Value <<= bKernOnOff; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsFontworkKernCharacterPairs).copy(5), bKernOnOff) }; mxControl->dispatchCommand( gsFontworkKernCharacterPairs, aArgs ); mbCommandDispatched = true; @@ -631,9 +630,8 @@ IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, KernSelectHdl, weld::Toggleable& void FontworkCharacterSpacingWindow::DispatchSpacingDialog() { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkCharacterSpacing).copy(5); - aArgs[0].Value <<= mnCharacterSpacing; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsFontworkCharacterSpacing).copy(5), mnCharacterSpacing) }; rtl::Reference<svt::PopupWindowController> xControl(mxControl); xControl->EndPopupMode(); @@ -671,9 +669,8 @@ IMPL_LINK(FontworkCharacterSpacingWindow, SelectHdl, weld::Toggleable&, rButton, else nCharacterSpacing = 100; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkCharacterSpacing).copy(5); - aArgs[0].Value <<= nCharacterSpacing; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsFontworkCharacterSpacing).copy(5), nCharacterSpacing) }; mxControl->dispatchCommand( gsFontworkCharacterSpacing, aArgs ); mbCommandDispatched = true; diff --git a/svx/source/tbxctrls/formatpaintbrushctrl.cxx b/svx/source/tbxctrls/formatpaintbrushctrl.cxx index 0089212bdd01..f67efd12c701 100644 --- a/svx/source/tbxctrls/formatpaintbrushctrl.cxx +++ b/svx/source/tbxctrls/formatpaintbrushctrl.cxx @@ -20,6 +20,7 @@ #include <svx/formatpaintbrushctrl.hxx> +#include <comphelper/propertyvalue.hxx> #include <svl/eitem.hxx> #include <vcl/toolbox.hxx> #include <vcl/settings.hxx> @@ -54,9 +55,8 @@ FormatPaintBrushToolBoxControl::~FormatPaintBrushToolBoxControl() void FormatPaintBrushToolBoxControl::impl_executePaintBrush() { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "PersistentCopy"; - aArgs[0].Value <<= m_bPersistentCopy; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("PersistentCopy", + m_bPersistentCopy) }; Dispatch( ".uno:FormatPaintbrush" , aArgs ); } diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index 3d2cd7218fd3..02fb3d540ba8 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <comphelper/propertyvalue.hxx> #include <vcl/toolbox.hxx> #include <vcl/idle.hxx> #include <svl/intitem.hxx> @@ -121,9 +124,7 @@ IMPL_LINK_NOARG(ImplGrafControl, ImplModifyHdl, Timer*, void) INetURLObject aObj( maCommand ); - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(aObj.GetURLPath(), a) }; SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ), @@ -322,9 +323,8 @@ ImplGrafModeControl::~ImplGrafModeControl() IMPL_LINK(ImplGrafModeControl, SelectHdl, weld::ComboBox&, rBox, void) { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "GrafMode"; - aArgs[0].Value <<= sal_Int16(rBox.get_active()); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("GrafMode", + sal_Int16(rBox.get_active())) }; /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. This instance may be deleted in the meantime (i.e. when a dialog is opened diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index f9612fe008d7..130fba5ae014 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <comphelper/propertyvalue.hxx> #include <sfx2/tbxctrl.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/module.hxx> @@ -104,10 +105,8 @@ IMPL_LINK_NOARG(SvxMetricField, ModifyHdl, weld::MetricSpinButton&, void) XLineWidthItem aLineWidthItem( nTmp ); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "LineWidth"; aLineWidthItem.QueryValue( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("LineWidth", a) }; SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ), ".uno:LineWidth", aArgs ); diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index 3741402f1143..e67d77fd59e2 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -27,6 +27,7 @@ #include <layctrl.hxx> #include <svx/dialmgr.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <svtools/colorcfg.hxx> #include <svtools/toolbarmenu.hxx> #include <com/sun/star/util/URLTransformer.hpp> @@ -337,11 +338,8 @@ void TableWidget::InsertTable() { if (nCol && nLine) { - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "Columns"; - aArgs[0].Value <<= sal_Int16( nCol ); - aArgs[1].Name = "Rows"; - aArgs[1].Value <<= sal_Int16( nLine ); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("Columns", sal_Int16( nCol )), + comphelper::makePropertyValue("Rows", sal_Int16( nLine )) }; mxControl->TableDialog( aArgs ); } @@ -675,11 +673,10 @@ void ColumnsWidget::InsertColumns() { if (nCol) { - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "Columns"; - aArgs[0].Value <<= sal_Int16( nCol ); - aArgs[1].Name = "Modifier"; - aArgs[1].Value <<= sal_Int16( m_bMod1 ? KEY_MOD1 : 0 ); + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue("Columns", sal_Int16( nCol )), + comphelper::makePropertyValue("Modifier", sal_Int16( m_bMod1 ? KEY_MOD1 : 0 )) + }; mxControl->InsertColumns(aArgs); } } diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index 7adb99ecaaa2..8f628876f2c4 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -31,6 +31,8 @@ #include <svx/strings.hrc> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> + #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -219,9 +221,7 @@ void SvxUndoRedoControl::Do(sal_Int16 nCount) if ( xDispatch.is() ) { INetURLObject aObj( m_aCommandURL ); - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value <<= nCount; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(aObj.GetURLPath(), nCount) }; xDispatch->dispatch(aTargetURL, aArgs); } } diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 1771e2f74649..81f064fc78f4 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -47,6 +47,7 @@ #include <memory> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -327,21 +328,20 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void) pLineEndItem.reset(new XLineEndItem(pEntry->GetName(), pEntry->GetLineEnd())); } - Sequence< PropertyValue > aArgs( 1 ); + OUString name; Any a; if ( pLineStartItem ) { - aArgs[0].Name = "LineStart"; + name = "LineStart"; pLineStartItem->QueryValue( a ); - aArgs[0].Value = a; } else { - aArgs[0].Name = "LineEnd"; + name = "LineEnd"; pLineEndItem->QueryValue( a ); - aArgs[0].Value = a; } + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(name, a) }; /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. This instance may be deleted in the meantime (i.e. when a dialog is opened @@ -611,10 +611,8 @@ IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void) XLineDashItem aLineDashItem(pEntry->GetName(), pEntry->GetDash()); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "LineDash"; aLineDashItem.QueryValue ( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("LineDash", a) }; mxControl->dispatchLineStyleCommand(".uno:LineDash", aArgs); // set also cap style using the toolbar line style selection popup @@ -623,10 +621,8 @@ IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void) eStyle == drawing::DashStyle_RECT || eStyle == drawing::DashStyle_RECTRELATIVE ? css::drawing::LineCap_BUTT : css::drawing::LineCap_ROUND ); - Sequence< PropertyValue > aArgs2( 1 ); - aArgs2[0].Name = "LineCap"; aLineCapItem.QueryValue ( a ); - aArgs2[0].Value = a; + Sequence< PropertyValue > aArgs2{ comphelper::makePropertyValue("LineCap", a) }; mxControl->dispatchLineStyleCommand(".uno:LineCap", aArgs2); } } @@ -635,10 +631,8 @@ IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void) XLineStyleItem aLineStyleItem( eXLS ); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "XLineStyle"; aLineStyleItem.QueryValue ( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("XLineStyle", a) }; mxControl->dispatchLineStyleCommand(".uno:XLineStyle", aArgs); mxControl->EndPopupMode(); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 1c816097b3ff..8327fe48cf61 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -21,6 +21,7 @@ #include <comphelper/configurationlistener.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <tools/color.hxx> #include <svl/numformat.hxx> #include <svl/poolitem.hxx> @@ -915,11 +916,9 @@ IMPL_LINK(SvxStyleBox_Base, MenuSelectHdl, const OString&, rMenuIdent, void) OUString sEntry = m_xWidget->get_text(m_nLastItemWithMenu); ReleaseFocus(); // It must be after getting entry pos! - Sequence<PropertyValue> aArgs(2); - aArgs[0].Name = "Param"; - aArgs[0].Value <<= sEntry; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16( eStyleFamily ); + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("Param", sEntry), + comphelper::makePropertyValue("Family", + sal_Int16( eStyleFamily )) }; if (rMenuIdent == "update") { @@ -1015,17 +1014,18 @@ void SvxStyleBox_Base::Select(bool bNonTravelSelect) m_xWidget->save_value(); Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Value <<= aSearchEntry; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16( eStyleFamily ); + auto pArgs = aArgs.getArray(); + pArgs[0].Value <<= aSearchEntry; + pArgs[1].Name = "Family"; + pArgs[1].Value <<= sal_Int16( eStyleFamily ); if( bCreateNew ) { - aArgs[0].Name = "Param"; + pArgs[0].Name = "Param"; SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:StyleNewByExample", aArgs); } else { - aArgs[0].Name = "Template"; + pArgs[0].Name = "Template"; SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs ); } } @@ -1684,6 +1684,7 @@ IMPL_LINK_NOARG(SvxFontNameBox_Base, ActivateHdl, weld::ComboBox&, bool) void SvxFontNameBox_Base::Select(bool bNonTravelSelect) { Sequence< PropertyValue > aArgs( 1 ); + auto pArgs = aArgs.getArray(); std::unique_ptr<SvxFontItem> pFontItem; if ( pFontList ) { @@ -1701,7 +1702,7 @@ void SvxFontNameBox_Base::Select(bool bNonTravelSelect) Any a; pFontItem->QueryValue( a ); - aArgs[0].Value = a; + pArgs[0].Value = a; } if (bNonTravelSelect) @@ -1714,7 +1715,7 @@ void SvxFontNameBox_Base::Select(bool bNonTravelSelect) EndPreview(); if (pFontItem) { - aArgs[0].Name = "CharFontName"; + pArgs[0].Name = "CharFontName"; SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:CharFontName", aArgs ); @@ -1724,7 +1725,7 @@ void SvxFontNameBox_Base::Select(bool bNonTravelSelect) { if (pFontItem) { - aArgs[0].Name = "CharPreviewFontName"; + pArgs[0].Name = "CharPreviewFontName"; SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:CharPreviewFontName", aArgs ); @@ -2349,14 +2350,11 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, ValueSet*, void) aBorderInner.SetValid( SvxBoxInfoItemValidFlags::DISTANCE ); aBorderInner.SetValid( SvxBoxInfoItemValidFlags::DISABLE, false ); - Any a; - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "OuterBorder"; - aBorderOuter.QueryValue( a ); - aArgs[0].Value = a; - aArgs[1].Name = "InnerBorder"; - aBorderInner.QueryValue( a ); - aArgs[1].Value = a; + Any a1, a2; + aBorderOuter.QueryValue( a1 ); + aBorderInner.QueryValue( a2 ); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("OuterBorder", a1), + comphelper::makePropertyValue("InnerBorder", a2) }; mxControl->dispatchCommand( ".uno:SetBorderStyle", aArgs ); } @@ -2376,10 +2374,8 @@ void SvxFrameWindow_Impl::SetDiagonalDownBorder(const SvxLineItem& dDownLineItem { // apply diagonal down border Any a; - Sequence<PropertyValue> aArgs(1); - aArgs[0].Name = "BorderTLBR"; dDownLineItem.QueryValue(a); - aArgs[0].Value = a; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("BorderTLBR", a) }; mxControl->dispatchCommand(".uno:BorderTLBR", aArgs); } @@ -2388,10 +2384,8 @@ void SvxFrameWindow_Impl::SetDiagonalUpBorder(const SvxLineItem& dUpLineItem) { // apply diagonal up border Any a; - Sequence<PropertyValue> aArgs(1); - aArgs[0].Name = "BorderBLTR"; dUpLineItem.QueryValue(a); - aArgs[0].Value = a; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("BorderBLTR", a) }; mxControl->dispatchCommand(".uno:BorderBLTR", aArgs); } @@ -2547,10 +2541,8 @@ IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl, ValueSet*, void) aLineItem.SetLine( nullptr ); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "LineStyle"; aLineItem.QueryValue( a, m_bIsWriter ? CONVERT_TWIPS : 0 ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("LineStyle", a) }; m_xControl->dispatchCommand( ".uno:LineStyle", aArgs ); @@ -3778,9 +3770,8 @@ void SvxCurrencyToolBoxControl::execute( sal_Int16 nSelectModifier ) if( nFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "NumberFormatCurrency"; - aArgs[0].Value <<= nFormatKey; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("NumberFormatCurrency", + nFormatKey) }; dispatchCommand( m_aCommandURL, aArgs ); m_nFormatKey = nFormatKey; } diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 8811d75dc2aa..413b12741ac7 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <comphelper/propertyvalue.hxx> #include <rtl/math.hxx> #include <vcl/event.hxx> #include <vcl/svapp.hxx> @@ -219,9 +220,8 @@ void SvxFontSizeBox_Base::Select() sal_Int64 nSelVal = m_xWidget->get_value(); float fSelVal = float( nSelVal ) / 10; - uno::Sequence< beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "FontHeight.Height"; - aArgs[0].Value <<= fSelVal; + uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue("FontHeight.Height", + fSelVal) }; /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. This instance may be deleted in the meantime (i.e. when a dialog is opened |