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 829a001ffe89dd9c9dcda08fcc61bb4711b447df
Author:     Mark Hung <mark...@gmail.com>
AuthorDate: Thu Oct 7 23:54:51 2021 +0800
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Oct 12 15:20:44 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>
    (cherry picked from commit 5f84c44e3d5ff19b800b6358e61228546e318d4f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123396
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

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 6884ea3ebc03..5a331a5f505d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -62,6 +62,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 b4c58c0d8808..3b8f36d602a0 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1709,12 +1709,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;
 

Reply via email to