[ooo-build-commit] .: patches/dev300
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Tue Aug 31 07:18:20 PDT 2010
patches/dev300/apply | 2
patches/dev300/writer-navigation-buttons.diff | 1003 +++++++++++++++++++-------
2 files changed, 758 insertions(+), 247 deletions(-)
New commits:
commit 5f8adc54ece70c920c635bd42c0d3d4596f15af5
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Tue Aug 31 16:14:51 2010 +0200
Updated maja's patch with her latest version.
The version of the patch applied here is the one submitted to Google for
the GSoc end. It will bring a lot of improvements. The patch has also
been fixed for ooo330-m4
diff --git a/patches/dev300/apply b/patches/dev300/apply
index c3ba348..42b0b7c 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3060,7 +3060,7 @@ stream-read-csv-always-single-line.diff, n#523517, kohei
impress-autolayout.diff, cocofan
[ WriterNavigation ]
-# FIXME dev300-m83 writer-navigation-buttons.diff, ovcica
+writer-navigation-buttons.diff, ovcica
[ WriterDocComparison ]
SectionOwner => jholesov
diff --git a/patches/dev300/writer-navigation-buttons.diff b/patches/dev300/writer-navigation-buttons.diff
index 63273bb..9ecea3b 100644
--- a/patches/dev300/writer-navigation-buttons.diff
+++ b/patches/dev300/writer-navigation-buttons.diff
@@ -1,8 +1,57 @@
+Feature from Maja's GSoc project
+
+From: Cédric Bosdonnat <cedricbosdo at openoffice.org>
+
+
+---
+
+ .../org/openoffice/Office/UI/WriterCommands.xcu | 16 +
+ .../Office/UI/WriterGlobalWindowState.xcu | 23 ++
+ .../org/openoffice/Office/UI/WriterWindowState.xcu | 23 ++
+ packimages/pack/image-sort.lst | 1
+ sfx2/inc/sfx2/sfx.hrc | 1
+ sw/inc/cmdid.h | 3
+ sw/inc/helpid.h | 1
+ sw/inc/shellid.hxx | 1
+ sw/sdi/_navsh.sdi | 49 +++
+ sw/sdi/makefile.mk | 2
+ sw/sdi/navsh.sdi | 34 ++
+ sw/sdi/swriter.sdi | 51 ++++
+ sw/sdi/swslots.sdi | 2
+ sw/source/ui/app/swmodule.cxx | 2
+ sw/source/ui/inc/navmgr.hxx | 74 +++++
+ sw/source/ui/inc/navsh.hxx | 51 ++++
+ sw/source/ui/inc/shells.hrc | 5
+ sw/source/ui/inc/view.hxx | 3
+ sw/source/ui/inc/wrtsh.hxx | 18 +
+ sw/source/ui/shells/makefile.mk | 1
+ sw/source/ui/shells/navsh.cxx | 169 ++++++++++++
+ sw/source/ui/shells/shells.src | 31 ++
+ sw/source/ui/shells/textsh1.cxx | 1
+ sw/source/ui/uiview/view.cxx | 8 +
+ sw/source/ui/uiview/view2.cxx | 4
+ sw/source/ui/utlui/content.cxx | 7
+ sw/source/ui/wrtsh/makefile.mk | 1
+ sw/source/ui/wrtsh/move.cxx | 132 +++++++++
+ sw/source/ui/wrtsh/navmgr.cxx | 282 ++++++++++++++++++++
+ sw/source/ui/wrtsh/wrtsh1.cxx | 13 +
+ sw/source/ui/wrtsh/wrtsh3.cxx | 1
+ .../swriter/toolbar/navigationobjectbar.xml | 6
+ 32 files changed, 1006 insertions(+), 10 deletions(-)
+ create mode 100644 sw/sdi/_navsh.sdi
+ create mode 100644 sw/sdi/navsh.sdi
+ create mode 100644 sw/source/ui/inc/navmgr.hxx
+ create mode 100644 sw/source/ui/inc/navsh.hxx
+ create mode 100644 sw/source/ui/shells/navsh.cxx
+ create mode 100644 sw/source/ui/wrtsh/navmgr.cxx
+ create mode 100644 sw/uiconfig/swriter/toolbar/navigationobjectbar.xml
+
+
diff --git officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
-index fa0611e..35916b7 100644
+index 4fa2366..dc35bbc 100644
--- officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
-@@ -2241,6 +2241,22 @@
+@@ -2274,6 +2274,22 @@
<value xml:lang="en-US">Continue previous numbering</value>
</prop>
</node>
@@ -14,7 +63,7 @@ index fa0611e..35916b7 100644
+ <value>1</value>
+ </prop>
+ </node>
-+ <node oor:name=".uno:NavigateForward" oor:op="replace">
++ <node oor:name=".uno:NavigateForward" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Forward</value>
+ </prop>
@@ -26,10 +75,10 @@ index fa0611e..35916b7 100644
</node>
</oor:component-data>
diff --git officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu
-index 3988e6d..dcda7ab 100644
+index c18fc70..4b41812 100644
--- officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu
+++ officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu
-@@ -443,6 +443,29 @@
+@@ -649,6 +649,29 @@
<value>true</value>
</prop>
</node>
@@ -56,14 +105,14 @@ index 3988e6d..dcda7ab 100644
+ <value>false</value>
+ </prop>
+ </node>
- <node oor:name="private:resource/toolbar/viewerbar" oor:op="replace">
- <prop oor:name="DockingArea" oor:type="xs:int">
- <value>0</value>
+ </node>
+ </node>
+ </oor:component-data>
diff --git officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
-index ec70817..1da701c 100644
+index 51b7224..f1d14cd 100644
--- officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
+++ officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
-@@ -449,6 +449,29 @@
+@@ -655,6 +655,29 @@
<value>true</value>
</prop>
</node>
@@ -90,14 +139,14 @@ index ec70817..1da701c 100644
+ <value>false</value>
+ </prop>
+ </node>
- <node oor:name="private:resource/toolbar/viewerbar" oor:op="replace">
- <prop oor:name="DockingArea" oor:type="xs:int">
- <value>0</value>
+ </node>
+ </node>
+ </oor:component-data>
diff --git packimages/pack/image-sort.lst packimages/pack/image-sort.lst
-index 43202b8..1118b3a 100644
+index d7a615b..5339b55 100644
--- packimages/pack/image-sort.lst
+++ packimages/pack/image-sort.lst
-@@ -303,6 +303,7 @@ uiconfig/modules/swriter/toolbar/graphicobjectbar.xml
+@@ -309,6 +309,7 @@ uiconfig/modules/swriter/toolbar/graphicobjectbar.xml
uiconfig/modules/swriter/toolbar/insertbar.xml
uiconfig/modules/swriter/toolbar/mediaobjectbar.xml
uiconfig/modules/swriter/toolbar/moreformcontrols.xml
@@ -105,37 +154,37 @@ index 43202b8..1118b3a 100644
uiconfig/modules/swriter/toolbar/numobjectbar.xml
uiconfig/modules/swriter/toolbar/oleobjectbar.xml
uiconfig/modules/swriter/toolbar/optimizetablebar.xml
-diff --git sfx2/source/appl/workwin.cxx sfx2/source/appl/workwin.cxx
-index 89b52ac..ee739da 100644
---- sfx2/source/appl/workwin.cxx
-+++ sfx2/source/appl/workwin.cxx
-@@ -140,6 +140,7 @@ static const ResIdToResName pToolBarResToName[] =
- { 23031, "mediaobjectbar" }, //draw/impress
- { 25060, "mediaobjectbar" }, //calc
- { 23311, "mediaobjectbar" }, //writer
-+ { 23313, "navigationobjectbar" }, //writer
- { 0, "" }
- };
+diff --git sfx2/inc/sfx2/sfx.hrc sfx2/inc/sfx2/sfx.hrc
+index 6071c16..7ea194f 100755
+--- sfx2/inc/sfx2/sfx.hrc
++++ sfx2/inc/sfx2/sfx.hrc
+@@ -303,6 +303,7 @@
+ #define GID_MODIFY (RID_GROUPS_SFXOFFSET+23)
+ #define GID_DRAWING (RID_GROUPS_SFXOFFSET+24)
+ #define GID_CONTROLS (RID_GROUPS_SFXOFFSET+25)
++#define GID_NAVIGATION (RID_GROUPS_SFXOFFSET+26)
+ // compatibility-#defines
+ #define GID_FORMEL GID_MATH
diff --git sw/inc/cmdid.h sw/inc/cmdid.h
-index cf5bcd5..e33894d 100644
+index 5c59f70..475354b 100644
--- sw/inc/cmdid.h
+++ sw/inc/cmdid.h
@@ -908,6 +908,9 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
- #define FN_UNO_TABLE_NAME (FN_EXTRA2 + 111)
#define FN_UNO_META (FN_EXTRA2 + 112)
+ #define FN_UNO_NESTED_TEXT_CONTENT (FN_EXTRA2 + 113)
-+#define FN_NAVIGATION_BACK (FN_EXTRA2 + 113)
-+#define FN_NAVIGATION_FORWARD (FN_EXTRA2 + 114)
++#define FN_NAVIGATION_BACK (FN_EXTRA2 + 114)
++#define FN_NAVIGATION_FORWARD (FN_EXTRA2 + 115)
+
/*--------------------------------------------------------------------
Bereich: Hilfe
--------------------------------------------------------------------*/
diff --git sw/inc/helpid.h sw/inc/helpid.h
-index 0ff576a..1fb0828 100644
+index 9f5c6ad..f0658f1 100644
--- sw/inc/helpid.h
+++ sw/inc/helpid.h
-@@ -981,3 +981,4 @@
+@@ -982,3 +982,4 @@
#define HID_MM_HEADER_12 (HID_BASE + 2279)
#define HID_MM_HEADER_13 (HID_BASE + 2280)
@@ -152,14 +201,14 @@ index 65af848..e3ef3e6 100644
#endif // _UIPARAM_HXX
diff --git sw/sdi/_navsh.sdi sw/sdi/_navsh.sdi
new file mode 100644
-index 0000000..d8820cf
+index 0000000..deb4fb9
--- /dev/null
+++ sw/sdi/_navsh.sdi
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
++ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -189,50 +238,50 @@ index 0000000..d8820cf
+interface _Navigation
+[ Automation = FALSE; ]
+{
-+ SfxVoidItem NavigateBack FN_NAVIGATION_BACK
-+ [
-+ ExecMethod = Execute ;
-+ StateMethod = GetState;
-+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
-+ ]
-+
-+ SfxVoidItem NavigateForward FN_NAVIGATION_FORWARD
-+ [
-+ ExecMethod = Execute ;
-+ StateMethod = GetState;
-+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
-+ ]
++ SfxVoidItem NavigateBack FN_NAVIGATION_BACK
++ [
++ ExecMethod = Execute ;
++ StateMethod = GetState;
++ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
++ ]
++
++ SfxVoidItem NavigateForward FN_NAVIGATION_FORWARD
++ [
++ ExecMethod = Execute ;
++ StateMethod = GetState;
++ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
++ ]
+
+}
+
diff --git sw/sdi/makefile.mk sw/sdi/makefile.mk
-index e539c7a..0cf3813 100644
+index e539c7a..dbbd3e2 100644
--- sw/sdi/makefile.mk
+++ sw/sdi/makefile.mk
@@ -96,6 +96,8 @@ SVSDI1DEPEND= \
mediash.sdi\
_annotsh.sdi\
annotsh.sdi\
-+ _navsh.sdi \
-+ navsh.sdi \
++ _navsh.sdi \
++ navsh.sdi \
swslots.hrc \
$(INC)$/globals.hrc \
$(INC)$/cmdid.h
diff --git sw/sdi/navsh.sdi sw/sdi/navsh.sdi
new file mode 100644
-index 0000000..5919775
+index 0000000..dbb7a2e
--- /dev/null
+++ sw/sdi/navsh.sdi
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
++ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
-+ * $RCSfile: annotsh.sdi,v $
++ * $RCSfile: navsh.sdi,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
@@ -256,13 +305,13 @@ index 0000000..5919775
+
+shell SwNavigationShell
+{
-+ import _Navigation[Automation];
++ import _Navigation[Automation];
+}
diff --git sw/sdi/swriter.sdi sw/sdi/swriter.sdi
-index aede246..a5e3afe 100644
+index 633cda7..72d2557 100755
--- sw/sdi/swriter.sdi
+++ sw/sdi/swriter.sdi
-@@ -10316,3 +10316,54 @@ SfxVoidItem CopyHyperlinkLocation FN_COPY_HYPERLINK_LOCATION
+@@ -10341,3 +10341,54 @@ SfxVoidItem CopyHyperlinkLocation FN_COPY_HYPERLINK_LOCATION
ToolBoxConfig = TRUE,
GroupId = GID_EDIT;
]
@@ -290,7 +339,7 @@ index aede246..a5e3afe 100644
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
-+ GroupId = GID_NAVIGATOR;
++ GroupId = GID_NAVIGATION;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem NavigateForward FN_NAVIGATION_FORWARD
@@ -315,43 +364,26 @@ index aede246..a5e3afe 100644
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
-+ GroupId = GID_NAVIGATOR;
++ GroupId = GID_NAVIGATION;
+]
diff --git sw/sdi/swslots.sdi sw/sdi/swslots.sdi
-index eb43955..2d72843 100644
+index eb43955..118a482 100644
--- sw/sdi/swslots.sdi
+++ sw/sdi/swslots.sdi
@@ -120,6 +120,8 @@ ModulePrefix( "Sw" )
include "_annotsh.sdi"
include "annotsh.sdi"
-+ include "_navsh.sdi"
++ include "_navsh.sdi"
+ include "navsh.sdi"
}
-diff --git sw/sdi/swslots.src sw/sdi/swslots.src
-index b67716c..bdd22a5 100644
---- sw/sdi/swslots.src
-+++ sw/sdi/swslots.src
-@@ -1485,4 +1485,12 @@ SfxSlotInfo FN_VIEW_NOTES
- {
- Slotname [ en-US ] = "Notes";
- };
-+SfxSlotInfo FN_NAVIGATION_BACK
-+{
-+ SlotName [ en-US ] = "Back";
-+};
-+SfxSlotInfo FN_NAVIGATION_FORWARD
-+{
-+ SlotName [ en-US ] = "Forward";
-+}
-
diff --git sw/source/ui/app/swmodule.cxx sw/source/ui/app/swmodule.cxx
-index f2de617..0beccae 100644
+index 569e068..8aa0ee9 100644
--- sw/source/ui/app/swmodule.cxx
+++ sw/source/ui/app/swmodule.cxx
-@@ -160,6 +160,7 @@
+@@ -161,6 +161,7 @@
#include <avmedia/mediatoolbox.hxx>
#include <annotsh.hxx>
@@ -363,20 +395,20 @@ index f2de617..0beccae 100644
SwBezierShell::RegisterInterface(pMod);
SwGrfShell::RegisterInterface(pMod);
SwOleShell::RegisterInterface(pMod);
-+ SwNavigationShell::RegisterInterface(pMod);
++ SwNavigationShell::RegisterInterface(pMod);
SwWebTextShell::RegisterInterface(pMod);
SwWebFrameShell::RegisterInterface(pMod);
SwWebGrfShell::RegisterInterface(pMod);
diff --git sw/source/ui/inc/navmgr.hxx sw/source/ui/inc/navmgr.hxx
new file mode 100644
-index 0000000..e510b8e
+index 0000000..4044767
--- /dev/null
+++ sw/source/ui/inc/navmgr.hxx
-@@ -0,0 +1,62 @@
+@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
++ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -407,8 +439,6 @@ index 0000000..e510b8e
+
+#include "swtypes.hxx"
+#include "pam.hxx"
-+#include <editeng/svxenum.hxx>
-+#include <tools/gen.hxx>
+#include "swdllapi.h"
+
+class SwWrtShell;
@@ -417,22 +447,36 @@ index 0000000..e510b8e
+class SW_DLLPUBLIC SwNavigationMgr
+{
+private:
-+ std::vector<SwPosition*>::iterator _iCurrent;
-+ std::vector<SwPosition*> _entries;
-+ int _nCurrent;
-+ SwWrtShell* _pMyShell;
-+
-+ void GotoSwPosition(SwPosition* aPos);
++ /*
++ * List of entries in the navigation history
++ * Each entry is a SwPosition, which represents a position within the document
++ * SwPosition is given by a node index (SwNodeIndex) which usually represents the paragraph the position is in
++ * and an index (SwIndex), which represents the position inside this paragraph.
++ * You can find more on SwPositions at http://wiki.services.openoffice.org/wiki/Writer_Core_And_Layout
++ *
++ * The navigation history behaves as a stack, to which items are added when we jump to a new position
++ * (e.g. click a link, or double click an entry from the navigator).
++ * Every use of the back/forward buttons results in moving the stack pointer within the navigation history
++ */
++ std::vector<SwPosition> _entries;
++ std::vector<SwPosition>::size_type _nCurrent; /* Current position within the navigation history */
++ SwWrtShell* _pMyShell; /* The active shell within which the navigation occurs */
++
++ void GotoSwPosition(const SwPosition &rPos);
+
+public:
-+ SwNavigationMgr();
-+ void setShell( SwWrtShell* pShell );
-+
-+ BOOL backEnabled() ;
-+ BOOL forwardEnabled();
-+ void goBack() ;
-+ void goForward() ;
-+ void addEntry(SwPosition* aPos);
++ /* Constructor that initializes the shell to the current shell */
++ SwNavigationMgr( SwWrtShell* pShell );
++ /* Can we go back in the history ? */
++ BOOL backEnabled() ;
++ /* Can we go forward in the history ? */
++ BOOL forwardEnabled();
++ /* The method that is called when we click the back button */
++ void goBack() ;
++ /* The method that is called when we click the forward button */
++ void goForward() ;
++ /* The method that adds the position pPos to the navigation history */
++ bool addEntry(const SwPosition& rPos);
+};
+#endif
diff --git sw/source/ui/inc/navsh.hxx sw/source/ui/inc/navsh.hxx
@@ -444,7 +488,7 @@ index 0000000..5f0c3c6
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
++ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -484,9 +528,9 @@ index 0000000..5f0c3c6
+{
+public:
+ SFX_DECL_INTERFACE(SW_NAVIGATIONSHELL)
-+
++
+ SwNavigationShell(SwView &rView);
-+
++
+ void GetState(SfxItemSet &);
+ void Execute(SfxRequest &);
+};
@@ -509,7 +553,7 @@ index 243c4fc..847d322 100644
#if SHELLS_ACT_END > RC_SHELLS_END
#error Resource-Id Ueberlauf in #file, #line
diff --git sw/source/ui/inc/view.hxx sw/source/ui/inc/view.hxx
-index 9553d88..a6cc6de 100644
+index 08e27ac..09f0c1b 100644
--- sw/source/ui/inc/view.hxx
+++ sw/source/ui/inc/view.hxx
@@ -129,7 +129,8 @@ enum ShellModes
@@ -517,23 +561,23 @@ index 9553d88..a6cc6de 100644
SHELL_MODE_EXTRUDED_CUSTOMSHAPE,
SHELL_MODE_FONTWORK,
- SHELL_MODE_POSTIT
-+ SHELL_MODE_POSTIT,
-+ SHELL_MODE_NAVIGATION
++ SHELL_MODE_POSTIT,
++ SHELL_MODE_NAVIGATION
};
/*--------------------------------------------------------------------
diff --git sw/source/ui/inc/wrtsh.hxx sw/source/ui/inc/wrtsh.hxx
-index ff1143b..8e8190f 100644
+index 14b26c0..3adf7dd 100644
--- sw/source/ui/inc/wrtsh.hxx
+++ sw/source/ui/inc/wrtsh.hxx
-@@ -34,6 +34,7 @@
+@@ -33,6 +33,7 @@
+ #include <sortopt.hxx>
#include <swurl.hxx>
#include <IMark.hxx>
-
+#include "navmgr.hxx"
+
class Window;
class OutputDevice;
- class SbxArray;
@@ -84,6 +85,7 @@ namespace nsSelectionType
const SelectionType SEL_EXTRUDED_CUSTOMSHAPE = 0x008000; // extruded custom shape
const SelectionType SEL_FONTWORK = 0x010000; // fontwork
@@ -542,40 +586,54 @@ index ff1143b..8e8190f 100644
}
-@@ -474,6 +476,7 @@ typedef BOOL (SwWrtShell:: *FNSimpleMove)();
+@@ -474,6 +476,21 @@ typedef BOOL (SwWrtShell:: *FNSimpleMove)();
String GetSelDescr() const;
+ SwNavigationMgr& GetNavigationMgr();
++ void addCurrentPosition();
++ BOOL GotoFly( const String& rName, FlyCntType eType = FLYCNTTYPE_ALL,
++ BOOL bSelFrame = TRUE );
++ BOOL GotoINetAttr( const SwTxtINetFmt& rAttr );
++ void GotoOutline( USHORT nIdx );
++ BOOL GotoOutline( const String& rName );
++ BOOL GotoRegion( const String& rName );
++ BOOL GotoRefMark( const String& rRefMark, USHORT nSubType = 0,
++ USHORT nSeqNo = 0 );
++ BOOL GotoNextTOXBase( const String* pName = 0);
++ BOOL GotoTable( const String& rName );
++ BOOL GotoFld( const SwFmtFld& rFld );
++ const SwRedline* GotoRedline( USHORT nArrPos, BOOL bSelect = FALSE);
++
private:
SW_DLLPRIVATE void OpenMark();
-@@ -530,6 +533,7 @@ private:
+@@ -530,6 +547,7 @@ private:
} *pCrsrStack;
SwView &rView;
-+ SwNavigationMgr aNavigationMgr;
++ SwNavigationMgr aNavigationMgr;
Point aDest;
BOOL bDestOnStack;
diff --git sw/source/ui/shells/makefile.mk sw/source/ui/shells/makefile.mk
-index e9a03a5..0e0b815 100644
+index dce62a2..b940bd0 100644
--- sw/source/ui/shells/makefile.mk
+++ sw/source/ui/shells/makefile.mk
@@ -58,6 +58,7 @@ SLOFILES = \
$(SLO)$/grfshex.obj \
$(SLO)$/mediash.obj \
$(SLO)$/listsh.obj \
-+ $(SLO)$/navsh.obj \
++ $(SLO)$/navsh.obj \
$(SLO)$/olesh.obj \
$(SLO)$/slotadd.obj \
$(SLO)$/tabsh.obj \
diff --git sw/source/ui/shells/navsh.cxx sw/source/ui/shells/navsh.cxx
new file mode 100644
-index 0000000..82fec06
+index 0000000..9f3a1ca
--- /dev/null
+++ sw/source/ui/shells/navsh.cxx
-@@ -0,0 +1,150 @@
+@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -585,7 +643,7 @@ index 0000000..82fec06
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: navsh.cxx,v $
-+ * $Revision: 1.0 $
++ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
@@ -643,13 +701,17 @@ index 0000000..82fec06
+using namespace std;
+#endif
+
++
++//#define DEBUG_STATE 1
++//#define DEBUG_EXECUTE 1
++
+SFX_IMPL_INTERFACE(SwNavigationShell, SwBaseShell, SW_RES(STR_SHELLNAME_NAVIGATION))
+{
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_NAVIGATION_TOOLBOX));
+}
+
+SwNavigationShell::SwNavigationShell(SwView &_rView):
-+SwBaseShell( _rView )
++ SwBaseShell( _rView )
+
+{
+ SetName(C2S("Navigation"));
@@ -658,37 +720,51 @@ index 0000000..82fec06
+
+void SwNavigationShell::Execute(SfxRequest &rReq)
+{
-+ SwWrtShell *pSh = &GetShell();
-+ SdrView* pSdrView = pSh->GetDrawView();
-+ const SfxItemSet *pArgs = rReq.GetArgs();
-+ USHORT nSlotId = rReq.GetSlot();
-+ BOOL bChanged = pSdrView->GetModel()->IsChanged();
-+ pSdrView->GetModel()->SetChanged(FALSE);
-+ SwNavigationMgr& mgr = pSh->GetNavigationMgr();
-+ const SfxPoolItem* pItem;
-+ if(pArgs)
-+ pArgs->GetItemState(nSlotId, FALSE, &pItem);
-+
-+ switch (nSlotId)
-+ {
-+ case FN_NAVIGATION_BACK:
-+ mgr.goBack();
-+ break;
-+
-+ case FN_NAVIGATION_FORWARD:
-+ mgr.goForward();
-+ break;
-+ default:
-+ break;
-+ }
-+ if (pSdrView->GetModel()->IsChanged())
-+ GetShell().SetModified();
-+ else if (bChanged)
-+ pSdrView->GetModel()->SetChanged(TRUE);
++#if DEBUG_EXECUTE
++ clog << "Calling execute " << endl;
++#endif
++ SwWrtShell *pSh = &GetShell();
++ SdrView* pSdrView = pSh->GetDrawView();
++ const SfxItemSet *pArgs = rReq.GetArgs();
++ USHORT nSlotId = rReq.GetSlot();
++ BOOL bChanged = pSdrView->GetModel()->IsChanged();
++ pSdrView->GetModel()->SetChanged(FALSE);
++ SwNavigationMgr& aSwNavigationMgr = pSh->GetNavigationMgr();
++ const SfxPoolItem* pItem;
++ if(pArgs)
++ pArgs->GetItemState(nSlotId, FALSE, &pItem);
++#if DEBUG_EXECUTE
++ clog << "entering switch() " << endl;
++#endif
++ switch (nSlotId)
++ {
++ case FN_NAVIGATION_BACK:
++#if DEBUG_EXECUTE
++ clog << "Execute(FN_NAVIGATION_BACK)" << endl;
++#endif
++ aSwNavigationMgr.goBack();
++ break;
++
++ case FN_NAVIGATION_FORWARD:
++#if DEBUG_EXECUTE
++ clog << "Execute(FN_NAVIGATION_FORWARD)" << endl;
++#endif
++ aSwNavigationMgr.goForward();
++ break;
++ default:
++ break;
++ }
++ if (pSdrView->GetModel()->IsChanged())
++ GetShell().SetModified();
++ else if (bChanged)
++ pSdrView->GetModel()->SetChanged(TRUE);
++#if DEBUG_EXECUTE
++ clog << "execute ended" << endl << endl;
++#endif
+}
+
+/*--------------------------------------------------------------------
-+ set buttons to enabled/disabled
++ determine if the buttons should be enabled/disabled
+ --------------------------------------------------------------------*/
+
+
@@ -701,36 +777,37 @@ index 0000000..82fec06
+ while( nWhich )
+ {
+ switch( nWhich )
-+ {
-+ case FN_NAVIGATION_BACK:
-+ {
-+#if DEBUG
-+ clog << "SwNavigationShell::GetState( FN_NAVIGATION_BACK )" << endl;
++ {
++ case FN_NAVIGATION_BACK:
++ {
++#if DEBUG_STATE
++ clog << "SwNavigationShell::GetState( FN_NAVIGATION_BACK )" << endl;
+#endif
-+ if (!aNavigationMgr.backEnabled())
-+ rSet.DisableItem(FN_NAVIGATION_BACK);
-+ }
-+ break;
-+ case FN_NAVIGATION_FORWARD:
-+ {
-+#if DEBUG
-+ clog << "SwNavigationShell::GetState( FN_NAVIGATION_FORWARD )" << endl;
++ if (!aNavigationMgr.backEnabled()) {
++ rSet.DisableItem(FN_NAVIGATION_BACK);
++ }
++ }
++ break;
++ case FN_NAVIGATION_FORWARD:
++ {
++#if DEBUG_STATE
++ clog << "SwNavigationShell::GetState( FN_NAVIGATION_FORWARD )" << endl;
+#endif
-+ if (!aNavigationMgr.forwardEnabled())
-+ rSet.DisableItem(FN_NAVIGATION_FORWARD);
-+ }
-+ break;
-+ default:
-+ break;
-+ }
++ if (!aNavigationMgr.forwardEnabled())
++ rSet.DisableItem(FN_NAVIGATION_FORWARD);
++ }
++ break;
++ default:
++ break;
++ }
+ nWhich = aIter.NextWhich();
+ }
+}
diff --git sw/source/ui/shells/shells.src sw/source/ui/shells/shells.src
-index 42b3b00..87c9b94 100644
+index 42b3b00..d9e783d 100644
--- sw/source/ui/shells/shells.src
+++ sw/source/ui/shells/shells.src
-@@ -1030,6 +1030,43 @@ ToolBox RID_NUM_TOOLBOX
+@@ -1030,6 +1030,37 @@ ToolBox RID_NUM_TOOLBOX
};
Scroll = TRUE ;
};
@@ -754,28 +831,34 @@ index 42b3b00..87c9b94 100644
+ {
+ ToolBoxItem
+ {
-+ Identifier = FN_NAVIGATION_BACK ;
-+ HelpID = FN_NAVIGATION_BACK ;
++ Identifier = FN_NAVIGATION_BACK ;
++ HelpID = FN_NAVIGATION_BACK ;
+ };
+ ToolBoxItem
+ {
-+ Identifier = FN_NAVIGATION_FORWARD ;
-+ HelpID = FN_NAVIGATION_FORWARD ;
++ Identifier = FN_NAVIGATION_FORWARD ;
++ HelpID = FN_NAVIGATION_FORWARD ;
+ };
+ };
+};
+
-+
-+String RID_NAVIGATION_TOOLBOX
-+{
-+ Text [ en-US ] = "Navigation Bar" ;
-+ Text [ x-comment ] = " ";
-+};
String STR_SHELLNAME_TEXT
{
Text [ en-US ] = "Text" ;
+diff --git sw/source/ui/shells/textsh1.cxx sw/source/ui/shells/textsh1.cxx
+index f41d28c..760e4d7 100644
+--- sw/source/ui/shells/textsh1.cxx
++++ sw/source/ui/shells/textsh1.cxx
+@@ -1745,6 +1745,7 @@ void SwTextShell::ChangeHeaderOrFooter(
+ const String& rStyleName, BOOL bHeader, BOOL bOn, BOOL bShowWarning)
+ {
+ SwWrtShell& rSh = GetShell();
++ rSh.addCurrentPosition();
+ rSh.StartAllAction();
+ rSh.StartUndo( UNDO_HEADER_FOOTER ); // #i7983#
+ BOOL bExecute = TRUE;
diff --git sw/source/ui/uiview/view.cxx sw/source/ui/uiview/view.cxx
-index e5884cb..1cb760a 100644
+index 0e3d55e..dabdefa 100644
--- sw/source/ui/uiview/view.cxx
+++ sw/source/ui/uiview/view.cxx
@@ -73,6 +73,7 @@
@@ -800,11 +883,27 @@ index e5884cb..1cb760a 100644
if ( nSelectionType & nsSelectionType::SEL_OLE )
{
eShellMode = SHELL_MODE_OBJECT;
+diff --git sw/source/ui/uiview/view2.cxx sw/source/ui/uiview/view2.cxx
+index dbabf2b..f212478 100755
+--- sw/source/ui/uiview/view2.cxx
++++ sw/source/ui/uiview/view2.cxx
+@@ -1917,8 +1917,10 @@ BOOL SwView::JumpToSwMark( const String& rMark )
+ }
+ else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) )
+ pWrtShell->GotoMark( ppMark->get(), FALSE, TRUE ), bRet = TRUE;
+- else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) ))
++ else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) )) {
++ pWrtShell->addCurrentPosition();
+ bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() );
++ }
+
+ // fuer alle Arten von Flys
+ if( FLYCNTTYPE_ALL != eFlyType && pWrtShell->GotoFly( sName, eFlyType ))
diff --git sw/source/ui/utlui/content.cxx sw/source/ui/utlui/content.cxx
-index bbb3d98..382f403 100644
+index a59244a..6f44d96 100644
--- sw/source/ui/utlui/content.cxx
+++ sw/source/ui/utlui/content.cxx
-@@ -115,6 +115,7 @@
+@@ -114,6 +114,7 @@
#include "globals.hrc"
#include <unomid.h>
@@ -812,47 +911,217 @@ index bbb3d98..382f403 100644
#define CTYPE_CNT 0
#define CTYPE_CTT 1
-@@ -3185,6 +3186,12 @@ void SwContentTree::GotoContent(SwContent* pCnt)
-
- sal_Bool bSel = sal_False;
- sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
-+ SwNavigationMgr& aNavigationMgr = pActiveShell->GetNavigationMgr();
-+ SwPaM* pPaM = pActiveShell->GetCrsr();
-+
-+ if(pPaM->HasMark())
-+ pPaM->DeleteMark(); //If there was a selection, get rid of it
-+ aNavigationMgr.addEntry(pPaM->GetPoint());
- switch(nJumpType)
- {
- case CONTENT_TYPE_OUTLINE :
+@@ -3217,10 +3218,10 @@ void SwContentTree::GotoContent(SwContent* pCnt)
+ break;
+ case CONTENT_TYPE_URLFIELD:
+ {
+- if(pActiveShell->GotoINetAttr(
++ if(pActiveShell->GotoINetAttr(
+ *((SwURLFieldContent*)pCnt)->GetINetAttr() ))
+ {
+- pActiveShell->Right( CRSR_SKIP_CHARS, sal_True, 1, sal_False);
++ pActiveShell->Right( CRSR_SKIP_CHARS, sal_True, 1, sal_False);
+ pActiveShell->SwCrsrShell::SelectTxtAttr( RES_TXTATR_INETFMT, sal_True );
+ }
+
+@@ -3248,6 +3249,7 @@ void SwContentTree::GotoContent(SwContent* pCnt)
+ break;
+ case CONTENT_TYPE_DRAWOBJECT:
+ {
++ SwPosition aPos = *pActiveShell->GetCrsr()->GetPoint();
+ SdrView* pDrawView = pActiveShell->GetDrawView();
+ if (pDrawView)
+ {
+@@ -3271,6 +3273,7 @@ void SwContentTree::GotoContent(SwContent* pCnt)
+ }
+ }
+ }
++ pActiveShell->GetNavigationMgr().addEntry(aPos);
+ }
+ }
+ break;
diff --git sw/source/ui/wrtsh/makefile.mk sw/source/ui/wrtsh/makefile.mk
-index baeb3ac..b7fef6c 100644
+index baeb3ac..464f2f8 100644
--- sw/source/ui/wrtsh/makefile.mk
+++ sw/source/ui/wrtsh/makefile.mk
@@ -43,6 +43,7 @@ SRC1FILES = \
wrtsh.src
SLOFILES = \
-+ $(SLO)$/navmgr.obj \
++ $(SLO)$/navmgr.obj \
$(SLO)$/move.obj \
$(SLO)$/select.obj \
$(SLO)$/wrtsh1.obj \
+diff --git sw/source/ui/wrtsh/move.cxx sw/source/ui/wrtsh/move.cxx
+index 3e649a9..80dafb6 100644
+--- sw/source/ui/wrtsh/move.cxx
++++ sw/source/ui/wrtsh/move.cxx
+@@ -37,6 +37,10 @@
+ #include <viewopt.hxx>
+ #include <crsskip.hxx>
+
++#if DEBUG
++#include <cstdio>
++#endif
++
+ /* Immer:
+ - Zuruecksetzen des Cursorstacks
+ - Timer nachtriggern
+@@ -670,7 +674,130 @@ BOOL SwWrtShell::GotoPage(USHORT nPage, BOOL bRecord)
+ BOOL SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark, BOOL bSelect, BOOL bStart )
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+- return SwCrsrShell::GotoMark( pMark, bStart );
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoBookmark()...\n");
++#endif
++ bool bRet = SwCrsrShell::GotoMark( pMark, bStart );
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++}
++
++BOOL SwWrtShell::GotoFly( const String& rName, FlyCntType eType, BOOL bSelFrame )
++{
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr,"SwWrtShell::GotoFly()...\n");
++#endif
++ bool bRet = SwFEShell::GotoFly(rName, eType, bSelFrame);
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++}
++
++BOOL SwWrtShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
++{
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoINetAttr()...\n");
++#endif
++ bool bRet = SwCrsrShell::GotoINetAttr(rAttr);
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++}
++
++void SwWrtShell::GotoOutline( USHORT nIdx )
++{
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoOutline(USHORT)...\n");
++#endif
++ addCurrentPosition();
++ return SwCrsrShell::GotoOutline (nIdx);
++}
++
++BOOL SwWrtShell::GotoOutline( const String& rName )
++{
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoOutline(String)...\n");
++#endif
++ bool bRet = SwCrsrShell::GotoOutline (rName);
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++}
++
++BOOL SwWrtShell::GotoRegion( const String& rName )
++{
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoRegion()...\n");
++#endif
++ bool bRet = SwCrsrShell::GotoRegion (rName);
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++ }
++
++BOOL SwWrtShell::GotoRefMark( const String& rRefMark, USHORT nSubType,
++ USHORT nSeqNo )
++{
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoRefMark(String)...\n");
++#endif
++ bool bRet = SwCrsrShell::GotoRefMark(rRefMark, nSubType, nSeqNo);
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++}
++
++BOOL SwWrtShell::GotoNextTOXBase( const String* pName )
++{
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoNextTOXBase(String)...\n");
++#endif
++ bool bRet = SwCrsrShell::GotoNextTOXBase(pName);
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++}
++
++BOOL SwWrtShell::GotoTable( const String& rName )
++{
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoTable(String)...\n");
++#endif
++ bool bRet = SwCrsrShell::GotoTable(rName);
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++}
++
++BOOL SwWrtShell::GotoFld( const SwFmtFld& rFld ) {
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoFld()...\n");
++#endif
++ bool bRet = SwCrsrShell::GotoFld(rFld);
++ if (bRet)
++ aNavigationMgr.addEntry(aPos);
++ return bRet;
++}
++
++const SwRedline* SwWrtShell::GotoRedline( USHORT nArrPos, BOOL bSelect ) {
++ SwPosition aPos = *GetCrsr()->GetPoint();
++#if DEBUG
++ fprintf(stderr, "SwWrtShell::GotoRedline()...\n");
++#endif
++ const SwRedline *pRedline = SwCrsrShell::GotoRedline(nArrPos, bSelect);
++ if (pRedline)
++ aNavigationMgr.addEntry(aPos);
++ return pRedline;
+ }
+
+
+@@ -686,6 +813,3 @@ BOOL SwWrtShell::SelectTxtAttr( USHORT nWhich, const SwTxtAttr* pAttr )
+ EndSelect();
+ return bRet;
+ }
+-
+-
+-
diff --git sw/source/ui/wrtsh/navmgr.cxx sw/source/ui/wrtsh/navmgr.cxx
new file mode 100644
-index 0000000..56cb5e1
+index 0000000..a0fc70f
--- /dev/null
+++ sw/source/ui/wrtsh/navmgr.cxx
-@@ -0,0 +1,73 @@
+@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
++ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: navmgr.cxx,v $
-+ * $Revision: 1.0 $
++ * $Revision: 2.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
@@ -872,55 +1141,289 @@ index 0000000..56cb5e1
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
++#include "precompiled_sw.hxx"
++
+#include "navmgr.hxx"
+#include "wrtsh.hxx"
-+void SwNavigationMgr::GotoSwPosition(SwPosition* aPos) {
-+ SwWrtShell& rSh = *_pMyShell;
-+ rSh.LockView( TRUE );
-+ rSh.StartAllAction();
-+ SwPaM* pPaM = rSh.GetCrsr();
-+
-+ if(pPaM->HasMark())
-+ pPaM->DeleteMark(); //If there was a selection, get rid of it
-+ *pPaM->GetPoint() = *aPos; // Position Cursor
-+
-+ rSh.EndAllAction();
-+ rSh.LockView( FALSE );
-+}
++#include <sfx2/bindings.hxx>
++#include <sfx2/viewfrm.hxx>
++#include <cmdid.h>
++#include <view.hxx>
++#include <stdio.h>
++
++/**
++ * If SMART is defined, the navigation history has recency with temporal ordering enhancement,
++ * as described on http://zing.ncsl.nist.gov/hfweb/proceedings/greenberg/
++ */
++#define SMART 1
++
++/* Debugging flags - uncomment a flag to see printouts that might be useful when debugging the feature*/
++//#define DEBUG 1 /* For general debugging */
++//#define DEBUG_GOTO 1 /* For debugging the moving of the cursor */
++//#define DEBUG_ADDING 1 /* For debugging the adding of a new entry to the list */
++
++/*
++ * This method positions the cursor to the position rPos
++ */
++void SwNavigationMgr::GotoSwPosition(const SwPosition &rPos) {
++#if DEBUG_GOTO
++ fprintf(stderr, "Going to sw position of index %d\n", rPos.nNode.GetIndex());
++#endif
++ SwWrtShell& rSh = *_pMyShell;
++ /* EnterStdMode() prevents the cursor to 'block' the current shell when it should move from the image back to the normal shell */
++ rSh.EnterStdMode();
++ rSh.StartAllAction();
++ /*
++ * cursor consists of two SwPositions: Point and Mark.
++ * Such a pair is called a PaM. SwPaM is derived from SwRing.
++ * The Ring contains the single regions of a multi-selection.
++ */
++ SwPaM* pPaM = rSh.GetCrsr();
++
++ if(pPaM->HasMark())
++ pPaM->DeleteMark(); // If there was a selection, get rid of it
++ *pPaM->GetPoint() = rPos; // Position Cursor
+
-+SwNavigationMgr::SwNavigationMgr() {
-+ _nCurrent = -1;
-+ _iCurrent = _entries.begin();
++ rSh.EndAllAction();
+}
-+void SwNavigationMgr::setShell(SwWrtShell* shell) {
-+ _pMyShell = shell;
++/*
++ * Ctor for the SwNavigationMgr class
++ * Sets the shell to the current shell
++ * and the index of the current position to 0
++ */
++
++SwNavigationMgr::SwNavigationMgr(SwWrtShell* pShell)
++ : _nCurrent(0), _pMyShell(pShell) {
+}
++/*
++ * This method is used by the navigation shell - defined in sw/source/ui/inc/navsh.hxx
++ * and implemented in sw/source/ui/shells/navsh.cxx
++ * It is called when we want to check if the back button should be enabled or not.
++ * The back button should be enabled only if there are some entries in the navigation history
++ */
+BOOL SwNavigationMgr::backEnabled() {
-+ return (_nCurrent >= 0);
++ return (_nCurrent > 0);
+}
++/*
++ * Similar to backEnabled() method.
++ * The forward button should be enabled if we ever clicked back
++ * Due to the implementation of the navigation class, this is when the
++ * current position within the navigation history entries in not the last one
++ * i.e. when the _nCurrent index is not at the end of the _entries vector
++ */
+BOOL SwNavigationMgr::forwardEnabled() {
-+ return (_nCurrent < (int)(_entries.size() - 1));
++ return _nCurrent+1 < _entries.size();
+}
++
++
++/*
++ * The goBack() method positions the cursor to the previous entry in the navigation history
++ * If there was no history to go forward to, it adds the current position of the cursor
++ * to the history so we could go forward to where we came from
++ */
+void SwNavigationMgr::goBack() {
-+ _nCurrent--;
-+ _iCurrent--;
-+ GotoSwPosition(*_iCurrent);
++ /*
++ * Although the button should be disabled whenever the backEnabled() returns false,
++ * the UI is sometimes not as responsive as we would like it to be :)
++ * this check prevents segmentation faults and in this way the class is not relying on the UI
++ */
++ if (backEnabled()) {
++ SwWrtShell& rSh = *_pMyShell;
++ /* Trying to get the current cursor */
++ SwPaM* pPaM = rSh.GetCrsr();
++ if (!pPaM) {
++#if DEBUG
++ fprintf (stderr, "No PaM, returning...\n");
++#endif
++ return;
++ }
++
++#if DEBUG
++ fprintf(stderr, "Going back...\n");
++ fprintf(stderr, "Current position = %d\n", _nCurrent);
++#endif
++ /* This flag will be used to manually refresh the buttons */
++ bool bForwardWasDisabled = !forwardEnabled();
++ /*
++ * If we're going backwards in our history, but the current location is not
++ * in the history then we need to add *here* to it so that we can "go
++ * forward" to here again.
++ */
++
++ if (bForwardWasDisabled) {
++ /*
++ * the cursor consists of two SwPositions: Point and Mark.
++ * We are adding the current Point to the navigation history
++ * so we could later navigate forward to it
++ */
++#if DEBUG
++ fprintf(stderr, "No forward. Attempting to add the current position...\n");
++#endif
++ /* The addEntry() method returns true iff we should decrement the index before navigating back */
++ if (addEntry(*pPaM->GetPoint()) ) {
++ _nCurrent--;
++#if DEBUG
++ fprintf(stderr, "New position added to the navigation history.\n");
++#endif
++ }
++ }
++ _nCurrent--;
++#if DEBUG
++ fprintf(stderr, "Going back to position with index %d...\n", _nCurrent);
++#endif
++ /* Position cursor to appropriate navigation history entry */
++ GotoSwPosition(_entries[_nCurrent]);
++#if DEBUG
++ fprintf(stderr, "Jumped to position of index %d\n", _nCurrent);
++#endif
++ /* Refresh the buttons */
++ if (bForwardWasDisabled)
++ _pMyShell->GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_FORWARD);
++ if (!backEnabled())
++ _pMyShell->GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_BACK);
++ }
+}
++/*
++ * The goForward() method positions the cursor to the next entry in the navigation history
++ */
++
+void SwNavigationMgr::goForward() {
-+ _nCurrent++;
-+ _iCurrent++;
-+ GotoSwPosition(*_iCurrent);
++ /*
++ * Although the button should be disabled whenever the backForward() returns false,
++ * the UI is sometimes not as responsive as we would like it to be :)
++ * this check prevents segmentation faults and in this way the class is not relying on the UI
++ */
++
++ if (forwardEnabled()) {
++#if DEBUG
++ fprintf(stderr, "Going forward to position with index %d...\n", _nCurrent);
++#endif
++ /* This flag will be used to manually refresh the buttons */
++ bool bBackWasDisabled = !backEnabled();
++ /*
++ * The current index is positioned at the current entry in the navigation history
++ * We have to increment it to go to the next entry
++ */
++ _nCurrent++;
++ GotoSwPosition(_entries[_nCurrent]);
++#if DEBUG
++ fprintf(stderr, "Jumped to position of index %d\n", _nCurrent);
++#endif
++ /* Refresh the buttons */
++ if (bBackWasDisabled)
++ _pMyShell->GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_BACK);
++ if (!forwardEnabled())
++ _pMyShell->GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_FORWARD);
++ }
+}
-+void SwNavigationMgr::addEntry(SwPosition* aPos) {
-+ _entries.erase(_iCurrent, _entries.end() );
-+ _entries.push_back(aPos);
-+ _iCurrent = _entries.end(); _nCurrent = _entries.size() - 1;
++/*
++ * This method adds the SwPosition rPos to the navigation history
++ * rPos is usually the current position of the cursor in the document
++ */
++bool SwNavigationMgr::addEntry(const SwPosition& rPos) {
++#if DEBUG_ADDING
++ fprintf(stderr, "------------------\n");
++ fprintf(stderr, "Index of the entry: %d\n", rPos.nNode.GetIndex());
++ fprintf(stderr, "Before addEntry: ");
++ fprintf(stderr, "Entries.size() : %d\n", _entries.size());
++ fprintf(stderr, "Current index is %d\n", _nCurrent);
++#endif
++ /* Flags that will be used for refreshing the buttons */
++ bool bBackWasDisabled = !backEnabled();
++ bool bForwardWasEnabled = forwardEnabled();
++
++ bool bRet = false; // return value of the function.
++ // Indicates weather the index should be decremented before jumping back or not
++#if SMART
++ /* If any forward history exists, twist the tail of the list from the current position to the end */
++ if (bForwardWasEnabled) {
++
++ size_t number_of_entries = _entries.size(); /* To avoid calling _entries.size() multiple times */
++ int curr = _nCurrent; /* Index from which we'll twist the tail. */
++ int n = (number_of_entries - curr) / 2; /* Number of entries that will swap places */
++#if DEBUG_ADDING
++ fprintf(stderr, "Twisting tail from position no %d...\n", _nCurrent);
++#endif
++ for (int i = 0; i < n; i++) {
++#if DEBUG_ADDING
++ fprintf(stderr, "swaping %d and %d\n",
++ curr+i, number_of_entries - 1 - i);
++#endif
++ SwPosition temp = _entries[curr + i];
++ _entries[curr + i] = _entries[number_of_entries -1 - i];
++ _entries[number_of_entries -1 - i] = temp;
++ }
++
++ if (_entries.back() != rPos)
++ _entries.push_back(rPos);
++
++
++ bRet = true;
++ }
++ else {
++ if ( (_entries.size() > 0 && _entries.back() != rPos) || (_entries.size() == 0) ) {
++ _entries.push_back(rPos);
++ bRet = true;
++ }
++ if (_entries.size() > 1 && _entries.back() == rPos)
++ bRet = true;
++ if (_entries.size() == 1 && _entries.back() == rPos)
++ bRet = false;
++ }
++#else
++ _entries.erase(_entries.begin() + _nCurrent, _entries.end());
++ _entries.push_back(rPos);
++ bRet = true;
++#endif
++ _nCurrent = _entries.size();
++
++#if DEBUG_ADDING
++ fprintf(stderr, "After addEntry(), _entries.size() is %d\n", _entries.size());
++ fprintf(stderr, "nCurrent = %d\n", _nCurrent);
++ fprintf(stderr, "------------------\n");
++#endif
++
++ /* Refresh buttons */
++ if (bBackWasDisabled)
++ _pMyShell->GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_BACK);
++ if (bForwardWasEnabled)
++ _pMyShell->GetView().GetViewFrame()->GetBindings().Invalidate(FN_NAVIGATION_FORWARD);
++#if DEBUG_ADDING
++ if (bRet)
++ fprintf(stderr, "New entry added\n");
++#endif
++ return bRet;
+}
diff --git sw/source/ui/wrtsh/wrtsh1.cxx sw/source/ui/wrtsh/wrtsh1.cxx
-index 5403b8a..701aae9 100644
+index 9f0b753..465f178 100644
--- sw/source/ui/wrtsh/wrtsh1.cxx
+++ sw/source/ui/wrtsh/wrtsh1.cxx
-@@ -1527,6 +1527,8 @@ SelectionType SwWrtShell::GetSelectionType() const
+@@ -136,6 +136,7 @@ using namespace com::sun::star;
+ ePageMove(MV_NO),\
+ pCrsrStack(0), \
+ rView(rShell),\
++ aNavigationMgr(this), \
+ bDestOnStack(FALSE), \
+ fnLeaveSelect(&SwWrtShell::SttLeaveSelect)
+
+@@ -1011,7 +1012,7 @@ void SwWrtShell::InsertFootnote(const String &rStr, BOOL bEndNote, BOOL bEdit )
+ SwapPam();
+ ClearMark();
+ }
+-
++ SwPosition aPos = *GetCrsr()->GetPoint();
+ SwFmtFtn aFootNote( bEndNote );
+ if(rStr.Len())
+ aFootNote.SetNumStr( rStr );
+@@ -1024,6 +1025,7 @@ void SwWrtShell::InsertFootnote(const String &rStr, BOOL bEndNote, BOOL bEdit )
+ Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ GotoFtnTxt();
+ }
++ aNavigationMgr.addEntry(aPos);
+ }
+ }
+ /*------------------------------------------------------------------------
+@@ -1540,6 +1542,8 @@ SelectionType SwWrtShell::GetSelectionType() const
return nsSelectionType::SEL_FRM;
}
@@ -929,34 +1432,42 @@ index 5403b8a..701aae9 100644
if ( IsCrsrInTbl() )
nCnt |= nsSelectionType::SEL_TBL;
-@@ -1615,6 +1617,9 @@ SwFrmFmt *SwWrtShell::GetTblStyle(const String &rFmtName)
+@@ -1628,7 +1632,14 @@ SwFrmFmt *SwWrtShell::GetTblStyle(const String &rFmtName)
return 0;
}
+SwNavigationMgr& SwWrtShell::GetNavigationMgr() {
-+ return aNavigationMgr;
++ return aNavigationMgr;
+}
++void SwWrtShell::addCurrentPosition() {
++ SwPaM* pPaM = GetCrsr();
++ aNavigationMgr.addEntry(*pPaM->GetPoint());
++}
/*------------------------------------------------------------------------
Beschreibung: Anwenden der Vorlagen
-@@ -1764,6 +1769,7 @@ SwWrtShell::SwWrtShell( SwWrtShell& rSh, Window *_pWin, SwView &rShell )
- if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) {
- GotoFieldmark(pBM);
- }
-+ aNavigationMgr.setShell(this);
- }
-
+ ------------------------------------------------------------------------*/
+diff --git sw/source/ui/wrtsh/wrtsh3.cxx sw/source/ui/wrtsh/wrtsh3.cxx
+index 2f277f6..873c6dd 100644
+--- sw/source/ui/wrtsh/wrtsh3.cxx
++++ sw/source/ui/wrtsh/wrtsh3.cxx
+@@ -61,6 +61,7 @@ BOOL SwWrtShell::MoveBookMark( BookMarkMove eFuncId, const ::sw::mark::IMark* co
+ {
+ //JP 08.03.96: die Wizards brauchen die Selektion !!
+ // EndSelect();
++ addCurrentPosition();
+ (this->*fnKillSel)( 0, sal_False );
+ BOOL bRet = sal_True;
diff --git sw/uiconfig/swriter/toolbar/navigationobjectbar.xml sw/uiconfig/swriter/toolbar/navigationobjectbar.xml
new file mode 100644
-index 0000000..f30056f
+index 0000000..6cea7c3
--- /dev/null
+++ sw/uiconfig/swriter/toolbar/navigationobjectbar.xml
-@@ -0,0 +1,7 @@
+@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
-+ <toolbar:toolbaritem xlink:href=".uno:NavigateBack" toolbar:helpid="helpid:22311"/>
-+ <toolbar:toolbarseparator/>
-+ <toolbar:toolbaritem xlink:href=".uno:NavigateForward" toolbar:helpid="helpid:22312"/>
++ <toolbar:toolbaritem xlink:href=".uno:NavigateBack" toolbar:helpid="helpid:22314"/>
++ <toolbar:toolbaritem xlink:href=".uno:NavigateForward" toolbar:helpid="helpid:22315"/>
+</toolbar:toolbar>
More information about the ooo-build-commit
mailing list