diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-14 19:41:53 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-14 19:45:52 +0100 |
commit | 149640c229ca987ab3186d08fe4514200dd854c1 (patch) | |
tree | f19e07f42eee8c2a001e70e84e7aef17066dc39d /writerfilter | |
parent | 6036ae611e3667a07d7239857e2d6955f7292810 (diff) |
RTF import: fix nested comments
Change-Id: I6236c255708f13131117246743d86cd3448bce24
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 36 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtflistener.hxx | 2 |
3 files changed, 24 insertions, 22 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 226dc5c928af..13443d7eaf9d 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1691,18 +1691,15 @@ void DomainMapper_Impl::PopAnnotation() try { - if ( m_nAnnotationId != -1 ) - { // See if the annotation will be a single position or a range. - AnnotationPosition& aAnnotationPosition = m_aAnnotationPositions[ m_nAnnotationId ]; - if ( !aAnnotationPosition.m_xStart.is() - || !aAnnotationPosition.m_xEnd.is() ) + if (m_nAnnotationId == -1 || !m_aAnnotationPositions[m_nAnnotationId].m_xStart.is() || !m_aAnnotationPositions[m_nAnnotationId].m_xEnd.is()) { uno::Sequence< beans::PropertyValue > aEmptyProperties; appendTextContent( uno::Reference< text::XTextContent >( m_xAnnotationField, uno::UNO_QUERY_THROW ), aEmptyProperties ); } else { + AnnotationPosition& aAnnotationPosition = m_aAnnotationPositions[m_nAnnotationId]; // Create a range that points to the annotation start/end. uno::Reference<text::XText> const xText = aAnnotationPosition.m_xStart->getText(); uno::Reference<text::XTextCursor> const xCursor = xText->createTextCursorByRange(aAnnotationPosition.m_xStart); @@ -1715,7 +1712,6 @@ void DomainMapper_Impl::PopAnnotation() } m_aAnnotationPositions.erase( m_nAnnotationId ); } - } catch (uno::Exception const& e) { SAL_WARN("writerfilter", diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 6568b8cfef09..9b4f852281d8 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1103,6 +1103,8 @@ void RTFDocumentImpl::text(OUString& rString) case DESTINATION_SUBJECT: case DESTINATION_DOCCOMM: case DESTINATION_ATNID: + case DESTINATION_ANNOTATIONREFERENCESTART: + case DESTINATION_ANNOTATIONREFERENCEEND: case DESTINATION_MR: case DESTINATION_MCHR: case DESTINATION_MPOS: @@ -1624,22 +1626,10 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_aStates.top().nDestinationState = DESTINATION_DOCCOMM; break; case RTF_ATRFSTART: + m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCESTART; + break; case RTF_ATRFEND: - { - // We could send the real value here, but that would make the - // tokenizer more complicated, and dmapper doesn't read the - // result anyway. - RTFValue::Pointer_t pValue(new RTFValue(0)); - m_aStates.top().nDestinationState = DESTINATION_SKIP; - - RTFSprms aAttributes; - if (nKeyword == RTF_ATRFSTART) - aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue); - else - aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue); - writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes)); - Mapper().props(pProperties); - } + m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCEEND; break; case RTF_ATNID: m_aStates.top().nDestinationState = DESTINATION_ATNID; @@ -4251,11 +4241,25 @@ int RTFDocumentImpl::popState() case DESTINATION_ATNID: m_aAuthorInitials = m_aStates.top().aDestinationText.makeStringAndClear(); break; + case DESTINATION_ANNOTATIONREFERENCESTART: + case DESTINATION_ANNOTATIONREFERENCEEND: + { + OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear(); + RTFValue::Pointer_t pValue(new RTFValue(aStr.toInt32())); + RTFSprms aAttributes; + if (aState.nDestinationState == DESTINATION_ANNOTATIONREFERENCESTART) + aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue); + else + aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue); + writerfilter::Reference<Properties>::Pointer_t pProperties(new RTFReferenceProperties(aAttributes)); + Mapper().props(pProperties); + } + break; case DESTINATION_ANNOTATIONREFERENCE: { OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear(); RTFSprms aAnnAttributes; - aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, RTFValue::Pointer_t(new RTFValue(aStr))); + aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, RTFValue::Pointer_t(new RTFValue(aStr.toInt32()))); Mapper().props(writerfilter::Reference<Properties>::Pointer_t(new RTFReferenceProperties(aAnnAttributes))); } break; diff --git a/writerfilter/source/rtftok/rtflistener.hxx b/writerfilter/source/rtftok/rtflistener.hxx index 2abfe01a4a2e..b345275e72b0 100644 --- a/writerfilter/source/rtftok/rtflistener.hxx +++ b/writerfilter/source/rtftok/rtflistener.hxx @@ -89,6 +89,8 @@ namespace writerfilter { DESTINATION_SUBJECT, DESTINATION_DOCCOMM, DESTINATION_ATNID, + DESTINATION_ANNOTATIONREFERENCESTART, + DESTINATION_ANNOTATIONREFERENCEEND, DESTINATION_MOMATH, DESTINATION_MR, DESTINATION_MF, |