sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   25 ++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit 6e86f77da5cf66c832f785a7f4eb806a3fdc26c6
Author:     Shivam Kumar Singh <shivamhere...@gmail.com>
AuthorDate: Thu Jul 23 23:09:11 2020 +0530
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jul 24 13:42:27 2020 +0200

    tdf#135038 Sort attributes in Styles Inspector
    
    Change-Id: I49cbfcec280af26b34c956b270277c4f3409c777
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99335
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index a6faa29f7290..8dbf36c07188 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -31,6 +31,10 @@
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 
 #include <unotextrange.hxx>
+#include <comphelper/string.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <vcl/settings.hxx>
 
 namespace sw::sidebar
 {
@@ -59,6 +63,10 @@ 
WriterInspectorTextPanel::WriterInspectorTextPanel(vcl::Window* pParent,
 
 static void UpdateTree(SwDocShell* pDocSh, 
std::vector<svx::sidebar::TreeNode>& aStore)
 {
+    const comphelper::string::NaturalStringSorter aSorter(
+        comphelper::getProcessComponentContext(),
+        Application::GetSettings().GetUILanguageTag().getLocale());
+
     SwDoc* pDoc = pDocSh->GetDoc();
     SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
     svx::sidebar::TreeNode aDFNode;
@@ -94,6 +102,11 @@ static void UpdateTree(SwDocShell* pDocSh, 
std::vector<svx::sidebar::TreeNode>&
             aDFNode.children.push_back(aTemp);
         }
     }
+    std::sort(
+        aDFNode.children.begin(), aDFNode.children.end(),
+        [&aSorter](svx::sidebar::TreeNode const& rEntry1, 
svx::sidebar::TreeNode const& rEntry2) {
+            return aSorter.compare(rEntry1.sNodeName, rEntry2.sNodeName) < 0;
+        });
 
     uno::Reference<style::XStyleFamiliesSupplier> 
xStyleFamiliesSupplier(pDocSh->GetBaseModel(),
                                                                          
uno::UNO_QUERY);
@@ -132,6 +145,12 @@ static void UpdateTree(SwDocShell* pDocSh, 
std::vector<svx::sidebar::TreeNode>&
             }
         }
 
+        std::sort(aCurrentChild.children.begin(), aCurrentChild.children.end(),
+                  [&aSorter](svx::sidebar::TreeNode const& rEntry1,
+                             svx::sidebar::TreeNode const& rEntry2) {
+                      return aSorter.compare(rEntry1.sNodeName, 
rEntry2.sNodeName) < 0;
+                  });
+
         aCharNode.children.push_back(aCurrentChild);
     }
 
@@ -169,6 +188,12 @@ static void UpdateTree(SwDocShell* pDocSh, 
std::vector<svx::sidebar::TreeNode>&
             }
         }
 
+        std::sort(aCurrentChild.children.begin(), aCurrentChild.children.end(),
+                  [&aSorter](svx::sidebar::TreeNode const& rEntry1,
+                             svx::sidebar::TreeNode const& rEntry2) {
+                      return aSorter.compare(rEntry1.sNodeName, 
rEntry2.sNodeName) < 0;
+                  });
+
         aParaNode.children.push_back(aCurrentChild);
         sCurrentParaStyle = aParentParaStyle;
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to