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

New commits:
commit b38629ae210b204a6d24d6e9c5c62eaaf563d494
Author: Miklos Vajna <vmik...@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.
    
    Change-Id: Idcb669ba624bf462a50a85eb4aacf397afb6efe6

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 7579229..88df7ad 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1358,9 +1358,8 @@ DECLARE_RTFIMPORT_TEST(testCp1000018, "cp1000018.rtf")
     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());
 }
 
 #endif
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 306ef9c..742ef98 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3888,6 +3888,11 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
         m_pImpl->m_bHasFtnSep = true;
         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 5973c52..048e691 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -177,6 +177,7 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_nTableDepth(0),
         m_bHasFtnSep(false),
         m_bIgnoreNextPara(false),
+        m_bIgnoreNextTab(false),
         m_bFrameBtLr(false)
 
 {
@@ -1531,6 +1532,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 130ee1a..1ebf067 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -725,6 +725,8 @@ public:
 
     /// If the next newline should be ignored, used by the special footnote 
separator paragraph.
     bool m_bIgnoreNextPara;
+    /// If the next tab should be ignored, used for footnotes.
+    bool m_bIgnoreNextTab;
     bool m_bFrameBtLr; ///< Bottom to top, left to right text frame direction 
is requested for the current text frame.
     /// Pending floating tables: they may be converted to text frames at the 
section end.
     std::vector<FloatingTableInfo> m_aPendingFloatingTables;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to