From 8d414f3a8de5c25bcd830b1d4d8a7be3c34a2ed4 Mon Sep 17 00:00:00 2001 From: Michael Warner Date: Sat, 30 May 2020 22:18:29 -0400 Subject: tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctor Change-Id: Id747848b222f69af3293a2095a62542f1e1116d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95215 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- forms/source/component/Date.cxx | 43 ++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to 'forms') diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx index cca3e06821d7..1d16109ce672 100644 --- a/forms/source/component/Date.cxx +++ b/forms/source/component/Date.cxx @@ -55,16 +55,10 @@ Sequence ODateControl::_getTypes() return OBoundControl::_getTypes(); } - css::uno::Sequence SAL_CALL ODateControl::getSupportedServiceNames() { - css::uno::Sequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_DATEFIELD; - pArray[aSupported.getLength()-2] = STARDIV_ONE_FORM_CONTROL_DATEFIELD; - return aSupported; + const css::uno::Sequence vals { FRM_SUN_CONTROL_DATEFIELD, STARDIV_ONE_FORM_CONTROL_DATEFIELD }; + return comphelper::concatSequences(OBoundControl::getSupportedServiceNames(), vals); } @@ -122,26 +116,19 @@ IMPLEMENT_DEFAULT_CLONING( ODateModel ) css::uno::Sequence SAL_CALL ODateModel::getSupportedServiceNames() { - css::uno::Sequence aSupported = OBoundControlModel::getSupportedServiceNames(); - - sal_Int32 nOldLen = aSupported.getLength(); - aSupported.realloc( nOldLen + 9 ); - OUString* pStoreTo = aSupported.getArray() + nOldLen; - - *pStoreTo++ = BINDABLE_CONTROL_MODEL; - *pStoreTo++ = DATA_AWARE_CONTROL_MODEL; - *pStoreTo++ = VALIDATABLE_CONTROL_MODEL; - - *pStoreTo++ = BINDABLE_DATA_AWARE_CONTROL_MODEL; - *pStoreTo++ = VALIDATABLE_BINDABLE_CONTROL_MODEL; - - *pStoreTo++ = FRM_SUN_COMPONENT_DATEFIELD; - *pStoreTo++ = FRM_SUN_COMPONENT_DATABASE_DATEFIELD; - *pStoreTo++ = BINDABLE_DATABASE_DATE_FIELD; - - *pStoreTo++ = FRM_COMPONENT_DATEFIELD; - - return aSupported; + const css::uno::Sequence vals { + BINDABLE_CONTROL_MODEL, + DATA_AWARE_CONTROL_MODEL, + VALIDATABLE_CONTROL_MODEL, + BINDABLE_DATA_AWARE_CONTROL_MODEL, + VALIDATABLE_BINDABLE_CONTROL_MODEL, + FRM_SUN_COMPONENT_DATEFIELD, + FRM_SUN_COMPONENT_DATABASE_DATEFIELD, + BINDABLE_DATABASE_DATE_FIELD, + FRM_COMPONENT_DATEFIELD + }; + + return comphelper::concatSequences(OBoundControlModel::getSupportedServiceNames(), vals); } -- cgit