summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-09-20 19:56:37 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-09-21 08:18:40 +0200
commit7246e57216bb20c15af0ecf6a0183f5ffa81e780 (patch)
treeb69ab1799e3cf7188de2da89b895d907a726c3be /sw
parentf5a81a119cb63152c2c2e2473a1ea183a30c8db9 (diff)
tdf#143591 DOCX import: handle anchored objects as at-char
This partially reverts cc8f8ae55f681755f5da3bf64e4c30bb713f0383 (DOCX drawingML shape import: wp:anchor's behindDoc attribute, 2013-11-19), it seems to be more important to be consistent with the DOC import than with the VML import which is no longer used for DOCX shapes crated with Word >= 2010. Change-Id: I631da010bce1b4d3c392645e0ae3797a03665a42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122367 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport10.cxx3
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx12
2 files changed, 7 insertions, 8 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index ce706929cf04..4afa90c3351e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -147,7 +147,8 @@ DECLARE_OOXMLEXPORT_TEST(testWpsOnly, "wps-only.docx")
// Document has wp:anchor, not wp:inline, so handle it accordingly.
uno::Reference<drawing::XShape> xShape = getShape(1);
text::TextContentAnchorType eValue = getProperty<text::TextContentAnchorType>(xShape, "AnchorType");
- CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_PARAGRAPH, eValue);
+ // Word only as as-char and at-char, so at-char is our only choice.
+ CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eValue);
// Check position, it was 0. This is a shape, so use getPosition(), not a property.
CPPUNIT_ASSERT_EQUAL(oox::drawingml::convertEmuToHmm(671830), xShape->getPosition().X);
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 1890f2819d37..1b6b03225d4c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -563,15 +563,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTextCopy)
uno::Reference<beans::XPropertySet> xPageStyle(
getStyles("PageStyles")->getByName(aPageStyleName), uno::UNO_QUERY);
auto xHeaderText = getProperty<uno::Reference<text::XText>>(xPageStyle, "HeaderText");
- uno::Reference<container::XContentEnumerationAccess> xHeaderPara(
- getParagraphOfText(1, xHeaderText), uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xHeaderShapes
- = xHeaderPara->createContentEnumeration("com.sun.star.text.TextContent");
+ uno::Reference<text::XTextRange> xHeaderPara = getParagraphOfText(1, xHeaderText);
+ auto aTextPortionType = getProperty<OUString>(getRun(xHeaderPara, 1), "TextPortionType");
// Without the accompanying fix in place, this test would have failed with:
- // assertion failed
- // - Expression: xHeaderShapes->hasMoreElements()
+ // - Expected: Frame
+ // - Actual : Text
// i.e. the second page's header had no anchored shapes.
- CPPUNIT_ASSERT(xHeaderShapes->hasMoreElements());
+ CPPUNIT_ASSERT_EQUAL(OUString("Frame"), aTextPortionType);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf112443)