[Libreoffice-commits] core.git: sc/source vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 23 11:41:38 UTC 2020


 sc/source/ui/sidebar/AlignmentPropertyPanel.cxx |   44 ------------------------
 sc/source/ui/sidebar/AlignmentPropertyPanel.hxx |    2 -
 vcl/source/window/window.cxx                    |    9 ++++
 3 files changed, 9 insertions(+), 46 deletions(-)

New commits:
commit 84881e32317765e7752d57fceac8d979dd801b8c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jun 19 16:17:25 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jun 23 13:41:01 2020 +0200

    remove JSON node erasing
    
    as a step towards using tools::JsonWriter for DumpAsPropertyTree
    
    Since this method is only used by the LOK stuff, we can just
    remove the node down at the generation site in vcl::Window
    
    Change-Id: I1b3b9a0732dcdb18267cb56e545a30c8f56b4ae2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96839
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 4d7183d5f31f..6a6bee924459 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -140,50 +140,6 @@ void AlignmentPropertyPanel::Initialize()
     mxRefEdgeStd->connect_toggled(aLink2);
 }
 
-namespace {
-
-void eraseNode(boost::property_tree::ptree& pTree, const std::string& aValue)
-{
-    boost::optional<boost::property_tree::ptree&> pId;
-    boost::optional<boost::property_tree::ptree&> pSubTree = pTree.get_child_optional("children");
-
-    if (pSubTree)
-    {
-        boost::property_tree::ptree::iterator itFound = pSubTree.get().end();
-        for (boost::property_tree::ptree::iterator it = pSubTree.get().begin(); it != pSubTree.get().end(); ++it)
-        {
-            pId = it->second.get_child_optional("id");
-            if (pId && pId.get().get_value<std::string>("") == aValue)
-            {
-                itFound = it;
-                break;
-            }
-
-            eraseNode(it->second, aValue);
-        }
-
-        if (itFound != pSubTree.get().end())
-        {
-            pSubTree.get().erase(itFound);
-        }
-    }
-}
-
-}
-
-boost::property_tree::ptree AlignmentPropertyPanel::DumpAsPropertyTree()
-{
-    boost::property_tree::ptree aTree = PanelLayout::DumpAsPropertyTree();
-
-    const SfxViewShell* pViewShell = SfxViewShell::Current();
-    if (pViewShell && pViewShell->isLOKMobilePhone())
-    {
-        eraseNode(aTree, "textorientbox");
-    }
-
-    return aTree;
-}
-
 IMPL_LINK(AlignmentPropertyPanel, ReferenceEdgeHdl, weld::ToggleButton&, rToggle, void)
 {
     if (mbSettingToggles)
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index bcd3e1ebadba..3a1b8eb8201b 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -55,8 +55,6 @@ public:
 
     SfxBindings* GetBindings() { return mpBindings;}
 
-    virtual boost::property_tree::ptree DumpAsPropertyTree() override;
-
     // constructor/destructor
     AlignmentPropertyPanel(
         vcl::Window* pParent,
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c0429c9b76be..767beda066d9 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -85,6 +85,8 @@ using namespace ::com::sun::star::datatransfer::dnd;
 
 namespace vcl {
 
+static bool g_isLOKMobilePhone = false;
+
 Window::Window( WindowType nType )
     : OutputDevice(OUTDEV_WINDOW)
     , mpWindowImpl(new WindowImpl( nType ))
@@ -3382,6 +3384,13 @@ const char* windowTypeName(WindowType nWindowType)
 
 boost::property_tree::ptree Window::DumpAsPropertyTree()
 {
+    // This is for the code in sc/source/ui/sidebar/AlignmentPropertyPanel.cxx.
+    // Also see commit f27c6320e8496d690b5d341d3718430709263a1c
+    // "lok: remove complex rotation / alignment settings"
+    if (g_isLOKMobilePhone && get_id() == "textorientbox") {
+        return boost::property_tree::ptree();
+    }
+
     boost::property_tree::ptree aTree;
     aTree.put("id", get_id());  // TODO could be missing - sort out
     aTree.put("type", windowTypeName(GetType()));


More information about the Libreoffice-commits mailing list