xref: /aoo4110/main/svl/inc/svl/stylepool.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef INCLUDED_SVTOOLS_STYLEPOOL_HXX
24 #define INCLUDED_SVTOOLS_STYLEPOOL_HXX
25 
26 #include <boost/shared_ptr.hpp>
27 #include <rtl/ustring.hxx>
28 #include <svl/itemset.hxx>
29 
30 class StylePoolImpl;
31 class StylePoolIterImpl;
32 class IStylePoolIteratorAccess;
33 
34 class SVL_DLLPUBLIC StylePool
35 {
36 private:
37     StylePoolImpl *pImpl;
38 public:
39     typedef boost::shared_ptr<SfxItemSet> SfxItemSet_Pointer_t;
40 
41     // --> OD 2008-03-07 #i86923#
42     explicit StylePool( SfxItemSet* pIgnorableItems = 0 );
43     // <--
44 
45     /** Insert a SfxItemSet into the style pool.
46 
47         The pool makes a copy of the provided SfxItemSet.
48 
49         @param SfxItemSet
50         the SfxItemSet to insert
51 
52         @return a shared pointer to the SfxItemSet
53     */
54     virtual SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet );
55 
56     /** Create an iterator
57 
58         The iterator walks through the StylePool
59         OD 2008-03-07 #i86923#
60         introduce optional parameter to control, if unused SfxItemsSet are skipped or not
61         introduce optional parameter to control, if ignorable items are skipped or not
62 
63         @attention every change, e.g. destruction, of the StylePool could cause undefined effects.
64 
65         @param bSkipUnusedItemSets
66         input parameter - boolean, indicating if unused SfxItemSets are skipped or not
67 
68         @param bSkipIgnorableItems
69         input parameter - boolean, indicating if ignorable items are skipped or not
70 
71         @postcond the iterator "points before the first" SfxItemSet of the pool.
72         The first StylePoolIterator::getNext() call will deliver the first SfxItemSet.
73     */
74     virtual IStylePoolIteratorAccess* createIterator( const bool bSkipUnusedItemSets = false,
75                                                       const bool bSkipIgnorableItems = false );
76 
77     /** Returns the number of styles
78     */
79     virtual sal_Int32 getCount() const;
80 
81     virtual ~StylePool();
82 
83     static ::rtl::OUString nameOf( SfxItemSet_Pointer_t pSet );
84 };
85 
86 class SVL_DLLPUBLIC IStylePoolIteratorAccess
87 {
88 public:
89     /** Delivers a shared pointer to the next SfxItemSet of the pool
90         If there is no more SfxItemSet, the delivered share_pointer is empty.
91     */
92     virtual StylePool::SfxItemSet_Pointer_t getNext() = 0;
93     virtual ::rtl::OUString getName() = 0;
~IStylePoolIteratorAccess()94     virtual ~IStylePoolIteratorAccess() {};
95 };
96 #endif
97