diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-13 15:21:53 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-02-13 20:55:28 +0100 |
commit | 8eab16d46f0c70cf9f7afb307ab4a56c49919ac4 (patch) | |
tree | f5934147b117f92d58892df2d66988df101d8b2b | |
parent | c32a61b8d4461f4c936f7ea0f07624e1286f29bf (diff) |
extract NaturalSortCompare from ListBox
Change-Id: I260c83778aea06eba9ae774739c6dc31fe5366d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88613
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/vcl/lstbox.hxx | 2 | ||||
-rw-r--r-- | include/vcl/naturalsort.hxx | 19 | ||||
-rw-r--r-- | sw/inc/pch/precompiled_sw.hxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/inc/swcont.hxx | 4 | ||||
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 4 |
6 files changed, 31 insertions, 13 deletions
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index 3cf7d2d958b6..f002c7d14f32 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -276,8 +276,6 @@ public: void EnableQuickSelection( bool b ); - static sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB); - virtual FactoryFunction GetUITestFactory() const override; virtual boost::property_tree::ptree DumpAsPropertyTree() override; diff --git a/include/vcl/naturalsort.hxx b/include/vcl/naturalsort.hxx new file mode 100644 index 000000000000..852c8472b68f --- /dev/null +++ b/include/vcl/naturalsort.hxx @@ -0,0 +1,19 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <vcl/dllapi.h> + +namespace vcl +{ +VCL_DLLPUBLIC sal_Int32 NaturalSortCompare(const OUString& rA, const OUString& rB); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 218f9873a2d4..c9c519136b7e 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-02-05 21:00:03 using: + Generated on 2020-02-13 15:23:10 using: ./bin/update_pch sw sw --cutoff=7 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -68,9 +68,6 @@ #include <rtl/math.hxx> #include <rtl/ref.hxx> #include <rtl/strbuf.hxx> -#include <rtl/string.h> -#include <rtl/stringconcat.hxx> -#include <rtl/stringutils.hxx> #include <rtl/tencinfo.h> #include <rtl/textenc.h> #include <rtl/unload.h> diff --git a/sw/source/uibase/inc/swcont.hxx b/sw/source/uibase/inc/swcont.hxx index f116935d2edf..fb2d0a9d4b79 100644 --- a/sw/source/uibase/inc/swcont.hxx +++ b/sw/source/uibase/inc/swcont.hxx @@ -21,7 +21,7 @@ #define INCLUDED_SW_SOURCE_UIBASE_INC_SWCONT_HXX #include <rtl/ustring.hxx> -#include <vcl/lstbox.hxx> +#include <vcl/naturalsort.hxx> class SwContentType; @@ -92,7 +92,7 @@ public: // at first sort by position and then by name if (nYPosition != rCont.nYPosition) return nYPosition < rCont.nYPosition; - return ListBox::NaturalSortCompare(sContentName, rCont.sContentName) < 0; + return vcl::NaturalSortCompare(sContentName, rCont.sContentName) < 0; } bool IsInvisible() const {return bInvisible;} diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index c1ad5e82dae1..c4486f9262a0 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -25,6 +25,7 @@ #include <vcl/scrbar.hxx> #include <vcl/lstbox.hxx> #include <vcl/i18nhelp.hxx> +#include <vcl/naturalsort.hxx> #include <listbox.hxx> #include <controldata.hxx> @@ -110,10 +111,13 @@ namespace }; } -sal_Int32 ListBox::NaturalSortCompare(const OUString &rA, const OUString &rB) +namespace vcl { - const comphelper::string::NaturalStringSorter &rSorter = theSorter::get(); - return rSorter.compare(rA, rB); + sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB) + { + const comphelper::string::NaturalStringSorter &rSorter = theSorter::get(); + return rSorter.compare(rA, rB); + } } sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort ) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 68bf33771b8c..2870f7ada6e3 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -23,7 +23,7 @@ #include <bitmaps.hlst> #include <vcl/commandevent.hxx> -#include <vcl/lstbox.hxx> +#include <vcl/naturalsort.hxx> #include <vcl/print.hxx> #include <vcl/wall.hxx> #include <vcl/decoview.hxx> @@ -57,7 +57,7 @@ enum namespace { bool lcl_ListBoxCompare( const OUString& rStr1, const OUString& rStr2 ) { - return ListBox::NaturalSortCompare( rStr1, rStr2 ) < 0; + return vcl::NaturalSortCompare( rStr1, rStr2 ) < 0; } } |