Kaydet (Commit) b38629ae authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 215f87fb
......@@ -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
......
......@@ -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
{
......
......@@ -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 )
{
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment