diff options
author | Mark Hung <marklh9@gmail.com> | 2021-10-07 23:54:51 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2021-10-11 14:16:16 +0200 |
commit | 5f84c44e3d5ff19b800b6358e61228546e318d4f (patch) | |
tree | 1abc55c6e420f27cc22bb920a8eaff274353dd60 | |
parent | 8ac8a20ed15bb458e1ee5a8df2b97aef05ca4f7c (diff) |
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 <marklh9@gmail.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf142407.docx | bin | 0 -> 13527 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf142407.docx b/sw/qa/extras/ooxmlexport/data/tdf142407.docx Binary files differnew file mode 100644 index 000000000000..38397a4de996 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf142407.docx 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; |