summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-09 13:43:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-09 14:24:00 +0200
commit027b25ecd54ac97ea2471ca73e3ba89ce052fe76 (patch)
treefe8923a13998a96a865027c897273d0edb4d7c62 /sc
parentf59e802478e35e7b6f561f24806bca47b604529b (diff)
use comphelper::InitPropertySequence in more places
Change-Id: I72d7b13a23ce306b752b39187a0e9fbb7028643a Reviewed-on: https://gerrit.libreoffice.org/38606 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/extras/sccellrangeobj.cxx7
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx86
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx15
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx8
-rw-r--r--sc/source/ui/docshell/docsh8.cxx10
-rw-r--r--sc/source/ui/unoobj/PivotTableDataProvider.cxx28
-rw-r--r--sc/source/ui/unoobj/TablePivotCharts.cxx10
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx19
-rw-r--r--sc/source/ui/unoobj/docuno.cxx8
-rw-r--r--sc/source/ui/unoobj/eventuno.cxx12
-rw-r--r--sc/source/ui/unoobj/filtuno.cxx11
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx20
12 files changed, 98 insertions, 136 deletions
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index 40a3ebc638c1..07f6110d01fc 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -120,14 +120,13 @@ void ScCellRangeObj::testSortOOB()
uno::Sequence<beans::PropertyValue> aEmptyDescriptor;
xSortable->sort(aEmptyDescriptor);
- uno::Sequence<beans::PropertyValue> aProps(1);
uno::Sequence<util::SortField> aSort(1);
-
aSort[0].Field = 0xffffff;
aSort[0].SortAscending = true;
- aProps[0].Name = "SortFields";
- aProps[0].Value <<= aSort;
+ uno::Sequence<beans::PropertyValue> aProps( comphelper::InitPropertySequence({
+ { "SortFields", Any(aSort) }
+ }));
xSortable->sort(aProps);
}
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 565aa3bfe08c..3778f4be1093 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -209,13 +209,12 @@ void ScTiledRenderingTest::testRowColumnSelections()
{
comphelper::LibreOfficeKit::setActive();
ScModelObj* pModelObj = createDoc("select-row-cols.ods");
- uno::Sequence<beans::PropertyValue> aArgs(2);
// Select the 5th row with no modifier
- aArgs[0].Name = OUString::fromUtf8("Row");
- aArgs[0].Value <<= static_cast<sal_Int32>(5 - 1);
- aArgs[1].Name = OUString::fromUtf8("Modifier");
- aArgs[1].Value <<= static_cast<sal_uInt16>(0);
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "Row", uno::Any(sal_Int32(5 - 1)) },
+ { "Modifier", uno::Any(sal_uInt16(0)) }
+ }));
comphelper::dispatchCommand(".uno:SelectRow", aArgs);
// Check if it is selected
@@ -384,13 +383,12 @@ void ScTiledRenderingTest::testEmptyColumnSelection()
{
comphelper::LibreOfficeKit::setActive();
ScModelObj* pModelObj = createDoc("select-row-cols.ods");
- uno::Sequence<beans::PropertyValue> aArgs(2);
// Select empty column, 1000
- aArgs[0].Name = OUString::fromUtf8("Col");
- aArgs[0].Value <<= static_cast<sal_Int32>(1000 - 1);
- aArgs[1].Name = OUString::fromUtf8("Modifier");
- aArgs[1].Value <<= static_cast<sal_uInt16>(0);
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "Col", uno::Any(sal_Int32(1000 - 1)) },
+ { "Modifier", uno::Any(sal_uInt16(0)) }
+ }));
comphelper::dispatchCommand(".uno:SelectColumn", aArgs);
// Get plain selection
@@ -640,15 +638,14 @@ void ScTiledRenderingTest::testColRowResize()
pViewShell->registerLibreOfficeKitViewCallback(&ScTiledRenderingTest::callback, this);
- uno::Sequence<beans::PropertyValue> aArgs(2);
ScDocument& rDoc = pDocSh->GetDocument();
// Col 3, Tab 0
int nOldWidth = rDoc.GetColWidth(static_cast<SCCOL>(2), static_cast<SCTAB>(0), false);
- aArgs[0].Name = OUString::fromUtf8("Column");
- aArgs[0].Value <<= static_cast<sal_Int16>(3);
- aArgs[1].Name = OUString::fromUtf8("Width");
- aArgs[1].Value <<= static_cast<sal_uInt16>(nOldWidth + 100);
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "Column", uno::Any(sal_Int16(3)) },
+ { "Width", uno::Any(sal_uInt16(nOldWidth + 100)) }
+ }));
comphelper::dispatchCommand(".uno:ColumnWidth", aArgs);
int nNewWidth = rDoc.GetColWidth(static_cast<SCCOL>(2), static_cast<SCTAB>(0), false);
@@ -657,11 +654,11 @@ void ScTiledRenderingTest::testColRowResize()
// Row 5, Tab 0
int nOldHeight = rDoc.GetRowHeight(static_cast<SCROW>(4), static_cast<SCTAB>(0), false);
- aArgs[0].Name = OUString::fromUtf8("Row");
- aArgs[0].Value <<= static_cast<sal_Int16>(5);
- aArgs[1].Name = OUString::fromUtf8("Height");
- aArgs[1].Value <<= static_cast<sal_uInt16>(nOldHeight + 100);
- comphelper::dispatchCommand(".uno:RowHeight", aArgs);
+ uno::Sequence<beans::PropertyValue> aArgs2( comphelper::InitPropertySequence({
+ { "Row", uno::Any(sal_Int16(5)) },
+ { "Height", uno::Any(sal_uInt16(nOldHeight + 100)) }
+ }));
+ comphelper::dispatchCommand(".uno:RowHeight", aArgs2);
int nNewHeight = rDoc.GetRowHeight(static_cast<SCROW>(4), static_cast<SCTAB>(0), false);
CPPUNIT_ASSERT(nNewHeight > nOldHeight);
@@ -902,21 +899,18 @@ void ScTiledRenderingTest::testHideColRow()
comphelper::LibreOfficeKit::setActive();
createDoc("small.ods");
{
- uno::Sequence<beans::PropertyValue> aArgs(2);
-
- aArgs[0].Name = OUString::fromUtf8("Col");
- aArgs[0].Value <<= static_cast<sal_Int32>(2 - 1);
- aArgs[1].Name = OUString::fromUtf8("Modifier");
- aArgs[1].Value <<= KEY_SHIFT;
-
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "Col", uno::Any(sal_Int32(2 - 1)) },
+ { "Modifier", uno::Any(KEY_SHIFT) }
+ }));
comphelper::dispatchCommand(".uno:SelectColumn", aArgs);
- aArgs[0].Name = OUString::fromUtf8("Col");
- aArgs[0].Value <<= static_cast<sal_Int32>(3 - 1);
- aArgs[1].Name = OUString::fromUtf8("Modifier");
- aArgs[1].Value <<= static_cast<sal_uInt16>(0);
+ uno::Sequence<beans::PropertyValue> aArgs2( comphelper::InitPropertySequence({
+ { "Col", uno::Any(sal_Int32(3 - 1)) },
+ { "Modifier", uno::Any(sal_uInt16(0)) }
+ }));
- comphelper::dispatchCommand(".uno:SelectColumn", aArgs);
+ comphelper::dispatchCommand(".uno:SelectColumn", aArgs2);
Scheduler::ProcessEventsToIdle();
}
@@ -933,21 +927,17 @@ void ScTiledRenderingTest::testHideColRow()
CPPUNIT_ASSERT(nNewCurX > nOldCurX);
CPPUNIT_ASSERT_EQUAL(nOldCurY, nNewCurY);
{
- uno::Sequence<beans::PropertyValue> aArgs(2);
-
- aArgs[0].Name = OUString::fromUtf8("Row");
- aArgs[0].Value <<= static_cast<sal_Int32>(6 - 1);
- aArgs[1].Name = OUString::fromUtf8("Modifier");
- aArgs[1].Value <<= KEY_SHIFT;
-
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "Row", uno::Any(sal_Int32(6 - 1)) },
+ { "Modifier", uno::Any(KEY_SHIFT) }
+ }));
comphelper::dispatchCommand(".uno:SelectRow", aArgs);
- aArgs[0].Name = OUString::fromUtf8("Row");
- aArgs[0].Value <<= static_cast<sal_Int32>(7 - 1);
- aArgs[1].Name = OUString::fromUtf8("Modifier");
- aArgs[1].Value <<= static_cast<sal_uInt16>(0);
-
- comphelper::dispatchCommand(".uno:SelectRow", aArgs);
+ uno::Sequence<beans::PropertyValue> aArgs2( comphelper::InitPropertySequence({
+ { "Row", uno::Any(sal_Int32(7 - 1)) },
+ { "Modifier", uno::Any(sal_uInt16(0)) }
+ }));
+ comphelper::dispatchCommand(".uno:SelectRow", aArgs2);
Scheduler::ProcessEventsToIdle();
}
@@ -1301,9 +1291,9 @@ void ScTiledRenderingTest::testInsertGraphicInvalidations()
// insert an image in view and see if both views are invalidated
aView.m_bInvalidateTiles = false;
- uno::Sequence<beans::PropertyValue> aArgs(1);
- aArgs[0].Name = OUString::fromUtf8("FileName");
- aArgs[0].Value <<= (m_directories.getURLFromSrc(DATA_DIRECTORY) + "smile.png");
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "FileName", uno::Any(m_directories.getURLFromSrc(DATA_DIRECTORY) + "smile.png") }
+ }));
comphelper::dispatchCommand(".uno:InsertGraphic", aArgs);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index a9d0464a82d8..6236dd6e7369 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/sheet/XSheetCondition.hpp>
#include <com/sun/star/sheet/TableValidationVisibility.hpp>
#include <comphelper/extract.hxx>
+#include <comphelper/propertysequence.hxx>
#include <sfx2/app.hxx>
#include <o3tl/make_unique.hxx>
@@ -411,15 +412,11 @@ void ScMyValidationsContainer::WriteValidations(ScXMLExport& rExport)
bool bScriptURL = SfxApplication::IsXScriptURL( aItr->sErrorTitle );
const OUString sScript("Script");
- uno::Sequence<beans::PropertyValue> aSeq(3);
- beans::PropertyValue* pArr(aSeq.getArray());
- pArr[0].Name = "EventType";
- pArr[0].Value <<= bScriptURL ? sScript : OUString("StarBasic");
- pArr[1].Name = "Library";
- pArr[1].Value <<= OUString();
- pArr[2].Name = bScriptURL ? sScript : OUString("MacroName");
- pArr[2].Value <<= aItr->sErrorTitle;
-
+ uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({
+ { "EventType", uno::Any(bScriptURL ? sScript : OUString("StarBasic")) },
+ { "Library", uno::Any(OUString()) },
+ { bScriptURL ? sScript : OUString("MacroName"), uno::Any(aItr->sErrorTitle) }
+ }));
// 2) export the sequence
rExport.GetEventExport().ExportSingleEvent( aSeq, "OnError");
}
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 0e702d0e5a13..880c2f5320ea 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -24,6 +24,7 @@
#include <sot/storage.hxx>
#include <osl/diagnose.h>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
#include <unotools/streamwrap.hxx>
#include <svx/xmlgrhlp.hxx>
#include <svtools/sfxecode.hxx>
@@ -747,10 +748,9 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
if (pMedium)
sFileName = pMedium->GetName();
SfxObjectShell* pObjSh = rDoc.GetDocumentShell();
- uno::Sequence<beans::PropertyValue> aDescriptor(1);
- beans::PropertyValue* pProps = aDescriptor.getArray();
- pProps[0].Name = "FileName";
- pProps[0].Value <<= sFileName;
+ uno::Sequence<beans::PropertyValue> aDescriptor( comphelper::InitPropertySequence({
+ { "FileName", uno::Any(sFileName) }
+ }));
/** property map for export info set */
comphelper::PropertyMapEntry const aExportInfoMap[] =
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index fe715fa66cf6..85d73f4070d7 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -23,6 +23,7 @@
#include <tools/urlobj.hxx>
#include <svl/converter.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
#include <comphelper/string.hxx>
#include <comphelper/types.hxx>
#include <ucbhelper/content.hxx>
@@ -140,11 +141,10 @@ namespace
aCharSetStr = OUString::createFromAscii( pIanaName );
}
- uno::Sequence<beans::PropertyValue> aProps(2);
- aProps[0].Name = SC_DBPROP_EXTENSION;
- aProps[0].Value <<= aExtension;
- aProps[1].Name = SC_DBPROP_CHARSET;
- aProps[1].Value <<= aCharSetStr;
+ uno::Sequence<beans::PropertyValue> aProps( comphelper::InitPropertySequence({
+ { SC_DBPROP_EXTENSION, uno::Any(aExtension) },
+ { SC_DBPROP_CHARSET, uno::Any(aCharSetStr) }
+ }));
_rConnection = _rDrvMgr->getConnectionWithInfo( aConnUrl, aProps );
return 0L;
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index 65046a075021..7e13f3429eb7 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -26,6 +26,7 @@
#include <vcl/svapp.hxx>
#include <sfx2/objsh.hxx>
+#include <comphelper/propertysequence.hxx>
#include <comphelper/sequence.hxx>
#include <com/sun/star/chart2/data/LabeledDataSequence.hpp>
@@ -699,26 +700,15 @@ uno::Reference<chart2::data::XDataSource>
uno::Sequence<beans::PropertyValue> SAL_CALL PivotTableDataProvider::detectArguments(
const uno::Reference<chart2::data::XDataSource> & xDataSource)
{
- uno::Sequence<beans::PropertyValue> aArguments;
-
if (!m_pDocument ||!xDataSource.is())
- return aArguments;
-
- aArguments.realloc(4);
-
- aArguments[0] = beans::PropertyValue("CellRangeRepresentation", -1, uno::Any(OUString("PivotChart")),
- beans::PropertyState_DIRECT_VALUE);
-
- aArguments[1] = beans::PropertyValue("DataRowSource", -1, uno::Any(chart::ChartDataRowSource_COLUMNS),
- beans::PropertyState_DIRECT_VALUE);
-
- aArguments[2] = beans::PropertyValue("FirstCellAsLabel", -1, uno::Any(false),
- beans::PropertyState_DIRECT_VALUE);
-
- aArguments[3] = beans::PropertyValue("HasCategories", -1, uno::Any(true),
- beans::PropertyState_DIRECT_VALUE);
-
- return aArguments;
+ return uno::Sequence<beans::PropertyValue>();
+
+ return comphelper::InitPropertySequence({
+ { "CellRangeRepresentation", uno::Any(OUString("PivotChart")) },
+ { "DataRowSource", uno::Any(chart::ChartDataRowSource_COLUMNS) },
+ { "FirstCellAsLabel", uno::Any(false) },
+ { "HasCategories", uno::Any(true) }
+ });
}
sal_Bool SAL_CALL PivotTableDataProvider::createDataSequenceByRangeRepresentationPossible(const OUString& /*aRangeRepresentation*/)
diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx
index e07be4068e59..16d260fec458 100644
--- a/sc/source/ui/unoobj/TablePivotCharts.cxx
+++ b/sc/source/ui/unoobj/TablePivotCharts.cxx
@@ -23,6 +23,7 @@
#include <svx/charthelper.hxx>
#include <sfx2/app.hxx>
#include <unotools/moduleoptions.hxx>
+#include <comphelper/propertysequence.hxx>
#include <comphelper/classids.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/globname.hxx>
@@ -145,10 +146,11 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName,
uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(m_pDocShell->GetModel(), uno::UNO_QUERY);
xReceiver->attachNumberFormatsSupplier(xNumberFormatsSupplier);
- uno::Sequence<beans::PropertyValue> aArgs(3);
- aArgs[0] = beans::PropertyValue("CellRangeRepresentation", -1, uno::makeAny(rDataPilotName), beans::PropertyState_DIRECT_VALUE);
- aArgs[1] = beans::PropertyValue("HasCategories", -1, uno::makeAny(true), beans::PropertyState_DIRECT_VALUE);
- aArgs[2] = beans::PropertyValue("DataRowSource", -1, uno::makeAny(chart::ChartDataRowSource_COLUMNS), beans::PropertyState_DIRECT_VALUE);
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "CellRangeRepresentation", uno::makeAny(rDataPilotName) },
+ { "HasCategories", uno::makeAny(true) },
+ { "DataRowSource", uno::makeAny(chart::ChartDataRowSource_COLUMNS) }
+ }));
xReceiver->setArguments(aArgs);
}
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 99d8add7102b..6a18af374367 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -57,6 +57,7 @@
#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <comphelper/extract.hxx>
+#include <comphelper/propertysequence.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
@@ -958,22 +959,18 @@ Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPrope
const ScDPServiceDesc* pServiceDesc = pDPObject->GetDPServiceDesc();
if (pServiceDesc)
{
- uno::Sequence<beans::PropertyValue> aSeq( 4 );
- beans::PropertyValue* pArray = aSeq.getArray();
- pArray[0].Name = SC_UNO_DP_SOURCENAME;
- pArray[0].Value <<= pServiceDesc->aParSource;
- pArray[1].Name = SC_UNO_DP_OBJECTNAME;
- pArray[1].Value <<= pServiceDesc->aParName;
- pArray[2].Name = SC_UNO_DP_USERNAME;
- pArray[2].Value <<= pServiceDesc->aParUser;
- pArray[3].Name = SC_UNO_DP_PASSWORD;
- pArray[3].Value <<= pServiceDesc->aParPass;
+ uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({
+ { SC_UNO_DP_SOURCENAME, Any(pServiceDesc->aParSource) },
+ { SC_UNO_DP_OBJECTNAME, Any(pServiceDesc->aParName) },
+ { SC_UNO_DP_USERNAME, Any(pServiceDesc->aParUser) },
+ { SC_UNO_DP_PASSWORD, Any(pServiceDesc->aParPass) }
+ }));
aRet <<= aSeq;
}
else
{
// empty sequence
- uno::Sequence<beans::PropertyValue> aEmpty(0);
+ uno::Sequence<beans::PropertyValue> aEmpty;
aRet <<= aEmpty;
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 5df2608e73e6..305e788670cb 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -34,6 +34,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
+#include <comphelper/propertysequence.hxx>
#include <officecfg/Office/Common.hxx>
#include <officecfg/Office/Calc.hxx>
#include <svl/numuno.hxx>
@@ -1644,10 +1645,9 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
Size aTwips = aDefaultFunc.GetPageSize();
awt::Size aPageSize( TwipsToHMM( aTwips.Width() ), TwipsToHMM( aTwips.Height() ) );
- uno::Sequence<beans::PropertyValue> aSequence(1);
- beans::PropertyValue* pArray = aSequence.getArray();
- pArray[0].Name = SC_UNONAME_PAGESIZE;
- pArray[0].Value <<= aPageSize;
+ uno::Sequence<beans::PropertyValue> aSequence( comphelper::InitPropertySequence({
+ { SC_UNONAME_PAGESIZE, uno::Any(aPageSize) }
+ }));
if( ! pPrinterOptions )
pPrinterOptions = new ScPrintUIOptions;
diff --git a/sc/source/ui/unoobj/eventuno.cxx b/sc/source/ui/unoobj/eventuno.cxx
index 1ab409416273..e54a6938a94e 100644
--- a/sc/source/ui/unoobj/eventuno.cxx
+++ b/sc/source/ui/unoobj/eventuno.cxx
@@ -22,6 +22,7 @@
#include "docsh.hxx"
#include "sheetevents.hxx"
#include "unonames.hxx"
+#include <comphelper/propertysequence.hxx>
#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
@@ -132,13 +133,10 @@ uno::Any SAL_CALL ScSheetEventsObj::getByName( const OUString& aName )
uno::Any aRet;
if (pScript)
{
- uno::Sequence<beans::PropertyValue> aPropSeq( 2 );
- aPropSeq[0] = beans::PropertyValue(
- "EventType", -1,
- uno::makeAny( OUString("Script") ), beans::PropertyState_DIRECT_VALUE );
- aPropSeq[1] = beans::PropertyValue(
- "Script", -1,
- uno::makeAny( *pScript ), beans::PropertyState_DIRECT_VALUE );
+ uno::Sequence<beans::PropertyValue> aPropSeq( comphelper::InitPropertySequence({
+ { "EventType", uno::Any( OUString("Script") ) },
+ { "Script", uno::Any( *pScript ) }
+ }));
aRet <<= aPropSeq;
}
// empty Any if nothing was set
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index 7b805717aae6..f31eba2295bf 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -39,6 +39,7 @@
#include <optutil.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <comphelper/propertysequence.hxx>
#include <memory>
using namespace com::sun::star;
@@ -119,13 +120,9 @@ Calc_FilterOptionsDialog_get_implementation(css::uno::XComponentContext*, css::u
uno::Sequence<beans::PropertyValue> SAL_CALL ScFilterOptionsObj::getPropertyValues()
{
- uno::Sequence<beans::PropertyValue> aRet(1);
- beans::PropertyValue* pArray = aRet.getArray();
-
- pArray[0].Name = SC_UNONAME_FILTEROPTIONS;
- pArray[0].Value <<= aFilterOptions;
-
- return aRet;
+ return comphelper::InitPropertySequence({
+ { SC_UNONAME_FILTEROPTIONS, Any(aFilterOptions) }
+ });
}
void SAL_CALL ScFilterOptionsObj::setPropertyValues( const uno::Sequence<beans::PropertyValue>& aProps )
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index b4266155f859..33600f6165ee 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <comphelper/propertysequence.hxx>
#include <cppuhelper/supportsservice.hxx>
#include "styleuno.hxx"
@@ -529,20 +530,11 @@ void SAL_CALL ScStyleFamiliesObj::loadStylesFromURL( const OUString& aURL,
uno::Sequence<beans::PropertyValue> SAL_CALL ScStyleFamiliesObj::getStyleLoaderOptions()
{
// return defaults for options (?)
-
- uno::Sequence<beans::PropertyValue> aSequence(3);
- beans::PropertyValue* pArray = aSequence.getArray();
-
- pArray[0].Name = SC_UNONAME_OVERWSTL;
- pArray[0].Value <<= true;
-
- pArray[1].Name = SC_UNONAME_LOADCELL;
- pArray[1].Value <<= true;
-
- pArray[2].Name = SC_UNONAME_LOADPAGE;
- pArray[2].Value <<= true;
-
- return aSequence;
+ return comphelper::InitPropertySequence({
+ { SC_UNONAME_OVERWSTL, uno::Any(true) },
+ { SC_UNONAME_LOADCELL, uno::Any(true) },
+ { SC_UNONAME_LOADPAGE, uno::Any(true) }
+ });
}
// style::XStyleLoader2