summaryrefslogtreecommitdiff
path: root/oox/source/drawingml
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-03-01 08:39:11 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-03-07 02:37:36 +0100
commitd72145f9307c732ced4a546ac1e5093ec7c1a982 (patch)
tree648cf88d30ba3da260edb22829d8cd8be0c9345e /oox/source/drawingml
parent6b39ed0eaffabb6ffe11496d833053c094c72f7b (diff)
Move BackGraphicURL property & friends to BackGraphic + fixes
This moves BackGraphicURL, HeaderGraphicURL, FooterGraphicURL and ParaBackGraphicURL properties to BackGraphic, HeaderBackGraphic, FooterBackGraphic and ParaBackGraphic. With this the property type changes from String to XGraphic. This change also fixes a bunch of test failures, changes the tests to use the new properties and the correct type, changes the import and export filters like xmloff and oox, to make the tests happy. Change-Id: Ie66097514203c6dc36ab27420faf265322e9279e Reviewed-on: https://gerrit.libreoffice.org/50760 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r--oox/source/drawingml/fillproperties.cxx7
-rw-r--r--oox/source/drawingml/shape.cxx14
-rw-r--r--oox/source/drawingml/shapepropertymap.cxx17
3 files changed, 21 insertions, 17 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 7f6a7044a386..c22654ebeb6f 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -604,17 +604,14 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
// TODO: "rotate with shape" is not possible with our current core
- OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic );
- // push bitmap or named bitmap to property map
-
- if (!aGraphicUrl.isEmpty())
+ if (xGraphic.is())
{
if (rPropMap.supportsProperty(ShapeProperty::FillBitmapNameFromUrl) &&
rPropMap.setProperty(ShapeProperty::FillBitmapNameFromUrl, xGraphic))
{
eFillStyle = FillStyle_BITMAP;
}
- else if (rPropMap.setProperty(ShapeProperty::FillBitmapUrl, aGraphicUrl))
+ else if (rPropMap.setProperty(ShapeProperty::FillBitmapUrl, xGraphic))
{
eFillStyle = FillStyle_BITMAP;
}
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 6d83c68e3df2..b3c48b0b67c7 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -54,6 +54,7 @@
#include <tools/mapunit.hxx>
#include <editeng/unoprnms.hxx>
#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -841,16 +842,19 @@ Reference< XShape > const & Shape::createAndInsert(
aShapeProps.setAnyProperty(PROP_BackColorTransparency, aShapeProps.getProperty(PROP_FillTransparence));
aShapeProps.erase(PROP_FillTransparence);
}
- // TextFrames have BackGrahicURL, not FillBitmapURL
- if (aShapeProps.hasProperty(PROP_FillBitmapURL))
+ // TextFrames have BackGrahic, not FillBitmap
+ if (aShapeProps.hasProperty(PROP_FillBitmap))
{
- aShapeProps.setAnyProperty(PROP_BackGraphicURL, aShapeProps.getProperty(PROP_FillBitmapURL));
- aShapeProps.erase(PROP_FillBitmapURL);
+ aShapeProps.setAnyProperty(PROP_BackGraphic, aShapeProps.getProperty(PROP_FillBitmap));
+ aShapeProps.erase(PROP_FillBitmap);
}
if (aShapeProps.hasProperty(PROP_FillBitmapName))
{
uno::Any aAny = aShapeProps.getProperty(PROP_FillBitmapName);
- aShapeProps.setProperty(PROP_BackGraphicURL, rFilterBase.getModelObjectHelper().getFillBitmapUrl( aAny.get<OUString>() ));
+ OUString aFillBitmapName = aAny.get<OUString>();
+ uno::Reference<awt::XBitmap> xBitmap = rFilterBase.getModelObjectHelper().getFillBitmap(aFillBitmapName);
+ uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
+ aShapeProps.setProperty(PROP_BackGraphic, xGraphic);
// aShapeProps.erase(PROP_FillBitmapName); // Maybe, leave the name as well
}
// And no LineColor property; individual borders can have colors
diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx
index 53226434dfb1..c0704381b19c 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -180,17 +180,20 @@ bool ShapePropertyMap::setGradientTrans( sal_Int32 nPropId, const Any& rValue )
return false;
}
-bool ShapePropertyMap::setFillBitmapUrl( sal_Int32 nPropId, const Any& rValue )
+bool ShapePropertyMap::setFillBitmapUrl(sal_Int32 nPropId, const Any& rValue)
{
- // push bitmap URL explicitly
- if( !maShapePropInfo.mbNamedFillBitmapUrl )
- return setAnyProperty( nPropId, rValue );
+ // push bitmap explicitly
+ if (!maShapePropInfo.mbNamedFillBitmapUrl)
+ {
+ return setAnyProperty(nPropId, rValue);
+ }
// create named bitmap URL and push its name
- if( rValue.has< OUString >() )
+ if (rValue.has<uno::Reference<graphic::XGraphic>>())
{
- OUString aBitmapUrlName = mrModelObjHelper.insertFillBitmapUrl( rValue.get< OUString >() );
- return !aBitmapUrlName.isEmpty() && setProperty( nPropId, aBitmapUrlName );
+ auto xGraphic = rValue.get<uno::Reference<graphic::XGraphic>>();
+ OUString aBitmapName = mrModelObjHelper.insertFillBitmapXGraphic(xGraphic);
+ return !aBitmapName.isEmpty() && setProperty(nPropId, aBitmapName);
}
return false;