summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-06-01 16:41:26 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-06-01 19:06:27 +0200
commitc4015f23024880fbfd988bb1c5749360ededc57b (patch)
treebfa6c0cb2940b9ceb628ee3ab49b23c37982deec /writerfilter
parent587a21002699c0dd7f7a8a40b485acfb6b63fc97 (diff)
DOCX import: fix relativeFrom=page, align=right handling again
sw/qa/extras/ooxmlexport/data/wpg-nested.docx has a right sidebar on the page, which is a nested drawingML group shape. This was fixed to have a reasonable position in commit 51a61bd4aca15c860d301b687d582a39193089e2 (DOCX import: fix relativeFrom=page, align=right handling, 2013-12-06) but the testcase only asserted the document model, so it wasn't caught that later commit af313fc149f80adb0f1680ca20e19745ccb7fede (tdf#105143 DOCX import: enable DoNotCaptureDrawObjsOnPage layout compat option, 2017-01-06) broke it. Fix it again by reverting the original fix and focusing only the part that is still a problem: the margins around the shape prevent it to be exactly at the right edge (instead there is some spacing). The margins are not relevant in the "no wrap: in front of text" and "no wrap: behind text" cases, the Word UI even disables the controls in those wrap cases. Improve the relevant testcase to assert the layout instead, so next time this breaks, we'll more likely notice it. For each modified existing testcase, I compared the old Writer, new Writer and Word rendering result and came to the conclusion that it's the test that should be changed, not the code. Change-Id: Ida29929671148db77fdd9ce8dbfb5214bb4728dd Reviewed-on: https://gerrit.libreoffice.org/55192 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 45621b9c1686..57390765f134 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1036,15 +1036,6 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
m_pImpl->nHoriRelation = pHandler->relation();
m_pImpl->nHoriOrient = pHandler->orientation();
m_pImpl->nLeftPosition = pHandler->position();
- if (m_pImpl->nHoriRelation == text::RelOrientation::PAGE_FRAME && m_pImpl->nHoriOrient == text::HoriOrientation::RIGHT)
- {
- // If the shape is relative from page and aligned to
- // right, then set the relation to right and clear the
- // orientation, that provides the same visual result as
- // Word.
- m_pImpl->nHoriRelation = text::RelOrientation::PAGE_RIGHT;
- m_pImpl->nHoriOrient = text::HoriOrientation::NONE;
- }
}
}
}
@@ -1090,6 +1081,13 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_EG_WrapType_wrapNone: // 90944; - doesn't contain attributes
//depending on the behindDoc attribute text wraps through behind or in front of the object
m_pImpl->nWrap = text::WrapTextMode_THROUGH;
+
+ // Wrap though means the margins defined earlier should not be
+ // respected.
+ m_pImpl->nLeftMargin = 0;
+ m_pImpl->nTopMargin = 0;
+ m_pImpl->nRightMargin = 0;
+ m_pImpl->nBottomMargin = 0;
break;
case NS_ooxml::LN_EG_WrapType_wrapTopAndBottom: // 90948;
m_pImpl->nWrap = text::WrapTextMode_NONE;