Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SVL_STYLEPOOL_HXX
20 : #define INCLUDED_SVL_STYLEPOOL_HXX
21 :
22 : #include <memory>
23 : #include <rtl/ustring.hxx>
24 : #include <svl/itemset.hxx>
25 :
26 : class StylePoolImpl;
27 : class IStylePoolIteratorAccess;
28 :
29 : class SVL_DLLPUBLIC StylePool
30 : {
31 : private:
32 : StylePoolImpl *pImpl;
33 : public:
34 : typedef std::shared_ptr<SfxItemSet> SfxItemSet_Pointer_t;
35 :
36 : explicit StylePool( SfxItemSet* pIgnorableItems = 0 );
37 :
38 : /** Insert a SfxItemSet into the style pool.
39 :
40 : The pool makes a copy of the provided SfxItemSet.
41 :
42 : @param SfxItemSet
43 : the SfxItemSet to insert
44 :
45 : @return a shared pointer to the SfxItemSet
46 : */
47 : SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet );
48 :
49 : /** Create an iterator
50 :
51 : The iterator walks through the StylePool
52 : OD 2008-03-07 #i86923#
53 : introduce optional parameter to control, if unused SfxItemsSet are skipped or not
54 : introduce optional parameter to control, if ignorable items are skipped or not
55 :
56 : @attention every change, e.g. destruction, of the StylePool could cause undefined effects.
57 :
58 : @param bSkipUnusedItemSets
59 : input parameter - boolean, indicating if unused SfxItemSets are skipped or not
60 :
61 : @param bSkipIgnorableItems
62 : input parameter - boolean, indicating if ignorable items are skipped or not
63 :
64 : @postcond the iterator "points before the first" SfxItemSet of the pool.
65 : The first StylePoolIterator::getNext() call will deliver the first SfxItemSet.
66 : */
67 : IStylePoolIteratorAccess* createIterator( const bool bSkipUnusedItemSets = false,
68 : const bool bSkipIgnorableItems = false );
69 :
70 : /** Returns the number of styles
71 : */
72 : sal_Int32 getCount() const;
73 :
74 : virtual ~StylePool();
75 :
76 : static OUString nameOf( SfxItemSet_Pointer_t pSet );
77 : };
78 :
79 152 : class SVL_DLLPUBLIC IStylePoolIteratorAccess
80 : {
81 : public:
82 : /** Delivers a shared pointer to the next SfxItemSet of the pool
83 : If there is no more SfxItemSet, the delivered share_pointer is empty.
84 : */
85 : virtual StylePool::SfxItemSet_Pointer_t getNext() = 0;
86 : virtual OUString getName() = 0;
87 152 : virtual ~IStylePoolIteratorAccess() {};
88 : };
89 : #endif
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|