1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlsSelectionCommand.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_SLIDESORTER_SELECTION_COMMAND_HXX
32 #define SD_SLIDESORTER_SELECTION_COMMAND_HXX
34 #include "controller/SlsPageSelector.hxx"
35 #include "SlsCommand.hxx"
36 #include <tools/solar.h>
37 #include <com/sun/star/drawing/XDrawPage.hpp>
39 #include <boost/shared_ptr.hpp>
42 namespace sd
{ namespace slidesorter
{ namespace model
{
43 class SlideSorterModel
;
47 namespace sd
{ namespace slidesorter
{ namespace controller
{
49 class CurrentSlideManager
;
52 /** The SelectionCommand stores a list of pages that it will select on its
53 execution. Furthermore it will make a page the current page. Note that
54 internally pages are stored with pointers because this command is designed
55 to be executed after model changes where page indices may change but
56 page object identities remain.
58 class SelectionCommand
62 /** Create a new command object that will on its exection use the given
63 PageSelector to select a set of pages.
66 PageSelector
& rSelector
,
67 const ::boost::shared_ptr
<controller::CurrentSlideManager
>& rpCurrentSlideManager
,
68 const model::SlideSorterModel
& rModel
);
70 /** Add the pages in the given list of selected pages to those that will
71 be selected when this command is executed, i.e. its operator()
73 The first page will be set as current page when the new current page
74 has not been specified previously.
76 void AddSlides (const ::boost::shared_ptr
<PageSelector::PageSelection
>& rpSelection
);
78 /** Remember the specified page to be selected when this command is
81 void AddSlide (USHORT nPageIndex
);
83 /** Call this method to explicitly set the page that will be made the
84 current page when this command is executed.
86 void SetCurrentSlide (USHORT nPageIndex
);
88 /** Execute the command and select the pages added by previous calls to
89 AddPages() and AddPage().
91 virtual void operator() (void);
94 /// The page selector is used to select pages and set the current page.
95 PageSelector
& mrPageSelector
;
96 /// Used for setting the current slide.
97 ::boost::shared_ptr
<controller::CurrentSlideManager
> mpCurrentSlideManager
;
98 /// The model is used to translate page indices into page pointers.
99 const model::SlideSorterModel
& mrModel
;
100 /// The list of pages to be selected when the command is executed.
101 typedef ::std::vector
<sal_Int32
> PageList
;
102 PageList maPagesToSelect
;
103 /** The page that will be made the current page when the command is
106 sal_Int32 mnCurrentPageIndex
;
109 } } } // end of namespace sd::slidesorter::controller