summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/GraphicImport.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-05-06 21:33:59 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-05-07 09:47:37 +0200
commit65420c21194a28aeead0238838028b734b663d87 (patch)
tree60764cbb3fe69d6082dd2d8f2c2682dbfcee7bdb /writerfilter/source/dmapper/GraphicImport.cxx
parent780d0945fb917ead9b98debe57210092cdc59351 (diff)
tdf#124594 DOCX filter: don't extend margins from effects for rotated shapes
Regression from commit a5a836d8c43dc9cebbbf8af39bf0142de603a7c6 (DOCX filter: effect extent should be part of the margin, 2014-12-04), the problem was that extending margins as-is based on the effect extent values only work correctly in case of non-rotated shapes. For example, with 90 degree clockwise rotation the top effect extent should extend the right margin, etc. Fix the bug by limiting this extension to the non-rotated scenario. Test the behavior at a layout level, so in case later the effect extent feature is implemented, it won't be necessary to adjust the test. Change-Id: I97271bbb7c079951980b436cb8d8e5e54eeead55 Reviewed-on: https://gerrit.libreoffice.org/71878 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/dmapper/GraphicImport.cxx')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx32
1 files changed, 28 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 6c04c10dacbb..d9458ba468c2 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -532,19 +532,15 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
break;
case NS_ooxml::LN_CT_EffectExtent_l:
m_pImpl->m_oEffectExtentLeft = nIntValue;
- m_pImpl->nLeftMargin += oox::drawingml::convertEmuToHmm(nIntValue);
break;
case NS_ooxml::LN_CT_EffectExtent_t:
m_pImpl->m_oEffectExtentTop = nIntValue;
- m_pImpl->nTopMargin += oox::drawingml::convertEmuToHmm(nIntValue);
break;
case NS_ooxml::LN_CT_EffectExtent_r:
m_pImpl->m_oEffectExtentRight = nIntValue;
- m_pImpl->nRightMargin += oox::drawingml::convertEmuToHmm(nIntValue);
break;
case NS_ooxml::LN_CT_EffectExtent_b:
m_pImpl->m_oEffectExtentBottom = nIntValue;
- m_pImpl->nBottomMargin += oox::drawingml::convertEmuToHmm(nIntValue);
break;
case NS_ooxml::LN_CT_NonVisualDrawingProps_id:// 90650;
//id of the object - ignored
@@ -770,7 +766,35 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
}
m_xShape->setSize(aSize);
if (bKeepRotation)
+ {
xShapeProps->setPropertyValue("RotateAngle", uno::makeAny(nRotation));
+ if (nRotation == 0)
+ {
+ // Include effect extent in the margin to bring Writer layout closer
+ // to Word. But do this for non-rotated shapes only, where effect
+ // extents map to increased margins as-is.
+ if (m_pImpl->m_oEffectExtentLeft)
+ {
+ m_pImpl->nLeftMargin += oox::drawingml::convertEmuToHmm(
+ *m_pImpl->m_oEffectExtentLeft);
+ }
+ if (m_pImpl->m_oEffectExtentTop)
+ {
+ m_pImpl->nTopMargin += oox::drawingml::convertEmuToHmm(
+ *m_pImpl->m_oEffectExtentTop);
+ }
+ if (m_pImpl->m_oEffectExtentRight)
+ {
+ m_pImpl->nRightMargin += oox::drawingml::convertEmuToHmm(
+ *m_pImpl->m_oEffectExtentRight);
+ }
+ if (m_pImpl->m_oEffectExtentBottom)
+ {
+ m_pImpl->nBottomMargin += oox::drawingml::convertEmuToHmm(
+ *m_pImpl->m_oEffectExtentBottom);
+ }
+ }
+ }
m_pImpl->bIsGraphic = true;