chart2/inc/ChartModel.hxx | 7 ++ chart2/inc/ChartView.hxx | 17 +++++ chart2/source/model/main/ChartModel.cxx | 19 ++++++ chart2/source/view/inc/VDataSeries.hxx | 19 +++++- chart2/source/view/inc/VSeriesPlotter.hxx | 4 - chart2/source/view/main/ChartView.cxx | 51 +++++++++++++++++ chart2/source/view/main/VDataSeries.cxx | 52 +++++++++++++++++ offapi/UnoApi_offapi.mk | 1 offapi/com/sun/star/chart2/XTimeBased.idl | 30 ++++++++++ sc/inc/chart2uno.hxx | 25 +++++++- sc/source/ui/unoobj/chart2uno.cxx | 88 ++++++++++++++++++++++++++++-- 11 files changed, 299 insertions(+), 14 deletions(-)
New commits: commit 7e8664eb332a571c7459ba04e26e1cbe2f1135c2 Author: Markus Mohrhard <[email protected]> Date: Mon Dec 30 08:58:18 2013 +0100 simlplify Change-Id: I8ff774d9f26ff0c9a2241ee14935a86085a3209d diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 75ce9b3..9a887fa 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1540,8 +1540,8 @@ ScChart2DataProvider::createDataSource( pValueTokens.reset(pChartMap->getAllColHeaderRanges()); SAL_WNODEPRECATED_DECLARATIONS_PUSH - auto_ptr< vector<ScTokenRef> > pLabelTokens(NULL); - pLabelTokens.reset(pChartMap->getLeftUpperCornerRanges()); + auto_ptr< vector<ScTokenRef> > pLabelTokens( + pChartMap->getLeftUpperCornerRanges()); SAL_WNODEPRECATED_DECLARATIONS_POP Reference< chart2::data::XLabeledDataSequence > xCategories = lcl_createLabeledDataSequenceFromTokens( commit 1737c4572e5224dd220a41efe520f6ae1259359a Author: Markus Mohrhard <[email protected]> Date: Mon Dec 30 08:39:19 2013 +0100 remaining chart work for time based charting Change-Id: Iac33c81df199a942ddf073f9eb1b34e147a34f3c diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 748e5f6..b251920 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -585,6 +585,8 @@ public: bool isTimeBased() const; void setTimeBased(bool bTimeBased); + + void getNextTimePoint(); }; } // namespace chart diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 80f0d27..66925ab 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -43,6 +43,7 @@ #include <vector> #include <boost/shared_ptr.hpp> +#include <boost/ptr_container/ptr_vector.hpp> class SdrPage; @@ -51,20 +52,19 @@ namespace chart { class VCoordinateSystem; class DrawModelWrapper; class SeriesPlotterContainer; -class VDataSeriesGroup; +class VDataSeries; struct TimeBasedInfo { TimeBasedInfo(): bTimeBased(false), - nFrame(0), - m_pZSlots(NULL) {} + nFrame(0) {} bool bTimeBased; size_t nFrame; // only valid when we are in the time based mode - ::std::vector< ::std::vector< VDataSeriesGroup > >* m_pZSlots; + ::std::vector< std::vector< VDataSeries* > > m_aDataSeriesList; }; /** diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 842501f..4e6d245 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -58,6 +58,7 @@ #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/document/DocumentProperties.hpp> +#include <com/sun/star/chart2/XTimeBased.hpp> // header for class SvNumberFormatter #include <svl/zforlist.hxx> @@ -1356,6 +1357,14 @@ void ChartModel::setTimeBased(bool bTimeBased) mbTimeBased = bTimeBased; } +void ChartModel::getNextTimePoint() +{ + uno::Reference< chart2::XTimeBased > xTimeBased(getUsedData(), uno::UNO_QUERY); + SAL_WARN_IF(!xTimeBased.is(), "chart2", "does not support time based charting"); + if(xTimeBased.is()) + xTimeBased->switchToNext(); +} + } // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index 94827d1..7989b3e 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -40,7 +40,7 @@ namespace chart { -class VDataSequence : boost::noncopyable +class VDataSequence { public: void init( const ::com::sun::star::uno::Reference< @@ -62,10 +62,6 @@ class VDataSeries SAL_FINAL : boost::noncopyable public: VDataSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xDataSeries ); - // for time based charting - VDataSeries( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDataSeries >& xDataSeries, - VDataSeries* pOldSeries, double nPercent); ~VDataSeries(); @@ -176,11 +172,17 @@ public: void setMissingValueTreatment( sal_Int32 nMissingValueTreatment ); sal_Int32 getMissingValueTreatment() const; + void setOldTimeBased( VDataSeries* pOldSeries, double nPercent ); + VDataSeries* createCopyForTimeBased() const; + private: //methods ::com::sun::star::chart2::DataPointLabel* getDataPointLabel( sal_Int32 index ) const; void adaptPointCache( sal_Int32 nNewPointIndex ) const; + // for copies for time based charting + VDataSeries(); + public: //member ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xGroupShape; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xLabelsGroupShape; diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 521903e..098bbe1 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -384,9 +384,6 @@ protected: VDataSeries* getFirstSeries() const; - // ugly hack to cache the data for the next turn - const std::vector< std::vector< VDataSeriesGroup > >& getData(); - protected: PlottingPositionHelper* m_pMainPosHelper; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 3e23991..c7db1b1 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2444,6 +2444,25 @@ void ChartView::createShapes() SeriesPlotterContainer aSeriesPlotterContainer( m_aVCooSysList ); aSeriesPlotterContainer.initializeCooSysAndSeriesPlotter( mrChartModel ); + if(maTimeBased.bTimeBased) + { + std::vector<VSeriesPlotter*>& rSeriesPlotter = + aSeriesPlotterContainer.getSeriesPlotterList(); + size_t n = rSeriesPlotter.size(); + for(size_t i = 0; i < n; ++i) + { + std::vector< VDataSeries* > aAllNewDataSeries = + rSeriesPlotter[i]->getAllSeries(); + std::vector< VDataSeries* >& rAllOldDataSeries = + maTimeBased.m_aDataSeriesList[i]; + size_t m = std::min(aAllNewDataSeries.size(), rAllOldDataSeries.size()); + for(size_t j = 0; j < m; ++j) + { + aAllNewDataSeries[j]->setOldTimeBased( + rAllOldDataSeries[j], (maTimeBased.nFrame % 60)/60.0); + } + } + } lcl_createLegend( LegendHelper::getLegend( mrChartModel ), mxRootShape, m_xShapeFactory, m_xCC , aRemainingSpace, aPageSize, mrChartModel, aSeriesPlotterContainer.getLegendEntryProviderList() @@ -2529,6 +2548,31 @@ void ChartView::createShapes() //cleanup: remove all empty group shapes to avoid grey border lines: lcl_removeEmptyGroupShapes( mxRootShape ); + + if(maTimeBased.bTimeBased && maTimeBased.nFrame % 60 == 0) + { + // create copy of the data for next frame + std::vector<VSeriesPlotter*>& rSeriesPlotter = + aSeriesPlotterContainer.getSeriesPlotterList(); + size_t n = rSeriesPlotter.size(); + maTimeBased.m_aDataSeriesList.clear(); + maTimeBased.m_aDataSeriesList.resize(n); + for(size_t i = 0; i < n; ++i) + { + std::vector< VDataSeries* > aAllNewDataSeries = + rSeriesPlotter[i]->getAllSeries(); + std::vector< VDataSeries* >& rAllOldDataSeries = + maTimeBased.m_aDataSeriesList[i]; + size_t m = std::min(aAllNewDataSeries.size(), rAllOldDataSeries.size()); + for(size_t j = 0; j < m; ++j) + { + rAllOldDataSeries.push_back( aAllNewDataSeries[j]-> + createCopyForTimeBased() ); + } + } + + mrChartModel.getNextTimePoint(); + } } // #i12587# support for shapes in chart @@ -2540,11 +2584,6 @@ void ChartView::createShapes() pShapeFactory->render( mxRootShape ); - if(maTimeBased.bTimeBased && maTimeBased.nFrame % 60 == 0) - { - // create copy of the data for next frame - - } if(maTimeBased.bTimeBased) { maTimeBased.nFrame++; diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 2f170eb..981d832 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -182,6 +182,8 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) , m_nCurrentAttributedPoint(-1) , m_nMissingValueTreatment(::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP) , m_bAllowPercentValueInDataLabel(false) + , mpOldSeries(NULL) + , mnPercent(0.0) { ::rtl::math::setNan( & m_fXMeanValue ); ::rtl::math::setNan( & m_fYMeanValue ); @@ -1053,6 +1055,33 @@ sal_Int32 VDataSeries::getMissingValueTreatment() const return m_nMissingValueTreatment; } +VDataSeries::VDataSeries() +{ +} + +void VDataSeries::setOldTimeBased( VDataSeries* pOldSeries, double nPercent ) +{ + mnPercent = nPercent; + mpOldSeries = pOldSeries; +} + +VDataSeries* VDataSeries::createCopyForTimeBased() const +{ + VDataSeries* pNew = new VDataSeries(); + pNew->m_aValues_X = m_aValues_X; + pNew->m_aValues_Y = m_aValues_Y; + pNew->m_aValues_Z = m_aValues_Z; + pNew->m_aValues_Y_Min = m_aValues_Y_Min; + pNew->m_aValues_Y_Max = m_aValues_Y_Max; + pNew->m_aValues_Y_First = m_aValues_Y_First; + pNew->m_aValues_Y_Last = m_aValues_Y_Last; + pNew->m_aValues_Bubble_Size = m_aValues_Bubble_Size; + + pNew->m_nPointCount = m_nPointCount; + + return pNew; +} + } //namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 63dc12de012221e10ccaf0e82d4fd3f2703f17b9 Author: Markus Mohrhard <[email protected]> Date: Tue Dec 31 15:15:19 2013 +0100 time based charting calc side Change-Id: I0d5963a691e4495ee14e4d1228ea0ba2b1dd66d7 diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index a1ad831..48eb8de 100755 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2023,6 +2023,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/chart2,\ XRegressionCurveContainer \ XScaling \ XTarget \ + XTimeBased \ XTitle \ XTitled \ XTransformation \ diff --git a/offapi/com/sun/star/chart2/XTimeBased.idl b/offapi/com/sun/star/chart2/XTimeBased.idl new file mode 100644 index 0000000..70ce701 --- /dev/null +++ b/offapi/com/sun/star/chart2/XTimeBased.idl @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef com_sun_star_chart2_XTimeBased_idl +#define com_sun_star_chart2_XTimeBased_idl + +#include <com/sun/star/uno/XInterface.idl> + +module com { module sun { module star { module chart2 { + +interface XTimeBased : com::sun::star::uno::XInterface +{ + + /** + * @return + * FALSE if the data wrapped around + */ + boolean switchToNext(); +}; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx index 4f54357..81a23dc 100644 --- a/sc/inc/chart2uno.hxx +++ b/sc/inc/chart2uno.hxx @@ -37,13 +37,14 @@ #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> #include <com/sun/star/chart2/data/DataSequenceRole.hpp> +#include <com/sun/star/chart2/XTimeBased.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XCloneable.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> -#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase5.hxx> -#include <cppuhelper/implbase7.hxx> +#include <cppuhelper/implbase8.hxx> #include <rtl/ustring.hxx> #include <svl/itemprop.hxx> @@ -189,8 +190,9 @@ private: // DataSource class ScChart2DataSource : public - ::cppu::WeakImplHelper2< + ::cppu::WeakImplHelper3< ::com::sun::star::chart2::data::XDataSource, + com::sun::star::chart2::XTimeBased, ::com::sun::star::lang::XServiceInfo>, SfxListener { @@ -205,6 +207,10 @@ public: ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() throw (::com::sun::star::uno::RuntimeException); + // XTimeBased + virtual sal_Bool switchToNext() throw( + ::com::sun::star::uno::RuntimeException); + // XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException); @@ -220,20 +226,28 @@ public: void AddLabeledSequence(const com::sun::star::uno::Reference < com::sun::star::chart2::data::XLabeledDataSequence >& xNew); + void SetTimeBased(SCTAB nTimeBasedStart, SCTAB nTimeBasedEnd); + private: ScDocument* m_pDocument; typedef std::list < com::sun::star::uno::Reference< com::sun::star::chart2::data::XLabeledDataSequence > > LabeledList; LabeledList m_aLabeledSequences; + bool bTimeBased; + SCTAB mnTimeBasedStart; + SCTAB mnTimeBasedEnd; + SCTAB mnCurrentTab; + }; // DataSequence class ScChart2DataSequence : public - ::cppu::WeakImplHelper7< + ::cppu::WeakImplHelper8< ::com::sun::star::chart2::data::XDataSequence, ::com::sun::star::chart2::data::XTextualDataSequence, ::com::sun::star::chart2::data::XNumericalDataSequence, + com::sun::star::chart2::XTimeBased, ::com::sun::star::util::XCloneable, ::com::sun::star::util::XModifyBroadcaster, ::com::sun::star::beans::XPropertySet, @@ -269,6 +283,9 @@ public: virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getTextualData( ) throw (::com::sun::star::uno::RuntimeException); + // XTimeBased + virtual sal_Bool switchToNext() throw (::com::sun::star::uno::RuntimeException); + // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 1057fb5..75ce9b3 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1441,6 +1441,7 @@ ScChart2DataProvider::createDataSource( bool bOrientCol = true; OUString aRangeRepresentation; uno::Sequence< sal_Int32 > aSequenceMapping; + sal_Bool bTimeBased = false; for(sal_Int32 i = 0; i < aArguments.getLength(); ++i) { if ( aArguments[i].Name == "DataRowSource" ) @@ -1470,6 +1471,10 @@ ScChart2DataProvider::createDataSource( { aArguments[i].Value >>= aSequenceMapping; } + else if ( aArguments[i].Name == "TimeBased" ) + { + aArguments[i].Value >>= bTimeBased; + } } vector<ScTokenRef> aRefTokens; @@ -1480,7 +1485,31 @@ ScChart2DataProvider::createDataSource( // Invalid range representation. Bail out. throw lang::IllegalArgumentException(); - shrinkToDataRange(m_pDocument, aRefTokens); + SCTAB nTimeBasedStart = MAXTAB; + SCTAB nTimeBasedEnd = 0; + if(bTimeBased) + { + // limit to first sheet + for(vector<ScTokenRef>::iterator itr = aRefTokens.begin(), + itrEnd = aRefTokens.end(); itr != itrEnd; ++itr) + { + if ((*itr)->GetType() != svDoubleRef) + continue; + + ScComplexRefData& rData = (*itr)->GetDoubleRef(); + ScSingleRefData& s = rData.Ref1; + ScSingleRefData& e = rData.Ref2; + + nTimeBasedStart = std::min(nTimeBasedStart, s.Tab()); + nTimeBasedEnd = std::min(nTimeBasedEnd, e.Tab()); + + if(s.Tab() != e.Tab()) + e.SetAbsTab(s.Tab()); + } + } + + if(!bTimeBased) + shrinkToDataRange(m_pDocument, aRefTokens); if (bLabel) lcl_addUpperLeftCornerIfMissing(aRefTokens); //#i90669# @@ -1550,6 +1579,8 @@ ScChart2DataProvider::createDataSource( } pDS = new ScChart2DataSource(m_pDocument); + if(bTimeBased) + pDS->SetTimeBased(nTimeBasedStart, nTimeBasedEnd); ::std::list< Reference< chart2::data::XLabeledDataSequence > >::iterator aItr( aSeqs.begin() ); ::std::list< Reference< chart2::data::XLabeledDataSequence > >::iterator aEndItr( aSeqs.end() ); @@ -2424,6 +2455,32 @@ void ScChart2DataSource::AddLabeledSequence(const uno::Reference < chart2::data: m_aLabeledSequences.push_back(xNew); } +sal_Bool ScChart2DataSource::switchToNext() throw ( uno::RuntimeException) +{ + if(mnCurrentTab != mnTimeBasedEnd) + { + for(LabeledList::iterator itr = m_aLabeledSequences.begin(), + itrEnd = m_aLabeledSequences.end(); itr != itrEnd; ++itr) + { + uno::Reference< chart2::XTimeBased> xTimeBased(*itr, uno::UNO_QUERY); + if(xTimeBased.is()) + xTimeBased->switchToNext(); + } + ++mnCurrentTab; + return sal_True; + } + + return sal_False; +} + +void ScChart2DataSource::SetTimeBased(SCTAB nTimeBasedStart, SCTAB nTimeBasedEnd) +{ + mnCurrentTab = nTimeBasedStart; + mnTimeBasedStart = nTimeBasedStart; + mnTimeBasedEnd = nTimeBasedEnd; + bTimeBased = true; +} + // DataSequence ============================================================== @@ -3549,4 +3606,29 @@ void ScChart2DataSequence::setDataChangedHint(bool b) m_bGotDataChangedHint = b; } +sal_Bool ScChart2DataSequence::switchToNext() + throw (uno::RuntimeException) +{ + if(!m_pTokens) + return sal_True; + + for(vector<ScTokenRef>::iterator itr = m_pTokens->begin(), + itrEnd = m_pTokens->end(); itr != itrEnd; ++itr) + { + if ((*itr)->GetType() != svDoubleRef) + continue; + + ScComplexRefData& rData = (*itr)->GetDoubleRef(); + ScSingleRefData& s = rData.Ref1; + ScSingleRefData& e = rData.Ref2; + + s.IncTab(1); + e.IncTab(1); + } + + RebuildDataCache(); + + return sal_True; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 71937296cc9bc0a4d1e7eaddca10b6484b161e84 Author: Markus Mohrhard <[email protected]> Date: Mon Dec 30 06:47:30 2013 +0100 kill two virtual destructors we know that there are no subclasses so the virtual destructors are unnecessary Change-Id: Idad45370035004224d4128fb095aefac6b9acad0 diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index 37d512f..94827d1 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -67,7 +67,7 @@ public: ::com::sun::star::chart2::XDataSeries >& xDataSeries, VDataSeries* pOldSeries, double nPercent); - virtual ~VDataSeries(); + ~VDataSeries(); ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > getModel() const; diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index e685700..521903e 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -78,7 +78,7 @@ class VDataSeriesGroup SAL_FINAL public: VDataSeriesGroup(); VDataSeriesGroup( VDataSeries* pSeries ); - virtual ~VDataSeriesGroup(); + ~VDataSeriesGroup(); void addSeries( VDataSeries* pSeries );//takes ownership of pSeries sal_Int32 getSeriesCount() const; commit 51aa09045652425e414c19f3dde9e8386ba948df Author: Markus Mohrhard <[email protected]> Date: Mon Dec 30 06:45:50 2013 +0100 one more place for time based charting Change-Id: I977c02af8517fb747d526535bb1dc5aa0f3e485c diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 9a2a949..3e23991 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2369,6 +2369,8 @@ void ChartView::createShapes() clock_t nStart = clock(); OSL_TRACE( "\nPPPPPPPPP>>>>>>>>>>>> chart view :: createShapes()" ); #endif + if(mrChartModel.isTimeBased()) + maTimeBased.bTimeBased = true; //make sure add-in is refreshed after creating the shapes const ::comphelper::ScopeGuard aGuard( boost::bind( &ChartView::impl_refreshAddIn, this ) ); @@ -2538,6 +2540,16 @@ void ChartView::createShapes() pShapeFactory->render( mxRootShape ); + if(maTimeBased.bTimeBased && maTimeBased.nFrame % 60 == 0) + { + // create copy of the data for next frame + + } + if(maTimeBased.bTimeBased) + { + maTimeBased.nFrame++; + } + #if OSL_DEBUG_LEVEL > 0 clock_t nEnd = clock(); double fDuration =(double(nEnd-nStart)*1000.0)/double(CLOCKS_PER_SEC); commit ceaf08a3e12645502ccf850743895f6e3c7c7bac Author: Markus Mohrhard <[email protected]> Date: Mon Dec 30 06:45:14 2013 +0100 add SAL_FINAL to assert that there are no subclasses we can now remove all the virtual keywords Change-Id: I494b25d7a1ba7f30d319025c92040d0f882d6c63 diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index bbd903c..37d512f 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -57,7 +57,7 @@ public: mutable ::com::sun::star::uno::Sequence< double > Doubles; }; -class VDataSeries : boost::noncopyable +class VDataSeries SAL_FINAL : boost::noncopyable { public: VDataSeries( const ::com::sun::star::uno::Reference< diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 0d68cdf..e685700 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -73,7 +73,7 @@ private: * A list of series that have the same CoordinateSystem. They are used to be * plotted maybe in a stacked manner by a plotter. */ -class VDataSeriesGroup +class VDataSeriesGroup SAL_FINAL { public: VDataSeriesGroup(); commit 8c7a4232246b389f680c2699ccb613866bac8f7c Author: Markus Mohrhard <[email protected]> Date: Mon Dec 30 06:22:04 2013 +0100 implement time based charting based on new approach The old approach does not work with the current implementation of the OpenGL backend. We now need to repaing every time the whole chart. Change-Id: I2151a3f016c6ceecaec2d45db0cb967cfee59af6 diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 7d61d1d..748e5f6 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -120,6 +120,8 @@ private: sal_Int32 m_nInLoad; sal_Bool volatile m_bUpdateNotificationsPending; + bool mbTimeBased; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xChartView; // for the ref count ChartView* mpChartView; @@ -580,6 +582,9 @@ public: // normal methods ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > getNumberFormatsSupplier(); + + bool isTimeBased() const; + void setTimeBased(bool bTimeBased); }; } // namespace chart diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 80ef459..80f0d27 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -51,6 +51,21 @@ namespace chart { class VCoordinateSystem; class DrawModelWrapper; class SeriesPlotterContainer; +class VDataSeriesGroup; + +struct TimeBasedInfo +{ + TimeBasedInfo(): + bTimeBased(false), + nFrame(0), + m_pZSlots(NULL) {} + + bool bTimeBased; + size_t nFrame; + + // only valid when we are in the time based mode + ::std::vector< ::std::vector< VDataSeriesGroup > >* m_pZSlots; +}; /** * The ChartView is responsible to manage the generation of Drawing Objects @@ -237,6 +252,8 @@ private: //member sal_Bool m_bSdrViewIsInEditMode; ::com::sun::star::awt::Rectangle m_aResultingDiagramRectangleExcludingAxes; + + TimeBasedInfo maTimeBased; }; } diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index c29a10e..842501f 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -1346,6 +1346,16 @@ OUString SAL_CALL ChartModel::dump() return OUString(); } +bool ChartModel::isTimeBased() const +{ + return mbTimeBased; +} + +void ChartModel::setTimeBased(bool bTimeBased) +{ + mbTimeBased = bTimeBased; +} + } // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index be0fab6..bbd903c 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -62,6 +62,11 @@ class VDataSeries : boost::noncopyable public: VDataSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xDataSeries ); + // for time based charting + VDataSeries( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xDataSeries, + VDataSeries* pOldSeries, double nPercent); + virtual ~VDataSeries(); ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > @@ -140,7 +145,7 @@ public: void setRoleOfSequenceForDataLabelNumberFormatDetection( const OUString& rRole ); - //this is only temporarily here for area chart: + //this is only tempohttps://www.google.de/search?q=minka+kelly&safe=off&tbm=isch&tbo=u&source=univ&sa=X&ei=x36_Uv6ZF9Kf7ga-rYGIAg&ved=0CK4BEIke&biw=1920&bih=1043#q=minka+kelly&safe=off&tbm=isch&tbs=isz:lrarily here for area chart: ::com::sun::star::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D; sal_Int32 m_nPolygonIndex; double m_fLogicMinX; @@ -250,6 +255,10 @@ private: //member sal_Int32 m_nMissingValueTreatment; bool m_bAllowPercentValueInDataLabel; + + // for time based charting + VDataSeries* mpOldSeries; + double mnPercent; }; } //namespace chart diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 6a087de..0d68cdf 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -384,6 +384,9 @@ protected: VDataSeries* getFirstSeries() const; + // ugly hack to cache the data for the next turn + const std::vector< std::vector< VDataSeriesGroup > >& getData(); + protected: PlottingPositionHelper* m_pMainPosHelper; diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 72cefde..2f170eb 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -465,7 +465,14 @@ double VDataSeries::getXValue( sal_Int32 index ) const if(m_aValues_X.is()) { if( 0<=index && index<m_aValues_X.getLength() ) + { fRet = m_aValues_X.Doubles[index]; + if(mpOldSeries) + { + double nOldVal = mpOldSeries->m_aValues_X.Doubles[index]; + fRet = nOldVal + (fRet - nOldVal) * mnPercent; + } + } else ::rtl::math::setNan( &fRet ); } @@ -487,7 +494,14 @@ double VDataSeries::getYValue( sal_Int32 index ) const if(m_aValues_Y.is()) { if( 0<=index && index<m_aValues_Y.getLength() ) + { fRet = m_aValues_Y.Doubles[index]; + if(mpOldSeries) + { + double nOldVal = mpOldSeries->m_aValues_Y.Doubles[index]; + fRet = nOldVal + (fRet - nOldVal) * mnPercent; + } + } else ::rtl::math::setNan( &fRet ); } @@ -548,7 +562,14 @@ double VDataSeries::getY_Last( sal_Int32 index ) const } double VDataSeries::getBubble_Size( sal_Int32 index ) const { - return m_aValues_Bubble_Size.getValue( index ); + double nNewVal = m_aValues_Bubble_Size.getValue( index ); + if(mpOldSeries) + { + double nOldVal = mpOldSeries->m_aValues_Bubble_Size.getValue( index ); + nNewVal = nOldVal + (nNewVal - nOldVal) * mnPercent; + } + + return nNewVal; } bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
