summaryrefslogtreecommitdiff
path: root/patches/dev300/writer-navigation-buttons.diff
blob: c0e9f6630c9683319b492b0d1fc4c94d849fc427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
Feature from Maja's GSoc project

From: Cédric Bosdonnat <cedricbosdo@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 4fa2366..dc35bbc 100644
--- officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -2274,6 +2274,22 @@
                     <value xml:lang="en-US">Continue previous numbering</value>
                 </prop>
             </node>
+            <node oor:name=".uno:NavigateBack" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">Back</value>
+                </prop>
+                <prop oor:name="Properties" oor:type="xs:int">
+                    <value>1</value>
+                </prop>
+            </node>
+                <node oor:name=".uno:NavigateForward" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">Forward</value>
+                </prop>
+                <prop oor:name="Properties" oor:type="xs:int">
+                    <value>1</value>
+                </prop>
+            </node>
         </node>
     </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 c18fc70..4b41812 100644
--- officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu
+++ officecfg/registry/data/org/openoffice/Office/UI/WriterGlobalWindowState.xcu
@@ -649,6 +649,29 @@
                     <value>true</value>
                 </prop>
             </node>
+            <node oor:name="private:resource/toolbar/navigationobjectbar" oor:op="replace">
+                <prop oor:name="DockingArea" oor:type="xs:int">
+                    <value>0</value>
+                </prop>
+                <prop oor:name="DockPos" oor:type="xs:string">
+                    <value>0,1</value>
+                </prop>
+                <prop oor:name="Docked" oor:type="xs:boolean">
+                    <value>true</value>
+                </prop>
+                <prop oor:name="Visible" oor:type="xs:boolean">
+                    <value>true</value>
+                </prop>
+                <prop oor:name="UIName" oor:type="xs:string">
+                    <value xml:lang="en-US">Navigation</value>
+                </prop>
+                <prop oor:name="HideFromToolbarMenu" oor:type="xs:boolean">
+                    <value>false</value>
+                </prop>
+                <prop oor:name="ContextSensitive" oor:type="xs:boolean">
+                    <value>false</value>
+                </prop>
+            </node>
         </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 51b7224..f1d14cd 100644
--- officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
+++ officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
@@ -655,6 +655,29 @@
                     <value>true</value>
                 </prop>
             </node>
+            <node oor:name="private:resource/toolbar/navigationobjectbar" oor:op="replace">
+                <prop oor:name="DockingArea" oor:type="xs:int">
+                    <value>0</value>
+                </prop>
+                <prop oor:name="DockPos" oor:type="xs:string">
+                    <value>0,1</value>
+                </prop>
+                <prop oor:name="Docked" oor:type="xs:boolean">
+                    <value>true</value>
+                </prop>
+                <prop oor:name="Visible" oor:type="xs:boolean">
+                    <value>true</value>
+                </prop>
+                <prop oor:name="UIName" oor:type="xs:string">
+                    <value xml:lang="en-US">Navigation</value>
+                </prop>
+                <prop oor:name="HideFromToolbarMenu" oor:type="xs:boolean">
+                    <value>false</value>
+                </prop>
+                <prop oor:name="ContextSensitive" oor:type="xs:boolean">
+                    <value>false</value>
+                </prop>
+            </node>
         </node>
     </node>
 </oor:component-data>
diff --git packimages/pack/image-sort.lst packimages/pack/image-sort.lst
index d7a615b..5339b55 100644
--- packimages/pack/image-sort.lst
+++ packimages/pack/image-sort.lst
@@ -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
+uiconfig/modules/swriter/toolbar/navigationobjectbar.xml
 uiconfig/modules/swriter/toolbar/numobjectbar.xml
 uiconfig/modules/swriter/toolbar/oleobjectbar.xml
 uiconfig/modules/swriter/toolbar/optimizetablebar.xml
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 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_META                         (FN_EXTRA2 + 112)
 #define FN_UNO_NESTED_TEXT_CONTENT          (FN_EXTRA2 + 113)
 
+#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 9f5c6ad..f0658f1 100644
--- sw/inc/helpid.h
+++ sw/inc/helpid.h
@@ -982,5 +982,7 @@
 #define HID_MM_HEADER_13                            (HID_BASE + 2280)
 
 #define HID_TITLEPAGE 						  		(HID_BASE + 2281)
+
+#define HID_NAVIGATION_TOOLBOX                      (HID_BASE + 2282)
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git sw/inc/shellid.hxx sw/inc/shellid.hxx
index 65af848..e3ef3e6 100644
--- sw/inc/shellid.hxx
+++ sw/inc/shellid.hxx
@@ -70,6 +70,7 @@
 #define SW_MEDIASHELL 			(SFX_INTERFACE_SW_START + 31)
 #define SW_ANNOTATIONSHELL 		(SFX_INTERFACE_SW_START + 32)
 
+#define SW_NAVIGATIONSHELL              (SFX_INTERFACE_SW_START + 33)
 #endif // _UIPARAM_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git sw/sdi/_navsh.sdi sw/sdi/_navsh.sdi
new file mode 100644
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
+ *
+ * $RCSfile: _navsh.sdi,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+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";
+	]
+
+}
+
diff --git sw/sdi/makefile.mk sw/sdi/makefile.mk
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 \
         swslots.hrc \
         $(INC)$/globals.hrc \
                 $(INC)$/cmdid.h 
diff --git sw/sdi/navsh.sdi sw/sdi/navsh.sdi
new file mode 100644
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: navsh.sdi,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+shell SwNavigationShell
+{
+	import _Navigation[Automation];
+}
diff --git sw/sdi/swriter.sdi sw/sdi/swriter.sdi
index 633cda7..72d2557 100755
--- sw/sdi/swriter.sdi
+++ sw/sdi/swriter.sdi
@@ -10341,3 +10341,54 @@ SfxVoidItem CopyHyperlinkLocation FN_COPY_HYPERLINK_LOCATION
     ToolBoxConfig = TRUE,
     GroupId = GID_EDIT;
 ]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NavigateBack FN_NAVIGATION_BACK
+[
+    /* flags: */
+    AutoUpdate = TRUE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+    Readonly = FALSE,
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_NAVIGATION;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem NavigateForward FN_NAVIGATION_FORWARD
+[
+    /* flags: */
+    AutoUpdate = TRUE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+    Readonly = FALSE,
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_NAVIGATION;
+]
diff --git sw/sdi/swslots.sdi sw/sdi/swslots.sdi
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"
 }
 
 
diff --git sw/source/ui/app/swmodule.cxx sw/source/ui/app/swmodule.cxx
index 569e068..8aa0ee9 100644
--- sw/source/ui/app/swmodule.cxx
+++ sw/source/ui/app/swmodule.cxx
@@ -161,6 +161,7 @@
 #include <avmedia/mediatoolbox.hxx>
 
 #include <annotsh.hxx>
+#include <navsh.hxx>
 
 #include <app.hrc>
 #include <svx/xmlsecctrl.hxx>
@@ -348,6 +349,7 @@ void SwDLL::RegisterInterfaces()
     SwBezierShell::RegisterInterface(pMod);
     SwGrfShell::RegisterInterface(pMod);
     SwOleShell::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..4044767
--- /dev/null
+++ sw/source/ui/inc/navmgr.hxx
@@ -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
+ *
+ * $RCSfile: navmgr.hxx,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NAVMGR_HXX
+#define _NAVMGR_HXX
+
+#include "swtypes.hxx"
+#include "pam.hxx"
+#include "swdllapi.h"
+
+class	SwWrtShell;
+struct  SwPosition;
+
+class SW_DLLPUBLIC SwNavigationMgr
+{
+private:
+	/*
+	 * 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:
+	/* 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
new file mode 100644
index 0000000..5f0c3c6
--- /dev/null
+++ sw/source/ui/inc/navsh.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * 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: navsh.hxx,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWNAVIGATIONSH_HXX
+#define _SWNAVIGATIONSH_HXX
+
+#include "frmsh.hxx"
+
+class SfxItemSet;
+class SwWrtShell;
+
+
+
+class SwNavigationShell: public SwBaseShell
+{
+public:
+  SFX_DECL_INTERFACE(SW_NAVIGATIONSHELL)
+
+  SwNavigationShell(SwView &rView);
+
+  void	GetState(SfxItemSet &);
+  void 	Execute(SfxRequest &);
+};
+
+#endif
diff --git sw/source/ui/inc/shells.hrc sw/source/ui/inc/shells.hrc
index 243c4fc..847d322 100644
--- sw/source/ui/inc/shells.hrc
+++ sw/source/ui/inc/shells.hrc
@@ -102,7 +102,9 @@
 
 #define RID_MEDIA_TOOLBOX         	(RC_SHELLS_BEGIN + 61)
 
-#define SHELLS_ACT_END              RID_MEDIA_TOOLBOX
+#define STR_SHELLNAME_NAVIGATION   (RC_SHELLS_BEGIN +  62)
+
+#define SHELLS_ACT_END              STR_SHELLNAME_NAVIGATION
 
 #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 08e27ac..09f0c1b 100644
--- sw/source/ui/inc/view.hxx
+++ sw/source/ui/inc/view.hxx
@@ -129,7 +129,8 @@ enum ShellModes
     SHELL_MODE_MEDIA,
     SHELL_MODE_EXTRUDED_CUSTOMSHAPE,
     SHELL_MODE_FONTWORK,
-    SHELL_MODE_POSTIT
+	SHELL_MODE_POSTIT,
+	SHELL_MODE_NAVIGATION
 };
 
 /*--------------------------------------------------------------------
diff --git sw/source/ui/inc/wrtsh.hxx sw/source/ui/inc/wrtsh.hxx
index 14b26c0..3adf7dd 100644
--- sw/source/ui/inc/wrtsh.hxx
+++ sw/source/ui/inc/wrtsh.hxx
@@ -33,6 +33,7 @@
 #include <sortopt.hxx>
 #include <swurl.hxx>
 #include <IMark.hxx>
+#include "navmgr.hxx"

 class Window;
 class OutputDevice;
@@ -84,6 +85,7 @@ namespace nsSelectionType
     const SelectionType SEL_EXTRUDED_CUSTOMSHAPE = 0x008000; 	// extruded custom shape
     const SelectionType SEL_FONTWORK  		= 0x010000;	// fontwork
     const SelectionType SEL_POSTIT			= 0x020000;	//annotation
+    const SelectionType SEL_NAV             = 0x040000; //navigation buttons
 }
 
 
@@ -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 +547,7 @@ private:
     } *pCrsrStack;
 
     SwView	&rView;
+	SwNavigationMgr aNavigationMgr;
 
     Point	aDest;
     BOOL	bDestOnStack;
diff --git sw/source/ui/shells/makefile.mk sw/source/ui/shells/makefile.mk
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)$/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..9f3a1ca
--- /dev/null
+++ sw/source/ui/shells/navsh.cxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * 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: navsh.cxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include "cmdid.h"
+#include <svx/svdview.hxx>
+#include <svx/srchitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svdopath.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objface.hxx>
+
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "helpid.h"
+#include "globals.hrc"
+
+#include "navsh.hxx"
+
+
+#include "popup.hrc"
+#include "shells.hrc"
+#define SwNavigationShell
+#include "swslots.hxx"
+
+#include <unomid.h>
+
+#include "navmgr.hxx"
+
+#if DEBUG
+#include <iostream>
+using namespace std;
+#endif
+
+
+//#define DEBUG_STATE 1
+//#define DEBUG_EXECUTE 1
+
+SFX_IMPL_INTERFACE(SwNavigationShell, SwBaseShell, SW_RES(STR_SHELLNAME_NAVIGATION))
+{
+}
+
+SwNavigationShell::SwNavigationShell(SwView &_rView):
+  SwBaseShell( _rView )
+
+{
+  SetName(C2S("Navigation"));
+  SetHelpId(SW_NAVIGATIONSHELL);
+}
+
+void SwNavigationShell::Execute(SfxRequest &rReq)
+{
+#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
+}
+
+/*--------------------------------------------------------------------
+  determine if the buttons should be enabled/disabled
+  --------------------------------------------------------------------*/
+
+
+void SwNavigationShell::GetState(SfxItemSet &rSet)
+{
+  SwWrtShell *pSh = &GetShell();
+  SfxWhichIter aIter( rSet );
+  USHORT nWhich = aIter.FirstWhich();
+  SwNavigationMgr& aNavigationMgr = pSh->GetNavigationMgr();
+  while( nWhich )
+    {
+      switch( nWhich )
+	{
+	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_STATE
+	    clog << "SwNavigationShell::GetState( FN_NAVIGATION_FORWARD )" << endl;
+#endif
+	    if (!aNavigationMgr.forwardEnabled())
+	      rSet.DisableItem(FN_NAVIGATION_FORWARD);
+	  }
+	  break;
+	default:
+	  break;
+	}
+      nWhich = aIter.NextWhich();
+    }
+}
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 0e3d55e..dabdefa 100644
--- sw/source/ui/uiview/view.cxx
+++ sw/source/ui/uiview/view.cxx
@@ -73,6 +73,7 @@
 #include <drformsh.hxx>
 #include <drwtxtsh.hxx>
 #include <beziersh.hxx>
+#include <navsh.hxx>
 #include <globdoc.hxx>
 #include <scroll.hxx>
 #include <globdoc.hxx>
@@ -335,6 +336,13 @@ void SwView::SelectShell()
         if ( !( nSelectionType & nsSelectionType::SEL_FOC_FRM_CTRL ) )
             rDispatcher.Push( *pFormShell );
 
+        if ( nSelectionType & nsSelectionType::SEL_NAV )
+        {
+            eShellMode = SHELL_MODE_NAVIGATION;
+            pShell = new SwNavigationShell( *this );
+            rDispatcher.Push( *pShell );
+        }
+
         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 a59244a..6f44d96 100644
--- sw/source/ui/utlui/content.cxx
+++ sw/source/ui/utlui/content.cxx
@@ -114,6 +114,7 @@
 #include "globals.hrc"
 #include <unomid.h>
 
+#include "navmgr.hxx"
 
 #define CTYPE_CNT	0
 #define CTYPE_CTT	1
@@ -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..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)$/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;
 }


diff --git sw/source/ui/wrtsh/navmgr.cxx sw/source/ui/wrtsh/navmgr.cxx
new file mode 100644
index 0000000..a0fc70f
--- /dev/null
+++ sw/source/ui/wrtsh/navmgr.cxx
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: navmgr.cxx,v $
+ * $Revision: 2.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_sw.hxx"
+
+#include "navmgr.hxx"
+#include "wrtsh.hxx"
+#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
+
+	rSh.EndAllAction();
+}
+/*
+ * 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);
+}
+/*
+ * 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+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()  {
+	/*
+	 * 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() {
+	/*
+	 * 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);
+	}
+}
+/*
+ * 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 9f0b753..465f178 100644
--- sw/source/ui/wrtsh/wrtsh1.cxx
+++ sw/source/ui/wrtsh/wrtsh1.cxx
@@ -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;
     }
 
+    nCnt |= nsSelectionType::SEL_NAV;
+
     if ( IsCrsrInTbl() )
         nCnt |= nsSelectionType::SEL_TBL;
 
@@ -1628,7 +1632,14 @@ SwFrmFmt *SwWrtShell::GetTblStyle(const String &rFmtName)
     return 0;
 }
 
+SwNavigationMgr& SwWrtShell::GetNavigationMgr() {
+	return aNavigationMgr;
+}
 
+void SwWrtShell::addCurrentPosition() {
+    SwPaM* pPaM = GetCrsr();
+    aNavigationMgr.addEntry(*pPaM->GetPoint());
+}
 /*------------------------------------------------------------------------
  Beschreibung:	Anwenden der Vorlagen
 ------------------------------------------------------------------------*/
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..6cea7c3
--- /dev/null
+++ sw/uiconfig/swriter/toolbar/navigationobjectbar.xml
@@ -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:22314"/>
+  <toolbar:toolbaritem xlink:href=".uno:NavigateForward" toolbar:helpid="helpid:22315"/>
+</toolbar:toolbar>