summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/rtfimport/data/fdo84685.rtf2
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx8
-rw-r--r--writerfilter/source/rtftok/rtfcontrolwords.hxx1
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx10
4 files changed, 20 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo84685.rtf b/sw/qa/extras/rtfimport/data/fdo84685.rtf
index 431dbd3fea22..af73b1a57bf0 100644
--- a/sw/qa/extras/rtfimport/data/fdo84685.rtf
+++ b/sw/qa/extras/rtfimport/data/fdo84685.rtf
@@ -2,4 +2,6 @@
\pard
{\v {\xe {\v {\f0\fs20 Key the 1st}}}} Some text
\par
+{\v {\tc {\v {\f0\fs20 foo}}}} Some text
+\par
}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index e80f727aa0fe..0e651d003829 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2093,6 +2093,14 @@ DECLARE_RTFIMPORT_TEST(testFdo84685, "fdo84685.rtf")
"DocumentIndexMark"));
CPPUNIT_ASSERT(xMark.is());
CPPUNIT_ASSERT_EQUAL(OUString("Key the 1st"), getProperty<OUString>(xMark, "PrimaryKey"));
+ // let's test toc entry too
+ uno::Reference<text::XDocumentIndexMark> xTOCMark(
+ getProperty<uno::Reference<text::XDocumentIndexMark>>(
+ getRun(getParagraph(2), 1),
+ "DocumentIndexMark"));
+ CPPUNIT_ASSERT(xTOCMark.is());
+ uno::Reference<lang::XServiceInfo> xTOCSI(xTOCMark, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xTOCSI->supportsService("com.sun.star.text.ContentIndexMark"));
}
DECLARE_RTFIMPORT_TEST(testFdo83204, "fdo83204.rtf")
diff --git a/writerfilter/source/rtftok/rtfcontrolwords.hxx b/writerfilter/source/rtftok/rtfcontrolwords.hxx
index ac45593ac7ef..f2f8ad51a81c 100644
--- a/writerfilter/source/rtftok/rtfcontrolwords.hxx
+++ b/writerfilter/source/rtftok/rtfcontrolwords.hxx
@@ -150,6 +150,7 @@ enum RTFDestinationState
DESTINATION_SHAPEGROUP,
DESTINATION_FOOTNOTESEPARATOR,
DESTINATION_INDEXENTRY,
+ DESTINATION_TOCENTRY,
};
enum RTFKeyword
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3d7922a43cc7..6df07cead004 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1260,6 +1260,7 @@ void RTFDocumentImpl::text(OUString& rString)
case DESTINATION_MTYPE:
case DESTINATION_MGROW:
case DESTINATION_INDEXENTRY:
+ case DESTINATION_TOCENTRY:
m_aStates.top().pDestinationText->append(rString);
break;
default:
@@ -1733,6 +1734,10 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
case RTF_XE:
m_aStates.top().nDestinationState = DESTINATION_INDEXENTRY;
break;
+ case RTF_TC:
+ case RTF_TCN:
+ m_aStates.top().nDestinationState = DESTINATION_TOCENTRY;
+ break;
case RTF_REVTBL:
m_aStates.top().nDestinationState = DESTINATION_REVISIONTABLE;
break;
@@ -5191,12 +5196,15 @@ int RTFDocumentImpl::popState()
}
break;
case DESTINATION_INDEXENTRY:
+ case DESTINATION_TOCENTRY:
{
if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
break; // not for nested group
OUString str(m_aStates.top().pDestinationText->makeStringAndClear());
// dmapper expects this as a field, so let's fake something...
- str = "XE \"" + str.replaceAll("\"", "\\\"") + "\"";
+ OUString const field(
+ (DESTINATION_INDEXENTRY == aState.nDestinationState) ? "XE" : "TC");
+ str = field + " \"" + str.replaceAll("\"", "\\\"") + "\"";
singleChar(0x13);
Mapper().utext(reinterpret_cast<sal_uInt8 const*>(str.getStr()), str.getLength());
singleChar(0x14);