xref: /AOO41X/main/sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx (revision 67e470dafe1997e73f56ff7ff4878983707e3e07)
1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SD_SLIDESORTER_SELECTION_COMMAND_HXX
25cdf0e10cSrcweir #define SD_SLIDESORTER_SELECTION_COMMAND_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "controller/SlsPageSelector.hxx"
28cdf0e10cSrcweir #include "SlsCommand.hxx"
29cdf0e10cSrcweir #include <tools/solar.h>
30cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
33cdf0e10cSrcweir #include <vector>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace sd { namespace slidesorter { namespace model {
36cdf0e10cSrcweir class SlideSorterModel;
37cdf0e10cSrcweir } } }
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace sd { namespace slidesorter { namespace controller {
41cdf0e10cSrcweir 
42cdf0e10cSrcweir class CurrentSlideManager;
43cdf0e10cSrcweir class PageSelector;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir /** The SelectionCommand stores a list of pages that it will select on its
46cdf0e10cSrcweir     execution.  Furthermore it will make a page the current page.  Note that
47cdf0e10cSrcweir     internally pages are stored with pointers because this command is designed
48cdf0e10cSrcweir     to be executed after model changes where page indices may change but
49cdf0e10cSrcweir     page object identities remain.
50cdf0e10cSrcweir */
51cdf0e10cSrcweir class SelectionCommand
52cdf0e10cSrcweir     : public Command
53cdf0e10cSrcweir {
54cdf0e10cSrcweir public:
55cdf0e10cSrcweir     /** Create a new command object that will on its exection use the given
56cdf0e10cSrcweir         PageSelector to select a set of pages.
57cdf0e10cSrcweir     */
58cdf0e10cSrcweir     SelectionCommand (
59cdf0e10cSrcweir         PageSelector& rSelector,
60cdf0e10cSrcweir         const ::boost::shared_ptr<controller::CurrentSlideManager>& rpCurrentSlideManager,
61cdf0e10cSrcweir         const model::SlideSorterModel& rModel);
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     /** Remember the specified page to be selected when this command is
64cdf0e10cSrcweir         executed.
65cdf0e10cSrcweir     */
66cdf0e10cSrcweir     void AddSlide (sal_uInt16 nPageIndex);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     /** Execute the command and select the pages added by previous calls to
69cdf0e10cSrcweir         AddPages() and AddPage().
70cdf0e10cSrcweir     */
71cdf0e10cSrcweir     virtual void operator() (void);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir     /// The page selector is used to select pages and set the current page.
75cdf0e10cSrcweir     PageSelector& mrPageSelector;
76cdf0e10cSrcweir     /// Used for setting the current slide.
77cdf0e10cSrcweir     ::boost::shared_ptr<controller::CurrentSlideManager> mpCurrentSlideManager;
78cdf0e10cSrcweir     /// The model is used to translate page indices into page pointers.
79cdf0e10cSrcweir     const model::SlideSorterModel& mrModel;
80cdf0e10cSrcweir     /// The list of pages to be selected when the command is executed.
81cdf0e10cSrcweir     typedef ::std::vector<sal_Int32> PageList;
82cdf0e10cSrcweir     PageList maPagesToSelect;
83cdf0e10cSrcweir     /** The page that will be made the current page when the command is
84cdf0e10cSrcweir         executed.
85cdf0e10cSrcweir     */
86cdf0e10cSrcweir     sal_Int32 mnCurrentPageIndex;
87cdf0e10cSrcweir };
88cdf0e10cSrcweir 
89cdf0e10cSrcweir } } } // end of namespace sd::slidesorter::controller
90cdf0e10cSrcweir 
91cdf0e10cSrcweir #endif
92