[Libreoffice-commits] core.git: sc/inc sc/source

Noel Grandin noelgrandin at gmail.com
Fri Apr 1 13:09:43 UTC 2016


 sc/inc/charthelper.hxx              |    2 +-
 sc/source/core/data/documen5.cxx    |    4 ++--
 sc/source/core/tool/charthelper.cxx |   20 +++++++++++---------
 3 files changed, 14 insertions(+), 12 deletions(-)

New commits:
commit 86e9ef21a06a9babefb778dfc3e02118d371d70d
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Tue Mar 8 20:41:21 2016 +0200

    sequence->vector in sc
    
    Change-Id: I23edfbacb9ad0fb11ac8e6f789a73367f043eeda
    Reviewed-on: https://gerrit.libreoffice.org/23697
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/charthelper.hxx b/sc/inc/charthelper.hxx
index 2b77c03..000e6af 100644
--- a/sc/inc/charthelper.hxx
+++ b/sc/inc/charthelper.hxx
@@ -42,7 +42,7 @@ public:
     static void UpdateChartsOnDestinationPage( ScDocument* pDestDoc, const SCTAB nDestTab );
     static css::uno::Reference< css::chart2::XChartDocument > GetChartFromSdrObject( SdrObject* pObject );
     static void GetChartRanges( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc,
-            css::uno::Sequence< OUString >& rRanges );
+            std::vector< OUString >& rRanges );
     static void SetChartRanges( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc,
             const css::uno::Sequence< OUString >& rRanges );
 
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index b054560..c88a619 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -259,9 +259,9 @@ void ScDocument::GetChartRanges( const OUString& rChartName, ::std::vector< ScRa
     uno::Reference< chart2::XChartDocument > xChartDoc( GetChartByName( rChartName ) );
     if ( xChartDoc.is() )
     {
-        uno::Sequence< OUString > aRangeStrings;
+        std::vector< OUString > aRangeStrings;
         ScChartHelper::GetChartRanges( xChartDoc, aRangeStrings );
-        for( sal_Int32 nN=0; nN<aRangeStrings.getLength(); nN++ )
+        for( size_t nN=0; nN<aRangeStrings.size(); nN++ )
         {
             ScRangeList aRanges;
             aRanges.Parse( aRangeStrings[nN], pSheetNameDoc, ScRefFlags::VALID, pSheetNameDoc->GetAddressConvention() );
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index 0297d7f..e814de8 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -206,16 +206,15 @@ uno::Reference< chart2::XChartDocument > ScChartHelper::GetChartFromSdrObject( S
 }
 
 void ScChartHelper::GetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartDoc,
-            uno::Sequence< OUString >& rRanges )
+            std::vector< OUString >& rRanges )
 {
-    rRanges.realloc(0);
+    rRanges.clear();
     uno::Reference< chart2::data::XDataSource > xDataSource( xChartDoc, uno::UNO_QUERY );
     if( !xDataSource.is() )
         return;
 
     uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aLabeledDataSequences( xDataSource->getDataSequences() );
-    rRanges.realloc(2*aLabeledDataSequences.getLength());
-    sal_Int32 nRealCount=0;
+    rRanges.reserve(2*aLabeledDataSequences.getLength());
     for( sal_Int32 nN=0;nN<aLabeledDataSequences.getLength();nN++)
     {
         uno::Reference< chart2::data::XLabeledDataSequence > xLabeledSequence( aLabeledDataSequences[nN] );
@@ -224,12 +223,15 @@ void ScChartHelper::GetChartRanges( const uno::Reference< chart2::XChartDocument
         uno::Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel());
         uno::Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues());
 
-        if( xLabel.is())
-            rRanges[nRealCount++] = xLabel->getSourceRangeRepresentation();
-        if( xValues.is())
-            rRanges[nRealCount++] = xValues->getSourceRangeRepresentation();
+        if (xLabel.is())
+             rRanges.push_back( xLabel->getSourceRangeRepresentation() );
+         else
+             rRanges.push_back( OUString() );
+         if (xValues.is())
+             rRanges.push_back( xValues->getSourceRangeRepresentation() );
+         else
+             rRanges.push_back( OUString() );
     }
-    rRanges.realloc(nRealCount);
 }
 
 void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartDoc,


More information about the Libreoffice-commits mailing list