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 #ifndef SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX
23 #define SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX
24 
25 #include "MasterPagesSelector.hxx"
26 
27 #include <memory>
28 
29 namespace sd { namespace sidebar {
30 
31 
32 /** Show a list of all available master pages so that the user can assign
33     them to the document.
34 */
35 class AllMasterPagesSelector
36     : public MasterPagesSelector
37 {
38 public:
39     static MasterPagesSelector* Create (
40         ::Window* pParent,
41         ViewShellBase& rViewShellBase,
42         const cssu::Reference<css::ui::XSidebar>& rxSidebar);
43 
44     /** Scan the set of templates for the ones whose first master pages are
45         shown by this control and store them in the MasterPageContainer.
46     */
47     virtual void Fill (ItemList& rItemList);
48 
49     virtual void GetState (SfxItemSet& rItemSet);
50 
51 protected:
52     virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
53 
54 private:
55     /** The list of master pages displayed by this class.
56     */
57     class SortedMasterPageDescriptorList;
58     ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages;
59 
60     AllMasterPagesSelector (
61         ::Window* pParent,
62         SdDrawDocument& rDocument,
63         ViewShellBase& rBase,
64         const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
65         const cssu::Reference<css::ui::XSidebar>& rxSidebar);
66     virtual ~AllMasterPagesSelector (void);
67 
68     void AddTemplate (const TemplateEntry& rEntry);
69 
70     /** This filter returns <TRUE/> when the master page specified by the
71         given file name belongs to the set of Impress master pages.
72     */
73     bool FileFilter (const String& sFileName);
74 
75     void AddItem (MasterPageContainer::Token aToken);
76 
77     /** Add all items in the internal master page list into the given list.
78     */
79     void UpdatePageSet (ItemList& rItemList);
80 
81     /** Update the internal list of master pages that are to show in the
82         control.
83     */
84     void UpdateMasterPageList (void);
85 
86 	using MasterPagesSelector::Fill;
87 };
88 
89 } } // end of namespace sd::sidebar
90 
91 #endif
92