diff options
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/Library_writerfilter.mk | 1 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk index 792b1620b8dd..27eb752b02c3 100644 --- a/writerfilter/Library_writerfilter.mk +++ b/writerfilter/Library_writerfilter.mk @@ -34,6 +34,7 @@ $(eval $(call gb_Library_add_defs,writerfilter,\ )) $(eval $(call gb_Library_use_libraries,writerfilter,\ + basegfx \ comphelper \ cppu \ cppuhelper \ diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 0c67801ec32e..626d2a4c3f5f 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -33,6 +33,7 @@ #include <oox/drawingml/shapepropertymap.hxx> #include <oox/helper/propertyset.hxx> #include <boost/logic/tribool.hpp> +#include <basegfx/matrix/b2dhommatrix.hxx> using namespace com::sun::star; @@ -346,6 +347,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap boost::optional<sal_Int16> oRelativeWidth, oRelativeHeight; sal_Int16 nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME; sal_Int16 nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME; + boost::logic::tribool obRelFlipV(boost::logic::indeterminate); bool bCustom(false); int const nType = initShape(xShape, xPropertySet, bCustom, rShape, bClose, shapeOrPict); @@ -778,6 +780,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap while (nCharIndex >= 0); rShape.aWrapPolygonSprms = aPolygonSprms; } + else if (i->first == "fRelFlipV") + obRelFlipV = i->second.toInt32() == 1; else SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'"); } @@ -836,6 +840,33 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap } if (!aGeometry.empty() && xPropertySet.is() && !m_bTextFrame) xPropertySet->setPropertyValue("CustomShapeGeometry", uno::Any(comphelper::containerToSequence(aGeometry))); + if (!boost::logic::indeterminate(obRelFlipV) && xPropertySet.is()) + { + if (nType == ESCHER_ShpInst_Line) + { + // Line shape inside group shape: get the polygon sequence and transform it. + uno::Sequence< uno::Sequence<awt::Point> > aPolyPolySequence; + if ((xPropertySet->getPropertyValue("PolyPolygon") >>= aPolyPolySequence) && aPolyPolySequence.hasElements()) + { + uno::Sequence<awt::Point>& rPolygon = aPolyPolySequence[0]; + basegfx::B2DPolygon aPoly; + for (sal_Int32 i = 0; i < rPolygon.getLength(); ++i) + { + const awt::Point& rPoint = rPolygon[i]; + aPoly.insert(i, basegfx::B2DPoint(rPoint.X, rPoint.Y)); + } + basegfx::B2DHomMatrix aTransformation; + aTransformation.scale(1.0, obRelFlipV ? -1.0 : 1.0); + aPoly.transform(aTransformation); + for (sal_Int32 i = 0; i < rPolygon.getLength(); ++i) + { + basegfx::B2DPoint aPoint(aPoly.getB2DPoint(i)); + rPolygon[i] = awt::Point(static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getX())), static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getY()))); + } + xPropertySet->setPropertyValue("PolyPolygon", uno::makeAny(aPolyPolySequence)); + } + } + } // Set position and size if (xShape.is()) |