[Libreoffice-commits] .: chart2/source

Julien Nabet serval2412 at kemper.freedesktop.org
Wed Feb 2 03:35:36 PST 2011


 chart2/source/controller/dialogs/res_ErrorBar.cxx                        |    3 +--
 chart2/source/controller/dialogs/tp_PolarOptions.cxx                     |    3 +--
 chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx |    7 +++----
 chart2/source/controller/itemsetwrapper/ItemConverter.cxx                |   10 +++++-----
 chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx   |    2 +-
 chart2/source/controller/main/ChartController.hxx                        |    2 +-
 chart2/source/tools/AxisHelper.cxx                                       |    4 ++--
 chart2/source/tools/RangeHighlighter.cxx                                 |   10 +++++++---
 8 files changed, 21 insertions(+), 20 deletions(-)

New commits:
commit 17c9543ed8c4f36fa1c35396397d761eabc84eae
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Feb 2 12:32:52 2011 +0100

    Some cppcheck cleaning

diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx
index 6f35318..1cd1104 100644
--- a/chart2/source/controller/dialogs/res_ErrorBar.cxx
+++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx
@@ -569,10 +569,9 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
 
     aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, TRUE, &pPoolItem );
     m_bMinusUnique = ( aState != SFX_ITEM_DONTCARE );
-    double fMinusValue = 0.0;
     if( aState == SFX_ITEM_SET )
     {
-        fMinusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
+        double fMinusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
         sal_Int32 nMinusValue = static_cast< sal_Int32 >( fMinusValue * pow(10.0,m_aMfNegative.GetDecimalDigits()) );
         m_aMfNegative.SetValue( nMinusValue );
 
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index b73dd70..3be89b5 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -87,10 +87,9 @@ void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
 {
     const SfxPoolItem *pPoolItem = NULL;
 
-    long nTmp;
     if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, TRUE, &pPoolItem) == SFX_ITEM_SET)
     {
-        nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
+        long nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
 
         m_aAngleDial.SetRotation( nTmp*100 );
     }
diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
index 651489c..4d29b74 100644
--- a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
@@ -300,7 +300,7 @@ void GraphicPropertyItemConverter::FillSpecialItem(
                     }
                 }
             }
-            catch( beans::UnknownPropertyException ex )
+            catch( beans::UnknownPropertyException &ex )
             {
                 ASSERT_EXCEPTION( ex );
             }
@@ -314,11 +314,10 @@ void GraphicPropertyItemConverter::FillSpecialItem(
                     ? C2U( "GradientStepCount" )
                     : C2U( "FillGradientStepCount" );
 
-                sal_Int16 nStepCount = 0;
                 uno::Any aValue( GetPropertySet()->getPropertyValue( aPropName ) );
                 if( hasLongOrShortValue(aValue) )
                 {
-                    nStepCount = getShortForLongAlso(aValue);
+                    sal_Int16 nStepCount = getShortForLongAlso(aValue);
                     rOutItemSet.Put( XGradientStepCountItem( nStepCount ));
                 }
             }
@@ -545,7 +544,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem(
                     }
                 }
             }
-            catch( beans::UnknownPropertyException ex )
+            catch( beans::UnknownPropertyException &ex )
             {
                 ASSERT_EXCEPTION( ex );
             }
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
index 319659c..2132c66 100644
--- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
@@ -140,7 +140,7 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
                             delete pItem;
                         }
                     }
-                    catch( beans::UnknownPropertyException ex )
+                    catch( beans::UnknownPropertyException &ex )
                     {
                         delete pItem;
                         OSL_ENSURE( false,
@@ -150,7 +150,7 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
                                                              " - unknown Property: " )) + aProperty.first,
                                         RTL_TEXTENCODING_ASCII_US ).getStr());
                     }
-                    catch( uno::Exception ex )
+                    catch( uno::Exception &ex )
                     {
                         ASSERT_EXCEPTION( ex );
                     }
@@ -162,7 +162,7 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
                 {
                     FillSpecialItem( nWhich, rOutItemSet );
                 }
-                catch( uno::Exception ex )
+                catch( uno::Exception &ex )
                 {
                     ASSERT_EXCEPTION( ex );
                 }
@@ -212,7 +212,7 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
                         bItemsChanged = true;
                     }
                 }
-                catch( beans::UnknownPropertyException ex )
+                catch( beans::UnknownPropertyException &ex )
                 {
                     OSL_ENSURE( false,
                                 ::rtl::OUStringToOString(
@@ -221,7 +221,7 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
                                                          " - unknown Property: " )) + aProperty.first,
                                     RTL_TEXTENCODING_ASCII_US).getStr());
                 }
-                catch( uno::Exception ex )
+                catch( uno::Exception &ex )
                 {
                     OSL_ENSURE( false, ::rtl::OUStringToOString(
                                     ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index e0e3c48..89be2be 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -177,7 +177,7 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
             }
         }
     }
-    catch( uno::Exception ex )
+    catch( uno::Exception &ex )
     {
         ASSERT_EXCEPTION( ex );
     }
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index 93b1706..fcca86e 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -519,7 +519,7 @@ private:
             void		removeListener(  ChartController* pController );
             void		tryTermination();
             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
-                        getModel() { return m_xModel;}
+                        getModel() const { return m_xModel;}
 
         private:
             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >		m_xModel;
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index a3f47a1..eb6fe3e 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -574,11 +574,11 @@ std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem(
 
     if(xCooSys.is())
     {
-        sal_Int32 nDimensionIndex = 0;
         sal_Int32 nMaxDimensionIndex = xCooSys->getDimension() -1;
         if( nMaxDimensionIndex>=0 )
         {
-            for(nDimensionIndex=0; nDimensionIndex<=nMaxDimensionIndex; ++nDimensionIndex)
+            sal_Int32 nDimensionIndex = 0;
+            for(; nDimensionIndex<=nMaxDimensionIndex; ++nDimensionIndex)
             {
                 const sal_Int32 nMaximumAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
                 for(sal_Int32 nAxisIndex=0; nAxisIndex<=nMaximumAxisIndex; ++nAxisIndex)
diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx
index 98b3746..f0ad7cc 100644
--- a/chart2/source/tools/RangeHighlighter.cxx
+++ b/chart2/source/tools/RangeHighlighter.cxx
@@ -216,12 +216,14 @@ void RangeHighlighter::fillRangesForDiagram( const Reference< chart2::XDiagram >
 
 void RangeHighlighter::fillRangesForDataSeries( const uno::Reference< chart2::XDataSeries > & xSeries )
 {
-    sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
     Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
     if( xSource.is())
+    {
+        sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
         lcl_fillRanges( m_aSelectedRanges,
                         ::chart::DataSourceHelper::getRangesFromDataSource( xSource ),
                         nPreferredColor );
+    }
 }
 
 void RangeHighlighter::fillRangesForErrorBars(
@@ -245,12 +247,14 @@ void RangeHighlighter::fillRangesForErrorBars(
 
     if( bUsesRangesAsErrorBars )
     {
-        sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
         Reference< chart2::data::XDataSource > xSource( xErrorBar, uno::UNO_QUERY );
         if( xSource.is())
+        {
+            sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
             lcl_fillRanges( m_aSelectedRanges,
                             ::chart::DataSourceHelper::getRangesFromDataSource( xSource ),
                             nPreferredColor );
+        }
     }
     else
     {
@@ -269,12 +273,12 @@ void RangeHighlighter::fillRangesForCategories( const Reference< chart2::XAxis >
 
 void RangeHighlighter::fillRangesForDataPoint( const Reference< uno::XInterface > & xDataSeries, sal_Int32 nIndex )
 {
-    sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
     if( xDataSeries.is())
     {
         Reference< chart2::data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY );
         if( xSource.is() )
         {
+            sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
             ::std::vector< chart2::data::HighlightedRange > aHilightedRanges;
             Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences());
             for( sal_Int32 i=0; i<aLSeqSeq.getLength(); ++i )


More information about the Libreoffice-commits mailing list