[PATCH] fdo#49683 implement RTF_KEYWORDS

Miklos Vajna vmiklos at suse.cz
Wed May 9 05:30:55 PDT 2012


Use comphelper::string::convertCommaSeparated(), as done in
RtfExport::WriteInfo().

Change-Id: Iad4c3c57cf2e16c7256b9853cb1a6a0843463387
---
 writerfilter/Library_rtftok.mk                 |    1 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    7 +++++++
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/writerfilter/Library_rtftok.mk b/writerfilter/Library_rtftok.mk
index 1afdd27..c58b077 100644
--- a/writerfilter/Library_rtftok.mk
+++ b/writerfilter/Library_rtftok.mk
@@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_defs,rtftok,\
 ))
 
 $(eval $(call gb_Library_add_linked_libs,rtftok,\
+	comphelper \
 	cppu \
 	cppuhelper \
 	oox \
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1d45cb3..1250855 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -45,6 +45,7 @@
 #include <vcl/graph.hxx>
 #include <svtools/grfmgr.hxx>
 #include <vcl/svapp.hxx>
+#include <comphelper/string.hxx>
 
 #include <doctok/sprmids.hxx> // NS_sprm namespace
 #include <doctok/resourceids.hxx> // NS_rtf namespace
@@ -981,6 +982,7 @@ void RTFDocumentImpl::text(OUString& rString)
         case DESTINATION_FORMFIELDLIST:
         case DESTINATION_DATAFIELD:
         case DESTINATION_AUTHOR:
+        case DESTINATION_KEYWORDS:
         case DESTINATION_OPERATOR:
         case DESTINATION_COMPANY:
         case DESTINATION_COMMENT:
@@ -1357,6 +1359,9 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
         case RTF_AUTHOR:
             m_aStates.top().nDestinationState = DESTINATION_AUTHOR;
             break;
+        case RTF_KEYWORDS:
+            m_aStates.top().nDestinationState = DESTINATION_KEYWORDS;
+            break;
         case RTF_OPERATOR:
             m_aStates.top().nDestinationState = DESTINATION_OPERATOR;
             break;
@@ -3256,6 +3261,8 @@ int RTFDocumentImpl::popState()
         m_xDocumentProperties->setPrintDate(lcl_getDateTime(m_aStates));
     else if (m_aStates.top().nDestinationState == DESTINATION_AUTHOR && m_xDocumentProperties.is())
         m_xDocumentProperties->setAuthor(m_aStates.top().aDestinationText.makeStringAndClear());
+    else if (m_aStates.top().nDestinationState == DESTINATION_KEYWORDS && m_xDocumentProperties.is())
+        m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(m_aStates.top().aDestinationText.makeStringAndClear()));
     else if (m_aStates.top().nDestinationState == DESTINATION_COMMENT && m_xDocumentProperties.is())
         m_xDocumentProperties->setGenerator(m_aStates.top().aDestinationText.makeStringAndClear());
     else if (m_aStates.top().nDestinationState == DESTINATION_OPERATOR
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 84ac9f3..fa21c81 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -100,6 +100,7 @@ namespace writerfilter {
             DESTINATION_REVISIONTIME,
             DESTINATION_PRINTTIME,
             DESTINATION_AUTHOR,
+            DESTINATION_KEYWORDS,
             DESTINATION_OPERATOR,
             DESTINATION_COMPANY,
             DESTINATION_COMMENT,
-- 
1.7.7


--0OAP2g/MAC+5xKAE--


More information about the LibreOffice mailing list