RTF import: handle RTF_ATNREF

Otherwise dmapper won't create an annotation mark for us.

Change-Id: I868c3ffd65fbaa9a5115ba7300310fa3585d2d05
This commit is contained in:
Miklos Vajna
2014-01-09 12:18:12 +01:00
parent 6cb6370711
commit 347d83d1cc
3 changed files with 15 additions and 5 deletions

View File

@@ -1288,8 +1288,6 @@ DECLARE_RTFIMPORT_TEST(testFdo53556, "fdo53556.rtf")
DECLARE_RTFIMPORT_TEST(testFdo63428, "hello.rtf")
{
#if 0
// FIXME port to AnnotationMarks
// Pasting content that contained an annotation caused a crash.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
@@ -1297,9 +1295,8 @@ DECLARE_RTFIMPORT_TEST(testFdo63428, "hello.rtf")
paste("fdo63428.rtf", xEnd);
// Additionally, commented range was imported as a normal comment.
CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(getRun(getParagraph(1), 2), "TextPortionType"));
CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(getRun(getParagraph(1), 4), "TextPortionType"));
#endif
CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(getRun(getParagraph(1), 2), "TextPortionType"));
CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(getRun(getParagraph(1), 4), "TextPortionType"));
}
DECLARE_RTFIMPORT_TEST(testGroupshapeRotation, "groupshape-rotation.rtf")

View File

@@ -1095,6 +1095,7 @@ void RTFDocumentImpl::text(OUString& rString)
case DESTINATION_OBJDATA:
case DESTINATION_ANNOTATIONDATE:
case DESTINATION_ANNOTATIONAUTHOR:
case DESTINATION_ANNOTATIONREFERENCE:
case DESTINATION_FALT:
case DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER:
case DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE:
@@ -1578,6 +1579,9 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
case RTF_ATNAUTHOR:
m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONAUTHOR;
break;
case RTF_ATNREF:
m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCE;
break;
case RTF_FALT:
m_aStates.top().nDestinationState = DESTINATION_FALT;
break;
@@ -4247,6 +4251,14 @@ int RTFDocumentImpl::popState()
case DESTINATION_ATNID:
m_aAuthorInitials = m_aStates.top().aDestinationText.makeStringAndClear();
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)));
Mapper().props(writerfilter::Reference<Properties>::Pointer_t(new RTFReferenceProperties(aAnnAttributes)));
}
break;
case DESTINATION_FALT:
{
OUString aStr(m_aStates.top().aDestinationText.makeStringAndClear());

View File

@@ -78,6 +78,7 @@ namespace writerfilter {
DESTINATION_RESULT,
DESTINATION_ANNOTATIONDATE,
DESTINATION_ANNOTATIONAUTHOR,
DESTINATION_ANNOTATIONREFERENCE,
DESTINATION_FALT,
DESTINATION_FLYMAINCONTENT,
DESTINATION_DRAWINGOBJECT,