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