[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - canvas/source include/vcl vcl/source

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 30 07:39:33 UTC 2019


 canvas/source/opengl/ogl_canvashelper.cxx |   16 ++--
 include/vcl/window.hxx                    |    5 +
 vcl/source/window/window.cxx              |  113 ++++++++++++++++++++++++++++++
 3 files changed, 126 insertions(+), 8 deletions(-)

New commits:
commit f89ebad04011b38f21ffb0b19cd3e89465449954
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Sat Sep 14 21:26:21 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Sep 30 09:38:51 2019 +0200

    lok jsdialogs: Introduce dumping of widgets hierarchy to vcl::Window.
    
    Change-Id: Ie3267e1f888df371d281e81ead437a150aa8dc1c
    Reviewed-on: https://gerrit.libreoffice.org/79688
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index 2902c2e9b8db..cc81138a9361 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -394,7 +394,7 @@ namespace oglcanvas
 
             setupGraphicsState( rAct, viewState, renderState );
             rAct.maFunction = std::bind(&lcl_drawLine,
-                                          _1, _2, _3, _4, _5,
+                                          std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
                                           aStartPoint, aEndPoint);
         }
     }
@@ -414,7 +414,7 @@ namespace oglcanvas
 
             // TODO(F2): subdivide&render whole curve
             rAct.maFunction = std::bind(&lcl_drawLine,
-                                            _1,_2,_3,_4,_5,
+                                            std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
                                             geometry::RealPoint2D(
                                                 aBezierSegment.Px,
                                                 aBezierSegment.Py),
@@ -567,10 +567,10 @@ namespace oglcanvas
                         pGradient->getValues() );
 
                     rAct.maFunction = std::bind(&lcl_fillGradientPolyPolygon,
-                                                    _1,_2,_3,_4,
+                                                    std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4,
                                                     rValues,
                                                     textures[0],
-                                                    _6);
+                                                    std::placeholders::_6);
                 }
                 else
                 {
@@ -610,14 +610,14 @@ namespace oglcanvas
                                 canvas::tools::getStdColorSpace()));
 
                         rAct.maFunction = std::bind(&lcl_fillTexturedPolyPolygon,
-                                                        _1,_2,_3,_4,
+                                                        std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4,
                                                         textures[0],
                                                         aSize,
                                                         aARGBBytes,
                                                         rtl_crc32(0,
                                                                   aARGBBytes.getConstArray(),
                                                                   aARGBBytes.getLength()),
-                                                        _6);
+                                                        std::placeholders::_6);
                     }
                     // TODO(F1): handle non-integer case
                 }
@@ -790,7 +790,7 @@ namespace oglcanvas
 
                 setupGraphicsState( rAct, viewState, renderState );
                 rAct.maFunction = std::bind(&lcl_drawOwnBitmap,
-                                                _1,_2,_3,_4,_5,
+                                                std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
                                                 *pOwnBitmap);
             }
             else
@@ -819,7 +819,7 @@ namespace oglcanvas
 
                     setupGraphicsState( rAct, viewState, renderState );
                     rAct.maFunction = std::bind(&lcl_drawGenericBitmap,
-                                                    _1,_2,_3,_4,_5,
+                                                    std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5,
                                                     aSize, aARGBBytes,
                                                     rtl_crc32(0,
                                                               aARGBBytes.getConstArray(),
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 9d2dbe51e0a4..72bf36ec21e3 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -41,6 +41,8 @@
 #include <com/sun/star/uno/Reference.hxx>
 #include <memory>
 
+#include <boost/property_tree/ptree.hpp>
+
 class VirtualDevice;
 struct ImplSVEvent;
 struct ImplWinData;
@@ -1237,6 +1239,9 @@ public:
     /// Find an existing Window based on the LOKWindowId.
     static VclPtr<vcl::Window>          FindLOKWindow(vcl::LOKWindowId nWindowId);
 
+    /// Dumps itself and potentially its children to a property tree, to be written easily to JSON.
+    virtual boost::property_tree::ptree DumpAsPropertyTree();
+
     /// Dialog / window tunneling related methods.
     Size PaintActiveFloatingWindow(VirtualDevice& rDevice) const;
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b75793329981..086c3f61971e 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3247,6 +3247,119 @@ VclPtr<vcl::Window> Window::GetParentWithLOKNotifier()
     return pWindow;
 }
 
+namespace
+{
+
+const char* windowTypeName(WindowType nWindowType)
+{
+    switch (nWindowType)
+    {
+        case WindowType::NONE:                      return "none";
+        case WindowType::MESSBOX:                   return "messagebox";
+        case WindowType::INFOBOX:                   return "infobox";
+        case WindowType::WARNINGBOX:                return "warningbox";
+        case WindowType::ERRORBOX:                  return "errorbox";
+        case WindowType::QUERYBOX:                  return "querybox";
+        case WindowType::WINDOW:                    return "window";
+        case WindowType::WORKWINDOW:                return "workwindow";
+        case WindowType::CONTAINER:                 return "container";
+        case WindowType::FLOATINGWINDOW:            return "floatingwindow";
+        case WindowType::DIALOG:                    return "dialog";
+        case WindowType::MODELESSDIALOG:            return "modelessdialog";
+        case WindowType::MODALDIALOG:               return "modaldialog";
+        case WindowType::CONTROL:                   return "control";
+        case WindowType::PUSHBUTTON:                return "pushbutton";
+        case WindowType::OKBUTTON:                  return "okbutton";
+        case WindowType::CANCELBUTTON:              return "cancelbutton";
+        case WindowType::HELPBUTTON:                return "helpbutton";
+        case WindowType::IMAGEBUTTON:               return "imagebutton";
+        case WindowType::MENUBUTTON:                return "menubutton";
+        case WindowType::MOREBUTTON:                return "morebutton";
+        case WindowType::SPINBUTTON:                return "spinbutton";
+        case WindowType::RADIOBUTTON:               return "radiobutton";
+        case WindowType::CHECKBOX:                  return "checkbox";
+        case WindowType::TRISTATEBOX:               return "tristatebox";
+        case WindowType::EDIT:                      return "edit";
+        case WindowType::MULTILINEEDIT:             return "multilineedit";
+        case WindowType::COMBOBOX:                  return "combobox";
+        case WindowType::LISTBOX:                   return "listbox";
+        case WindowType::MULTILISTBOX:              return "multilistbox";
+        case WindowType::FIXEDTEXT:                 return "fixedtext";
+        case WindowType::FIXEDLINE:                 return "fixedline";
+        case WindowType::FIXEDBITMAP:               return "fixedbitmap";
+        case WindowType::FIXEDIMAGE:                return "fixedimage";
+        case WindowType::GROUPBOX:                  return "groupbox";
+        case WindowType::SCROLLBAR:                 return "scrollbar";
+        case WindowType::SCROLLBARBOX:              return "scrollbarbox";
+        case WindowType::SPLITTER:                  return "splitter";
+        case WindowType::SPLITWINDOW:               return "splitwindow";
+        case WindowType::SPINFIELD:                 return "spinfield";
+        case WindowType::PATTERNFIELD:              return "patternfield";
+        case WindowType::NUMERICFIELD:              return "numericfield";
+        case WindowType::METRICFIELD:               return "metricfield";
+        case WindowType::CURRENCYFIELD:             return "currencyfield";
+        case WindowType::DATEFIELD:                 return "datefield";
+        case WindowType::TIMEFIELD:                 return "timefield";
+        case WindowType::PATTERNBOX:                return "patternbox";
+        case WindowType::NUMERICBOX:                return "numericbox";
+        case WindowType::METRICBOX:                 return "metricbox";
+        case WindowType::CURRENCYBOX:               return "currencybox";
+        case WindowType::DATEBOX:                   return "datebox";
+        case WindowType::TIMEBOX:                   return "timebox";
+        case WindowType::LONGCURRENCYFIELD:         return "longcurrencyfield";
+        case WindowType::LONGCURRENCYBOX:           return "longcurrencybox";
+        case WindowType::SCROLLWINDOW:              return "scrollwindow";
+        case WindowType::TOOLBOX:                   return "toolbox";
+        case WindowType::DOCKINGWINDOW:             return "dockingwindow";
+        case WindowType::STATUSBAR:                 return "statusbar";
+        case WindowType::TABPAGE:                   return "tabpage";
+        case WindowType::TABCONTROL:                return "tabcontrol";
+        case WindowType::TABDIALOG:                 return "tabdialog";
+        case WindowType::BORDERWINDOW:              return "borderwindow";
+        case WindowType::BUTTONDIALOG:              return "buttondialog";
+        case WindowType::SYSTEMCHILDWINDOW:         return "systemchildwindow";
+        case WindowType::SLIDER:                    return "slider";
+        case WindowType::MENUBARWINDOW:             return "menubarwindow";
+        case WindowType::TREELISTBOX:               return "treelistbox";
+        case WindowType::HELPTEXTWINDOW:            return "helptextwindow";
+        case WindowType::INTROWINDOW:               return "introwindow";
+        case WindowType::LISTBOXWINDOW:             return "listboxwindow";
+        case WindowType::DOCKINGAREA:               return "dockingarea";
+        case WindowType::RULER:                     return "ruler";
+        case WindowType::CALCINPUTLINE:             return "calcinputline";
+        case WindowType::HEADERBAR:                 return "headerbar";
+
+        // nothing to do here, but for completeness
+        case WindowType::TOOLKIT_FRAMEWINDOW:       return "toolkit_framewindow";
+        case WindowType::TOOLKIT_SYSTEMCHILDWINDOW: return "toolkit_systemchildwindow";
+    }
+
+    return "none";
+}
+
+}
+
+boost::property_tree::ptree Window::DumpAsPropertyTree()
+{
+    boost::property_tree::ptree aTree;
+    aTree.put("id", get_id());  // TODO could be missing - sort out
+    aTree.put("type", windowTypeName(GetType()));
+    aTree.put("text", GetText());
+
+    boost::property_tree::ptree aChildren;
+    if (vcl::Window* pChild = mpWindowImpl->mpFirstChild)
+    {
+        while (pChild)
+        {
+            aChildren.push_back(std::make_pair("", pChild->DumpAsPropertyTree()));
+            pChild = pChild->mpWindowImpl->mpNext;
+        }
+        aTree.add_child("children", aChildren);
+    }
+
+    return aTree;
+}
+
 void Window::ImplCallDeactivateListeners( vcl::Window *pNew )
 {
     // no deactivation if the newly activated window is my child


More information about the Libreoffice-commits mailing list