From 592ad72ae178bc9018354ab37224666293ecbe81 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 8 Oct 2020 10:21:09 +0200 Subject: use sal_Int32 for style-sheet index instead of a mix of unsigned and sal_uInt16. Change-Id: Ice56d58d22856daa6645577610368ba19a849176 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104076 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/svl/IndexedStyleSheets.hxx | 28 +++++++++++++--------------- include/svl/style.hxx | 4 ++-- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'include/svl') diff --git a/include/svl/IndexedStyleSheets.hxx b/include/svl/IndexedStyleSheets.hxx index 72c87f0ba40b..2393073af04b 100644 --- a/include/svl/IndexedStyleSheets.hxx +++ b/include/svl/IndexedStyleSheets.hxx @@ -93,11 +93,11 @@ public: HasStyleSheet(const rtl::Reference< SfxStyleSheetBase >& style) const; /** Obtain the number of style sheets which are held */ - unsigned + sal_Int32 GetNumberOfStyleSheets() const; /** Obtain the number of style sheets for which a certain condition holds */ - unsigned + sal_Int32 GetNumberOfStyleSheetsWithPredicate(StyleSheetPredicate& predicate) const; /** Return the stylesheet by its position. @@ -105,19 +105,18 @@ public: * @internal * Method is not const because the returned style sheet is not const */ - SfxStyleSheetBase* - GetStyleSheetByPosition(unsigned pos); + SfxStyleSheetBase* GetStyleSheetByPosition(sal_Int32 pos); /** Find the position of a provided style. * * @throws std::runtime_error if the style has not been found. */ - unsigned + sal_Int32 FindStyleSheetPosition(const SfxStyleSheetBase& style) const; /** Obtain the positions of all styles which have a given name */ - std::vector + std::vector FindPositionsByName(const OUString& name) const; enum class SearchBehavior { ReturnAll, ReturnFirst }; @@ -125,7 +124,7 @@ public: * * This method is fast because it can use the name-based index */ - std::vector + std::vector FindPositionsByNameAndPredicate(const OUString& name, StyleSheetPredicate& predicate, SearchBehavior behavior = SearchBehavior::ReturnAll) const; @@ -133,7 +132,7 @@ public: * * This method is slow because it cannot use the name-based index */ - std::vector + std::vector FindPositionsByPredicate(StyleSheetPredicate& predicate) const; /** Execute a callback on all style sheets */ @@ -151,19 +150,18 @@ public: Reindex(); /** Warning: counting for n starts at 0, i.e., the 0th style sheet is the first that is found. */ - SfxStyleSheetBase* - GetNthStyleSheetThatMatchesPredicate(unsigned n, StyleSheetPredicate& predicate, - unsigned startAt = 0); + SfxStyleSheetBase* GetNthStyleSheetThatMatchesPredicate(sal_Int32 n, + StyleSheetPredicate& predicate, + sal_Int32 startAt = 0); /** Get the positions of the style sheets which belong to a certain family. */ - const std::vector& + const std::vector& GetStyleSheetPositionsByFamily(SfxStyleFamily) const; private: /** Register the position of a styleName in the index */ - void - Register(const SfxStyleSheetBase& style, unsigned pos); + void Register(const SfxStyleSheetBase& style, sal_Int32 pos); typedef std::vector > VectorType; /** Vector with the stylesheets to allow for index-based access. @@ -179,7 +177,7 @@ private: /** A map which stores the positions of style sheets by their name */ MapType mPositionsByName; - std::vector > mStyleSheetPositionsByFamily; + std::vector> mStyleSheetPositionsByFamily; }; } /* namespace svl */ diff --git a/include/svl/style.hxx b/include/svl/style.hxx index ea2efab759f4..85f3934db783 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -195,8 +195,8 @@ public: SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ); SfxStyleSearchBits GetSearchMask() const; SfxStyleFamily GetSearchFamily() const; - virtual sal_uInt16 Count(); - virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx); + virtual sal_Int32 Count(); + virtual SfxStyleSheetBase *operator[](sal_Int32 nIdx); virtual SfxStyleSheetBase* First(); virtual SfxStyleSheetBase* Next(); virtual SfxStyleSheetBase* Find(const OUString& rStr); -- cgit