[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sc/source

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Wed May 20 22:40:15 UTC 2020


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

New commits:
commit b716a4db9945a80e2218ce2eaa8877435cfccfb1
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 May 21 00:39:46 2020 +0200

    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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94514
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index e92edd6943ca..e69356709fa9 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -28,6 +28,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;
@@ -132,6 +135,49 @@ void AlignmentPropertyPanel::Initialize()
     mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount());
 }
 
+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::isMobilePhone(SfxLokHelper::getView()))
+    {
+        eraseNode(aTree, "textorientbox");
+    }
+
+    return aTree;
+}
+
 IMPL_LINK( AlignmentPropertyPanel, ReferenceEdgeHdl, Button*, pControl, void )
 {
     SvxRotateMode eMode;
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index 71c8d7efafd4..a405ecbe7fb2 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -53,6 +53,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