chart2/source/inc/InternalData.hxx           |    1 +
 chart2/source/tools/InternalData.cxx         |   20 +++++++++++++++++---
 chart2/source/tools/InternalDataProvider.cxx |    2 +-
 3 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 8815270721053233e32c8f4f6ad50f56b55b1469
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Tue Apr 8 18:02:31 2025 +0200
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Wed Apr 9 17:11:14 2025 +0200

    tdf#165230 chart: fix multiplying row labels in innerdatatable
    
    We only need to handle category labels as multilevel labels.
    
    regression from: fa0a981af41a2606541eec1cb20a379a739691e0
    (DOCX chart import: fix missing complex categories)
    
    Change-Id: I0958d87f315ddbe5cf2721a75a969abb09f4dc34
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183858
    Tested-by: Jenkins
    Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>

diff --git a/chart2/source/inc/InternalData.hxx 
b/chart2/source/inc/InternalData.hxx
index 9d9abeb3a7c0..1d52df4566c7 100644
--- a/chart2/source/inc/InternalData.hxx
+++ b/chart2/source/inc/InternalData.hxx
@@ -44,6 +44,7 @@ public:
 
     void setComplexColumnLabel( sal_Int32 nColumnIndex, std::vector< 
css::uno::Any >&& rComplexLabel );
     void setComplexRowLabel( sal_Int32 nRowIndex, std::vector< css::uno::Any 
>&& rComplexLabel );
+    void setComplexCategoryLabel( sal_Int32 nRowIndex, std::vector< 
css::uno::Any >&& rComplexLabel );
 
     std::vector< css::uno::Any > getComplexColumnLabel( sal_Int32 nColumnIndex 
) const;
     std::vector< css::uno::Any > getComplexRowLabel( sal_Int32 nRowIndex ) 
const;
diff --git a/chart2/source/tools/InternalData.cxx 
b/chart2/source/tools/InternalData.cxx
index c0cddac8bb82..a0f5f087d09c 100644
--- a/chart2/source/tools/InternalData.cxx
+++ b/chart2/source/tools/InternalData.cxx
@@ -221,10 +221,24 @@ void InternalData::setComplexRowLabel( sal_Int32 
nRowIndex, std::vector< uno::An
         m_aRowLabels.resize(nRowIndex+1);
         enlargeData( 0, nRowIndex+1 );
     }
-    sal_Int32 nSize = static_cast<sal_Int32>( m_aRowLabels[nRowIndex].size() );
-    if( nSize >= 1 && !rComplexLabel.empty() )
+    m_aRowLabels[nRowIndex] = std::move(rComplexLabel);
+
+    dump();
+}
+
+void InternalData::setComplexCategoryLabel(sal_Int32 nRowIndex, std::vector< 
uno::Any >&& rComplexLabel)
+{
+    if (nRowIndex < 0)
+        return;
+    if (o3tl::make_unsigned(nRowIndex) >= m_aRowLabels.size())
+    {
+        m_aRowLabels.resize(nRowIndex + 1);
+        enlargeData(0, nRowIndex + 1);
+    }
+    sal_Int32 nSize = static_cast<sal_Int32>(m_aRowLabels[nRowIndex].size());
+    if (nSize >= 1 && !rComplexLabel.empty())
     {
-        m_aRowLabels[nRowIndex].resize(nSize+1);
+        m_aRowLabels[nRowIndex].resize(nSize + 1);
         m_aRowLabels[nRowIndex][nSize] = rComplexLabel[0];
     }
     else
diff --git a/chart2/source/tools/InternalDataProvider.cxx 
b/chart2/source/tools/InternalDataProvider.cxx
index 8046819d413b..a6b93fd86d8d 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -626,7 +626,7 @@ InternalDataProvider::createDataSequenceFromArray( const 
OUString& rArrayStr, st
             }
             std::vector<uno::Any> aLabels(1,
                 bStoreNumeric ? uno::Any(fValue) : uno::Any(aRawElems[i]));
-            m_aInternalData.setComplexRowLabel(i, std::move(aLabels));
+            m_aInternalData.setComplexCategoryLabel(i, std::move(aLabels));
         }
 
         xSeq.set(new UncachedDataSequence(this, lcl_aCategoriesRangeName));

Reply via email to