[Libreoffice-commits] core.git: 2 commits - include/comphelper sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 16 16:50:21 UTC 2021


 include/comphelper/multicontainer2.hxx |    4 -
 sw/source/core/crsr/crsrsh.cxx         |   69 +++++++++++++++------------------
 2 files changed, 35 insertions(+), 38 deletions(-)

New commits:
commit b336dca9864390a0e19ae3f4518725eba6be2ffc
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 3 14:42:13 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 16 18:46:41 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

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index ccabd89f38ba..e1abd7264ae9 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;
@@ -2061,69 +2061,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()
commit 8e63f79f0ab23013f81e54b36d1e0678e9e681dc
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 16 13:02:04 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 16 18:45:58 2021 +0200

    improve documentation for comphelper::OMultiTypeInterfaceContainerHelper2
    
    Change-Id: I7ac6cf075f2f143bf080d9ee2f74840c3f56d61a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120538
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/comphelper/multicontainer2.hxx b/include/comphelper/multicontainer2.hxx
index 35f0fd9686ef..33f82dcb5c20 100644
--- a/include/comphelper/multicontainer2.hxx
+++ b/include/comphelper/multicontainer2.hxx
@@ -42,8 +42,8 @@ class XInterface;
 /** */ //for docpp
 namespace comphelper
 {
-/** Specialized class for key type css::uno::Type,
-    without explicit usage of STL symbols.
+/** This is a copy of cppu::OMultiTypeInterfaceContainerHelper2 in include/ccppuhelper/interfacecontainer.h,
+    except that it uses comphelper::OInterfaceContainerHelper2, which is more efficient.
 */
 class COMPHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelper2
 {


More information about the Libreoffice-commits mailing list