1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SVL_STYLEPOOL_HXX
20 #define INCLUDED_SVL_STYLEPOOL_HXX
23 #include <rtl/ustring.hxx>
24 #include <svl/itemset.hxx>
27 class IStylePoolIteratorAccess
;
29 class SVL_DLLPUBLIC StylePool final
32 std::unique_ptr
<StylePoolImpl
> pImpl
;
34 explicit StylePool( SfxItemSet
const * pIgnorableItems
= nullptr );
36 /** Insert a SfxItemSet into the style pool.
38 The pool makes a copy of the provided SfxItemSet.
41 the SfxItemSet to insert
44 Name of the parent of rSet. If set, createIterator() can be more deterministic by iterating
45 over item sets ordered by parent names.
47 @return a shared pointer to the SfxItemSet
49 std::shared_ptr
<SfxItemSet
> insertItemSet( const SfxItemSet
& rSet
, const OUString
* pParentName
= nullptr );
51 /** Create an iterator
53 The iterator walks through the StylePool
54 OD 2008-03-07 #i86923#
55 introduce optional parameter to control, if unused SfxItemsSet are skipped or not
56 introduce optional parameter to control, if ignorable items are skipped or not
58 @attention every change, e.g. destruction, of the StylePool could cause undefined effects.
60 @param bSkipUnusedItemSets
61 input parameter - boolean, indicating if unused SfxItemSets are skipped or not
63 @param bSkipIgnorableItems
64 input parameter - boolean, indicating if ignorable items are skipped or not
66 @postcond the iterator "points before the first" SfxItemSet of the pool.
67 The first StylePoolIterator::getNext() call will deliver the first SfxItemSet.
69 std::unique_ptr
<IStylePoolIteratorAccess
> createIterator( const bool bSkipUnusedItemSets
= false,
70 const bool bSkipIgnorableItems
= false );
74 static OUString
nameOf( const std::shared_ptr
<SfxItemSet
>& pSet
);
77 class SVL_DLLPUBLIC IStylePoolIteratorAccess
80 /** Delivers a shared pointer to the next SfxItemSet of the pool
81 If there is no more SfxItemSet, the delivered share_pointer is empty.
83 virtual std::shared_ptr
<SfxItemSet
> getNext() = 0;
84 virtual ~IStylePoolIteratorAccess() {};
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */