[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - desktop/qa sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 22 10:55:12 UTC 2021
desktop/qa/desktop_lib/test_desktop_lib.cxx | 2
sw/source/core/crsr/crsrsh.cxx | 69 +++++++++++++---------------
2 files changed, 34 insertions(+), 37 deletions(-)
New commits:
commit 2bb1290736ab7fe26e5670c732615c175b76ba3e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 3 14:42:13 2021 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Sep 22 12:54:35 2021 +0200
use tools::Json for cursor messages
and tweak the JsonWriter to produce output more like the boost propertytree,
to make the cypress tests happier.
Change-Id: Ia2062508ae9f14a5f89306042c33884ff300f478
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119936
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
(cherry picked from commit d46c7bd597e51453ac420db97fd898ed2f3b26bf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120433
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122127
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 4f0014f6e0ad..f63e8dd5ddca 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2014,7 +2014,7 @@ public:
break;
case LOK_CALLBACK_TABLE_SELECTED:
{
- m_bEmptyTableSelection = (std::string(pPayload).compare("{\n}\n") == 0);
+ m_bEmptyTableSelection = (std::string(pPayload).compare("{ }") == 0);
++m_nTableSelectionCount;
}
break;
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index bb2323240c20..ef4e669b5f36 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -73,8 +73,8 @@
#include <wrtsh.hxx>
#include <undobj.hxx>
#include <view.hxx>
-#include <boost/property_tree/json_parser.hpp>
#include <hints.hxx>
+#include <tools/json_writer.hxx>
using namespace com::sun::star;
using namespace util;
@@ -2054,69 +2054,66 @@ void SwCursorShell::sendLOKCursorUpdates()
SwFrame* pCurrentFrame = GetCurrFrame();
SelectionType eType = pShell->GetSelectionType();
- boost::property_tree::ptree aRootTree;
+ tools::JsonWriter aJsonWriter;
if (pCurrentFrame && (eType & SelectionType::Table) && pCurrentFrame->IsInTab())
{
const SwRect& rPageRect = pShell->GetAnyCurRect(CurRectType::Page, nullptr);
- boost::property_tree::ptree aTableColumns;
{
+ auto columnsNode = aJsonWriter.startNode("columns");
SwTabCols aTabCols;
pShell->GetTabCols(aTabCols);
const int nColumnOffset = aTabCols.GetLeftMin() + rPageRect.Left();
- aTableColumns.put("left", aTabCols.GetLeft());
- aTableColumns.put("right", aTabCols.GetRight());
- aTableColumns.put("tableOffset", nColumnOffset);
+ aJsonWriter.put("left", aTabCols.GetLeft());
+ aJsonWriter.put("right", aTabCols.GetRight());
+ aJsonWriter.put("tableOffset", static_cast<sal_Int64>(nColumnOffset));
- boost::property_tree::ptree aEntries;
- for (size_t i = 0; i < aTabCols.Count(); ++i)
{
- auto const & rEntry = aTabCols.GetEntry(i);
- boost::property_tree::ptree aTableColumnEntry;
- aTableColumnEntry.put("position", rEntry.nPos);
- aTableColumnEntry.put("min", rEntry.nMin);
- aTableColumnEntry.put("max", rEntry.nMax);
- aTableColumnEntry.put("hidden", rEntry.bHidden);
- aEntries.push_back(std::make_pair("", aTableColumnEntry));
+ auto entriesNode = aJsonWriter.startArray("entries");
+ for (size_t i = 0; i < aTabCols.Count(); ++i)
+ {
+ auto entryNode = aJsonWriter.startStruct();
+ auto const & rEntry = aTabCols.GetEntry(i);
+ aJsonWriter.put("position", rEntry.nPos);
+ aJsonWriter.put("min", rEntry.nMin);
+ aJsonWriter.put("max", rEntry.nMax);
+ aJsonWriter.put("hidden", rEntry.bHidden);
+ }
}
- aTableColumns.push_back(std::make_pair("entries", aEntries));
}
- boost::property_tree::ptree aTableRows;
{
+ auto rowsNode = aJsonWriter.startNode("rows");
SwTabCols aTabRows;
pShell->GetTabRows(aTabRows);
const int nRowOffset = aTabRows.GetLeftMin() + rPageRect.Top();
- aTableRows.put("left", aTabRows.GetLeft());
- aTableRows.put("right", aTabRows.GetRight());
- aTableRows.put("tableOffset", nRowOffset);
+ aJsonWriter.put("left", aTabRows.GetLeft());
+ aJsonWriter.put("right", aTabRows.GetRight());
+ aJsonWriter.put("tableOffset", static_cast<sal_Int64>(nRowOffset));
- boost::property_tree::ptree aEntries;
- for (size_t i = 0; i < aTabRows.Count(); ++i)
{
- auto const & rEntry = aTabRows.GetEntry(i);
- boost::property_tree::ptree aTableRowEntry;
- aTableRowEntry.put("position", rEntry.nPos);
- aTableRowEntry.put("min", rEntry.nMin);
- aTableRowEntry.put("max", rEntry.nMax);
- aTableRowEntry.put("hidden", rEntry.bHidden);
- aEntries.push_back(std::make_pair("", aTableRowEntry));
+ auto entriesNode = aJsonWriter.startArray("entries");
+ for (size_t i = 0; i < aTabRows.Count(); ++i)
+ {
+ auto entryNode = aJsonWriter.startStruct();
+ auto const & rEntry = aTabRows.GetEntry(i);
+ aJsonWriter.put("position", rEntry.nPos);
+ aJsonWriter.put("min", rEntry.nMin);
+ aJsonWriter.put("max", rEntry.nMax);
+ aJsonWriter.put("hidden", rEntry.bHidden);
+ }
}
- aTableRows.push_back(std::make_pair("entries", aEntries));
}
-
- aRootTree.add_child("columns", aTableColumns);
- aRootTree.add_child("rows", aTableRows);
}
- std::stringstream aStream;
- boost::property_tree::write_json(aStream, aRootTree);
- GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, aStream.str().c_str());
+ char* pChar = aJsonWriter.extractData();
+ GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, pChar);
+ free(pChar);
}
void SwCursorShell::RefreshBlockCursor()
More information about the Libreoffice-commits
mailing list