summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper_Impl.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-10-03 13:44:15 -0400
committerJustin Luth <jluth@mail.com>2023-10-04 16:36:14 +0200
commit4dd491bc50801d10bb2f1004fff6ebcdb5da9f59 (patch)
treedafc7228022cb7c9a7b789a2bcc6a70e736ae6f5 /writerfilter/source/dmapper/DomainMapper_Impl.cxx
parent0d21e1075f0288a007cb427ce508d6fbbf8503dd (diff)
tdf#157572 tdf#112287 tdf#154129 writerfilter framePr: fix vAnchor default
Fixes LO 7.6 regression commit 630732bfd8ed531e9d412a36a083f33763def054 See bug 157572 for the documentation. To test this, I used ooxmlexport5's tdf112287B.docx with Word 2010: -changed vertical relative to Paragraph - exported w:vAnchor="text" -changed vertical relative to Page - exported w:vAnchor="page" -changed vertical relative to Margin - did not export w:vAnchor So, obviously the default is "margin" Note that it always exports w:y=1 For importing, the default vAnchor changed depending on whether w:y=0 (text) or w:y=1 (margin) * an exception is when w:y=0 and vAlign is defined - then 'margin' make CppunitTest_sw_ooxmlexport5 \ CPPUNIT_TEST_NAME=testTdf157572_defaultVAnchor Change-Id: I126094eafc43a83e3a4efdd1ebc8d9cab9d49759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157527 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 13836906c53e..9c1b32a54927 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1873,13 +1873,15 @@ DomainMapper_Impl::MakeFrameProperties(const ParagraphProperties& rProps)
aFrameProperties.push_back(
comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), nVertOrient));
- //Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11
- sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text'
- // vAlign is ignored if vAnchor is set to 'text'. So, if w:y is not defined,
- // but there is a defined vAlign, then a missing vAnchor should become 'margin'.
- if (!bValidY && nVertOrient)
- {
- nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin'
+ // Default the anchor in case FramePr_vAnchor is missing.
+ // ECMA 17.3.1.11 says "page",
+ // but errata documentation MS-OE376 2.1.48 Section 2.3.1.11 says "text"
+ // while actual testing usually indicates "margin" tdf#157572 tdf#112287
+ sal_Int16 nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin'
+ if (!nY && (bValidY || nVertOrient == text::VertOrientation::NONE))
+ {
+ // special cases? "auto" position defaults to "paragraph" based on testing when w:y=0
+ nVAnchor = text::RelOrientation::FRAME; // 'text'
}
for (const auto pProp : vProps)
{