Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : : *
5 : : * The contents of this file are subject to the Mozilla Public License Version
6 : : * 1.1 (the "License"); you may not use this file except in compliance with
7 : : * the License. You may obtain a copy of the License at
8 : : * http://www.mozilla.org/MPL/
9 : : *
10 : : * Software distributed under the License is distributed on an "AS IS" basis,
11 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : : * for the specific language governing rights and limitations under the
13 : : * License.
14 : : *
15 : : * The Initial Developer of the Original Code is
16 : : * [ Maja Djordjevic < ovcica@gmail.com > ]
17 : : * Portions created by the Initial Developer are Copyright (C) 2010 the
18 : : * Initial Developer. All Rights Reserved.
19 : : *
20 : : * Contributor(s): Cédric Bosdonnat <cbosdonnat@novell.com>
21 : : * Caolan McNamara <caolanm@redhat.com>
22 : : *
23 : : * Alternatively, the contents of this file may be used under the terms of
24 : : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 : : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 : : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 : : * instead of those above.
28 : : */
29 : : #ifndef SW_NAVMGR_HXX
30 : : #define SW_NAVMGR_HXX
31 : :
32 : : #include <vector>
33 : :
34 : : #include <boost/shared_ptr.hpp>
35 : :
36 : : #include "swtypes.hxx"
37 : :
38 : : class SwWrtShell;
39 : : struct SwPosition;
40 : : class SwUnoCrsr;
41 : :
42 : :
43 : 1231 : class SwNavigationMgr
44 : : {
45 : : private:
46 : : /*
47 : : * List of entries in the navigation history
48 : : * Entries are SwUnoCrsr because thos gets corrected automatically
49 : : * when nodes are deleted.
50 : : *
51 : : * The navigation history behaves as a stack, to which items are added when we jump to a new position
52 : : * (e.g. click a link, or double click an entry from the navigator).
53 : : * Every use of the back/forward buttons results in moving the stack pointer within the navigation history
54 : : */
55 : : typedef ::std::vector< ::boost::shared_ptr<SwUnoCrsr> > Stack_t;
56 : : Stack_t m_entries;
57 : : Stack_t::size_type m_nCurrent; /* Current position within the navigation history */
58 : : SwWrtShell & m_rMyShell; /* The active shell within which the navigation occurs */
59 : :
60 : : void GotoSwPosition(const SwPosition &rPos);
61 : :
62 : : public:
63 : : /* Constructor that initializes the shell to the current shell */
64 : : SwNavigationMgr( SwWrtShell & rShell );
65 : : /* Can we go back in the history ? */
66 : : sal_Bool backEnabled() ;
67 : : /* Can we go forward in the history ? */
68 : : sal_Bool forwardEnabled();
69 : : /* The method that is called when we click the back button */
70 : : void goBack() ;
71 : : /* The method that is called when we click the forward button */
72 : : void goForward() ;
73 : : /* The method that adds the position pPos to the navigation history */
74 : : bool addEntry(const SwPosition& rPos);
75 : : };
76 : : #endif
77 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|