[Libreoffice-commits] core.git: include/vcl sw/source
Caolán McNamara
caolanm at redhat.com
Fri Sep 4 06:54:53 PDT 2015
include/vcl/lstbox.hxx | 2 ++
sw/source/uibase/inc/swcont.hxx | 25 +++++++++++++------------
2 files changed, 15 insertions(+), 12 deletions(-)
New commits:
commit b14cdcbf6834461f6f079c153fc7d32402c28236
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Sep 4 13:51:18 2015 +0100
natural sort contents of writer navigator
i.e. graphic1, graphic2, graphic10
not
i.e. graphic1, graphic10, graphic2
Change-Id: Ic8596144b594a933cb1366e29d3c45a4c90d7d07
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 21b78bc..92072a0 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -236,6 +236,8 @@ public:
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
void EnableQuickSelection( const bool& b );
+
+ static sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB);
};
diff --git a/sw/source/uibase/inc/swcont.hxx b/sw/source/uibase/inc/swcont.hxx
index c36fb85..836e0db 100644
--- a/sw/source/uibase/inc/swcont.hxx
+++ b/sw/source/uibase/inc/swcont.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SW_SOURCE_UIBASE_INC_SWCONT_HXX
#include <rtl/ustring.hxx>
+#include <vcl/lstbox.hxx>
class SwContentType;
@@ -72,18 +73,18 @@ public:
virtual bool IsProtect() const;
const SwContentType* GetParent() const {return pParent;}
const OUString& GetName() const {return sContentName;}
- bool operator==(const SwContent& /*rCont*/) const
- {
- // they're never equal, otherwise they'd fall out of the array
- return false;
- }
- bool operator<(const SwContent& rCont) const
- {
- // at first sort by position and then by name
- return nYPosition != rCont.nYPosition ?
- nYPosition < rCont.nYPosition :
- sContentName < rCont.sContentName;
- }
+ bool operator==(const SwContent& /*rCont*/) const
+ {
+ // they're never equal, otherwise they'd fall out of the array
+ return false;
+ }
+ bool operator<(const SwContent& rCont) const
+ {
+ // at first sort by position and then by name
+ if (nYPosition != rCont.nYPosition)
+ return nYPosition < rCont.nYPosition;
+ return ListBox::NaturalSortCompare(sContentName, rCont.sContentName) < 0;
+ }
long GetYPos() const {return nYPosition;}
More information about the Libreoffice-commits
mailing list