diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-22 09:52:13 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-02-22 14:34:21 +0200 |
commit | db8067145f0126402be39042934e11228a1b42e9 (patch) | |
tree | 0a9d18faaf0c862cc544e6a991b32a68bbb40e28 /chart2 | |
parent | 14420e83296fd393cba956047370564c3517cdae (diff) |
loplugin:write only fields
Change-Id: I44f249a17d0a510ec63a488b656d57a1a392f821
Diffstat (limited to 'chart2')
4 files changed, 15 insertions, 47 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 599dcc34ecd6..b16c6ccf941c 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -217,24 +217,21 @@ bool lcl_ShowCategoriesAsDataLabel( const Reference< chart2::XDiagram > & xDiagr struct DataBrowserModel::tDataColumn { uno::Reference<chart2::XDataSeries> m_xDataSeries; - sal_Int32 m_nIndexInDataSeries; OUString m_aUIRoleName; uno::Reference<chart2::data::XLabeledDataSequence> m_xLabeledDataSequence; eCellType m_eCellType; sal_Int32 m_nNumberFormatKey; // default CTOR - tDataColumn() : m_nIndexInDataSeries( -1 ), m_eCellType( TEXT ), m_nNumberFormatKey( 0 ) {} + tDataColumn() : m_eCellType( TEXT ), m_nNumberFormatKey( 0 ) {} // "full" CTOR tDataColumn( const uno::Reference<chart2::XDataSeries> & xDataSeries, - sal_Int32 nIndexInDataSeries, const OUString& aUIRoleName, const uno::Reference<chart2::data::XLabeledDataSequence>& xLabeledDataSequence, eCellType aCellType, sal_Int32 nNumberFormatKey ) : m_xDataSeries( xDataSeries ), - m_nIndexInDataSeries( nIndexInDataSeries ), m_aUIRoleName( aUIRoleName ), m_xLabeledDataSequence( xLabeledDataSequence ), m_eCellType( aCellType ), @@ -893,7 +890,6 @@ void DataBrowserModel::updateFromModel() m_aColumns.push_back( tDataColumn( aSeries[nSeriesIdx], - nSeqIdx, lcl_getUIRoleName( aLSeqs[nSeqIdx] ), aLSeqs[nSeqIdx], NUMBER, @@ -973,7 +969,6 @@ void DataBrowserModel::addErrorBarRanges( m_aColumns.push_back( tDataColumn( xDataSeries, - rInOutSequenceIndex, lcl_getUIRoleName( *aIt ), *aIt, NUMBER, diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx index 18bf2e08af5b..6297ad1da067 100644 --- a/chart2/source/inc/ExplicitCategoriesProvider.hxx +++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx @@ -47,24 +47,6 @@ public: virtual ::com::sun::star::uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0; }; -struct DatePlusIndex -{ - DatePlusIndex() - : fValue(1.0) - , nIndex( -1 ) - { - } - - DatePlusIndex( const double& _fValue, sal_Int32 _nIndex ) - : fValue(_fValue) - , nIndex( _nIndex ) - { - } - - double fValue; - sal_Int32 nIndex; -}; - class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider { public: @@ -102,7 +84,7 @@ public: ::com::sun::star::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList() { return m_aSplitCategoriesList;} bool isDateAxis(); - const std::vector< DatePlusIndex >& getDateCategories(); + const std::vector< double >& getDateCategories(); private: //member bool volatile m_bDirty; @@ -120,7 +102,7 @@ private: //member bool m_bIsDateAxis; bool m_bIsAutoDate; - std::vector< DatePlusIndex > m_aDateCategories; + std::vector< double > m_aDateCategories; }; } // namespace chart diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index b661046d9560..2d1802cec97d 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -400,16 +400,7 @@ Sequence< OUString > ExplicitCategoriesProvider::getExplicitSimpleCategories( return lcl_getExplicitSimpleCategories( rSplitCategoriesProvider, aComplexCats ); } -struct DatePlusIndexComparator -{ - inline bool operator() ( const DatePlusIndex& aFirst, - const DatePlusIndex& aSecond ) const - { - return ( aFirst.fValue < aSecond.fValue ); - } -}; - -bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< DatePlusIndex >& rDateCategories, bool bIsAutoDate, ChartModel& rModel ) +bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< double >& rDateCategories, bool bIsAutoDate, ChartModel& rModel ) { bool bOnlyDatesFound = true; bool bAnyDataFound = false; @@ -468,18 +459,18 @@ bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataS if( !bContainsEmptyString && !bContainsNan ) bAnyDataFound = true; } - DatePlusIndex aDatePlusIndex( 1.0, nN ); - if( bIsDate && (aAny >>= aDatePlusIndex.fValue) ) - rDateCategories.push_back( aDatePlusIndex ); + double aDate( 1.0 ); + if( bIsDate && (aAny >>= aDate) ) + rDateCategories.push_back( aDate ); else { if( aAny.hasValue() && !bContainsEmptyString )//empty string does not count as non date value! bOnlyDatesFound=false; - ::rtl::math::setNan( &aDatePlusIndex.fValue ); - rDateCategories.push_back( aDatePlusIndex ); + ::rtl::math::setNan( &aDate ); + rDateCategories.push_back( aDate ); } } - ::std::sort( rDateCategories.begin(), rDateCategories.end(), DatePlusIndexComparator() ); + ::std::sort( rDateCategories.begin(), rDateCategories.end() ); } return bAnyDataFound && bOnlyDatesFound; @@ -572,7 +563,7 @@ bool ExplicitCategoriesProvider::isDateAxis() return m_bIsDateAxis; } -const std::vector< DatePlusIndex >& ExplicitCategoriesProvider::getDateCategories() +const std::vector< double >& ExplicitCategoriesProvider::getDateCategories() { init(); return m_aDateCategories; diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 475eca90738b..6c789cd8146b 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1352,18 +1352,18 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis() long nRet = ::com::sun::star::chart::TimeUnit::YEAR; if( m_pExplicitCategoriesProvider ) { - const std::vector< DatePlusIndex >& rDateCategories = m_pExplicitCategoriesProvider->getDateCategories(); - std::vector< DatePlusIndex >::const_iterator aIt = rDateCategories.begin(), aEnd = rDateCategories.end(); + const std::vector< double >& rDateCategories = m_pExplicitCategoriesProvider->getDateCategories(); + std::vector< double >::const_iterator aIt = rDateCategories.begin(), aEnd = rDateCategories.end(); Date aNullDate(30,12,1899); if( m_apNumberFormatterWrapper.get() ) aNullDate = m_apNumberFormatterWrapper->getNullDate(); if( aIt!=aEnd ) { - Date aPrevious(aNullDate); aPrevious+=static_cast<long>(rtl::math::approxFloor(aIt->fValue)); + Date aPrevious(aNullDate); aPrevious+=static_cast<long>(rtl::math::approxFloor(*aIt)); ++aIt; for(;aIt!=aEnd;++aIt) { - Date aCurrent(aNullDate); aCurrent+=static_cast<long>(rtl::math::approxFloor(aIt->fValue)); + Date aCurrent(aNullDate); aCurrent+=static_cast<long>(rtl::math::approxFloor(*aIt)); if( ::com::sun::star::chart::TimeUnit::YEAR == nRet ) { if( DateHelper::IsInSameYear( aPrevious, aCurrent ) ) |