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

Vasily Melenchuk vasily.melenchuk at cib.de
Sun Mar 8 06:11:01 PDT 2015


 sw/qa/extras/rtfimport/data/fdo49893-2.rtf     |    5 +++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |    8 ++++++++
 writerfilter/source/rtftok/rtfcontrolwords.cxx |    2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    6 +++---
 4 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 0ae97c39134a73feeea718e81669fd42e5ceb627
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
Date:   Wed Mar 4 17:06:43 2015 +0300

    tdf#49893: fix for missing header on page 2
    
    Header on second page was missing because document was parsed as document with facing page.
    Original document contains \facingp0 token toggling facing page off. However LibreOffice treats
    it as a boolean switch. This absolutely conform RTF specification (1.9.1), but differs from actual
    behavior of MS Word: actually this RTF token behaves like \b token (\b or \b1 are enabling bold text,
    \b0 - disabling).
    
    Change-Id: Iea2b52cde311ab1b02938461ba0945191339c783
    Reviewed-on: https://gerrit.libreoffice.org/14743
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/rtfimport/data/fdo49893-2.rtf b/sw/qa/extras/rtfimport/data/fdo49893-2.rtf
new file mode 100755
index 0000000..ac05451
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo49893-2.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+\facingp0
+{\header HEADER\par}
+\page \page \page \page
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 90ef8d3..7e7c96d 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2265,6 +2265,14 @@ DECLARE_RTFIMPORT_TEST(testFdo49893, "fdo49893.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(1296)), xShape->getSize().Width);
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo49893_2, "fdo49893-2.rtf")
+{
+    // Ensure that header text exists on each page (especially on secnd page)
+    CPPUNIT_ASSERT_EQUAL(OUString("HEADER"),  parseDump("/root/page[1]/header/txt/text()"));
+    CPPUNIT_ASSERT_EQUAL(OUString("HEADER"),  parseDump("/root/page[2]/header/txt/text()"));
+    CPPUNIT_ASSERT_EQUAL(OUString("HEADER"),  parseDump("/root/page[3]/header/txt/text()"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfcontrolwords.cxx b/writerfilter/source/rtftok/rtfcontrolwords.cxx
index 4f69ece..044116c 100644
--- a/writerfilter/source/rtftok/rtfcontrolwords.cxx
+++ b/writerfilter/source/rtftok/rtfcontrolwords.cxx
@@ -506,7 +506,7 @@ RTFSymbol aRTFControlWords[] =
     {"f", CONTROL_VALUE, RTF_F},
     {"faauto", CONTROL_FLAG, RTF_FAAUTO},
     {"facenter", CONTROL_FLAG, RTF_FACENTER},
-    {"facingp", CONTROL_FLAG, RTF_FACINGP},
+    {"facingp", CONTROL_TOGGLE, RTF_FACINGP},
     {"factoidname", CONTROL_DESTINATION, RTF_FACTOIDNAME},
     {"fafixed", CONTROL_FLAG, RTF_FAFIXED},
     {"fahang", CONTROL_FLAG, RTF_FAHANG},
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d6adeae..c225dc4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3457,9 +3457,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, pValue);
     }
     break;
-    case RTF_FACINGP:
-        m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, std::make_shared<RTFValue>(1));
-        break;
     case RTF_SHPBXPAGE:
         m_aStates.top().aShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
         m_aStates.top().aShape.nHoriOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page;
@@ -4879,6 +4876,9 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n
     case RTF_SAAUTO:
         lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_afterAutospacing, pBoolValue, RTFOverwrite::YES);
         break;
+    case RTF_FACINGP:
+        m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, pBoolValue);
+        break;
     default:
     {
         SAL_INFO("writerfilter", "TODO handle toggle '" << lcl_RtfToString(nKeyword) << "'");


More information about the Libreoffice-commits mailing list