diff options
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx | 51 |
2 files changed, 52 insertions, 1 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index f49bcb0d4fe5..31cf7ff0c9ba 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -591,7 +591,7 @@ beans::PropertyState SAL_CALL DataSeriesPointWrapper::getPropertyState( const OU beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE ); try { - if (rPropertyName == "SymbolBitmap") + if (rPropertyName == "SymbolBitmap" || rPropertyName == "SymbolBitmapURL") { uno::Any aAny = WrappedPropertySet::getPropertyValue("SymbolType"); sal_Int32 nVal = css::chart::ChartSymbolType::NONE; diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx index a0bd74b8c82b..10a756ef1f9c 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/chart/ChartSymbolType.hpp> #include <com/sun/star/drawing/LineStyle.hpp> +#include <vcl/GraphicLoader.hxx> #include <editeng/unoprnms.hxx> #include <vcl/graph.hxx> @@ -58,6 +59,16 @@ public: tSeriesOrDiagramPropertyType ePropertyType); }; +class WrappedSymbolBitmapURLProperty : public WrappedSeriesOrDiagramProperty<OUString> +{ +public: + virtual OUString getValueFromSeries(const Reference<beans::XPropertySet>& xSeriesPropertySet) const override; + virtual void setValueToSeries(const Reference<beans::XPropertySet> & xSeriesPropertySet, OUString const & xNewGraphicURL) const override; + + explicit WrappedSymbolBitmapURLProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact, + tSeriesOrDiagramPropertyType ePropertyType); +}; + class WrappedSymbolBitmapProperty : public WrappedSeriesOrDiagramProperty<uno::Reference<graphic::XGraphic>> { public: @@ -96,6 +107,7 @@ enum { //symbol properties PROP_CHART_SYMBOL_TYPE = FAST_PROPERTY_ID_START_CHART_SYMBOL_PROP, + PROP_CHART_SYMBOL_BITMAP_URL, PROP_CHART_SYMBOL_BITMAP, PROP_CHART_SYMBOL_SIZE, PROP_CHART_SYMBOL_AND_LINES @@ -151,6 +163,7 @@ void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList , tSeriesOrDiagramPropertyType ePropertyType ) { rList.push_back( new WrappedSymbolTypeProperty( spChart2ModelContact, ePropertyType ) ); + rList.push_back( new WrappedSymbolBitmapURLProperty( spChart2ModelContact, ePropertyType ) ); rList.push_back( new WrappedSymbolBitmapProperty( spChart2ModelContact, ePropertyType ) ); rList.push_back( new WrappedSymbolSizeProperty( spChart2ModelContact, ePropertyType ) ); rList.push_back( new WrappedSymbolAndLinesProperty( spChart2ModelContact, ePropertyType ) ); @@ -166,6 +179,12 @@ void WrappedSymbolProperties::addProperties( std::vector< Property > & rOutPrope beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( "SymbolBitmapURL", + PROP_CHART_SYMBOL_BITMAP_URL, + cppu::UnoType<OUString>::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( "SymbolBitmap", PROP_CHART_SYMBOL_BITMAP, cppu::UnoType<graphic::XGraphic>::get(), @@ -278,6 +297,38 @@ beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Referenc return WrappedProperty::getPropertyState( xInnerPropertyState ); } +WrappedSymbolBitmapURLProperty::WrappedSymbolBitmapURLProperty( + const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact, + tSeriesOrDiagramPropertyType ePropertyType ) + : WrappedSeriesOrDiagramProperty<OUString>("SymbolBitmapURL", + uno::Any(OUString()), spChart2ModelContact, ePropertyType) +{ +} + +OUString WrappedSymbolBitmapURLProperty::getValueFromSeries(const Reference< beans::XPropertySet >& /*xSeriesPropertySet*/) const +{ + return OUString(); +} + +void WrappedSymbolBitmapURLProperty::setValueToSeries( + const Reference< beans::XPropertySet >& xSeriesPropertySet, + OUString const & xNewGraphicURL) const +{ + if (!xSeriesPropertySet.is()) + return; + + chart2::Symbol aSymbol; + if (xSeriesPropertySet->getPropertyValue("Symbol") >>= aSymbol) + { + if (!xNewGraphicURL.isEmpty()) + { + Graphic aGraphic = vcl::graphic::loadFromURL(xNewGraphicURL); + aSymbol.Graphic.set(aGraphic.GetXGraphic()); + xSeriesPropertySet->setPropertyValue("Symbol", uno::Any(aSymbol)); + } + } +} + WrappedSymbolBitmapProperty::WrappedSymbolBitmapProperty( const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) |