[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Dec 5 02:57:03 PST 2013
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 bf53bea48d5184455841a8d8963eea35293c0b8e
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.
Change-Id: Idcb669ba624bf462a50a85eb4aacf397afb6efe6
(cherry picked from commit b38629ae210b204a6d24d6e9c5c62eaaf563d494)
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 78fafea..4ea280c 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1360,9 +1360,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 ae81ad5..06ea11c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3859,6 +3859,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 3181c9f..6b9562b 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;
More information about the Libreoffice-commits
mailing list