sw/qa/extras/ooxmlexport/data/tdf142407.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 8 ++++++++ writerfilter/source/dmapper/PropertyMap.cxx | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-)
New commits: commit 5f84c44e3d5ff19b800b6358e61228546e318d4f Author: Mark Hung <mark...@gmail.com> AuthorDate: Thu Oct 7 23:54:51 2021 +0800 Commit: Mark Hung <mark...@gmail.com> CommitDate: Mon Oct 11 14:16:16 2021 +0200 tdf#142407 fix incorrect number of lines in vertical writing. Wrting mode isn't read correctly. The property PROP_WRITING_MODE contans an Any of sal_Int16. When converting to WritingMode enum directly, it always get WrtingMode::LR_TB(0), hence use wrong side to calculate number of grid lines for vertical writing. The resulted number of grid lines are much smaller than expected, it ends up leaving large space between header and text. Change-Id: Ifb0ff09fe981819cc2705de8d5596190f320f79e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123223 Tested-by: Jenkins Reviewed-by: Mark Hung <mark...@gmail.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf142407.docx b/sw/qa/extras/ooxmlexport/data/tdf142407.docx new file mode 100644 index 000000000000..38397a4de996 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf142407.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 523d4a6e747d..77645a84aefb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -106,6 +106,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123642_BookmarkAtDocEnd, "tdf123642.docx") CPPUNIT_ASSERT_EQUAL(OUString("Bookmark1"), getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:bookmarkStart[1]", "name")); } +DECLARE_OOXMLEXPORT_TEST(testTdf142407, "tdf142407.docx") +{ + uno::Reference<container::XNameAccess> xPageStyles = getStyles("PageStyles"); + uno::Reference<beans::XPropertySet> xPageStyle(xPageStyles->getByName("Standard"), uno::UNO_QUERY); + sal_Int16 nGridLines; + xPageStyle->getPropertyValue("GridLines") >>= nGridLines; + CPPUNIT_ASSERT_EQUAL( sal_Int16(36), nGridLines); // was 23, left large space before text. +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 3fdecb9ed576..920874afa39d 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1710,12 +1710,12 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) if ( pProp ) pProp->second >>= nWidth; - text::WritingMode eWritingMode = text::WritingMode_LR_TB; + sal_Int16 nWritingMode = text::WritingMode2::LR_TB; pProp = getProperty( PROP_WRITING_MODE ); if ( pProp ) - pProp->second >>= eWritingMode; + pProp->second >>= nWritingMode; - sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ? + sal_Int32 nTextAreaHeight = nWritingMode == text::WritingMode2::LR_TB ? nHeight - m_nTopMargin - m_nBottomMargin : nWidth - m_nLeftMargin - m_nRightMargin;