summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/WrapPolygonHandler.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-11-21 16:18:38 +1000
committerMichael Meeks <michael.meeks@collabora.com>2015-11-23 11:32:08 +0000
commitd59ef5b2ddb9249905fecf941be6ec83251d12de (patch)
treefc03b5080f7795fad15a79fac66d2dfc9171a7f5 /writerfilter/source/dmapper/WrapPolygonHandler.cxx
parent0cda1453a0e24e9ad6884a1345e4514a86900346 (diff)
tdf#60351: Use Wrap Polygon also for PROP_SIZE_PIXEL
Since commit 2b5bf2f1c57d6585ec898c4c44a74c5b47f09ab9 "graphic import improved" from 2006-11-20 by Oliver Specht, there is an unused code reading pixel size (PROP_SIZE_PIXEL) of an image in a part of GraphicImport::createGraphicObject() that imports the wrap polygon. When there's no PROP_SIZE100th_M_M in graphic, the imported wrap polygon was simply dropped, and then automatic contour was generated for graphic. Now we import contour correctly in this case. Also, as paragraph background overlaps non-opaque graphics, we need to set opaque to true regardless of behindDoc value of wp:anchor. Change-Id: Ifa5eec9f8ccaf5ba051732b6e4f965ae8606a1cf Reviewed-on: https://gerrit.libreoffice.org/20103 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'writerfilter/source/dmapper/WrapPolygonHandler.cxx')
-rw-r--r--writerfilter/source/dmapper/WrapPolygonHandler.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.cxx b/writerfilter/source/dmapper/WrapPolygonHandler.cxx
index 8a66e822bba3..02732cfe1cd0 100644
--- a/writerfilter/source/dmapper/WrapPolygonHandler.cxx
+++ b/writerfilter/source/dmapper/WrapPolygonHandler.cxx
@@ -111,6 +111,29 @@ WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygon(const awt::Size & rSr
return pResult;
}
+WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygonPixel(const awt::Size & rSrcSize)
+{
+ WrapPolygon::Pointer_t pResult;
+
+ /*
+ * https://msdn.microsoft.com/en-us/library/ee342530.aspx
+ *
+ * Image wrapping polygons in Microsoft Word use a fixed coordinate space
+ * that is 21600 units x 21600 units. Coordinate (0,0) is the upper left
+ * corner of the image and coordinate (21600,21600) is the lower right
+ * corner of the image. Microsoft Word scales the size of the wrapping
+ * polygon units to fit the size of the image. The 21600 value is a legacy
+ * artifact from the drawing layer of early versions of Microsoft Office.
+ */
+ const long nWrap100Percent = 21600;
+
+ Fraction aScaleX(rSrcSize.Width, nWrap100Percent);
+ Fraction aScaleY(rSrcSize.Height, nWrap100Percent);
+ pResult = scale(aScaleX, aScaleY);
+
+ return pResult;
+}
+
drawing::PointSequenceSequence WrapPolygon::getPointSequenceSequence() const
{
drawing::PointSequenceSequence aPolyPolygon(1L);