summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-19 16:46:15 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-19 17:05:06 +0200
commita0c66852c3da76674510e8559e102bcc1efd0676 (patch)
treec5fa976ec5a2a6a68015d3beb87011307fcb3afb
parent1e36a15754acb0debe7e0297ebd02a757c4e548f (diff)
sw redlines: expose description as part of the UNO/LOK API
A redline can have a manual comment and also an autogenerated description, like "Insert 'abc'". Expose this later property as well, as it provides useful additional information, especially when the comment property is empty. Change-Id: Id0f0ff62aef58d96b9b6071706c6f5b4a0d74800 (cherry picked from commit 9e310a4705ce956551059040696166aefb2388cb)
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx4
-rw-r--r--desktop/source/lib/init.cxx4
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitEnums.h1
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx7
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/source/core/doc/docredln.cxx2
-rw-r--r--sw/source/core/unocore/unomapproperties.hxx1
-rw-r--r--sw/source/core/unocore/unoredline.cxx10
8 files changed, 26 insertions, 4 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index ffacd4c8458a..d71532919ade 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1203,6 +1203,10 @@ void DesktopLOKTest::testRedlineWriter()
// Make sure that pressing a key creates exactly one redline.
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aTree.get_child("redlines").size());
+ for (boost::property_tree::ptree::value_type& rRedline : aTree.get_child("redlines"))
+ // This failed with boost::property_tree::ptree_bad_path, as there were no description field.
+ CPPUNIT_ASSERT_EQUAL(std::string("Insert 't'"), rRedline.second.get<std::string>("description"));
+
comphelper::LibreOfficeKit::setActive(false);
}
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0a9f2b2a3018..b18e4d680b98 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1858,6 +1858,10 @@ static char* getTrackedChanges(LibreOfficeKitDocument* pThis)
xRedline->getPropertyValue("RedlineComment") >>= sComment;
aRedline.put("comment", sComment.toUtf8().getStr());
+ OUString sDescription;
+ xRedline->getPropertyValue("RedlineDescription") >>= sDescription;
+ aRedline.put("description", sDescription.toUtf8().getStr());
+
util::DateTime aDateTime;
xRedline->getPropertyValue("RedlineDateTime") >>= aDateTime;
OUString sDateTime = utl::toISO8601(aDateTime);
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 2c3bcabc496c..0805e62145cd 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -417,6 +417,7 @@ typedef enum
* "author": "Unknown Author",
* "type": "Delete",
* "comment": "",
+ * "description": "Delete 'abc'",
* "dateTime": "2016-08-18T12:14:00"
* }
* }
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 1d7791804f75..a1833d2d9e74 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -485,7 +485,7 @@ static void documentRedline(GtkWidget* pButton, gpointer /*pItem*/)
GtkWidget* pContentArea = gtk_dialog_get_content_area(GTK_DIALOG (pDialog));
// Build the table.
- GtkTreeStore* pTreeStore = gtk_tree_store_new(5, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ GtkTreeStore* pTreeStore = gtk_tree_store_new(6, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
for (const auto& rValue : aTree.get_child("redlines"))
{
GtkTreeIter aTreeIter;
@@ -495,11 +495,12 @@ static void documentRedline(GtkWidget* pButton, gpointer /*pItem*/)
1, rValue.second.get<std::string>("author").c_str(),
2, rValue.second.get<std::string>("type").c_str(),
3, rValue.second.get<std::string>("comment").c_str(),
- 4, rValue.second.get<std::string>("dateTime").c_str(),
+ 4, rValue.second.get<std::string>("description").c_str(),
+ 5, rValue.second.get<std::string>("dateTime").c_str(),
-1);
}
GtkWidget* pTreeView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pTreeStore));
- std::vector<std::string> aColumns = {"Index", "Author", "Type", "Comment", "Timestamp"};
+ std::vector<std::string> aColumns = {"Index", "Author", "Type", "Comment", "Description", "Timestamp"};
for (size_t nColumn = 0; nColumn < aColumns.size(); ++nColumn)
{
GtkCellRenderer* pRenderer = gtk_cell_renderer_text_new();
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 63589f273ce5..fa87f404fc03 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -536,6 +536,7 @@
#define UNO_NAME_REDLINE_AUTHOR "RedlineAuthor"
#define UNO_NAME_REDLINE_DATE_TIME "RedlineDateTime"
#define UNO_NAME_REDLINE_COMMENT "RedlineComment"
+#define UNO_NAME_REDLINE_DESCRIPTION "RedlineDescription"
#define UNO_NAME_REDLINE_TYPE "RedlineType"
#define UNO_NAME_REDLINE_SUCCESSOR_DATA "RedlineSuccessorData"
#define UNO_NAME_REDLINE_IDENTIFIER "RedlineIdentifier"
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index b7b1c8a9cbe8..90c68750362a 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -310,6 +310,7 @@ static void lcl_RedlineNotification(bool bAdd, size_t nPos, SwRangeRedline* pRed
aRedline.put("author", pRedline->GetAuthorString(1).toUtf8().getStr());
aRedline.put("type", SwRedlineTypeToOUString(pRedline->GetRedlineData().GetType()).toUtf8().getStr());
aRedline.put("comment", pRedline->GetRedlineData().GetComment().toUtf8().getStr());
+ aRedline.put("description", pRedline->GetDescr().toUtf8().getStr());
OUString sDateTime = utl::toISO8601(pRedline->GetRedlineData().GetTimeStamp().GetUNODateTime());
aRedline.put("dateTime", sDateTime.toUtf8().getStr());
boost::property_tree::ptree aTree;
@@ -1673,6 +1674,7 @@ void SwRangeRedline::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number(GetSeqNo()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("author"), BAD_CAST(SW_MOD()->GetRedlineAuthor(GetAuthor()).toUtf8().getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("date"), BAD_CAST(DateTimeToOString(GetTimeStamp()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("descr"), BAD_CAST(const_cast<SwRangeRedline*>(this)->GetDescr().toUtf8().getStr()));
OString sRedlineType;
switch (GetType())
diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx
index f53ac89e2477..20d0162e2c19 100644
--- a/sw/source/core/unocore/unomapproperties.hxx
+++ b/sw/source/core/unocore/unomapproperties.hxx
@@ -68,6 +68,7 @@
{OUString(UNO_NAME_REDLINE_AUTHOR), 0, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
{OUString(UNO_NAME_REDLINE_DATE_TIME), 0, cppu::UnoType<css::util::DateTime>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
{OUString(UNO_NAME_REDLINE_COMMENT), 0, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {OUString(UNO_NAME_REDLINE_DESCRIPTION), 0, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0}, \
{OUString(UNO_NAME_REDLINE_TYPE), 0, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
{OUString(UNO_NAME_REDLINE_SUCCESSOR_DATA), 0, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
{OUString(UNO_NAME_REDLINE_IDENTIFIER), 0, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index 093d247a7850..10ccc8a3b3c9 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -287,6 +287,8 @@ uno::Any SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co
}
else if(rPropertyName == UNO_NAME_REDLINE_COMMENT)
aRet <<= rRedline.GetComment();
+ else if(rPropertyName == UNO_NAME_REDLINE_DESCRIPTION)
+ aRet <<= const_cast<SwRangeRedline&>(rRedline).GetDescr();
else if(rPropertyName == UNO_NAME_REDLINE_TYPE)
{
aRet <<= SwRedlineTypeToOUString(rRedline.GetType());
@@ -315,7 +317,7 @@ uno::Any SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co
uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties(
const SwRangeRedline& rRedline, bool bIsStart ) throw()
{
- uno::Sequence< beans::PropertyValue > aRet(11);
+ uno::Sequence< beans::PropertyValue > aRet(12);
const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
beans::PropertyValue* pRet = aRet.getArray();
@@ -326,6 +328,8 @@ uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties
pRet[nPropIdx++].Value <<= rRedline.GetTimeStamp().GetUNODateTime();
pRet[nPropIdx].Name = UNO_NAME_REDLINE_COMMENT;
pRet[nPropIdx++].Value <<= rRedline.GetComment();
+ pRet[nPropIdx].Name = UNO_NAME_REDLINE_DESCRIPTION;
+ pRet[nPropIdx++].Value <<= const_cast<SwRangeRedline&>(rRedline).GetDescr();
pRet[nPropIdx].Name = UNO_NAME_REDLINE_TYPE;
pRet[nPropIdx++].Value <<= SwRedlineTypeToOUString(rRedline.GetType());
pRet[nPropIdx].Name = UNO_NAME_REDLINE_IDENTIFIER;
@@ -401,6 +405,10 @@ void SwXRedline::setPropertyValue( const OUString& rPropertyName, const uno::Any
OUString sTmp; aValue >>= sTmp;
pRedline->SetComment(sTmp);
}
+ else if(rPropertyName == UNO_NAME_REDLINE_DESCRIPTION)
+ {
+ SAL_WARN("sw.uno", "SwXRedline::setPropertyValue: can't set Description");
+ }
else if(rPropertyName == UNO_NAME_REDLINE_TYPE)
{
OSL_FAIL("currently not available");