summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPallavi Jadhav <pallavi.jadhav@synerzip.com>2013-10-31 15:27:00 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-11-14 10:42:54 +0000
commitddaf39843ff8eac8e71a7d9a8bb74b34935cd399 (patch)
tree32105595017b594f3d0c619e441ea3d38fea294f /sw
parent6ad1a001b5c1d8287808aa3d9f7dfdb39040100f (diff)
Save Image-Crop information in docx for PNG
Issue:- 1] When MS Office docx file containing cropped image is round tripped with LibreOffice 4.2, image looses its cropping effect. Implementation:- 1] Function WriteSrcRect() is implemented inside docxattributeoutput.cxx 2] It writes out xml tag <a:srcRect> which is responsible for storing cropping parameters Change-Id: I8814df40f9907512779b42c9ad2405953c70626b Reviewed-on: https://gerrit.libreoffice.org/6507 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 01738692dfe4..2760f15826ca 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2707,13 +2707,20 @@ void DocxAttributeOutput::WriteSrcRect(const SdrObject* pSdrObj )
if ( (0 != aGraphicCropStruct.Left) || (0 != aGraphicCropStruct.Top) || (0 != aGraphicCropStruct.Right) || (0 != aGraphicCropStruct.Bottom) )
{
- m_pSerializer->singleElementNS( XML_a, XML_srcRect,
- XML_l, I32S(((aGraphicCropStruct.Left) * 100000)/aOriginalSize.Width()),
- XML_t, I32S(((aGraphicCropStruct.Top) * 100000)/aOriginalSize.Height()),
- XML_r, I32S(((aGraphicCropStruct.Right) * 100000)/aOriginalSize.Width()),
- XML_b, I32S(((aGraphicCropStruct.Bottom) * 100000)/aOriginalSize.Height()),
- FSEND );
-
+ double widthMultiplier = 100000.0/aOriginalSize.Width();
+ double heightMultiplier = 100000.0/aOriginalSize.Height();
+
+ double left = aGraphicCropStruct.Left * widthMultiplier;
+ double right = aGraphicCropStruct.Right * widthMultiplier;
+ double top = aGraphicCropStruct.Top * heightMultiplier;
+ double bottom = aGraphicCropStruct.Bottom * heightMultiplier;
+
+ m_pSerializer->singleElementNS( XML_a, XML_srcRect,
+ XML_l, I32S(left),
+ XML_t, I32S(top),
+ XML_r, I32S(right),
+ XML_b, I32S(bottom),
+ FSEND );
}
}