[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 27 19:45:17 UTC 2021
sw/source/uibase/app/swmodul1.cxx | 4 ++--
sw/source/uibase/uno/unotxdoc.cxx | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit a845ba982c742d9a4b9b427ea38b96a0f5989ad4
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Jan 14 23:50:39 2021 +0200
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 27 20:44:39 2021 +0100
Fix errors in produced JSON introduced with the switch to JsonWriter
GetRedlineAuthorInfo() should produce a JSON array and not an object
with empty strings as keys, which is incorrect JSON. The code in
Collabora Online expects an array, see Document::getViewColors() in
kit/Kit.cpp.
Producing the wrong kind of data leads to Poco throwing an exception:
Assertion violation: !_key.empty() [in file "src/ParseHandler.cpp", line 64]
Also SwXTextDocument::getPostIts() should produce a JSON array.
Change-Id: I1ab0653ca1eaa3c466d31b1f068ba5937a04e43e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109316
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109475
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index 53cbe772da6d..3cd4c81893ea 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -437,10 +437,10 @@ static Color lcl_GetAuthorColor(std::size_t nPos)
/// Returns a JSON representation of a redline author.
void SwModule::GetRedlineAuthorInfo(tools::JsonWriter& rJsonWriter)
{
- auto authorsNode = rJsonWriter.startNode("authors");
+ auto authorsNode = rJsonWriter.startArray("authors");
for (std::size_t nAuthor = 0; nAuthor < m_pAuthorNames.size(); ++nAuthor)
{
- auto authorNode = rJsonWriter.startNode("");
+ auto authorNode = rJsonWriter.startStruct();
rJsonWriter.put("index", static_cast<sal_Int64>(nAuthor));
rJsonWriter.put("name", m_pAuthorNames[nAuthor]);
rJsonWriter.put("color", sal_uInt32(lcl_GetAuthorColor(nAuthor)));
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index bd56d0c7dcb4..4362d09044ec 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3329,7 +3329,7 @@ void SwXTextDocument::getRulerState(tools::JsonWriter& rJsonWriter)
void SwXTextDocument::getPostIts(tools::JsonWriter& rJsonWriter)
{
SolarMutexGuard aGuard;
- auto commentsNode = rJsonWriter.startNode("comments");
+ auto commentsNode = rJsonWriter.startArray("comments");
for (auto const& sidebarItem : *m_pDocShell->GetView()->GetPostItMgr())
{
sw::annotation::SwAnnotationWin* pWin = sidebarItem->mpPostIt.get();
@@ -3355,7 +3355,7 @@ void SwXTextDocument::getPostIts(tools::JsonWriter& rJsonWriter)
}
const OString sRects = comphelper::string::join("; ", aRects);
- auto commentNode = rJsonWriter.startNode("");
+ auto commentNode = rJsonWriter.startStruct();
rJsonWriter.put("id", pField->GetPostItId());
rJsonWriter.put("parent", pWin->CalcParent());
rJsonWriter.put("author", pField->GetPar1());
More information about the Libreoffice-commits
mailing list