[Libreoffice-commits] core.git: writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jan 14 10:46:12 PST 2014
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 +---
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 36 ++++++++++++----------
writerfilter/source/rtftok/rtflistener.hxx | 2 +
3 files changed, 24 insertions(+), 22 deletions(-)
New commits:
commit 149640c229ca987ab3186d08fe4514200dd854c1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 14 19:41:53 2014 +0100
RTF import: fix nested comments
Change-Id: I6236c255708f13131117246743d86cd3448bce24
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 226dc5c..13443d7 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 6568b8c..9b4f852 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 2abfe01..b345275 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,
More information about the Libreoffice-commits
mailing list