summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-10-11 16:48:55 +0200
committerMichael Stahl <mstahl@redhat.com>2012-10-19 09:20:11 +0000
commit9a2f97b9539f8101745467758fe03d5e76c0346f (patch)
tree5d374b1c964a3a452f5c7030c2b3188d9c7d8593
parent07cc274256ebff259e228e7285bc27e6ddc94fdc (diff)
fdo#55493 fix RTF import of specific PNG image
The image was special in that the resulting Graphic's GetPrefMapMode().GetMapUnit() wasn't MAP_PIXEL. (cherry picked from commit 5ef0f1dc9a70c20fe6879832b782a0c34724353f) Conflicts: writerfilter/source/rtftok/rtfdocumentimpl.cxx Change-Id: I681e344a042721b99f6cb2e599f9c65156d219a4 Reviewed-on: https://gerrit.libreoffice.org/860 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 45e1920c9ea5..bf981d901b87 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -646,12 +646,18 @@ int RTFDocumentImpl::resolvePict(bool bInline)
// provided by picw and pich.
OString aURLBS(OUStringToOString(aGraphicUrl, RTL_TEXTENCODING_UTF8));
const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
- Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
- Size aSize(aGraphic.GetPrefSize());
- MapMode aMap(MAP_100TH_MM);
- aSize = Application::GetDefaultDevice()->PixelToLogic( aSize, aMap );
- m_aStates.top().aPicture.nWidth = aSize.Width();
- m_aStates.top().aPicture.nHeight = aSize.Height();
+ if (aURLBS.compareTo(aURLBegin, RTL_CONSTASCII_LENGTH(aURLBegin)) == 0)
+ {
+ Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
+ Size aSize(aGraphic.GetPrefSize());
+ MapMode aMap(MAP_100TH_MM);
+ if (aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL)
+ aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMap);
+ else
+ aSize = OutputDevice::LogicToLogic(aSize, aGraphic.GetPrefMapMode(), aMap);
+ m_aStates.top().aPicture.nWidth = aSize.Width();
+ m_aStates.top().aPicture.nHeight = aSize.Height();
+ }
}
// Wrap it in an XShape.