summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-09-17 11:30:26 +0200
committerAndras Timar <andras.timar@collabora.com>2019-10-04 15:41:39 +0200
commit57dde667d9256192a83944a3dbc1fc83bc1e3a31 (patch)
tree03312a9f2b6ed3cf9e24cafd7f31ec190a9405eb /writerfilter
parent7f5a7ece456bb78a84948d5ceb97cb84b86949c2 (diff)
Related: tdf#124600 DOCX import: ignore left wrap on left-aligned shapes
The DOC import does the same in SwWW8ImplReader::AdjustLRWrapForWordMargins(). This fixes one sub-problem of the bugdoc, so now the shape anchored in the header has a correct position. This made it necessary to re-visit the tdf#115719 testcases, which are minimal reproducers. The original document had from-left alignment (instead of align-to-left), but this did not matter before. Bring the test documents closer to the original large document, so the tests still pass and don't depend on LO mis-handling the above mentioned left-aligned situation. (The interesting property of tdf115719.docx, where Word 2010 and Word 2013 handles the document differently is preserved after this change.) (cherry picked from commit 4883da6fd25e4645a3b30cb58212a2f666dae75a) Change-Id: I973c13df47b0867e2c4756f0c448495257b7c9d5 Reviewed-on: https://gerrit.libreoffice.org/80041 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 1d5bcbf97e74..97cc3c78fe92 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -970,7 +970,6 @@ void GraphicImport::ProcessShapeOptions(Value const & rValue)
switch( m_pImpl->nShapeOptionType )
{
case NS_ooxml::LN_CT_Anchor_distL:
- //todo: changes have to be applied depending on the orientation, see SwWW8ImplReader::AdjustLRWrapForWordMargins()
m_pImpl->nLeftMargin = nIntValue / 360;
break;
case NS_ooxml::LN_CT_Anchor_distT:
@@ -1065,6 +1064,16 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
m_pImpl->nHoriRelation = pHandler->relation();
m_pImpl->nHoriOrient = pHandler->orientation();
m_pImpl->nLeftPosition = pHandler->position();
+
+ // Left adjustments: if horizontally aligned to left of margin, then remove the
+ // left wrapping.
+ if (m_pImpl->nHoriOrient == text::HoriOrientation::LEFT)
+ {
+ if (m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA)
+ {
+ m_pImpl->nLeftMargin = 0;
+ }
+ }
}
}
}