summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfdocumentimpl.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-12-16 23:17:28 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-18 15:46:57 +0000
commitd90c5fbf67dc76c18cf703267139e7ad6b26564b (patch)
tree49233340faf9a864f27cd87dcc1454f4d835428c /writerfilter/source/rtftok/rtfdocumentimpl.cxx
parent99b3e159726b51537563790e8f73b43a88970e13 (diff)
fdo#84685: writerfilter: RTF import: support \xe index entry
(cherry picked from commit f14e6e06b9e3c82c267649d63512a3538e5ee2f5) (related fdo#84685): writerfilter: RTF import: support \tc TOC entry (cherry picked from commit 1dd1dfc152c7cbeb374fe4f38b08c6af9cef2c06) fix Windows build (cherry picked from commit acfd640fd8547d3275c5db714b88d52b3fe7c4d5) Change-Id: Ia957541a5997961aa86b2eb8537ebd29d3092691 Reviewed-on: https://gerrit.libreoffice.org/13508 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter/source/rtftok/rtfdocumentimpl.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b61f5a764074..447493cfeacf 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1248,6 +1248,8 @@ void RTFDocumentImpl::text(OUString& rString)
case DESTINATION_MSUPHIDE:
case DESTINATION_MTYPE:
case DESTINATION_MGROW:
+ case DESTINATION_INDEXENTRY:
+ case DESTINATION_TOCENTRY:
m_aStates.top().pDestinationText->append(rString);
break;
default:
@@ -1716,6 +1718,13 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
case RTF_BKMKEND:
m_aStates.top().nDestinationState = DESTINATION_BOOKMARKEND;
break;
+ 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;
@@ -5047,6 +5056,23 @@ int RTFDocumentImpl::popState()
break; // not for nested group
Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aStates.top().pDestinationText->makeStringAndClear()]));
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...
+ OUString const field = OUString::createFromAscii(
+ (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);
+ // no result
+ singleChar(0x15);
+ }
+ break;
case DESTINATION_FORMFIELDNAME:
{
if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)