Kaydet (Commit) d70331f9 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

first step for mapped properties

Only FillColor in bubble charts is supported right now.

Change-Id: If6ad0220c15e06a9a57c554f6243fd9908b2651b
üst 8eb5d8da
...@@ -218,6 +218,8 @@ DataSourceTabPage::DataSourceTabPage( ...@@ -218,6 +218,8 @@ DataSourceTabPage::DataSourceTabPage(
get(m_pEDT_CATEGORIES ,"EDT_CATEGORIES"); get(m_pEDT_CATEGORIES ,"EDT_CATEGORIES");
get(m_pIMB_RANGE_CAT ,"IMB_RANGE_CAT"); get(m_pIMB_RANGE_CAT ,"IMB_RANGE_CAT");
m_pBtn_AddMapping = NULL;
m_pFT_CAPTION->Show(!bHideDescription); m_pFT_CAPTION->Show(!bHideDescription);
m_aFixedTextRange = OUString( m_pFT_RANGE->GetText() ); m_aFixedTextRange = OUString( m_pFT_RANGE->GetText() );
...@@ -246,6 +248,11 @@ DataSourceTabPage::DataSourceTabPage( ...@@ -246,6 +248,11 @@ DataSourceTabPage::DataSourceTabPage(
m_pEDT_RANGE->SetStyle( m_pEDT_RANGE->GetStyle() | WB_FORCECTRLBACKGROUND ); m_pEDT_RANGE->SetStyle( m_pEDT_RANGE->GetStyle() | WB_FORCECTRLBACKGROUND );
m_pEDT_CATEGORIES->SetStyle( m_pEDT_CATEGORIES->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 // set symbol font for arrows
// note: StarSymbol is substituted to OpenSymbol for OOo // note: StarSymbol is substituted to OpenSymbol for OOo
Font aSymbolFont( m_pBTN_UP->GetFont()); Font aSymbolFont( m_pBTN_UP->GetFont());
...@@ -754,7 +761,16 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit ) ...@@ -754,7 +761,16 @@ IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
return 0; 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 // rNewRange becomes invalid after removing the listener
OUString aRange( rNewRange ); OUString aRange( rNewRange );
......
...@@ -88,6 +88,7 @@ protected: ...@@ -88,6 +88,7 @@ protected:
DECL_LINK( RangeUpdateDataHdl, Edit* ); DECL_LINK( RangeUpdateDataHdl, Edit* );
DECL_LINK( UpButtonClickedHdl, void* ); DECL_LINK( UpButtonClickedHdl, void* );
DECL_LINK( DownButtonClickedHdl, void* ); DECL_LINK( DownButtonClickedHdl, void* );
DECL_LINK( AddMappingHdl, void* );
// ____ RangeSelectionListenerParent ____ // ____ RangeSelectionListenerParent ____
virtual void listeningFinished( const OUString & rNewRange ); virtual void listeningFinished( const OUString & rNewRange );
...@@ -108,8 +109,8 @@ protected: ...@@ -108,8 +109,8 @@ protected:
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener > ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener >
getSelectionRangeListener(); getSelectionRangeListener();
/** @return </sal_True>, if the edit field contains a valid range entry. if no /** @return </sal_True>, if the edit field contains a valid range entry. If no
XCellRangesAccess can be obtained, </sal_True> is returned. XCellRangesAccess can be obtained, </sal_False> is returned.
*/ */
bool isRangeFieldContentValid( Edit & rEdit ); bool isRangeFieldContentValid( Edit & rEdit );
...@@ -142,6 +143,7 @@ private: ...@@ -142,6 +143,7 @@ private:
FixedText* m_pFT_DATALABELS;//used for xy charts FixedText* m_pFT_DATALABELS;//used for xy charts
Edit* m_pEDT_CATEGORIES; Edit* m_pEDT_CATEGORIES;
PushButton* m_pIMB_RANGE_CAT; PushButton* m_pIMB_RANGE_CAT;
PushButton* m_pBtn_AddMapping;
OUString m_aFixedTextRange; OUString m_aFixedTextRange;
......
...@@ -33,4 +33,6 @@ ...@@ -33,4 +33,6 @@
#define ED_TIME_START 5 #define ED_TIME_START 5
#define ED_TIME_END 6 #define ED_TIME_END 6
#define BTN_ADDMAPPING 160
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -248,6 +248,8 @@ void BubbleChart::createShapes() ...@@ -248,6 +248,8 @@ void BubbleChart::createShapes()
if(!pSeries) if(!pSeries)
continue; continue;
bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor");
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(*aSeriesIter, xSeriesTarget); uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(*aSeriesIter, xSeriesTarget);
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex(); sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
...@@ -319,6 +321,13 @@ void BubbleChart::createShapes() ...@@ -319,6 +321,13 @@ void BubbleChart::createShapes()
, pSeries->getPropertiesOfPoint( nIndex ) , pSeries->getPropertiesOfPoint( nIndex )
, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); , 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" ); m_pShapeFactory->setShapeName( xShape, "MarkHandles" );
//create data point label //create data point label
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <vector> #include <vector>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/ptr_container/ptr_map.hpp>
namespace chart namespace chart
{ {
...@@ -93,6 +94,10 @@ public: ...@@ -93,6 +94,10 @@ public:
double getMinimumofAllDifferentYValues( sal_Int32 index ) const; double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
double getMaximumofAllDifferentYValues( 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 > getAllX() const;
::com::sun::star::uno::Sequence< double > getAllY() const; ::com::sun::star::uno::Sequence< double > getAllY() const;
...@@ -214,6 +219,8 @@ private: //member ...@@ -214,6 +219,8 @@ private: //member
VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection; VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
boost::ptr_map<OUString, VDataSequence> maPropertyMap;
mutable double m_fXMeanValue; mutable double m_fXMeanValue;
mutable double m_fYMeanValue; mutable double m_fYMeanValue;
......
...@@ -226,6 +226,12 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) ...@@ -226,6 +226,12 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
m_aValues_Y_Last.init( xDataSequence ); m_aValues_Y_Last.init( xDataSequence );
else if (aRole == "values-size") else if (aRole == "values-size")
m_aValues_Bubble_Size.init( xDataSequence ); m_aValues_Bubble_Size.init( xDataSequence );
else
{
VDataSequence* pSequence = new VDataSequence();
pSequence->init( xDataSequence );
maPropertyMap.insert(aRole, pSequence);
}
} }
catch( const uno::Exception& e ) catch( const uno::Exception& e )
{ {
...@@ -1082,6 +1088,27 @@ VDataSeries* VDataSeries::createCopyForTimeBased() const ...@@ -1082,6 +1088,27 @@ VDataSeries* VDataSeries::createCopyForTimeBased() const
return pNew; 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 } //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment