[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@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Tomaž Vajngerl
2018-04-26 17:03:55 +09:00
committed by Miklos Vajna
parent ebcf27d419
commit 7f580d4fba
9 changed files with 116 additions and 6 deletions

View File

@@ -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;

View File

@@ -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 )

View File

@@ -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;
};

View File

@@ -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;
};

View File

@@ -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"
1 ChXDataPoint com::sun::star::xml::UserDefinedAttributesSupplier UserDefinedAttributes
15 ChXDataPoint com::sun::star::chart::Chart3DBarProperties#optional SolidType
16 ChXDataPoint com::sun::star::chart::ChartDataPointProperties DataCaption
17 ChXDataPoint com::sun::star::chart::ChartDataPointProperties SymbolType#optional
ChXDataPoint com::sun::star::chart::ChartDataPointProperties SymbolBitmapURL#optional
18 ChXDataPoint com::sun::star::drawing::FillProperties FillStyle
19 ChXDataPoint com::sun::star::drawing::FillProperties FillColor
20 ChXDataPoint com::sun::star::drawing::FillProperties FillTransparence

View File

@@ -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"
1 ChXDataRow com::sun::star::xml::UserDefinedAttributesSupplier#optional UserDefinedAttributes
15 ChXDataRow com::sun::star::chart::Chart3DBarProperties#optional SolidType
16 ChXDataRow com::sun::star::chart::ChartDataPointProperties DataCaption
17 ChXDataRow com::sun::star::chart::ChartDataPointProperties SymbolType#optional
ChXDataRow com::sun::star::chart::ChartDataPointProperties SymbolBitmapURL#optional
18 ChXDataRow com::sun::star::drawing::FillProperties#optional FillStyle
19 ChXDataRow com::sun::star::drawing::FillProperties#optional FillColor
20 ChXDataRow com::sun::star::drawing::FillProperties#optional FillTransparence

View File

@@ -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"
1 ChXDiagram com::sun::star::xml::UserDefinedAttributesSupplier#optional UserDefinedAttributes
61 ChXDiagram com::sun::star::drawing::XShape setSize()
62 ChXDiagram com::sun::star::chart::LineDiagram SymbolType
63 ChXDiagram com::sun::star::chart::LineDiagram SymbolSize#optional
ChXDiagram com::sun::star::chart::LineDiagram SymbolBitmapURL#optional
64 ChXDiagram com::sun::star::chart::LineDiagram Lines
65 ChXDiagram com::sun::star::chart::LineDiagram SplineType
66 ChXDiagram com::sun::star::chart::LineDiagram SplineOrder#optional

View File

@@ -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);
}
}
}

View File

@@ -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