summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2011-07-26 00:56:04 +0200
committerMiklos Vajna <vmiklos@frugalware.org>2011-07-29 17:32:40 +0200
commit32a8777fd8efc84d3bbfdc95b83ab3e4965c8863 (patch)
tree4492781e441f0710e2c600a3bad248fab3f98608 /writerfilter
parente8b50bde720e434290c5e0ec22014d33b025f7d9 (diff)
implement RTF_ATNAUTHOR
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx28
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx6
2 files changed, 33 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b1fab2feddc7..3b369bd06283 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -308,6 +308,11 @@ void RTFDocumentImpl::setSubstream(bool bIsSubtream)
m_bIsSubstream = bIsSubtream;
}
+void RTFDocumentImpl::setAuthor(rtl::OUString& rAuthor)
+{
+ m_aAuthor = rAuthor;
+}
+
bool RTFDocumentImpl::isSubstream()
{
return m_bIsSubstream;
@@ -330,6 +335,11 @@ void RTFDocumentImpl::resolveSubstream(sal_uInt32 nPos, Id nId, OUString& rIgnor
RTFDocumentImpl::Pointer_t pImpl(new RTFDocumentImpl(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame));
pImpl->setSubstream(true);
pImpl->setIgnoreFirst(rIgnoreFirst);
+ if (m_aAuthor.getLength())
+ {
+ pImpl->setAuthor(m_aAuthor);
+ m_aAuthor = OUString();
+ }
pImpl->seek(nPos);
OSL_TRACE("substream start");
Mapper().substream(nId, pImpl);
@@ -676,6 +686,7 @@ void RTFDocumentImpl::text(OUString& rString)
case DESTINATION_COMMENT:
case DESTINATION_OBJDATA:
case DESTINATION_ANNOTATIONDATE:
+ case DESTINATION_ANNOTATIONAUTHOR:
m_aDestinationText.append(rString);
break;
default: bRet = false; break;
@@ -966,6 +977,18 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
resolveSubstream(m_nGroupStartPos - 1, NS_rtf::LN_annotation);
m_aStates.top().nDestinationState = DESTINATION_SKIP;
}
+ else
+ {
+ // If there is an author set, emit it now.
+ if (m_aAuthor.getLength())
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(m_aAuthor));
+ RTFSprms_t aAttributes;
+ aAttributes.push_back(make_pair(NS_ooxml::LN_CT_TrackChange_author, pValue));
+ writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes));
+ Mapper().props(pProperties);
+ }
+ }
break;
case RTF_SHPTXT:
m_aStates.top().nDestinationState = DESTINATION_SHAPETEXT;
@@ -1024,6 +1047,9 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
case RTF_ATNDATE:
m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONDATE;
break;
+ case RTF_ATNAUTHOR:
+ m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONAUTHOR;
+ break;
case RTF_LISTTEXT:
// Should be ignored by any reader that understands Word 97 through Word 2007 numbering.
case RTF_NONESTTABLES:
@@ -2594,6 +2620,8 @@ int RTFDocumentImpl::popState()
writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAnnAttributes));
Mapper().props(pProperties);
}
+ else if (m_aStates.top().nDestinationState == DESTINATION_ANNOTATIONAUTHOR)
+ m_aAuthor = m_aDestinationText.makeStringAndClear();
// See if we need to end a track change
RTFValue::Pointer_t pTrackchange = RTFSprm::find(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index ab3a09a4cb82..808e3a9d3270 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -109,7 +109,8 @@ namespace writerfilter {
DESTINATION_OBJECT,
DESTINATION_OBJDATA,
DESTINATION_RESULT,
- DESTINATION_ANNOTATIONDATE
+ DESTINATION_ANNOTATIONDATE,
+ DESTINATION_ANNOTATIONAUTHOR
};
enum RTFBorderState
@@ -263,6 +264,7 @@ namespace writerfilter {
Stream& Mapper();
void setSubstream(bool bIsSubtream);
+ void setAuthor(rtl::OUString& rAuthor);
bool isSubstream();
void setIgnoreFirst(rtl::OUString& rIgnoreFirst);
void seek(sal_uInt32 nPos);
@@ -356,6 +358,8 @@ namespace writerfilter {
std::map<rtl::OUString, int> m_aBookmarks;
/// Revision index <-> author map.
std::map<int, rtl::OUString> m_aAuthors;
+ /// Annotation author of the next annotation.
+ rtl::OUString m_aAuthor;
/// Text from special destinations.
rtl::OUStringBuffer m_aDestinationText;