diff options
author | Justin Luth <justin.luth@collabora.com> | 2024-03-05 19:43:51 -0500 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-03-06 11:27:04 +0100 |
commit | 3aeaee800f675a5f733e06bb4ea73909570f9004 (patch) | |
tree | 9fbd9f3f438d12ca9f2c50164d15a5a0ad4fb0fb /sw | |
parent | eacf8dc7ab850f2d00bd4b327f830c55cf2a0d92 (diff) |
tdf#160049 doc import: use margins with left/right HoriOrientRelation
No interesting existing unit tests.
make CppunitTest_sw_ww8export4 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMargin
Change-Id: Ib855d9f35db9e0f47aff18400b69a990cd1ad5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164444
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc | bin | 0 -> 88064 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export4.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 6 |
3 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc Binary files differnew file mode 100644 index 000000000000..d1082515fd9c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index ea50ed2a19b9..7ab6f76ec3a6 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -51,6 +51,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf77964) CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty<text::TextContentAnchorType>(getShapeByName(u"Image2"), "AnchorType")); } +DECLARE_WW8EXPORT_TEST(testTdf160049_anchorMargin, "tdf160049_anchorMargin.doc") +{ + // given a document with a LEFT "column/text" anchored image + + // The image takes into account the margin, so it looks like it is in the middle of the doc, + // which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph area"/FRAME/0 + CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, + getProperty<sal_Int16>(getShape(1), "HoriOrientRelation")); +} + DECLARE_WW8EXPORT_TEST(testTdf150197_anlv2ListFormat, "tdf150197_anlv2ListFormat.doc") { CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(getParagraph(2), "ListLabelString")); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index a7c9ec979e09..28b1211683d1 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2400,6 +2400,12 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS rFSPA.nXaLeft = 0; rFSPA.nXaRight = nWidth; } + else if ((eHoriOri == text::HoriOrientation::LEFT || eHoriOri == text::HoriOrientation::RIGHT) + && eHoriRel == text::RelOrientation::FRAME) + { + // relative left/right honors paragraph margins, but not with center or none/absolute offset + eHoriRel = text::RelOrientation::PRINT_AREA; + } // #i24255# - position of floating screen objects in // R2L layout are given in L2R layout, thus convert them of all |