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 INCLUDED_SW_SOURCE_UIBASE_INC_NAVMGR_HXX
10 : #define INCLUDED_SW_SOURCE_UIBASE_INC_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 4706 : class SwNavigationMgr
23 : {
24 : private:
25 : /*
26 : * List of entries in the navigation history
27 : * Entries are SwUnoCrsr because thos gets corrected automatically
28 : * when nodes are deleted.
29 : *
30 : * The navigation history behaves as a stack, to which items are added when we jump to a new position
31 : * (e.g. click a link, or double click an entry from the navigator).
32 : * Every use of the back/forward buttons results in moving the stack pointer within the navigation history
33 : */
34 : typedef ::std::vector< ::boost::shared_ptr<SwUnoCrsr> > Stack_t;
35 : Stack_t m_entries;
36 : Stack_t::size_type m_nCurrent; /* Current position within the navigation history */
37 : SwWrtShell & m_rMyShell; /* The active shell within which the navigation occurs */
38 :
39 : void GotoSwPosition(const SwPosition &rPos);
40 :
41 : public:
42 : /* Constructor that initializes the shell to the current shell */
43 : SwNavigationMgr( SwWrtShell & rShell );
44 : /* Can we go back in the history ? */
45 : bool backEnabled() ;
46 : /* Can we go forward in the history ? */
47 : bool forwardEnabled();
48 : /* The method that is called when we click the back button */
49 : void goBack() ;
50 : /* The method that is called when we click the forward button */
51 : void goForward() ;
52 : /* The method that adds the position pPos to the navigation history */
53 : bool addEntry(const SwPosition& rPos);
54 : };
55 : #endif
56 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|