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_CURRENT_MASTER_PAGES_SELECTOR_HXX
23 #define SD_SIDEBAR_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX
24 
25 #include "MasterPagesSelector.hxx"
26 #include <com/sun/star/lang/XComponent.hpp>
27 
28 
29 namespace css = ::com::sun::star;
30 namespace cssu = ::com::sun::star::uno;
31 
32 
33 namespace sd { namespace tools { class EventMultiplexerEvent; } }
34 
35 
36 namespace sd { namespace sidebar {
37 
38 
39 /** Show the master pages currently used by a SdDrawDocument.
40 */
41 class CurrentMasterPagesSelector
42     : public MasterPagesSelector,
43       public SfxListener
44 {
45 public:
46     static MasterPagesSelector* Create (
47         ::Window* pParent,
48         ViewShellBase& rViewShellBase,
49         const cssu::Reference<css::ui::XSidebar>& rxSidebar);
50 
51     /** Set the selection so that the master page is selected that is
52         used by the currently selected page of the document in the
53         center pane.
54     */
55     virtual void UpdateSelection (void);
56 
57     /** Copy all master pages that are to be shown into the given list.
58     */
59     virtual void Fill (ItemList& rItemList);
60 
61 	using MasterPagesSelector::Fill;
62 
63 protected:
64     virtual ResId GetContextMenuResId (void) const;
65 
66     virtual void ProcessPopupMenu (Menu& rMenu);
67     virtual void ExecuteCommand (const sal_Int32 nCommandId);
68 
69 private:
70     cssu::Reference<css::lang::XComponent> mxListener;
71 
72     CurrentMasterPagesSelector (
73         ::Window* pParent,
74         SdDrawDocument& rDocument,
75         ViewShellBase& rBase,
76         const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
77         const cssu::Reference<css::ui::XSidebar>& rxSidebar);
78     virtual ~CurrentMasterPagesSelector (void);
79 
80     virtual void LateInit (void);
81 
82     DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent*);
83     void Notify (SfxBroadcaster&, const SfxHint& rHint);
84 };
85 
86 } } // end of namespace sd::sidebar
87 
88 #endif
89