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