[Libreoffice-commits] core.git: chart2/source offapi/com qadevOOo/objdsc qadevOOo/tests
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Thu May 3 06:51:24 UTC 2018
chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx | 2
chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx | 51 ++++++++++
offapi/com/sun/star/chart/ChartDataPointProperties.idl | 12 ++
offapi/com/sun/star/chart/LineDiagram.idl | 10 +
qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataPoint.csv | 1
qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataRow.csv | 1
qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDiagram.csv | 1
qadevOOo/tests/java/ifc/chart/_ChartDataPointProperties.java | 22 ++++
qadevOOo/tests/java/ifc/chart/_LineDiagram.java | 22 ++++
9 files changed, 116 insertions(+), 6 deletions(-)
New commits:
commit 7f580d4fba2da90da2ccfbad7f0e21c12e810a26
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Apr 26 17:03:55 2018 +0900
[API CHANGE] revert SymbolBitmapURL impl, add SymbolBitmap property
This adds back the implementation for setting the SymbolBitmapURL
property (getting returns an empty string) and adds SymbolBitmap
property to the UNO API (LineDiagram.idl).
SymbolBitmapURL property was already deprecated, but we still need
to add the SymbolBitmap for compatibility.
[ Miklos Vajna: updated qadevOOo tests to handle the new write-only
properties. ]
Change-Id: Id00d78299b7fd5ba9d78c36c5f03a10d9e61c60a
Reviewed-on: https://gerrit.libreoffice.org/53492
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
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 )
diff --git a/offapi/com/sun/star/chart/ChartDataPointProperties.idl b/offapi/com/sun/star/chart/ChartDataPointProperties.idl
index 06a3b4d92c2d..f80574ff1204 100644
--- a/offapi/com/sun/star/chart/ChartDataPointProperties.idl
+++ b/offapi/com/sun/star/chart/ChartDataPointProperties.idl
@@ -124,6 +124,8 @@ published service ChartDataPointProperties
<p>When you query this value you get an internal URL of the
embedded graphic.</p>
+ @deprecated as of Libreoffice 6.1
+
@see ChartSymbolType
*/
[optional, property] string SymbolBitmapURL;
@@ -139,6 +141,16 @@ published service ChartDataPointProperties
@since LibreOffice 5.1
*/
[optional, property] boolean TextWordWrap;
+
+ /** In charts that support symbols, you can set this property to
+ a graphic object. This graphic is then used as symbol for each
+ data point.
+
+ @since LibreOffice 6.1
+
+ @see ChartSymbolType
+ */
+ [optional, property] com::sun::star::graphic::XGraphic SymbolBitmap;
};
diff --git a/offapi/com/sun/star/chart/LineDiagram.idl b/offapi/com/sun/star/chart/LineDiagram.idl
index 4117feff6aac..5fcb2d15629e 100644
--- a/offapi/com/sun/star/chart/LineDiagram.idl
+++ b/offapi/com/sun/star/chart/LineDiagram.idl
@@ -123,6 +123,16 @@ published service LineDiagram
/** determines the number of sampling points of a spline
*/
[optional, property] long SplineResolution;
+
+ /** Set this property to a graphic object which is then used as
+ symbol for all series.
+
+ @since LibreOffice 6.1
+
+ @deprecated - added for backwards compatibility
+ @see ChartSymbolType
+ */
+ [optional, property] com::sun::star::graphic::XGraphic SymbolBitmap;
};
diff --git a/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataPoint.csv b/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataPoint.csv
index af4ebc6b2f74..69bad48ea738 100644
--- a/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataPoint.csv
+++ b/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataPoint.csv
@@ -15,7 +15,6 @@
"ChXDataPoint";"com::sun::star::chart::Chart3DBarProperties#optional";"SolidType"
"ChXDataPoint";"com::sun::star::chart::ChartDataPointProperties";"DataCaption"
"ChXDataPoint";"com::sun::star::chart::ChartDataPointProperties";"SymbolType#optional"
-"ChXDataPoint";"com::sun::star::chart::ChartDataPointProperties";"SymbolBitmapURL#optional"
"ChXDataPoint";"com::sun::star::drawing::FillProperties";"FillStyle"
"ChXDataPoint";"com::sun::star::drawing::FillProperties";"FillColor"
"ChXDataPoint";"com::sun::star::drawing::FillProperties";"FillTransparence"
diff --git a/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataRow.csv b/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataRow.csv
index f64c24d83035..482d206da493 100644
--- a/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataRow.csv
+++ b/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDataRow.csv
@@ -15,7 +15,6 @@
"ChXDataRow";"com::sun::star::chart::Chart3DBarProperties#optional";"SolidType"
"ChXDataRow";"com::sun::star::chart::ChartDataPointProperties";"DataCaption"
"ChXDataRow";"com::sun::star::chart::ChartDataPointProperties";"SymbolType#optional"
-"ChXDataRow";"com::sun::star::chart::ChartDataPointProperties";"SymbolBitmapURL#optional"
"ChXDataRow";"com::sun::star::drawing::FillProperties#optional";"FillStyle"
"ChXDataRow";"com::sun::star::drawing::FillProperties#optional";"FillColor"
"ChXDataRow";"com::sun::star::drawing::FillProperties#optional";"FillTransparence"
diff --git a/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDiagram.csv b/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDiagram.csv
index 8976f4ae236a..5a0ca113d696 100644
--- a/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDiagram.csv
+++ b/qadevOOo/objdsc/sch/com.sun.star.comp.office.ChXDiagram.csv
@@ -61,7 +61,6 @@
"ChXDiagram";"com::sun::star::drawing::XShape";"setSize()"
"ChXDiagram";"com::sun::star::chart::LineDiagram";"SymbolType"
"ChXDiagram";"com::sun::star::chart::LineDiagram";"SymbolSize#optional"
-"ChXDiagram";"com::sun::star::chart::LineDiagram";"SymbolBitmapURL#optional"
"ChXDiagram";"com::sun::star::chart::LineDiagram";"Lines"
"ChXDiagram";"com::sun::star::chart::LineDiagram";"SplineType"
"ChXDiagram";"com::sun::star::chart::LineDiagram";"SplineOrder#optional"
diff --git a/qadevOOo/tests/java/ifc/chart/_ChartDataPointProperties.java b/qadevOOo/tests/java/ifc/chart/_ChartDataPointProperties.java
index fbf59aa5dac6..c78d87951750 100644
--- a/qadevOOo/tests/java/ifc/chart/_ChartDataPointProperties.java
+++ b/qadevOOo/tests/java/ifc/chart/_ChartDataPointProperties.java
@@ -102,7 +102,27 @@ public class _ChartDataPointProperties extends MultiPropertyTest {
throw new StatusException("Exception while set property value", e);
}
- testProperty("SymbolBitmapURL", URLTester);
+ try {
+ oObj.setPropertyValue(
+ "SymbolBitmapURL",
+ utils.getFullTestURL("space-metal.jpg") );
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception while set property value");
+ e.printStackTrace(log);
+ throw new StatusException("Exception while set property value", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception while set property value");
+ e.printStackTrace(log);
+ throw new StatusException("Exception while set property value", e);
+ } catch(com.sun.star.beans.PropertyVetoException e) {
+ log.println("Exception while set property value");
+ e.printStackTrace(log);
+ throw new StatusException("Exception while set property value", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e) {
+ log.println("Exception while set property value");
+ e.printStackTrace(log);
+ throw new StatusException("Exception while set property value", e);
+ }
}
}
diff --git a/qadevOOo/tests/java/ifc/chart/_LineDiagram.java b/qadevOOo/tests/java/ifc/chart/_LineDiagram.java
index d461844513cc..aaade8f9bc29 100644
--- a/qadevOOo/tests/java/ifc/chart/_LineDiagram.java
+++ b/qadevOOo/tests/java/ifc/chart/_LineDiagram.java
@@ -183,7 +183,27 @@ public class _LineDiagram extends MultiPropertyTest {
throw new StatusException("Exception while set property value", e);
}
- testProperty("SymbolBitmapURL", URLTester) ;
+ try {
+ oObj.setPropertyValue(
+ "SymbolBitmapURL",
+ util.utils.getFullTestURL("space-metal.jpg") );
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception while set property value");
+ e.printStackTrace(log);
+ throw new StatusException("Exception while set property value", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception while set property value");
+ e.printStackTrace(log);
+ throw new StatusException("Exception while set property value", e);
+ } catch(com.sun.star.beans.PropertyVetoException e) {
+ log.println("Exception while set property value");
+ e.printStackTrace(log);
+ throw new StatusException("Exception while set property value", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e) {
+ log.println("Exception while set property value");
+ e.printStackTrace(log);
+ throw new StatusException("Exception while set property value", e);
+ }
}
} // EOF LineDiagram
More information about the Libreoffice-commits
mailing list