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

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 5 13:01:12 UTC 2020


 sc/source/ui/sidebar/AlignmentPropertyPanel.cxx |   46 ++++++++++++++++++++++++
 sc/source/ui/sidebar/AlignmentPropertyPanel.hxx |    2 +
 2 files changed, 48 insertions(+)

New commits:
commit f27c6320e8496d690b5d341d3718430709263a1c
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Tue Feb 25 15:58:06 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Thu Mar 5 14:00:33 2020 +0100

    lok: remove complex rotation / alignment settings
    
    It is very confusing for mobile user the text orientation
    properties, let's remove the property for mobile view.
    
    Change-Id: I4150f9ed7343d38fd00ee66fa5afffe40426b984
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89840
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 21772db395fe..78363b683ebe 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -30,6 +30,9 @@
 #include <svtools/unitconv.hxx>
 #include <unotools/localedatawrapper.hxx>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <boost/property_tree/json_parser.hpp>
+#include <sfx2/lokhelper.hxx>
+#include <comphelper/lok.hxx>
 
 using namespace css;
 using namespace css::uno;
@@ -137,6 +140,49 @@ 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();
+
+    if (comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+    {
+        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 1d467bf988b3..00199541fd0b 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -50,6 +50,8 @@ public:
 
     SfxBindings* GetBindings() { return mpBindings;}
 
+    virtual boost::property_tree::ptree DumpAsPropertyTree() override;
+
     // constructor/destructor
     AlignmentPropertyPanel(
         vcl::Window* pParent,


More information about the Libreoffice-commits mailing list