Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 : #ifndef SW_NAVMGR_HXX
10 : #define SW_NAVMGR_HXX
11 :
12 : #include <vector>
13 :
14 : #include <boost/shared_ptr.hpp>
15 :
16 : #include "swtypes.hxx"
17 :
18 : class SwWrtShell;
19 : struct SwPosition;
20 : class SwUnoCrsr;
21 :
22 :
23 792 : class SwNavigationMgr
24 : {
25 : private:
26 : /*
27 : * List of entries in the navigation history
28 : * Entries are SwUnoCrsr because thos gets corrected automatically
29 : * when nodes are deleted.
30 : *
31 : * The navigation history behaves as a stack, to which items are added when we jump to a new position
32 : * (e.g. click a link, or double click an entry from the navigator).
33 : * Every use of the back/forward buttons results in moving the stack pointer within the navigation history
34 : */
35 : typedef ::std::vector< ::boost::shared_ptr<SwUnoCrsr> > Stack_t;
36 : Stack_t m_entries;
37 : Stack_t::size_type m_nCurrent; /* Current position within the navigation history */
38 : SwWrtShell & m_rMyShell; /* The active shell within which the navigation occurs */
39 :
40 : void GotoSwPosition(const SwPosition &rPos);
41 :
42 : public:
43 : /* Constructor that initializes the shell to the current shell */
44 : SwNavigationMgr( SwWrtShell & rShell );
45 : /* Can we go back in the history ? */
46 : bool backEnabled() ;
47 : /* Can we go forward in the history ? */
48 : bool forwardEnabled();
49 : /* The method that is called when we click the back button */
50 : void goBack() ;
51 : /* The method that is called when we click the forward button */
52 : void goForward() ;
53 : /* The method that adds the position pPos to the navigation history */
54 : bool addEntry(const SwPosition& rPos);
55 : };
56 : #endif
57 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|