Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/airbrush.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/airbrush.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/ase.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/ase.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/asn.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/asn.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/asne.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/asne.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/asns.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/asns.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/asnswe.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/asnswe.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/asnw.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/asnw.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/ass.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/ass.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/asse.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/asse.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/assw.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/assw.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/asw.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/asw.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/aswe.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/aswe.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/chain.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/chain.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/chainnot.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/chainnot.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/chart.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/chart.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/copydata.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/copydata.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/copydlnk.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/copydlnk.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/copyf.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/copyf.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/copyf2.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/copyf2.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/copyflnk.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/copyflnk.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/crook.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/crook.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/crop.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/crop.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/darc.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/darc.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dbezier.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dbezier.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dcapt.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dcapt.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dcirccut.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dcirccut.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dconnect.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dconnect.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dellipse.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dellipse.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/detectiv.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/detectiv.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dfree.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dfree.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dline.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dline.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dpie.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dpie.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dpolygon.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dpolygon.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/drect.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/drect.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/dtext.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/dtext.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/fill.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/fill.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/help.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/help.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/hourglass.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/hourglass.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/hshear.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/hshear.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/linkdata.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/linkdata.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/linkf.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/linkf.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/magnify.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/magnify.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/mirror.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/mirror.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/movebw.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/movebw.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/movedata.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/movedata.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/movedlnk.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/movedlnk.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/movef.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/movef.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/movef2.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/movef2.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/moveflnk.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/moveflnk.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/movept.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/movept.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/neswsize.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/neswsize.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/notallow.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/notallow.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/nullptr.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/nullptr.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/nwsesize.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/nwsesize.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/pen.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/pen.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/pivotcol.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/pivotcol.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/pivotdel.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/pivotdel.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/pivotfld.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/pivotfld.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/pivotrow.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/pivotrow.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/pntbrsh.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/pntbrsh.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/rotate.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/rotate.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/tblsele.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/tblsele.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/tblsels.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/tblsels.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/tblselse.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/tblselse.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/tblselsw.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/tblselsw.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/tblselw.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/tblselw.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/timemove.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/timemove.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/timesize.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/timesize.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/vshear.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/vshear.png differ
Binary files ooo_SRC680_m233_src.orig/instsetoo_native/macosx/application/cursors/vtext.png and ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/application/cursors/vtext.png differ
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/instsetoo_native/macosx/makefile.mk ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/makefile.mk
--- ooo_SRC680_m233_src.orig/instsetoo_native/macosx/makefile.mk	2007-10-09 17:05:49.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/instsetoo_native/macosx/makefile.mk	2007-10-18 16:10:58.000000000 +0200
@@ -66,6 +66,78 @@
     $(CONTENTS)$/Resources$/MainMenu.nib$/info.nib   \
     $(CONTENTS)$/Resources$/MainMenu.nib$/keyedobjects.nib
 
+cursorfiles = \
+	$(CONTENTS)$/Resources$/cursors$/airbrush.png   \
+	$(CONTENTS)$/Resources$/cursors$/ase.png   \
+	$(CONTENTS)$/Resources$/cursors$/asn.png   \
+	$(CONTENTS)$/Resources$/cursors$/asne.png   \
+	$(CONTENTS)$/Resources$/cursors$/asns.png   \
+	$(CONTENTS)$/Resources$/cursors$/asnswe.png   \
+	$(CONTENTS)$/Resources$/cursors$/asnw.png   \
+	$(CONTENTS)$/Resources$/cursors$/ass.png   \
+	$(CONTENTS)$/Resources$/cursors$/asse.png   \
+	$(CONTENTS)$/Resources$/cursors$/assw.png   \
+	$(CONTENTS)$/Resources$/cursors$/asw.png   \
+	$(CONTENTS)$/Resources$/cursors$/aswe.png   \
+	$(CONTENTS)$/Resources$/cursors$/chain.png   \
+	$(CONTENTS)$/Resources$/cursors$/chainnot.png   \
+	$(CONTENTS)$/Resources$/cursors$/chart.png   \
+	$(CONTENTS)$/Resources$/cursors$/copydata.png   \
+	$(CONTENTS)$/Resources$/cursors$/copydlnk.png   \
+	$(CONTENTS)$/Resources$/cursors$/copyf.png   \
+	$(CONTENTS)$/Resources$/cursors$/copyf2.png   \
+	$(CONTENTS)$/Resources$/cursors$/copyflnk.png   \
+	$(CONTENTS)$/Resources$/cursors$/crook.png   \
+	$(CONTENTS)$/Resources$/cursors$/crop.png   \
+	$(CONTENTS)$/Resources$/cursors$/darc.png   \
+	$(CONTENTS)$/Resources$/cursors$/dbezier.png   \
+	$(CONTENTS)$/Resources$/cursors$/dcapt.png   \
+	$(CONTENTS)$/Resources$/cursors$/dcirccut.png   \
+	$(CONTENTS)$/Resources$/cursors$/dconnect.png   \
+	$(CONTENTS)$/Resources$/cursors$/dellipse.png   \
+	$(CONTENTS)$/Resources$/cursors$/detectiv.png   \
+	$(CONTENTS)$/Resources$/cursors$/dfree.png   \
+	$(CONTENTS)$/Resources$/cursors$/dline.png   \
+	$(CONTENTS)$/Resources$/cursors$/dpie.png   \
+	$(CONTENTS)$/Resources$/cursors$/dpolygon.png   \
+	$(CONTENTS)$/Resources$/cursors$/drect.png   \
+	$(CONTENTS)$/Resources$/cursors$/dtext.png   \
+	$(CONTENTS)$/Resources$/cursors$/fill.png   \
+	$(CONTENTS)$/Resources$/cursors$/help.png   \
+	$(CONTENTS)$/Resources$/cursors$/hourglass.png   \
+	$(CONTENTS)$/Resources$/cursors$/hshear.png   \
+	$(CONTENTS)$/Resources$/cursors$/linkdata.png   \
+	$(CONTENTS)$/Resources$/cursors$/linkf.png   \
+	$(CONTENTS)$/Resources$/cursors$/magnify.png   \
+	$(CONTENTS)$/Resources$/cursors$/mirror.png   \
+	$(CONTENTS)$/Resources$/cursors$/movebw.png   \
+	$(CONTENTS)$/Resources$/cursors$/movedata.png   \
+	$(CONTENTS)$/Resources$/cursors$/movedlnk.png   \
+	$(CONTENTS)$/Resources$/cursors$/movef.png   \
+	$(CONTENTS)$/Resources$/cursors$/movef2.png   \
+	$(CONTENTS)$/Resources$/cursors$/moveflnk.png   \
+	$(CONTENTS)$/Resources$/cursors$/movept.png   \
+	$(CONTENTS)$/Resources$/cursors$/neswsize.png   \
+	$(CONTENTS)$/Resources$/cursors$/notallow.png   \
+	$(CONTENTS)$/Resources$/cursors$/nullptr.png   \
+	$(CONTENTS)$/Resources$/cursors$/nwsesize.png   \
+	$(CONTENTS)$/Resources$/cursors$/pen.png   \
+	$(CONTENTS)$/Resources$/cursors$/pivotcol.png   \
+	$(CONTENTS)$/Resources$/cursors$/pivotdel.png   \
+	$(CONTENTS)$/Resources$/cursors$/pivotfld.png   \
+	$(CONTENTS)$/Resources$/cursors$/pivotrow.png   \
+	$(CONTENTS)$/Resources$/cursors$/pntbrsh.png   \
+	$(CONTENTS)$/Resources$/cursors$/rotate.png   \
+	$(CONTENTS)$/Resources$/cursors$/tblsele.png   \
+	$(CONTENTS)$/Resources$/cursors$/tblsels.png   \
+	$(CONTENTS)$/Resources$/cursors$/tblselse.png   \
+	$(CONTENTS)$/Resources$/cursors$/tblselsw.png   \
+	$(CONTENTS)$/Resources$/cursors$/tblselw.png   \
+	$(CONTENTS)$/Resources$/cursors$/timemove.png   \
+	$(CONTENTS)$/Resources$/cursors$/timesize.png   \
+	$(CONTENTS)$/Resources$/cursors$/vshear.png   \
+	$(CONTENTS)$/Resources$/cursors$/vtext.png    
+
 ZIPFLAGS = -r
 ZIP1TARGET = osxbundle
 ZIP1DIR = $(CONTENTS)
@@ -83,7 +155,7 @@
 
 .INCLUDE : target.mk
 
-$(ZIP1TARGETN) : $(scriptfiles) $(plistfiles) $(nibfiles)
+$(ZIP1TARGETN) : $(scriptfiles) $(plistfiles) $(nibfiles) $(cursorfiles)
 
 $(plistfiles) : $(scriptfiles)
 
@@ -109,7 +181,12 @@
         sed "s|\%BUNDLEEXECUTABLE|${BUNDLEEXECUTABLE}|g" "$(VERSIONED)/$<" > "$@"
 
 # nibs are just copied
-$(CONTENTS)$/Resources$/MainMenu.nib$/%.nib: application/MainMenu.nib$/%.nib
+$(CONTENTS)$/Resources$/MainMenu.nib$/%.nib: application$/MainMenu.nib$/%.nib
+    $(MKDIRHIER) $(@:d)
+    $(COPY) "$<" "$@"
+
+# cursor files are just copied
+$(CONTENTS)$/Resources$/cursors$/%.png: application$/cursors$/%.png
     $(MKDIRHIER) $(@:d)
     $(COPY) "$<" "$@"
 
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/rsc/inc/vclrsc.hxx ooo_SRC680_m233_src.aquavcl04/rsc/inc/vclrsc.hxx
--- ooo_SRC680_m233_src.orig/rsc/inc/vclrsc.hxx	2007-06-19 18:11:22.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/rsc/inc/vclrsc.hxx	2007-10-19 16:41:39.000000000 +0200
@@ -214,8 +214,8 @@
 #define KEY_SHIFT		((sal_uInt16)0x1000)
 #define KEY_MOD1		((sal_uInt16)0x2000)
 #define KEY_MOD2		((sal_uInt16)0x4000)
-#define KEY_MODTYPE 	((sal_uInt16)0x7000)
-#define KEY_CONTROLMOD	((sal_uInt16)0x8000)
+#define KEY_MOD3		((sal_uInt16)0x8000)
+#define KEY_MODTYPE 	((sal_uInt16)0xF000)
 #define KEY_ALLMODTYPE	((sal_uInt16)0xF000)
 
 
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/solenv/inc/rules.mk ooo_SRC680_m233_src.aquavcl04/solenv/inc/rules.mk
--- ooo_SRC680_m233_src.orig/solenv/inc/rules.mk	2007-09-21 11:17:06.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/solenv/inc/rules.mk	2007-10-15 16:03:39.000000000 +0200
@@ -367,11 +367,11 @@
 	@echo Making: $@
 .IF "$(OS)"=="MACOSX"
 .IF "$(TEST)"!=""
-	$(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) -E $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $*.mm
+	$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) -E $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $*.mm
 .ELSE
 	@$(RM) $@ $(@:s/.obj/.o/)
-	$(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $*.mm
-	+if ( -e $(@:s/.obj/.o/)) $(TOUCH) $@
+	$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $*.mm
+ 	$(IFEXIST) $(@:s/.obj/.o/) $(THEN) $(TOUCH) $@ $(FI)
 .ENDIF
 .ELSE		"$(OS)"=="MACOSX"
 	@echo "No recipe for compiling Objective-C++ files is available for this platform"
@@ -383,8 +383,8 @@
 	@echo Making: $@
 .IF "$(OS)"=="MACOSX"
 	@$(RM) $@ $(@:s/.obj/.o/)
-	$(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $(MISC)$/$*.mm
-	+if ( -e $(@:s/.obj/.o/)) $(TOUCH) $@
+	$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)$/$*.o $(MISC)$/$*.mm
+ 	$(IFEXIST) $(@:s/.obj/.o/) $(THEN) $(TOUCH) $@ $(FI)
 .ELSE		"$(OS)"=="MACOSX"
 	@echo "No recipe for compiling Objective-C++ files is available for this platform"
 .ENDIF		"$(OS)"=="MACOSX"
@@ -395,8 +395,8 @@
 	@echo Making: $@
 .IF "$(OS)"=="MACOSX"
 	@$(RM) $@ $(@:s/.obj/.o/)
-	$(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)$/$*.o $(MISC)$/$*.mm
-	+if ( -e $(@:s/.obj/.o/)) $(TOUCH) $@
+	$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(OBJCXXFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)$/$*.o $(MISC)$/$*.mm
+ 	$(IFEXIST) $(@:s/.obj/.o/) $(THEN) $(TOUCH) $@ $(FI)
 .ELSE		"$(OS)"=="MACOSX"
 	@echo "No recipe for compiling Objective-C++ files is available for this platform"
 .ENDIF		"$(OS)"=="MACOSX"
@@ -407,8 +407,8 @@
 	@echo Making: $@
 .IF "$(OS)"=="MACOSX"
 	@$(RM) $@ $(@:s/.obj/.o/)
-	$(objc) $(CFLAGS) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)$/$*.o $*.mm
-	+if ( -e $(@:s/.obj/.o/)) $(TOUCH) $@
+	$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(OBJCXXFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)$/$*.o $*.mm
+ 	$(IFEXIST) $(@:s/.obj/.o/) $(THEN) $(TOUCH) $@ $(FI)
 .ELSE		"$(OS)"=="MACOSX"
 	@echo "No recipe for compiling Objective-C++ files is available for this platform"
 .ENDIF		"$(OS)"=="MACOSX"
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/solenv/inc/unxmacx.mk ooo_SRC680_m233_src.aquavcl04/solenv/inc/unxmacx.mk
--- ooo_SRC680_m233_src.orig/solenv/inc/unxmacx.mk	2007-10-09 17:05:16.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/solenv/inc/unxmacx.mk	2007-10-15 17:17:57.000000000 +0200
@@ -84,9 +84,11 @@
 # CC = C++ compiler to use
 # cc = C compiler to use
 # objc = Objective C compiler to use
+# objcpp = Objective C++ compiler to use
 CXX*=g++
 CC*=gcc
-objc=cc
+objc*=gcc
+objcpp*=g++
 
 CFLAGS=-fsigned-char -fmessage-length=0 -malign-natural -c
 
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/svx/source/svdraw/svdhdl.cxx ooo_SRC680_m233_src.aquavcl04/svx/source/svdraw/svdhdl.cxx
--- ooo_SRC680_m233_src.orig/svx/source/svdraw/svdhdl.cxx	2007-07-18 12:56:21.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/svx/source/svdraw/svdhdl.cxx	2007-10-18 18:34:24.000000000 +0200
@@ -898,9 +898,9 @@
         } else {
             switch (eKind) {
                 case HDL_UPLFT: ePtr=POINTER_NWSIZE;  break;
-                case HDL_UPPER: ePtr=POINTER_SSIZE;     break;
+                case HDL_UPPER: ePtr=POINTER_NSIZE;     break;
                 case HDL_UPRGT: ePtr=POINTER_NESIZE;  break;
-                case HDL_LEFT : ePtr=POINTER_ESIZE;     break;
+                case HDL_LEFT : ePtr=POINTER_WSIZE;     break;
                 case HDL_RIGHT: ePtr=POINTER_ESIZE;     break;
                 case HDL_LWLFT: ePtr=POINTER_SWSIZE;  break;
                 case HDL_LOWER: ePtr=POINTER_SSIZE;     break;
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/sw/source/ui/docvw/edtwin.cxx ooo_SRC680_m233_src.aquavcl04/sw/source/ui/docvw/edtwin.cxx
--- ooo_SRC680_m233_src.orig/sw/source/ui/docvw/edtwin.cxx	2007-09-27 13:40:19.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/sw/source/ui/docvw/edtwin.cxx	2007-10-19 17:18:57.000000000 +0200
@@ -1603,7 +1603,7 @@
 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #endif
 
-			if( !rKeyCode.IsControlMod() && '=' == aCh &&
+			if( '=' == aCh &&
 				!rSh.IsTableMode() && rSh.GetTableFmt() &&
 				rSh.IsSttPara() /*&& rSh.IsEndPara()*/ &&
 				!rSh.HasReadonlySel() )
@@ -2191,7 +2191,7 @@
 		case KS_KeyToView:
 			{
 				eKeyState = KS_Ende;
-                bNormalChar = !rKeyCode.IsControlMod() &&
+                bNormalChar =
                     rKeyCode.GetModifier() != (KEY_MOD1) &&
                     rKeyCode.GetModifier() != (KEY_MOD1|KEY_SHIFT) &&
                                 SW_ISPRINTABLE( aCh );
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/aquaprintview.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/aquaprintview.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/aquaprintview.h	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/aquaprintview.h	2007-10-15 15:24:24.000000000 +0200
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+#ifndef _VCL_AQUAPRINTVIEW_H
+#define _VCL_AQUAPRINTVIEW_H
+
+#include "premac.h"
+#include <Cocoa/Cocoa.h>
+#include "postmac.h"
+
+class ImplQPrinter;
+class AquaSalInfoPrinter;
+
+@interface AquaPrintView : NSView
+{
+    ImplQPrinter*       mpQPrinter;
+    AquaSalInfoPrinter* mpInfoPrinter;
+}
+-(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter;
+-(MacOSBOOL)knowsPageRange: (NSRangePointer)range;
+-(NSRect)rectForPage: (int)page;
+-(NSPoint)locationOfPrintRect: (NSRect)aRect;
+-(void)drawRect: (NSRect)rect;
+@end
+
+
+#endif
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/saldata.hxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/saldata.hxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/saldata.hxx	2007-10-09 17:09:03.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/saldata.hxx	2007-10-17 20:13:38.000000000 +0200
@@ -44,8 +44,10 @@
 #include "vcl/sv.h"
 #include "vcl/svdata.hxx"
 #include "vcl/salwtype.hxx"
+#include "vcl/ptrstyle.hxx"
 
 #include <list>
+#include <vector>
 #include <hash_set>
 
 #include <cstdio>
@@ -76,6 +78,8 @@
     { return std::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); }
 };
 
+#define INVALID_CURSOR_PTR (NSCursor*)0xdeadbeef
+
 struct SalData
 {
     
@@ -90,6 +94,8 @@
     
     CGColorSpaceRef                               mxRGBSpace;
     CGColorSpaceRef                               mxGraySpace;
+    
+    std::vector< NSCursor* >                      maCursors;
 
     static FILE                                  *s_pLog;
 
@@ -103,14 +109,24 @@
         mpFirstPrinter( NULL ),
         mpFontList( NULL ),
         mxRGBSpace( CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB) ),
-        mxGraySpace( CGColorSpaceCreateWithName(kCGColorSpaceGenericGray) )
+        mxGraySpace( CGColorSpaceCreateWithName(kCGColorSpaceGenericGray) ),
+        maCursors( POINTER_COUNT, INVALID_CURSOR_PTR ),
+        mbIsScrollbarDoubleMax( false )
     {}
     
     ~SalData()
     {
         CFRelease( mxRGBSpace );
         CFRelease( mxGraySpace );
+        for( unsigned int i = 0; i < maCursors.size(); i++ )
+        {
+            NSCursor* pCurs = maCursors[i];
+            if( pCurs && pCurs != INVALID_CURSOR_PTR )
+                [pCurs release];
+        }
     }
+    
+    NSCursor* getCursor( PointerStyle i_eStyle );
 };
 
 void AquaLog( const char* pFormat, ... );
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/salframe.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salframe.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/salframe.h	2007-10-09 17:09:28.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salframe.h	2007-10-15 15:24:24.000000000 +0200
@@ -200,73 +200,4 @@
     AquaSalFrame& operator=(const AquaSalFrame&);
 };
 
-@interface SalFrameWindow : NSWindow
-{
-    AquaSalFrame*       mpFrame;
-}
--(id)initWithSalFrame: (AquaSalFrame*)pFrame;
--(void)windowDidBecomeKey: (NSNotification*)pNotification;
--(void)windowDidResignKey: (NSNotification*)pNotification;
--(void)windowDidChangeScreen: (NSNotification*)pNotification;
--(void)windowDidMove: (NSNotification*)pNotification;
--(void)windowDidResize: (NSNotification*)pNotification;
--(void)windowDidMiniaturize: (NSNotification*)pNotification;
--(void)windowDidDeminiaturize: (NSNotification*)pNotification;
--(MacOSBOOL)windowShouldClose: (NSNotification*)pNotification;
--(void)dockMenuItemTriggered: (id)sender;
--(AquaSalFrame*)getSalFrame;
-@end
-
-@interface SalFrameView : NSView <NSTextInput>
-{
-    AquaSalFrame*       mpFrame;
-
-    // for NSTextInput
-    id mpLastEvent;
-    BOOL mbNeedSpecialKeyHandle;
-    BOOL mbInKeyInput;
-    BOOL mbKeyHandled;
-    NSRange mMarkedRange;
-    NSRange mSelectedRange;
-}
--(id)initWithSalFrame: (AquaSalFrame*)pFrame;
--(MacOSBOOL)acceptsFirstResponder;
--(MacOSBOOL)acceptsFirstMouse: (NSEvent *)pEvent;
--(MacOSBOOL)isOpaque;
--(void)drawRect: (NSRect)aRect;
--(void)mouseDown: (NSEvent*)pEvent;
--(void)mouseDragged: (NSEvent*)pEvent;
--(void)mouseUp: (NSEvent*)pEvent;
--(void)mouseMoved: (NSEvent*)pEvent;
--(void)mouseEntered: (NSEvent*)pEvent;
--(void)mouseExited: (NSEvent*)pEvent;
--(void)rightMouseDown: (NSEvent*)pEvent;
--(void)rightMouseDragged: (NSEvent*)pEvent;
--(void)rightMouseUp: (NSEvent*)pEvent;
--(void)otherMouseDown: (NSEvent*)pEvent;
--(void)otherMouseDragged: (NSEvent*)pEvent;
--(void)otherMouseUp: (NSEvent*)pEvent;
--(void)scrollWheel: (NSEvent*)pEvent;
--(void)keyDown: (NSEvent*)pEvent;
--(void)flagsChanged: (NSEvent*)pEvent;
--(void)sendMouseEventToFrame:(NSEvent*)pEvent button:(USHORT)nButton eventtype:(USHORT)nEvent;
--(void)sendKeyInputAndReleaseToFrame: (USHORT)nKeyCode character: (sal_Unicode)aChar;
--(MacOSBOOL)checkSpecialCharacters:(NSEvent*)pEvent;
-/*
-    text action methods
-*/
--(void)insertText:(id)aString;
--(void)insertTab: (id)aSender;
--(void)moveLeft: (id)aSender;
--(void)moveRight: (id)aSender;
--(void)moveUp: (id)aSender;
--(void)moveDown: (id)aSender;
--(void)insertNewline: (id)aSender;
--(void)deleteBackward: (id)aSender;
--(void)deleteForward: (id)aSender;
--(void)cancelOperation: (id)aSender;
-/* set the correct pointer for our view */
--(void)resetCursorRects;
-@end
-
 #endif // _SV_SALFRAME_H
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/salframeview.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salframeview.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/salframeview.h	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salframeview.h	2007-10-16 15:10:08.000000000 +0200
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+#ifndef _VCL_SALFRAMEVIEW_H
+#define _VCL_SALFRAMEVIEW_H
+
+@interface SalFrameWindow : NSWindow
+{
+    AquaSalFrame*       mpFrame;
+}
+-(id)initWithSalFrame: (AquaSalFrame*)pFrame;
+-(void)windowDidBecomeKey: (NSNotification*)pNotification;
+-(void)windowDidResignKey: (NSNotification*)pNotification;
+-(void)windowDidChangeScreen: (NSNotification*)pNotification;
+-(void)windowDidMove: (NSNotification*)pNotification;
+-(void)windowDidResize: (NSNotification*)pNotification;
+-(void)windowDidMiniaturize: (NSNotification*)pNotification;
+-(void)windowDidDeminiaturize: (NSNotification*)pNotification;
+-(MacOSBOOL)windowShouldClose: (NSNotification*)pNotification;
+-(void)dockMenuItemTriggered: (id)sender;
+-(AquaSalFrame*)getSalFrame;
+@end
+
+@interface SalFrameView : NSView <NSTextInput>
+{
+    AquaSalFrame*       mpFrame;
+
+    // for NSTextInput
+    id mpLastEvent;
+    BOOL mbNeedSpecialKeyHandle;
+    BOOL mbInKeyInput;
+    BOOL mbKeyHandled;
+    NSRange mMarkedRange;
+    NSRange mSelectedRange;
+}
++(void)unsetMouseFrame: (AquaSalFrame*)pFrame;
+-(id)initWithSalFrame: (AquaSalFrame*)pFrame;
+-(MacOSBOOL)acceptsFirstResponder;
+-(MacOSBOOL)acceptsFirstMouse: (NSEvent *)pEvent;
+-(MacOSBOOL)isOpaque;
+-(void)drawRect: (NSRect)aRect;
+-(void)mouseDown: (NSEvent*)pEvent;
+-(void)mouseDragged: (NSEvent*)pEvent;
+-(void)mouseUp: (NSEvent*)pEvent;
+-(void)mouseMoved: (NSEvent*)pEvent;
+-(void)mouseEntered: (NSEvent*)pEvent;
+-(void)mouseExited: (NSEvent*)pEvent;
+-(void)rightMouseDown: (NSEvent*)pEvent;
+-(void)rightMouseDragged: (NSEvent*)pEvent;
+-(void)rightMouseUp: (NSEvent*)pEvent;
+-(void)otherMouseDown: (NSEvent*)pEvent;
+-(void)otherMouseDragged: (NSEvent*)pEvent;
+-(void)otherMouseUp: (NSEvent*)pEvent;
+-(void)scrollWheel: (NSEvent*)pEvent;
+-(void)keyDown: (NSEvent*)pEvent;
+-(void)flagsChanged: (NSEvent*)pEvent;
+-(void)sendMouseEventToFrame:(NSEvent*)pEvent button:(USHORT)nButton eventtype:(USHORT)nEvent;
+-(void)sendKeyInputAndReleaseToFrame: (USHORT)nKeyCode character: (sal_Unicode)aChar;
+-(MacOSBOOL)checkSpecialCharacters:(NSEvent*)pEvent;
+/*
+    text action methods
+*/
+-(void)insertText:(id)aString;
+-(void)insertTab: (id)aSender;
+-(void)moveLeft: (id)aSender;
+-(void)moveRight: (id)aSender;
+-(void)moveUp: (id)aSender;
+-(void)moveDown: (id)aSender;
+-(void)insertNewline: (id)aSender;
+-(void)deleteBackward: (id)aSender;
+-(void)deleteForward: (id)aSender;
+-(void)cancelOperation: (id)aSender;
+/* set the correct pointer for our view */
+-(void)resetCursorRects;
+@end
+
+#endif
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/salinst.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salinst.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/salinst.h	2007-10-09 17:09:54.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salinst.h	2007-10-23 16:05:13.000000000 +0200
@@ -46,6 +46,7 @@
 #include <list>
 
 class AquaSalFrame;
+class ApplicationEvent;
 
 // -----------------
 // - SalYieldMutex -
@@ -98,9 +99,14 @@
     rtl::OUString                           maDefaultPrinter;
     vos::OThread::TThreadIdentifier         maMainThread;
     int                                     mnMainThreadLevel;
+    bool                                    mbWaitingYield;
     NSAutoreleasePool*                      mpAutoreleasePool;
     std::list< SalUserEvent >               maUserEvents;
     oslMutex                                maUserEventListMutex;
+
+    typedef std::list<const ApplicationEvent*> AppEventList;
+    static AppEventList aAppEventList;
+    
 public:
     AquaSalInstance();
     virtual ~AquaSalInstance();
@@ -147,6 +153,8 @@
     virtual void            SetErrorEventCallback( void* pInstance, bool(*pCallback)(void*,void*,int) );
 
     static void handleAppDefinedEvent( NSEvent* pEvent );
+    
+    void wakeupYield();
 
  public:
     friend class AquaSalFrame;
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/salmenu.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salmenu.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/salmenu.h	2007-10-09 17:10:05.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salmenu.h	2007-10-15 15:24:24.000000000 +0200
@@ -85,34 +85,4 @@
     std::vector< AquaSalMenuItem* > maItems;
 };
 
-class AquaSalMenuItem : public SalMenuItem
-{
-public:
-    AquaSalMenuItem( const SalItemParams* );
-    virtual ~AquaSalMenuItem();
-
-    USHORT              mnId;                 // Item ID
-    Menu*               mpVCLMenu;            // VCL Menu into which this MenuItem is inserted
-    AquaSalMenu*        mpParentMenu;         // The menu in which this menu item is inserted
-    AquaSalMenu*        mpSubMenu;            // Sub menu of this item (if defined)
-    NSMenuItem*         mpMenuItem;           // The NSMenuItem
-};
-
-@interface SalNSMenu : NSMenu
-{
-    AquaSalMenu*        mpMenu;
-}
--(id)initWithMenu: (AquaSalMenu*)pMenu;
--(void)menuNeedsUpdate: (NSMenu*)pMenu;
--(void)setSalMenu: (AquaSalMenu*)pMenu;
-@end
-
-@interface SalNSMenuItem : NSMenuItem
-{
-    AquaSalMenuItem*    mpMenuItem;
-}
--(id)initWithMenuItem: (AquaSalMenuItem*)pMenuItem;
--(void)menuItemTriggered: (id)aSender;
-@end
-
 #endif // _SV_SALMENU_H
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/salnsmenu.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salnsmenu.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/salnsmenu.h	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salnsmenu.h	2007-10-15 15:24:24.000000000 +0200
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+#ifndef _VCL_SALNSMENU_H
+#define _VCL_SALNSMENU_H
+
+class AquaSalMenuItem : public SalMenuItem
+{
+public:
+    AquaSalMenuItem( const SalItemParams* );
+    virtual ~AquaSalMenuItem();
+
+    USHORT              mnId;                 // Item ID
+    Menu*               mpVCLMenu;            // VCL Menu into which this MenuItem is inserted
+    AquaSalMenu*        mpParentMenu;         // The menu in which this menu item is inserted
+    AquaSalMenu*        mpSubMenu;            // Sub menu of this item (if defined)
+    NSMenuItem*         mpMenuItem;           // The NSMenuItem
+};
+
+@interface SalNSMenu : NSMenu
+{
+    AquaSalMenu*        mpMenu;
+}
+-(id)initWithMenu: (AquaSalMenu*)pMenu;
+-(void)menuNeedsUpdate: (NSMenu*)pMenu;
+-(void)setSalMenu: (AquaSalMenu*)pMenu;
+@end
+
+@interface SalNSMenuItem : NSMenuItem
+{
+    AquaSalMenuItem*    mpMenuItem;
+}
+-(id)initWithMenuItem: (AquaSalMenuItem*)pMenuItem;
+-(void)menuItemTriggered: (id)aSender;
+@end
+
+
+#endif
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/salnstimer.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salnstimer.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/salnstimer.h	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/salnstimer.h	2007-10-15 15:24:24.000000000 +0200
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+#ifndef _VCL_SALNSTIMER_H
+#define _VCL_SALNSTIMER_H
+
+#include "premac.h"
+#include "Cocoa/Cocoa.h"
+#include "postmac.h"
+
+@interface TimerCallbackCaller : NSObject
+{
+}
+-(void)timerElapsed:(NSTimer*)pTimer;
+@end
+
+#endif
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/saltimer.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/saltimer.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/saltimer.h	2007-10-09 17:12:00.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/saltimer.h	2007-10-15 15:24:24.000000000 +0200
@@ -54,6 +54,10 @@
     
     static void handleStartTimerEvent( NSEvent* pEvent );
 
+
+    static NSTimer* pRunningTimer;
+    static bool bDispatchTimer;
+    static bool bTimerInDispatch;
 };
 
 #endif
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/inc/vclnsapp.h ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/vclnsapp.h
--- ooo_SRC680_m233_src.orig/vcl/aqua/inc/vclnsapp.h	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/inc/vclnsapp.h	2007-10-15 15:24:25.000000000 +0200
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+#ifndef _VCL_VCLNSAPP_H
+#define _VCL_VCLNSAPP_H
+
+#include "premac.h"
+#include "Cocoa/Cocoa.h"
+#include "postmac.h"
+ 
+@interface CocoaThreadEnabler : NSObject
+{
+}
+-(void)enableCocoaThreads:(id)param;
+@end
+
+// our very own application
+@interface VCL_NSApplication : NSApplication
+{
+}
+-(void)sendEvent:(NSEvent*)pEvent;
+-(NSMenu*)applicationDockMenu:(NSApplication *)sender;
+-(MacOSBOOL)application: (NSApplication*) app openFile: (NSString*)file;
+-(void)application: (NSApplication*) app openFiles: (NSArray*)files;
+-(MacOSBOOL)application: (NSApplication*) app printFile: (NSString*)file;
+-(NSApplicationPrintReply)application: (NSApplication *) app printFiles:(NSArray *)files withSettings: (NSDictionary *)printSettings showPrintPanels:(MacOSBOOL)bShowPrintPanels;
+-(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app;
+@end
+
+
+#endif
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/app/makefile.mk ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/makefile.mk
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/app/makefile.mk	2007-07-05 10:18:05.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/makefile.mk	2007-10-17 20:13:38.000000000 +0200
@@ -59,7 +59,10 @@
 OBJFILES=	$(OBJ)$/salmain.obj
 
 SLOFILES=   $(SLO)$/salinst.obj			\
+            $(SLO)$/saldata.obj         \
+            $(SLO)$/vclnsapp.obj        \
 			$(SLO)$/saltimer.obj		\
+			$(SLO)$/salnstimer.obj		\
 			$(SLO)$/salsound.obj		\
 			$(SLO)$/salsys.obj			\
 			$(SLO)$/salmain.obj
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/app/saldata.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/saldata.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/app/saldata.cxx	2007-10-09 17:12:44.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/saldata.cxx	2007-10-18 16:05:51.000000000 +0200
@@ -38,39 +38,137 @@
 
 #include "saldata.hxx"
 
-// =======================================================================
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void SalSetSalData( struct SalData* pData )
+struct curs_ent
 {
-	SetSalData( pData );
+    const char*         pBaseName;
+    const NSPoint       aHotSpot;
 }
-
-// -----------------------------------------------------------------------
-
-struct SalData* SalGetSalData()
+const aCursorTab[ POINTER_COUNT ] =
 {
-	return GetSalData();
-}
-
-// -----------------------------------------------------------------------
+{ NULL, { 0, 0 } }, //POINTER_ARROW
+{ "nullptr", { 16, 16 } }, //POINTER_NULL
+{ "hourglass", { 15, 15 } }, //POINTER_WAIT
+{ NULL, { 0, 0 } }, //POINTER_TEXT
+{ "help", { 0, 0 } }, //POINTER_HELP
+{ NULL, { 0, 0 } }, //POINTER_CROSS
+{ NULL, { 0, 0 } }, //POINTER_MOVE
+{ NULL, { 0, 0 } }, //POINTER_NSIZE
+{ NULL, { 0, 0 } }, //POINTER_SSIZE
+{ NULL, { 0, 0 } }, //POINTER_WSIZE
+{ NULL, { 0, 0 } }, //POINTER_ESIZE
+{ "nwsesize", { 15, 15 } }, //POINTER_NWSIZE
+{ "neswsize", { 15, 15 } }, //POINTER_NESIZE
+{ "neswsize", { 15, 15 } }, //POINTER_SWSIZE
+{ "nwsesize", { 15, 15 } }, //POINTER_SESIZE
+{ NULL, { 0, 0 } }, //POINTER_WINDOW_NSIZE
+{ NULL, { 0, 0 } }, //POINTER_WINDOW_SSIZE
+{ NULL, { 0, 0 } }, //POINTER_WINDOW_WSIZE
+{ NULL, { 0, 0 } }, //POINTER_WINDOW_ESIZE
+{ "nwsesize", { 15, 15 } }, //POINTER_WINDOW_NWSIZE
+{ "neswsize", { 15, 15 } }, //POINTER_WINDOW_NESIZE
+{ "neswsize", { 15, 15 } }, //POINTER_WINDOW_SWSIZE
+{ "nwsesize", { 15, 15 } }, //POINTER_WINDOW_SESIZE
+{ NULL, { 0, 0 } }, //POINTER_HSPLIT
+{ NULL, { 0, 0 } }, //POINTER_VSPLIT
+{ NULL, { 0, 0 } }, //POINTER_HSIZEBAR
+{ NULL, { 0, 0 } }, //POINTER_VSIZEBAR
+{ NULL, { 0, 0 } }, //POINTER_HAND
+{ NULL, { 0, 0 } }, //POINTER_REFHAND
+{ "pen", { 3, 27 } }, //POINTER_PEN
+{ "magnify", { 12, 13 } }, //POINTER_MAGNIFY
+{ "fill", { 10, 22 } }, //POINTER_FILL
+{ "rotate", { 15, 15 } }, //POINTER_ROTATE
+{ "hshear", { 15, 15 } }, //POINTER_HSHEAR
+{ "vshear", { 15, 15 } }, //POINTER_VSHEAR
+{ "mirror", { 14, 12 } }, //POINTER_MIRROR
+{ "crook", { 15, 14 } }, //POINTER_CROOK
+{ "crop", { 9, 9 } }, //POINTER_CROP
+{ "movept", { 0, 0 } }, //POINTER_MOVEPOINT
+{ "movebw", { 0, 0 } }, //POINTER_MOVEBEZIERWEIGHT
+{ "movedata", { 0, 0 } }, //POINTER_MOVEDATA
+{ "copydata", { 0, 0 } }, //POINTER_COPYDATA
+{ "linkdata", { 0, 0 } }, //POINTER_LINKDATA
+{ "movedlnk", { 0, 0 } }, //POINTER_MOVEDATALINK
+{ "copydlnk", { 0, 0 } }, //POINTER_COPYDATALINK
+{ "movef", { 8, 8 } }, //POINTER_MOVEFILE
+{ "copyf", { 8, 8 } }, //POINTER_COPYFILE
+{ "linkf", { 8, 8 } }, //POINTER_LINKFILE
+{ "moveflnk", { 8, 8 } }, //POINTER_MOVEFILELINK
+{ "copyflnk", { 8, 8 } }, //POINTER_COPYFILELINK
+{ "movef2", { 7, 8 } }, //POINTER_MOVEFILES
+{ "copyf2", { 7, 8 } }, //POINTER_COPYFILES
+{ "notallow", { 15, 15 } }, //POINTER_NOTALLOWED
+{ "dline", { 8, 8 } }, //POINTER_DRAW_LINE
+{ "drect", { 8, 8 } }, //POINTER_DRAW_RECT
+{ "dpolygon", { 8, 8 } }, //POINTER_DRAW_POLYGON
+{ "dbezier", { 8, 8 } }, //POINTER_DRAW_BEZIER
+{ "darc", { 8, 8 } }, //POINTER_DRAW_ARC
+{ "dpie", { 8, 8 } }, //POINTER_DRAW_PIE
+{ "dcirccut", { 8, 8 } }, //POINTER_DRAW_CIRCLECUT
+{ "dellipse", { 8, 8 } }, //POINTER_DRAW_ELLIPSE
+{ "dfree", { 8, 8 } }, //POINTER_DRAW_FREEHAND
+{ "dconnect", { 8, 8 } }, //POINTER_DRAW_CONNECT
+{ "dtext", { 8, 8 } }, //POINTER_DRAW_TEXT
+{ "dcapt", { 8, 8 } }, //POINTER_DRAW_CAPTION
+{ "chart", { 15, 16 } }, //POINTER_CHART
+{ "detectiv", { 12, 13 } }, //POINTER_DETECTIVE
+{ "pivotcol", { 7, 5 } }, //POINTER_PIVOT_COL
+{ "pivotrow", { 8, 7 } }, //POINTER_PIVOT_ROW
+{ "pivotfld", { 8, 7 } }, //POINTER_PIVOT_FIELD
+{ "chain", { 0, 2 } }, //POINTER_CHAIN
+{ "chainnot", { 2, 2 } }, //POINTER_CHAIN_NOTALLOWED
+{ "timemove", { 16, 16 } }, //POINTER_TIMEEVENT_MOVE
+{ "timesize", { 16, 17 } }, //POINTER_TIMEEVENT_SIZE
+{ "asn", { 16, 12 } }, //POINTER_AUTOSCROLL_N
+{ "ass", { 15, 19 } }, //POINTER_AUTOSCROLL_S
+{ "asw", { 12, 15 } }, //POINTER_AUTOSCROLL_W
+{ "ase", { 19, 16 } }, //POINTER_AUTOSCROLL_E
+{ "asnw", { 10, 10 } }, //POINTER_AUTOSCROLL_NW
+{ "asne", { 21, 10 } }, //POINTER_AUTOSCROLL_NE
+{ "assw", { 21, 21 } }, //POINTER_AUTOSCROLL_SW
+{ "asse", { 21, 21 } }, //POINTER_AUTOSCROLL_SE
+{ "asns", { 15, 15 } }, //POINTER_AUTOSCROLL_NS
+{ "aswe", { 15, 15 } }, //POINTER_AUTOSCROLL_WE
+{ "asnswe", { 15, 15 } }, //POINTER_AUTOSCROLL_NSWE
+{ "airbrush", { 5, 22 } }, //POINTER_AIRBRUSH
+{ "vtext", { 15, 15 } }, //POINTER_TEXT_VERTICAL
+{ "pivotdel", { 18, 15 } }, //POINTER_PIVOT_DELETE
+{ "tblsels", { 15, 30 } }, //POINTER_TAB_SELECT_S
+{ "tblsele", { 30, 16 } }, //POINTER_TAB_SELECT_E
+{ "tblselse", { 30, 30 } }, //POINTER_TAB_SELECT_SE
+{ "tblselw", { 1, 16 } }, //POINTER_TAB_SELECT_W
+{ "tblselsw", { 1, 30 } }, //POINTER_TAB_SELECT_SW
+{ "pntbrsh", { 9, 16 } }  //POINTER_PAINTBRUSH
+};
 
-struct SalData* SalGetAppSalData()
+NSCursor* SalData::getCursor( PointerStyle i_eStyle )
 {
-	return GetAppSalData();
+    if( i_eStyle >= POINTER_COUNT )
+        return nil;
+    
+    NSCursor* pCurs = maCursors[ i_eStyle ];
+    if( pCurs == INVALID_CURSOR_PTR )
+    {
+        pCurs = nil;        
+        if( aCursorTab[ i_eStyle ].pBaseName )
+        {
+            NSPoint aHotSpot = aCursorTab[ i_eStyle ].aHotSpot;
+            CFStringRef pCursorName =
+                CFStringCreateWithCStringNoCopy(
+                    kCFAllocatorDefault,
+                    aCursorTab[ i_eStyle ].pBaseName,
+                    kCFStringEncodingASCII,
+                    kCFAllocatorNull );
+            CFBundleRef hMain = CFBundleGetMainBundle();
+            CFURLRef hURL = CFBundleCopyResourceURL( hMain, pCursorName, CFSTR("png"), CFSTR("cursors") );
+            if( hURL )
+            {
+                pCurs = [[NSCursor alloc] initWithImage: [[NSImage alloc] initWithContentsOfURL: (NSURL*)hURL] hotSpot: aHotSpot];
+                CFRelease( hURL );
+            }
+            CFRelease( pCursorName );
+        }
+        maCursors[ i_eStyle ] = pCurs;
+    }
+    return pCurs;
 }
-
-// -----------------------------------------------------------------------
-
-BOOL SalGetAppQuit()
-{
-	return ImplGetSVData()->maAppData.mbAppQuit;
-}
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/app/salinst.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/salinst.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/app/salinst.cxx	2007-10-09 17:12:57.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/salinst.cxx	2007-10-23 16:05:13.000000000 +0200
@@ -57,6 +57,7 @@
 #include "salprn.h"
 #include "salogl.h"
 #include "saltimer.h"
+#include "vclnsapp.h"
 
 #include "premac.h"
 #include <ApplicationServices/ApplicationServices.h>
@@ -75,8 +76,7 @@
 
 // the AppEventList must be available before any SalData/SalInst/etc. objects are ready
 typedef std::list<const ApplicationEvent*> AppEventList;
-static AppEventList aAppEventList;
-
+AppEventList AquaSalInstance::aAppEventList;
 
 NSMenu* AquaSalInstance::GetDynamicDockMenu()
 {
@@ -85,136 +85,6 @@
     return pDockMenu;
 }
  
-@interface CocoaThreadEnabler : NSObject
-{
-}
--(void)enableCocoaThreads:(id)param;
-@end
-
-@implementation CocoaThreadEnabler
--(void)enableCocoaThreads:(id)param
-{
-    // do nothing, this is just to start an NSThread and therefore put
-    // Cocoa into multithread mode
-}
-@end
-
-// our very own application
-@interface VCL_NSApplication : NSApplication
-{
-}
--(void)sendEvent:(NSEvent*)pEvent;
--(NSMenu*)applicationDockMenu:(NSApplication *)sender;
--(MacOSBOOL)application: (NSApplication*) app openFile: (NSString*)file;
--(void)application: (NSApplication*) app openFiles: (NSArray*)files;
--(MacOSBOOL)application: (NSApplication*) app printFile: (NSString*)file;
--(NSApplicationPrintReply)application: (NSApplication *) app printFiles:(NSArray *)files withSettings: (NSDictionary *)printSettings showPrintPanels:(BOOL)bShowPrintPanels;
--(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app;
-@end
-
-@implementation VCL_NSApplication
--(void)sendEvent:(NSEvent*)pEvent
-{
-    NSEventType eType = [pEvent type];
-    if( eType == NSApplicationDefined )
-        GetSalData()->mpFirstInstance->handleAppDefinedEvent( pEvent );
-    else if( eType == NSKeyDown && ([pEvent modifierFlags] & NSCommandKeyMask) != 0 )
-    {
-        NSWindow* pKeyWin = [NSApp keyWindow];
-        if( pKeyWin && [pKeyWin isKindOfClass: [SalFrameWindow class]] )
-        {
-            AquaSalFrame* pFrame = [(SalFrameWindow*)pKeyWin getSalFrame];
-            if( pFrame->mpParent && pFrame->mpParent->GetWindow()->IsInModalMode() )
-            {
-                // dispatch to view directly to avoid the key event being consumed by the menubar
-                [[pKeyWin contentView] keyDown: pEvent];
-                return;
-            }
-        }
-
-    }
-    [super sendEvent: pEvent];
-}
-
--(NSMenu*)applicationDockMenu:(NSApplication *)sender
-{
-    return AquaSalInstance::GetDynamicDockMenu();
-}
--(MacOSBOOL)application: (NSApplication*)app openFile: (NSString*)pFile
-{
-    const rtl::OUString aFile( GetOUString( pFile ) );
-	const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
-                                                APPEVENT_OPEN_STRING, aFile );
-	aAppEventList.push_back( pAppEvent );
-    return YES;
-}
-
--(void)application: (NSApplication*) app openFiles: (NSArray*)files
-{
-    rtl::OUStringBuffer aFileList( 256 );
-    
-    NSEnumerator* it = [files objectEnumerator];
-    NSString* pFile = nil;
-    
-    while( (pFile = [it nextObject]) != nil )
-    {
-        if( aFileList.getLength() > 0 )
-            aFileList.append( sal_Unicode( APPEVENT_PARAM_DELIMITER ) );
-        aFileList.append( GetOUString( pFile ) );
-    }
-    // we have no back channel here, we have to assume success, in which case
-    // replyToOpenOrPrint does not need to be called according to documentation
-    // [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
-	const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
-                                                APPEVENT_OPEN_STRING, aFileList.makeStringAndClear() );
-	aAppEventList.push_back( pAppEvent );
-}
-
--(MacOSBOOL)application: (NSApplication*)app printFile: (NSString*)pFile
-{
-    const rtl::OUString aFile( GetOUString( pFile ) );
-	const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
-                                                APPEVENT_PRINT_STRING, aFile );
-	aAppEventList.push_back( pAppEvent );
-    return YES;
-}
--(NSApplicationPrintReply)application: (NSApplication *) app printFiles:(NSArray *)files withSettings: (NSDictionary *)printSettings showPrintPanels:(BOOL)bShowPrintPanels
-{
-    // currently ignores print settings an bShowPrintPanels
-    rtl::OUStringBuffer aFileList( 256 );
-    
-    NSEnumerator* it = [files objectEnumerator];
-    NSString* pFile = nil;
-    
-    while( (pFile = [it nextObject]) != nil )
-    {
-        if( aFileList.getLength() > 0 )
-            aFileList.append( sal_Unicode( APPEVENT_PARAM_DELIMITER ) );
-        aFileList.append( GetOUString( pFile ) );
-    }
-	const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
-                                                APPEVENT_PRINT_STRING, aFileList.makeStringAndClear() );
-	aAppEventList.push_back( pAppEvent );
-    // we have no back channel here, we have to assume success
-    // correct handling would be NSPrintingReplyLater and then send [app replyToOpenOrPrint]
-    return NSPrintingSuccess;
-}
-
--(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app
-{
-    const SalData* pSalData = GetSalData();
-	if( !pSalData->maFrames.empty() )
-    {
-        // we forward the signal; alas we have no answer
-        // we cancel the request; OOo will decide whether is shuts down or not
-		pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL );
-        return NSTerminateCancel;
-    }
-    else
-        // no frame left to talk to -> we really should terminate
-        return NSTerminateNow;
-}
-@end
 
 // initialize the cocoa VCL_NSApplication object
 // returns an NSAutoreleasePool that must be released when the event loop begins
@@ -518,6 +388,7 @@
 	mpSalYieldMutex->acquire();
     maMainThread = vos::OThread::getCurrentIdentifier();
     mnMainThreadLevel = 0;
+    mbWaitingYield = false;
     mpAutoreleasePool = nil;
     maUserEventListMutex = osl_createMutex();
 }
@@ -533,25 +404,36 @@
 
 // -----------------------------------------------------------------------
 
+void AquaSalInstance::wakeupYield()
+{
+    // wakeup :Yield
+    if( mbWaitingYield )
+    {
+        NSPoint aPt = { 0, 0 };
+        NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
+                                   location: aPt
+                                   modifierFlags: 0
+                                   timestamp: 0
+                                   windowNumber: 0
+                                   context: nil
+                                   subtype: AquaSalInstance::YieldWakeupEvent
+                                   data1: 0
+                                   data2: 0 ];
+        if( pEvent )
+            [NSApp postEvent: pEvent atStart: NO];
+    }
+}
+
+// -----------------------------------------------------------------------
+
 void AquaSalInstance::PostUserEvent( AquaSalFrame* pFrame, USHORT nType, void* pData )
 {
     osl_acquireMutex( maUserEventListMutex );
     maUserEvents.push_back( SalUserEvent( pFrame, pData, nType ) );
     osl_releaseMutex( maUserEventListMutex );
-    // wakeup :Yield
-    NSPoint aPt = { 0, 0 };
-    NSEvent* pEvent = [NSEvent otherEventWithType: NSApplicationDefined
-                               location: aPt
-                               modifierFlags: 0
-                               timestamp: 0
-                               windowNumber: 0
-                               context: nil
-                               subtype: AquaSalInstance::YieldWakeupEvent
-                               data1: 0
-                               data2: 0 ];
-    if( pEvent )
-        [NSApp postEvent: pEvent atStart: NO];
-
+    
+    // notify main loop that an event has arrived
+    wakeupYield();
 }
 
 // -----------------------------------------------------------------------
@@ -650,7 +532,7 @@
     
         // get one user event
         osl_acquireMutex( maUserEventListMutex );
-        SalUserEvent aEvent( NULL, 0, NULL );
+        SalUserEvent aEvent( NULL, NULL, 0 );
         if( ! maUserEvents.empty() )
         {
             aEvent = maUserEvents.front();
@@ -700,6 +582,8 @@
         // if we had no event yet, wait for one if requested
         if( bWait && ! bHadEvent )
         {
+            bool bOldWaitingYield = mbWaitingYield;
+            mbWaitingYield = true;
             ULONG nCount = ReleaseYieldMutex();
     
             pEvent = [NSApp nextEventMatchingMask: NSAnyEventMask untilDate: [NSDate distantFuture]
@@ -709,6 +593,7 @@
             [NSApp updateWindows];
         
             AcquireYieldMutex( nCount );
+            mbWaitingYield = bOldWaitingYield;
         }
         
         mnMainThreadLevel--;
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/app/salnstimer.mm ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/salnstimer.mm
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/app/salnstimer.mm	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/salnstimer.mm	2007-10-23 16:05:13.000000000 +0200
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "saltimer.h"
+#include "salnstimer.h"
+#include "salinst.h"
+#include "saldata.hxx"
+
+#include "vcl/svdata.hxx"
+
+@implementation TimerCallbackCaller
+-(void)timerElapsed:(NSTimer*)pTimer
+{
+    if( AquaSalTimer::bDispatchTimer && ! AquaSalTimer::bTimerInDispatch )
+    {
+        ImplSVData* pSVData = ImplGetSVData();
+        if( pSVData->mpSalTimer )
+        {
+            YIELD_GUARD;
+            AquaSalTimer::bTimerInDispatch = true;
+            pSVData->mpSalTimer->CallCallback();
+            AquaSalTimer::bTimerInDispatch = false;
+            
+            // NSTimer does not end nextEventMatchingMask of NSApplication
+            // so we need to wakeup a waiting Yield to inform it something happened
+            GetSalData()->mpFirstInstance->wakeupYield();
+        }
+    }
+}
+@end
+
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/app/salsys.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/salsys.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/app/salsys.cxx	2007-10-09 17:13:43.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/salsys.cxx	2007-10-18 17:34:18.000000000 +0200
@@ -97,7 +97,7 @@
 Rectangle AquaSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen )
 {
 	CGRect aRect( CGDisplayBounds ( CGMainDisplayID() ) );
-	Rectangle aRet( aRect.origin.x, aRect.origin.y, aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height );
+	Rectangle aRet(static_cast<long>(aRect.origin.x), static_cast<long>(aRect.origin.y), static_cast<long>(aRect.origin.x + aRect.size.width), static_cast<long>(aRect.origin.y + aRect.size.height));
 	AquaLog("AquaSalSystem::GetDisplayScreenPosSizePixel(%d) (%ld,%ld,%ld,%ld)\n", nScreen, aRet.nLeft, aRet.nTop, aRet.nRight, aRet.nBottom );
 	return aRet;
 }
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/app/saltimer.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/saltimer.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/app/saltimer.cxx	2007-10-09 17:13:56.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/saltimer.cxx	2007-10-15 15:24:25.000000000 +0200
@@ -37,64 +37,43 @@
 #include "precompiled_vcl.hxx"
 
 #include "saltimer.h"
+#include "salnstimer.h"
 #include "saldata.hxx"
 #include "salframe.h"
 #include "salinst.h"
 
 // =======================================================================
 
-static NSTimer* pRunningTimer = nil;
-static bool bDispatchTimer = false;
-static bool bTimerInDispatch = false;
+NSTimer* AquaSalTimer::pRunningTimer = nil;
+bool AquaSalTimer::bDispatchTimer = false;
+bool AquaSalTimer::bTimerInDispatch = false;
 
-@interface TimerCallbackCaller : NSObject
-{
-}
--(void)timerElapsed:(NSTimer*)pTimer;
-@end
-
-@implementation TimerCallbackCaller
--(void)timerElapsed:(NSTimer*)pTimer
-{
-    if( bDispatchTimer && ! bTimerInDispatch )
-    {
-        ImplSVData* pSVData = ImplGetSVData();
-        if( pSVData->mpSalTimer )
-        {
-            YIELD_GUARD;
-            bTimerInDispatch = true;
-            pSVData->mpSalTimer->CallCallback();
-            bTimerInDispatch = false;
-        }
-    }
-}
-@end
 
 void ImplSalStartTimer( ULONG nMS )
 {
     SalData* pSalData = GetSalData();
     if( pSalData->mpFirstInstance->isNSAppThread() )
     {
-        bDispatchTimer = true;
+        AquaSalTimer::bDispatchTimer = true;
         NSTimeInterval aTI = double(nMS)/1000.0;
-        if( pRunningTimer != nil )
+        if( AquaSalTimer::pRunningTimer != nil )
         {
-            if( [pRunningTimer timeInterval] == aTI )
+            if( [AquaSalTimer::pRunningTimer timeInterval] == aTI )
                 // set new fire date
-                [pRunningTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: aTI]];
+                [AquaSalTimer::pRunningTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: aTI]];
             else
             {
-                [pRunningTimer invalidate];
-                pRunningTimer = nil;
+                [AquaSalTimer::pRunningTimer invalidate];
+                AquaSalTimer::pRunningTimer = nil;
             }
         }
-        if( pRunningTimer == nil )
+        if( AquaSalTimer::pRunningTimer == nil )
         {
-            pRunningTimer = [NSTimer scheduledTimerWithTimeInterval: aTI
-                                     target: [[[TimerCallbackCaller alloc] init] autorelease]
-                                     selector: @selector(timerElapsed:)
-                                     userInfo: nil
-                                     repeats: YES];
+            AquaSalTimer::pRunningTimer = [NSTimer scheduledTimerWithTimeInterval: aTI
+                                                   target: [[[TimerCallbackCaller alloc] init] autorelease]
+                                                   selector: @selector(timerElapsed:)
+                                                   userInfo: nil
+                                                   repeats: YES];
         }
     }
     else
@@ -117,7 +96,7 @@
 
 void ImplSalStopTimer()
 {
-    bDispatchTimer = false;
+    AquaSalTimer::bDispatchTimer = false;
 }
 
 void AquaSalTimer::handleStartTimerEvent( NSEvent* pEvent )
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/app/vclnsapp.mm ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/vclnsapp.mm
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/app/vclnsapp.mm	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/app/vclnsapp.mm	2007-10-16 15:10:08.000000000 +0200
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "vclnsapp.h"
+#include "salinst.h"
+#include "saldata.hxx"
+#include "salframe.h"
+#include "salframeview.h"
+
+#include "vcl/window.hxx"
+#include "vcl/svapp.hxx"
+
+#include "rtl/ustrbuf.hxx"
+
+ 
+@implementation CocoaThreadEnabler
+-(void)enableCocoaThreads:(id)param
+{
+    // do nothing, this is just to start an NSThread and therefore put
+    // Cocoa into multithread mode
+}
+@end
+
+@implementation VCL_NSApplication
+-(void)sendEvent:(NSEvent*)pEvent
+{
+    NSEventType eType = [pEvent type];
+    if( eType == NSApplicationDefined )
+        GetSalData()->mpFirstInstance->handleAppDefinedEvent( pEvent );
+    else if( eType == NSKeyDown && ([pEvent modifierFlags] & NSCommandKeyMask) != 0 )
+    {
+        NSWindow* pKeyWin = [NSApp keyWindow];
+        if( pKeyWin && [pKeyWin isKindOfClass: [SalFrameWindow class]] )
+        {
+            AquaSalFrame* pFrame = [(SalFrameWindow*)pKeyWin getSalFrame];
+            if( pFrame->mpParent && pFrame->mpParent->GetWindow()->IsInModalMode() )
+            {
+                // dispatch to view directly to avoid the key event being consumed by the menubar
+                [[pKeyWin contentView] keyDown: pEvent];
+                return;
+            }
+        }
+
+    }
+    else if( eType == NSScrollWheel )
+    {
+        // FIMXE: this is necessary on MacOS 10.4 only
+        // how do I find out the OS version ?
+        
+        NSWindow* pWin = [pEvent window];
+        // on Tiger wheel events do not reach non key windows
+        // which probably should be considered a bug
+        if( [pWin isKindOfClass: [SalFrameWindow class]] && [pWin canBecomeKeyWindow] == NO )
+        {
+            [[pWin contentView] scrollWheel: pEvent];
+            return;
+        }
+    }
+    [super sendEvent: pEvent];
+}
+
+-(NSMenu*)applicationDockMenu:(NSApplication *)sender
+{
+    return AquaSalInstance::GetDynamicDockMenu();
+}
+-(MacOSBOOL)application: (NSApplication*)app openFile: (NSString*)pFile
+{
+    const rtl::OUString aFile( GetOUString( pFile ) );
+	const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
+                                                APPEVENT_OPEN_STRING, aFile );
+	AquaSalInstance::aAppEventList.push_back( pAppEvent );
+    return YES;
+}
+
+-(void)application: (NSApplication*) app openFiles: (NSArray*)files
+{
+    rtl::OUStringBuffer aFileList( 256 );
+    
+    NSEnumerator* it = [files objectEnumerator];
+    NSString* pFile = nil;
+    
+    while( (pFile = [it nextObject]) != nil )
+    {
+        if( aFileList.getLength() > 0 )
+            aFileList.append( sal_Unicode( APPEVENT_PARAM_DELIMITER ) );
+        aFileList.append( GetOUString( pFile ) );
+    }
+    // we have no back channel here, we have to assume success, in which case
+    // replyToOpenOrPrint does not need to be called according to documentation
+    // [app replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
+	const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
+                                                APPEVENT_OPEN_STRING, aFileList.makeStringAndClear() );
+	AquaSalInstance::aAppEventList.push_back( pAppEvent );
+}
+
+-(MacOSBOOL)application: (NSApplication*)app printFile: (NSString*)pFile
+{
+    const rtl::OUString aFile( GetOUString( pFile ) );
+	const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
+                                                APPEVENT_PRINT_STRING, aFile );
+	AquaSalInstance::aAppEventList.push_back( pAppEvent );
+    return YES;
+}
+-(NSApplicationPrintReply)application: (NSApplication *) app printFiles:(NSArray *)files withSettings: (NSDictionary *)printSettings showPrintPanels:(MacOSBOOL)bShowPrintPanels
+{
+    // currently ignores print settings an bShowPrintPanels
+    rtl::OUStringBuffer aFileList( 256 );
+    
+    NSEnumerator* it = [files objectEnumerator];
+    NSString* pFile = nil;
+    
+    while( (pFile = [it nextObject]) != nil )
+    {
+        if( aFileList.getLength() > 0 )
+            aFileList.append( sal_Unicode( APPEVENT_PARAM_DELIMITER ) );
+        aFileList.append( GetOUString( pFile ) );
+    }
+	const ApplicationEvent* pAppEvent = new ApplicationEvent( String(), ApplicationAddress(),
+                                                APPEVENT_PRINT_STRING, aFileList.makeStringAndClear() );
+	AquaSalInstance::aAppEventList.push_back( pAppEvent );
+    // we have no back channel here, we have to assume success
+    // correct handling would be NSPrintingReplyLater and then send [app replyToOpenOrPrint]
+    return NSPrintingSuccess;
+}
+
+-(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app
+{
+    const SalData* pSalData = GetSalData();
+	if( !pSalData->maFrames.empty() )
+    {
+        // we forward the signal; alas we have no answer
+        // we cancel the request; OOo will decide whether is shuts down or not
+		pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL );
+        return NSTerminateCancel;
+    }
+    else
+        // no frame left to talk to -> we really should terminate
+        return NSTerminateNow;
+}
+@end
+
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/aquaprintview.mm ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/aquaprintview.mm
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/aquaprintview.mm	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/aquaprintview.mm	2007-10-15 15:24:25.000000000 +0200
@@ -0,0 +1,80 @@
+/************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "aquaprintview.h"
+#include "salprn.h"
+#include "vcl/impprn.hxx"
+
+@implementation AquaPrintView
+-(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter
+{
+    NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] };
+    if( (self = [super initWithFrame: aRect]) != nil )
+    {
+        mpQPrinter = pPrinter;
+        mpInfoPrinter = pInfoPrinter;
+    }
+    return self;
+}
+
+-(MacOSBOOL)knowsPageRange: (NSRangePointer)range
+{
+    range->location = 1;
+    range->length = mpQPrinter->GetPrintPageCount();
+    return YES;
+}
+
+-(NSRect)rectForPage: (int)page
+{
+    NSRect aRect = { { 0, 0 }, [mpInfoPrinter->getPrintInfo() paperSize] };
+    return aRect;
+}
+
+-(NSPoint)locationOfPrintRect: (NSRect)aRect
+{
+    NSPoint aPoint = { 0, 0 };
+    return aPoint;
+}
+
+-(void)drawRect: (NSRect)rect
+{
+    NSPoint aPoint = [self locationOfPrintRect: rect];
+    mpQPrinter->PrintNextPage();
+}
+@end
+
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/makefile.mk ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/makefile.mk
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/makefile.mk	2007-07-05 10:24:00.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/makefile.mk	2007-10-15 15:24:25.000000000 +0200
@@ -65,6 +65,7 @@
             $(SLO)$/salgdi.obj            \
             $(SLO)$/salvd.obj             \
             $(SLO)$/salprn.obj            \
+            $(SLO)$/aquaprintview.obj     \
             $(SLO)$/salbmp.obj            \
             $(SLO)$/salogl.obj
 
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salatslayout.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salatslayout.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salatslayout.cxx	2007-10-09 17:14:08.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salatslayout.cxx	2007-10-18 17:35:17.000000000 +0200
@@ -400,7 +400,7 @@
 		nYOffset = mpDeltaY[ nStart ];
 
     // calculate absolute position in pixel units
-    const Point aRelativePos( Fix2Long(nXOffset*mfFontScale), Fix2Long(nYOffset*mfFontScale) );
+    const Point aRelativePos( Fix2Long(static_cast<long>(nXOffset*mfFontScale)), Fix2Long(static_cast<long>(nYOffset*mfFontScale)) );
     rPos = GetDrawPosition( aRelativePos );
 
 	// update return values {nGlyphIndex,nCharPos,nGlyphAdvance}
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salgdi.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salgdi.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salgdi.cxx	2007-10-09 17:14:59.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salgdi.cxx	2007-10-18 17:35:17.000000000 +0200
@@ -1335,9 +1335,9 @@
 void AquaSalGraphics::SetTextColor( SalColor nSalColor )
 {
     RGBColor color;
-    color.red     = (unsigned short) SALCOLOR_RED(nSalColor)   * 65535.0 / 255.0;
-    color.green   = (unsigned short) SALCOLOR_GREEN(nSalColor) * 65535.0 / 255.0;
-    color.blue    = (unsigned short) SALCOLOR_BLUE(nSalColor)  * 65535.0 / 255.0;
+    color.red     = (unsigned short) ( SALCOLOR_RED(nSalColor)   * 65535.0 / 255.0 );
+    color.green   = (unsigned short) ( SALCOLOR_GREEN(nSalColor) * 65535.0 / 255.0 );
+    color.blue    = (unsigned short) ( SALCOLOR_BLUE(nSalColor)  * 65535.0 / 255.0 );
 
     ATSUAttributeTag aTag = kATSUColorTag;
     ByteCount aValueSize = sizeof( color );
@@ -1382,15 +1382,15 @@
 	// convert quartz units to pixel units
 	// please see the comment in AquaSalGraphics::SetFont() for details
     const double fPixelSize = (mfFontScale * mfFakeDPIScale * fPointSize);
-    pMetric->mnAscent       = +(aMetrics.ascent  * fPixelSize + 0.5);
-    pMetric->mnDescent      = -(aMetrics.descent * fPixelSize + 0.5);
-    pMetric->mnExtLeading   = +(aMetrics.leading * fPixelSize + 0.5);
+    pMetric->mnAscent       = + static_cast<long>(aMetrics.ascent  * fPixelSize + 0.5);
+    pMetric->mnDescent      = - static_cast<long>(aMetrics.descent * fPixelSize + 0.5);
+    pMetric->mnExtLeading   = + static_cast<long>(aMetrics.leading * fPixelSize + 0.5);
     pMetric->mnIntLeading   = 0;
     // ATSFontMetrics.avgAdvanceWidth is obsolete, so it is usually set to zero
     // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
     // setting this width to the pixel height of the fontsize is good enough
 	// it also makes the calculation of the stretch factor simple
-    pMetric->mnWidth        = fPixelSize + 0.5;
+    pMetric->mnWidth        = static_cast<long>(fPixelSize + 0.5);
 
 	// apply the "CJK needs extra leading" heuristic if needed
 	if( mpMacFontData->HasCJKSupport() )
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salgdiutils.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salgdiutils.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salgdiutils.cxx	2007-10-09 17:15:12.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salgdiutils.cxx	2007-10-18 17:35:17.000000000 +0200
@@ -143,9 +143,10 @@
                 */
                 maXORClipMask.reset();
                 CGRect aBounds( maClippingRects.front() );
-                basegfx::B2IRange aRect( aBounds.origin.x, aBounds.origin.y,
-                                         aBounds.origin.x+aBounds.size.width,
-                                         aBounds.origin.y+aBounds.size.height );
+                basegfx::B2IRange aRect( static_cast<sal_Int32>(aBounds.origin.x),
+					  static_cast<sal_Int32>(aBounds.origin.y),
+                                         static_cast<sal_Int32>(aBounds.origin.x+aBounds.size.width),
+                                         static_cast<sal_Int32>(aBounds.origin.y+aBounds.size.height) );
                 maXORDevice = basebmp::subsetBitmapDevice( maXORDevice, aRect );
             }
         }
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salnativewidgets.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salnativewidgets.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salnativewidgets.cxx	2007-10-09 17:15:40.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salnativewidgets.cxx	2007-10-18 22:30:15.000000000 +0200
@@ -638,7 +638,7 @@
                     {
                         // translate the origin of the button from the half of the offset
                         // translation value must be an integrer
-                        int delta_y = floor((rc.size.height - max_height) / 2.0);
+                        int delta_y = static_cast<int>(floor((rc.size.height - max_height) / 2.0));
                         rc.origin.y += delta_y + 1;
 
                         // button height must be limited ( height value collected from OSXHIGuidelines )
@@ -737,7 +737,7 @@
             aTrackInfo.kind                 = (rc.size.height > 10) ? kThemeProgressBarLarge : kThemeProgressBarMedium;
             aTrackInfo.bounds               = rc;
             aTrackInfo.min                  = 0;
-            aTrackInfo.max                  = rc.size.width;
+            aTrackInfo.max                  = static_cast<SInt32>(rc.size.width);
             aTrackInfo.value                = nProgressWidth;
             aTrackInfo.reserved             = 0;
             aTrackInfo.bounds.origin.y     -= 2; // FIXME: magic for shadow
@@ -747,7 +747,7 @@
                 aTrackInfo.attributes      |= kThemeTrackRightToLeft;
             aTrackInfo.enableState          = (nState & CTRL_STATE_ENABLED) ? kThemeTrackActive : kThemeTrackInactive;
             aTrackInfo.filler1              = 0;
-            aTrackInfo.trackInfo.progress.phase   = CFAbsoluteTimeGetCurrent()*10.0;
+            aTrackInfo.trackInfo.progress.phase   = static_cast<UInt8>(CFAbsoluteTimeGetCurrent()*10.0);
             
             HIThemeDrawTrack( &aTrackInfo, NULL, mrContext, kHIThemeOrientationNormal );
             bOK = true;
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salprn.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salprn.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/gdi/salprn.cxx	2007-10-09 17:16:20.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/gdi/salprn.cxx	2007-10-18 17:35:17.000000000 +0200
@@ -38,6 +38,7 @@
 
 #include "salinst.h"
 #include "salprn.h"
+#include "aquaprintview.h"
 #include "salgdi.h"
 #include "saldata.hxx"
 #include "vcl/jobset.h"
@@ -45,57 +46,6 @@
 #include "vcl/impprn.hxx"
 #include <boost/bind.hpp>
 
-@interface AquaPrintView : NSView
-{
-    ImplQPrinter*       mpQPrinter;
-    AquaSalInfoPrinter* mpInfoPrinter;
-}
--(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter;
--(MacOSBOOL)knowsPageRange: (NSRangePointer)range;
--(NSRect)rectForPage: (int)page;
--(NSPoint)locationOfPrintRect: (NSRect)aRect;
--(void)drawRect: (NSRect)rect;
-@end
-
-@implementation AquaPrintView
--(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter
-{
-    NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] };
-    if( (self = [super initWithFrame: aRect]) != nil )
-    {
-        mpQPrinter = pPrinter;
-        mpInfoPrinter = pInfoPrinter;
-    }
-    return self;
-}
-
--(MacOSBOOL)knowsPageRange: (NSRangePointer)range
-{
-    range->location = 1;
-    range->length = mpQPrinter->GetPrintPageCount();
-    return YES;
-}
-
--(NSRect)rectForPage: (int)page
-{
-    NSRect aRect = { { 0, 0 }, [mpInfoPrinter->getPrintInfo() paperSize] };
-    return aRect;
-}
-
--(NSPoint)locationOfPrintRect: (NSRect)aRect
-{
-    NSPoint aPoint = { 0, 0 };
-    return aPoint;
-}
-
--(void)drawRect: (NSRect)rect
-{
-    NSPoint aPoint = [self locationOfPrintRect: rect];
-    mpQPrinter->PrintNextPage();
-}
-@end
-
-
 // =======================================================================
 
 AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) :
@@ -413,12 +363,12 @@
                      fYScaling = static_cast<double>(nDPIY)/72.0;
 
         NSSize aPaperSize = [mpPrintInfo paperSize];
-        o_rPageWidth  = double(aPaperSize.width) * fXScaling;
-        o_rPageHeight = double(aPaperSize.height) * fYScaling;
-        o_rPageOffX   = [mpPrintInfo leftMargin] * fXScaling;
-        o_rPageOffY   = [mpPrintInfo topMargin] * fYScaling;
-        o_rOutWidth   = o_rPageWidth - double([mpPrintInfo leftMargin] + [mpPrintInfo rightMargin]) * fXScaling;
-        o_rOutHeight  = o_rPageHeight - double([mpPrintInfo topMargin] + [mpPrintInfo bottomMargin]) * fYScaling;
+        o_rPageWidth  = static_cast<long>( double(aPaperSize.width) * fXScaling );
+        o_rPageHeight = static_cast<long>( double(aPaperSize.height) * fYScaling );
+        o_rPageOffX   = static_cast<long>( [mpPrintInfo leftMargin] * fXScaling );
+        o_rPageOffY   = static_cast<long>( [mpPrintInfo topMargin] * fYScaling );
+        o_rOutWidth   = static_cast<long>( o_rPageWidth - double([mpPrintInfo leftMargin] + [mpPrintInfo rightMargin]) * fXScaling );
+        o_rOutHeight  = static_cast<long>( o_rPageHeight - double([mpPrintInfo topMargin] + [mpPrintInfo bottomMargin]) * fYScaling );
     }
 }
 
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/window/makefile.mk ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/makefile.mk
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/window/makefile.mk	2007-07-05 10:31:09.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/makefile.mk	2007-10-15 15:24:25.000000000 +0200
@@ -57,7 +57,9 @@
 
 SLOFILES=	\
 		$(SLO)/salframe.obj		\
+		$(SLO)/salframeview.obj	\
 		$(SLO)/salmenu.obj		\
+		$(SLO)/salnsmenu.obj		\
 		$(SLO)/salobj.obj
 
 .ENDIF		# "$(GUIBASE)"!="aqua"
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/window/salframe.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/salframe.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/window/salframe.cxx	2007-10-09 17:16:48.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/salframe.cxx	2007-10-19 16:42:31.000000000 +0200
@@ -1,4 +1,4 @@
-/*n***********************************************************************
+/************************************************************************
  *
  *  OpenOffice.org - a multi-platform office productivity suite
  *
@@ -44,6 +44,7 @@
 #include "salmenu.h"
 #include "saltimer.h"
 #include "salinst.h"
+#include "salframeview.h"
 #include "vcl/salwtype.hxx"
 #include "vcl/window.hxx"
 
@@ -51,13 +52,16 @@
 #include "vcl/svapp.hxx"
 #include "rtl/ustrbuf.hxx"
 
+#include <premac.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <postmac.h>
+
 using namespace std;
 
 // =======================================================================
 
 AquaSalFrame* AquaSalFrame::s_pCaptureFrame = NULL;
 
-
 // =======================================================================
 
 AquaSalFrame::AquaSalFrame( SalFrame* pParent, ULONG salFrameStyle ) :
@@ -99,6 +103,8 @@
 
 AquaSalFrame::~AquaSalFrame()
 {
+    [SalFrameView unsetMouseFrame: this];
+    
     SalData* pSalData = GetSalData();
     pSalData->maFrames.remove( this );
     pSalData->maFrameCheck.erase( this );
@@ -131,8 +137,8 @@
     NSRect aVisibleRect = [[NSScreen mainScreen] visibleFrame];
     CocoaToVCL( aVisibleRect );
     
-    maGeometry.nX = aVisibleRect.origin.x + aVisibleRect.size.width / 10;
-    maGeometry.nY = aVisibleRect.origin.y + aVisibleRect.size.height / 10;
+    maGeometry.nX = static_cast<int>(aVisibleRect.origin.x + aVisibleRect.size.width / 10);
+    maGeometry.nY = static_cast<int>(aVisibleRect.origin.y + aVisibleRect.size.height / 10);
     maGeometry.nWidth = static_cast<unsigned int>(aVisibleRect.size.width * 0.8);
     maGeometry.nHeight = static_cast<unsigned int>(aVisibleRect.size.height * 0.8);
     
@@ -147,10 +153,10 @@
                       NSResizableWindowMask         |
                       NSClosableWindowMask;
         // make default window "maximized"
-        maGeometry.nX = aVisibleRect.origin.x;
-        maGeometry.nY = aVisibleRect.origin.y;
-        maGeometry.nWidth = aVisibleRect.size.width;
-        maGeometry.nHeight = aVisibleRect.size.height;
+        maGeometry.nX = static_cast<int>(aVisibleRect.origin.x);
+        maGeometry.nY = static_cast<int>(aVisibleRect.origin.y);
+        maGeometry.nWidth = static_cast<int>(aVisibleRect.size.width);
+        maGeometry.nHeight = static_cast<int>(aVisibleRect.size.height);
         mbPositioned = mbSized = true;
     }
     else
@@ -368,6 +374,7 @@
     }
     else
     {
+        [SalFrameView unsetMouseFrame: this];
         if( mpParent )
             [mpParent->mpWindow removeChildWindow: mpWindow];
         
@@ -548,28 +555,30 @@
 	mbFullScreen = bFullScreen;
 	if( bFullScreen )
 	{
-		NSRect aNewContentRect = maScreenRect;
-        maFullScreenRect = [mpWindow frame];
-        [mpWindow setFrame: [NSWindow frameRectForContentRect: aNewContentRect styleMask: mnStyleMask] display: YES];
+	    NSRect aNewContentRect = maScreenRect;
 
-        UpdateFrameGeometry();
-        if( mbShown )
+	    // hide the dock and the menubar
+	    [NSMenu setMenuBarVisible:NO];
+
+	    maFullScreenRect = [mpWindow frame];
+	    [mpWindow setFrame: [NSWindow frameRectForContentRect: aNewContentRect styleMask: mnStyleMask] display: YES];
+
+	    UpdateFrameGeometry();
+
+	    if( mbShown )
             CallCallback( SALEVENT_MOVERESIZE, NULL );
-        
-        // FIXME: replace by Cocoa calls
-		SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar );
-		// -> Shows menubar when we move the mouse over it.
 	}
 	else
 	{
-		[mpWindow setFrame: maFullScreenRect display: YES];
+	    [mpWindow setFrame: maFullScreenRect display: YES];
 
-        UpdateFrameGeometry();
-        if( mbShown )
+	    UpdateFrameGeometry();
+
+	    if( mbShown )
             CallCallback( SALEVENT_MOVERESIZE, NULL );
 
-        // FIXME: replace by Cocoa calls
-		SetSystemUIMode( kUIModeNormal, nil );
+	    // show the dock and the menubar
+	    [NSMenu setMenuBarVisible:YES];
 	}
     if( mbShown )
         // trigger filling our backbuffer
@@ -619,8 +628,8 @@
     case POINTER_MOVE:      pCursor = [NSCursor openHandCursor];        break;
     case POINTER_NSIZE:     pCursor = [NSCursor resizeUpCursor];        break;
     case POINTER_SSIZE:     pCursor = [NSCursor resizeDownCursor];      break;
-    case POINTER_ESIZE:     pCursor = [NSCursor resizeLeftCursor];      break;
-    case POINTER_WSIZE:     pCursor = [NSCursor resizeRightCursor];     break;
+    case POINTER_ESIZE:     pCursor = [NSCursor resizeRightCursor];      break;
+    case POINTER_WSIZE:     pCursor = [NSCursor resizeLeftCursor];     break;
     case POINTER_ARROW:     pCursor = [NSCursor arrowCursor];           break;
     case POINTER_VSPLIT:
     case POINTER_VSIZEBAR:
@@ -635,8 +644,12 @@
     case POINTER_REFHAND:   pCursor = [NSCursor pointingHandCursor];    break;
         
     default:
-        DBG_ERROR( "unmapped cursor" ); 
-        pCursor = [NSCursor arrowCursor];
+        pCursor = GetSalData()->getCursor( mePointerStyle );
+        if( pCursor == nil )
+        {
+            DBG_ERROR( "unmapped cursor" ); 
+            pCursor = [NSCursor arrowCursor];
+        }
         break;
     }
     return pCursor;
@@ -646,10 +659,8 @@
 {
     if( ePointerStyle >= POINTER_COUNT || ePointerStyle == mePointerStyle )
         return;
-    
     mePointerStyle = ePointerStyle;
     
-    AquaLog( ">*>_> %s\n",__func__);
     [mpWindow invalidateCursorRectsForView: mpView];
 }
 
@@ -787,8 +798,8 @@
         if( (nKeyCode & KEY_MOD1) != 0 )
             aResult.append( sal_Unicode( 0x2303 ) );
         // we do not really handle Alt (see below)
-        // we map it to MOD5, whichis actually Command
-        if( (nKeyCode & (KEY_MOD2|KEY_MOD5)) != 0 )
+        // we map it to MOD3, whichis actually Command
+        if( (nKeyCode & (KEY_MOD2|KEY_MOD3)) != 0 )
             aResult.append( sal_Unicode( 0x2318 ) );
         
         aResult.append( it->second );
@@ -1271,10 +1282,10 @@
     // FIXME: multiple screens
     NSRect aRect = [[NSScreen mainScreen] visibleFrame];
     CocoaToVCL( aRect );
-    rRect.nLeft     = aRect.origin.x;
-    rRect.nTop      = aRect.origin.y;
-    rRect.nRight    = aRect.origin.x + aRect.size.width - 1;
-    rRect.nBottom   = aRect.origin.y + aRect.size.height - 1;
+    rRect.nLeft     = static_cast<long>(aRect.origin.x);
+    rRect.nTop      = static_cast<long>(aRect.origin.y);
+    rRect.nRight    = static_cast<long>(aRect.origin.x + aRect.size.width - 1);
+    rRect.nBottom   = static_cast<long>(aRect.origin.y + aRect.size.height - 1);
 }
 
 SalPointerState	AquaSalFrame::GetPointerState()
@@ -1286,7 +1297,7 @@
     // get position
     NSPoint aPt = [mpWindow mouseLocationOutsideOfEventStream];
     CocoaToVCL( aPt, false );
-    state.maPos = Point( aPt.x, aPt.y );
+    state.maPos = Point(static_cast<long>(aPt.x), static_cast<long>(aPt.y));
 
     // FIXME: replace Carbon by Cocoa
     // Cocoa does not have an equivalent for GetCurrentEventButtonState
@@ -1419,19 +1430,19 @@
     CocoaToVCL( aFrameRect );
     CocoaToVCL( aContentRect );
 
-    maGeometry.nX = aContentRect.origin.x;
-    maGeometry.nY = aContentRect.origin.y;
+    maGeometry.nX = static_cast<int>(aContentRect.origin.x);
+    maGeometry.nY = static_cast<int>(aContentRect.origin.y);
 
-    maGeometry.nLeftDecoration = aContentRect.origin.x - aFrameRect.origin.x;
-    maGeometry.nRightDecoration = (aFrameRect.origin.x + aFrameRect.size.width) -
-                                  (aContentRect.origin.x + aContentRect.size.width);
-    
-    maGeometry.nTopDecoration = aContentRect.origin.y - aFrameRect.origin.y;
-    maGeometry.nBottomDecoration = (aFrameRect.origin.y + aFrameRect.size.height) -
-                                   (aContentRect.origin.y + aContentRect.size.height);
+    maGeometry.nLeftDecoration = static_cast<unsigned int>(aContentRect.origin.x - aFrameRect.origin.x);
+    maGeometry.nRightDecoration = static_cast<unsigned int>((aFrameRect.origin.x + aFrameRect.size.width) -
+                                  (aContentRect.origin.x + aContentRect.size.width));
+    
+    maGeometry.nTopDecoration = static_cast<unsigned int>(aContentRect.origin.y - aFrameRect.origin.y);
+    maGeometry.nBottomDecoration = static_cast<unsigned int>((aFrameRect.origin.y + aFrameRect.size.height) -
+                                   (aContentRect.origin.y + aContentRect.size.height));
 
-    maGeometry.nWidth = aContentRect.size.width;
-    maGeometry.nHeight = aContentRect.size.height;
+    maGeometry.nWidth = static_cast<unsigned int>(aContentRect.size.width);
+    maGeometry.nHeight = static_cast<unsigned int>(aContentRect.size.height);
 
     //DbgPrintFrameGeometry(fullWindowRect, contentRect, titleBarRect, maGeometry);
 }
@@ -1487,718 +1498,3 @@
     /* FIXME: implement */
 }
 
-static USHORT ImplGetModifierMask( unsigned int nMask, bool bKeyEvent )
-{
-    USHORT nRet = 0;
-    if( (nMask & NSShiftKeyMask) != 0 )
-        nRet |= KEY_SHIFT;
-    if( (nMask & NSControlKeyMask) != 0 )
-        nRet |= KEY_MOD1;
-    if( (nMask & NSAlternateKeyMask) != 0 )
-        nRet |= bKeyEvent ? KEY_MOD5 : KEY_MOD2;
-    if( (nMask & NSCommandKeyMask) != 0 )
-        nRet |= KEY_MOD5;
-    return nRet;
-}
-
-static USHORT ImplMapCharCode( sal_Unicode aCode )
-{
-    static USHORT aKeyCodeMap[ 128 ] =
-    {
-        0, 0, 0, 0, 0, 0, 0, 0,
-        KEY_BACKSPACE, KEY_TAB, KEY_RETURN, 0, 0, KEY_RETURN, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, KEY_ESCAPE, 0, 0, 0, 0,
-        KEY_SPACE, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, KEY_MULTIPLY, KEY_ADD, KEY_COMMA, KEY_SUBTRACT, KEY_POINT, KEY_DIVIDE,
-        KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7,
-        KEY_8, KEY_9, 0, 0, KEY_LESS, KEY_EQUAL, KEY_GREATER, 0,
-        0, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G,
-        KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
-        KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W,
-        KEY_X, KEY_Y, KEY_Z, 0, 0, 0, 0, 0,
-        KEY_QUOTELEFT, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G,
-        KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
-        KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W,
-        KEY_X, KEY_Y, KEY_Z, 0, 0, 0, KEY_TILDE, KEY_DELETE
-    };
-    
-    static USHORT aFunctionKeyCodeMap[ 128 ] =
-    {
-        KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_F1, KEY_F2, KEY_F3, KEY_F4,
-        KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12,
-        KEY_F13, KEY_F14, KEY_F15, KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20,
-        KEY_F21, KEY_F22, KEY_F23, KEY_F24, KEY_F25, KEY_F26, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, KEY_INSERT,
-        KEY_DELETE, KEY_HOME, 0, KEY_END, KEY_PAGEUP, KEY_PAGEDOWN, 0, 0,
-        0, 0, 0, 0, 0, KEY_MENU, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, KEY_UNDO, KEY_REPEAT, KEY_FIND, KEY_HELP, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0
-    };
-    
-    USHORT nKeyCode = 0;
-    if( aCode < sizeof( aKeyCodeMap) / sizeof( aKeyCodeMap[0] ) )
-        nKeyCode = aKeyCodeMap[ aCode ];
-    else if( aCode >= 0xf700 && aCode < 0xf780 )
-        nKeyCode = aFunctionKeyCodeMap[ aCode - 0xf700 ]; 
-    return nKeyCode;
-}
-
-@implementation SalFrameWindow
--(id)initWithSalFrame: (AquaSalFrame*)pFrame
-{
-    mpFrame = pFrame;
-    NSRect aRect = { { pFrame->maGeometry.nX, pFrame->maGeometry.nY },
-                     { pFrame->maGeometry.nWidth, pFrame->maGeometry.nHeight } };
-    pFrame->VCLToCocoa( aRect );
-    return [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ];
-}
-
--(AquaSalFrame*)getSalFrame
-{
-    return mpFrame;
-}
-
--(void)windowDidBecomeKey: (NSNotification*)pNotification
-{
-    YIELD_GUARD;
-
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-    {
-        if( mpFrame->mpMenu )
-            mpFrame->mpMenu->setMainMenu();
-        #if 0
-        // FIXME: we should disable menus while in modal mode
-        // however from down here there is currently no reliable way to
-        // find out when to do this
-        if( (mpFrame->mpParent && mpFrame->mpParent->GetWindow()->IsInModalMode()) )
-            AquaSalMenu::enableMainMenu( false );
-        #endif
-        mpFrame->CallCallback( SALEVENT_GETFOCUS, 0 );
-    }
-}
-
--(void)windowDidResignKey: (NSNotification*)pNotification
-{
-    YIELD_GUARD;
-
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-        mpFrame->CallCallback(SALEVENT_LOSEFOCUS, 0);
-}
-
--(void)windowDidChangeScreen: (NSNotification*)pNotification
-{
-    // FIXME: multiscreen
-}
-
--(void)windowDidMove: (NSNotification*)pNotification
-{
-    YIELD_GUARD;
-
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-    {
-        mpFrame->UpdateFrameGeometry();
-        mpFrame->CallCallback( SALEVENT_MOVE, 0 );
-    }
-}
-
--(void)windowDidResize: (NSNotification*)pNotification
-{
-    YIELD_GUARD;
-
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-    {
-        mpFrame->UpdateFrameGeometry();
-        mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
-    }
-}
-
--(void)windowDidMiniaturize: (NSNotification*)pNotification
-{
-    YIELD_GUARD;
-
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-    {
-        mpFrame->mbShown = false;
-        mpFrame->UpdateFrameGeometry();
-        mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
-    }
-}
-
--(void)windowDidDeminiaturize: (NSNotification*)pNotification
-{
-    YIELD_GUARD;
-
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-    {
-        mpFrame->mbShown = true;
-        mpFrame->UpdateFrameGeometry();
-        mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
-    }
-}
-
--(MacOSBOOL)windowShouldClose: (NSNotification*)pNotification
-{
-    YIELD_GUARD;
-
-    MacOSBOOL bRet = YES;
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-    {
-        mpFrame->CallCallback( SALEVENT_CLOSE, 0 );
-        bRet = NO; // application will close the window or not, AppKit shouldn't
-    }
-    return bRet;
-}
-
--(void)dockMenuItemTriggered: (id)sender
-{
-    YIELD_GUARD;
-
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-        mpFrame->ToTop( SAL_FRAME_TOTOP_RESTOREWHENMIN | SAL_FRAME_TOTOP_GRABFOCUS );
-}
-
-@end
-
-@implementation SalFrameView
--(id)initWithSalFrame: (AquaSalFrame*)pFrame
-{
-    mpFrame = pFrame;
-    if ((self = [super initWithFrame: [NSWindow contentRectForFrameRect: [mpFrame->getWindow() frame] styleMask: mpFrame->mnStyleMask]]) != nil)
-    {
-        mMarkedRange = NSMakeRange(NSNotFound, 0);
-        mSelectedRange = NSMakeRange(NSNotFound, 0);
-    }
-
-    return self;
-}
-
--(void)resetCursorRects
-{
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-    {
-        // FIXME: does this leak the returned NSCursor of getCurrentCursor ?
-        NSRect aRect = { { 0, 0 }, { mpFrame->maGeometry.nWidth, mpFrame->maGeometry.nHeight } };
-        [self addCursorRect: aRect cursor: mpFrame->getCurrentCursor()];
-    }
-}
-
--(MacOSBOOL)acceptsFirstResponder
-{
-    return YES;
-}
-
--(MacOSBOOL)acceptsFirstMouse: (NSEvent*)pEvent
-{
-    return YES;
-}
-
--(MacOSBOOL)isOpaque
-{
-    return YES;
-}
-
--(void)drawRect: (NSRect)aRect
-{
-    AquaLog( "drawRect\n" );
-
-    YIELD_GUARD;
-
-    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
-    {
-        // FIXME: optimize UpdateWindow wrt to aRect
-        if( mpFrame->mpGraphics )
-            mpFrame->mpGraphics->UpdateWindow( [NSGraphicsContext currentContext] );
-    }
-}
-
--(void)sendMouseEventToFrame: (NSEvent*)pEvent button:(USHORT)nButton eventtype:(USHORT)nEvent
-{
-    YIELD_GUARD;
-
-    AquaSalFrame* pDispatchFrame = AquaSalFrame::GetCaptureFrame();
-    if( pDispatchFrame )
-    {
-        if( nEvent == SALEVENT_MOUSELEAVE ) // no leave events if mouse is captured
-            nEvent = SALEVENT_MOUSEMOVE;
-    }
-    else
-        pDispatchFrame = mpFrame;
-    
-    
-    if( pDispatchFrame && AquaSalFrame::isAlive( pDispatchFrame ) )
-    {
-        pDispatchFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
-        pDispatchFrame->mnLastModifierFlags = [pEvent modifierFlags];
-
-        NSPoint aPt = [NSEvent mouseLocation];
-        pDispatchFrame->CocoaToVCL( aPt );
-
-        SalMouseEvent aEvent;
-        aEvent.mnTime   = pDispatchFrame->mnLastEventTime;
-        aEvent.mnX      = static_cast<long>(aPt.x) - pDispatchFrame->maGeometry.nX;
-        aEvent.mnY      = static_cast<long>(aPt.y) - pDispatchFrame->maGeometry.nY;
-        aEvent.mnButton = nButton;
-        aEvent.mnCode   =  aEvent.mnButton | ImplGetModifierMask( [pEvent modifierFlags], false );
-     
-        pDispatchFrame->CallCallback( nEvent, &aEvent );
-    }
-}
-
--(void)mouseDown: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:MOUSE_LEFT eventtype:SALEVENT_MOUSEBUTTONDOWN];
-}
-
--(void)mouseDragged: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:MOUSE_LEFT eventtype:SALEVENT_MOUSEMOVE];
-}
-
--(void)mouseUp: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:MOUSE_LEFT eventtype:SALEVENT_MOUSEBUTTONUP];
-}
-
--(void)mouseMoved: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:0 eventtype:SALEVENT_MOUSEMOVE];
-}
-
--(void)mouseEntered: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:0 eventtype:SALEVENT_MOUSEMOVE];
-}
-
--(void)mouseExited: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:0 eventtype:SALEVENT_MOUSELEAVE];
-}
-
--(void)rightMouseDown: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:MOUSE_RIGHT eventtype:SALEVENT_MOUSEBUTTONDOWN];
-}
-
--(void)rightMouseDragged: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:MOUSE_RIGHT eventtype:SALEVENT_MOUSEMOVE];
-}
-
--(void)rightMouseUp: (NSEvent*)pEvent
-{
-    [self sendMouseEventToFrame:pEvent button:MOUSE_RIGHT eventtype:SALEVENT_MOUSEBUTTONUP];
-}
-
--(void)otherMouseDown: (NSEvent*)pEvent
-{
-    if( [pEvent buttonNumber] == 2 )
-        [self sendMouseEventToFrame:pEvent button:MOUSE_MIDDLE eventtype:SALEVENT_MOUSEBUTTONDOWN];
-}
-
--(void)otherMouseDragged: (NSEvent*)pEvent
-{
-    if( [pEvent buttonNumber] == 2 )
-        [self sendMouseEventToFrame:pEvent button:MOUSE_MIDDLE eventtype:SALEVENT_MOUSEMOVE];
-}
-
--(void)otherMouseUp: (NSEvent*)pEvent
-{
-    if( [pEvent buttonNumber] == 2 )
-        [self sendMouseEventToFrame:pEvent button:MOUSE_MIDDLE eventtype:SALEVENT_MOUSEBUTTONUP];
-}
-
--(void)scrollWheel: (NSEvent*)pEvent
-{
-    YIELD_GUARD;
-    
-    if( AquaSalFrame::isAlive( mpFrame ) )
-    {
-        mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
-        mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
-
-        NSPoint aPt = [NSEvent mouseLocation];
-        mpFrame->CocoaToVCL( aPt );
-
-        SalWheelMouseEvent aEvent;
-        aEvent.mnTime   = mpFrame->mnLastEventTime;
-        aEvent.mnX      = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
-        aEvent.mnY      = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
-        aEvent.mnCode   = ImplGetModifierMask( mpFrame->mnLastModifierFlags, false ); // FIXME: button code
-
-        float dX = [pEvent deltaX];
-        float dY = [pEvent deltaY];
-        if( dX != 0.0 )
-        {
-            aEvent.mnDelta = dX;
-            aEvent.mnNotchDelta = dX;
-            aEvent.mnScrollLines = dX < 0.0 ? -1 : 1;
-            aEvent.mbHorz = TRUE;
-            mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
-        }
-        if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) )
-        {
-            aEvent.mnDelta = dY;
-            aEvent.mnNotchDelta = dY;
-            aEvent.mnScrollLines = dY < 0.0 ? -1 : 1;
-            aEvent.mbHorz = FALSE;
-            mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
-        }
-    }
-}
-
--(void)keyDown: (NSEvent*)pEvent
-{
-    YIELD_GUARD;
-    
-    if( AquaSalFrame::isAlive( mpFrame ) )
-    {
-        mpLastEvent = pEvent;
-        mbInKeyInput = true;
-        mbNeedSpecialKeyHandle = false;
-        mbKeyHandled = false;
-
-        mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
-        mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
-
-        bool bHandleCommandKey = mpFrame->mpMenu ? false : true;
-        if( (mpFrame->mnLastModifierFlags & NSControlKeyMask) ||
-            ( (mpFrame->mnLastModifierFlags & NSCommandKeyMask) && bHandleCommandKey )
-            )
-        {
-            // note: checkSpecialCharacters sets mbInKeyInput to false as a side effect
-            //       if the event is consumed
-            if ( [self checkSpecialCharacters:pEvent] )
-                return;
-        }
-
-        NSArray* pArray = [NSArray arrayWithObject: pEvent];
-        [self interpretKeyEvents: pArray];
-
-        mbInKeyInput = false;
-    }
-}
-
--(void)flagsChanged: (NSEvent*)pEvent
-{
-    YIELD_GUARD;
-    
-    if( AquaSalFrame::isAlive( mpFrame ) )
-    {
-        mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
-        mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
-    }
-}
-
--(void)insertText:(id)aString
-{
-    YIELD_GUARD;
-    
-    if( AquaSalFrame::isAlive( mpFrame ) )
-    {
-        NSString* pInsert = nil;
-        if( [aString isMemberOfClass: [NSAttributedString class]] )
-            pInsert = [aString string];
-        else
-            pInsert = aString;
-        
-        int nLen = 0;
-        if( pInsert && ( nLen = [pInsert length] ) > 0 )
-        {
-            OUString aInsertString( GetOUString( pInsert ) );
-            USHORT nKeyCode = 0;
-             // aCharCode initializer is safe since aInsertString will at least contain '\0'
-            sal_Unicode aCharCode = *aInsertString.getStr();
-            // FIXME: will probably break somehow in less than trivial text input mode
-            if( nLen == 1 &&
-                aCharCode < 0x80 &&
-                aCharCode > 0x31 &&
-                ( nKeyCode = ImplMapCharCode( aCharCode ) ) != 0
-                )
-            {
-                [self sendKeyInputAndReleaseToFrame: nKeyCode character: aCharCode];
-            }
-            else
-            {
-                SalExtTextInputEvent aEvent;
-                aEvent.mnTime           = mpFrame->mnLastEventTime;
-                aEvent.maText           = aInsertString;
-                aEvent.mpTextAttr       = NULL;
-                aEvent.mnCursorPos      = aInsertString.getLength();
-                aEvent.mnDeltaStart     = 0;
-                aEvent.mnCursorFlags    = 0;
-                aEvent.mbOnlyCursor     = FALSE;
-                mpFrame->CallCallback( SALEVENT_EXTTEXTINPUT, &aEvent );
-                if( AquaSalFrame::isAlive( mpFrame ) )
-                    mpFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, 0 );
-            }
-        }
-        else
-        {
-            SalExtTextInputEvent aEvent;
-            aEvent.mnTime           = mpFrame->mnLastEventTime;
-            aEvent.maText           = String();
-            aEvent.mpTextAttr       = NULL;
-            aEvent.mnCursorPos      = 0;
-            aEvent.mnDeltaStart     = 0;
-            aEvent.mnCursorFlags    = 0;
-            aEvent.mbOnlyCursor     = FALSE;
-            mpFrame->CallCallback( SALEVENT_EXTTEXTINPUT, &aEvent );
-            if( AquaSalFrame::isAlive( mpFrame ) )
-                mpFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, 0 );
-
-        }
-        mbKeyHandled = true;
-    }
-}
-
--(void)insertTab: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_TAB character: '\t'];
-}
-
--(void)moveLeft: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_LEFT character: 0];
-}
-
--(void)moveRight: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_RIGHT character: 0];
-}
-
--(void)moveUp: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_UP character: 0];
-}
-
--(void)moveDown: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_DOWN character: 0];
-}
-
--(void)insertNewline: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_RETURN character: '\n'];
-}
-
--(void)deleteBackward: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_BACKSPACE character: '\b'];
-}
-
--(void)deleteForward: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_DELETE character: 0x7f];
-}
-
--(void)cancelOperation: (id)aSender
-{
-    [self sendKeyInputAndReleaseToFrame: KEY_ESCAPE character: 0x1b];
-}
-
--(void)sendKeyInputAndReleaseToFrame: (USHORT)nKeyCode  character: (sal_Unicode)aChar
-{
-    YIELD_GUARD;
-    
-    if( AquaSalFrame::isAlive( mpFrame ) )
-    {
-        SalKeyEvent aEvent;
-        aEvent.mnTime           = mpFrame->mnLastEventTime;
-        aEvent.mnCode           = nKeyCode | ImplGetModifierMask( mpFrame->mnLastModifierFlags, true );
-        aEvent.mnCharCode       = aChar;
-        aEvent.mnRepeat         = FALSE;
-        mpFrame->CallCallback( SALEVENT_KEYINPUT, &aEvent );
-        if( AquaSalFrame::isAlive( mpFrame ) )
-            mpFrame->CallCallback( SALEVENT_KEYUP, &aEvent );
-    }
-}
-
-
--(MacOSBOOL)checkSpecialCharacters: (NSEvent *)pEvent
-{
-    // check for special characters
-    NSString* pUnmodifiedString = [pEvent charactersIgnoringModifiers]; 
-
-    if( pUnmodifiedString && [pUnmodifiedString length] == 1 )
-    {
-        unichar keyChar = [pUnmodifiedString characterAtIndex: 0];
-        USHORT nKeyCode = ImplMapCharCode( keyChar );
-        bool bUseKeyInput = false;
-        if( nKeyCode != 0 )
-        {
-            // handle function keys, let unmodified cursor keys through to input manager
-            if( keyChar >= 0xf704 && keyChar < 0xf900 )
-                bUseKeyInput = true;
-            else if( keyChar >= 0xf700 && keyChar < 0xf704 &&
-                    mpFrame->mnLastModifierFlags != 0 )
-                bUseKeyInput = true;
-            else if( ((mpFrame->mnLastModifierFlags & ~(NSControlKeyMask | NSAlternateKeyMask | NSShiftKeyMask)) &  NSDeviceIndependentModifierFlagsMask) == 0 &&
-                    (mpFrame->mnLastModifierFlags & (NSControlKeyMask | NSAlternateKeyMask)) != 0 )
-                bUseKeyInput = true;
-            else if( (mpFrame->mnLastModifierFlags & NSCommandKeyMask) && mpFrame->mpMenu == NULL )
-                bUseKeyInput = true;
-        }
-        if( bUseKeyInput )
-        {
-            [self sendKeyInputAndReleaseToFrame: nKeyCode character: 0];
-            mbInKeyInput = false;
-
-            return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-
-// NSTextInput protocol
-- (NSArray *)validAttributesForMarkedText
-{
-    // FIXME
-    return [NSArray array];
-}
-
-- (MacOSBOOL)hasMarkedText
-{
-    MacOSBOOL bHasMarkedText;
-
-    bHasMarkedText = ( mMarkedRange.location != NSNotFound ) &&
-                     ( mMarkedRange.length != 0 );
-    // hack to check keys like "Control-j"
-    if( mbInKeyInput )
-    {
-        mbNeedSpecialKeyHandle = true;
-    }
-    return bHasMarkedText;
-}
-
-- (NSRange)markedRange
-{
-    return [self hasMarkedText] ? mMarkedRange : NSMakeRange( NSNotFound, 0 );
-}
-
-- (NSRange)selectedRange
-{
-    return mSelectedRange;
-}
-
-- (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange
-{
-    AquaLog( ">*>_> %s\n",__func__ );
-    AquaLog( "location: %d, length: %d\n", selRange.location, selRange.length );
-    AquaLog( "aString = '%@'\n", aString );
-    AquaLog( "length %d\n", [aString length] );
-
-    if( ![aString isKindOfClass:[NSAttributedString class]] )
-        aString = [[[NSAttributedString alloc] initWithString:aString] autorelease];
-    NSRange rangeToReplace = [self hasMarkedText] ? [self markedRange] : [self selectedRange];
-    mMarkedRange = NSMakeRange( rangeToReplace.location, [aString length] );
-    mSelectedRange = NSMakeRange( rangeToReplace.location + selRange.location, selRange.length );
-
-    int len = [aString length];
-    SalExtTextInputEvent aInputEvent;
-    aInputEvent.mnTime = mpFrame->mnLastEventTime;
-    aInputEvent.mnDeltaStart = 0;
-    aInputEvent.mbOnlyCursor = FALSE;
-    if( len > 0 ) {
-        NSString *pString = [aString string];
-        OUString aInsertString( GetOUString( pString ) );
-        std::vector<USHORT> aInputFlags = std::vector<USHORT>( std::max( 1, len ), 0 );
-        for ( int i = 0; i < len; i++ )
-        {
-            // FIXME
-            aInputFlags[i] = SAL_EXTTEXTINPUT_ATTR_UNDERLINE;
-        }
-
-        aInputEvent.maText = aInsertString;
-        aInputEvent.mnCursorPos = selRange.location;
-        aInputEvent.mpTextAttr = &aInputFlags[0];
-        mpFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void *)&aInputEvent );
-    } else {
-        aInputEvent.maText = String();
-        aInputEvent.mnCursorPos = 0;
-        aInputEvent.mnCursorFlags = 0;
-        aInputEvent.mpTextAttr = 0;
-        mpFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void *)&aInputEvent );
-        mpFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, 0 );
-    }
-    mbKeyHandled= true;
-}
-
-- (void)unmarkText
-{
-    AquaLog( ">*>_> %s\n", __func__ );
-
-    mSelectedRange = mMarkedRange = NSMakeRange(NSNotFound, 0);
-}
-
-- (NSAttributedString *)attributedSubstringFromRange:(NSRange)theRange
-{
-    AquaLog( ">*>_> %s\n", __func__ );
-    AquaLog( "theRange = %d, %d\n", theRange.location, theRange.length);
-
-    // FIXME
-    return nil;
-}
-
-- (unsigned int)characterIndexForPoint:(NSPoint)thePoint
-{
-    AquaLog( ">*>_> %s\n",__func__ );
-
-    // FIXME
-    return 0;
-}
-
-- (long)conversationIdentifier
-{
-    return (long)self;
-}
-
-- (void)doCommandBySelector:(SEL)aSelector
-{
-    AquaLog( ">*>_> %s\n",__func__ );
-    AquaLog( "aSelector %s", aSelector );
-
-    // check for special characters with OOo way
-    if ( [self checkSpecialCharacters:mpLastEvent] )
-    {
-        mbKeyHandled = true;
-        return;
-    }
-
-    // Cocoa way
-    (void)[self performSelector: aSelector];
-    mbKeyHandled = true;
-}
-
-- (NSRect)firstRectForCharacterRange:(NSRange)theRange
-{
-    AquaLog( ">*>_> %s\n",__func__ );
-    AquaLog( "mSelectedRange = %d, %d", mSelectedRange.location, mSelectedRange.length );
-    AquaLog( " theRange = %d, %d\n", theRange.location, theRange.length );
-
-    SalExtTextInputPosEvent aPosEvent;
-    mpFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void *)&aPosEvent );
-
-    NSRect rect;
-
-    rect.origin.x = aPosEvent.mnX + mpFrame->maGeometry.nX;
-    rect.origin.y = aPosEvent.mnY + mpFrame->maGeometry.nY;
-    rect.size.width = aPosEvent.mnWidth;
-    rect.size.height = aPosEvent.mnHeight;
-
-    // FIXME how to convert the geometry??
-    //rect = [self convertRect:rect toView:nil];
-    //rect.origin = [[self window] convertBaseToScreen:rect.origin];
-    return rect;
-}
-
-@end
-
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/window/salframeview.mm ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/salframeview.mm
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/window/salframeview.mm	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/salframeview.mm	2007-10-23 16:23:37.000000000 +0200
@@ -0,0 +1,778 @@
+/*n***********************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "salinst.h"
+#include "salgdi.h"
+#include "salframe.h"
+#include "salframeview.h"
+ 
+static USHORT ImplGetModifierMask( unsigned int nMask, bool bKeyEvent )
+{
+    USHORT nRet = 0;
+    if( (nMask & NSShiftKeyMask) != 0 )
+        nRet |= KEY_SHIFT;
+    if( (nMask & NSControlKeyMask) != 0 )
+        nRet |= KEY_MOD1;
+    if( (nMask & NSAlternateKeyMask) != 0 )
+        nRet |= bKeyEvent ? KEY_MOD3 : KEY_MOD2;
+    if( (nMask & NSCommandKeyMask) != 0 )
+        nRet |= KEY_MOD3;
+    return nRet;
+}
+
+static USHORT ImplMapCharCode( sal_Unicode aCode )
+{
+    static USHORT aKeyCodeMap[ 128 ] =
+    {
+        0, 0, 0, 0, 0, 0, 0, 0,
+        KEY_BACKSPACE, KEY_TAB, KEY_RETURN, 0, 0, KEY_RETURN, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, KEY_ESCAPE, 0, 0, 0, 0,
+        KEY_SPACE, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, KEY_MULTIPLY, KEY_ADD, KEY_COMMA, KEY_SUBTRACT, KEY_POINT, KEY_DIVIDE,
+        KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7,
+        KEY_8, KEY_9, 0, 0, KEY_LESS, KEY_EQUAL, KEY_GREATER, 0,
+        0, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G,
+        KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
+        KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W,
+        KEY_X, KEY_Y, KEY_Z, 0, 0, 0, 0, 0,
+        KEY_QUOTELEFT, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G,
+        KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
+        KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W,
+        KEY_X, KEY_Y, KEY_Z, 0, 0, 0, KEY_TILDE, KEY_DELETE
+    };
+    
+    static USHORT aFunctionKeyCodeMap[ 128 ] =
+    {
+        KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_F1, KEY_F2, KEY_F3, KEY_F4,
+        KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12,
+        KEY_F13, KEY_F14, KEY_F15, KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20,
+        KEY_F21, KEY_F22, KEY_F23, KEY_F24, KEY_F25, KEY_F26, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, KEY_INSERT,
+        KEY_DELETE, KEY_HOME, 0, KEY_END, KEY_PAGEUP, KEY_PAGEDOWN, 0, 0,
+        0, 0, 0, 0, 0, KEY_MENU, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, KEY_UNDO, KEY_REPEAT, KEY_FIND, KEY_HELP, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0
+    };
+    
+    USHORT nKeyCode = 0;
+    if( aCode < sizeof( aKeyCodeMap) / sizeof( aKeyCodeMap[0] ) )
+        nKeyCode = aKeyCodeMap[ aCode ];
+    else if( aCode >= 0xf700 && aCode < 0xf780 )
+        nKeyCode = aFunctionKeyCodeMap[ aCode - 0xf700 ]; 
+    return nKeyCode;
+}
+
+static AquaSalFrame* pMouseFrame = NULL;
+
+@implementation SalFrameWindow
+-(id)initWithSalFrame: (AquaSalFrame*)pFrame
+{
+    mpFrame = pFrame;
+    NSRect aRect = { { pFrame->maGeometry.nX, pFrame->maGeometry.nY },
+                     { pFrame->maGeometry.nWidth, pFrame->maGeometry.nHeight } };
+    pFrame->VCLToCocoa( aRect );
+    return [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ];
+}
+
+-(AquaSalFrame*)getSalFrame
+{
+    return mpFrame;
+}
+
+-(void)windowDidBecomeKey: (NSNotification*)pNotification
+{
+    YIELD_GUARD;
+
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+    {
+        if( mpFrame->mpMenu )
+            mpFrame->mpMenu->setMainMenu();
+        #if 0
+        // FIXME: we should disable menus while in modal mode
+        // however from down here there is currently no reliable way to
+        // find out when to do this
+        if( (mpFrame->mpParent && mpFrame->mpParent->GetWindow()->IsInModalMode()) )
+            AquaSalMenu::enableMainMenu( false );
+        #endif
+        mpFrame->CallCallback( SALEVENT_GETFOCUS, 0 );
+    }
+}
+
+-(void)windowDidResignKey: (NSNotification*)pNotification
+{
+    YIELD_GUARD;
+
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+        mpFrame->CallCallback(SALEVENT_LOSEFOCUS, 0);
+}
+
+-(void)windowDidChangeScreen: (NSNotification*)pNotification
+{
+    // FIXME: multiscreen
+}
+
+-(void)windowDidMove: (NSNotification*)pNotification
+{
+    YIELD_GUARD;
+
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+    {
+        mpFrame->UpdateFrameGeometry();
+        mpFrame->CallCallback( SALEVENT_MOVE, 0 );
+    }
+}
+
+-(void)windowDidResize: (NSNotification*)pNotification
+{
+    YIELD_GUARD;
+
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+    {
+        mpFrame->UpdateFrameGeometry();
+        mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
+    }
+}
+
+-(void)windowDidMiniaturize: (NSNotification*)pNotification
+{
+    YIELD_GUARD;
+
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+    {
+        mpFrame->mbShown = false;
+        mpFrame->UpdateFrameGeometry();
+        mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
+    }
+}
+
+-(void)windowDidDeminiaturize: (NSNotification*)pNotification
+{
+    YIELD_GUARD;
+
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+    {
+        mpFrame->mbShown = true;
+        mpFrame->UpdateFrameGeometry();
+        mpFrame->CallCallback( SALEVENT_RESIZE, 0 );
+    }
+}
+
+-(MacOSBOOL)windowShouldClose: (NSNotification*)pNotification
+{
+    YIELD_GUARD;
+
+    MacOSBOOL bRet = YES;
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+    {
+        mpFrame->CallCallback( SALEVENT_CLOSE, 0 );
+        bRet = NO; // application will close the window or not, AppKit shouldn't
+    }
+    return bRet;
+}
+
+-(void)dockMenuItemTriggered: (id)sender
+{
+    YIELD_GUARD;
+
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+        mpFrame->ToTop( SAL_FRAME_TOTOP_RESTOREWHENMIN | SAL_FRAME_TOTOP_GRABFOCUS );
+}
+
+@end
+
+@implementation SalFrameView
++(void)unsetMouseFrame: (AquaSalFrame*)pFrame
+{
+    if( pFrame == pMouseFrame )
+        pMouseFrame = NULL;
+}
+
+-(id)initWithSalFrame: (AquaSalFrame*)pFrame
+{
+    mpFrame = pFrame;
+    if ((self = [super initWithFrame: [NSWindow contentRectForFrameRect: [mpFrame->getWindow() frame] styleMask: mpFrame->mnStyleMask]]) != nil)
+    {
+        mMarkedRange = NSMakeRange(NSNotFound, 0);
+        mSelectedRange = NSMakeRange(NSNotFound, 0);
+    }
+
+    return self;
+}
+
+-(void)resetCursorRects
+{
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+    {
+        // FIXME: does this leak the returned NSCursor of getCurrentCursor ?
+        NSRect aRect = { { 0, 0 }, { mpFrame->maGeometry.nWidth, mpFrame->maGeometry.nHeight } };
+        [self addCursorRect: aRect cursor: mpFrame->getCurrentCursor()];
+    }
+}
+
+-(MacOSBOOL)acceptsFirstResponder
+{
+    return YES;
+}
+
+-(MacOSBOOL)acceptsFirstMouse: (NSEvent*)pEvent
+{
+    return YES;
+}
+
+-(MacOSBOOL)isOpaque
+{
+    return YES;
+}
+
+-(void)drawRect: (NSRect)aRect
+{
+    AquaLog( "drawRect\n" );
+
+    YIELD_GUARD;
+
+    if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+    {
+        // FIXME: optimize UpdateWindow wrt to aRect
+        if( mpFrame->mpGraphics )
+            mpFrame->mpGraphics->UpdateWindow( [NSGraphicsContext currentContext] );
+    }
+}
+
+-(void)sendMouseEventToFrame: (NSEvent*)pEvent button:(USHORT)nButton eventtype:(USHORT)nEvent
+{
+    YIELD_GUARD;
+
+    AquaSalFrame* pDispatchFrame = AquaSalFrame::GetCaptureFrame();
+    if( pDispatchFrame )
+    {
+        if( nEvent == SALEVENT_MOUSELEAVE ) // no leave events if mouse is captured
+            nEvent = SALEVENT_MOUSEMOVE;
+    }
+    else if( pMouseFrame )
+        pDispatchFrame = pMouseFrame;
+    else
+        pDispatchFrame = mpFrame;
+    
+    
+    if( pDispatchFrame && AquaSalFrame::isAlive( pDispatchFrame ) )
+    {
+        pDispatchFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
+        pDispatchFrame->mnLastModifierFlags = [pEvent modifierFlags];
+
+        NSPoint aPt = [NSEvent mouseLocation];
+        pDispatchFrame->CocoaToVCL( aPt );
+        
+        USHORT nModMask = ImplGetModifierMask( [pEvent modifierFlags], false );
+        // #i82284# emulate ctrl left
+        if( nModMask == KEY_MOD1 && nButton == MOUSE_LEFT )
+        {
+            nModMask    = 0;
+            nButton     = MOUSE_RIGHT;
+        }
+
+        SalMouseEvent aEvent;
+        aEvent.mnTime   = pDispatchFrame->mnLastEventTime;
+        aEvent.mnX      = static_cast<long>(aPt.x) - pDispatchFrame->maGeometry.nX;
+        aEvent.mnY      = static_cast<long>(aPt.y) - pDispatchFrame->maGeometry.nY;
+        aEvent.mnButton = nButton;
+        aEvent.mnCode   =  aEvent.mnButton | nModMask;
+     
+        pDispatchFrame->CallCallback( nEvent, &aEvent );
+    }
+}
+
+-(void)mouseDown: (NSEvent*)pEvent
+{
+    [self sendMouseEventToFrame:pEvent button:MOUSE_LEFT eventtype:SALEVENT_MOUSEBUTTONDOWN];
+}
+
+-(void)mouseDragged: (NSEvent*)pEvent
+{
+    [self sendMouseEventToFrame:pEvent button:MOUSE_LEFT eventtype:SALEVENT_MOUSEMOVE];
+}
+
+-(void)mouseUp: (NSEvent*)pEvent
+{
+    [self sendMouseEventToFrame:pEvent button:MOUSE_LEFT eventtype:SALEVENT_MOUSEBUTTONUP];
+}
+
+-(void)mouseMoved: (NSEvent*)pEvent
+{
+    [self sendMouseEventToFrame:pEvent button:0 eventtype:SALEVENT_MOUSEMOVE];
+}
+
+-(void)mouseEntered: (NSEvent*)pEvent
+{
+    pMouseFrame = mpFrame;
+    
+    [self sendMouseEventToFrame:pEvent button:0 eventtype:SALEVENT_MOUSEMOVE];
+}
+
+-(void)mouseExited: (NSEvent*)pEvent
+{
+    if( pMouseFrame == mpFrame )
+        pMouseFrame = NULL;
+
+    [self sendMouseEventToFrame:pEvent button:0 eventtype:SALEVENT_MOUSELEAVE];
+}
+
+-(void)rightMouseDown: (NSEvent*)pEvent
+{
+    [self sendMouseEventToFrame:pEvent button:MOUSE_RIGHT eventtype:SALEVENT_MOUSEBUTTONDOWN];
+}
+
+-(void)rightMouseDragged: (NSEvent*)pEvent
+{
+    [self sendMouseEventToFrame:pEvent button:MOUSE_RIGHT eventtype:SALEVENT_MOUSEMOVE];
+}
+
+-(void)rightMouseUp: (NSEvent*)pEvent
+{
+    [self sendMouseEventToFrame:pEvent button:MOUSE_RIGHT eventtype:SALEVENT_MOUSEBUTTONUP];
+}
+
+-(void)otherMouseDown: (NSEvent*)pEvent
+{
+    if( [pEvent buttonNumber] == 2 )
+        [self sendMouseEventToFrame:pEvent button:MOUSE_MIDDLE eventtype:SALEVENT_MOUSEBUTTONDOWN];
+}
+
+-(void)otherMouseDragged: (NSEvent*)pEvent
+{
+    if( [pEvent buttonNumber] == 2 )
+        [self sendMouseEventToFrame:pEvent button:MOUSE_MIDDLE eventtype:SALEVENT_MOUSEMOVE];
+}
+
+-(void)otherMouseUp: (NSEvent*)pEvent
+{
+    if( [pEvent buttonNumber] == 2 )
+        [self sendMouseEventToFrame:pEvent button:MOUSE_MIDDLE eventtype:SALEVENT_MOUSEBUTTONUP];
+}
+
+-(void)scrollWheel: (NSEvent*)pEvent
+{
+    YIELD_GUARD;
+    
+    if( AquaSalFrame::isAlive( mpFrame ) )
+    {
+        mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
+        mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
+
+        NSPoint aPt = [NSEvent mouseLocation];
+        mpFrame->CocoaToVCL( aPt );
+
+        SalWheelMouseEvent aEvent;
+        aEvent.mnTime   = mpFrame->mnLastEventTime;
+        aEvent.mnX      = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
+        aEvent.mnY      = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
+        aEvent.mnCode   = ImplGetModifierMask( mpFrame->mnLastModifierFlags, false ); // FIXME: button code
+        aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
+
+        float dX = [pEvent deltaX];
+        float dY = [pEvent deltaY];
+        if( dX != 0.0 )
+        {
+            aEvent.mnDelta = static_cast<long>(floor(dX));
+            aEvent.mnNotchDelta = aEvent.mnDelta;
+            aEvent.mbHorz = TRUE;
+            mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
+        }
+        if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) )
+        {
+            aEvent.mnDelta = static_cast<long>(floor(dY));
+            aEvent.mnNotchDelta = aEvent.mnDelta;
+            aEvent.mbHorz = FALSE;
+            mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
+        }
+    }
+}
+
+-(void)keyDown: (NSEvent*)pEvent
+{
+    YIELD_GUARD;
+    
+    if( AquaSalFrame::isAlive( mpFrame ) )
+    {
+        mpLastEvent = pEvent;
+        mbInKeyInput = true;
+        mbNeedSpecialKeyHandle = false;
+        mbKeyHandled = false;
+
+        mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
+        mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
+
+        bool bHandleCommandKey = mpFrame->mpMenu ? false : true;
+        if( (mpFrame->mnLastModifierFlags & NSControlKeyMask) ||
+            ( (mpFrame->mnLastModifierFlags & NSCommandKeyMask) && bHandleCommandKey )
+            )
+        {
+            // note: checkSpecialCharacters sets mbInKeyInput to false as a side effect
+            //       if the event is consumed
+            if ( [self checkSpecialCharacters:pEvent] )
+                return;
+        }
+
+        NSArray* pArray = [NSArray arrayWithObject: pEvent];
+        [self interpretKeyEvents: pArray];
+
+        mbInKeyInput = false;
+    }
+}
+
+-(void)flagsChanged: (NSEvent*)pEvent
+{
+    YIELD_GUARD;
+    
+    if( AquaSalFrame::isAlive( mpFrame ) )
+    {
+        mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
+        mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
+    }
+}
+
+-(void)insertText:(id)aString
+{
+    YIELD_GUARD;
+    
+    if( AquaSalFrame::isAlive( mpFrame ) )
+    {
+        NSString* pInsert = nil;
+        if( [aString isMemberOfClass: [NSAttributedString class]] )
+            pInsert = [aString string];
+        else
+            pInsert = aString;
+        
+        int nLen = 0;
+        if( pInsert && ( nLen = [pInsert length] ) > 0 )
+        {
+            OUString aInsertString( GetOUString( pInsert ) );
+            USHORT nKeyCode = 0;
+             // aCharCode initializer is safe since aInsertString will at least contain '\0'
+            sal_Unicode aCharCode = *aInsertString.getStr();
+            // FIXME: will probably break somehow in less than trivial text input mode
+            if( nLen == 1 &&
+                aCharCode < 0x80 &&
+                aCharCode > 0x1f &&
+                ( nKeyCode = ImplMapCharCode( aCharCode ) ) != 0
+                )
+            {
+                [self sendKeyInputAndReleaseToFrame: nKeyCode character: aCharCode];
+            }
+            else
+            {
+                SalExtTextInputEvent aEvent;
+                aEvent.mnTime           = mpFrame->mnLastEventTime;
+                aEvent.maText           = aInsertString;
+                aEvent.mpTextAttr       = NULL;
+                aEvent.mnCursorPos      = aInsertString.getLength();
+                aEvent.mnDeltaStart     = 0;
+                aEvent.mnCursorFlags    = 0;
+                aEvent.mbOnlyCursor     = FALSE;
+                mpFrame->CallCallback( SALEVENT_EXTTEXTINPUT, &aEvent );
+                if( AquaSalFrame::isAlive( mpFrame ) )
+                    mpFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, 0 );
+            }
+        }
+        else
+        {
+            SalExtTextInputEvent aEvent;
+            aEvent.mnTime           = mpFrame->mnLastEventTime;
+            aEvent.maText           = String();
+            aEvent.mpTextAttr       = NULL;
+            aEvent.mnCursorPos      = 0;
+            aEvent.mnDeltaStart     = 0;
+            aEvent.mnCursorFlags    = 0;
+            aEvent.mbOnlyCursor     = FALSE;
+            mpFrame->CallCallback( SALEVENT_EXTTEXTINPUT, &aEvent );
+            if( AquaSalFrame::isAlive( mpFrame ) )
+                mpFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, 0 );
+
+        }
+        mbKeyHandled = true;
+    }
+}
+
+-(void)insertTab: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_TAB character: '\t'];
+}
+
+-(void)moveLeft: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_LEFT character: 0];
+}
+
+-(void)moveRight: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_RIGHT character: 0];
+}
+
+-(void)moveUp: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_UP character: 0];
+}
+
+-(void)moveDown: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_DOWN character: 0];
+}
+
+-(void)insertNewline: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_RETURN character: '\n'];
+}
+
+-(void)deleteBackward: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_BACKSPACE character: '\b'];
+}
+
+-(void)deleteForward: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_DELETE character: 0x7f];
+}
+
+-(void)cancelOperation: (id)aSender
+{
+    [self sendKeyInputAndReleaseToFrame: KEY_ESCAPE character: 0x1b];
+}
+
+-(void)sendKeyInputAndReleaseToFrame: (USHORT)nKeyCode  character: (sal_Unicode)aChar
+{
+    YIELD_GUARD;
+    
+    if( AquaSalFrame::isAlive( mpFrame ) )
+    {
+        SalKeyEvent aEvent;
+        aEvent.mnTime           = mpFrame->mnLastEventTime;
+        aEvent.mnCode           = nKeyCode | ImplGetModifierMask( mpFrame->mnLastModifierFlags, true );
+        aEvent.mnCharCode       = aChar;
+        aEvent.mnRepeat         = FALSE;
+        mpFrame->CallCallback( SALEVENT_KEYINPUT, &aEvent );
+        if( AquaSalFrame::isAlive( mpFrame ) )
+            mpFrame->CallCallback( SALEVENT_KEYUP, &aEvent );
+    }
+}
+
+
+-(MacOSBOOL)checkSpecialCharacters: (NSEvent *)pEvent
+{
+    // check for special characters
+    NSString* pUnmodifiedString = [pEvent charactersIgnoringModifiers]; 
+
+    if( pUnmodifiedString && [pUnmodifiedString length] == 1 )
+    {
+        unichar keyChar = [pUnmodifiedString characterAtIndex: 0];
+        USHORT nKeyCode = ImplMapCharCode( keyChar );
+        bool bUseKeyInput = false;
+        if( nKeyCode != 0 )
+        {
+            // handle function keys, let unmodified cursor keys through to input manager
+            if( keyChar >= 0xf704 && keyChar < 0xf900 )
+                bUseKeyInput = true;
+            else if( keyChar >= 0xf700 && keyChar < 0xf704 &&
+                    mpFrame->mnLastModifierFlags != 0 )
+                bUseKeyInput = true;
+            else if( ((mpFrame->mnLastModifierFlags & ~(NSControlKeyMask | NSAlternateKeyMask | NSShiftKeyMask)) &  NSDeviceIndependentModifierFlagsMask) == 0 &&
+                    (mpFrame->mnLastModifierFlags & (NSControlKeyMask | NSAlternateKeyMask)) != 0 )
+                bUseKeyInput = true;
+            else if( (mpFrame->mnLastModifierFlags & NSCommandKeyMask) && mpFrame->mpMenu == NULL )
+                bUseKeyInput = true;
+        }
+        if( bUseKeyInput )
+        {
+            [self sendKeyInputAndReleaseToFrame: nKeyCode character: 0];
+            mbInKeyInput = false;
+
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+
+// NSTextInput protocol
+- (NSArray *)validAttributesForMarkedText
+{
+    // FIXME
+    return [NSArray array];
+}
+
+- (MacOSBOOL)hasMarkedText
+{
+    MacOSBOOL bHasMarkedText;
+
+    bHasMarkedText = ( mMarkedRange.location != NSNotFound ) &&
+                     ( mMarkedRange.length != 0 );
+    // hack to check keys like "Control-j"
+    if( mbInKeyInput )
+    {
+        mbNeedSpecialKeyHandle = true;
+    }
+    return bHasMarkedText;
+}
+
+- (NSRange)markedRange
+{
+    return [self hasMarkedText] ? mMarkedRange : NSMakeRange( NSNotFound, 0 );
+}
+
+- (NSRange)selectedRange
+{
+    return mSelectedRange;
+}
+
+- (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange
+{
+    AquaLog( ">*>_> %s\n",__func__ );
+    AquaLog( "location: %d, length: %d\n", selRange.location, selRange.length );
+    AquaLog( "aString = '%@'\n", aString );
+    AquaLog( "length %d\n", [aString length] );
+
+    if( ![aString isKindOfClass:[NSAttributedString class]] )
+        aString = [[[NSAttributedString alloc] initWithString:aString] autorelease];
+    NSRange rangeToReplace = [self hasMarkedText] ? [self markedRange] : [self selectedRange];
+    mMarkedRange = NSMakeRange( rangeToReplace.location, [aString length] );
+    mSelectedRange = NSMakeRange( rangeToReplace.location + selRange.location, selRange.length );
+
+    int len = [aString length];
+    SalExtTextInputEvent aInputEvent;
+    aInputEvent.mnTime = mpFrame->mnLastEventTime;
+    aInputEvent.mnDeltaStart = 0;
+    aInputEvent.mbOnlyCursor = FALSE;
+    if( len > 0 ) {
+        NSString *pString = [aString string];
+        OUString aInsertString( GetOUString( pString ) );
+        std::vector<USHORT> aInputFlags = std::vector<USHORT>( std::max( 1, len ), 0 );
+        for ( int i = 0; i < len; i++ )
+        {
+            // FIXME
+            aInputFlags[i] = SAL_EXTTEXTINPUT_ATTR_UNDERLINE;
+        }
+
+        aInputEvent.maText = aInsertString;
+        aInputEvent.mnCursorPos = selRange.location;
+        aInputEvent.mpTextAttr = &aInputFlags[0];
+        mpFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void *)&aInputEvent );
+    } else {
+        aInputEvent.maText = String();
+        aInputEvent.mnCursorPos = 0;
+        aInputEvent.mnCursorFlags = 0;
+        aInputEvent.mpTextAttr = 0;
+        mpFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void *)&aInputEvent );
+        mpFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, 0 );
+    }
+    mbKeyHandled= true;
+}
+
+- (void)unmarkText
+{
+    AquaLog( ">*>_> %s\n", __func__ );
+
+    mSelectedRange = mMarkedRange = NSMakeRange(NSNotFound, 0);
+}
+
+- (NSAttributedString *)attributedSubstringFromRange:(NSRange)theRange
+{
+    AquaLog( ">*>_> %s\n", __func__ );
+    AquaLog( "theRange = %d, %d\n", theRange.location, theRange.length);
+
+    // FIXME
+    return nil;
+}
+
+- (unsigned int)characterIndexForPoint:(NSPoint)thePoint
+{
+    AquaLog( ">*>_> %s\n",__func__ );
+
+    // FIXME
+    return 0;
+}
+
+- (long)conversationIdentifier
+{
+    return (long)self;
+}
+
+- (void)doCommandBySelector:(SEL)aSelector
+{
+    AquaLog( ">*>_> %s\n",__func__ );
+    AquaLog( "aSelector %s", aSelector );
+
+    // check for special characters with OOo way
+    if ( [self checkSpecialCharacters:mpLastEvent] )
+    {
+        mbKeyHandled = true;
+        return;
+    }
+
+    // Cocoa way
+    (void)[self performSelector: aSelector];
+    mbKeyHandled = true;
+}
+
+- (NSRect)firstRectForCharacterRange:(NSRange)theRange
+{
+    AquaLog( ">*>_> %s\n",__func__ );
+    AquaLog( "mSelectedRange = %d, %d", mSelectedRange.location, mSelectedRange.length );
+    AquaLog( " theRange = %d, %d\n", theRange.location, theRange.length );
+
+    SalExtTextInputPosEvent aPosEvent;
+    mpFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void *)&aPosEvent );
+
+    NSRect rect;
+
+    rect.origin.x = aPosEvent.mnX + mpFrame->maGeometry.nX;
+    rect.origin.y =   aPosEvent.mnY + mpFrame->maGeometry.nY + 4; // add some space for underlines
+    rect.size.width = aPosEvent.mnWidth;
+    rect.size.height = aPosEvent.mnHeight;
+
+    mpFrame->VCLToCocoa( rect );
+    return rect;
+}
+
+@end
+
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/window/salmenu.cxx ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/salmenu.cxx
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/window/salmenu.cxx	2007-10-09 17:17:04.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/salmenu.cxx	2007-10-15 15:24:26.000000000 +0200
@@ -36,6 +36,7 @@
 #include "saldata.hxx"
 #include "salinst.h"
 #include "salmenu.h"
+#include "salnsmenu.h"
 #include "salframe.h"
 #include "vcl/svids.hrc"
 #include "vcl/cmdevt.hxx"
@@ -555,63 +556,3 @@
 
 // -------------------------------------------------------------------
 
-@implementation SalNSMenu
--(id)initWithMenu: (AquaSalMenu*)pMenu
-{
-    mpMenu = pMenu;
-    return [super initWithTitle: [NSString string]];
-}
-
--(void)menuNeedsUpdate: (NSMenu*)pMenu
-{
-    YIELD_GUARD;
-    
-    if( mpMenu )
-    {
-        const AquaSalFrame* pFrame = mpMenu->getFrame();
-        if( pFrame && AquaSalFrame::isAlive( pFrame ) )
-        {
-            SalMenuEvent aMenuEvt;
-            aMenuEvt.mnId   = 0;
-            aMenuEvt.mpMenu = mpMenu->mpVCLMenu;
-            if( aMenuEvt.mpMenu )
-            {
-                pFrame->CallCallback(SALEVENT_MENUACTIVATE, &aMenuEvt);
-                pFrame->CallCallback(SALEVENT_MENUDEACTIVATE, &aMenuEvt);
-            }
-            else
-                DBG_ERROR( "unconnected menu" );
-        }
-    }
-}
-
--(void)setSalMenu: (AquaSalMenu*)pMenu
-{
-    mpMenu = pMenu;
-}
-@end
-
-@implementation SalNSMenuItem
--(id)initWithMenuItem: (AquaSalMenuItem*)pMenuItem
-{
-    mpMenuItem = pMenuItem;
-    id ret = [super initWithTitle: [NSString string] action: nil keyEquivalent: [NSString string]];
-    [ret setAction:@selector(menuItemTriggered:)];
-    [ret setTarget: self];
-    return ret;
-}
--(void)menuItemTriggered: (id)aSender
-{
-    YIELD_GUARD;
-    
-    const AquaSalFrame* pFrame = mpMenuItem->mpParentMenu ? mpMenuItem->mpParentMenu->getFrame() : NULL;
-    if( pFrame && AquaSalFrame::isAlive( pFrame ) && ! pFrame->GetWindow()->IsInModalMode() )
-    {
-        SalMenuEvent aMenuEvt;
-        aMenuEvt.mnId   = mpMenuItem->mnId;
-        aMenuEvt.mpMenu = mpMenuItem->mpVCLMenu;
-        pFrame->CallCallback(SALEVENT_MENUCOMMAND, &aMenuEvt);
-    }
-}
-@end
-
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/aqua/source/window/salnsmenu.mm ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/salnsmenu.mm
--- ooo_SRC680_m233_src.orig/vcl/aqua/source/window/salnsmenu.mm	1970-01-01 01:00:00.000000000 +0100
+++ ooo_SRC680_m233_src.aquavcl04/vcl/aqua/source/window/salnsmenu.mm	2007-10-15 15:24:26.000000000 +0200
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile$
+ *
+ *  $Revision$
+ *
+ *  last change: $Author$ $Date$
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library 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 for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "salinst.h"
+#include "saldata.hxx"
+#include "salframe.h"
+#include "salmenu.h"
+#include "salnsmenu.h"
+
+#include "vcl/window.hxx"
+ 
+@implementation SalNSMenu
+-(id)initWithMenu: (AquaSalMenu*)pMenu
+{
+    mpMenu = pMenu;
+    return [super initWithTitle: [NSString string]];
+}
+
+-(void)menuNeedsUpdate: (NSMenu*)pMenu
+{
+    YIELD_GUARD;
+    
+    if( mpMenu )
+    {
+        const AquaSalFrame* pFrame = mpMenu->getFrame();
+        if( pFrame && AquaSalFrame::isAlive( pFrame ) )
+        {
+            SalMenuEvent aMenuEvt;
+            aMenuEvt.mnId   = 0;
+            aMenuEvt.mpMenu = mpMenu->mpVCLMenu;
+            if( aMenuEvt.mpMenu )
+            {
+                pFrame->CallCallback(SALEVENT_MENUACTIVATE, &aMenuEvt);
+                pFrame->CallCallback(SALEVENT_MENUDEACTIVATE, &aMenuEvt);
+            }
+            else
+                DBG_ERROR( "unconnected menu" );
+        }
+    }
+}
+
+-(void)setSalMenu: (AquaSalMenu*)pMenu
+{
+    mpMenu = pMenu;
+}
+@end
+
+@implementation SalNSMenuItem
+-(id)initWithMenuItem: (AquaSalMenuItem*)pMenuItem
+{
+    mpMenuItem = pMenuItem;
+    id ret = [super initWithTitle: [NSString string] action: nil keyEquivalent: [NSString string]];
+    [ret setAction:@selector(menuItemTriggered:)];
+    [ret setTarget: self];
+    return ret;
+}
+-(void)menuItemTriggered: (id)aSender
+{
+    YIELD_GUARD;
+    
+    const AquaSalFrame* pFrame = mpMenuItem->mpParentMenu ? mpMenuItem->mpParentMenu->getFrame() : NULL;
+    if( pFrame && AquaSalFrame::isAlive( pFrame ) && ! pFrame->GetWindow()->IsInModalMode() )
+    {
+        SalMenuEvent aMenuEvt;
+        aMenuEvt.mnId   = mpMenuItem->mnId;
+        aMenuEvt.mpMenu = mpMenuItem->mpVCLMenu;
+        pFrame->CallCallback(SALEVENT_MENUCOMMAND, &aMenuEvt);
+    }
+}
+@end
+
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/inc/vcl/cmdevt.hxx ooo_SRC680_m233_src.aquavcl04/vcl/inc/vcl/cmdevt.hxx
--- ooo_SRC680_m233_src.orig/vcl/inc/vcl/cmdevt.hxx	2007-07-05 10:34:29.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/inc/vcl/cmdevt.hxx	2007-10-19 16:42:28.000000000 +0200
@@ -181,10 +181,8 @@
                         { return ((mnCode & KEY_MOD1) != 0); }
     BOOL            IsMod2() const
                         { return ((mnCode & KEY_MOD2) != 0); }
-#ifdef MACOSX
-    BOOL	    IsMod5() const
-			{ return ((mnCode & KEY_MOD5) != 0); }
-#endif
+    BOOL	        IsMod3() const
+                        { return ((mnCode & KEY_MOD3) != 0); }
 };
 
 inline CommandWheelData::CommandWheelData()
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/inc/vcl/keycod.hxx ooo_SRC680_m233_src.aquavcl04/vcl/inc/vcl/keycod.hxx
--- ooo_SRC680_m233_src.orig/vcl/inc/vcl/keycod.hxx	2007-04-11 19:58:51.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/inc/vcl/keycod.hxx	2007-10-19 16:42:28.000000000 +0200
@@ -95,11 +95,7 @@
 				KeyCode( KeyFuncType eFunction );
 
 	USHORT		GetFullCode() const { return nCode; }
-#ifdef MACOSX
 	USHORT		GetFullKeyCode() const { return (nCode) ; }
-#else
-	USHORT		GetFullKeyCode() const { return (nCode & ~KEY_CONTROLMOD); }
-#endif
 	KeyFuncType GetFullFunction() const { return eFunc; }
 	BOOL		IsDefinedKeyCodeEqual( const KeyCode& rKeyCode ) const;
 
@@ -116,16 +112,8 @@
 					{ return ((nCode & KEY_MOD1) != 0); }
 	BOOL		IsMod2() const
 					{ return ((nCode & KEY_MOD2) != 0); }
-#ifdef MACOSX
-	//  [ericb 07/2006]] Remap ALT with mod5, working fine with Tiger
-	BOOL		IsMod5() const
-					{ return ((nCode & KEY_MOD5) != 0); }	
-	BOOL		IsControlMod() const
-					{ return (IsMod2() && IsMod1() && IsMod5()); }
-#else
-	BOOL		IsControlMod() const
-					{ return ((nCode & KEY_CONTROLMOD) != 0); }
-#endif
+	BOOL		IsMod3() const
+					{ return ((nCode & KEY_MOD3) != 0); }	
 	USHORT		GetGroup() const
 					{ return (nCode & KEYGROUP_TYPE); }
 
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/inc/vcl/keycodes.hxx ooo_SRC680_m233_src.aquavcl04/vcl/inc/vcl/keycodes.hxx
--- ooo_SRC680_m233_src.orig/vcl/inc/vcl/keycodes.hxx	2007-04-11 19:59:01.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/inc/vcl/keycodes.hxx	2007-10-19 16:42:28.000000000 +0200
@@ -177,13 +177,8 @@
 #define KEY_SHIFT		((USHORT)0x1000)
 #define KEY_MOD1		((USHORT)0x2000)
 #define KEY_MOD2		((USHORT)0x4000)
-#ifdef MACOSX
-#define KEY_MOD5	((USHORT)0x8000)
+#define KEY_MOD3	((USHORT)0x8000)
 #define KEY_MODTYPE	((USHORT)0xF000)
-#else
-#define KEY_MODTYPE 	((USHORT)0x7000)
-#define KEY_CONTROLMOD	((USHORT)0x8000)
-#endif
 #define KEY_ALLMODTYPE	((USHORT)0xF000)
 
 // extended Modifier-Keys (only used for modkey events)
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/control/edit.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/control/edit.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/control/edit.cxx	2007-09-26 17:06:07.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/control/edit.cxx	2007-10-19 16:42:28.000000000 +0200
@@ -429,8 +429,7 @@
 {
 	// In the future we must use new Unicode functions for this
 	xub_Unicode cCharCode = rKeyEvent.GetCharCode();
-	return ((cCharCode >= 32) && (cCharCode != 127) &&
-			!rKeyEvent.GetKeyCode().IsControlMod());
+	return ((cCharCode >= 32) && (cCharCode != 127));
 }
 
 // -----------------------------------------------------------------------
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/control/field.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/control/field.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/control/field.cxx	2007-07-24 12:06:28.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/control/field.cxx	2007-10-19 16:42:29.000000000 +0200
@@ -839,8 +839,7 @@
 
 long NumericField::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplNumericProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
             return 1;
@@ -959,8 +958,7 @@
 
 long NumericBox::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplNumericProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
             return 1;
@@ -1777,8 +1775,7 @@
 
 long MetricField::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplMetricProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
             return 1;
@@ -1904,8 +1901,7 @@
 
 long MetricBox::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplMetricProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
             return 1;
@@ -2246,8 +2242,7 @@
 
 long CurrencyField::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplCurrencyProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
             return 1;
@@ -2366,8 +2361,7 @@
 
 long CurrencyBox::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplCurrencyProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsUseThousandSep(), ImplGetLocaleDataWrapper() ) )
             return 1;
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/control/field2.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/control/field2.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/control/field2.cxx	2007-06-27 22:05:38.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/control/field2.cxx	2007-10-19 16:42:29.000000000 +0200
@@ -681,7 +681,7 @@
         }
     }
 
-    if ( aCode.IsControlMod() || (cChar < 32) || (cChar == 127) )
+    if ( (cChar < 32) || (cChar == 127) )
         return FALSE;
 
     Selection aSel = aOldSel;
@@ -992,8 +992,7 @@
 
 long PatternField::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplPatternProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetEditMask(), GetLiteralMask(),
                                          IsStrictFormat(), GetFormatFlags(),
@@ -1071,8 +1070,7 @@
 
 long PatternBox::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplPatternProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetEditMask(), GetLiteralMask(),
                                          IsStrictFormat(), GetFormatFlags(),
@@ -2159,8 +2157,7 @@
 long DateField::PreNotify( NotifyEvent& rNEvt )
 {
     if ( (rNEvt.GetType() == EVENT_KEYINPUT) && IsStrictFormat() &&
-         ( GetExtDateFormat() != XTDATEF_SYSTEM_LONG ) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+         ( GetExtDateFormat() != XTDATEF_SYSTEM_LONG ) )
     {
         if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetExtDateFormat( TRUE ), ImplGetLocaleDataWrapper() ) )
             return 1;
@@ -2304,8 +2301,7 @@
 long DateBox::PreNotify( NotifyEvent& rNEvt )
 {
     if ( (rNEvt.GetType() == EVENT_KEYINPUT) && IsStrictFormat() &&
-         ( GetExtDateFormat() != XTDATEF_SYSTEM_LONG ) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+         ( GetExtDateFormat() != XTDATEF_SYSTEM_LONG ) )
     {
         if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetExtDateFormat( TRUE ), ImplGetLocaleDataWrapper() ) )
             return 1;
@@ -3208,8 +3204,7 @@
 
 long TimeField::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplTimeProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsDuration(), GetFormat(), ImplGetLocaleDataWrapper() ) )
             return 1;
@@ -3392,8 +3387,7 @@
 
 long TimeBox::PreNotify( NotifyEvent& rNEvt )
 {
-    if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
-         !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+    if ( (rNEvt.GetType() == EVENT_KEYINPUT) )
     {
         if ( ImplTimeProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsDuration(), GetFormat(), ImplGetLocaleDataWrapper() ) )
             return 1;
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/control/ilstbox.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/control/ilstbox.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/control/ilstbox.cxx	2007-09-13 18:33:05.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/control/ilstbox.cxx	2007-10-19 16:42:29.000000000 +0200
@@ -1548,8 +1548,7 @@
 		{
 			xub_Unicode c = rKEvt.GetCharCode();
 
-			if ( !IsReadOnly() && (c >= 32) && (c != 127) &&
-				 !rKEvt.GetKeyCode().IsControlMod() )
+			if ( !IsReadOnly() && (c >= 32) && (c != 127) )
 			{
 				maSearchStr += c;
 				XubString aTmpSearch( maSearchStr );
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/gdi/impprn.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/gdi/impprn.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/gdi/impprn.cxx	2007-10-09 17:19:55.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/gdi/impprn.cxx	2007-10-15 17:18:32.000000000 +0200
@@ -489,6 +489,7 @@
                                  maJobSetup.ImplGetConstData(),
                                  this );
             mpPrinter->EndJob();
+            mbJobActive = mbPrinting = FALSE;
             mpParent->ImplEndPrint();
         }
     }
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/window/keycod.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/window/keycod.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/window/keycod.cxx	2007-06-27 22:31:44.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/window/keycod.cxx	2007-10-19 16:42:29.000000000 +0200
@@ -67,22 +67,22 @@
 static USHORT aImplKeyFuncTab[(KEYFUNC_FRONT+1)*3] =
 {
 	0, 0, 0,												// KEYFUNC_DONTKNOW
-	KEY_N | KEY_MOD5, 0, 0,									// KEYFUNC_NEW
-	KEY_O | KEY_MOD5, KEY_OPEN, 0,							// KEYFUNC_OPEN
-	KEY_S | KEY_MOD5, 0, 0,									// KEYFUNC_SAVE
+	KEY_N | KEY_MOD3, 0, 0,									// KEYFUNC_NEW
+	KEY_O | KEY_MOD3, KEY_OPEN, 0,							// KEYFUNC_OPEN
+	KEY_S | KEY_MOD3, 0, 0,									// KEYFUNC_SAVE
 	0, 0, 0,												// KEYFUNC_SAVEAS
-	KEY_P | KEY_MOD5, 0, 0, 								// KEYFUNC_PRINT
-	KEY_W | KEY_MOD5, KEY_F4 | KEY_MOD5, 0, 				// KEYFUNC_CLOSE
-	KEY_Q | KEY_MOD5, KEY_F4 | KEY_MOD2, 0, 				// KEYFUNC_QUIT
-	KEY_X | KEY_MOD5, KEY_DELETE | KEY_SHIFT, KEY_CUT,		// KEYFUNC_CUT
-	KEY_C | KEY_MOD5, KEY_INSERT | KEY_MOD5, KEY_COPY,		// KEYFUNC_COPY
-	KEY_V | KEY_MOD5, KEY_INSERT | KEY_SHIFT, KEY_PASTE,	// KEYFUNC_PASTE
-	KEY_Z | KEY_MOD5, KEY_BACKSPACE | KEY_MOD2, KEY_UNDO,	// KEYFUNC_UNDO
+	KEY_P | KEY_MOD3, 0, 0, 								// KEYFUNC_PRINT
+	KEY_W | KEY_MOD3, KEY_F4 | KEY_MOD3, 0, 				// KEYFUNC_CLOSE
+	KEY_Q | KEY_MOD3, KEY_F4 | KEY_MOD2, 0, 				// KEYFUNC_QUIT
+	KEY_X | KEY_MOD3, KEY_DELETE | KEY_SHIFT, KEY_CUT,		// KEYFUNC_CUT
+	KEY_C | KEY_MOD3, KEY_INSERT | KEY_MOD3, KEY_COPY,		// KEYFUNC_COPY
+	KEY_V | KEY_MOD3, KEY_INSERT | KEY_SHIFT, KEY_PASTE,	// KEYFUNC_PASTE
+	KEY_Z | KEY_MOD3, KEY_BACKSPACE | KEY_MOD2, KEY_UNDO,	// KEYFUNC_UNDO
 	0, 0, 0,												// KEYFUNC_REDO
 	KEY_DELETE, 0, 0,										// KEYFUNC_DELETE
 	KEY_REPEAT, 0, 0,										// KEYFUNC_REPEAT
-	KEY_F | KEY_MOD5, KEY_FIND, 0,							// KEYFUNC_FIND
-	KEY_F | KEY_SHIFT | KEY_MOD5, KEY_SHIFT | KEY_FIND, 0,	// KEYFUNC_FINDBACKWARD
+	KEY_F | KEY_MOD3, KEY_FIND, 0,							// KEYFUNC_FIND
+	KEY_F | KEY_SHIFT | KEY_MOD3, KEY_SHIFT | KEY_FIND, 0,	// KEYFUNC_FINDBACKWARD
 	KEY_RETURN | KEY_MOD2, 0, 0,							// KEYFUNC_PROPERTIES
 	0, 0, 0 												// KEYFUNC_FRONT
 };
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/window/menu.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/window/menu.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/window/menu.cxx	2007-09-20 18:24:48.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/window/menu.cxx	2007-10-19 16:42:29.000000000 +0200
@@ -4516,7 +4516,6 @@
                                        CTRL_STATE_ENABLED,
                                        ImplControlValue(),
                                        OUString() );
-                    Pop();
                     if( bHighlight &&
                         IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM ) )
                     {
@@ -4532,6 +4531,7 @@
                     }
                     else
                         bDrawItemRect = bHighlight;
+                    Pop();
                 }
                 if( bDrawItemRect )
                 {
@@ -4831,7 +4831,7 @@
             else
             {
                 // Bei ungueltigen Tasten Beepen, aber nicht bei HELP und F-Tasten
-                if ( !rKEvent.GetKeyCode().IsControlMod() && ( nCode != KEY_HELP ) && ( rKEvent.GetKeyCode().GetGroup() != KEYGROUP_FKEYS ) )
+                if ( ( nCode != KEY_HELP ) && ( rKEvent.GetKeyCode().GetGroup() != KEYGROUP_FKEYS ) )
                     Sound::Beep();
                 FloatingWindow::KeyInput( rKEvent );
             }
@@ -5566,7 +5566,7 @@
         }
     }
 
-    if ( !bDone && ( bFromMenu || rKEvent.GetKeyCode().IsControlMod() ) )
+    if ( !bDone && bFromMenu )
     {
         xub_Unicode nCharCode = rKEvent.GetCharCode();
         if ( nCharCode )
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/window/status.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/window/status.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/window/status.cxx	2007-08-03 16:08:49.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/window/status.cxx	2007-10-23 13:35:26.000000000 +0200
@@ -1584,7 +1584,9 @@
 	DBG_ASSERT( mbProgressMode, "StatusBar::SetProgressValue(): no progrss mode" );
 	DBG_ASSERTWARNING( nNewPercent <= 100, "StatusBar::SetProgressValue(): nPercent > 100" );
 
-	if ( mbProgressMode && IsReallyVisible() )
+	if ( mbProgressMode
+	&&   IsReallyVisible()
+	&&   (!mnPercent || (mnPercent != nNewPercent)) )
 	{
 		Update();
 		SetLineColor();
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/source/window/winproc.cxx ooo_SRC680_m233_src.aquavcl04/vcl/source/window/winproc.cxx
--- ooo_SRC680_m233_src.orig/vcl/source/window/winproc.cxx	2007-10-09 17:20:51.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/source/window/winproc.cxx	2007-10-19 16:42:29.000000000 +0200
@@ -646,7 +646,7 @@
                                 ::com::sun::star::awt::MouseEvent aMouseEvent(
                                     static_cast < ::com::sun::star::uno::XInterface * > ( 0 ),
 #ifdef MACOSX
-				    nCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD5),
+				    nCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3),
 #else
                                     nCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2),
 #endif
@@ -1076,11 +1076,7 @@
     {
 #ifdef DBG_UTIL
         // #105224# use Ctrl-Alt-Shift-D, Ctrl-Shift-D must be useable by app
-        #ifdef MACOSX
-        if ( aKeyCode.IsShift() && aKeyCode.IsMod1() && (aKeyCode.IsMod2() || aKeyCode.IsMod5()) && (aKeyCode.GetCode() == KEY_D) )
-        #else
-        if ( aKeyCode.IsShift() && aKeyCode.IsMod1() && aKeyCode.IsMod2() && (aKeyCode.GetCode() == KEY_D) )
-        #endif
+        if ( aKeyCode.IsShift() && aKeyCode.IsMod1() && (aKeyCode.IsMod2() || aKeyCode.IsMod3()) && (aKeyCode.GetCode() == KEY_D) )
         {
             DBGGUI_START();
             return 1;
@@ -2091,7 +2087,7 @@
                                  pEvent->mnX, pEvent->mnY,
                                  pEvent->mnTime,
 #ifdef MACOSX
-				 pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD5)),
+				 pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3)),
 #else
                                  pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)),
 #endif
@@ -2106,7 +2102,7 @@
                                  pEvent->mnX, pEvent->mnY,
                                  pEvent->mnTime,
 #ifdef MACOSX
-				 pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD5)),
+				 pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3)),
 #else
                                  pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)),
 #endif
@@ -2169,7 +2165,7 @@
     if ( pTrackWin )
         pWindow = pTrackWin;
 #ifdef MACOSX
-    USHORT nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD5);
+    USHORT nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3);
 #else
     USHORT nOldCode = pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2);
 #endif
@@ -2177,7 +2173,7 @@
     if ( nOldCode != nNewCode )
     {
 #ifdef MACOSX
-	nNewCode |= pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & ~(KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD5);
+	nNewCode |= pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & ~(KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3);
 #else
         nNewCode |= pWindow->ImplGetWindowImpl()->mpFrameData->mnMouseCode & ~(KEY_SHIFT | KEY_MOD1 | KEY_MOD2);
 #endif
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/unx/gtk/window/gtkframe.cxx ooo_SRC680_m233_src.aquavcl04/vcl/unx/gtk/window/gtkframe.cxx
--- ooo_SRC680_m233_src.orig/vcl/unx/gtk/window/gtkframe.cxx	2007-10-09 17:21:04.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/unx/gtk/window/gtkframe.cxx	2007-10-19 18:46:41.000000000 +0200
@@ -95,11 +95,9 @@
     if( (state & GDK_MOD1_MASK) )
 	{
         nCode |= KEY_MOD2;
-		if( ! (nCode & KEY_MOD1) )
 #ifdef MACOSX
-			nCode |= KEY_MOD5;
-#else
-			nCode |= KEY_CONTROLMOD;
+		if( ! (nCode & KEY_MOD1) )
+			nCode |= KEY_MOD3;
 #endif
 	}
     return nCode;
@@ -2832,17 +2830,17 @@
             case GDK_Alt_L:
                 nExtModMask = MODKEY_LMOD2;
 #ifdef MACOSX
-		nModMask = KEY_MOD5 | (pEvent->type == GDK_KEY_RELEASE ? KEY_MOD5: 0);
+                nModMask = KEY_MOD3;
 #else
-                nModMask = KEY_MOD2 | (pEvent->type == GDK_KEY_RELEASE ? KEY_CONTROLMOD : 0);
+                nModMask = KEY_MOD2;
 #endif
                 break;
             case GDK_Alt_R:
                 nExtModMask = MODKEY_RMOD2;
 #ifdef MACOSX
-		nModMask = KEY_MOD2 | (pEvent->type == GDK_KEY_RELEASE ? KEY_MOD5 : 0);
+		        nModMask = KEY_MOD2 | (pEvent->type == GDK_KEY_RELEASE ? KEY_MOD3 : 0);
 #else
-                nModMask = KEY_MOD2 | (pEvent->type == GDK_KEY_RELEASE ? KEY_CONTROLMOD : 0);
+                nModMask = KEY_MOD2;
 #endif
                 break;
             case GDK_Shift_L:
@@ -2874,11 +2872,7 @@
 		{
 			// emulate KEY_MENU
 			if( ( pEvent->keyval == GDK_Alt_L || pEvent->keyval == GDK_Alt_R ) &&
-#ifdef MACOSX
-				( nModCode & ~(KEY_MOD5|KEY_MOD2)) == 0 )
-#else
-				( nModCode & ~(KEY_CONTROLMOD|KEY_MOD2)) == 0 )
-#endif
+				( nModCode & ~(KEY_MOD3|KEY_MOD2)) == 0 )
 			{
 				if( pEvent->type == GDK_KEY_PRESS )
 					pThis->m_bSingleAltPress = true;
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/unx/source/app/saldisp.cxx ooo_SRC680_m233_src.aquavcl04/vcl/unx/source/app/saldisp.cxx
--- ooo_SRC680_m233_src.orig/vcl/unx/source/app/saldisp.cxx	2007-07-31 18:10:02.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/unx/source/app/saldisp.cxx	2007-10-19 16:42:30.000000000 +0200
@@ -1207,7 +1207,7 @@
 {
     String aStrMap;
 #ifdef MACOSX
-    if( nKeyCode & KEY_MOD5 )
+    if( nKeyCode & KEY_MOD3 )
     {
 	aStrMap += GetKeyNameFromKeySym( nMod2KeySym_ );
     }
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/unx/source/window/salframe.cxx ooo_SRC680_m233_src.aquavcl04/vcl/unx/source/window/salframe.cxx
--- ooo_SRC680_m233_src.orig/vcl/unx/source/window/salframe.cxx	2007-08-30 15:57:30.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/unx/source/window/salframe.cxx	2007-10-19 16:42:30.000000000 +0200
@@ -3042,14 +3042,10 @@
 		nModCode |= KEY_MOD1;
 #ifdef MACOSX
 	if( pEvent->state & Mod2Mask )
-		nModCode |= KEY_MOD5;
+		nModCode |= KEY_MOD3;
 #else
 	if( pEvent->state & Mod1Mask )
-	{
 		nModCode |= KEY_MOD2;
-		if ( !(nModCode & KEY_MOD1) )
-			nModCode |= KEY_CONTROLMOD;
-	}
 #endif
 	if( 	nKeySym == XK_Shift_L 	|| nKeySym == XK_Shift_R
 		|| 	nKeySym == XK_Control_L || nKeySym == XK_Control_R
@@ -3085,17 +3081,17 @@
             case XK_Alt_L:
                 nExtModMask = MODKEY_LMOD2;
 #ifdef MACOSX
-		nModMask = KEY_MOD2 | (pEvent->type==KeyRelease ? KEY_MOD5 : 0 );
+		        nModMask = KEY_MOD2 | (pEvent->type==KeyRelease ? KEY_MOD3 : 0 );
 #else
-                nModMask = KEY_MOD2 | (pEvent->type==KeyRelease ? KEY_CONTROLMOD : 0);
+                nModMask = KEY_MOD2;
 #endif
                 break;
             case XK_Alt_R:
                 nExtModMask = MODKEY_RMOD2;
 #ifdef MACOSX
-		nModMask = KEY_MOD2 | (pEvent->type==KeyRelease ? KEY_MOD5 : 0 );
+		        nModMask = KEY_MOD2 | (pEvent->type==KeyRelease ? KEY_MOD3 : 0 );
 #else
-                nModMask = KEY_MOD2 | (pEvent->type==KeyRelease ? KEY_CONTROLMOD : 0);
+                nModMask = KEY_MOD2;
 #endif
                 break;
             case XK_Shift_L:
@@ -3125,11 +3121,7 @@
 
         // emulate KEY_MENU
         if ( ( (nKeySym == XK_Alt_L) || (nKeySym == XK_Alt_R) ) &&
-#ifdef MACOSX
-	     ( (nModCode & ~(KEY_MOD5|KEY_MOD2)) == 0 ) )
-#else
-             ( (nModCode & ~(KEY_CONTROLMOD|KEY_MOD2)) == 0 ) )
-#endif
+             ( (nModCode & ~(KEY_MOD3|KEY_MOD2)) == 0 ) )
         {
             if( pEvent->type == XLIB_KeyPress )
                 mbKeyMenu = true;
diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m233_src.orig/vcl/win/source/window/salframe.cxx ooo_SRC680_m233_src.aquavcl04/vcl/win/source/window/salframe.cxx
--- ooo_SRC680_m233_src.orig/vcl/win/source/window/salframe.cxx	2007-10-09 17:22:11.000000000 +0200
+++ ooo_SRC680_m233_src.aquavcl04/vcl/win/source/window/salframe.cxx	2007-10-19 16:42:31.000000000 +0200
@@ -3727,12 +3727,7 @@
     if ( GetKeyState( VK_CONTROL ) & 0x8000 )
         nModCode |= KEY_MOD1;
     if ( GetKeyState( VK_MENU ) & 0x8000 )
-    {
         nModCode |= KEY_MOD2;
-        if ( !(nModCode & KEY_MOD1) &&
-             ((nMsg == WM_SYSKEYDOWN) || (nMsg == WM_SYSKEYUP)) )
-            nModCode |= KEY_CONTROLMOD;
-    }
 
     if ( (nMsg == WM_CHAR) || (nMsg == WM_SYSCHAR) )
     {
@@ -3990,11 +3985,7 @@
         if ( GetKeyState( VK_CONTROL ) & 0x8000 )
             nModCode |= KEY_MOD1;
         if ( GetKeyState( VK_MENU ) & 0x8000 )
-        {
             nModCode |= KEY_MOD2;
-            if ( !(nModCode & KEY_MOD1) )
-                nModCode |= KEY_CONTROLMOD;
-        }
 
         if ( (wParam != VK_SHIFT) && (wParam != VK_CONTROL) && (wParam != VK_MENU) )
         {
@@ -4045,8 +4036,6 @@
     if ( GetKeyState( VK_CONTROL ) & 0x8000 )
         nModCode |= KEY_MOD1;
     nModCode |= KEY_MOD2;
-    if ( !(nModCode & KEY_MOD1) )
-        nModCode |= KEY_CONTROLMOD;
 
     // KeyEvent zusammenbauen
     SalKeyEvent aKeyEvt;
@@ -5264,8 +5253,6 @@
                     if ( GetKeyState( VK_CONTROL ) & 0x8000 )
                         nModCode |= KEY_MOD1;
                     nModCode |= KEY_MOD2;
-                    if ( !(nModCode & KEY_MOD1) )
-                        nModCode |= KEY_CONTROLMOD;
 
                     SalKeyEvent aKeyEvt;
                     aKeyEvt.mnTime      = GetMessageTime();
