[Libreoffice-commits] core.git: chart2/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 8 08:25:49 UTC 2021


 chart2/source/model/main/ChartModel.cxx           |    8 ++------
 chart2/source/model/template/BarChartType.cxx     |    6 +-----
 chart2/source/model/template/BubbleChartType.cxx  |   12 ++----------
 chart2/source/model/template/ChartType.cxx        |    5 +----
 chart2/source/model/template/ColumnChartType.cxx  |    6 +-----
 chart2/source/model/template/PieChartType.cxx     |    6 +-----
 chart2/source/model/template/ScatterChartType.cxx |    6 +-----
 chart2/source/tools/CommonConverters.cxx          |   12 ++----------
 chart2/source/tools/DataSourceHelper.cxx          |   18 ++++++------------
 chart2/source/view/charttypes/ConfigAccess.cxx    |    3 +--
 10 files changed, 18 insertions(+), 64 deletions(-)

New commits:
commit 5895be734d1872c9c014aca5fe77813dd78cfd14
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Mon Jun 7 21:54:42 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Tue Jun 8 10:25:12 2021 +0200

    Simplify Sequences initializations (chart2)(part1)
    
    Change-Id: I97ddde9659f337932b4165b794a769b83882126d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116802
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 164daeed7c3d..01bf592f7f34 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1080,13 +1080,9 @@ uno::Any SAL_CALL ChartModel::getTransferData( const datatransfer::DataFlavor& a
 
 Sequence< datatransfer::DataFlavor > SAL_CALL ChartModel::getTransferDataFlavors()
 {
-    uno::Sequence< datatransfer::DataFlavor > aRet(1);
-
-    aRet[0] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMETypeHighContrast,
+    return { datatransfer::DataFlavor( lcl_aGDIMetaFileMIMETypeHighContrast,
         "GDIMetaFile",
-        cppu::UnoType<uno::Sequence< sal_Int8 >>::get() );
-
-    return aRet;
+        cppu::UnoType<uno::Sequence< sal_Int8 >>::get() ) };
 }
 
 sal_Bool SAL_CALL ChartModel::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
diff --git a/chart2/source/model/template/BarChartType.cxx b/chart2/source/model/template/BarChartType.cxx
index 87675e3f140d..d32aa6efeca3 100644
--- a/chart2/source/model/template/BarChartType.cxx
+++ b/chart2/source/model/template/BarChartType.cxx
@@ -53,11 +53,7 @@ OUString SAL_CALL BarChartType::getChartType()
 
 uno::Sequence< OUString > BarChartType::getSupportedPropertyRoles()
 {
-    uno::Sequence< OUString > aPropRoles(2);
-    aPropRoles[0] = "FillColor";
-    aPropRoles[1] = "BorderColor";
-
-    return aPropRoles;
+    return { "FillColor", "BorderColor" };
 }
 
 OUString SAL_CALL BarChartType::getImplementationName()
diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx
index 4abdbb826467..1998eb9e4dc7 100644
--- a/chart2/source/model/template/BubbleChartType.cxx
+++ b/chart2/source/model/template/BubbleChartType.cxx
@@ -147,20 +147,12 @@ OUString SAL_CALL BubbleChartType::getChartType()
 
 uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
 {
-    uno::Sequence< OUString > aMandRolesSeq(4);
-    aMandRolesSeq[0] = "label";
-    aMandRolesSeq[1] = "values-x";
-    aMandRolesSeq[2] = "values-y";
-    aMandRolesSeq[3] = "values-size";
-    return aMandRolesSeq;
+    return { "label", "values-x", "values-y", "values-size" };
 }
 
 uno::Sequence< OUString > SAL_CALL BubbleChartType::getSupportedPropertyRoles()
 {
-    uno::Sequence< OUString > aPropertyRoles(2);
-    aPropertyRoles[0] = "FillColor";
-    aPropertyRoles[1] = "BorderColor";
-    return aPropertyRoles;
+    return { "FillColor", "BorderColor" };
 }
 
 OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx
index 177eb4f1372d..5eb0adca0f06 100644
--- a/chart2/source/model/template/ChartType.cxx
+++ b/chart2/source/model/template/ChartType.cxx
@@ -98,10 +98,7 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
 
 Sequence< OUString > SAL_CALL ChartType::getSupportedMandatoryRoles()
 {
-    Sequence< OUString > aDefaultSeq(2);
-    aDefaultSeq[0] = "label";
-    aDefaultSeq[1] = "values-y";
-    return aDefaultSeq;
+    return { "label", "values-y" };
 }
 
 Sequence< OUString > SAL_CALL ChartType::getSupportedOptionalRoles()
diff --git a/chart2/source/model/template/ColumnChartType.cxx b/chart2/source/model/template/ColumnChartType.cxx
index 4c95b1c1b0b8..487cf8977099 100644
--- a/chart2/source/model/template/ColumnChartType.cxx
+++ b/chart2/source/model/template/ColumnChartType.cxx
@@ -149,11 +149,7 @@ OUString SAL_CALL ColumnChartType::getChartType()
 
 uno::Sequence< OUString > ColumnChartType::getSupportedPropertyRoles()
 {
-    uno::Sequence< OUString > aPropRoles(2);
-    aPropRoles[0] = "FillColor";
-    aPropRoles[1] = "BorderColor";
-
-    return aPropRoles;
+    return { "FillColor", "BorderColor" };
 }
 
 // ____ OPropertySet ____
diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx
index c18c8d11d376..eb7c10a5e834 100644
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -182,11 +182,7 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
 
 uno::Sequence< OUString > PieChartType::getSupportedPropertyRoles()
 {
-    uno::Sequence< OUString > aPropRoles(2);
-    aPropRoles[0] = "FillColor";
-    aPropRoles[1] = "BorderColor";
-
-    return aPropRoles;
+    return { "FillColor", "BorderColor" };
 }
 
 // ____ OPropertySet ____
diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx
index 10798f9bd455..a68c9eaee1cf 100644
--- a/chart2/source/model/template/ScatterChartType.cxx
+++ b/chart2/source/model/template/ScatterChartType.cxx
@@ -192,11 +192,7 @@ OUString SAL_CALL ScatterChartType::getChartType()
 
 uno::Sequence< OUString > SAL_CALL ScatterChartType::getSupportedMandatoryRoles()
 {
-    uno::Sequence< OUString > aMandRolesSeq(3);
-    aMandRolesSeq[0] = "label";
-    aMandRolesSeq[1] = "values-x";
-    aMandRolesSeq[2] = "values-y";
-    return aMandRolesSeq;
+    return { "label", "values-x", "values-y" };
 }
 
 // ____ OPropertySet ____
diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx
index 01b2c2c758a4..76bb4a071b7c 100644
--- a/chart2/source/tools/CommonConverters.cxx
+++ b/chart2/source/tools/CommonConverters.cxx
@@ -388,11 +388,7 @@ awt::Size Direction3DToAWTSize( const drawing::Direction3D& rDirection )
 
 uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint )
 {
-    uno::Sequence< double > aRet(3);
-    aRet[0] = rPoint.getX();
-    aRet[1] = rPoint.getY();
-    aRet[2] = rPoint.getZ();
-    return aRet;
+    return { rPoint.getX(), rPoint.getY(), rPoint.getZ() };
 }
 
 drawing::Position3D SequenceToPosition3D( const uno::Sequence< double >& rSeq )
@@ -408,11 +404,7 @@ drawing::Position3D SequenceToPosition3D( const uno::Sequence< double >& rSeq )
 
 uno::Sequence< double > Position3DToSequence( const drawing::Position3D& rPosition )
 {
-    uno::Sequence< double > aRet(3);
-    aRet[0] = rPosition.PositionX;
-    aRet[1] = rPosition.PositionY;
-    aRet[2] = rPosition.PositionZ;
-    return aRet;
+    return { rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ };
 }
 
 using namespace ::com::sun::star::chart2;
diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx
index 3d6bb54592fe..7722da5e6e60 100644
--- a/chart2/source/tools/DataSourceHelper.cxx
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -155,18 +155,12 @@ uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments(
     if( bUseColumns )
         eRowSource = css::chart::ChartDataRowSource_COLUMNS;
 
-    uno::Sequence< beans::PropertyValue > aArguments(3);
-    aArguments[0] = beans::PropertyValue( "DataRowSource"
-        , -1, uno::Any( eRowSource )
-        , beans::PropertyState_DIRECT_VALUE );
-    aArguments[1] = beans::PropertyValue( "FirstCellAsLabel"
-        , -1, uno::Any( bFirstCellAsLabel )
-        , beans::PropertyState_DIRECT_VALUE );
-    aArguments[2] = beans::PropertyValue( "HasCategories"
-        , -1, uno::Any( bHasCategories )
-        , beans::PropertyState_DIRECT_VALUE );
-
-    return aArguments;
+    return
+    {
+        { "DataRowSource", -1, uno::Any( eRowSource), beans::PropertyState_DIRECT_VALUE },
+        { "FirstCellAsLabel", -1, uno::Any( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE },
+        { "HasCategories", -1, uno::Any( bHasCategories ), beans::PropertyState_DIRECT_VALUE }
+    };
 }
 
 uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments(
diff --git a/chart2/source/view/charttypes/ConfigAccess.cxx b/chart2/source/view/charttypes/ConfigAccess.cxx
index 964e58ce43f7..e83385fb63d1 100644
--- a/chart2/source/view/charttypes/ConfigAccess.cxx
+++ b/chart2/source/view/charttypes/ConfigAccess.cxx
@@ -53,8 +53,7 @@ void ChartConfigItem::Notify(const uno::Sequence<OUString>&) {}
 
 bool ChartConfigItem::getUseErrorRectangle()
 {
-    uno::Sequence<OUString> aNames(1);
-    aNames[0] = "ErrorRectangle";
+    uno::Sequence<OUString> aNames{ "ErrorRectangle" };
 
     auto b = o3tl::tryAccess<bool>(GetProperties(aNames)[0]);
     return b && *b;


More information about the Libreoffice-commits mailing list