diff options
Diffstat (limited to 'writerfilter/source/dmapper/WrapPolygonHandler.cxx')
-rw-r--r-- | writerfilter/source/dmapper/WrapPolygonHandler.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.cxx b/writerfilter/source/dmapper/WrapPolygonHandler.cxx index 7d2526c0bbaf..00b8699972bc 100644 --- a/writerfilter/source/dmapper/WrapPolygonHandler.cxx +++ b/writerfilter/source/dmapper/WrapPolygonHandler.cxx @@ -18,6 +18,7 @@ */ #include <com/sun/star/drawing/PointSequence.hpp> +#include <com/sun/star/text/GraphicCrop.hpp> #include <comphelper/sequence.hxx> #include <ooxml/resourceids.hxx> @@ -135,6 +136,23 @@ WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygonPixel(const awt::Size return pResult; } +WrapPolygon::Pointer_t WrapPolygon::correctCrop(const awt::Size& rGraphicSize, + const text::GraphicCrop& rGraphicCrop) +{ + WrapPolygon::Pointer_t pResult; + + Fraction aScaleX(rGraphicSize.Width - rGraphicCrop.Left - rGraphicCrop.Right, + rGraphicSize.Width); + Fraction aScaleY(rGraphicSize.Height - rGraphicCrop.Top - rGraphicCrop.Bottom, + rGraphicSize.Height); + pResult = scale(aScaleX, aScaleY); + + awt::Point aMove(rGraphicCrop.Left, rGraphicCrop.Top); + pResult = pResult->move(aMove); + + return pResult; +} + drawing::PointSequenceSequence WrapPolygon::getPointSequenceSequence() const { drawing::PointSequenceSequence aPolyPolygon(1); |