[Libreoffice-commits] .: 2 commits - chart2/source sc/inc

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 24 18:23:51 PDT 2012


 chart2/source/inc/ExplicitCategoriesProvider.hxx   |    2 -
 chart2/source/tools/ExplicitCategoriesProvider.cxx |    9 ++--
 chart2/source/view/axes/VCartesianAxis.cxx         |   39 +++++++++++++--------
 sc/inc/conditio.hxx                                |    2 +
 4 files changed, 32 insertions(+), 20 deletions(-)

New commits:
commit bcd2b017088822ea95e9d33d1d0dc360c0ec8d74
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Sep 24 21:19:43 2012 -0400

    Build fix.
    
    Change-Id: I2faebd74a1908c0a11e0e876055352716e54f5ca

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 93c89ac..ae7bcb9 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -37,6 +37,8 @@
 
 #include <rtl/math.hxx>
 
+#include <map>
+
 #include <boost/ptr_container/ptr_set.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/scoped_ptr.hpp>
commit fad417fe49d9da0fdef7447521a4bcd962d5c9eb
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Sep 24 21:19:09 2012 -0400

    Prevent so many copying of vector instances.
    
    Change-Id: I2d74fe70411fb1a12387458d170a4a6b603755a3

diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx
index b83052b..d96ef67 100644
--- a/chart2/source/inc/ExplicitCategoriesProvider.hxx
+++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx
@@ -84,7 +84,7 @@ public:
         ::com::sun::star::chart2::data::XDataSequence > getOriginalCategories();
 
     ::com::sun::star::uno::Sequence< ::rtl::OUString > getSimpleCategories();
-    ::std::vector< ComplexCategory > getCategoriesByLevel( sal_Int32 nLevel );
+    const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel );
 
     static ::rtl::OUString getCategoryByIndex(
           const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index 9cc82b6..e3d800f 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -556,14 +556,13 @@ Sequence< ::rtl::OUString > ExplicitCategoriesProvider::getSimpleCategories()
     return m_aExplicitCategories;
 }
 
-std::vector< ComplexCategory >  ExplicitCategoriesProvider::getCategoriesByLevel( sal_Int32 nLevel )
+const std::vector<ComplexCategory>* ExplicitCategoriesProvider::getCategoriesByLevel( sal_Int32 nLevel )
 {
-    std::vector< ComplexCategory > aRet;
     init();
     sal_Int32 nMaxIndex = m_aComplexCats.size()-1;
-    if( nLevel >= 0 && nLevel <= nMaxIndex  )
-        aRet = m_aComplexCats[nMaxIndex-nLevel];
-    return aRet;
+    if (nLevel >= 0 && nLevel <= nMaxIndex)
+        return &m_aComplexCats[nMaxIndex-nLevel];
+    return NULL;
 }
 
 OUString ExplicitCategoriesProvider::getCategoryByIndex(
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 6c0dd04..f394ef8 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -463,10 +463,16 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( ::std::vector< ::s
         for( ; nLevel<nLevelCount; nLevel++ )
         {
             ::std::vector< TickInfo > aTickInfoVector;
-            std::vector< ComplexCategory > aComplexCategories( m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoriesByLevel( nLevel ) );
+            const std::vector<ComplexCategory>* pComplexCategories =
+                m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoriesByLevel(nLevel);
+
+            if (!pComplexCategories)
+                continue;
+
             sal_Int32 nCatIndex = 0;
-            std::vector< ComplexCategory >::const_iterator aIt(aComplexCategories.begin());
-            std::vector< ComplexCategory >::const_iterator aEnd(aComplexCategories.end());
+            std::vector<ComplexCategory>::const_iterator aIt = pComplexCategories->begin();
+            std::vector<ComplexCategory>::const_iterator aEnd = pComplexCategories->end();
+
             for(;aIt!=aEnd;++aIt)
             {
                 TickInfo aTickInfo(0);
@@ -497,20 +503,25 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( ::std::vector< ::s
         for( ; nLevel<nLevelCount; nLevel++ )
         {
             ::std::vector< TickInfo > aTickInfoVector;
-            std::vector< ComplexCategory > aComplexCategories( m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoriesByLevel( nLevel ) );
+            const std::vector<ComplexCategory>* pComplexCategories =
+                m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoriesByLevel(nLevel);
             sal_Int32 nCatIndex = 0;
-            std::vector< ComplexCategory >::const_iterator aIt(aComplexCategories.begin());
-            std::vector< ComplexCategory >::const_iterator aEnd(aComplexCategories.end());
-            for(;aIt!=aEnd;++aIt)
+            if (pComplexCategories)
             {
-                TickInfo aTickInfo(0);
-                ComplexCategory aCat(*aIt);
-                aTickInfo.fScaledTickValue = nCatIndex + 1.0;
-                aTickInfoVector.push_back(aTickInfo);
-                nCatIndex += aCat.Count;
-                if( nCatIndex + 1.0 > m_aScale.Maximum )
-                    break;
+                std::vector<ComplexCategory>::const_iterator aIt = pComplexCategories->begin();
+                std::vector<ComplexCategory>::const_iterator aEnd = pComplexCategories->end();
+                for(;aIt!=aEnd;++aIt)
+                {
+                    TickInfo aTickInfo(0);
+                    ComplexCategory aCat(*aIt);
+                    aTickInfo.fScaledTickValue = nCatIndex + 1.0;
+                    aTickInfoVector.push_back(aTickInfo);
+                    nCatIndex += aCat.Count;
+                    if( nCatIndex + 1.0 > m_aScale.Maximum )
+                        break;
+                }
             }
+
             //fill up with single ticks until maximum scale
             while( nCatIndex + 1.0 < m_aScale.Maximum )
             {


More information about the Libreoffice-commits mailing list