[Libreoffice-commits] core.git: 2 commits - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Mar 30 07:05:45 UTC 2016


 sw/qa/extras/rtfexport/data/pgnlcltr.rtf       |   23 +++++++++++++++++++++++
 sw/qa/extras/rtfexport/data/tdf65642.rtf       |   23 +++++++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport.cxx           |   14 ++++++++++++++
 sw/qa/extras/rtfimport/data/tdf65642.rtf       |   23 -----------------------
 sw/qa/extras/rtfimport/rtfimport.cxx           |    8 --------
 writerfilter/source/dmapper/DomainMapper.cxx   |    4 ++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    7 ++++++-
 7 files changed, 70 insertions(+), 32 deletions(-)

New commits:
commit 43a17602fb894c10931581b20deec4a47889f310
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 30 09:05:04 2016 +0200

    Related: tdf#65642 RTF filter: import \pgnlcltr
    
    This as a side effect also implements support for DOCX <w:pgNumType
    w:fmt="lowerLetter" .../>.
    
    Change-Id: I47b60a0390ef081dc15b26e40393e35bf7bad130

diff --git a/sw/qa/extras/rtfexport/data/pgnlcltr.rtf b/sw/qa/extras/rtfexport/data/pgnlcltr.rtf
new file mode 100644
index 0000000..6bc3035
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/pgnlcltr.rtf
@@ -0,0 +1,23 @@
+{\rtf1
+\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0
+{\field\fldedit
+{\*\fldinst
+{ PAGE   \\* MERGEFORMAT }
+}
+{\fldrslt
+{1}
+}
+}
+\sect
+\sectd\pgnrestart\pgnlcltr
+{\field\fldedit
+{\*\fldinst
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid525329  PAGE   \\* MERGEFORMAT }
+}
+{\fldrslt
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid9597790 A}
+}
+}
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid13321744
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 8a544ce..da0712a 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1007,6 +1007,12 @@ DECLARE_RTFEXPORT_TEST(testTdf65642, "tdf65642.rtf")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty<sal_Int32>(getParagraph(2), "PageNumberOffset"));
 }
 
+DECLARE_RTFEXPORT_TEST(testPgnlcltr, "pgnlcltr.rtf")
+{
+    // The second page's numbering type: this was style::NumberingType::ARABIC.
+    CPPUNIT_ASSERT_EQUAL(style::NumberingType::CHARS_LOWER_LETTER_N, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 137f5b8..9863c59 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -993,6 +993,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                     // A, B, ...
                     pSectionContext->SetPageNumberType(style::NumberingType::CHARS_UPPER_LETTER_N);
                 break;
+                case NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter:
+                    // a, b, ...
+                    pSectionContext->SetPageNumberType(style::NumberingType::CHARS_LOWER_LETTER_N);
+                break;
                 }
             }
         break;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 46fbdf4..d0631c5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3280,7 +3280,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
     case RTF_PGNDEC:
     case RTF_PGNUCRM:
     case RTF_PGNLCRM:
-    case RTF_PGNLCLTR:
     case RTF_PGNBIDIA:
     case RTF_PGNBIDIB:
         // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
@@ -3604,6 +3603,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue);
     }
     break;
+    case RTF_PGNLCLTR:
+    {
+        auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter);
+        lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue);
+    }
+    break;
     default:
     {
         SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'");
commit 1250ad9561e8f7d3227bb97b9e1f7b2968b5c900
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 30 09:04:57 2016 +0200

    Related: tdf#65642 RTF export: \pgnucltr testcase
    
    There is no reason this unit test is import-only, this area of the
    export filter was untested so far.
    
    Change-Id: Ia271bccf59c1b21474e7b854cbaa0992b722e552

diff --git a/sw/qa/extras/rtfimport/data/tdf65642.rtf b/sw/qa/extras/rtfexport/data/tdf65642.rtf
similarity index 100%
rename from sw/qa/extras/rtfimport/data/tdf65642.rtf
rename to sw/qa/extras/rtfexport/data/tdf65642.rtf
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 24faee2..8a544ce 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -999,6 +999,14 @@ DECLARE_RTFEXPORT_TEST(testCustomDocProps, "custom-doc-props.rtf")
     CPPUNIT_ASSERT_EQUAL(OUString("None"), getProperty<OUString>(xUserDefinedProperties, "urn:bails:IntellectualProperty:Authorization:StopValidity"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf65642, "tdf65642.rtf")
+{
+    // The second page's numbering type: this was style::NumberingType::ARABIC.
+    CPPUNIT_ASSERT_EQUAL(style::NumberingType::CHARS_UPPER_LETTER_N, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType"));
+    // The second page's restart value: this was 0.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty<sal_Int32>(getParagraph(2), "PageNumberOffset"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index cd0eb55..a8c8f79 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2554,14 +2554,6 @@ DECLARE_RTFIMPORT_TEST(testClassificatonPasteLevels, "classification-confidentia
     CPPUNIT_ASSERT_EQUAL(aOld, xText->getString());
 }
 
-DECLARE_RTFIMPORT_TEST(testTdf65642, "tdf65642.rtf")
-{
-    // The second page's numbering type: this was style::NumberingType::ARABIC.
-    CPPUNIT_ASSERT_EQUAL(style::NumberingType::CHARS_UPPER_LETTER_N, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType"));
-    // The second page's restart value: this was 0.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty<sal_Int32>(getParagraph(2), "PageNumberOffset"));
-}
-
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list