diff options
Diffstat (limited to 'svl')
-rw-r--r-- | svl/qa/unit/items/test_IndexedStyleSheets.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/IndexedStyleSheets.cxx | 14 | ||||
-rw-r--r-- | svl/source/items/style.cxx | 15 |
3 files changed, 14 insertions, 19 deletions
diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx index 6afaca629565..a94572de7fc9 100644 --- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx +++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx @@ -176,10 +176,10 @@ void IndexedStyleSheetsTest::PositionCanBeQueriedByFamily() iss.AddStyleSheet(sheet2); iss.AddStyleSheet(sheet3); - const std::vector<sal_Int32>& v = iss.GetStyleSheetPositionsByFamily(SfxStyleFamily::Char); + const std::vector<SfxStyleSheetBase*>& v = iss.GetStyleSheetsByFamily(SfxStyleFamily::Char); CPPUNIT_ASSERT_EQUAL_MESSAGE("Separation by family works.", static_cast<size_t>(2), v.size()); - const std::vector<sal_Int32>& w = iss.GetStyleSheetPositionsByFamily(SfxStyleFamily::All); + const std::vector<SfxStyleSheetBase*>& w = iss.GetStyleSheetsByFamily(SfxStyleFamily::All); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wildcard works for family queries.", static_cast<size_t>(3), w.size()); } diff --git a/svl/source/items/IndexedStyleSheets.cxx b/svl/source/items/IndexedStyleSheets.cxx index a9ca6908695d..0c5f0f7cdafe 100644 --- a/svl/source/items/IndexedStyleSheets.cxx +++ b/svl/source/items/IndexedStyleSheets.cxx @@ -47,13 +47,13 @@ IndexedStyleSheets::IndexedStyleSheets() { } -void IndexedStyleSheets::Register(const SfxStyleSheetBase& style, sal_Int32 pos) +void IndexedStyleSheets::Register(SfxStyleSheetBase& style, sal_Int32 pos) { mPositionsByName.insert(std::make_pair(style.GetName(), pos)); size_t position = family_to_index(style.GetFamily()); - mStyleSheetPositionsByFamily.at(position).push_back(pos); + mStyleSheetsByFamily.at(position).push_back(&style); size_t positionForFamilyAll = family_to_index(SfxStyleFamily::All); - mStyleSheetPositionsByFamily.at(positionForFamilyAll).push_back(pos); + mStyleSheetsByFamily.at(positionForFamilyAll).push_back(&style); } void @@ -61,7 +61,7 @@ IndexedStyleSheets::Reindex() { mPositionsByName.clear(); for (size_t i = 0; i < NUMBER_OF_FAMILIES; i++) { - mStyleSheetPositionsByFamily[i].clear(); + mStyleSheetsByFamily[i].clear(); } sal_Int32 i = 0; @@ -222,11 +222,11 @@ IndexedStyleSheets::FindPositionsByPredicate(StyleSheetPredicate& predicate) con return r; } -const std::vector<sal_Int32>& -IndexedStyleSheets::GetStyleSheetPositionsByFamily(SfxStyleFamily e) const +const std::vector<SfxStyleSheetBase*>& +IndexedStyleSheets::GetStyleSheetsByFamily(SfxStyleFamily e) const { size_t position = family_to_index(e); - return mStyleSheetPositionsByFamily.at(position); + return mStyleSheetsByFamily.at(position); } } /* namespace svl */ diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 104cb793cc6d..0f208ad1cf26 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -415,7 +415,7 @@ sal_Int32 SfxStyleSheetIterator::Count() } else if(nMask == SfxStyleSearchBits::All) { - n = static_cast<sal_uInt16>(pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetPositionsByFamily(nSearchFamily).size()); + n = static_cast<sal_uInt16>(pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetsByFamily(nSearchFamily).size()); } else { @@ -435,11 +435,7 @@ SfxStyleSheetBase* SfxStyleSheetIterator::operator[](sal_Int32 nIdx) } else if(nMask == SfxStyleSearchBits::All) { - rtl::Reference< SfxStyleSheetBase > ref = - pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition( - pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetPositionsByFamily(nSearchFamily).at(nIdx)) - ; - retval = ref.get(); + retval = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetsByFamily(nSearchFamily).at(nIdx); mnCurrentPosition = nIdx; } else @@ -489,14 +485,13 @@ SfxStyleSheetBase* SfxStyleSheetIterator::Next() else if(nMask == SfxStyleSearchBits::All) { sal_Int32 newPosition = mnCurrentPosition + 1; - const std::vector<sal_Int32>& familyVector + const std::vector<SfxStyleSheetBase*>& familyVector = - pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetPositionsByFamily(nSearchFamily); + pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetsByFamily(nSearchFamily); if (static_cast<sal_Int32>(familyVector.size()) > newPosition) { mnCurrentPosition = newPosition; - sal_Int32 stylePosition = familyVector[newPosition]; - retval = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(stylePosition); + retval = familyVector[newPosition]; } } else |