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 
24 #ifndef SD_SLIDESORTER_SLOT_MANAGER_HXX
25 #define SD_SLIDESORTER_SLOT_MANAGER_HXX
26 
27 #include "model/SlsSharedPageDescriptor.hxx"
28 #include <tools/link.hxx>
29 #include <memory>
30 #include <queue>
31 
32 class AbstractSvxNameDialog;
33 class SfxItemSet;
34 class SfxRequest;
35 class String;
36 
37 namespace sd { namespace slidesorter {
38 class SlideSorter;
39 } }
40 
41 
42 namespace sd { namespace slidesorter { namespace controller {
43 
44 class Command;
45 
46 /** This manager takes over the work of handling slot calls from the
47     controller of the slide sorter.
48 */
49 class SlotManager
50 {
51 public:
52     /** Create a new slot manager that handles slot calls for the controller
53         of a slide sorter.
54         @param rController
55             The controller for which to handle the slot calls.
56     */
57     SlotManager (SlideSorter& rSlideSorter);
58 
59     ~SlotManager (void);
60 
61 	void FuTemporary (SfxRequest& rRequest);
62 	void FuPermanent (SfxRequest& rRequest);
63 	void FuSupport (SfxRequest& rRequest);
64 	void GetMenuState (SfxItemSet &rSet);
65 	void GetClipboardState (SfxItemSet &rSet);
66 	void GetStatusBarState (SfxItemSet& rSet);
67 	void ExecCtrl (SfxRequest& rRequest);
68 	void GetAttrState (SfxItemSet& rSet);
69 
70     void ExecuteCommandAsynchronously (::std::auto_ptr<Command> pCommand);
71 
72     /** Exclude or include one slide or all selected slides.
73         @param rpDescriptor
74             When the pointer is empty then apply the new state to all
75             selected pages.  Otherwise apply the new state to just the
76             specified state.
77     */
78     void ChangeSlideExclusionState (
79         const model::SharedPageDescriptor& rpDescriptor,
80         const bool bExcludeSlide);
81 
82     /** Call this after a change from normal mode to master mode or back.
83         The affected slots are invalidated.
84     */
85     void NotifyEditModeChange (void);
86 
87 private:
88     /// The controller for which we manage the slot calls.
89     SlideSorter& mrSlideSorter;
90 
91     typedef ::std::queue<Command*> CommandQueue;
92     CommandQueue maCommandQueue;
93 
94     /** Called by FuTemporary to show the slide show.
95     */
96     void ShowSlideShow (SfxRequest& rRequest);
97 
98     /** The implementation is a copy of the code for SID_RENAMEPAGE in
99         drviews2.cxx.
100     */
101     void RenameSlide (void);
102     DECL_LINK(RenameSlideHdl, AbstractSvxNameDialog*);
103     bool RenameSlideFromDrawViewShell( sal_uInt16 nPageId, const String& rName);
104 
105     /** Handle SID_INSERTPAGE slot calls.
106     */
107     void InsertSlide (SfxRequest& rRequest);
108 
109     void DuplicateSelectedSlides (SfxRequest& rRequest);
110 
111     /** Use one of several ways to determine where to insert a new page.
112         This can be the current selection or the insertion indicator.
113     */
114     sal_Int32 GetInsertionPosition (void);
115 
116     DECL_LINK(UserEventCallback, void*);
117 };
118 
119 } } } // end of namespace ::sd::slidesorter::controller
120 
121 #endif
122