summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf157572_defaultVAnchor.docxbin0 -> 12702 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx11
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx16
3 files changed, 20 insertions, 7 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf157572_defaultVAnchor.docx b/sw/qa/extras/ooxmlexport/data/tdf157572_defaultVAnchor.docx
new file mode 100644
index 000000000000..9f63950693f7
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf157572_defaultVAnchor.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index ceb6bdff9c06..71cea9fa2964 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1429,6 +1429,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112287)
assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","yAlign","bottom");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf157572_defaultVAnchor)
+{
+ loadAndSave("tdf157572_defaultVAnchor.docx");
+ xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
+
+ // vAnchor wasn't defined on import. It should default to 'margin' when w:y=non-zero
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","vAnchor","margin");
+ // yAlign=something is not compatible with w:y=non-zero" - don't write anything out
+ // assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "yAlign");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf112287B)
{
loadAndSave("tdf112287B.docx");
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)
{