xref: /AOO41X/main/sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_SLIDESORTER_SELECTION_COMMAND_HXX
29 #define SD_SLIDESORTER_SELECTION_COMMAND_HXX
30 
31 #include "controller/SlsPageSelector.hxx"
32 #include "SlsCommand.hxx"
33 #include <tools/solar.h>
34 #include <com/sun/star/drawing/XDrawPage.hpp>
35 
36 #include <boost/shared_ptr.hpp>
37 #include <vector>
38 
39 namespace sd { namespace slidesorter { namespace model {
40 class SlideSorterModel;
41 } } }
42 
43 
44 namespace sd { namespace slidesorter { namespace controller {
45 
46 class CurrentSlideManager;
47 class PageSelector;
48 
49 /** The SelectionCommand stores a list of pages that it will select on its
50     execution.  Furthermore it will make a page the current page.  Note that
51     internally pages are stored with pointers because this command is designed
52     to be executed after model changes where page indices may change but
53     page object identities remain.
54 */
55 class SelectionCommand
56     : public Command
57 {
58 public:
59     /** Create a new command object that will on its exection use the given
60         PageSelector to select a set of pages.
61     */
62     SelectionCommand (
63         PageSelector& rSelector,
64         const ::boost::shared_ptr<controller::CurrentSlideManager>& rpCurrentSlideManager,
65         const model::SlideSorterModel& rModel);
66 
67     /** Remember the specified page to be selected when this command is
68         executed.
69     */
70     void AddSlide (sal_uInt16 nPageIndex);
71 
72     /** Execute the command and select the pages added by previous calls to
73         AddPages() and AddPage().
74     */
75     virtual void operator() (void);
76 
77 private:
78     /// The page selector is used to select pages and set the current page.
79     PageSelector& mrPageSelector;
80     /// Used for setting the current slide.
81     ::boost::shared_ptr<controller::CurrentSlideManager> mpCurrentSlideManager;
82     /// The model is used to translate page indices into page pointers.
83     const model::SlideSorterModel& mrModel;
84     /// The list of pages to be selected when the command is executed.
85     typedef ::std::vector<sal_Int32> PageList;
86     PageList maPagesToSelect;
87     /** The page that will be made the current page when the command is
88         executed.
89     */
90     sal_Int32 mnCurrentPageIndex;
91 };
92 
93 } } } // end of namespace sd::slidesorter::controller
94 
95 #endif
96