diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-01-04 08:16:08 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-01-29 08:09:33 +0100 |
commit | d70331f9def6383f94beadbf43f5c10848d67208 (patch) | |
tree | 036c723670e65ecc0b979c5756660a0dbe6babe7 | |
parent | 8eb5d8da67e8184fe17dcc7ccc746059f06c836f (diff) |
first step for mapped properties
Only FillColor in bubble charts is supported right now.
Change-Id: If6ad0220c15e06a9a57c554f6243fd9908b2651b
-rw-r--r-- | chart2/source/controller/dialogs/tp_DataSource.cxx | 18 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_DataSource.hxx | 6 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.cxx | 9 | ||||
-rw-r--r-- | chart2/source/view/inc/VDataSeries.hxx | 7 | ||||
-rw-r--r-- | chart2/source/view/main/VDataSeries.cxx | 27 |
6 files changed, 66 insertions, 3 deletions
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index c45328b3f9ae..330bfb790f5f 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -218,6 +218,8 @@ DataSourceTabPage::DataSourceTabPage( get(m_pEDT_CATEGORIES ,"EDT_CATEGORIES"); get(m_pIMB_RANGE_CAT ,"IMB_RANGE_CAT"); + m_pBtn_AddMapping = NULL; + m_pFT_CAPTION->Show(!bHideDescription); m_aFixedTextRange = OUString( m_pFT_RANGE->GetText() ); @@ -246,6 +248,11 @@ DataSourceTabPage::DataSourceTabPage( m_pEDT_RANGE->SetStyle( m_pEDT_RANGE->GetStyle() | WB_FORCECTRLBACKGROUND ); m_pEDT_CATEGORIES->SetStyle( m_pEDT_CATEGORIES->GetStyle() | WB_FORCECTRLBACKGROUND ); + // mapped properties +#if 0 + m_pBtn_AddMapping->SetClickHdl( LINK( this, DataSourceTabPage, AddMappingHdl )); +#endif + // set symbol font for arrows // note: StarSymbol is substituted to OpenSymbol for OOo Font aSymbolFont( m_pBTN_UP->GetFont()); @@ -754,7 +761,16 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit ) return 0; } -void DataSourceTabPage::listeningFinished(const OUString & rNewRange ) +IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl ) +{ + OUString aNewMappingName = "FillColor"; + m_pLB_ROLE->InsertEntry( lcl_GetRoleLBEntry( aNewMappingName, OUString())); + + return 0; +} + +void DataSourceTabPage::listeningFinished( + const OUString & rNewRange ) { // rNewRange becomes invalid after removing the listener OUString aRange( rNewRange ); diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx index 94f4692704b7..819f02a5a22b 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.hxx +++ b/chart2/source/controller/dialogs/tp_DataSource.hxx @@ -88,6 +88,7 @@ protected: DECL_LINK( RangeUpdateDataHdl, Edit* ); DECL_LINK( UpButtonClickedHdl, void* ); DECL_LINK( DownButtonClickedHdl, void* ); + DECL_LINK( AddMappingHdl, void* ); // ____ RangeSelectionListenerParent ____ virtual void listeningFinished( const OUString & rNewRange ); @@ -108,8 +109,8 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener > getSelectionRangeListener(); - /** @return </sal_True>, if the edit field contains a valid range entry. if no - XCellRangesAccess can be obtained, </sal_True> is returned. + /** @return </sal_True>, if the edit field contains a valid range entry. If no + XCellRangesAccess can be obtained, </sal_False> is returned. */ bool isRangeFieldContentValid( Edit & rEdit ); @@ -142,6 +143,7 @@ private: FixedText* m_pFT_DATALABELS;//used for xy charts Edit* m_pEDT_CATEGORIES; PushButton* m_pIMB_RANGE_CAT; + PushButton* m_pBtn_AddMapping; OUString m_aFixedTextRange; diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc index 685c4fe8e6c0..b7d17a7a7a80 100644 --- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc +++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc @@ -33,4 +33,6 @@ #define ED_TIME_START 5 #define ED_TIME_END 6 +#define BTN_ADDMAPPING 160 + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index 1db4d838431e..a2e5dca4cbdd 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -248,6 +248,8 @@ void BubbleChart::createShapes() if(!pSeries) continue; + bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor"); + uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(*aSeriesIter, xSeriesTarget); sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex(); @@ -319,6 +321,13 @@ void BubbleChart::createShapes() , pSeries->getPropertiesOfPoint( nIndex ) , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); + if(bHasFillColorMapping) + { + uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW ); + xProps->setPropertyValue("FillColor", uno::makeAny(static_cast<sal_Int32>( + pSeries->getValueByProperty(nIndex, "FillColor")))); + } + m_pShapeFactory->setShapeName( xShape, "MarkHandles" ); //create data point label diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index 7989b3e996eb..ab48afe0f910 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -36,6 +36,7 @@ #include <vector> #include <boost/noncopyable.hpp> #include <boost/scoped_ptr.hpp> +#include <boost/ptr_container/ptr_map.hpp> namespace chart { @@ -93,6 +94,10 @@ public: double getMinimumofAllDifferentYValues( sal_Int32 index ) const; double getMaximumofAllDifferentYValues( sal_Int32 index ) const; + double getValueByProperty( sal_Int32 index, const OUString& rPropName ) const; + + bool hasPropertyMapping( const OUString& rPropName ) const; + ::com::sun::star::uno::Sequence< double > getAllX() const; ::com::sun::star::uno::Sequence< double > getAllY() const; @@ -214,6 +219,8 @@ private: //member VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection; + boost::ptr_map<OUString, VDataSequence> maPropertyMap; + mutable double m_fXMeanValue; mutable double m_fYMeanValue; diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 52b510f89597..dad92a86f958 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -226,6 +226,12 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) m_aValues_Y_Last.init( xDataSequence ); else if (aRole == "values-size") m_aValues_Bubble_Size.init( xDataSequence ); + else + { + VDataSequence* pSequence = new VDataSequence(); + pSequence->init( xDataSequence ); + maPropertyMap.insert(aRole, pSequence); + } } catch( const uno::Exception& e ) { @@ -1082,6 +1088,27 @@ VDataSeries* VDataSeries::createCopyForTimeBased() const return pNew; } +double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropName ) const +{ + boost::ptr_map<OUString, VDataSequence>::const_iterator itr = + maPropertyMap.find(rPropName); + if(itr == maPropertyMap.end()) + { + double fNan; + ::rtl::math::setNan( & fNan ); + return fNan; + } + + // TODO:moggi handle time based charting + const VDataSequence* pData = itr->second; + return pData->getValue(nIndex); +} + +bool VDataSeries::hasPropertyMapping(const OUString& rPropName ) const +{ + return maPropertyMap.find(rPropName) != maPropertyMap.end(); +} + } //namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |