20const size_t NUMBER_OF_FAMILIES = 7;
49 for (
size_t i = 0;
i < NUMBER_OF_FAMILIES;
i++) {
68 for (
size_t i = 0;
i < NUMBER_OF_FAMILIES;
i++) {
98 std::pair<MapType::const_iterator, MapType::const_iterator> range =
mPositionsByName.equal_range(style->GetName());
99 for (MapType::const_iterator it = range.first; it != range.second; ++it)
101 sal_Int32
pos = it->second;
114 std::vector<sal_Int32> r;
115 std::pair<MapType::const_iterator, MapType::const_iterator> range =
mPositionsByName.equal_range(
name);
116 for (MapType::const_iterator it = range.first; it != range.second; ++it) {
117 r.push_back(it->second);
125 std::vector<sal_Int32> r;
127 for (
auto it = range.first; it != range.second; ++it) {
128 sal_Int32
pos = it->second;
130 if (predicate.
Check(*ssheet)) {
146 const SfxStyleSheetBase *ssheet = rxStyleSheet.get();
147 return predicate.Check(*ssheet);
158 sal_Int32 matching = 0;
161 if (predicate.
Check(*ssheet)) {
176 throw std::runtime_error(
"IndexedStyleSheets::FindStylePosition Looked for style not in index");
185 disposer.
Dispose(rxStyleSheet);
198 std::pair<MapType::const_iterator, MapType::const_iterator> range =
mPositionsByName.equal_range(style->GetName());
199 for (MapType::const_iterator it = range.first; it != range.second; ++it)
219 callback.
DoIt(*rxStyleSheet);
223std::vector<sal_Int32>
226 std::vector<sal_Int32> r;
228 if (predicate.
Check(**it)) {
235const std::vector<sal_Int32>&
238 size_t position = family_to_index(e);
const OUString & GetName() const
SfxStyleFamily GetFamily() const
bool RemoveStyleSheet(const rtl::Reference< SfxStyleSheetBase > &style)
Removes a style sheet.
void AddStyleSheet(const rtl::Reference< SfxStyleSheetBase > &style)
Adds a style sheet.
sal_Int32 FindStyleSheetPosition(const SfxStyleSheetBase &style) const
Find the position of a provided style.
SfxStyleSheetBase * GetStyleSheetByPosition(sal_Int32 pos)
Return the stylesheet by its position.
void ApplyToAllStyleSheets(StyleSheetCallback &callback) const
Execute a callback on all style sheets.
MapType mPositionsByName
A map which stores the positions of style sheets by their name.
VectorType mStyleSheets
Vector with the stylesheets to allow for index-based access.
void Clear(StyleSheetDisposer &cleanup)
Clear the contents of the index.
~IndexedStyleSheets()
Destructor.
const std::vector< sal_Int32 > & GetStyleSheetPositionsByFamily(SfxStyleFamily) const
Get the positions of the style sheets which belong to a certain family.
SfxStyleSheetBase * GetNthStyleSheetThatMatchesPredicate(sal_Int32 n, StyleSheetPredicate &predicate, sal_Int32 startAt=0)
Warning: counting for n starts at 0, i.e., the 0th style sheet is the first that is found.
sal_Int32 GetNumberOfStyleSheets() const
Obtain the number of style sheets which are held.
std::vector< sal_Int32 > FindPositionsByName(const OUString &name) const
Obtain the positions of all styles which have a given name.
std::vector< std::vector< sal_Int32 > > mStyleSheetPositionsByFamily
void Register(const SfxStyleSheetBase &style, sal_Int32 pos)
Register the position of a styleName in the index.
std::vector< sal_Int32 > FindPositionsByPredicate(StyleSheetPredicate &predicate) const
Obtain the positions of all styles which fulfill a certain condition.
sal_Int32 GetNumberOfStyleSheetsWithPredicate(StyleSheetPredicate &predicate) const
Obtain the number of style sheets for which a certain condition holds.
std::vector< sal_Int32 > FindPositionsByNameAndPredicate(const OUString &name, StyleSheetPredicate &predicate, SearchBehavior behavior=SearchBehavior::ReturnAll) const
Obtain the positions of all styles which have a certain name and fulfill a certain condition.
bool HasStyleSheet(const rtl::Reference< SfxStyleSheetBase > &style) const
Check whether a specified style sheet is stored.
Function object to apply a method on all style sheets.
virtual void DoIt(const SfxStyleSheetBase &styleSheet)=0
Function object for cleanup-Strategy for IndexedSfxStyleSheets::Clear().
virtual void Dispose(rtl::Reference< SfxStyleSheetBase > styleSheet)=0
Function object to check whether a style sheet a fulfills specific criteria.
virtual bool Check(const SfxStyleSheetBase &styleSheet)=0