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 : #include <memory>
14 :
15 : #include "swtypes.hxx"
16 : #include "calbck.hxx"
17 : #include "unocrsr.hxx"
18 : #include "vcl/svapp.hxx"
19 :
20 : class SwWrtShell;
21 : struct SwPosition;
22 : class SwUnoCrsr;
23 :
24 : class SwNavigationMgr
25 : {
26 : private:
27 : /*
28 : * List of entries in the navigation history
29 : * Entries are SwUnoCrsr because thos gets corrected automatically
30 : * when nodes are deleted.
31 : *
32 : * The navigation history behaves as a stack, to which items are added when we jump to a new position
33 : * (e.g. click a link, or double click an entry from the navigator).
34 : * Every use of the back/forward buttons results in moving the stack pointer within the navigation history
35 : */
36 : typedef ::std::vector< sw::UnoCursorPointer > Stack_t;
37 : Stack_t m_entries;
38 : Stack_t::size_type m_nCurrent; /* Current position within the navigation history */
39 : SwWrtShell & m_rMyShell; /* The active shell within which the navigation occurs */
40 :
41 : void GotoSwPosition(const SwPosition &rPos);
42 :
43 : public:
44 : /* Constructor that initializes the shell to the current shell */
45 : SwNavigationMgr( SwWrtShell & rShell );
46 2757 : virtual ~SwNavigationMgr()
47 5514 : {
48 2757 : SolarMutexGuard g;
49 2757 : m_entries.clear();
50 2757 : }
51 : /* Can we go back in the history ? */
52 : bool backEnabled() ;
53 : /* Can we go forward in the history ? */
54 : bool forwardEnabled();
55 : /* The method that is called when we click the back button */
56 : void goBack() ;
57 : /* The method that is called when we click the forward button */
58 : void goForward() ;
59 : /* The method that adds the position pPos to the navigation history */
60 : bool addEntry(const SwPosition& rPos);
61 : };
62 : #endif
63 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|