summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-03-08 15:56:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-08 17:56:56 +0100
commit6441778b61d1c6737947551e55d2c27e79260142 (patch)
tree14e96f8f46a5772d3274b548c3c9296c34418a9f
parent02f88f45e681beacf611f7c20f7903916b7e7374 (diff)
tdf#158773 reduce size of IndexedStyleSheets
we don't need to store SfxStyleFamily::All in the mStyleSheetsByFamily array, the call sites just iterate over the main vector for that case. Change-Id: I17fca2aa59e786d6dee13c884dedb9fde847b979 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svl/IndexedStyleSheets.hxx2
-rw-r--r--svl/qa/unit/items/test_IndexedStyleSheets.cxx4
-rw-r--r--svl/source/items/IndexedStyleSheets.cxx4
3 files changed, 3 insertions, 7 deletions
diff --git a/include/svl/IndexedStyleSheets.hxx b/include/svl/IndexedStyleSheets.hxx
index 1a76604bd972..1734c7248e04 100644
--- a/include/svl/IndexedStyleSheets.hxx
+++ b/include/svl/IndexedStyleSheets.hxx
@@ -173,7 +173,7 @@ private:
/** A map which stores the positions of style sheets by their name */
MapType mPositionsByName;
- static constexpr size_t NUMBER_OF_FAMILIES = 7;
+ static constexpr size_t NUMBER_OF_FAMILIES = 6;
std::array<std::vector<SfxStyleSheetBase*>, NUMBER_OF_FAMILIES> mStyleSheetsByFamily;
};
diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx
index a94572de7fc9..314ce263ecd7 100644
--- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx
+++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx
@@ -179,8 +179,8 @@ void IndexedStyleSheetsTest::PositionCanBeQueriedByFamily()
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<SfxStyleSheetBase*>& w = iss.GetStyleSheetsByFamily(SfxStyleFamily::All);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Wildcard works for family queries.", static_cast<size_t>(3), w.size());
+ const std::vector<SfxStyleSheetBase*>& w = iss.GetStyleSheetsByFamily(SfxStyleFamily::Para);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wildcard works for family queries.", static_cast<size_t>(1), w.size());
}
void IndexedStyleSheetsTest::OnlyOneStyleSheetIsReturnedWhenReturnFirstIsUsed()
diff --git a/svl/source/items/IndexedStyleSheets.cxx b/svl/source/items/IndexedStyleSheets.cxx
index 0c5f0f7cdafe..351e56425036 100644
--- a/svl/source/items/IndexedStyleSheets.cxx
+++ b/svl/source/items/IndexedStyleSheets.cxx
@@ -32,8 +32,6 @@ size_t family_to_index(SfxStyleFamily family)
return 4;
case SfxStyleFamily::Table:
return 5;
- case SfxStyleFamily::All:
- return 6;
default: break;
}
assert(false); // only for compiler warning. all cases are handled in the switch
@@ -52,8 +50,6 @@ void IndexedStyleSheets::Register(SfxStyleSheetBase& style, sal_Int32 pos)
mPositionsByName.insert(std::make_pair(style.GetName(), pos));
size_t position = family_to_index(style.GetFamily());
mStyleSheetsByFamily.at(position).push_back(&style);
- size_t positionForFamilyAll = family_to_index(SfxStyleFamily::All);
- mStyleSheetsByFamily.at(positionForFamilyAll).push_back(&style);
}
void