sw/source/filter/ww8/docxattributeoutput.cxx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
New commits: commit ddaf39843ff8eac8e71a7d9a8bb74b34935cd399 Author: Pallavi Jadhav <pallavi.jad...@synerzip.com> Date: Thu Oct 31 15:27:00 2013 +0530 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 <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0173869..2760f15 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 ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits