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         SidebarShellManager& rSubShellManager);
43     /** Scan the set of templates for the ones whose first master pages are
44         shown by this control and store them in the MasterPageContainer.
45     */
46     virtual void Fill (ItemList& rItemList);
47 
48     virtual void GetState (SfxItemSet& rItemSet);
49 
50 protected:
51     virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
52 
53 private:
54     /** The list of master pages displayed by this class.
55     */
56     class SortedMasterPageDescriptorList;
57     ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages;
58 
59     AllMasterPagesSelector (
60         ::Window* pParent,
61         SdDrawDocument& rDocument,
62         ViewShellBase& rBase,
63         SidebarShellManager& rShellManager,
64         const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
65     virtual ~AllMasterPagesSelector (void);
66 
67     void AddTemplate (const TemplateEntry& rEntry);
68 
69     /** This filter returns <TRUE/> when the master page specified by the
70         given file name belongs to the set of Impress master pages.
71     */
72     bool FileFilter (const String& sFileName);
73 
74     void AddItem (MasterPageContainer::Token aToken);
75 
76     /** Add all items in the internal master page list into the given list.
77     */
78     void UpdatePageSet (ItemList& rItemList);
79 
80     /** Update the internal list of master pages that are to show in the
81         control.
82     */
83     void UpdateMasterPageList (void);
84 
85 	using MasterPagesSelector::Fill;
86 };
87 
88 } } // end of namespace sd::sidebar
89 
90 #endif
91