summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-01-09 17:39:02 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-09 17:44:23 +0100
commitcc0943a5db55811c7cb864c1a38ccabab6ad348f (patch)
tree4c14ac1abd1161e70cf96f38a454bf940fba2a0c
parent6af2caab7271e11d9501fd6a597e05194d33fd10 (diff)
DOC export of annotation marks
Change-Id: Ib29aef7838b9d31d7956c93e1aa5b896852e4b89
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx11
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx17
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx1
3 files changed, 20 insertions, 9 deletions
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 39f6c794df3f..1c4a8d738afb 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -152,8 +152,6 @@ DECLARE_WW8EXPORT_TEST(testCharacterBorder, "charborder.odt")
DECLARE_WW8EXPORT_TEST(testFdo59530, "fdo59530.doc")
{
-#if 0
- // FIXME port to AnnotationMarks
// See ooxmlexport's testFdo38244().
// Test comment range feature.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
@@ -163,10 +161,10 @@ DECLARE_WW8EXPORT_TEST(testFdo59530, "fdo59530.doc")
uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
xRunEnum->nextElement();
uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(xPropertySet, "TextPortionType"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(xPropertySet, "TextPortionType"));
xRunEnum->nextElement();
xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
+ CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
// Test initials.
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
@@ -181,14 +179,13 @@ DECLARE_WW8EXPORT_TEST(testFdo59530, "fdo59530.doc")
xRunEnum = xRunEnumAccess->createEnumeration();
xRunEnum->nextElement();
xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(xPropertySet, "TextPortionType"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(xPropertySet, "TextPortionType"));
// Comment ends in the third paragraph
xRunEnumAccess.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xRunEnum = xRunEnumAccess->createEnumeration();
xRunEnum->nextElement();
xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
-#endif
+ CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
}
#endif
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index d8a3d92b120b..a24cf5bc2f45 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1387,8 +1387,23 @@ void WW8Export::AppendBookmarks( const SwTxtNode& rNd, sal_Int32 nAktPos, sal_In
}
}
-void WW8Export::AppendAnnotationMarks( const SwTxtNode& /*rNd*/, sal_Int32 /*nAktPos*/, sal_Int32 /*nLen*/ )
+void WW8Export::AppendAnnotationMarks(const SwTxtNode& rNode, sal_Int32 nAktPos, sal_Int32 nLen)
{
+ std::vector<OUString> aStarts;
+ IMarkVector aMarks;
+ if (GetAnnotationMarks(rNode, nAktPos, nAktPos + nLen, aMarks))
+ {
+ for (IMarkVector::const_iterator it = aMarks.begin(), end = aMarks.end(); it != end; ++it)
+ {
+ sw::mark::IMark* pMark = (*it);
+ const sal_Int32 nStart = pMark->GetMarkStart().nContent.GetIndex();
+ if (nStart == nAktPos)
+ {
+ pAtn->AddRangeStartPosition(Fc2Cp(Strm().Tell()));
+ return;
+ }
+ }
+ }
}
void WW8Export::MoveFieldMarks(WW8_CP nFrom, WW8_CP nTo)
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 42f1a8bdd7ee..418d20d5aa90 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2490,7 +2490,6 @@ void WW8AttributeOutput::PostitField( const SwField* pFld )
void WW8AttributeOutput::WritePostitFieldStart()
{
- m_rWW8Export.pAtn->AddRangeStartPosition( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ) );
}
bool WW8AttributeOutput::DropdownField( const SwField* pFld )