diff options
author | Noel Grandin <noel@peralex.com> | 2020-10-08 10:21:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-08 18:45:29 +0200 |
commit | 592ad72ae178bc9018354ab37224666293ecbe81 (patch) | |
tree | 60954e07087ff8ee053e29e62d72ec1c281caa04 | |
parent | 9b6fb8bf3d8e622bd2d013744a591ff32287d3de (diff) |
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 <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svl/IndexedStyleSheets.hxx | 28 | ||||
-rw-r--r-- | include/svl/style.hxx | 4 | ||||
-rw-r--r-- | sc/inc/styleuno.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/stlpool.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/styleuno.cxx | 4 | ||||
-rw-r--r-- | sd/source/core/stlpool.cxx | 6 | ||||
-rw-r--r-- | svl/qa/unit/items/test_IndexedStyleSheets.cxx | 24 | ||||
-rw-r--r-- | svl/source/items/IndexedStyleSheets.cxx | 43 | ||||
-rw-r--r-- | svl/source/items/style.cxx | 23 | ||||
-rw-r--r-- | sw/inc/docstyle.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 4 |
11 files changed, 69 insertions, 75 deletions
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<unsigned> + std::vector<sal_Int32> 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<unsigned> + std::vector<sal_Int32> 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<unsigned> + std::vector<sal_Int32> 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<unsigned>& + const std::vector<sal_Int32>& 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<rtl::Reference<SfxStyleSheetBase> > 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<std::vector<unsigned> > mStyleSheetPositionsByFamily; + std::vector<std::vector<sal_Int32>> 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); diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx index 529e776e30a0..b4f95f0b6214 100644 --- a/sc/inc/styleuno.hxx +++ b/sc/inc/styleuno.hxx @@ -110,7 +110,7 @@ private: ScDocShell* pDocShell; SfxStyleFamily eFamily; // Family - ScStyleObj* GetObjectByIndex_Impl(sal_uInt32 nIndex); + ScStyleObj* GetObjectByIndex_Impl(sal_Int32 nIndex); ScStyleObj* GetObjectByName_Impl(const OUString& Name); public: diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index f2f337e56bad..6a8fcd5f5663 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -412,7 +412,7 @@ struct CaseInsensitiveNamePredicate : svl::StyleSheetPredicate ScStyleSheet* ScStyleSheetPool::FindCaseIns( const OUString& rName, SfxStyleFamily eFam ) { CaseInsensitiveNamePredicate aPredicate(rName, eFam); - std::vector<unsigned> aFoundPositions = GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate); + std::vector<sal_Int32> aFoundPositions = GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate); for (const auto& rPos : aFoundPositions) { diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 5d5aa8b93fbf..15e2074ffe44 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -638,7 +638,7 @@ void ScStyleFamilyObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) // XStyleFamily -ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) +ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_Int32 nIndex) { if ( pDocShell ) { @@ -648,7 +648,7 @@ ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) SfxStyleSheetIterator aIter( pStylePool, eFamily ); if ( nIndex < aIter.Count() ) { - SfxStyleSheetBase* pStyle = aIter[static_cast<sal_uInt16>(nIndex)]; + SfxStyleSheetBase* pStyle = aIter[nIndex]; if ( pStyle ) { return new ScStyleObj( pDocShell, eFamily, pStyle->GetName() ); diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index a31e28461f3c..14b2c3fe1ec8 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -617,7 +617,7 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily // find all style sheets of the source pool which have the same family HasFamilyPredicate aHasFamilyPredicate(eFamily); - std::vector<unsigned> aSheetsWithFamily = rSourcePool.GetIndexedStyleSheets().FindPositionsByPredicate(aHasFamilyPredicate); + std::vector<sal_Int32> aSheetsWithFamily = rSourcePool.GetIndexedStyleSheets().FindPositionsByPredicate(aHasFamilyPredicate); for (const auto& rPos : aSheetsWithFamily) { @@ -627,7 +627,7 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily OUString aName( pSheet->GetName() ); // now check whether we already have a sheet with the same name - std::vector<unsigned> aSheetsWithName = GetIndexedStyleSheets().FindPositionsByName(aName); + std::vector<sal_Int32> aSheetsWithName = GetIndexedStyleSheets().FindPositionsByName(aName); bool bAddToList = false; SfxStyleSheetBase * pExistingSheet = nullptr; if (!aSheetsWithName.empty()) @@ -915,7 +915,7 @@ void SdStyleSheetPool::UpdateStdNames() OUString aHelpFile; StyleSheetIsUserDefinedPredicate aPredicate; std::vector<SfxStyleSheetBase*> aEraseList; - std::vector<unsigned> aUserDefinedStyles = GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate); + std::vector<sal_Int32> aUserDefinedStyles = GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate); for (const auto& rStyle : aUserDefinedStyles) { SfxStyleSheetBase* pStyle = GetStyleSheetByPositionInIndex(rStyle); diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx index 50fd4d1ed42c..5c12acc250a5 100644 --- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx +++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx @@ -91,9 +91,9 @@ void IndexedStyleSheetsTest::AddingSameStylesheetTwiceHasNoEffect() rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("sheet1")); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); - CPPUNIT_ASSERT_EQUAL(1u, iss.GetNumberOfStyleSheets()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), iss.GetNumberOfStyleSheets()); iss.AddStyleSheet(sheet1); - CPPUNIT_ASSERT_EQUAL(1u, iss.GetNumberOfStyleSheets()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), iss.GetNumberOfStyleSheets()); } void IndexedStyleSheetsTest::RemovedStyleSheetIsNotFound() @@ -114,9 +114,9 @@ void IndexedStyleSheetsTest::RemovingStyleSheetWhichIsNotAvailableHasNoEffect() rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet("sheet2")); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); - CPPUNIT_ASSERT_EQUAL(1u, iss.GetNumberOfStyleSheets()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), iss.GetNumberOfStyleSheets()); iss.RemoveStyleSheet(sheet2); - CPPUNIT_ASSERT_EQUAL(1u, iss.GetNumberOfStyleSheets()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), iss.GetNumberOfStyleSheets()); } void IndexedStyleSheetsTest::StyleSheetsCanBeRetrievedByTheirName() @@ -131,17 +131,17 @@ void IndexedStyleSheetsTest::StyleSheetsCanBeRetrievedByTheirName() iss.AddStyleSheet(sheet2); iss.AddStyleSheet(sheet3); - std::vector<unsigned> r = iss.FindPositionsByName(name1); + std::vector<sal_Int32> r = iss.FindPositionsByName(name1); CPPUNIT_ASSERT_EQUAL_MESSAGE("Two style sheets are found by 'name1'", 2u, static_cast<unsigned>(r.size())); std::sort (r.begin(), r.end()); - CPPUNIT_ASSERT_EQUAL(0u, r.at(0)); - CPPUNIT_ASSERT_EQUAL(2u, r.at(1)); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), r.at(0)); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), r.at(1)); r = iss.FindPositionsByName(name2); CPPUNIT_ASSERT_EQUAL_MESSAGE("One style sheets is found by 'name2'", 1u, static_cast<unsigned>(r.size())); - CPPUNIT_ASSERT_EQUAL(1u, r.at(0)); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), r.at(0)); } void IndexedStyleSheetsTest::KnowsThatItStoresAStyleSheet() @@ -176,10 +176,10 @@ void IndexedStyleSheetsTest::PositionCanBeQueriedByFamily() iss.AddStyleSheet(sheet2); iss.AddStyleSheet(sheet3); - const std::vector<unsigned>& v = iss.GetStyleSheetPositionsByFamily(SfxStyleFamily::Char); + const std::vector<sal_Int32>& v = iss.GetStyleSheetPositionsByFamily(SfxStyleFamily::Char); CPPUNIT_ASSERT_EQUAL_MESSAGE("Separation by family works.", static_cast<size_t>(2), v.size()); - const std::vector<unsigned>& w = iss.GetStyleSheetPositionsByFamily(SfxStyleFamily::All); + const std::vector<sal_Int32>& w = iss.GetStyleSheetPositionsByFamily(SfxStyleFamily::All); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wildcard works for family queries.", static_cast<size_t>(3), w.size()); } @@ -197,11 +197,11 @@ void IndexedStyleSheetsTest::OnlyOneStyleSheetIsReturnedWhenReturnFirstIsUsed() DummyPredicate predicate; // returns always true, i.e., all style sheets match the predicate. - std::vector<unsigned> v = iss.FindPositionsByNameAndPredicate(name, predicate, + std::vector<sal_Int32> v = iss.FindPositionsByNameAndPredicate(name, predicate, IndexedStyleSheets::SearchBehavior::ReturnFirst); CPPUNIT_ASSERT_EQUAL_MESSAGE("Only one style sheet is returned.", static_cast<size_t>(1), v.size()); - std::vector<unsigned> w = iss.FindPositionsByNameAndPredicate(name, predicate); + std::vector<sal_Int32> w = iss.FindPositionsByNameAndPredicate(name, predicate); CPPUNIT_ASSERT_EQUAL_MESSAGE("All style sheets are returned.", static_cast<size_t>(3), w.size()); } diff --git a/svl/source/items/IndexedStyleSheets.cxx b/svl/source/items/IndexedStyleSheets.cxx index 4d71e7e6ff95..57e2dddbf1c1 100644 --- a/svl/source/items/IndexedStyleSheets.cxx +++ b/svl/source/items/IndexedStyleSheets.cxx @@ -51,8 +51,7 @@ IndexedStyleSheets::IndexedStyleSheets() } ;} -void -IndexedStyleSheets::Register(const SfxStyleSheetBase& style, unsigned pos) +void IndexedStyleSheets::Register(const SfxStyleSheetBase& style, sal_Int32 pos) { mPositionsByName.insert(std::make_pair(style.GetName(), pos)); size_t position = family_to_index(style.GetFamily()); @@ -70,7 +69,7 @@ IndexedStyleSheets::Reindex() mStyleSheetPositionsByFamily.emplace_back(); } - unsigned i = 0; + sal_Int32 i = 0; for (const auto& rxStyleSheet : mStyleSheets) { SfxStyleSheetBase* p = rxStyleSheet.get(); Register(*p, i); @@ -78,8 +77,7 @@ IndexedStyleSheets::Reindex() } } -unsigned -IndexedStyleSheets::GetNumberOfStyleSheets() const +sal_Int32 IndexedStyleSheets::GetNumberOfStyleSheets() const { return mStyleSheets.size(); } @@ -100,7 +98,7 @@ IndexedStyleSheets::RemoveStyleSheet(const rtl::Reference< SfxStyleSheetBase >& std::pair<MapType::const_iterator, MapType::const_iterator> range = mPositionsByName.equal_range(style->GetName()); for (MapType::const_iterator it = range.first; it != range.second; ++it) { - unsigned pos = it->second; + sal_Int32 pos = it->second; if (mStyleSheets.at(pos) == style) { mStyleSheets.erase(mStyleSheets.begin() + pos); @@ -111,10 +109,9 @@ IndexedStyleSheets::RemoveStyleSheet(const rtl::Reference< SfxStyleSheetBase >& return false; } -std::vector<unsigned> -IndexedStyleSheets::FindPositionsByName(const OUString& name) const +std::vector<sal_Int32> IndexedStyleSheets::FindPositionsByName(const OUString& name) const { - std::vector<unsigned> r; + std::vector<sal_Int32> r; std::pair<MapType::const_iterator, MapType::const_iterator> range = mPositionsByName.equal_range(name); for (MapType::const_iterator it = range.first; it != range.second; ++it) { r.push_back(it->second); @@ -122,14 +119,13 @@ IndexedStyleSheets::FindPositionsByName(const OUString& name) const return r; } -std::vector<unsigned> -IndexedStyleSheets::FindPositionsByNameAndPredicate(const OUString& name, +std::vector<sal_Int32> IndexedStyleSheets::FindPositionsByNameAndPredicate(const OUString& name, StyleSheetPredicate& predicate, SearchBehavior behavior) const { - std::vector<unsigned> r; + std::vector<sal_Int32> r; auto range = mPositionsByName.equal_range(name); for (auto it = range.first; it != range.second; ++it) { - unsigned pos = it->second; + sal_Int32 pos = it->second; SfxStyleSheetBase *ssheet = mStyleSheets.at(pos).get(); if (predicate.Check(*ssheet)) { r.push_back(pos); @@ -142,7 +138,7 @@ IndexedStyleSheets::FindPositionsByNameAndPredicate(const OUString& name, } -unsigned +sal_Int32 IndexedStyleSheets::GetNumberOfStyleSheetsWithPredicate(StyleSheetPredicate& predicate) const { return std::count_if(mStyleSheets.begin(), mStyleSheets.end(), @@ -154,12 +150,12 @@ IndexedStyleSheets::GetNumberOfStyleSheetsWithPredicate(StyleSheetPredicate& pre SfxStyleSheetBase* IndexedStyleSheets::GetNthStyleSheetThatMatchesPredicate( - unsigned n, + sal_Int32 n, StyleSheetPredicate& predicate, - unsigned startAt) + sal_Int32 startAt) { SfxStyleSheetBase* retval = nullptr; - unsigned matching = 0; + sal_Int32 matching = 0; for (VectorType::const_iterator it = mStyleSheets.begin()+startAt; it != mStyleSheets.end(); ++it) { SfxStyleSheetBase *ssheet = it->get(); if (predicate.Check(*ssheet)) { @@ -173,8 +169,7 @@ IndexedStyleSheets::GetNthStyleSheetThatMatchesPredicate( return retval; } -unsigned -IndexedStyleSheets::FindStyleSheetPosition(const SfxStyleSheetBase& style) const +sal_Int32 IndexedStyleSheets::FindStyleSheetPosition(const SfxStyleSheetBase& style) const { VectorType::const_iterator it = std::find(mStyleSheets.begin(), mStyleSheets.end(), &style); if (it == mStyleSheets.end()) { @@ -210,9 +205,9 @@ IndexedStyleSheets::HasStyleSheet(const rtl::Reference< SfxStyleSheetBase >& sty } SfxStyleSheetBase* -IndexedStyleSheets::GetStyleSheetByPosition(unsigned pos) +IndexedStyleSheets::GetStyleSheetByPosition(sal_Int32 pos) { - if( pos < mStyleSheets.size() ) + if( pos < static_cast<sal_Int32>(mStyleSheets.size()) ) return mStyleSheets.at(pos).get(); return nullptr; } @@ -225,10 +220,10 @@ IndexedStyleSheets::ApplyToAllStyleSheets(StyleSheetCallback& callback) const } } -std::vector<unsigned> +std::vector<sal_Int32> IndexedStyleSheets::FindPositionsByPredicate(StyleSheetPredicate& predicate) const { - std::vector<unsigned> r; + std::vector<sal_Int32> r; for (VectorType::const_iterator it = mStyleSheets.begin(); it != mStyleSheets.end(); ++it) { if (predicate.Check(**it)) { r.push_back(std::distance(mStyleSheets.begin(), it)); @@ -237,7 +232,7 @@ IndexedStyleSheets::FindPositionsByPredicate(StyleSheetPredicate& predicate) con return r; } -const std::vector<unsigned>& +const std::vector<sal_Int32>& IndexedStyleSheets::GetStyleSheetPositionsByFamily(SfxStyleFamily e) const { size_t position = family_to_index(e); diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index e6606c82bdfa..8ef014755874 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -408,9 +408,9 @@ SfxStyleSheetIterator::~SfxStyleSheetIterator() { } -sal_uInt16 SfxStyleSheetIterator::Count() +sal_Int32 SfxStyleSheetIterator::Count() { - sal_uInt16 n = 0; + sal_Int32 n = 0; if( IsTrivialSearch()) { n = static_cast<sal_uInt16>(pBasePool->pImpl->mxIndexedStyleSheets->GetNumberOfStyleSheets()); @@ -427,7 +427,7 @@ sal_uInt16 SfxStyleSheetIterator::Count() return n; } -SfxStyleSheetBase* SfxStyleSheetIterator::operator[](sal_uInt16 nIdx) +SfxStyleSheetBase* SfxStyleSheetIterator::operator[](sal_Int32 nIdx) { SfxStyleSheetBase* retval = nullptr; if( IsTrivialSearch()) @@ -480,8 +480,8 @@ SfxStyleSheetBase* SfxStyleSheetIterator::Next() if ( IsTrivialSearch() ) { - unsigned nStyleSheets = pBasePool->pImpl->mxIndexedStyleSheets->GetNumberOfStyleSheets(); - unsigned newPosition = nCurrentPosition +1; + sal_Int32 nStyleSheets = pBasePool->pImpl->mxIndexedStyleSheets->GetNumberOfStyleSheets(); + sal_Int32 newPosition = nCurrentPosition + 1; if (nStyleSheets > newPosition) { nCurrentPosition = newPosition; @@ -490,13 +490,14 @@ SfxStyleSheetBase* SfxStyleSheetIterator::Next() } else if(nMask == SfxStyleSearchBits::All) { - unsigned newPosition = nCurrentPosition +1; - const std::vector<unsigned>& familyVector = + sal_Int32 newPosition = nCurrentPosition + 1; + const std::vector<sal_Int32>& familyVector + = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetPositionsByFamily(nSearchFamily); - if (familyVector.size() > newPosition) + if (static_cast<sal_Int32>(familyVector.size()) > newPosition) { nCurrentPosition = newPosition; - unsigned stylePosition = familyVector[newPosition]; + sal_Int32 stylePosition = familyVector[newPosition]; retval = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(stylePosition); } } @@ -519,14 +520,14 @@ SfxStyleSheetBase* SfxStyleSheetIterator::Find(const OUString& rStr) { DoesStyleMatchStyleSheetPredicate predicate(this); - std::vector<unsigned> positions = + std::vector<sal_Int32> positions = pBasePool->pImpl->mxIndexedStyleSheets->FindPositionsByNameAndPredicate(rStr, predicate, svl::IndexedStyleSheets::SearchBehavior::ReturnFirst); if (positions.empty()) { return nullptr; } - unsigned pos = positions.front(); + sal_Int32 pos = positions.front(); SfxStyleSheetBase* pStyle = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(pos); nCurrentPosition = pos; pCurrentStyle = pStyle; diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 229ed37e0e32..8e79ee930a30 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -179,8 +179,8 @@ public: SfxStyleFamily eFam, SfxStyleSearchBits n); virtual ~SwStyleSheetIterator() override; - virtual sal_uInt16 Count() override; - virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx) override; + virtual sal_Int32 Count() override; + virtual SfxStyleSheetBase *operator[](sal_Int32 nIdx) override; virtual SfxStyleSheetBase* First() override; virtual SfxStyleSheetBase* Next() override; virtual SfxStyleSheetBase* Find(const OUString& rStr) override; diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 9dc426bc1d51..9f594d1ceada 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2664,7 +2664,7 @@ SwStyleSheetIterator::~SwStyleSheetIterator() EndListening( *mxIterSheet->GetPool() ); } -sal_uInt16 SwStyleSheetIterator::Count() +sal_Int32 SwStyleSheetIterator::Count() { // let the list fill correctly!! if( !bFirstCalled ) @@ -2672,7 +2672,7 @@ sal_uInt16 SwStyleSheetIterator::Count() return aLst.size(); } -SfxStyleSheetBase* SwStyleSheetIterator::operator[]( sal_uInt16 nIdx ) +SfxStyleSheetBase* SwStyleSheetIterator::operator[]( sal_Int32 nIdx ) { // found if( !bFirstCalled ) |