diff -ur ooo_SRC680_m143_src.orig/sc/inc/address.hxx ooo_SRC680_m143_src/sc/inc/address.hxx
--- ooo_SRC680_m143_src.orig/sc/inc/address.hxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/inc/address.hxx	2005-12-03 21:55:28.000000000 +0100
@@ -81,7 +81,7 @@
 // size_t typedef to be able to find places where code was changed from USHORT
 // to size_t and is used to read/write from/to streams.
 typedef size_t SCSIZE;
-#ifndef MACOSX
+#if !defined( MACOSX ) && !defined( __x86_64__ )
 // resolve ambiguity, TODO: move to tools/solar.h, or even better use ::std::min/max
 inline size_t Min( size_t a, size_t b) { return a<b ? a : b; }
 inline size_t Max( size_t a, size_t b) { return a>b ? a : b; }
diff -ur ooo_SRC680_m143_src.orig/sc/source/core/data/table3.cxx ooo_SRC680_m143_src/sc/source/core/data/table3.cxx
--- ooo_SRC680_m143_src.orig/sc/source/core/data/table3.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/core/data/table3.cxx	2005-12-03 22:02:03.000000000 +0100
@@ -1064,7 +1064,7 @@
                         bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr );
 					else
 					{
-                        ::com::sun::star::uno::Sequence< long > xOff;
+                        ::com::sun::star::uno::Sequence< sal_Int32 > xOff;
                         String aCell( pTransliteration->transliterate(
                             aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(),
                             &xOff ) );
diff -ur ooo_SRC680_m143_src.orig/sc/source/core/tool/chartarr.cxx ooo_SRC680_m143_src/sc/source/core/tool/chartarr.cxx
--- ooo_SRC680_m143_src.orig/sc/source/core/tool/chartarr.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/core/tool/chartarr.cxx	2005-12-03 22:03:01.000000000 +0100
@@ -67,14 +67,14 @@
 	rDest.SetYAxisTitle( rSource.GetYAxisTitle() );
 	rDest.SetZAxisTitle( rSource.GetZAxisTitle() );
 
-	const long* pArr;
+	sal_Int32* pArr;
 	if ( rSource.GetRowCount() == rDest.GetRowCount() &&
 		 rSource.GetColCount() == rDest.GetColCount() )
 	{
 		//	don't copy column/row number formats here (are set in new MemChart object)
 
-		if ( (pArr = rSource.GetRowTranslation()) ) rDest.SetRowTranslation( pArr );
-		if ( (pArr = rSource.GetColTranslation()) ) rDest.SetColTranslation( pArr );
+		if ( (pArr = (sal_Int32 *) rSource.GetRowTranslation()) ) rDest.SetRowTranslation( pArr );
+		if ( (pArr = (sal_Int32 *) rSource.GetColTranslation()) ) rDest.SetColTranslation( pArr );
 		rDest.SetTranslation( rSource.GetTranslation() );
 	}
 }
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/excel/excrecds.cxx ooo_SRC680_m143_src/sc/source/filter/excel/excrecds.cxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/excel/excrecds.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/excel/excrecds.cxx	2005-12-03 22:05:25.000000000 +0100
@@ -440,7 +440,7 @@
 void ExcBundlesheetBase::UpdateStreamPos( XclExpStream& rStrm )
 {
 	rStrm.SetStreamPos( nOwnPos );
-	rStrm << nStrPos;
+	rStrm << (sal_uInt32)nStrPos;
 }
 
 
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/excel/xiescher.cxx ooo_SRC680_m143_src/sc/source/filter/excel/xiescher.cxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/excel/xiescher.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/excel/xiescher.cxx	2005-12-03 22:06:49.000000000 +0100
@@ -1412,7 +1412,7 @@
         // automatic margin is handled by host
         if( GetPropertyBool( DFF_Prop_AutoTextMargin ) )
         {
-            long nMargin = EXC_ESCHER_AUTOMARGIN;
+            sal_Int32 nMargin = EXC_ESCHER_AUTOMARGIN;
             ScaleEmu( nMargin );
             xSdrObj->SetMergedItem( SdrTextLeftDistItem( nMargin ) );
             xSdrObj->SetMergedItem( SdrTextRightDistItem( nMargin ) );
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/excel/xlstyle.cxx ooo_SRC680_m143_src/sc/source/filter/excel/xlstyle.cxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/excel/xlstyle.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/excel/xlstyle.cxx	2005-12-03 22:07:51.000000000 +0100
@@ -329,7 +329,7 @@
 
 void XclFontData::SetScHeight( sal_Int32 nTwips )
 {
-    mnHeight = static_cast< sal_uInt16 >( ::std::min( nTwips, 0x7FFFL ) );
+    mnHeight = static_cast< sal_uInt16 >( ::std::min( nTwips, (sal_Int32)0x7FFF ) );
 }
 
 void XclFontData::SetScFamily( FontFamily eScFamily )
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/html/htmlpars.cxx ooo_SRC680_m143_src/sc/source/filter/html/htmlpars.cxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/html/htmlpars.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/html/htmlpars.cxx	2005-12-03 22:09:12.000000000 +0100
@@ -159,7 +159,7 @@
 }
 
 
-ULONG ScHTMLLayoutParser::Read( SvStream& rStream, const String& rBaseURL )
+sal_uInt32 ScHTMLLayoutParser::Read( SvStream& rStream, const String& rBaseURL )
 {
     Link aOldLink = pEdit->GetImportHdl();
     pEdit->SetImportHdl( LINK( this, ScHTMLLayoutParser, HTMLImportHdl ) );
@@ -188,7 +188,7 @@
         }
     }
 
-    ULONG nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_HTML, pAttributes );
+    sal_uInt32 nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_HTML, pAttributes );
 
     pEdit->SetImportHdl( aOldLink );
     // Spaltenbreiten erzeugen
@@ -2163,10 +2163,10 @@
             switch( aIter->GetToken() )
             {
                 case HTML_O_COLSPAN:
-                    aSpanSize.mnCols = static_cast< SCCOL >( bound( aIter->GetString().ToInt32(), 1L, 256L ) );
+                    aSpanSize.mnCols = static_cast< SCCOL >( bound( aIter->GetString().ToInt32(), (sal_Int32)1, (sal_Int32)256 ) );
                 break;
                 case HTML_O_ROWSPAN:
-                    aSpanSize.mnRows = static_cast< SCROW >( bound( aIter->GetString().ToInt32(), 1L, 256L ) );
+                    aSpanSize.mnRows = static_cast< SCROW >( bound( aIter->GetString().ToInt32(), (sal_Int32)1, (sal_Int32)256 ) );
                 break;
                 case HTML_O_SDVAL:
                     pValStr.reset( new String( aIter->GetString() ) );
@@ -2962,7 +2962,7 @@
             break;
             case HTML_O_SIZE :
             {
-                sal_uInt32 nSize = bound( aIter->GetNumber(), 1UL, SC_HTML_FONTSIZES );
+                sal_uInt32 nSize = bound( aIter->GetNumber(), (sal_uInt32)1, SC_HTML_FONTSIZES );
                 mpCurrTable->PutItem( SvxFontHeightItem( maFontHeights[ nSize - 1 ], 100, ATTR_FONT_HEIGHT ) );
             }
             break;
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/inc/eeparser.hxx ooo_SRC680_m143_src/sc/source/filter/inc/eeparser.hxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/inc/eeparser.hxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/inc/eeparser.hxx	2005-12-03 22:14:13.000000000 +0100
@@ -158,7 +158,7 @@
 						ScEEParser( EditEngine* );
 	virtual				~ScEEParser();
 
-    virtual ULONG       Read( SvStream&, const String& rBaseURL ) = 0;
+	virtual sal_uInt32		Read( SvStream&, const String& rBaseURL ) = 0;
 
 	void				GetDimensions( SCCOL& nCols, SCROW& nRows ) const
 							{ nCols = nColMax; nRows = nRowMax; }
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/inc/htmlpars.hxx ooo_SRC680_m143_src/sc/source/filter/inc/htmlpars.hxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/inc/htmlpars.hxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/inc/htmlpars.hxx	2005-12-03 22:13:46.000000000 +0100
@@ -205,7 +205,7 @@
 public:
                         ScHTMLLayoutParser( EditEngine*, const String& rBaseURL, const Size& aPageSize, ScDocument* );
     virtual             ~ScHTMLLayoutParser();
-    virtual ULONG       Read( SvStream&, const String& rBaseURL  );
+    virtual sal_uInt32       Read( SvStream&, const String& rBaseURL  );
     virtual const ScHTMLTable*  GetGlobalTable() const;
 };
 
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/inc/rtfparse.hxx ooo_SRC680_m143_src/sc/source/filter/inc/rtfparse.hxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/inc/rtfparse.hxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/inc/rtfparse.hxx	2005-12-03 22:15:48.000000000 +0100
@@ -90,7 +90,7 @@
 public:
 						ScRTFParser( EditEngine* );
 	virtual				~ScRTFParser();
-    virtual ULONG       Read( SvStream&, const String& rBaseURL );
+	virtual sal_uInt32		Read( SvStream&, const String& rBaseURL );
 };
 
 
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/rtf/eeimpars.cxx ooo_SRC680_m143_src/sc/source/filter/rtf/eeimpars.cxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/rtf/eeimpars.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/rtf/eeimpars.cxx	2005-12-03 22:15:15.000000000 +0100
@@ -226,7 +226,7 @@
 			// HTML
 			String aValStr, aNumStr;
 			double fVal;
-			ULONG nNumForm;
+			sal_uInt32 nNumForm;
 			LanguageType eNumLang;
 			if ( pE->pNumStr )
 			{	// SDNUM muss sein wenn SDVAL
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/rtf/rtfparse.cxx ooo_SRC680_m143_src/sc/source/filter/rtf/rtfparse.cxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/rtf/rtfparse.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/rtf/rtfparse.cxx	2005-12-03 22:16:42.000000000 +0100
@@ -93,11 +93,11 @@
 }
 
 
-ULONG ScRTFParser::Read( SvStream& rStream, const String& rBaseURL )
+sal_uInt32 ScRTFParser::Read( SvStream& rStream, const String& rBaseURL )
 {
 	Link aOldLink = pEdit->GetImportHdl();
 	pEdit->SetImportHdl( LINK( this, ScRTFParser, RTFImportHdl ) );
-    ULONG nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_RTF );
+	sal_uInt32 nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_RTF );
 	if ( nLastToken == RTF_PAR )
 	{
 		ScEEParseEntry* pE = pList->Last();
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/xcl97/XclImpChangeTrack.cxx ooo_SRC680_m143_src/sc/source/filter/xcl97/XclImpChangeTrack.cxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/xcl97/XclImpChangeTrack.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/xcl97/XclImpChangeTrack.cxx	2005-12-03 22:17:40.000000000 +0100
@@ -143,7 +143,7 @@
 
 void XclImpChangeTrack::DoDeleteRange( const ScRange& rRange )
 {
-	sal_uInt32 nFirst, nLast;
+	ULONG nFirst, nLast;
 	pChangeTrack->AppendDeleteRange( rRange, NULL, nFirst, nLast );
 	DoAcceptRejectAction( nFirst, nLast );
 }
diff -ur ooo_SRC680_m143_src.orig/sc/source/filter/xcl97/xcl97rec.cxx ooo_SRC680_m143_src/sc/source/filter/xcl97/xcl97rec.cxx
--- ooo_SRC680_m143_src.orig/sc/source/filter/xcl97/xcl97rec.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/filter/xcl97/xcl97rec.cxx	2005-12-03 22:17:40.000000000 +0100
@@ -258,7 +258,7 @@
 
 // --- class XclMsodrawing --------------------------------------
 
-XclMsodrawing::XclMsodrawing( const XclExpRoot& rRoot, UINT16 nEscherType, UINT32 nInitialSize ) :
+XclMsodrawing::XclMsodrawing( const XclExpRoot& rRoot, UINT16 nEscherType, ULONG nInitialSize ) :
     XclMsodrawing_Base( *rRoot.GetOldRoot().pEscher, nInitialSize )
 {
 	if ( nEscherType )
@@ -564,7 +564,7 @@
 	pEx->OpenContainer( ESCHER_SpContainer );
 	pEx->AddShape( ESCHER_ShpInst_TextBox, SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_HAVESPT );
     sal_uInt32 nFlags = 0x000A0000;
-    ::set_flag( nFlags, 2UL, !bVisible );
+    ::set_flag( nFlags, (sal_uInt32)2, !bVisible );
     aPropOpt.AddOpt( ESCHER_Prop_fPrint, nFlags );                  // bool field
 	aPropOpt.Commit( pEx->GetStream() );
 
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/Accessibility/AccessibleCsvControl.cxx ooo_SRC680_m143_src/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/Accessibility/AccessibleCsvControl.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/Accessibility/AccessibleCsvControl.cxx	2005-12-03 22:18:28.000000000 +0100
@@ -381,7 +381,7 @@
         nApiPos += nStart - nExp + 1;
         nExp *= 10;
     }
-    return ::std::max( nApiPos, 0L );
+    return ::std::max( nApiPos, (sal_Int32)0 );
 }
 
 /** Converts an API text index to a ruler cursor position. */
@@ -600,7 +600,7 @@
     ensureAlive();
     ScCsvRuler& rRuler = implGetRuler();
     // #107054# use object's coordinate system, convert to API position
-    return lcl_GetApiPos( ::std::min( ::std::max( rRuler.GetPosFromX( rPoint.X ), 0L ), rRuler.GetPosCount() ) );
+    return lcl_GetApiPos( ::std::min( ::std::max( rRuler.GetPosFromX( rPoint.X ), (sal_Int32)0 ), rRuler.GetPosCount() ) );
 }
 
 OUString SAL_CALL ScAccessibleCsvRuler::getSelectedText() throw( RuntimeException )
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/dbgui/csvgrid.cxx ooo_SRC680_m143_src/sc/source/ui/dbgui/csvgrid.cxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/dbgui/csvgrid.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/dbgui/csvgrid.cxx	2005-12-03 22:29:32.000000000 +0100
@@ -153,7 +153,7 @@
     sal_Int32 nLastLine = GetLastVisLine() + 1;
     sal_Int32 nDigits = 2;
     while( nLastLine /= 10 ) ++nDigits;
-    nDigits = Max( nDigits, 3L );
+    nDigits = Max( nDigits, (sal_Int32)3 );
     Execute( CSVCMD_SETHDRWIDTH, GetTextWidth( String( '0' ) ) * nDigits );
 }
 
@@ -678,8 +678,8 @@
     {
         sal_Int32 nPosBeg = GetColumnPos( nColIndex );
         sal_Int32 nPosEnd = GetColumnPos( nColIndex + 1 );
-        sal_Int32 nMinPos = Max( nPosBeg - CSV_SCROLL_DIST, 0L );
-        sal_Int32 nMaxPos = Min( nPosEnd - GetVisPosCount() + CSV_SCROLL_DIST + 1L, nMinPos );
+        sal_Int32 nMinPos = Max( nPosBeg - CSV_SCROLL_DIST, (sal_Int32)0 );
+        sal_Int32 nMaxPos = Min( nPosEnd - GetVisPosCount() + CSV_SCROLL_DIST + (sal_Int32)1, nMinPos );
         if( nPosBeg - CSV_SCROLL_DIST + 1 <= GetFirstVisPos() )
             Execute( CSVCMD_SETPOSOFFSET, nMinPos );
         else if( nPosEnd + CSV_SCROLL_DIST >= GetLastVisPos() )
@@ -761,7 +761,7 @@
         pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep );
 
         // update column width
-        sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + 1L );
+        sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + (sal_Int32)1 );
         if( IsValidColumn( nColIx ) )
         {
             // expand existing column
@@ -892,7 +892,7 @@
 
         sal_Int32 nPos = (rMEvt.GetPosPixel().X() - GetFirstX()) / GetCharWidth() + GetFirstVisPos();
         // on mouse tracking: keep position valid
-        nPos = Max( Min( nPos, GetPosCount() - 1L ), 0L );
+        nPos = Max( Min( nPos, GetPosCount() - (sal_Int32)1 ), (sal_Int32)0 );
         Execute( CSVCMD_MAKEPOSVISIBLE, nPos );
 
         sal_uInt32 nColIx = GetColumnFromPos( nPos );
@@ -1340,7 +1340,7 @@
     if( HasFocus() && IsVisibleColumn( nColIndex ) )
     {
         sal_Int32 nX1 = Max( GetColumnX( nColIndex ), GetFirstX() ) + 1;
-        sal_Int32 nX2 = Min( GetColumnX( nColIndex + 1 ) - 1L, GetLastX() );
+        sal_Int32 nX2 = Min( GetColumnX( nColIndex + 1 ) - (sal_Int32)1, GetLastX() );
         sal_Int32 nY2 = Min( GetY( GetLastVisLine() + 1 ), GetHeight() ) - 1;
         InvertTracking( Rectangle( nX1, 0, nX2, nY2 ), SHOWTRACK_SMALL | SHOWTRACK_WINDOW );
     }
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/dbgui/csvruler.cxx ooo_SRC680_m143_src/sc/source/ui/dbgui/csvruler.cxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/dbgui/csvruler.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/dbgui/csvruler.cxx	2005-12-03 22:29:57.000000000 +0100
@@ -205,7 +205,7 @@
         else if( nNewPos > GetLastVisPos() - CSV_SCROLL_DIST - 1L )
         {
             sal_Int32 nScroll = (GetFirstVisPos() < GetMaxPosOffset()) ? CSV_SCROLL_DIST : 0;
-            nNewPos = Min( nNewPos, GetLastVisPos() - nScroll - 1L );
+            nNewPos = Min( nNewPos, GetLastVisPos() - nScroll - (sal_Int32)1 );
         }
     }
     return nNewPos;
@@ -348,7 +348,7 @@
         if( IsTracking() )
         {
             // on mouse tracking: keep position valid
-            nPos = Max( Min( nPos, GetPosCount() - 1L ), 1L );
+            nPos = Max( Min( nPos, GetPosCount() - (sal_Int32)1 ), (sal_Int32)1 );
             MoveMouseTracking( nPos );
         }
         else
@@ -487,7 +487,7 @@
 
     aRect = maActiveRect;
     aRect.Left() = Max( GetFirstX(), nPosX );
-    aRect.Right() = Min( Min( GetX( GetPosCount() ), GetLastX() ), nPosX + nWidth - 1L );
+    aRect.Right() = Min( Min( GetX( GetPosCount() ), GetLastX() ), nPosX + nWidth - (sal_Int32)1 );
     if( aRect.Left() <= aRect.Right() )
     {
         maBackgrDev.SetFillColor( maActiveColor );
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/dbgui/csvtablebox.cxx ooo_SRC680_m143_src/sc/source/ui/dbgui/csvtablebox.cxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/dbgui/csvtablebox.cxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/dbgui/csvtablebox.cxx	2005-12-03 22:29:57.000000000 +0100
@@ -383,33 +383,33 @@
     switch( eType )
     {
         case CSVCMD_SETPOSCOUNT:
-            maData.mnPosCount = Max( nParam1, 1L );
+            maData.mnPosCount = Max( nParam1, (sal_Int32)1 );
             ImplSetPosOffset( GetFirstVisPos() );
         break;
         case CSVCMD_SETPOSOFFSET:
             ImplSetPosOffset( nParam1 );
         break;
         case CSVCMD_SETHDRWIDTH:
-            maData.mnHdrWidth = Max( nParam1, 0L );
+            maData.mnHdrWidth = Max( nParam1, (sal_Int32)0 );
             ImplSetPosOffset( GetFirstVisPos() );
         break;
         case CSVCMD_SETCHARWIDTH:
-            maData.mnCharWidth = Max( nParam1, 1L );
+            maData.mnCharWidth = Max( nParam1, (sal_Int32)1 );
             ImplSetPosOffset( GetFirstVisPos() );
         break;
         case CSVCMD_SETLINECOUNT:
-            maData.mnLineCount = Max( nParam1, 1L );
+            maData.mnLineCount = Max( nParam1, (sal_Int32)1 );
             ImplSetLineOffset( GetFirstVisLine() );
         break;
         case CSVCMD_SETLINEOFFSET:
             ImplSetLineOffset( nParam1 );
         break;
         case CSVCMD_SETHDRHEIGHT:
-            maData.mnHdrHeight = Max( nParam1, 0L );
+            maData.mnHdrHeight = Max( nParam1, (sal_Int32)0 );
             ImplSetLineOffset( GetFirstVisLine() );
         break;
         case CSVCMD_SETLINEHEIGHT:
-            maData.mnLineHeight = Max( nParam1, 1L );
+            maData.mnLineHeight = Max( nParam1, (sal_Int32)1 );
             ImplSetLineOffset( GetFirstVisLine() );
         break;
         case CSVCMD_MOVERULERCURSOR:
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/inc/csvtablebox.hxx ooo_SRC680_m143_src/sc/source/ui/inc/csvtablebox.hxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/inc/csvtablebox.hxx	2005-12-03 21:49:53.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/inc/csvtablebox.hxx	2005-12-03 22:27:58.000000000 +0100
@@ -117,10 +117,10 @@
 
     /** Calculates and sets valid position offset nearest to nPos. */
     SC_DLLPRIVATE inline void                 ImplSetPosOffset( sal_Int32 nPos )
-                                    { maData.mnPosOffset = Max( Min( nPos, GetMaxPosOffset() ), 0L ); }
+                                    { maData.mnPosOffset = Max( Min( nPos, GetMaxPosOffset() ), (sal_Int32)0 ); }
     /** Calculates and sets valid line offset nearest to nLine. */
     SC_DLLPRIVATE inline void                 ImplSetLineOffset( sal_Int32 nLine )
-                                    { maData.mnLineOffset = Max( Min( nLine, GetMaxLineOffset() ), 0L ); }
+                                    { maData.mnLineOffset = Max( Min( nLine, GetMaxLineOffset() ), (sal_Int32)0 ); }
     /** Moves controls (not cursors!) so that nPos becomes visible. */
     SC_DLLPRIVATE void                        MakePosVisible( sal_Int32 nPos );
 
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/inc/viewdata.hxx ooo_SRC680_m143_src/sc/source/ui/inc/viewdata.hxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/inc/viewdata.hxx	2005-12-03 21:49:54.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/inc/viewdata.hxx	2005-12-03 22:19:41.000000000 +0100
@@ -324,7 +324,7 @@
 	BYTE			GetFillMode()				{ return nFillMode; }
 
 					// TRUE: Zelle ist zusammengefasst
-	BOOL			GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix );
+	BOOL			GetMergeSizePixel( SCCOL nX, SCROW nY, sal_Int32& rSizeXPix, sal_Int32& rSizeYPix );
 	BOOL			GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
 										SCsCOL& rPosX, SCsROW& rPosY,
 										BOOL bTestMerge = TRUE, BOOL bRepair = FALSE,
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/view/gridwin.cxx ooo_SRC680_m143_src/sc/source/ui/view/gridwin.cxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/view/gridwin.cxx	2005-12-03 21:49:54.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/view/gridwin.cxx	2005-12-03 22:35:57.000000000 +0100
@@ -583,8 +583,8 @@
 	SCTAB nTab = pViewData->GetTabNo();
 	BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab );
 
-	long nSizeX  = 0;
-	long nSizeY  = 0;
+	sal_Int32 nSizeX  = 0;
+	sal_Int32 nSizeY  = 0;
 	long nHeight = 0;
 	pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
 	Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich );
@@ -738,8 +738,8 @@
 	SCTAB nTab = pViewData->GetTabNo();
 	BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab );
 
-	long nSizeX  = 0;
-	long nSizeY  = 0;
+	sal_Int32 nSizeX  = 0;
+	sal_Int32 nSizeY  = 0;
 	long nHeight = 0;
 	pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
 	Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich );
@@ -881,8 +881,8 @@
 	SCTAB nTab = pViewData->GetTabNo();
 	BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab );
 
-	long nSizeX  = 0;
-	long nSizeY  = 0;
+	sal_Int32 nSizeX  = 0;
+	sal_Int32 nSizeY  = 0;
 	long nHeight = 0;
 	pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
 	Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich );
@@ -1429,8 +1429,8 @@
 				SCROW nY = aMarkRange.aEnd.Row();
 
 				Point aFillPos = pViewData->GetScrPos( nX, nY, eWhich, TRUE );
-				long nSizeXPix;
-				long nSizeYPix;
+				sal_Int32 nSizeXPix;
+				sal_Int32 nSizeYPix;
 				pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
 				aFillPos.X() += nSizeXPix * nLayoutSign;
 				aFillPos.Y() += nSizeYPix;
@@ -1733,8 +1733,8 @@
 		if (pAttr->HasAutoFilter())
 		{
 			Point	aScrPos  = pViewData->GetScrPos(nPosX,nPosY,eWhich);
-			long	nSizeX;
-			long	nSizeY;
+			sal_Int32	nSizeX;
+			sal_Int32	nSizeY;
 			Point	aDiffPix = aPos;
 
 			aDiffPix -= aScrPos;
@@ -1746,8 +1746,8 @@
 
 			//	Breite des Buttons ist nicht von der Zellhoehe abhaengig
 			Size aButSize = aComboButton.GetSizePixel();
-			long nButWidth  = Min( aButSize.Width(),  nSizeX );
-			long nButHeight = Min( aButSize.Height(), nSizeY );
+			long nButWidth  = Min( (sal_Int32)aButSize.Width(),  nSizeX );
+			long nButHeight = Min( (sal_Int32)aButSize.Height(), nSizeY );
 
 			if ( aDiffPix.X() >= nSizeX - nButWidth &&
 				 aDiffPix.Y() >= nSizeY - nButHeight )
@@ -2841,8 +2841,8 @@
 			SCCOL nCurX = pViewData->GetCurX();
 			SCROW nCurY = pViewData->GetCurY();
 			aMenuPos = pViewData->GetScrPos( nCurX, nCurY, eWhich, TRUE );
-			long nSizeXPix;
-			long nSizeYPix;
+			sal_Int32 nSizeXPix;
+			sal_Int32 nSizeYPix;
 			pViewData->GetMergeSizePixel( nCurX, nCurY, nSizeXPix, nSizeYPix );
 			aMenuPos.X() += nSizeXPix;
 			aMenuPos.Y() += nSizeYPix;
@@ -4106,8 +4106,8 @@
 			SCROW nY = pViewData->GetCurY();
 
 			Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich );
-			long nSizeXPix;
-			long nSizeYPix;
+			sal_Int32 nSizeXPix;
+			sal_Int32 nSizeYPix;
 			pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
 			aScrPos.X() -= 2;
 			aScrPos.Y() -= 2;
@@ -4143,8 +4143,8 @@
 					SCCOL nAutoX = aAutoMarkPos.Col();
 					SCROW nAutoY = aAutoMarkPos.Row();
 					Point aFillPos = pViewData->GetScrPos( nAutoX, nAutoY, eWhich, TRUE );
-					long nSizeXPix;
-					long nSizeYPix;
+					sal_Int32 nSizeXPix;
+					sal_Int32 nSizeYPix;
 					pViewData->GetMergeSizePixel( nAutoX, nAutoY, nSizeXPix, nSizeYPix );
 					aFillPos.X() += nSizeXPix;
 					aFillPos.Y() += nSizeYPix;
@@ -4252,8 +4252,8 @@
 //			Point aNext = pViewData->GetScrPos( nPosX+1, nPosY+1, eWhich );
 
 			Point aNext = pViewData->GetScrPos( nPosX, nPosY, eWhich, TRUE );
-			long nSizeXPix;
-			long nSizeYPix;
+			sal_Int32 nSizeXPix;
+			sal_Int32 nSizeYPix;
 			pViewData->GetMergeSizePixel( nPosX, nPosY, nSizeXPix, nSizeYPix );
 			aNext.X() += nSizeXPix * nLayoutSign;
 			aNext.Y() += nSizeYPix;
@@ -4656,8 +4656,8 @@
     Size aPaperSize = Size( 1000000, 1000000 );
     if(pCell->GetCellType() == CELLTYPE_FORMULA)
     {
-        long nSizeX  = 0;
-        long nSizeY  = 0;
+        sal_Int32 nSizeX  = 0;
+        sal_Int32 nSizeY  = 0;
         pViewData->GetMergeSizePixel( nPosX, nPosY, nSizeX, nSizeY );
         aPaperSize = Size(nSizeX, nSizeY );
         aPaperSize = PixelToLogic(aPaperSize);
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/view/gridwin4.cxx ooo_SRC680_m143_src/sc/source/ui/view/gridwin4.cxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/view/gridwin4.cxx	2005-12-03 21:49:54.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/view/gridwin4.cxx	2005-12-03 22:35:57.000000000 +0100
@@ -1241,8 +1241,8 @@
 						}
 
                     bool bArrowState = bSimpleQuery && bColumnFound;
-					long	nSizeX;
-					long	nSizeY;
+					sal_Int32	nSizeX;
+					sal_Int32	nSizeY;
 
 					pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
 					aComboButton.SetOptSizePixel();
@@ -1265,8 +1265,8 @@
 				if ( pInfo->bPushButton && !pInfo->bHOverlapped && !pInfo->bVOverlapped )
 				{
 					Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich );
-					long nSizeX;
-					long nSizeY;
+					sal_Int32 nSizeX;
+					sal_Int32 nSizeY;
 					pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
 					long nPosX = aScrPos.X();
 					long nPosY = aScrPos.Y();
@@ -1317,8 +1317,8 @@
     SCCOL nCol = rButtonPos.Col();
     SCROW nRow = rButtonPos.Row();
 
-    long nCellSizeX;    // width of this cell, including merged
-    long nDummy;
+    sal_Int32 nCellSizeX;    // width of this cell, including merged
+    sal_Int32 nDummy;
     pViewData->GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy );
 
     // for height, only the cell's row is used, excluding merged cells
@@ -1737,8 +1737,8 @@
 		}
 		if ( bMaybeVisible )
 		{
-			long nSizeXPix;
-			long nSizeYPix;
+			sal_Int32 nSizeXPix;
+			sal_Int32 nSizeYPix;
 			pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
 
 			if ( bLayoutRTL )
@@ -1785,8 +1785,8 @@
 		BOOL bLayoutRTL = pDoc->IsLayoutRTL( nTab );
 
 		Point aFillPos = pViewData->GetScrPos( nX, nY, eWhich, TRUE );
-		long nSizeXPix;
-		long nSizeYPix;
+		sal_Int32 nSizeXPix;
+		sal_Int32 nSizeYPix;
 		pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
 		if ( bLayoutRTL )
 			aFillPos.X() -= nSizeXPix + 3;
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/view/tabview3.cxx ooo_SRC680_m143_src/sc/source/ui/view/tabview3.cxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/view/tabview3.cxx	2005-12-03 21:49:54.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/view/tabview3.cxx	2005-12-03 22:35:57.000000000 +0100
@@ -564,8 +564,8 @@
 				 aPos.X() < aWinSize.Width() && aPos.Y() < aWinSize.Height() )
 			{
 				aPos += pWin->GetPosPixel();								// Position auf Frame
-				long nSizeXPix;
-				long nSizeYPix;
+				sal_Int32 nSizeXPix;
+				sal_Int32 nSizeYPix;
 				aViewData.GetMergeSizePixel( nCol, nRow, nSizeXPix, nSizeYPix );
 
 				// HintWindow anlegen, bestimmt seine Groesse selbst
@@ -711,8 +711,8 @@
 		SCsCOL nSizeX = (SCsCOL) aViewData.VisibleCellsX(eAlignX);
 		SCsROW nSizeY = (SCsROW) aViewData.VisibleCellsY(eAlignY);
 
-		long nCellSizeX;
-		long nCellSizeY;
+		sal_Int32 nCellSizeX;
+		sal_Int32 nCellSizeY;
 		if ( nCurX >= 0 && nCurY >= 0 )
 			aViewData.GetMergeSizePixel( (SCCOL)nCurX, (SCROW)nCurY, nCellSizeX, nCellSizeY );
 		else
@@ -755,7 +755,7 @@
 						{
 							//	Cursor ist auf dem Bildschirm
 							Point aStart = aViewData.GetScrPos( nCurX, nCurY, eAlign );
-							long nCSX, nCSY;
+							sal_Int32 nCSX, nCSY;
 							aViewData.GetMergeSizePixel( nCurX, nCurY, nCSX, nCSY );
 							Rectangle aCursor( aStart, Size( nCSX, nCSY ) );
 							if ( aCursor.IsOver( aDlgPixel ) )
diff -ur ooo_SRC680_m143_src.orig/sc/source/ui/view/viewdata.cxx ooo_SRC680_m143_src/sc/source/ui/view/viewdata.cxx
--- ooo_SRC680_m143_src.orig/sc/source/ui/view/viewdata.cxx	2005-12-03 21:49:54.000000000 +0100
+++ ooo_SRC680_m143_src/sc/source/ui/view/viewdata.cxx	2005-12-03 22:34:38.000000000 +0100
@@ -1611,7 +1611,7 @@
 	return CellsAtY( MAXROW+1, -1, eWhichY, SC_SIZE_NONE );
 }
 
-BOOL ScViewData::GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix )
+BOOL ScViewData::GetMergeSizePixel( SCCOL nX, SCROW nY, sal_Int32& rSizeXPix, sal_Int32& rSizeYPix )
 {
 	const ScMergeAttr* pMerge = (const ScMergeAttr*) pDoc->GetAttr( nX,nY,nTabNo, ATTR_MERGE );
 	if ( pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1 )
@@ -1763,8 +1763,8 @@
 	long nLayoutSign = bLayoutRTL ? -1 : 1;
 
 	Point aCellStart = GetScrPos( nPosX, nPosY, eWhich, TRUE );
-	long nSizeX;
-	long nSizeY;
+	sal_Int32 nSizeX;
+	sal_Int32 nSizeY;
 	GetMergeSizePixel( nPosX, nPosY, nSizeX, nSizeY );
 	rLeft = ( rClickPos.X() - aCellStart.X() ) * nLayoutSign <= nSizeX / 2;
 	rTop  = rClickPos.Y() - aCellStart.Y() <= nSizeY / 2;
