LibreOffice Module sw (master) 1
navmgr.hxx
Go to the documentation of this file.
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 <unocrsr.hxx>
15
16class SwWrtShell;
17struct SwPosition;
18class SwUnoCursor;
19
20class SwNavigationMgr final : public SfxListener
21{
22private:
23 /*
24 * List of entries in the navigation history
25 * Entries are SwUnoCursor because these gets corrected automatically
26 * when nodes are deleted.
27 *
28 * The navigation history behaves as a stack, to which items are added when we jump to a new position
29 * (e.g. click a link, or double click an entry from the navigator).
30 * Every use of the back/forward buttons results in moving the stack pointer within the navigation history
31 */
32 typedef std::vector< sw::UnoCursorPointer > Stack_t;
34 Stack_t::size_type m_nCurrent; /* Current position within the navigation history */
35 SwWrtShell & m_rMyShell; /* The active shell within which the navigation occurs */
36
37 void GotoSwPosition(const SwPosition &rPos);
38
39public:
40 /* Constructor that initializes the shell to the current shell */
41 SwNavigationMgr( SwWrtShell & rShell );
42 ~SwNavigationMgr() override;
43 /* Can we go back in the history ? */
44 bool backEnabled() ;
45 /* Can we go forward in the history ? */
46 bool forwardEnabled();
47 /* The method that is called when we click the back button */
48 void goBack() ;
49 /* The method that is called when we click the forward button */
50 void goForward() ;
51 /* The method that adds the position pPos to the navigation history */
52 bool addEntry(const SwPosition& rPos);
53 /* to get notified if our cursors self-destruct */
54 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
55};
56#endif
57
58/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void goBack()
Definition: navmgr.cxx:98
bool backEnabled()
Definition: navmgr.cxx:80
bool forwardEnabled()
Definition: navmgr.cxx:90
void goForward()
Definition: navmgr.cxx:144
SwNavigationMgr(SwWrtShell &rShell)
Definition: navmgr.cxx:44
Stack_t::size_type m_nCurrent
Definition: navmgr.hxx:34
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: navmgr.cxx:59
SwWrtShell & m_rMyShell
Definition: navmgr.hxx:35
bool addEntry(const SwPosition &rPos)
Definition: navmgr.cxx:168
~SwNavigationMgr() override
Definition: navmgr.cxx:49
Stack_t m_entries
Definition: navmgr.hxx:33
void GotoSwPosition(const SwPosition &rPos)
Definition: navmgr.cxx:22
std::vector< sw::UnoCursorPointer > Stack_t
Definition: navmgr.hxx:32
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
Marks a position in the document model.
Definition: pam.hxx:38