[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Dec 5 03:20:50 PST 2013


 sw/qa/extras/rtfimport/rtfimport.cxx              |    3 +--
 writerfilter/source/dmapper/DomainMapper.cxx      |    5 +++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    8 +++++++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    2 ++
 4 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 256c04feaadd789063a18f5cbd4f561bf5987d91
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Dec 5 11:33:56 2013 +0100

    cp#1000017 DOCX/RTF import: avoid fake tab char in footnotes
    
    Word wants this, so it's added by the exporter to the document, but on
    import we should ignore it.
    
    (cherry picked from commit b38629ae210b204a6d24d6e9c5c62eaaf563d494)
    
    Conflicts:
    	writerfilter/source/dmapper/DomainMapper.cxx
    	writerfilter/source/dmapper/DomainMapper_Impl.cxx
    	writerfilter/source/dmapper/DomainMapper_Impl.hxx
    
    Change-Id: Idcb669ba624bf462a50a85eb4aacf397afb6efe6

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index df2afe9..c971ed6 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1519,9 +1519,8 @@ void Test::testCp1000018()
     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
-    // Why the tab has to be removed here?
     OUString aExpected("Footnote first line.\n");
-    CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString().replaceAll("\t", ""));
+    CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 33c1ad1..dfbc4a7 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3681,6 +3681,11 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
         m_pImpl->m_pSdtHelper->createDateControl(sText);
         return;
     }
+    else if (len == 1 && sText[0] == '\t' && m_pImpl->m_bIgnoreNextTab)
+    {
+        m_pImpl->m_bIgnoreNextTab = false;
+        return;
+    }
 
     try
     {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e8a160b..429381d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -191,7 +191,8 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_bIsNewDoc(bIsNewDoc),
         m_bInTableStyleRunProps(false),
         m_pSdtHelper(0),
-        m_nTableDepth(0)
+        m_nTableDepth(0),
+        m_bIgnoreNextTab(false)
 
 {
     appendTableManager( );
@@ -1515,6 +1516,11 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote )
 
         // Redlines for the footnote anchor
         CheckRedline( xFootnote->getAnchor( ) );
+
+        // Word has a leading tab on footnotes, but we don't implement space
+        // between the footnote number and text using a tab, so just ignore
+        // that for now.
+        m_bIgnoreNextTab = true;
     }
     catch( const uno::Exception& e )
     {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 8bc422f..17d2b5a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -716,6 +716,8 @@ public:
      * PFInTable SPRM or not).
      */
     sal_Int32 m_nTableDepth;
+    /// If the next tab should be ignored, used for footnotes.
+    bool m_bIgnoreNextTab;
     /// Pending floating tables: they may be converted to text frames at the section end.
     std::vector<FloatingTableInfo> m_aPendingFloatingTables;
 };


More information about the Libreoffice-commits mailing list