incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1200700 [2/2] - in /incubator/ooo/trunk/main/vcl: ./ inc/ inc/os2/ inc/vcl/ os2/inc/ os2/source/app/ os2/source/gdi/ os2/source/src/ os2/source/window/ source/window/ workben/
Date Fri, 11 Nov 2011 02:37:06 GMT
Modified: incubator/ooo/trunk/main/vcl/os2/source/gdi/salgdi3.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/gdi/salgdi3.cxx?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/gdi/salgdi3.cxx (original)
+++ incubator/ooo/trunk/main/vcl/os2/source/gdi/salgdi3.cxx Fri Nov 11 02:37:05 2011
@@ -26,44 +26,43 @@
 #define INCL_DOS
 
 #include <string.h>
-#include <stdlib.h>
-#include <math.h>
+//#include <stdlib.h>
+//#include <math.h>
 #include <svpm.h>
 
-#define _SV_SALGDI3_CXX
-#include <tools/svwin.h>
-#include <rtl/tencinfo.h>
-#ifndef _OSL_FILE_HXX
-#include <osl/file.hxx>
-#endif
-#ifndef _OSL_THREAD_HXX
-#include <osl/thread.hxx>
-#endif
-#ifndef _OSL_PROCESS_HXX
-#include <osl/process.h>
-#endif
-#include <vcl/svapp.hxx>
-#include <saldata.hxx>
-#include <salgdi.h>
-#include <vcl/font.hxx>
-#include <vcl/sallayout.hxx>
-#include <tools/poly.hxx>
-#include <tools/debug.hxx>
-#include <rtl/textcvt.h>
-#include <tools/debug.hxx>
-#include <saldata.hxx>
-#include <salgdi.h>
-#ifndef _SV_OUTFONT_HXX
-#include <vcl/outfont.hxx>
-#endif
-#include <sallayout.h>
-#include <tools/poly.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/sysdata.hxx>
+#include "tools/svwin.h"
+
+#include "os2/saldata.hxx"
+#include "os2/salgdi.h"
+
+#include "vcl/svapp.hxx"
+#include "outfont.hxx"
+#include "vcl/font.hxx"
+#include "fontsubset.hxx"
+#include "sallayout.hxx"
+
+#include "rtl/logfile.hxx"
+#include "rtl/tencinfo.h"
+#include "rtl/textcvt.h"
+#include "rtl/bootstrap.hxx"
+
+
+#include "osl/module.h"
+#include "osl/file.hxx"
+#include "osl/thread.hxx"
+#include "osl/process.h"
+
+#include "tools/poly.hxx"
+#include "tools/debug.hxx"
+#include "tools/stream.hxx"
+
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/polygon/b2dpolypolygon.hxx"
+#include "basegfx/matrix/b2dhommatrix.hxx"
 
 #ifndef __H_FT2LIB
-#include <wingdi.h>
+#include <os2/wingdi.h>
 #include <ft2lib.h>
 #endif
 
@@ -181,7 +180,7 @@ static CharSet ImplCharSetToSal( USHORT 
 
 // -----------------------------------------------------------------------
 
-static FontFamily ImplFamilyToSal( BYTE bFamilyType )
+static FontFamily ImplFamilyToSal( PM_BYTE bFamilyType )
 {
     switch ( bFamilyType )
     {
@@ -260,7 +259,7 @@ static UniString ImpStyleNameToSal( cons
 
 // -----------------------------------------------------------------------
 
-inline FontPitch ImplLogPitchToSal( BYTE fsType )
+inline FontPitch ImplLogPitchToSal( PM_BYTE fsType )
 {
     if ( fsType & FM_TYPE_FIXED )
         return PITCH_FIXED;
@@ -270,7 +269,7 @@ inline FontPitch ImplLogPitchToSal( BYTE
 
 // -----------------------------------------------------------------------
 
-inline BYTE ImplPitchToWin( FontPitch ePitch )
+inline PM_BYTE ImplPitchToWin( FontPitch ePitch )
 {
     if ( ePitch == PITCH_FIXED )
         return FM_TYPE_FIXED;
@@ -342,9 +341,6 @@ static ImplDevFontAttributes Os2Font2Dev
             aDFA.mnQuality += 500;
     }    
 
-    aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
-    aDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
-
     // TODO: add alias names
 
     return aDFA;
@@ -352,12 +348,76 @@ static ImplDevFontAttributes Os2Font2Dev
 
 // =======================================================================
 
+// raw font data with a scoped lifetime
+class RawFontData
+{
+public:
+    explicit	RawFontData( HDC, DWORD nTableTag=0 );
+    			~RawFontData() { delete[] mpRawBytes; }
+    const unsigned char*	get() const { return mpRawBytes; }
+    const unsigned char*	steal() { unsigned char* p = mpRawBytes; mpRawBytes = NULL; return p; }
+    const int				size() const { return mnByteCount; }
+
+private:
+    unsigned char*	mpRawBytes;
+    int				mnByteCount;
+};
+
+RawFontData::RawFontData( HPS hPS, DWORD nTableTag )
+:	mpRawBytes( NULL )
+,	mnByteCount( 0 )
+{
+	// get required size in bytes
+    mnByteCount = ::Ft2GetFontData( hPS, nTableTag, 0, NULL, 0 );
+    if( mnByteCount == FT2_ERROR )
+        return;
+    else if( !mnByteCount )
+        return;
+
+	// allocate the array
+    mpRawBytes = new unsigned char[ mnByteCount ];
+
+	// get raw data in chunks small enough for GetFontData()
+	int nRawDataOfs = 0;
+	DWORD nMaxChunkSize = 0x100000;
+	for(;;)
+	{
+		// calculate remaining raw data to get
+		DWORD nFDGet = mnByteCount - nRawDataOfs;
+		if( nFDGet <= 0 )
+			break;
+		// #i56745# limit GetFontData requests
+		if( nFDGet > nMaxChunkSize )
+			nFDGet = nMaxChunkSize;
+		const DWORD nFDGot = ::Ft2GetFontData( hPS, nTableTag, nRawDataOfs,
+			(void*)(mpRawBytes + nRawDataOfs), nFDGet );
+		if( !nFDGot )
+			break;
+		else if( nFDGot != FT2_ERROR )
+			nRawDataOfs += nFDGot;
+		else
+		{
+			// was the chunk too big? reduce it
+			nMaxChunkSize /= 2;
+			if( nMaxChunkSize < 0x10000 )
+				break;
+		}
+	}
+
+	// cleanup if the raw data is incomplete
+	if( nRawDataOfs != mnByteCount )
+	{
+		delete[] mpRawBytes;
+		mpRawBytes = NULL;
+	}
+}
+
 // -----------------------------------------------------------------------
 
 // =======================================================================
 
 ImplOs2FontData::ImplOs2FontData( PFONTMETRICS _pFontMetric,
-    int nHeight, BYTE nPitchAndFamily )
+    int nHeight, PM_BYTE nPitchAndFamily )
 :	ImplFontData( Os2Font2DevFontAttributes(_pFontMetric), 0 ),
     pFontMetric( _pFontMetric ),
 	meOs2CharSet( _pFontMetric->usCodePage),
@@ -412,7 +472,6 @@ void ImplOs2FontData::UpdateFromHPS( HPS
 
 // -----------------------------------------------------------------------
 
-#ifdef GNG_VERT_HACK
 bool ImplOs2FontData::HasGSUBstitutions( HPS hPS ) const
 {
     if( !mbGsubRead )
@@ -426,12 +485,12 @@ bool ImplOs2FontData::IsGSUBstituted( sa
 {
     return( maGsubTable.find( cChar ) != maGsubTable.end() );
 }
-#endif // GNG_VERT_HACK
 
 // -----------------------------------------------------------------------
 
 const ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() const
 {
+    mpUnicodeMap->AddReference();
     return mpUnicodeMap;
 }
 
@@ -458,21 +517,22 @@ void ImplOs2FontData::ReadOs2Table( HPS 
         // to have access to the needed struct members.
         sal_uInt32 ulUnicodeRange1 = GetUInt( pOS2map + 42 );
         sal_uInt32 ulUnicodeRange2 = GetUInt( pOS2map + 46 );
+#if 0
         sal_uInt32 ulUnicodeRange3 = GetUInt( pOS2map + 50 );
         sal_uInt32 ulUnicodeRange4 = GetUInt( pOS2map + 54 );
+#endif
 
         // Check for CJK capabilities of the current font
-        mbHasCJKSupport = (ulUnicodeRange2 & 0x2fff0000)
-                        | (ulUnicodeRange3 & 0x00000001);
+        mbHasCJKSupport = (ulUnicodeRange2 & 0x2DF00000);
         mbHasKoreanRange= (ulUnicodeRange1 & 0x10000000)
                         | (ulUnicodeRange2 & 0x01100000);
+        mbHasArabicSupport = (ulUnicodeRange1 & 0x00002000);
     }
 }
 
 
 // -----------------------------------------------------------------------
 
-#ifdef GNG_VERT_HACK
 void ImplOs2FontData::ReadGsubTable( HPS hPS ) const
 {
     mbGsubRead = true;
@@ -483,47 +543,21 @@ void ImplOs2FontData::ReadGsubTable( HPS
     if( (nRC == FT2_ERROR) || !nRC )
         return;
 
-    // TODO: directly read the GSUB table instead of going through sft
+    // parse the GSUB table through sft
+    // TODO: parse it directly
 
-    // get raw font file data
-    DWORD nFontSize = Ft2GetFontData( hPS, 0, 0, NULL, 0 );
-    if( nFontSize == FT2_ERROR )
-        return;
-    std::vector<char> aRawFont( nFontSize+1 );
-    aRawFont[ nFontSize ] = 0;
-    DWORD nFontSize2 = Ft2GetFontData( hPS, 0, 0, (void*)&aRawFont[0], nFontSize );
-    if( nFontSize != nFontSize2 )
-        return;
+    // sft needs the full font file data => get it
+    const RawFontData aRawFontData( hPS );
+    if( !aRawFontData.get() )
+    	return;
 
     // open font file
     sal_uInt32 nFaceNum = 0;
-    if( !aRawFont[0] )  // TTC candidate
+    if( !*aRawFontData.get() )  // TTC candidate
         nFaceNum = ~0U;  // indicate "TTC font extracts only"
 
     TrueTypeFont* pTTFont = NULL;
-    ::OpenTTFontBuffer( &aRawFont[0], nFontSize, nFaceNum, &pTTFont );
-    if( !pTTFont )
-        return;
-
-    // add vertically substituted characters to list
-    static const sal_Unicode aGSUBCandidates[] = {
-        0x0020, 0x0080, // ASCII
-        0x2000, 0x2600, // misc
-        0x3000, 0x3100, // CJK punctutation
-        0x3300, 0x3400, // squared words
-        0xFF00, 0xFFF0, // halfwidth|fullwidth forms
-    0 };
-
-    for( const sal_Unicode* pPair = aGSUBCandidates; *pPair; pPair += 2 )
-        for( sal_Unicode cChar = pPair[0]; cChar < pPair[1]; ++cChar )
-            if( ::MapChar( pTTFont, cChar, 0 ) != ::MapChar( pTTFont, cChar, 1 ) )
-                maGsubTable.insert( cChar ); // insert GSUBbed unicodes
-
-    CloseTTFont( pTTFont );
-
-#if 0
-    TrueTypeFont* pTTFont = NULL;
-    ::OpenTTFont( &aRawFont[0], nFontSize, nFaceNum, &pTTFont );
+    ::OpenTTFontBuffer( (void*)aRawFontData.get(), aRawFontData.size(), nFaceNum, &pTTFont );
     if( !pTTFont )
         return;
 
@@ -542,52 +576,31 @@ void ImplOs2FontData::ReadGsubTable( HPS
                 maGsubTable.insert( cChar ); // insert GSUBbed unicodes
 
     CloseTTFont( pTTFont );
-#endif
 }
-#endif // GNG_VERT_HACK
 
 // -----------------------------------------------------------------------
 
 void ImplOs2FontData::ReadCmapTable( HPS hPS ) const
 {
-    CmapResult aResult;
-    aResult.mnPairCount = 0;
-    aResult.mbSymbolic  = (meOs2CharSet == SYMBOL_CHARSET);
-    aResult.mbRecoded   = true;
+    if( mpUnicodeMap != NULL )
+        return;
 
+    bool bIsSymbolFont = (meOs2CharSet == SYMBOL_CHARSET);
     // get the CMAP table from the font which is selected into the DC
-    const DWORD CmapTag = CalcTag( "cmap" );
-    DWORD nRC = Ft2GetFontData( hPS, CmapTag, 0, NULL, 0 );
-    // read the CMAP table if available
-    if( nRC != FT2_ERROR )
-    {
-        const int nLength = nRC;
-        std::vector<unsigned char> aCmap( nLength );
-        unsigned char* pCmap = &aCmap[0];
-        nRC = Ft2GetFontData( hPS, CmapTag, 0, pCmap, nLength );
-        // parse the CMAP table
-        if( nRC == nLength )
-            ParseCMAP( pCmap, nLength, aResult );
-    } else {
-		// we need to define at least a simple charmap, otherwise this font
-		// will be mapped to default charmap, and OOo doesn't accept the
-		// system font to match the default charmap
-		aResult.mnPairCount = 1;
-		// ImplFontCharMap destructor will free this memory
-		aResult.mpPairCodes = new sal_uInt32[ 2 * aResult.mnPairCount ];
-		aResult.mpPairCodes[0] = 0x0020;
-		aResult.mpPairCodes[1] = 0x00FF;
-		aResult.mpStartGlyphs = NULL;
-	}
-
-    mbDisableGlyphApi |= aResult.mbRecoded;
-
-    if( aResult.mnPairCount > 0 )
-        mpUnicodeMap = new ImplFontCharMap( aResult.mnPairCount,
-            aResult.mpPairCodes, aResult.mpStartGlyphs );
-    else
-        mpUnicodeMap = ImplFontCharMap::GetDefaultMap();
-	mpUnicodeMap->AddReference();
+    const DWORD nCmapTag = CalcTag( "cmap" );
+    const RawFontData aRawFontData( hPS, nCmapTag );
+    // parse the CMAP table if available
+    if( aRawFontData.get() ) {
+        CmapResult aResult;
+        ParseCMAP( aRawFontData.get(), aRawFontData.size(), aResult );
+        mbDisableGlyphApi |= aResult.mbRecoded;
+        aResult.mbSymbolic = bIsSymbolFont;
+        if( aResult.mnRangeCount > 0 )
+            mpUnicodeMap = new ImplFontCharMap( aResult );
+    }
+
+    if( !mpUnicodeMap )
+        mpUnicodeMap = ImplFontCharMap::GetDefaultMap( bIsSymbolFont );
 }
 
 // =======================================================================
@@ -614,13 +627,13 @@ USHORT Os2SalGraphics::ImplDoSetFont( Im
 {
 
 #if OSL_DEBUG_LEVEL>10
-    debug_printf( "Os2SalGraphics::ImplDoSetFont\n");
+    debug_printf( "Os2SalGraphics::ImplDoSetFont mbPrinter=%d\n", mbPrinter);
 #endif
 
 	ImplOs2FontData* pFontData = (ImplOs2FontData*)i_pFont->mpFontData;
 	PFONTMETRICS 	pFontMetric = NULL;
 	FATTRS		  	aFAttrs;
-	BOOL		  	bOutline = FALSE;
+	PM_BOOL		  	bOutline = FALSE;
 	APIRET			rc;			
 
 	memset( &aFAttrs, 0, sizeof( FATTRS ) );
@@ -654,6 +667,11 @@ USHORT Os2SalGraphics::ImplDoSetFont( Im
 		}
 
 	}
+#if OSL_DEBUG_LEVEL>1
+	if (pFontMetric->szFacename[0] == 'D') {
+		rc = 0; // debugger breakpoint
+	}
+#endif
 
 	// use family name for outline fonts
     if ( mbPrinter ) {
@@ -682,10 +700,17 @@ USHORT Os2SalGraphics::ImplDoSetFont( Im
 		debug_printf( "Os2SalGraphics::SetFont hps %x lMatch '%d'\n", mhPS, pFontMetric->lMatch);
 		debug_printf( "Os2SalGraphics::SetFont hps %x fontmetrics facename '%s'\n", mhPS, pFontMetric->szFacename);
 		debug_printf( "Os2SalGraphics::SetFont hps %x fattrs facename '%s'\n", mhPS, aFAttrs.szFacename);
+		debug_printf( "Os2SalGraphics::SetFont hps %x fattrs height '%d'\n", mhPS, aFAttrs.lMaxBaselineExt);
+		debug_printf( "Os2SalGraphics::SetFont hps %x fattrs width '%d'\n", mhPS, aFAttrs.lAveCharWidth);
 	}
 #endif
 
-	Ft2DeleteSetId( mhPS, nFallbackLevel + LCID_BASE);
+	// set default font
+	rc = Ft2SetCharSet( mhPS, LCID_DEFAULT);
+	// delete selected font
+	rc = Ft2DeleteSetId( mhPS, nFallbackLevel + LCID_BASE);
+
+	// create new logical font
 	if ( (rc=Ft2CreateLogFont( mhPS, NULL, nFallbackLevel + LCID_BASE, &aFAttrs)) == GPI_ERROR ) {
 #if OSL_DEBUG_LEVEL>1
 		ERRORID nLastError = WinGetLastError( GetSalData()->mhAB );
@@ -694,6 +719,22 @@ USHORT Os2SalGraphics::ImplDoSetFont( Im
 		return SAL_SETFONT_REMOVEANDMATCHNEW;
 	}
 
+#if OSL_DEBUG_LEVEL>1
+	// select new font
+	rc = Ft2SetCharSet( mhPS, nFallbackLevel + LCID_BASE);
+
+	// query fontmetric of new font
+	FONTMETRICS aOS2Metric = {0};
+	rc = Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric );
+
+	if (pFontMetric->szFacename[0] == 'D') {
+		debug_printf( "Os2SalGraphics::SetFont Ft2QueryFontMetrics fattrs facename '%s'\n", aOS2Metric.szFacename);
+		debug_printf( "Os2SalGraphics::SetFont Ft2QueryFontMetrics fattrs height '%d'\n", aOS2Metric.lMaxBaselineExt);
+		debug_printf( "Os2SalGraphics::SetFont Ft2QueryFontMetrics fattrs width '%d'\n", aOS2Metric.lAveCharWidth);
+	}
+#endif
+
+	// apply font sizing, rotation
 	CHARBUNDLE aBundle;
 
 	ULONG nAttrsDefault = 0;
@@ -761,8 +802,12 @@ USHORT Os2SalGraphics::ImplDoSetFont( Im
 	rc = Ft2SetAttrs( mhPS, PRIM_CHAR, nAttrs, nAttrsDefault, &aBundle );
 
 #if OSL_DEBUG_LEVEL>1
-	FONTMETRICS aOS2Metric = {0};
-	Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric );
+	rc = Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric );
+	if (pFontMetric->szFacename[0] == 'D') {
+		debug_printf( "Os2SalGraphics::SetFont Ft2QueryFontMetrics fattrs facename '%s'\n", aOS2Metric.szFacename);
+		debug_printf( "Os2SalGraphics::SetFont Ft2QueryFontMetrics fattrs height '%d'\n", aOS2Metric.lMaxBaselineExt);
+		debug_printf( "Os2SalGraphics::SetFont Ft2QueryFontMetrics fattrs width '%d'\n", aOS2Metric.lAveCharWidth);
+	}
 #endif
 
 	return 0;
@@ -791,7 +836,7 @@ USHORT Os2SalGraphics::SetFont( ImplFont
         return 0;
     }
 
-#if OSL_DEBUG_LEVEL>10
+#if OSL_DEBUG_LEVEL>1
     debug_printf( "Os2SalGraphics::SetFont\n");
 #endif
 
@@ -850,11 +895,13 @@ USHORT Os2SalGraphics::SetFont( ImplFont
 
 // -----------------------------------------------------------------------
 
-void Os2SalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+void Os2SalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
 {
 	FONTMETRICS aOS2Metric;
 	Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric );
 
+	// @TODO sync , int nFallbackLevel in 340
+
 #if OSL_DEBUG_LEVEL>1
 	debug_printf( "Os2SalGraphics::GetFontMetric hps %x\n", mhPS);
 	if (aOS2Metric.szFacename[0] == 'A') {
@@ -1025,7 +1072,7 @@ void Os2SalGraphics::GetDevFontList( Imp
 	SalData*		pSalData;
 
 #if OSL_DEBUG_LEVEL>0
-	debug_printf("Os2SalGraphics::GetDevFontList\n");
+	debug_printf("Os2SalGraphics::GetDevFontList mbPrinter=%d\n", mbPrinter);
 #endif
 
 	// install OpenSymbol
@@ -1043,7 +1090,7 @@ void Os2SalGraphics::GetDevFontList( Imp
 	*slash = '\0';
 	slash = strrchr( Buff, '\\');
 	*slash = '\0';
-	strcat( Buff, "\\SHARE\\FONTS\\TRUETYPE\\OPENS___.TTF");
+	strcat( Buff, "\\FONTS\\OPENS___.TTF");
 	rc = GpiLoadPublicFonts( GetSalData()->mhAB, Buff);
 
 	if ( !mbPrinter )
@@ -1074,7 +1121,7 @@ void Os2SalGraphics::GetDevFontList( Imp
 		// query the number of fonts available
 		LONG nTemp = 0;
 		nFontMetricCount = Ft2QueryFonts( mhPS,
-										  QF_PUBLIC | QF_PRIVATE,
+										  QF_PUBLIC | QF_PRIVATE | QF_NO_DEVICE,
 										  NULL, &nTemp,
 										  sizeof( FONTMETRICS ), NULL );
 
@@ -1086,7 +1133,7 @@ void Os2SalGraphics::GetDevFontList( Imp
 
 			// query font list
 			Ft2QueryFonts( mhPS,
-						   QF_PUBLIC | QF_PRIVATE,
+						   QF_PUBLIC | QF_PRIVATE | QF_NO_DEVICE,
 						   NULL,
 						   (PLONG)&nFontMetricCount,
 						   (LONG) sizeof( FONTMETRICS ),
@@ -1110,6 +1157,10 @@ void Os2SalGraphics::GetDevFontList( Imp
 	{
 		PFONTMETRICS pFontMetric = &pFontMetrics[i];
 
+#if OSL_DEBUG_LEVEL>1
+		debug_printf("Os2SalGraphics::GetDevFontList #%d,'%s'\n", i, pFontMetric->szFacename);
+#endif
+
 		// skip font starting with '@', this is an alias internally
 		// used by truetype engine.
 		if (pFontMetric->szFacename[0] == '@')
@@ -1129,6 +1180,9 @@ void Os2SalGraphics::GetDevFontList( Imp
 		// create new font list element
 		ImplOs2FontData* pData 		= new ImplOs2FontData( pFontMetric, 0, 0 );
 
+		// ticket#80: font id field is used for pdf font cache code.
+		pData->SetFontId( i);
+
 		// add font list element to font list
 		pList->Add( pData );
 
@@ -1143,7 +1197,7 @@ void Os2SalGraphics::GetDevFontSubstList
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect )
+sal_Bool Os2SalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect )
 {
     // use unity matrix
     MAT2 aMat;
@@ -1172,14 +1226,14 @@ BOOL Os2SalGraphics::GetGlyphBoundRect( 
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalGraphics::GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly )
+sal_Bool Os2SalGraphics::GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly )
 {
 #if OSL_DEBUG_LEVEL>0
 	debug_printf("Os2SalGraphics::GetGlyphOutline\n");
 #endif
     rB2DPolyPoly.clear();
 
-    BOOL bRet = FALSE;
+    PM_BOOL bRet = FALSE;
 
     // use unity matrix
     MAT2 aMat;
@@ -1199,7 +1253,7 @@ BOOL Os2SalGraphics::GetGlyphOutline( lo
         bRet = TRUE;
     else if( nSize1 != FT2_ERROR )
     {
-        BYTE*   pData = new BYTE[ nSize1 ];
+        PM_BYTE*   pData = new PM_BYTE[ nSize1 ];
         ULONG   nTotalCount = 0;
         DWORD   nSize2;
         nSize2 = Ft2GetGlyphOutline( mhPS, nIndex, nGGOFlags,
@@ -1211,10 +1265,10 @@ BOOL Os2SalGraphics::GetGlyphOutline( lo
 
             int     nPtSize = 512;
             Point*  pPoints = new Point[ nPtSize ];
-            BYTE*   pFlags = new BYTE[ nPtSize ];
+            sal_uInt8*   pFlags = new sal_uInt8[ nPtSize ];
 
             TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData;
-            while( (BYTE*)pHeader < pData+nSize2 )
+            while( (PM_BYTE*)pHeader < pData+nSize2 )
             {
                 // only outline data is interesting
                 if( pHeader->dwType != TT_POLYGON_TYPE )
@@ -1231,17 +1285,17 @@ BOOL Os2SalGraphics::GetGlyphOutline( lo
 
                 bool bHasOfflinePoints = false;
                 TTPOLYCURVE* pCurve = (TTPOLYCURVE*)( pHeader + 1 );
-                pHeader = (TTPOLYGONHEADER*)( (BYTE*)pHeader + pHeader->cb );
-                while( (BYTE*)pCurve < (BYTE*)pHeader )
+                pHeader = (TTPOLYGONHEADER*)( (PM_BYTE*)pHeader + pHeader->cb );
+                while( (PM_BYTE*)pCurve < (PM_BYTE*)pHeader )
                 {
                     int nNeededSize = nPnt + 16 + 3 * pCurve->cpfx;
                     if( nPtSize < nNeededSize )
                     {
                         Point* pOldPoints = pPoints;
-                        BYTE* pOldFlags = pFlags;
+                        sal_uInt8* pOldFlags = pFlags;
                         nPtSize = 2 * nNeededSize;
                         pPoints = new Point[ nPtSize ];
-                        pFlags = new BYTE[ nPtSize ];
+                        pFlags = new sal_uInt8[ nPtSize ];
                         for( int i = 0; i < nPnt; ++i )
                         {
                             pPoints[ i ] = pOldPoints[ i ];
@@ -1354,8 +1408,10 @@ BOOL Os2SalGraphics::GetGlyphOutline( lo
     // rescaling needed for the PolyPolygon conversion
     if( rB2DPolyPoly.count() )
     {
-		const double fFactor((1.0/256) * mfFontScale);
-		rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor));
+        ::basegfx::B2DHomMatrix aMatrix;
+        aMatrix.scale( 1.0/256, 1.0/256 );
+        aMatrix.scale( mfFontScale, mfFontScale );
+        rB2DPolyPoly.transform( aMatrix );
     }
     
     return bRet;
@@ -1439,10 +1495,12 @@ int ScopedTrueTypeFont::open(void * pBuf
     return OpenTTFontBuffer(pBuffer, nLen, nFaceNum, &m_pFont);
 }
 
-BOOL Os2SalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
+sal_Bool Os2SalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
 	const ImplFontData* pFont, long* pGlyphIDs, sal_uInt8* pEncoding,
 	sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo )
 {
+	// TODO: use more of the central font-subsetting code, move stuff there if needed
+
 	// create matching ImplFontSelectData
 	// we need just enough to get to the font file data
 	// use height=1000 for easier debugging (to match psprint's font units)
@@ -1452,6 +1510,10 @@ BOOL Os2SalGraphics::CreateFontSubset( c
 	ScopedFont aOldFont(*this);
 	SetFont( &aIFSD, 0 );
 
+    ImplOs2FontData* pWinFontData = (ImplOs2FontData*)aIFSD.mpFontData;
+    pWinFontData->UpdateFromHPS( mhPS );
+    const ImplFontCharMap* pImplFontCharMap = pWinFontData->GetImplFontCharMap();
+
 #if OSL_DEBUG_LEVEL > 100
 	// get font metrics
 	TEXTMETRICA aWinMetric;
@@ -1462,13 +1524,43 @@ BOOL Os2SalGraphics::CreateFontSubset( c
 	DBG_ASSERT( aWinMetric.tmPitchAndFamily & TMPF_TRUETYPE, "can only subset TT font" );
 #endif
 
-	// get raw font file data
-	DWORD nFontSize1 = Ft2GetFontData( mhPS, 0, 0, NULL, 0 );
-	if( nFontSize1 == FT2_ERROR )
-		return FALSE;
-	ScopedCharArray xRawFontData(new char[ nFontSize1 ]);
-	DWORD nFontSize2 = Ft2GetFontData( mhPS, 0, 0, (void*)xRawFontData.get(), nFontSize1 );
-	if( nFontSize1 != nFontSize2 )
+    rtl::OUString aSysPath;
+    if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) )
+        return FALSE;
+    const rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding();
+    const ByteString aToFile( aSysPath.getStr(), (xub_StrLen)aSysPath.getLength(), aThreadEncoding );
+
+	// check if the font has a CFF-table
+	const DWORD nCffTag = CalcTag( "CFF " );
+	const RawFontData aRawCffData( mhPS, nCffTag );
+	if( aRawCffData.get() )
+	{
+		long nRealGlyphIds[ 256 ];
+		for( int i = 0; i < nGlyphCount; ++i )
+		{
+			// TODO: remap notdef glyph if needed
+			// TODO: use GDI's GetGlyphIndices instead? Does it handle GSUB properly?
+			sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK;
+			if( pGlyphIDs[i] & GF_ISCHAR ) // remaining pseudo-glyphs need to be translated
+				nGlyphIdx = pImplFontCharMap->GetGlyphIndex( nGlyphIdx );
+			if( (pGlyphIDs[i] & (GF_ROTMASK|GF_GSUB)) != 0)	// TODO: vertical substitution
+				{/*####*/}
+
+			nRealGlyphIds[i] = nGlyphIdx;
+		}
+
+		// provide a font subset from the CFF-table
+		FILE* pOutFile = fopen( aToFile.GetBuffer(), "wb" );
+		rInfo.LoadFont( FontSubsetInfo::CFF_FONT, aRawCffData.get(), aRawCffData.size() );
+		bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, NULL,
+				nRealGlyphIds, pEncoding, nGlyphCount, pGlyphWidths );
+		fclose( pOutFile );
+		return bRC;
+	}
+
+    // get raw font file data
+    const RawFontData xRawFontData( mhPS, NULL );
+    if( !xRawFontData.get() )
 		return FALSE;
 
 	// open font file
@@ -1477,13 +1569,13 @@ BOOL Os2SalGraphics::CreateFontSubset( c
 		nFaceNum = ~0U;	 // indicate "TTC font extracts only"
 
 	ScopedTrueTypeFont aSftTTF;
-	int nRC = aSftTTF.open( xRawFontData.get(), nFontSize1, nFaceNum );
+	int nRC = aSftTTF.open( (void*)xRawFontData.get(), xRawFontData.size(), nFaceNum );
 	if( nRC != SF_OK )
 		return FALSE;
 
 	TTGlobalFontInfo aTTInfo;
 	::GetTTGlobalFontInfo( aSftTTF.get(), &aTTInfo );
-	rInfo.m_nFontType	= SAL_FONTSUBSETINFO_TYPE_TRUETYPE;
+	rInfo.m_nFontType   = FontSubsetInfo::SFNT_TTF;
 	rInfo.m_aPSName		= ImplSalGetUniString( aTTInfo.psname );
 	rInfo.m_nAscent		= +aTTInfo.winAscent;
 	rInfo.m_nDescent	= -aTTInfo.winDescent;
@@ -1491,7 +1583,7 @@ BOOL Os2SalGraphics::CreateFontSubset( c
 									Point( aTTInfo.xMax, aTTInfo.yMax ) );
 	rInfo.m_nCapHeight	= aTTInfo.yMax; // Well ...
 
-	// subset glyphs and get their properties
+	// subset TTF-glyphs and get their properties
 	// take care that subset fonts require the NotDef glyph in pos 0
 	int nOrigCount = nGlyphCount;
 	USHORT	  aShortIDs[ 256 ];
@@ -1504,14 +1596,14 @@ BOOL Os2SalGraphics::CreateFontSubset( c
 		sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK;
 		if( pGlyphIDs[i] & GF_ISCHAR )
 		{
-			bool bVertical = (pGlyphIDs[i] & GF_ROTMASK) != 0;
-			nGlyphIdx = ::MapChar( aSftTTF.get(), sal::static_int_cast<sal_uInt16>(nGlyphIdx), bVertical );
-			if( nGlyphIdx == 0 && pFont->IsSymbolFont() )
+			sal_Unicode cChar = static_cast<sal_Unicode>(nGlyphIdx); // TODO: sal_UCS4
+			const bool bVertical = ((pGlyphIDs[i] & (GF_ROTMASK|GF_GSUB)) != 0);
+			nGlyphIdx = ::MapChar( aSftTTF.get(), cChar, bVertical );
+			if( (nGlyphIdx == 0) && pFont->IsSymbolFont() )
 			{
 				// #i12824# emulate symbol aliasing U+FXXX <-> U+0XXX
-				nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK;
-				nGlyphIdx = (nGlyphIdx & 0xF000) ? (nGlyphIdx & 0x00FF) : (nGlyphIdx | 0xF000 );
-				nGlyphIdx = ::MapChar( aSftTTF.get(), sal::static_int_cast<sal_uInt16>(nGlyphIdx), bVertical );
+				cChar = (cChar & 0xF000) ? (cChar & 0x00FF) : (cChar | 0xF000);
+				nGlyphIdx = ::MapChar( aSftTTF.get(), cChar, bVertical );
 			}
 		}
 		aShortIDs[i] = static_cast<USHORT>( nGlyphIdx );
@@ -1547,14 +1639,9 @@ BOOL Os2SalGraphics::CreateFontSubset( c
 	free( pMetrics );
 
 	// write subset into destination file
-	rtl::OUString aSysPath;
-	if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) )
-		return FALSE;
-	rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding();
-	ByteString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) );
 	nRC = ::CreateTTFromTTGlyphs( aSftTTF.get(), aToFile.GetBuffer(), aShortIDs,
 			aTempEncs, nGlyphCount, 0, NULL, 0 );
-	return nRC == SF_OK;
+	return (nRC == SF_OK);
 }
 
 //--------------------------------------------------------------------------
@@ -1572,20 +1659,16 @@ const void* Os2SalGraphics::GetEmbedFont
 	SetFont( &aIFSD, 0 );
 
 	// get the raw font file data
-	DWORD nFontSize1 = Ft2GetFontData( mhPS, 0, 0, NULL, 0 );
-	if( nFontSize1 == FT2_ERROR || nFontSize1 <= 0 )
-	return NULL;
-	*pDataLen = nFontSize1;
-	void* pData = reinterpret_cast<void*>(new char[ nFontSize1 ]);
-	DWORD nFontSize2 = Ft2GetFontData( mhPS, 0, 0, pData, nFontSize1 );
-	if( nFontSize1 != nFontSize2 )
-		*pDataLen = 0;
-	
+	RawFontData aRawFontData( mhPS );
+	*pDataLen = aRawFontData.size();
+	if( !aRawFontData.get() )
+		return NULL;
+
 	// get important font properties
 	FONTMETRICS aOS2Metric;
 	if (Ft2QueryFontMetrics( mhPS, sizeof( aOS2Metric ), &aOS2Metric ) == GPI_ERROR)
 			*pDataLen = 0;
-	rInfo.m_nFontType	= SAL_FONTSUBSETINFO_TYPE_TYPE1;
+	rInfo.m_nFontType	= FontSubsetInfo::ANY_TYPE1;
 	rInfo.m_aPSName		= ImplSalGetUniString( aOS2Metric.szFacename );
 	rInfo.m_nAscent		= +aOS2Metric.lMaxAscender;
 	rInfo.m_nDescent	= -aOS2Metric.lMaxDescender;
@@ -1604,12 +1687,10 @@ const void* Os2SalGraphics::GetEmbedFont
 	}
 
 	if( !*pDataLen )
-	{
-		FreeEmbedFontData( pData, nFontSize1 );
-		pData = NULL;
-	}
+		return NULL;
 
-	return pData;
+	const unsigned char* pData = aRawFontData.steal();
+	return (void*)pData;
 }
 
 //--------------------------------------------------------------------------
@@ -1621,27 +1702,34 @@ void Os2SalGraphics::FreeEmbedFontData( 
 
 const Ucs2SIntMap* Os2SalGraphics::GetFontEncodingVector( const ImplFontData* pFont, const Ucs2OStrMap** pNonEncoded )
 {
-	// TODO: even for builtin fonts we get here... why?
-	if( !pFont->IsEmbeddable() )
-		return NULL;
-
-	// fill the encoding vector
-	Ucs2SIntMap& rMap = *new Ucs2SIntMap;
-#if 0	 
-	// TODO: get correct encoding vector
-	ImplWinFontData* pWinFontData = reinterpret_cast<ImplWinFontData*>(pFont);
-	
-	GLYPHSET aGlyphSet;
-	aGlyphSet.cbThis = sizeof(aGlyphSet);
-	DWORD aW = ::GetFontUnicodeRanges( mhDC, &aGlyphSet);
-#else	 
-	for( sal_Unicode i = 32; i < 256; ++i )
-		rMap[i] = i;
-	if( pNonEncoded )
-		*pNonEncoded = NULL;
-#endif
+    // TODO: even for builtin fonts we get here... why?
+    if( !pFont->IsEmbeddable() )
+        return NULL;
+
+    // fill the encoding vector
+    // currently no nonencoded vector
+    if( pNonEncoded )
+        *pNonEncoded = NULL;
+
+    const ImplOs2FontData* pWinFontData = static_cast<const ImplOs2FontData*>(pFont);
+    const Ucs2SIntMap* pEncoding = pWinFontData->GetEncodingVector();
+    if( pEncoding == NULL )
+    {
+        Ucs2SIntMap* pNewEncoding = new Ucs2SIntMap;
+        #if 0
+        // TODO: get correct encoding vector
+        GLYPHSET aGlyphSet;
+        aGlyphSet.cbThis = sizeof(aGlyphSet);
+        DWORD aW = ::GetFontUnicodeRanges( mhPS, &aGlyphSet);
+        #else
+        for( sal_Unicode i = 32; i < 256; ++i )
+            (*pNewEncoding)[i] = i;
+        #endif
+        pWinFontData->SetEncodingVector( pNewEncoding );
+	pEncoding = pNewEncoding;
+    }
 
-	return &rMap;
+    return pEncoding;
 }
 
 //--------------------------------------------------------------------------
@@ -1664,13 +1752,9 @@ void Os2SalGraphics::GetGlyphWidths( con
     if( pFont->IsSubsettable() )
     {
         // get raw font file data
-        DWORD nFontSize1 = ::Ft2GetFontData( mhPS, 0, 0, NULL, 0 );
-        if( nFontSize1 == FT2_ERROR )
-            return;
-        ScopedCharArray xRawFontData(new char[ nFontSize1 ]);
-        DWORD nFontSize2 = ::Ft2GetFontData( mhPS, 0, 0, (void*)xRawFontData.get(), nFontSize1 );
-        if( nFontSize1 != nFontSize2 )
-            return;
+	const RawFontData xRawFontData( mhPS );
+	if( !xRawFontData.get() )
+		return;
 
         // open font file
         sal_uInt32 nFaceNum = 0;
@@ -1678,7 +1762,7 @@ void Os2SalGraphics::GetGlyphWidths( con
             nFaceNum = ~0U;  // indicate "TTC font extracts only"
     
         ScopedTrueTypeFont aSftTTF;
-        int nRC = aSftTTF.open( xRawFontData.get(), nFontSize1, nFaceNum );
+        int nRC = aSftTTF.open( (void*)xRawFontData.get(), xRawFontData.size(), nFaceNum );
         if( nRC != SF_OK )
             return;
     

Modified: incubator/ooo/trunk/main/vcl/os2/source/gdi/salprn.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/gdi/salprn.cxx?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/gdi/salprn.cxx (original)
+++ incubator/ooo/trunk/main/vcl/os2/source/gdi/salprn.cxx Fri Nov 11 02:37:05 2011
@@ -39,6 +39,37 @@
 
 #include <string.h>
 
+#include <osl/module.h>
+
+#include <tools/urlobj.hxx>
+#include <tools/svwin.h>
+#ifdef __MINGW32__
+#include <excpt.h>
+#endif
+
+#include <os2/saldata.hxx>
+#include <os2/salinst.h>
+#include <os2/salgdi.h>
+#include <os2/salframe.h>
+#include <os2/salprn.h>
+
+#include <salptype.hxx>
+#include <print.h>
+#include <jobset.h>
+
+/*
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/processfactory.hxx>
+*/
+
+#include <malloc.h>
+
+/*
 #define _SV_SALPRN_CXX
 #include <tools/debug.hxx>
 #include <saldata.hxx>
@@ -50,8 +81,10 @@
 #include <vcl/print.h>
 #include <vcl/jobset.h>
 
+*/
+
 #ifndef __H_FT2LIB
-#include <wingdi.h>
+#include <os2/wingdi.h>
 #include <ft2lib.h>
 #endif
 
@@ -126,7 +159,7 @@ ImplQueueSalSysData::ImplQueueSalSysData
 {
 	if ( pDrivData )
 	{
-		mpDrivData = (PDRIVDATA)new BYTE[pDrivData->cb];
+		mpDrivData = (PDRIVDATA)new PM_BYTE[pDrivData->cb];
 		memcpy( mpDrivData, pDrivData, pDrivData->cb );
 	}
 	else
@@ -427,10 +460,10 @@ static void ImplUpdateSetupData( const P
 		{
 			if ( pSetupData->mnDriverDataLen != pDrivData->cb )
 				rtl_freeMemory( pSetupData->mpDriverData );
-			pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDrivData->cb);
+			pSetupData->mpDriverData = (sal_uInt8*)rtl_allocateMemory( pDrivData->cb);
 		}
 		else
-			pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDrivData->cb);
+			pSetupData->mpDriverData = (sal_uInt8*)rtl_allocateMemory( pDrivData->cb);
 		pSetupData->mnDriverDataLen = pDrivData->cb;
 		memcpy( pSetupData->mpDriverData, pDrivData, pDrivData->cb );
 	}
@@ -441,7 +474,7 @@ static void ImplUpdateSetupData( const P
 
 // -----------------------------------------------------------------------
 
-static BOOL ImplPaperSizeEqual( long nPaperWidth1, long nPaperHeight1,
+static sal_Bool ImplPaperSizeEqual( long nPaperWidth1, long nPaperHeight1,
 								long nPaperWidth2, long nPaperHeight2 )
 {
 	return (((nPaperWidth1 >= nPaperWidth2-1) && (nPaperWidth1 <= nPaperWidth2+1)) &&
@@ -450,7 +483,7 @@ static BOOL ImplPaperSizeEqual( long nPa
 
 // -----------------------------------------------------------------------
 
-static BOOL ImplIsDriverDJPEnabled( HDC hDC )
+static sal_Bool ImplIsDriverDJPEnabled( HDC hDC )
 {
 #ifdef NO_DJP
 	return FALSE;
@@ -502,7 +535,7 @@ static BOOL ImplIsDriverDJPEnabled( HDC 
 static void ImplFormatInputList( PDJP_ITEM pDJP, PQUERYTUPLE pTuple )
 {
    // Loop through the query elements
-   BOOL fContinue = TRUE;
+   sal_Bool fContinue = TRUE;
    do
    {
 	  pDJP->cb			  = sizeof (DJP_ITEM);
@@ -580,7 +613,7 @@ static void ImplGetFormAndTrayList( Os2S
 
 	// allocate the memory
 	nAlloc = pQuerySize->ulSizeNeeded;
-	pBuffer = (PBYTE)new BYTE[nAlloc];
+	pBuffer = (PBYTE)new PM_BYTE[nAlloc];
 
 	// set up the input
 	PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
@@ -646,7 +679,7 @@ static void ImplGetFormAndTrayList( Os2S
 
 // -----------------------------------------------------------------------
 
-static BOOL ImplGetCurrentSettings( Os2SalInfoPrinter* pOs2SalInfoPrinter, ImplJobSetup* pSetupData )
+static sal_Bool ImplGetCurrentSettings( Os2SalInfoPrinter* pOs2SalInfoPrinter, ImplJobSetup* pSetupData )
 {
 	// Um den aktuellen Tray zu ermitteln, brauchen wir auch die Listen dazu
 	if ( !pOs2SalInfoPrinter->mnFormCount )
@@ -667,7 +700,7 @@ static BOOL ImplGetCurrentSettings( Os2S
 	PDRIVDATA	pCopyDrivData		= ImplPrnDrivData( pSetupData );
 	LONG		nDrivDataSize		= pCopyDrivData->cb;
 	PBYTE		pDrivData			= (PBYTE)pCopyDrivData;
-	BOOL		bResult;
+	sal_Bool		bResult;
 
 	// find out how many bytes to allocate
 	pQuerySize->cb = sizeof( alQuery );
@@ -685,7 +718,7 @@ static BOOL ImplGetCurrentSettings( Os2S
 
 	// allocate the memory
 	nAlloc = pQuerySize->ulSizeNeeded;
-	pBuffer = (PBYTE)new BYTE[nAlloc];
+	pBuffer = (PBYTE)new PM_BYTE[nAlloc];
 
 	// set up the input
 	PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
@@ -740,11 +773,11 @@ static BOOL ImplGetCurrentSettings( Os2S
 							break;
 
 						case DJP_PSI_B4:
-							pSetupData->mePaperFormat = PAPER_B4;
+							pSetupData->mePaperFormat = PAPER_B4_JIS;
 							break;
 
 						case DJP_PSI_B5:
-							pSetupData->mePaperFormat = PAPER_B5;
+							pSetupData->mePaperFormat = PAPER_B5_JIS;
 							break;
 
 						case DJP_PSI_LETTER:
@@ -765,7 +798,7 @@ static BOOL ImplGetCurrentSettings( Os2S
 					}
 
 					// Wir suchen zuerst ueber den Namen/Id und dann ueber die Id
-					BOOL	bTrayFound = FALSE;
+					sal_Bool	bTrayFound = FALSE;
 					USHORT	j;
 					for ( j = 0; j < pOs2SalInfoPrinter->mnTrayCount; j++ )
 					{
@@ -815,7 +848,7 @@ static BOOL ImplGetCurrentSettings( Os2S
 
 // -----------------------------------------------------------------------
 
-static BOOL ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData,
+static sal_Bool ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData,
 								Orientation eOrientation )
 {
 	LONG alQuery[] =
@@ -844,7 +877,7 @@ static BOOL ImplSetOrientation( HDC hPri
 
 	// allocate the memory
 	nAlloc = pQuerySize->ulSizeNeeded;
-	pBuffer = (PBYTE)new BYTE[nAlloc];
+	pBuffer = (PBYTE)new PM_BYTE[nAlloc];
 
 	// set up the input
 	PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
@@ -872,7 +905,7 @@ static BOOL ImplSetOrientation( HDC hPri
 
 // -----------------------------------------------------------------------
 
-static BOOL ImplSetPaperSize( HDC hPrinterDC, PDRIVDATA pDriverData,
+static sal_Bool ImplSetPaperSize( HDC hPrinterDC, PDRIVDATA pDriverData,
 							  DJPT_PAPERSIZE nOS2PaperFormat )
 {
 	LONG alQuery[] =
@@ -901,7 +934,7 @@ static BOOL ImplSetPaperSize( HDC hPrint
 
 	// allocate the memory
 	nAlloc = pQuerySize->ulSizeNeeded;
-	pBuffer = (PBYTE)new BYTE[nAlloc];
+	pBuffer = (PBYTE)new PM_BYTE[nAlloc];
 
 	// set up the input
 	PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
@@ -929,7 +962,7 @@ static BOOL ImplSetPaperSize( HDC hPrint
 
 // -----------------------------------------------------------------------
 
-static BOOL ImplSetPaperBin( HDC hPrinterDC, PDRIVDATA pDriverData,
+static sal_Bool ImplSetPaperBin( HDC hPrinterDC, PDRIVDATA pDriverData,
 							 ImplTrayInfo* pTrayInfo )
 {
 	LONG alQuery[] =
@@ -958,7 +991,7 @@ static BOOL ImplSetPaperBin( HDC hPrinte
 
 	// allocate the memory
 	nAlloc = pQuerySize->ulSizeNeeded;
-	pBuffer = (PBYTE)new BYTE[nAlloc];
+	pBuffer = (PBYTE)new PM_BYTE[nAlloc];
 
 	// set up the input
 	PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
@@ -985,7 +1018,7 @@ static BOOL ImplSetPaperBin( HDC hPrinte
 
 // =======================================================================
 
-static BOOL ImplSalCreateInfoPrn( Os2SalInfoPrinter* pPrinter, PDRIVDATA pDriverData,
+static sal_Bool ImplSalCreateInfoPrn( Os2SalInfoPrinter* pPrinter, PDRIVDATA pDriverData,
 								  HDC& rDC, HPS& rPS )
 {
 	SalData* pSalData = GetSalData();
@@ -1044,7 +1077,7 @@ SalInfoPrinter* Os2SalInstance::CreateIn
 	// Nur Setup-Daten uebernehmen, wenn Treiber und Laenge der Treiberdaten
 	// uebereinstimmt
 	PDRIVDATA	pDriverData;
-	BOOL		bUpdateDriverData;
+	sal_Bool		bUpdateDriverData;
 	if ( pSetupData->mpDriverData && pSysQueueData->mpDrivData &&
 		 (pSetupData->mnSystem == JOBSETUP_SYSTEM_OS2) &&
 		 (pSetupData->mnDriverDataLen == pSysQueueData->mpDrivData->cb) &&
@@ -1090,7 +1123,7 @@ SalInfoPrinter* Os2SalInstance::CreateIn
 	{
 		if ( pSetupData->mpDriverData )
 			rtl_freeMemory( pSetupData->mpDriverData);
-		pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDriverData->cb);
+		pSetupData->mpDriverData = (sal_uInt8*)rtl_allocateMemory( pDriverData->cb);
 		memcpy( pSetupData->mpDriverData, pDriverData, pDriverData->cb );
 		pSetupData->mnDriverDataLen = pDriverData->cb;
 	}
@@ -1160,7 +1193,7 @@ void Os2SalInfoPrinter::ReleaseGraphics(
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData )
+sal_Bool Os2SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData )
 {
 	PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData );
 	if ( !pDrivData )
@@ -1207,7 +1240,7 @@ BOOL Os2SalInfoPrinter::Setup( SalFrame*
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData )
+sal_Bool Os2SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData )
 {
 	// Wir koennen nur Treiberdaten von OS2 setzen
 	if ( pSetupData->mnSystem != JOBSETUP_SYSTEM_OS2 )
@@ -1249,7 +1282,7 @@ BOOL Os2SalInfoPrinter::SetPrinterData( 
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
+sal_Bool Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
 {
 	// needs DJP support
 	if ( !mbDJPSupported )
@@ -1260,7 +1293,7 @@ BOOL Os2SalInfoPrinter::SetData( ULONG n
 	if ( !pDrivData )
 		return FALSE;
 
-	BOOL bOK = FALSE;
+	sal_Bool bOK = FALSE;
 
 	// set orientation
 	if ( nFlags & SAL_JOBSET_ORIENTATION )
@@ -1288,11 +1321,11 @@ BOOL Os2SalInfoPrinter::SetData( ULONG n
 				nOS2PaperFormat = DJP_PSI_A5;
 				break;
 
-			case PAPER_B4:
+			case PAPER_B4_JIS:
 				nOS2PaperFormat = DJP_PSI_B4;
 				break;
 
-			case PAPER_B5:
+			case PAPER_B5_JIS:
 				nOS2PaperFormat = DJP_PSI_B5;
 				break;
 
@@ -1487,7 +1520,7 @@ void Os2SalInfoPrinter::GetPageInfo( con
 
 // =======================================================================
 
-static BOOL ImplIsDriverPrintDJPEnabled( HDC hDC )
+static sal_Bool ImplIsDriverPrintDJPEnabled( HDC hDC )
 {
 #ifdef NO_DJP
 	return FALSE;
@@ -1549,7 +1582,7 @@ Os2SalPrinter::~Os2SalPrinter()
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalPrinter::StartJob( const XubString* pFileName,
+sal_Bool Os2SalPrinter::StartJob( const XubString* pFileName,
 						   const XubString& rJobName,
 						   const XubString& rAppName,
 						   ULONG nCopies,
@@ -1682,7 +1715,7 @@ BOOL Os2SalPrinter::StartJob( const XubS
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalPrinter::EndJob()
+sal_Bool Os2SalPrinter::EndJob()
 {
 	APIRET rc;
 	rc = DevEscape( mhDC,
@@ -1699,7 +1732,7 @@ BOOL Os2SalPrinter::EndJob()
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalPrinter::AbortJob()
+sal_Bool Os2SalPrinter::AbortJob()
 {
 	APIRET rc;
 
@@ -1725,7 +1758,7 @@ BOOL Os2SalPrinter::AbortJob()
 
 // -----------------------------------------------------------------------
 
-SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobSetup )
+SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobSetup )
 {
 	APIRET rc;
 
@@ -1797,7 +1830,7 @@ SalGraphics* Os2SalPrinter::StartPage( I
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalPrinter::EndPage()
+sal_Bool Os2SalPrinter::EndPage()
 {
 	if ( mpGraphics )
 	{

Modified: incubator/ooo/trunk/main/vcl/os2/source/gdi/salvd.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/gdi/salvd.cxx?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/gdi/salvd.cxx (original)
+++ incubator/ooo/trunk/main/vcl/os2/source/gdi/salvd.cxx Fri Nov 11 02:37:05 2011
@@ -25,14 +25,25 @@
 
 #include <svpm.h>
 
+#include <tools/svwin.h>
+
+#include <vcl/sysdata.hxx>
+
+#include <os2/saldata.hxx>
+#include <os2/salinst.h>
+#include <os2/salgdi.h>
+#include <os2/salvd.h>
+
+/*
 #define _SV_SALVD_CXX
 #include <saldata.hxx>
 #include <salinst.h>
 #include <salgdi.h>
 #include <salvd.h>
+*/
 
 #ifndef __H_FT2LIB
-#include <wingdi.h>
+#include <os2/wingdi.h>
 #include <ft2lib.h>
 #endif
 
@@ -172,7 +183,7 @@ void Os2SalVirtualDevice::ReleaseGraphic
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalVirtualDevice::SetSize( long nDX, long nDY )
+sal_Bool Os2SalVirtualDevice::SetSize( long nDX, long nDY )
 {
 	HBITMAP hNewBmp = ImplCreateVirDevBitmap( mhDC,
 											  mhPS, nDX, nDY,

Modified: incubator/ooo/trunk/main/vcl/os2/source/src/salsrc.rc
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/src/salsrc.rc?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/src/salsrc.rc (original)
+++ incubator/ooo/trunk/main/vcl/os2/source/src/salsrc.rc Fri Nov 11 02:37:05 2011
@@ -26,7 +26,7 @@
  ************************************************************************/
 
 #ifndef _SV_SALIDS_HRC
-#include <salids.hrc>
+#include <os2/salids.hrc>
 #endif
 
 POINTER 	SAL_RESID_POINTER_NULL					NULLPTR.PTR

Modified: incubator/ooo/trunk/main/vcl/os2/source/window/salframe.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/window/salframe.cxx?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/window/salframe.cxx (original)
+++ incubator/ooo/trunk/main/vcl/os2/source/window/salframe.cxx Fri Nov 11 02:37:05 2011
@@ -21,13 +21,15 @@
 
 
 
-#include <string.h>
-
 #define INCL_DOS
 #define INCL_PM
 #define INCL_WIN
 #include <svpm.h>
 
+#include <string.h>
+
+#include <tools/svwin.h>
+
 // =======================================================================
 
 #define _SV_SALFRAME_CXX
@@ -38,27 +40,22 @@
 
 #define private public
 
-#ifndef _SV_SALLANG_HXX
-#include <sallang.hxx>
-#endif
-#ifndef _SV_SALIDS_HRC
-#include <salids.hrc>
-#endif
-#include <saldata.hxx>
-#include <salinst.h>
-#include <salgdi.h>
-#include <salframe.h>
+#include "os2/sallang.hxx"
+#include "os2/salids.hrc"
+#include "os2/saldata.hxx"
+#include "os2/salinst.h"
+#include "os2/salgdi.h"
+#include "os2/salframe.h"
+#include "os2/saltimer.h"
+
 #include <vcl/timer.hxx>
 #include <vcl/settings.hxx>
-#ifndef _SV_KEYCOES_HXX
 #include <vcl/keycodes.hxx>
-#endif
-#include <saltimer.h>
 
 #if OSL_DEBUG_LEVEL>10
 extern "C" int debug_printf(const char *f, ...);
 
-static BOOL _bCapture;
+static sal_Bool _bCapture;
 
 #else
 #define debug_printf( ...) { 1; }
@@ -66,6 +63,14 @@ static BOOL _bCapture;
 
 // =======================================================================
 
+#undef WinEnableMenuItem
+#define WinEnableMenuItem(hwndMenu,id,fEnable) \
+    ((PM_BOOL)WinSendMsg (hwndMenu, MM_SETITEMATTR, MPFROM2SHORT (id, TRUE), \
+		       MPFROM2SHORT (MIA_DISABLED, \
+				     ((USHORT)(fEnable) ? 0 : MIA_DISABLED))))
+
+// =======================================================================
+
 HPOINTER ImplLoadPointer( ULONG nId );
 
 static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame );
@@ -80,7 +85,7 @@ MRESULT EXPENTRY SalFrameSubClassWndProc
 // =======================================================================
 
 static LanguageType eImplKeyboardLanguage = LANGUAGE_DONTKNOW;
-BOOL Os2SalFrame::mbInReparent = FALSE;
+sal_Bool Os2SalFrame::mbInReparent = FALSE;
 ULONG Os2SalFrame::mnInputLang = 0;
 
 // =======================================================================
@@ -94,26 +99,26 @@ ULONG Os2SalFrame::mnInputLang = 0;
 static LONG nScreenHeight  = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN);
 static LONG nScreenWidth   = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
 
-BOOL APIENTRY _WinQueryWindowRect( HWND hwnd, PRECTL prclDest)
+sal_Bool APIENTRY _WinQueryWindowRect( HWND hwnd, PRECTL prclDest)
 {
-	BOOL rc = WinQueryWindowRect( hwnd, prclDest);
+	sal_Bool rc = WinQueryWindowRect( hwnd, prclDest);
 	ULONG tmp = prclDest->yBottom;
 	prclDest->yBottom = prclDest->yTop;
 	prclDest->yTop = tmp;
 	return rc;
 }
 
-BOOL APIENTRY _WinQueryPointerPos (HWND hwndDesktop, PPOINTL pptl)
+sal_Bool APIENTRY _WinQueryPointerPos (HWND hwndDesktop, PPOINTL pptl)
 {
-	BOOL rc = WinQueryPointerPos( hwndDesktop, pptl);
+	sal_Bool rc = WinQueryPointerPos( hwndDesktop, pptl);
 	pptl->y = nScreenHeight - pptl->y;
 	return rc;
 }
 
-BOOL APIENTRY _WinQueryWindowPos( Os2SalFrame* pFrame, PSWP pswp)
+sal_Bool APIENTRY _WinQueryWindowPos( Os2SalFrame* pFrame, PSWP pswp)
 {
 	SWP swpOwner;
-	BOOL rc = WinQueryWindowPos( pFrame->mhWndFrame, pswp);
+	sal_Bool rc = WinQueryWindowPos( pFrame->mhWndFrame, pswp);
 
 #if OSL_DEBUG_LEVEL>1
 	debug_printf( "> WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", 
@@ -152,7 +157,7 @@ BOOL APIENTRY _WinQueryWindowPos( Os2Sal
 	return rc;
 }
 
-BOOL APIENTRY _WinSetWindowPos( Os2SalFrame* pFrame, HWND hwndInsertBehind, LONG x, LONG y,
+sal_Bool APIENTRY _WinSetWindowPos( Os2SalFrame* pFrame, HWND hwndInsertBehind, LONG x, LONG y,
     LONG cx, LONG cy, ULONG fl)
 {
 	SWP 	swpOwner = {0};
@@ -301,7 +306,7 @@ static SalIMEData* GetSalIMEData()
         if ( 0 == DosLoadModule( NULL, 0, "OS2IM", &hMod ) )
         {
             SalIMEData*     pIMEData = new SalIMEData;
-            BOOL            bError = FALSE;
+            sal_Bool            bError = FALSE;
             ImplSalIMEProc  aProcAry[SAL_IME_PROC_COUNT] =
             {
             { 101, (PFN*)&(pIMEData->mpAssocIME) },
@@ -364,7 +369,7 @@ static void ImplSaveFrameState( Os2SalFr
     if ( !pFrame->mbFullScreen )
     {
         SWP aSWP;
-        BOOL bVisible = WinIsWindowVisible( pFrame->mhWndFrame);
+        sal_Bool bVisible = WinIsWindowVisible( pFrame->mhWndFrame);
 
         // Query actual state (maState uses screen coords)
         WinQueryWindowPos( pFrame->mhWndFrame, &aSWP );
@@ -495,7 +500,7 @@ static void ImplSalCalcFullScreenSize( c
 
 // -----------------------------------------------------------------------
 
-static void ImplSalFrameFullScreenPos( Os2SalFrame* pFrame, BOOL bAlways = FALSE )
+static void ImplSalFrameFullScreenPos( Os2SalFrame* pFrame, sal_Bool bAlways = FALSE )
 {
     SWP aSWP;
     _WinQueryWindowPos( pFrame, &aSWP );
@@ -591,7 +596,7 @@ SalFrame* ImplSalCreateFrame( Os2SalInst
     ULONG    		nFrameFlags = FCF_NOBYTEALIGN | FCF_SCREENALIGN;
     ULONG    		nFrameStyle = 0;
     ULONG    		nClientStyle = WS_CLIPSIBLINGS;
-    BOOL        	bSubFrame = FALSE;
+    sal_Bool        	bSubFrame = FALSE;
 
 #if OSL_DEBUG_LEVEL>0
     debug_printf(">ImplSalCreateFrame hWndParent 0x%x, nSalFrameStyle 0x%x\n", hWndParent, nSalFrameStyle);
@@ -907,9 +912,9 @@ void Os2SalFrame::ReleaseGraphics( SalGr
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalFrame::PostEvent( void* pData )
+sal_Bool Os2SalFrame::PostEvent( void* pData )
 {
-    return (BOOL)WinPostMsg( mhWndClient, SAL_MSG_USEREVENT, 0, (MPARAM)pData );
+    return (sal_Bool)WinPostMsg( mhWndClient, SAL_MSG_USEREVENT, 0, (MPARAM)pData );
 }
 
 // -----------------------------------------------------------------------
@@ -1004,7 +1009,7 @@ void Os2SalFrame::SetExtendedFrameStyle(
 
 // -----------------------------------------------------------------------
 
-void Os2SalFrame::Show( BOOL bVisible, BOOL bNoActivate )
+void Os2SalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
 {
     // Post this Message to the window, because this only works
     // in the thread of the window, which has create this window.
@@ -1017,7 +1022,7 @@ void Os2SalFrame::Show( BOOL bVisible, B
 
 // -----------------------------------------------------------------------
 
-void Os2SalFrame::Enable( BOOL bEnable )
+void Os2SalFrame::Enable( sal_Bool bEnable )
 {
     WinEnableWindow( mhWndFrame, bEnable );
 }
@@ -1054,7 +1059,7 @@ void Os2SalFrame::SetPosSize( long nX, l
 
 	SWP aSWP;
 	_WinQueryWindowPos( this, &aSWP );
-    BOOL bVisible = WinIsWindowVisible( mhWndFrame );
+    sal_Bool bVisible = WinIsWindowVisible( mhWndFrame );
     if ( !bVisible )
     {
         if ( mbFloatWin )
@@ -1099,7 +1104,7 @@ void Os2SalFrame::SetPosSize( long nX, l
     }
 
     // Adjust Window in the screen
-    BOOL bCheckOffScreen = TRUE;
+    sal_Bool bCheckOffScreen = TRUE;
 
     // but don't do this for floaters or ownerdraw windows that are currently moved interactively
     if( (mnStyle & SAL_FRAME_STYLE_FLOAT) && !(mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) )
@@ -1227,7 +1232,7 @@ void Os2SalFrame::SetWindowState( const 
 		pState->mnWidth,pState->mnHeight,pState->mnX,pState->mnY);
 #endif
 
-    BOOL bVisible = WinIsWindowVisible( mhWndFrame );
+    sal_Bool bVisible = WinIsWindowVisible( mhWndFrame );
 
     // get screen coordinates
     SWP	aSWP;
@@ -1292,7 +1297,7 @@ void Os2SalFrame::SetWindowState( const 
 
     // Status setzen
 	bVisible = WinIsWindowVisible( mhWndFrame);
-	BOOL bUpdateHiddenFramePos = FALSE;
+	sal_Bool bUpdateHiddenFramePos = FALSE;
     if ( !bVisible )
     {
         aPlacement.fl = SWP_HIDE;
@@ -1367,7 +1372,7 @@ void Os2SalFrame::SetWindowState( const 
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalFrame::GetWindowState( SalFrameState* pState )
+sal_Bool Os2SalFrame::GetWindowState( SalFrameState* pState )
 {
     if ( maState.mnWidth && maState.mnHeight )
     {
@@ -1430,7 +1435,7 @@ void Os2SalFrame::SetMenu( SalMenu* pSal
 
 // -----------------------------------------------------------------------
 
-void Os2SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay )
+void Os2SalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay )
 {
     if ( mbFullScreen == bFullScreen )
         return;
@@ -1457,14 +1462,14 @@ void Os2SalFrame::ShowFullScreen( BOOL b
 
 // -----------------------------------------------------------------------
 
-void Os2SalFrame::StartPresentation( BOOL bStart )
+void Os2SalFrame::StartPresentation( sal_Bool bStart )
 {
     // SysSetObjectData("<WP_DESKTOP>","Autolockup=no"); oder OS2.INI: PM_Lockup
 }
 
 // -----------------------------------------------------------------------
 
-void Os2SalFrame::SetAlwaysOnTop( BOOL bOnTop )
+void Os2SalFrame::SetAlwaysOnTop( sal_Bool bOnTop )
 {
     mbAllwayOnTop = bOnTop;
 #if 0
@@ -1667,7 +1672,7 @@ void Os2SalFrame::SetPointer( PointerSty
 
 // -----------------------------------------------------------------------
 
-void Os2SalFrame::CaptureMouse( BOOL bCapture )
+void Os2SalFrame::CaptureMouse( sal_Bool bCapture )
 {
 #if OSL_DEBUG_LEVEL>10
 	_bCapture=bCapture;
@@ -1938,12 +1943,12 @@ XubString Os2SalFrame::GetSymbolKeyName(
 
 inline long ImplOS2ColorToSal( long nOS2Color )
 {
-    return MAKE_SALCOLOR( (BYTE)( nOS2Color>>16), (BYTE)(nOS2Color>>8), (BYTE)nOS2Color );
+    return MAKE_SALCOLOR( (PM_BYTE)( nOS2Color>>16), (PM_BYTE)(nOS2Color>>8), (PM_BYTE)nOS2Color );
 }
 
 // -----------------------------------------------------------------------
 
-static USHORT ImplMouseSysValueToSAL( int iSysValue, USHORT& rCode, USHORT& rClicks, BOOL& rDown )
+static USHORT ImplMouseSysValueToSAL( int iSysValue, USHORT& rCode, USHORT& rClicks, sal_Bool& rDown )
 {
     LONG lValue = WinQuerySysValue( HWND_DESKTOP, iSysValue );
 
@@ -2015,7 +2020,7 @@ static USHORT ImplMouseSysValueToSAL( in
 
 // -----------------------------------------------------------------------
 
-static BOOL ImplSalIsSameColor( const Color& rColor1, const Color& rColor2 )
+static sal_Bool ImplSalIsSameColor( const Color& rColor1, const Color& rColor2 )
 {
     ULONG nWrong = 0;
     nWrong += Abs( (short)rColor1.GetRed()-(short)rColor2.GetRed() );
@@ -2026,7 +2031,7 @@ static BOOL ImplSalIsSameColor( const Co
 
 // -----------------------------------------------------------------------
 
-static BOOL ImplOS2NameFontToVCLFont( const char* pFontName, Font& rFont )
+static sal_Bool ImplOS2NameFontToVCLFont( const char* pFontName, Font& rFont )
 {
     char aNumBuf[10];
     int  nNumBufLen = 0;
@@ -2101,7 +2106,7 @@ void Os2SalFrame::UpdateSettings( AllSet
     // --- Mouse setting ---
     USHORT  nCode;
     USHORT  nClicks;
-    BOOL    bDown;
+    sal_Bool    bDown;
     MouseSettings aMouseSettings = rSettings.GetMouseSettings();
     aMouseSettings.SetDoubleClickTime( WinQuerySysValue( HWND_DESKTOP, SV_DBLCLKTIME ) );
     if ( ImplMouseSysValueToSAL( SV_BEGINDRAG, nCode, nClicks, bDown ) )
@@ -2186,9 +2191,9 @@ void Os2SalFrame::UpdateSettings( AllSet
     // Checked-Color berechnen
     Color   aColor1 = aStyleSettings.GetFaceColor();
     Color   aColor2 = aStyleSettings.GetLightColor();
-    BYTE    nRed    = (BYTE)(((USHORT)aColor1.GetRed()   + (USHORT)aColor2.GetRed())/2);
-    BYTE    nGreen  = (BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2);
-    BYTE    nBlue   = (BYTE)(((USHORT)aColor1.GetBlue()  + (USHORT)aColor2.GetBlue())/2);
+    PM_BYTE    nRed    = (PM_BYTE)(((USHORT)aColor1.GetRed()   + (USHORT)aColor2.GetRed())/2);
+    PM_BYTE    nGreen  = (PM_BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2);
+    PM_BYTE    nBlue   = (PM_BYTE)(((USHORT)aColor1.GetBlue()  + (USHORT)aColor2.GetBlue())/2);
     aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) );
 
     // Fonts updaten
@@ -2366,7 +2371,7 @@ static long ImplHandleMouseMsg( HWND hWn
     SalMouseEvent   aMouseEvt;
     long            nRet;
     USHORT          nEvent;
-    BOOL            bCall = TRUE;
+    sal_Bool            bCall = TRUE;
     USHORT          nFlags = SHORT2FROMMP( nMP2 );
     Os2SalFrame* pFrame = GetWindowPtr( hWnd );
     if ( !pFrame )
@@ -2660,7 +2665,7 @@ static USHORT ImplSalGetKeyCode( Os2SalF
 
 static void ImplUpdateInputLang( Os2SalFrame* pFrame )
 {
-    BOOL 	bLanguageChange = FALSE;
+    sal_Bool 	bLanguageChange = FALSE;
     ULONG 	nLang = 0;
 	APIRET	rc;
 	UconvObject  uconv_object = NULL;
@@ -2724,7 +2729,7 @@ LanguageType Os2SalFrame::GetInputLangua
 
 // -----------------------------------------------------------------------
 
-BOOL Os2SalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& )
+sal_Bool Os2SalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& )
 {
     // not supported yet
     return FALSE;
@@ -2846,7 +2851,7 @@ static long ImplHandleKeyMsg( HWND hWnd,
 
 static bool ImplHandlePaintMsg( HWND hWnd )
 {
-    BOOL bMutex = FALSE;
+    sal_Bool bMutex = FALSE;
 
     if ( ImplSalYieldMutexTryToAcquire() )
         bMutex = TRUE;
@@ -3238,7 +3243,7 @@ static long ImplHandleIMEConversion( Os2
                 xub_Unicode*     pBuf = NULL;
                 ULONG    nAttrBufLen = 0;
                 PM_BYTE*    pAttrBuf = NULL;
-                BOOL        bLastCursor = FALSE;
+                sal_Bool        bLastCursor = FALSE;
                 if ( nMP2 & IMR_RESULT_RESULTSTRING )
                 {
                     pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, 0, &nBufLen );
@@ -3452,7 +3457,7 @@ MRESULT EXPENTRY SalFrameWndProc( HWND h
 {
     Os2SalFrame*   	pFrame      = (Os2SalFrame*)GetWindowPtr( hWnd );
     MRESULT     	nRet        = (MRESULT)0;
-    BOOL        	bDef     	= TRUE;
+    sal_Bool        	bDef     	= TRUE;
 	bool 			bCheckTimers= false;
 
 #if OSL_DEBUG_LEVEL>10

Added: incubator/ooo/trunk/main/vcl/os2/source/window/salmenu.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/window/salmenu.cxx?rev=1200700&view=auto
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/window/salmenu.cxx (added)
+++ incubator/ooo/trunk/main/vcl/os2/source/window/salmenu.cxx Fri Nov 11 02:37:05 2011
@@ -0,0 +1,124 @@
+/*************************************************************************
+
+   Copyright 2011 Yuri Dario <mc6530@mclink.it>
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ ************************************************************************/
+
+#define INCL_DOS
+#define INCL_PM
+#define INCL_WIN
+#include <svpm.h>
+
+#include "os2/saldata.hxx"
+#include "os2/salinst.h"
+#include "os2/salmenu.h"
+
+
+// =======================================================================
+
+// Os2SalInst factory methods
+
+SalMenu* Os2SalInstance::CreateMenu( sal_Bool bMenuBar, Menu* )
+{
+    return NULL;  // no support for native menues
+}
+
+void Os2SalInstance::DestroyMenu( SalMenu* pSalMenu )
+{
+    delete pSalMenu;
+}
+
+
+SalMenuItem* Os2SalInstance::CreateMenuItem( const SalItemParams* pItemData )
+{
+    return NULL;  // no support for native menues
+}
+
+void Os2SalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem )
+{
+    delete pSalMenuItem;
+}
+
+
+// =======================================================================
+
+
+/*
+ * Os2SalMenu
+ */
+
+
+Os2SalMenu::~Os2SalMenu()
+{
+}
+
+sal_Bool Os2SalMenu::VisibleMenuBar()
+{
+    return FALSE; 
+}
+
+void Os2SalMenu::SetFrame( const SalFrame *pFrame )
+{
+}
+
+void Os2SalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
+{
+}
+
+void Os2SalMenu::RemoveItem( unsigned nPos )
+{
+}
+
+void Os2SalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos )
+{
+}
+
+void Os2SalMenu::CheckItem( unsigned nPos, sal_Bool bCheck )
+{
+}
+
+void Os2SalMenu::EnableItem( unsigned nPos, sal_Bool bEnable )
+{
+}
+
+void Os2SalMenu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage )
+{
+}
+
+void Os2SalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText )
+{
+}
+
+void Os2SalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName )
+{
+}
+
+void Os2SalMenu::GetSystemMenuData( SystemMenuData* pData )
+{
+}
+
+// =======================================================================
+
+/*
+ * SalMenuItem
+ */
+
+
+Os2SalMenuItem::~Os2SalMenuItem()
+{
+}
+
+// -------------------------------------------------------------------
+

Modified: incubator/ooo/trunk/main/vcl/os2/source/window/salobj.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/window/salobj.cxx?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/window/salobj.cxx (original)
+++ incubator/ooo/trunk/main/vcl/os2/source/window/salobj.cxx Fri Nov 11 02:37:05 2011
@@ -23,15 +23,21 @@
 
 #include <svpm.h>
 
-#define _SV_SALOBJ_CXX
-#include <saldata.hxx>
-#include <salinst.h>
-#include <salframe.h>
-#include <salobj.h>
+#include <string.h>
+
+#include <tools/debug.hxx>
+#include <tools/svwin.h>
+
+#include "vcl/svapp.hxx"
+
+#include "os2/saldata.hxx"
+#include "os2/salinst.h"
+#include "os2/salframe.h"
+#include "os2/salobj.h"
 
 // =======================================================================
 
-static BOOL ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild )
+static sal_Bool ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild )
 {
 	if ( hWndParent == hWndChild )
 		return TRUE;
@@ -66,7 +72,7 @@ static Os2SalObject* ImplFindOs2SalObjec
 
 // =======================================================================
 
-BOOL EXPENTRY SalSysMsgProc( HAB /* hAB */, QMSG* pMsg, ULONG /* fs */ )
+sal_Bool EXPENTRY SalSysMsgProc( HAB /* hAB */, QMSG* pMsg, ULONG /* fs */ )
 {
 	if ( (pMsg->msg == WM_BUTTON1DOWN) ||
 		 (pMsg->msg == WM_BUTTON2DOWN) ||
@@ -484,7 +490,7 @@ void Os2SalObject::EndSetClipRegion()
 void Os2SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
 {
 	ULONG  nStyle = 0;
-	BOOL   bVisible = WinIsWindowVisible( mhWnd );
+	sal_Bool   bVisible = WinIsWindowVisible( mhWnd );
 	if ( bVisible )
 	{
 		WinShowWindow( mhWnd, FALSE );
@@ -498,14 +504,14 @@ void Os2SalObject::SetPosSize( long nX, 
 
 // -----------------------------------------------------------------------
 
-void Os2SalObject::Show( BOOL bVisible )
+void Os2SalObject::Show( sal_Bool bVisible )
 {
 	WinShowWindow( mhWnd, bVisible );
 }
 
 // -----------------------------------------------------------------------
 
-void Os2SalObject::Enable( BOOL bEnable )
+void Os2SalObject::Enable( sal_Bool bEnable )
 {
 	// Im Gegensatz zu Windows disablen wir das Childfenster,
 	// da ansonsten unser Clippen nicht mehr funktioniert, da

Modified: incubator/ooo/trunk/main/vcl/source/window/menu.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/window/menu.cxx?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/window/menu.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/window/menu.cxx Fri Nov 11 02:37:05 2011
@@ -100,7 +100,8 @@ DBG_NAME( Menu )
 
 #ifdef OS2
 
-#include <xwphook.h>
+#include "svsys.h"
+#include "os2/xwphook.h"
 
 // return sal_True if hilite should be executed: left mouse button down
 // or xwp mouse hook enabled

Modified: incubator/ooo/trunk/main/vcl/workben/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/workben/makefile.mk?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/workben/makefile.mk (original)
+++ incubator/ooo/trunk/main/vcl/workben/makefile.mk Fri Nov 11 02:37:05 2011
@@ -70,10 +70,11 @@ APP1STDLIBS=	$(CPPULIB)			\
 
 APP2TARGET= outdevgrind
 APP2OBJS=	\
-	$(OBJ)$/outdevgrind.obj $(OBJ)$/salmain.obj
+	$(OBJ)$/outdevgrind.obj 
 
 APP2NOSAL=		TRUE
 APP2STDLIBS=$(TOOLSLIB) 		\
+			vclmain.lib \
 			$(COMPHELPERLIB)	\
 			$(CPPULIB)			\
 			$(CPPUHELPERLIB)	\

Modified: incubator/ooo/trunk/main/vcl/workben/svdem.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/workben/svdem.cxx?rev=1200700&r1=1200699&r2=1200700&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/workben/svdem.cxx (original)
+++ incubator/ooo/trunk/main/vcl/workben/svdem.cxx Fri Nov 11 02:37:05 2011
@@ -51,7 +51,8 @@ SAL_IMPLEMENT_MAIN()
     tools::extendApplicationEnvironment();
 
     Reference< XMultiServiceFactory > xMS;
-    xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
+    //xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
+    xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
 
     InitVCL( xMS );
     ::Main();



Mime
View raw message