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

New commits:
commit 70321a866ce3be1eeea1037a4f688db759c115b2
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Feb 25 15:58:06 2020 -0400
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Feb 26 15:28:43 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/+/89479
    Tested-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx 
b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 6955fa47d2b5..68760df7c81d 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -29,6 +29,8 @@
 #include <svx/dlgutil.hxx>
 #include <vcl/toolbox.hxx>
 #include <svx/sidebar/SidebarDialControl.hxx>
+#include <sfx2/lokhelper.hxx>
+#include <comphelper/lok.hxx>
 
 using namespace css;
 using namespace css::uno;
@@ -133,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::isMobile(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 9df3f424d885..86c37c3cb57a 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -60,6 +60,8 @@ public:
 
     SfxBindings* GetBindings() { return mpBindings;}
 
+    virtual boost::property_tree::ptree DumpAsPropertyTree() override;
+
     // constructor/destructor
     AlignmentPropertyPanel(
         vcl::Window* pParent,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to