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