diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-18 15:55:08 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-18 15:55:08 +0100 |
commit | 4fdd55226d2972e3a256426db3122ac23b0615c6 (patch) | |
tree | 23f5b3a68382d6d3b8db0cb5e2537ed74a228d7c /vcl/win/source | |
parent | c3d5444d84e18fa82235bb9d419861ac5e54f544 (diff) | |
parent | e1028d9225bc47922c387aa462887c7643bc6c40 (diff) |
Merge remote-tracking branch 'origin/integration/dev300_m101'
Conflicts:
comphelper/source/misc/servicedecl.cxx
i18npool/source/breakiterator/breakiteratorImpl.cxx
l10ntools/scripts/localize.pl
svl/source/items/itemset.cxx
svl/source/memtools/svarray.cxx
svl/source/numbers/zformat.cxx
svtools/source/brwbox/brwbox1.cxx
tools/source/stream/strmwnt.cxx
vcl/inc/vcl/graphite_adaptors.hxx
vcl/inc/vcl/graphite_layout.hxx
vcl/inc/vcl/graphite_serverfont.hxx
vcl/source/control/imgctrl.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev3.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/graphite_adaptors.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/window/winproc.cxx
vcl/unx/source/fontmanager/fontconfig.cxx
Diffstat (limited to 'vcl/win/source')
31 files changed, 975 insertions, 739 deletions
diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx index 260fdd561f4f..374c7b4922b3 100644 --- a/vcl/win/source/app/saldata.cxx +++ b/vcl/win/source/app/saldata.cxx @@ -55,7 +55,7 @@ rtl_TextEncoding ImplSalGetSystemEncoding() // ----------------------------------------------------------------------- -ByteString ImplSalGetWinAnsiString( const UniString& rStr, BOOL bFileName ) +ByteString ImplSalGetWinAnsiString( const UniString& rStr, sal_Bool bFileName ) { rtl_TextEncoding eEncoding = ImplSalGetSystemEncoding(); if ( bFileName ) @@ -118,28 +118,28 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ) // ======================================================================= -WIN_BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) +BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { return PostMessageW( hWnd, nMsg, wParam, lParam ); } // ----------------------------------------------------------------------- -WIN_BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) +BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { return SendMessageW( hWnd, nMsg, wParam, lParam ); } // ----------------------------------------------------------------------- -WIN_BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ) +BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ) { return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax ); } // ----------------------------------------------------------------------- -WIN_BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) +BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) { return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg ); } diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index e25d1b8a52e4..020e555d8498 100644 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx @@ -71,7 +71,7 @@ WinSalSystem::~WinSalSystem() // ----------------------------------------------------------------------- -static WIN_BOOL CALLBACK ImplEnumMonitorProc( HMONITOR hMonitor, +static BOOL CALLBACK ImplEnumMonitorProc( HMONITOR hMonitor, HDC hDC, LPRECT lpRect, LPARAM dwData ) @@ -82,7 +82,7 @@ static WIN_BOOL CALLBACK ImplEnumMonitorProc( HMONITOR hMonitor, reinterpret_cast<sal_IntPtr>(lpRect) ); } -BOOL WinSalSystem::handleMonitorCallback( sal_IntPtr hMonitor, sal_IntPtr, sal_IntPtr ) +sal_Bool WinSalSystem::handleMonitorCallback( sal_IntPtr hMonitor, sal_IntPtr, sal_IntPtr ) { MONITORINFOEXW aInfo; aInfo.cbSize = sizeof( aInfo ); @@ -107,7 +107,7 @@ BOOL WinSalSystem::handleMonitorCallback( sal_IntPtr hMonitor, sal_IntPtr, sal_I m_nPrimary = it->second; } } - return TRUE; + return sal_True; } void WinSalSystem::clearMonitors() diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 5e3999e83d7b..e0935a6d956a 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -48,7 +48,7 @@ #include <salobj.h> #include <vcl/salsys.hxx> #include <saltimer.h> -#include <vcl/salatype.hxx> +#include <vcl/apptypes.hxx> #include <salbmp.h> #include <vcl/salimestatus.hxx> #include <vcl/timer.hxx> @@ -68,12 +68,10 @@ #pragma warning( disable: 4917 ) #endif -#define ULONG WIN_ULONG #include <GdiPlus.h> #include <GdiPlusEnums.h> #include <GdiPlusColor.h> #include <Shlobj.h> -#undef ULONG #if defined _MSC_VER #pragma warning(pop) @@ -111,7 +109,7 @@ class SalYieldMutex : public vcl::SolarMutexObject { public: // for ImplSalYield() WinSalInstance* mpInstData; - ULONG mnCount; + sal_uLong mnCount; DWORD mnThreadId; public: @@ -121,7 +119,7 @@ public: virtual void SAL_CALL release(); virtual sal_Bool SAL_CALL tryToAcquire(); - ULONG GetAcquireCount( ULONG nThreadId ); + sal_uLong GetAcquireCount( sal_uLong nThreadId ); }; // ----------------------------------------------------------------------- @@ -200,7 +198,7 @@ sal_Bool SAL_CALL SalYieldMutex::tryToAcquire() // ----------------------------------------------------------------------- -ULONG SalYieldMutex::GetAcquireCount( ULONG nThreadId ) +sal_uLong SalYieldMutex::GetAcquireCount( sal_uLong nThreadId ) { if ( nThreadId == mnThreadId ) return mnCount; @@ -226,7 +224,7 @@ void ImplSalYieldMutexAcquireWithWait() { // Wenn wir den Mutex nicht bekommen, muessen wir solange // warten, bis wir Ihn bekommen - BOOL bAcquire = FALSE; + sal_Bool bAcquire = FALSE; do { if ( pInst->mpSalYieldMutex->tryToAcquire() ) @@ -259,7 +257,7 @@ void ImplSalYieldMutexAcquireWithWait() // ----------------------------------------------------------------------- -BOOL ImplSalYieldMutexTryToAcquire() +sal_Bool ImplSalYieldMutexTryToAcquire() { WinSalInstance* pInst = GetSalData()->mpFirstInstance; if ( pInst ) @@ -291,15 +289,15 @@ void ImplSalYieldMutexRelease() // ----------------------------------------------------------------------- -ULONG ImplSalReleaseYieldMutex() +sal_uLong ImplSalReleaseYieldMutex() { WinSalInstance* pInst = GetSalData()->mpFirstInstance; if ( !pInst ) return 0; SalYieldMutex* pYieldMutex = pInst->mpSalYieldMutex; - ULONG nCount = pYieldMutex->GetAcquireCount( GetCurrentThreadId() ); - ULONG n = nCount; + sal_uLong nCount = pYieldMutex->GetAcquireCount( GetCurrentThreadId() ); + sal_uLong n = nCount; while ( n ) { pYieldMutex->release(); @@ -311,7 +309,7 @@ ULONG ImplSalReleaseYieldMutex() // ----------------------------------------------------------------------- -void ImplSalAcquireYieldMutex( ULONG nCount ) +void ImplSalAcquireYieldMutex( sal_uLong nCount ) { WinSalInstance* pInst = GetSalData()->mpFirstInstance; if ( !pInst ) @@ -327,10 +325,9 @@ void ImplSalAcquireYieldMutex( ULONG nCount ) // ----------------------------------------------------------------------- -#ifdef DBG_UTIL - -void ImplDbgTestSolarMutex() +bool WinSalInstance::CheckYieldMutex() { + bool bRet = true; SalData* pSalData = GetSalData(); DWORD nCurThreadId = GetCurrentThreadId(); if ( pSalData->mnAppThreadId != nCurThreadId ) @@ -340,7 +337,7 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - OSL_FAIL( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" ); + bRet = false; } } } @@ -351,14 +348,13 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - OSL_FAIL( "SolarMutex not locked in the main thread" ); + bRet = false; } } } + return bRet; } -#endif - // ======================================================================= void SalData::initKeyCodeMap() @@ -443,9 +439,12 @@ SalData::SalData() mpFirstIcon = 0; // icon cache, points to first icon, NULL if none mpTempFontItem = 0; mbThemeChanged = FALSE; // true if visual theme was changed: throw away theme handles + mbThemeMenuSupport = FALSE; // init with NULL gdiplusToken = 0; + maDwmLib = 0; + mpDwmIsCompositionEnabled = 0; initKeyCodeMap(); @@ -569,8 +568,7 @@ SalInstance* CreateSalInstance() return NULL; } - HWND hComWnd; - hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW, + HWND hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW, L"", WS_POPUP, 0, 0, 0, 0, 0, 0, pSalData->mhInst, NULL ); if ( !hComWnd ) @@ -638,14 +636,14 @@ osl::SolarMutex* WinSalInstance::GetYieldMutex() // ----------------------------------------------------------------------- -ULONG WinSalInstance::ReleaseYieldMutex() +sal_uLong WinSalInstance::ReleaseYieldMutex() { return ImplSalReleaseYieldMutex(); } // ----------------------------------------------------------------------- -void WinSalInstance::AcquireYieldMutex( ULONG nCount ) +void WinSalInstance::AcquireYieldMutex( sal_uLong nCount ) { ImplSalAcquireYieldMutex( nCount ); } @@ -667,7 +665,7 @@ static void ImplSalDispatchMessage( MSG* pMsg ) // ----------------------------------------------------------------------- -void ImplSalYield( BOOL bWait, BOOL bHandleAllCurrentEvents ) +void ImplSalYield( sal_Bool bWait, sal_Bool bHandleAllCurrentEvents ) { MSG aMsg; bool bWasMsg = false, bOneEvent = false; @@ -677,8 +675,12 @@ void ImplSalYield( BOOL bWait, BOOL bHandleAllCurrentEvents ) { if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) ) { - TranslateMessage( &aMsg ); - ImplSalDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplSalDispatchMessage( &aMsg ); + } + bOneEvent = bWasMsg = true; } else @@ -689,8 +691,11 @@ void ImplSalYield( BOOL bWait, BOOL bHandleAllCurrentEvents ) { if ( ImplGetMessage( &aMsg, 0, 0, 0 ) ) { - TranslateMessage( &aMsg ); - ImplSalDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplSalDispatchMessage( &aMsg ); + } } } } @@ -702,8 +707,8 @@ void WinSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) SalYieldMutex* pYieldMutex = mpSalYieldMutex; SalData* pSalData = GetSalData(); DWORD nCurThreadId = GetCurrentThreadId(); - ULONG nCount = pYieldMutex->GetAcquireCount( nCurThreadId ); - ULONG n = nCount; + sal_uLong nCount = pYieldMutex->GetAcquireCount( nCurThreadId ); + sal_uLong n = nCount; while ( n ) { pYieldMutex->release(); @@ -760,7 +765,7 @@ LRESULT CALLBACK SalComWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar rDef = FALSE; break; case SAL_MSG_THREADYIELD: - ImplSalYield( (BOOL)wParam, (BOOL)lParam ); + ImplSalYield( (sal_Bool)wParam, (sal_Bool)lParam ); rDef = FALSE; break; // If we get this message, because another GetMessage() call @@ -775,11 +780,11 @@ LRESULT CALLBACK SalComWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar rDef = FALSE; break; case SAL_MSG_STARTTIMER: - ImplSalStartTimer( (ULONG) lParam, FALSE ); + ImplSalStartTimer( (sal_uLong) lParam, FALSE ); rDef = FALSE; break; case SAL_MSG_CREATEFRAME: - nRet = (LRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (HWND)lParam, (ULONG)wParam ); + nRet = (LRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (HWND)lParam, (sal_uLong)wParam ); rDef = FALSE; break; case SAL_MSG_RECREATEHWND: @@ -894,7 +899,7 @@ LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPa // ----------------------------------------------------------------------- -bool WinSalInstance::AnyInput( USHORT nType ) +bool WinSalInstance::AnyInput( sal_uInt16 nType ) { MSG aMsg; @@ -976,7 +981,7 @@ bool WinSalInstance::AnyInput( USHORT nType ) // ----------------------------------------------------------------------- -void SalTimer::Start( ULONG nMS ) +void SalTimer::Start( sal_uLong nMS ) { // Um auf Main-Thread umzuschalten SalData* pSalData = GetSalData(); @@ -993,7 +998,7 @@ void SalTimer::Start( ULONG nMS ) // ----------------------------------------------------------------------- -SalFrame* WinSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle ) +SalFrame* WinSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, sal_uLong nSalFrameStyle ) { // Um auf Main-Thread umzuschalten return (SalFrame*)ImplSendMessage( mhComWnd, SAL_MSG_CREATEFRAME, nSalFrameStyle, (LPARAM)pSystemParentData->hWnd ); @@ -1001,7 +1006,7 @@ SalFrame* WinSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, // ----------------------------------------------------------------------- -SalFrame* WinSalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle ) +SalFrame* WinSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nSalFrameStyle ) { // Um auf Main-Thread umzuschalten HWND hWndParent; @@ -1023,7 +1028,7 @@ void WinSalInstance::DestroyFrame( SalFrame* pFrame ) SalObject* WinSalInstance::CreateObject( SalFrame* pParent, SystemWindowData* /*pWindowData*/, // SystemWindowData meaningless on Windows - BOOL /*bShow*/ ) + sal_Bool /*bShow*/ ) { // Um auf Main-Thread umzuschalten return (SalObject*)ImplSendMessage( mhComWnd, SAL_MSG_CREATEOBJECT, 0, (LPARAM)static_cast<WinSalFrame*>(pParent) ); diff --git a/vcl/win/source/app/salshl.cxx b/vcl/win/source/app/salshl.cxx index 136474e67f73..5dcc4b67da4e 100644 --- a/vcl/win/source/app/salshl.cxx +++ b/vcl/win/source/app/salshl.cxx @@ -44,15 +44,15 @@ extern "C" { #ifdef __MINGW32__ -BOOL WINAPI DllMain( HINSTANCE hInst, DWORD nReason, LPVOID pReserved ) +sal_Bool WINAPI DllMain( HINSTANCE hInst, DWORD nReason, LPVOID pReserved ) #else #ifdef ICC int _CRT_init(void); #else -WIN_BOOL WINAPI _CRT_INIT( HINSTANCE hInst, DWORD nReason, LPVOID pReserved ); +BOOL WINAPI _CRT_INIT( HINSTANCE hInst, DWORD nReason, LPVOID pReserved ); #endif -WIN_BOOL WINAPI LibMain( HINSTANCE hInst, DWORD nReason, LPVOID pReserved ) +BOOL WINAPI LibMain( HINSTANCE hInst, DWORD nReason, LPVOID pReserved ) #endif { // Unsere DLL-Initialisierung @@ -103,7 +103,7 @@ HBITMAP ImplLoadSalBitmap( int nId ) // ----------------------------------------------------------------------- -BOOL ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon ) +sal_Bool ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon ) { DBG_ASSERT( aSalShlData.mhInst, "no DLL instance handle" ); diff --git a/vcl/win/source/app/saltimer.cxx b/vcl/win/source/app/saltimer.cxx index 2f57bf810bd0..29caaef3a5c3 100644 --- a/vcl/win/source/app/saltimer.cxx +++ b/vcl/win/source/app/saltimer.cxx @@ -43,7 +43,7 @@ // ======================================================================= -void ImplSalStartTimer( ULONG nMS, BOOL bMutex ) +void ImplSalStartTimer( sal_uLong nMS, sal_Bool bMutex ) { SalData* pSalData = GetSalData(); @@ -52,7 +52,7 @@ void ImplSalStartTimer( ULONG nMS, BOOL bMutex ) if ( !bMutex ) pSalData->mnTimerOrgMS = nMS; - // Periode darf nicht zu gross sein, da Windows mit USHORT arbeitet + // Periode darf nicht zu gross sein, da Windows mit sal_uInt16 arbeitet if ( nMS > MAX_SYSPERIOD ) nMS = MAX_SYSPERIOD; @@ -71,7 +71,7 @@ WinSalTimer::~WinSalTimer() { } -void WinSalTimer::Start( ULONG nMS ) +void WinSalTimer::Start( sal_uLong nMS ) { // switch to main thread SalData* pSalData = GetSalData(); diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index b201bf7c19b9..4c61358d727a 100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx @@ -120,7 +120,7 @@ bool WinSalBitmap::Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ) // ------------------------------------------------------------------ -bool WinSalBitmap::Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ) +bool WinSalBitmap::Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) { bool bRet = FALSE; @@ -213,7 +213,7 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, SalGraphics* pSGraphics ) // ------------------------------------------------------------------ -bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, USHORT nNewBitCount ) +bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, sal_uInt16 nNewBitCount ) { bool bRet = FALSE; @@ -285,9 +285,9 @@ void WinSalBitmap::Destroy() // ------------------------------------------------------------------ -USHORT WinSalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB ) +sal_uInt16 WinSalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB ) { - USHORT nColors = 0; + sal_uInt16 nColors = 0; if( hDIB ) { @@ -299,7 +299,7 @@ USHORT WinSalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB ) if( pBIH->biBitCount <= 8 ) { if ( pBIH->biClrUsed ) - nColors = (USHORT) pBIH->biClrUsed; + nColors = (sal_uInt16) pBIH->biClrUsed; else nColors = 1 << pBIH->biBitCount; } @@ -315,7 +315,7 @@ USHORT WinSalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB ) // ------------------------------------------------------------------ -HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBits, const BitmapPalette& rPal ) +HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBits, const BitmapPalette& rPal ) { DBG_ASSERT( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 16 || nBits == 24, "Unsupported BitCount!" ); @@ -323,8 +323,8 @@ HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBits, const Bitm if ( rSize.Width() && rSize.Height() ) { - const ULONG nImageSize = AlignedWidth4Bytes( nBits * rSize.Width() ) * rSize.Height(); - const USHORT nColors = ( nBits <= 8 ) ? ( 1 << nBits ) : 0; + const sal_uLong nImageSize = AlignedWidth4Bytes( nBits * rSize.Width() ) * rSize.Height(); + const sal_uInt16 nColors = ( nBits <= 8 ) ? ( 1 << nBits ) : 0; hDIB = GlobalAlloc( GHND, sizeof( BITMAPINFOHEADER ) + nColors * sizeof( RGBQUAD ) + nImageSize ); @@ -347,7 +347,7 @@ HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBits, const Bitm if ( nColors ) { - const USHORT nMinCount = Min( nColors, rPal.GetEntryCount() ); + const sal_uInt16 nMinCount = Min( nColors, rPal.GetEntryCount() ); if( nMinCount ) memcpy( pBI->bmiColors, rPal.ImplGetColorBuffer(), nMinCount * sizeof( RGBQUAD ) ); @@ -368,7 +368,7 @@ HANDLE WinSalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB ) if ( bDIB && hHdl ) { - const ULONG nSize = GlobalSize( hHdl ); + const sal_uLong nSize = GlobalSize( hHdl ); if ( (hCopy = GlobalAlloc( GHND, nSize )) != 0 ) { @@ -426,8 +426,8 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( bool /*bReadOnly*/ ) { PBITMAPINFO pNewBI = (PBITMAPINFO) GlobalLock( hNewDIB ); PBITMAPINFOHEADER pNewBIH = (PBITMAPINFOHEADER) pNewBI; - const USHORT nColorCount = ImplGetDIBColorCount( hNewDIB ); - const ULONG nOffset = *(DWORD*) pBI + nColorCount * sizeof( RGBQUAD ); + const sal_uInt16 nColorCount = ImplGetDIBColorCount( hNewDIB ); + const sal_uLong nOffset = *(DWORD*) pBI + nColorCount * sizeof( RGBQUAD ); BYTE* pOldBits = (PBYTE) pBI + nOffset; BYTE* pNewBits = (PBYTE) pNewBI + nOffset; @@ -460,11 +460,11 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( bool /*bReadOnly*/ ) pBuffer->mnWidth = maSize.Width(); pBuffer->mnHeight = maSize.Height(); pBuffer->mnScanlineSize = AlignedWidth4Bytes( maSize.Width() * pBIH->biBitCount ); - pBuffer->mnBitCount = (USHORT) pBIH->biBitCount; + pBuffer->mnBitCount = (sal_uInt16) pBIH->biBitCount; if( pBuffer->mnBitCount <= 8 ) { - const USHORT nPalCount = ImplGetDIBColorCount( mhDIB ); + const sal_uInt16 nPalCount = ImplGetDIBColorCount( mhDIB ); pBuffer->maPalette.SetEntryCount( nPalCount ); memcpy( pBuffer->maPalette.ImplGetColorBuffer(), pBI->bmiColors, nPalCount * sizeof( RGBQUAD ) ); @@ -472,7 +472,7 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( bool /*bReadOnly*/ ) } else if( ( pBIH->biBitCount == 16 ) || ( pBIH->biBitCount == 32 ) ) { - ULONG nOffset = 0UL; + sal_uLong nOffset = 0UL; if( pBIH->biCompression == BI_BITFIELDS ) { @@ -516,9 +516,9 @@ void WinSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) if( !bReadOnly && !!pBuffer->maPalette ) { PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB ); - const USHORT nCount = pBuffer->maPalette.GetEntryCount(); - - memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGBQUAD ) ); + const sal_uInt16 nCount = pBuffer->maPalette.GetEntryCount(); + const sal_uInt16 nDIBColorCount = ImplGetDIBColorCount( mhDIB ); + memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), Min( nDIBColorCount, nCount ) * sizeof( RGBQUAD ) ); GlobalUnlock( mhDIB ); } @@ -537,12 +537,12 @@ void WinSalBitmap::ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf, HPBYTE pRLE = (HPBYTE) pSrcBuf; HPBYTE pDIB = (HPBYTE) pDstBuf; HPBYTE pRow = (HPBYTE) pDstBuf; - ULONG nWidthAl = AlignedWidth4Bytes( rSizePixel.Width() * ( bRLE4 ? 4UL : 8UL ) ); + sal_uLong nWidthAl = AlignedWidth4Bytes( rSizePixel.Width() * ( bRLE4 ? 4UL : 8UL ) ); HPBYTE pLast = pDIB + rSizePixel.Height() * nWidthAl - 1; - ULONG nCountByte; - ULONG nRunByte; - ULONG nX = 0; - ULONG i; + sal_uLong nCountByte; + sal_uLong nRunByte; + sal_uLong nX = 0; + sal_uLong i; BYTE cTmp; bool bEndDecoding = FALSE; diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index cac65c8c229b..1e5a4c49eba2 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -38,7 +38,10 @@ #include <tools/debug.hxx> #include <salframe.h> #include <tools/poly.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> #include <rtl/strbuf.hxx> +#include <vcl/region.h> using ::rtl::OStringBuffer; // ======================================================================= @@ -187,7 +190,7 @@ void ImplInitSalGDI() HBITMAP hBmpOld = (HBITMAP) ::SelectObject( hMemDC, hMemBmp ); HBRUSH hMemBrush = ::CreateSolidBrush( PALETTERGB( 175, 171, 169 ) ); HBRUSH hBrushOld = (HBRUSH) ::SelectObject( hMemDC, hMemBrush ); - BOOL bDither16 = TRUE; + sal_Bool bDither16 = TRUE; ::PatBlt( hMemDC, 0, 0, 8, 8, PATCOPY ); const COLORREF aCol( ::GetPixel( hMemDC, 0, 0 ) ); @@ -238,13 +241,13 @@ void ImplInitSalGDI() BYTE nR, nG, nB; PALETTEENTRY* pPalEntry; LOGPALETTE* pLogPal; - const USHORT nDitherPalCount = DITHER_PAL_COUNT; - ULONG nTotalCount = DITHER_MAX_SYSCOLOR + nDitherPalCount + DITHER_EXTRA_COLORS; + const sal_uInt16 nDitherPalCount = DITHER_PAL_COUNT; + sal_uLong nTotalCount = DITHER_MAX_SYSCOLOR + nDitherPalCount + DITHER_EXTRA_COLORS; // create logical palette pLogPal = (LOGPALETTE*) new char[ sizeof( LOGPALETTE ) + ( nTotalCount * sizeof( PALETTEENTRY ) ) ]; pLogPal->palVersion = 0x0300; - pLogPal->palNumEntries = (USHORT) nTotalCount; + pLogPal->palNumEntries = (sal_uInt16) nTotalCount; pPalEntry = pLogPal->palPalEntry; // Standard colors @@ -402,7 +405,7 @@ static int ImplIsPaletteEntry( BYTE nRed, BYTE nGreen, BYTE nBlue ) PALETTEENTRY* pPalEntry = aImplSalSysPalEntryAry; // standard palette color? - for ( USHORT i = 0; i < DITHER_MAX_SYSCOLOR; i++, pPalEntry++ ) + for ( sal_uInt16 i = 0; i < DITHER_MAX_SYSCOLOR; i++, pPalEntry++ ) { if( pPalEntry->peRed == nRed && pPalEntry->peGreen == nGreen && pPalEntry->peBlue == nBlue ) return TRUE; @@ -546,7 +549,7 @@ void ImplSalDeInitGraphics( WinSalGraphics* pData ) // ======================================================================= -HDC ImplGetCachedDC( ULONG nID, HBITMAP hBmp ) +HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp ) { SalData* pSalData = GetSalData(); HDCCache* pC = &pSalData->mpHDCCache[ nID ]; @@ -580,7 +583,7 @@ HDC ImplGetCachedDC( ULONG nID, HBITMAP hBmp ) // ======================================================================= -void ImplReleaseCachedDC( ULONG nID ) +void ImplReleaseCachedDC( sal_uLong nID ) { SalData* pSalData = GetSalData(); HDCCache* pC = &pSalData->mpHDCCache[ nID ]; @@ -593,7 +596,7 @@ void ImplReleaseCachedDC( ULONG nID ) void ImplClearHDCCache( SalData* pData ) { - for( ULONG i = 0; i < CACHESIZE_HDC; i++ ) + for( sal_uLong i = 0; i < CACHESIZE_HDC; i++ ) { HDCCache* pC = &pData->mpHDCCache[ i ]; @@ -616,21 +619,21 @@ void ImplClearHDCCache( SalData* pData ) // might also contain bezier control points for the PolyDraw() GDI method // Make sure pWinPointAry and pWinFlagAry are big enough void ImplPreparePolyDraw( bool bCloseFigures, - ULONG nPoly, + sal_uLong nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry, POINT* pWinPointAry, BYTE* pWinFlagAry ) { - ULONG nCurrPoly; + sal_uLong nCurrPoly; for( nCurrPoly=0; nCurrPoly<nPoly; ++nCurrPoly ) { const POINT* pCurrPoint = reinterpret_cast<const POINT*>( *pPtAry++ ); const BYTE* pCurrFlag = *pFlgAry++; const sal_uInt32 nCurrPoints = *pPoints++; const bool bHaveFlagArray( pCurrFlag ); - ULONG nCurrPoint; + sal_uLong nCurrPoint; if( nCurrPoints ) { @@ -686,11 +689,11 @@ void ImplPreparePolyDraw( bool bCloseFigures, // ======================================================================= // #100127# draw an array of points which might also contain bezier control points -void ImplRenderPath( HDC hdc, ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +void ImplRenderPath( HDC hdc, sal_uLong nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) { if( nPoints ) { - USHORT i; + sal_uInt16 i; // TODO: profile whether the following options are faster: // a) look ahead and draw consecutive bezier or line segments by PolyBezierTo/PolyLineTo resp. // b) convert our flag array to window's and use PolyDraw @@ -801,9 +804,9 @@ void WinSalGraphics::GetResolution( long& rDPIX, long& rDPIY ) // ----------------------------------------------------------------------- -USHORT WinSalGraphics::GetBitCount() const +sal_uInt16 WinSalGraphics::GetBitCount() const { - return (USHORT)GetDeviceCaps( mhDC, BITSPIXEL ); + return (sal_uInt16)GetDeviceCaps( mhDC, BITSPIXEL ); } // ----------------------------------------------------------------------- @@ -845,7 +848,7 @@ void WinSalGraphics::ResetClipRegion() // ----------------------------------------------------------------------- -void WinSalGraphics::BeginSetClipRegion( ULONG nRectCount ) +bool WinSalGraphics::setClipRegion( const Region& i_rClip ) { if ( mhRegion ) { @@ -853,123 +856,143 @@ void WinSalGraphics::BeginSetClipRegion( ULONG nRectCount ) mhRegion = 0; } - ULONG nRectBufSize = sizeof(RECT)*nRectCount; - if ( nRectCount < SAL_CLIPRECT_COUNT ) + if( i_rClip.HasPolyPolygon() ) { - if ( !mpStdClipRgnData ) - mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))]; - mpClipRgnData = mpStdClipRgnData; + // TODO: ConvertToB2DPolyPolygon actually is kind of const, just it does not advertise it in the header + basegfx::B2DPolyPolygon aPolyPolygon( const_cast<Region&>(i_rClip).ConvertToB2DPolyPolygon() ); + const sal_uInt32 nCount(aPolyPolygon.count()); + + if( nCount ) + { + std::vector< POINT > aPolyPoints; + aPolyPoints.reserve( 1024 ); + std::vector< INT > aPolyCounts( nCount, 0 ); + for(sal_uInt32 a(0); a < nCount; a++) + { + basegfx::B2DPolygon aPoly( aPolyPolygon.getB2DPolygon(a) ); + aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 ); + const sal_uInt32 nPoints = aPoly.count(); + aPolyCounts[a] = nPoints; + for( sal_uInt32 b = 0; b < nPoints; b++ ) + { + basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) ); + POINT aPOINT; + aPOINT.x = (LONG)aPt.getX(); + aPOINT.y = (LONG)aPt.getY(); + aPolyPoints.push_back( aPOINT ); + } + } + mhRegion = CreatePolyPolygonRgn( &aPolyPoints[0], &aPolyCounts[0], nCount, ALTERNATE ); + } } else - mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize]; - mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER ); - mpClipRgnData->rdh.iType = RDH_RECTANGLES; - mpClipRgnData->rdh.nCount = nRectCount; - mpClipRgnData->rdh.nRgnSize = nRectBufSize; - SetRectEmpty( &(mpClipRgnData->rdh.rcBound) ); - mpNextClipRect = (RECT*)(&(mpClipRgnData->Buffer)); - mbFirstClipRect = TRUE; -} - - -// ----------------------------------------------------------------------- - -BOOL WinSalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - if ( nWidth && nHeight ) { - RECT* pRect = mpNextClipRect; - RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound); - long nRight = nX + nWidth; - long nBottom = nY + nHeight; + sal_uLong nRectCount = i_rClip.GetRectCount(); - if ( mbFirstClipRect ) + sal_uLong nRectBufSize = sizeof(RECT)*nRectCount; + if ( nRectCount < SAL_CLIPRECT_COUNT ) { - pBoundRect->left = nX; - pBoundRect->top = nY; - pBoundRect->right = nRight; - pBoundRect->bottom = nBottom; - mbFirstClipRect = FALSE; + if ( !mpStdClipRgnData ) + mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))]; + mpClipRgnData = mpStdClipRgnData; } else + mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize]; + mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER ); + mpClipRgnData->rdh.iType = RDH_RECTANGLES; + mpClipRgnData->rdh.nCount = nRectCount; + mpClipRgnData->rdh.nRgnSize = nRectBufSize; + RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound); + SetRectEmpty( pBoundRect ); + RECT* pNextClipRect = (RECT*)(&(mpClipRgnData->Buffer)); + bool bFirstClipRect = true; + + ImplRegionInfo aInfo; + long nX, nY, nW, nH; + bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); + while( bRegionRect ) { - if ( nX < pBoundRect->left ) - pBoundRect->left = (int)nX; - - if ( nY < pBoundRect->top ) - pBoundRect->top = (int)nY; - - if ( nRight > pBoundRect->right ) - pBoundRect->right = (int)nRight; - - if ( nBottom > pBoundRect->bottom ) - pBoundRect->bottom = (int)nBottom; - } - - pRect->left = (int)nX; - pRect->top = (int)nY; - pRect->right = (int)nRight; - pRect->bottom = (int)nBottom; - mpNextClipRect++; - } - else - { - mpClipRgnData->rdh.nCount--; - mpClipRgnData->rdh.nRgnSize -= sizeof( RECT ); - } - - return TRUE; -} + if ( nW && nH ) + { + long nRight = nX + nW; + long nBottom = nY + nH; -// ----------------------------------------------------------------------- + if ( bFirstClipRect ) + { + pBoundRect->left = nX; + pBoundRect->top = nY; + pBoundRect->right = nRight; + pBoundRect->bottom = nBottom; + bFirstClipRect = false; + } + else + { + if ( nX < pBoundRect->left ) + pBoundRect->left = (int)nX; -bool WinSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) -{ - // TODO: implement and advertise OutDevSupport_B2DClip support - return false; -} + if ( nY < pBoundRect->top ) + pBoundRect->top = (int)nY; -// ----------------------------------------------------------------------- + if ( nRight > pBoundRect->right ) + pBoundRect->right = (int)nRight; -void WinSalGraphics::EndSetClipRegion() -{ - // create clip region from ClipRgnData - if ( mpClipRgnData->rdh.nCount == 1 ) - { - RECT* pRect = &(mpClipRgnData->rdh.rcBound); - mhRegion = CreateRectRgn( pRect->left, pRect->top, - pRect->right, pRect->bottom ); - } - else - { - ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); - mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); + if ( nBottom > pBoundRect->bottom ) + pBoundRect->bottom = (int)nBottom; + } - // if ExtCreateRegion(...) is not supported - if( !mhRegion ) + pNextClipRect->left = (int)nX; + pNextClipRect->top = (int)nY; + pNextClipRect->right = (int)nRight; + pNextClipRect->bottom = (int)nBottom; + pNextClipRect++; + } + else + { + mpClipRgnData->rdh.nCount--; + mpClipRgnData->rdh.nRgnSize -= sizeof( RECT ); + } + bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); + } + // create clip region from ClipRgnData + if ( mpClipRgnData->rdh.nCount == 1 ) { - RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mpClipRgnData; + RECT* pRect = &(mpClipRgnData->rdh.rcBound); + mhRegion = CreateRectRgn( pRect->left, pRect->top, + pRect->right, pRect->bottom ); + } + else if( mpClipRgnData->rdh.nCount > 1 ) + { + sal_uLong nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); + mhRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); - if( pHeader->nCount ) + // if ExtCreateRegion(...) is not supported + if( !mhRegion ) { - RECT* pRect = (RECT*) mpClipRgnData->Buffer; - mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); - pRect++; + RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mpClipRgnData; - for( ULONG n = 1; n < pHeader->nCount; n++, pRect++ ) + if( pHeader->nCount ) { - HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); - CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR ); - DeleteRegion( hRgn ); + RECT* pRect = (RECT*) mpClipRgnData->Buffer; + mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); + pRect++; + + for( sal_uLong n = 1; n < pHeader->nCount; n++, pRect++ ) + { + HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom ); + CombineRgn( mhRegion, mhRegion, hRgn, RGN_OR ); + DeleteRegion( hRgn ); + } } } - } - if ( mpClipRgnData != mpStdClipRgnData ) - delete [] mpClipRgnData; + if ( mpClipRgnData != mpStdClipRgnData ) + delete [] mpClipRgnData; + } } - SelectClipRgn( mhDC, mhRegion ); + if( mhRegion ) + SelectClipRgn( mhDC, mhRegion ); + return mhRegion != 0; } // ----------------------------------------------------------------------- @@ -1004,14 +1027,14 @@ void WinSalGraphics::SetLineColor( SalColor nSalColor ) SALCOLOR_GREEN( nSalColor ), SALCOLOR_BLUE( nSalColor ) ); HPEN hNewPen = 0; - BOOL bStockPen = FALSE; + sal_Bool bStockPen = FALSE; // search for stock pen (only screen, because printer have problems, // when we use stock objects) if ( !mbPrinter ) { SalData* pSalData = GetSalData(); - for ( USHORT i = 0; i < pSalData->mnStockPenCount; i++ ) + for ( sal_uInt16 i = 0; i < pSalData->mnStockPenCount; i++ ) { if ( nPenColor == pSalData->maStockPenColorAry[i] ) { @@ -1088,13 +1111,13 @@ void WinSalGraphics::SetFillColor( SalColor nSalColor ) BYTE nBlue = SALCOLOR_BLUE( nSalColor ); COLORREF nBrushColor = PALETTERGB( nRed, nGreen, nBlue ); HBRUSH hNewBrush = 0; - BOOL bStockBrush = FALSE; + sal_Bool bStockBrush = FALSE; // search for stock brush (only screen, because printer have problems, // when we use stock objects) if ( !mbPrinter ) { - for ( USHORT i = 0; i < pSalData->mnStockBrushCount; i++ ) + for ( sal_uInt16 i = 0; i < pSalData->mnStockBrushCount; i++ ) { if ( nBrushColor == pSalData->maStockBrushColorAry[ i ] ) { @@ -1314,7 +1337,7 @@ void WinSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) // ----------------------------------------------------------------------- -void WinSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ) +void WinSalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ) { // Unter NT koennen wir das Array direkt weiterreichen DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ), @@ -1329,7 +1352,7 @@ void WinSalGraphics::drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ) // ----------------------------------------------------------------------- -void WinSalGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) +void WinSalGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) { // Unter NT koennen wir das Array direkt weiterreichen DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ), @@ -1417,7 +1440,7 @@ void WinSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoint // ----------------------------------------------------------------------- -sal_Bool WinSalGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool WinSalGraphics::drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) { #ifdef USE_GDI_BEZIERS // Unter NT koennen wir das Array direkt weiterreichen @@ -1434,7 +1457,7 @@ sal_Bool WinSalGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtA // ----------------------------------------------------------------------- -sal_Bool WinSalGraphics::drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) +sal_Bool WinSalGraphics::drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) { #ifdef USE_GDI_BEZIERS // Unter NT koennen wir das Array direkt weiterreichen @@ -1494,7 +1517,7 @@ sal_Bool WinSalGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ), "WinSalGraphics::DrawPolyPolygonBezier(): POINT != SalPoint" ); - ULONG nCurrPoly, nTotalPoints; + sal_uLong nCurrPoly, nTotalPoints; const sal_uInt32* pCurrPoints = pPoints; for( nCurrPoly=0, nTotalPoints=0; nCurrPoly<nPoly; ++nCurrPoly ) nTotalPoints += *pCurrPoints++; @@ -1547,11 +1570,11 @@ sal_Bool WinSalGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt #define POSTSCRIPT_BOUNDINGSEARCH 0x1000 // we only try to get the BoundingBox // in the first 4096 bytes -static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize ) +static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, sal_uLong nComp, sal_uLong nSize ) { while ( nComp-- >= nSize ) { - ULONG i; + sal_uLong i; for ( i = 0; i < nSize; i++ ) { if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) ) @@ -1564,9 +1587,9 @@ static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSi return NULL; } -static BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize ) +static sal_Bool ImplGetBoundingBox( double* nNumb, BYTE* pSource, sal_uLong nSize ) { - BOOL bRetValue = FALSE; + sal_Bool bRetValue = FALSE; BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nSize, 14 ); if ( pDest ) { @@ -1581,9 +1604,9 @@ static BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize ) for ( i = 0; ( i < 4 ) && nSizeLeft; i++ ) { int nDivision = 1; - BOOL bDivision = FALSE; - BOOL bNegative = FALSE; - BOOL bValid = TRUE; + sal_Bool bDivision = FALSE; + sal_Bool bNegative = FALSE; + sal_Bool bValid = TRUE; while ( ( --nSizeLeft ) && ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) pDest++; BYTE nByte = *pDest; @@ -1626,9 +1649,9 @@ static BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize ) return bRetValue; } -BOOL WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) +sal_Bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) { - BOOL bRetValue = FALSE; + sal_Bool bRetValue = FALSE; if ( mbPrinter ) { @@ -1642,7 +1665,7 @@ BOOL WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* { OStringBuffer aBuf( POSTSCRIPT_BUFSIZE ); - // reserve place for a USHORT + // reserve place for a sal_uInt16 aBuf.append( "aa" ); // #107797# Write out EPS encapsulation header @@ -1720,7 +1743,7 @@ BOOL WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* // #107797# Write out buffer // ---------------------------------------------------------------------------------- - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); + *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 ); Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); @@ -1728,7 +1751,7 @@ BOOL WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* // ---------------------------------------------------------------------------------- double dM11 = nWidth / ( nBoundingBox[2] - nBoundingBox[0] ); double dM22 = nHeight / (nBoundingBox[1] - nBoundingBox[3] ); - // reserve a USHORT again + // reserve a sal_uInt16 again aBuf.setLength( 2 ); aBuf.append( "\n\n[" ); aBuf.append( dM11 ); @@ -1740,14 +1763,14 @@ BOOL WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* aBuf.append( nY - ( dM22 * nBoundingBox[3] ) ); aBuf.append( "] concat\n" "%%BeginDocument:\n" ); - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); + *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 ); Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); // #107797# Write out actual EPS content // ---------------------------------------------------------------------------------- - ULONG nToDo = nSize; - ULONG nDoNow; + sal_uLong nToDo = nSize; + sal_uLong nDoNow; while ( nToDo ) { nDoNow = nToDo; @@ -1755,9 +1778,9 @@ BOOL WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* nDoNow = POSTSCRIPT_BUFSIZE - 2; // the following is based on the string buffer allocation // of size POSTSCRIPT_BUFSIZE at construction time of aBuf - *((USHORT*)aBuf.getStr()) = (USHORT)nDoNow; + *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)nDoNow; memcpy( (void*)(aBuf.getStr() + 2), (BYTE*)pPtr + nSize - nToDo, nDoNow ); - ULONG nResult = Escape ( mhDC, nEscape, nDoNow + 2, (LPTSTR)aBuf.getStr(), 0 ); + sal_uLong nResult = Escape ( mhDC, nEscape, nDoNow + 2, (LPTSTR)aBuf.getStr(), 0 ); if (!nResult ) break; nToDo -= nResult; @@ -1766,13 +1789,13 @@ BOOL WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* // #107797# Write out EPS encapsulation footer // ---------------------------------------------------------------------------------- - // reserve a USHORT again + // reserve a sal_uInt16 again aBuf.setLength( 2 ); aBuf.append( "%%EndDocument\n" "count op_count_salWin sub {pop} repeat\n" "countdictstack dict_count_salWin sub {end} repeat\n" "b4_Inc_state_salWin restore\n\n" ); - *((USHORT*)aBuf.getStr()) = (USHORT)( aBuf.getLength() - 2 ); + *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 ); Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 ); bRetValue = TRUE; } diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx index b066258c3dac..90123100c7ee 100644 --- a/vcl/win/source/gdi/salgdi2.cxx +++ b/vcl/win/source/gdi/salgdi2.cxx @@ -50,6 +50,9 @@ bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const case OutDevSupport_TransparentRect: bRet = mbVirDev || mbWindow; break; + case OutDevSupport_B2DClip: + bRet = true; + break; case OutDevSupport_B2DDraw: bRet = bAllowForTest; default: break; @@ -146,7 +149,7 @@ void ImplCalcOutSideRgn( const RECT& rSrcRect, void WinSalGraphics::copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, - USHORT nFlags ) + sal_uInt16 nFlags ) { bool bRestoreClipRgn = false; HRGN hOldClipRgn = 0; @@ -343,14 +346,14 @@ void WinSalGraphics::copyArea( long nDestX, long nDestY, void ImplDrawBitmap( HDC hDC, const SalTwoRect* pPosAry, const WinSalBitmap& rSalBitmap, - BOOL bPrinter, int nDrawMode ) + sal_Bool bPrinter, int nDrawMode ) { if( hDC ) { HGLOBAL hDrawDIB; HBITMAP hDrawDDB = rSalBitmap.ImplGethDDB(); WinSalBitmap* pTmpSalBmp = NULL; - BOOL bPrintDDB = ( bPrinter && hDrawDDB ); + sal_Bool bPrintDDB = ( bPrinter && hDrawDDB ); if( bPrintDDB ) { @@ -384,7 +387,7 @@ void ImplDrawBitmap( HDC hDC, HDC hBmpDC = ImplGetCachedDC( CACHED_HDC_DRAW, hDrawDDB ); COLORREF nOldBkColor = RGB(0xFF,0xFF,0xFF); COLORREF nOldTextColor = RGB(0,0,0); - BOOL bMono = ( rSalBitmap.GetBitCount() == 1 ); + sal_Bool bMono = ( rSalBitmap.GetBitCount() == 1 ); if( bMono ) { @@ -666,7 +669,7 @@ SalBitmap* WinSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) HDC hDC = mhDC; HBITMAP hBmpBitmap = CreateCompatibleBitmap( hDC, nDX, nDY ); HDC hBmpDC = ImplGetCachedDC( CACHED_HDC_1, hBmpBitmap ); - BOOL bRet; + sal_Bool bRet; DWORD err = 0; bRet = BitBlt( hBmpDC, 0, 0, (int) nDX, (int) nDY, hDC, (int) nX, (int) nY, SRCCOPY ) ? TRUE : FALSE; @@ -753,7 +756,7 @@ void WinSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInv // ----------------------------------------------------------------------- -void WinSalGraphics::invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nSalFlags ) +void WinSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nSalFlags ) { HPEN hPen; HPEN hOldPen; diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 567ecc8b734b..355cae79377b 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -127,7 +127,7 @@ private: FontAttrMap aFontAttributes; rtl::OUString aCacheFileName; String aBaseURL; - BOOL bModified; + sal_Bool bModified; protected: String OptimizeURL( const String& rURL ) const; @@ -532,9 +532,10 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, // avoid fonts with unknown CMAP subtables for glyph fallback if( !pCharMap || pCharMap->IsDefaultMap() ) return false; + pCharMap->AddReference(); int nMatchCount = 0; - // static const int nMaxMatchCount = 1; // TODO: check more missing characters? + // static const int nMaxMatchCount = 1; // TODO: tolerate more missing characters? const sal_Int32 nStrLen = rMissingChars.getLength(); for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; ++nStrIdx ) { @@ -542,6 +543,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, nMatchCount += pCharMap->HasChar( uChar ); break; // for now } + pCharMap->DeReference(); const bool bHasMatches = (nMatchCount > 0); return bHasMatches; @@ -643,7 +645,7 @@ static CharSet ImplCharSetToSal( BYTE nCharSet ) if ( nCharSet == OEM_CHARSET ) { - UINT nCP = (USHORT)GetOEMCP(); + UINT nCP = (sal_uInt16)GetOEMCP(); switch ( nCP ) { // It is unclear why these two (undefined?) code page numbers are @@ -1192,7 +1194,7 @@ const void * GrFontData::getTable(unsigned int name, size_t *len) const #endif ImplWinFontData::ImplWinFontData( const ImplDevFontAttributes& rDFS, - int nHeight, WIN_BYTE eWinCharSet, WIN_BYTE nPitchAndFamily ) + int nHeight, BYTE eWinCharSet, BYTE nPitchAndFamily ) : ImplFontData( rDFS, 0 ), meWinCharSet( eWinCharSet ), mnPitchAndFamily( nPitchAndFamily ), @@ -1350,11 +1352,10 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const // ----------------------------------------------------------------------- -ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const +const ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const { if( !mpUnicodeMap ) return NULL; - mpUnicodeMap->AddReference(); return mpUnicodeMap; } @@ -1434,6 +1435,7 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const if( !mpUnicodeMap ) mpUnicodeMap = ImplFontCharMap::GetDefaultMap( bIsSymbolFont ); + mpUnicodeMap->AddReference(); } void ImplWinFontData::GetFontCapabilities( HDC hDC ) const @@ -1512,8 +1514,6 @@ int CALLBACK SalEnumQueryFontProcExW( const ENUMLOGFONTEXW*, bool ImplIsFontAvailable( HDC hDC, const UniString& rName ) { - bool bAvailable = false; - // Test, if Font available LOGFONTW aLogFont; memset( &aLogFont, 0, sizeof( aLogFont ) ); @@ -1525,6 +1525,7 @@ bool ImplIsFontAvailable( HDC hDC, const UniString& rName ) memcpy( aLogFont.lfFaceName, rName.GetBuffer(), nNameLen*sizeof( wchar_t ) ); aLogFont.lfFaceName[nNameLen] = 0; + bool bAvailable = false; EnumFontFamiliesExW( hDC, &aLogFont, (FONTENUMPROCW)SalEnumQueryFontProcExW, (LPARAM)(void*)&bAvailable, 0 ); @@ -1679,7 +1680,7 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont return hNewFont; } -USHORT WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel ) +sal_uInt16 WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel ) { // return early if there is no new font if( !pFont ) @@ -1868,12 +1869,12 @@ static void ImplGetAllFontCharSets( WinSalGraphics* pData ) static void ImplAddKerningPairs( WinSalGraphics* pData ) { - ULONG nPairs = ::GetKerningPairsA( pData->mhDC, 0, NULL ); + sal_uLong nPairs = ::GetKerningPairsA( pData->mhDC, 0, NULL ); if ( !nPairs ) return; CHARSETINFO aInfo; - if ( !TranslateCharsetInfo( (DWORD*)(ULONG)GetTextCharset( pData->mhDC ), &aInfo, TCI_SRCCHARSET ) ) + if ( !TranslateCharsetInfo( (DWORD*)(sal_uLong)GetTextCharset( pData->mhDC ), &aInfo, TCI_SRCCHARSET ) ) return; if ( !pData->mpFontKernPairs ) @@ -1888,15 +1889,15 @@ static void ImplAddKerningPairs( WinSalGraphics* pData ) } UINT nCP = aInfo.ciACP; - ULONG nOldPairs = pData->mnFontKernPairCount; + sal_uLong nOldPairs = pData->mnFontKernPairCount; KERNINGPAIR* pTempPair = pData->mpFontKernPairs+pData->mnFontKernPairCount; nPairs = ::GetKerningPairsA( pData->mhDC, nPairs, pTempPair ); - for ( ULONG i = 0; i < nPairs; i++ ) + for ( sal_uLong i = 0; i < nPairs; i++ ) { unsigned char aBuf[2]; wchar_t nChar; int nLen; - BOOL bAdd = TRUE; + sal_Bool bAdd = TRUE; // None-ASCII?, then we must convert the char if ( (pTempPair->wFirst > 125) || (pTempPair->wFirst == 92) ) @@ -1940,7 +1941,7 @@ static void ImplAddKerningPairs( WinSalGraphics* pData ) // TODO: get rid of linear search! KERNINGPAIR* pTempPair2 = pData->mpFontKernPairs; - for ( ULONG j = 0; j < nOldPairs; j++ ) + for ( sal_uLong j = 0; j < nOldPairs; j++ ) { if ( (pTempPair2->wFirst == pTempPair->wFirst) && (pTempPair2->wSecond == pTempPair->wSecond) ) @@ -1965,7 +1966,7 @@ static void ImplAddKerningPairs( WinSalGraphics* pData ) // ----------------------------------------------------------------------- -ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) +sal_uLong WinSalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ) { DBG_ASSERT( sizeof( KERNINGPAIR ) == sizeof( ImplKernPairData ), "WinSalGraphics::GetKernPairs(): KERNINGPAIR != ImplKernPairData" ); @@ -1983,17 +1984,17 @@ ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) int nCount = ::GetKerningPairsW( mhDC, 0, NULL ); if( nCount ) { -#ifdef GCP_KERN_HACK + #ifdef GCP_KERN_HACK pPairs = new KERNINGPAIR[ nCount+1 ]; mpFontKernPairs = pPairs; mnFontKernPairCount = nCount; ::GetKerningPairsW( mhDC, nCount, pPairs ); -#else // GCP_KERN_HACK + #else // GCP_KERN_HACK pPairs = pKernPairs; nCount = (nCount < nPairs) : nCount : nPairs; ::GetKerningPairsW( mhDC, nCount, pPairs ); return nCount; -#endif // GCP_KERN_HACK + #endif // GCP_KERN_HACK } mbFontKernInit = FALSE; @@ -2017,7 +2018,7 @@ ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) // ----------------------------------------------------------------------- -ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const { if( !mpWinFontData[0] ) return ImplFontCharMap::GetDefaultMap(); @@ -2393,8 +2394,8 @@ bool WinSalGraphics::AddTempDevFont( ImplDevFontList* pFontList, */ ImplWinFontData* pFontData = new ImplWinFontData( aDFA, 0, - sal::static_int_cast<WIN_BYTE>(nPreferedCharSet), - sal::static_int_cast<WIN_BYTE>(TMPF_VECTOR|TMPF_TRUETYPE) ); + sal::static_int_cast<BYTE>(nPreferedCharSet), + sal::static_int_cast<BYTE>(TMPF_VECTOR|TMPF_TRUETYPE) ); pFontData->SetFontId( reinterpret_cast<sal_IntPtr>(pFontData) ); pFontList->Add( pFontData ); return true; @@ -2505,7 +2506,7 @@ void WinSalGraphics::GetDevFontSubstList( OutputDevice* ) // ----------------------------------------------------------------------- -BOOL WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) +sal_Bool WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) { HDC hDC = mhDC; @@ -2522,9 +2523,7 @@ BOOL WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) GLYPHMETRICS aGM; aGM.gmptGlyphOrigin.x = aGM.gmptGlyphOrigin.y = 0; aGM.gmBlackBoxX = aGM.gmBlackBoxY = 0; - DWORD nSize = GDI_ERROR; - nSize = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); - + DWORD nSize = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); if( nSize == GDI_ERROR ) return false; @@ -2539,12 +2538,11 @@ BOOL WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) // ----------------------------------------------------------------------- -BOOL WinSalGraphics::GetGlyphOutline( long nIndex, +sal_Bool WinSalGraphics::GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& rB2DPolyPoly ) { rB2DPolyPoly.clear(); - BOOL bRet = FALSE; HDC hDC = mhDC; // use unity matrix @@ -2558,164 +2556,160 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, nIndex &= GF_IDXMASK; GLYPHMETRICS aGlyphMetrics; - DWORD nSize1 = GDI_ERROR; - nSize1 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat ); - + const DWORD nSize1 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat ); if( !nSize1 ) // blank glyphs are ok - bRet = TRUE; - else if( nSize1 != GDI_ERROR ) + return TRUE; + else if( nSize1 == GDI_ERROR ) + return FALSE; + + BYTE* pData = new BYTE[ nSize1 ]; + const DWORD nSize2 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, + &aGlyphMetrics, nSize1, pData, &aMat ); + + if( nSize1 != nSize2 ) + return FALSE; + + // TODO: avoid tools polygon by creating B2DPolygon directly + int nPtSize = 512; + Point* pPoints = new Point[ nPtSize ]; + BYTE* pFlags = new BYTE[ nPtSize ]; + + TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData; + while( (BYTE*)pHeader < pData+nSize2 ) { - BYTE* pData = new BYTE[ nSize1 ]; - DWORD nSize2; - nSize2 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, - &aGlyphMetrics, nSize1, pData, &aMat ); + // only outline data is interesting + if( pHeader->dwType != TT_POLYGON_TYPE ) + break; - if( nSize1 == nSize2 ) - { - bRet = TRUE; + // get start point; next start points are end points + // of previous segment + sal_uInt16 nPnt = 0; - int nPtSize = 512; - Point* pPoints = new Point[ nPtSize ]; - BYTE* pFlags = new BYTE[ nPtSize ]; + long nX = IntTimes256FromFixed( pHeader->pfxStart.x ); + long nY = IntTimes256FromFixed( pHeader->pfxStart.y ); + pPoints[ nPnt ] = Point( nX, nY ); + pFlags[ nPnt++ ] = POLY_NORMAL; - TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData; - while( (BYTE*)pHeader < pData+nSize2 ) + bool bHasOfflinePoints = false; + TTPOLYCURVE* pCurve = (TTPOLYCURVE*)( pHeader + 1 ); + pHeader = (TTPOLYGONHEADER*)( (BYTE*)pHeader + pHeader->cb ); + while( (BYTE*)pCurve < (BYTE*)pHeader ) + { + int nNeededSize = nPnt + 16 + 3 * pCurve->cpfx; + if( nPtSize < nNeededSize ) { - // only outline data is interesting - if( pHeader->dwType != TT_POLYGON_TYPE ) - break; - - // get start point; next start points are end points - // of previous segment - USHORT nPnt = 0; - - long nX = IntTimes256FromFixed( pHeader->pfxStart.x ); - long nY = IntTimes256FromFixed( pHeader->pfxStart.y ); - pPoints[ nPnt ] = Point( nX, nY ); - pFlags[ nPnt++ ] = POLY_NORMAL; - - bool bHasOfflinePoints = false; - TTPOLYCURVE* pCurve = (TTPOLYCURVE*)( pHeader + 1 ); - pHeader = (TTPOLYGONHEADER*)( (BYTE*)pHeader + pHeader->cb ); - while( (BYTE*)pCurve < (BYTE*)pHeader ) + Point* pOldPoints = pPoints; + BYTE* pOldFlags = pFlags; + nPtSize = 2 * nNeededSize; + pPoints = new Point[ nPtSize ]; + pFlags = new BYTE[ nPtSize ]; + for( sal_uInt16 i = 0; i < nPnt; ++i ) { - int nNeededSize = nPnt + 16 + 3 * pCurve->cpfx; - if( nPtSize < nNeededSize ) - { - Point* pOldPoints = pPoints; - BYTE* pOldFlags = pFlags; - nPtSize = 2 * nNeededSize; - pPoints = new Point[ nPtSize ]; - pFlags = new BYTE[ nPtSize ]; - for( USHORT i = 0; i < nPnt; ++i ) - { - pPoints[ i ] = pOldPoints[ i ]; - pFlags[ i ] = pOldFlags[ i ]; - } - delete[] pOldPoints; - delete[] pOldFlags; - } + pPoints[ i ] = pOldPoints[ i ]; + pFlags[ i ] = pOldFlags[ i ]; + } + delete[] pOldPoints; + delete[] pOldFlags; + } - int i = 0; - if( TT_PRIM_LINE == pCurve->wType ) + int i = 0; + if( TT_PRIM_LINE == pCurve->wType ) + { + while( i < pCurve->cpfx ) + { + nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); + nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); + ++i; + pPoints[ nPnt ] = Point( nX, nY ); + pFlags[ nPnt ] = POLY_NORMAL; + ++nPnt; + } + } + else if( TT_PRIM_QSPLINE == pCurve->wType ) + { + bHasOfflinePoints = true; + while( i < pCurve->cpfx ) + { + // get control point of quadratic bezier spline + nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); + nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); + ++i; + Point aControlP( nX, nY ); + + // calculate first cubic control point + // P0 = 1/3 * (PBeg + 2 * PQControl) + nX = pPoints[ nPnt-1 ].X() + 2 * aControlP.X(); + nY = pPoints[ nPnt-1 ].Y() + 2 * aControlP.Y(); + pPoints[ nPnt+0 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); + pFlags[ nPnt+0 ] = POLY_CONTROL; + + // calculate endpoint of segment + nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); + nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); + + if ( i+1 >= pCurve->cpfx ) { - while( i < pCurve->cpfx ) - { - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - ++i; - pPoints[ nPnt ] = Point( nX, nY ); - pFlags[ nPnt ] = POLY_NORMAL; - ++nPnt; - } + // endpoint is either last point in segment => advance + ++i; } - else if( TT_PRIM_QSPLINE == pCurve->wType ) + else { - bHasOfflinePoints = true; - while( i < pCurve->cpfx ) - { - // get control point of quadratic bezier spline - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - ++i; - Point aControlP( nX, nY ); - - // calculate first cubic control point - // P0 = 1/3 * (PBeg + 2 * PQControl) - nX = pPoints[ nPnt-1 ].X() + 2 * aControlP.X(); - nY = pPoints[ nPnt-1 ].Y() + 2 * aControlP.Y(); - pPoints[ nPnt+0 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); - pFlags[ nPnt+0 ] = POLY_CONTROL; - - // calculate endpoint of segment - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - - if ( i+1 >= pCurve->cpfx ) - { - // endpoint is either last point in segment => advance - ++i; - } - else - { - // or endpoint is the middle of two control points - nX += IntTimes256FromFixed( pCurve->apfx[ i-1 ].x ); - nY += IntTimes256FromFixed( pCurve->apfx[ i-1 ].y ); - nX = (nX + 1) / 2; - nY = (nY + 1) / 2; - // no need to advance, because the current point - // is the control point in next bezier spline - } - - pPoints[ nPnt+2 ] = Point( nX, nY ); - pFlags[ nPnt+2 ] = POLY_NORMAL; - - // calculate second cubic control point - // P1 = 1/3 * (PEnd + 2 * PQControl) - nX = pPoints[ nPnt+2 ].X() + 2 * aControlP.X(); - nY = pPoints[ nPnt+2 ].Y() + 2 * aControlP.Y(); - pPoints[ nPnt+1 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); - pFlags[ nPnt+1 ] = POLY_CONTROL; - - nPnt += 3; - } + // or endpoint is the middle of two control points + nX += IntTimes256FromFixed( pCurve->apfx[ i-1 ].x ); + nY += IntTimes256FromFixed( pCurve->apfx[ i-1 ].y ); + nX = (nX + 1) / 2; + nY = (nY + 1) / 2; + // no need to advance, because the current point + // is the control point in next bezier spline } - // next curve segment - pCurve = (TTPOLYCURVE*)&pCurve->apfx[ i ]; - } + pPoints[ nPnt+2 ] = Point( nX, nY ); + pFlags[ nPnt+2 ] = POLY_NORMAL; - // end point is start point for closed contour - // disabled, because Polygon class closes the contour itself - // pPoints[nPnt++] = pPoints[0]; - // #i35928# - // Added again, but add only when not yet closed - if(pPoints[nPnt - 1] != pPoints[0]) - { - if( bHasOfflinePoints ) - pFlags[nPnt] = pFlags[0]; + // calculate second cubic control point + // P1 = 1/3 * (PEnd + 2 * PQControl) + nX = pPoints[ nPnt+2 ].X() + 2 * aControlP.X(); + nY = pPoints[ nPnt+2 ].Y() + 2 * aControlP.Y(); + pPoints[ nPnt+1 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); + pFlags[ nPnt+1 ] = POLY_CONTROL; - pPoints[nPnt++] = pPoints[0]; + nPnt += 3; } + } - // convert y-coordinates W32 -> VCL - for( int i = 0; i < nPnt; ++i ) - pPoints[i].Y() = -pPoints[i].Y(); + // next curve segment + pCurve = (TTPOLYCURVE*)&pCurve->apfx[ i ]; + } - // insert into polypolygon - Polygon aPoly( nPnt, pPoints, (bHasOfflinePoints ? pFlags : NULL) ); - // convert to B2DPolyPolygon - // TODO: get rid of the intermediate PolyPolygon - rB2DPolyPoly.append( aPoly.getB2DPolygon() ); - } + // end point is start point for closed contour + // disabled, because Polygon class closes the contour itself + // pPoints[nPnt++] = pPoints[0]; + // #i35928# + // Added again, but add only when not yet closed + if(pPoints[nPnt - 1] != pPoints[0]) + { + if( bHasOfflinePoints ) + pFlags[nPnt] = pFlags[0]; - delete[] pPoints; - delete[] pFlags; + pPoints[nPnt++] = pPoints[0]; } - delete[] pData; + // convert y-coordinates W32 -> VCL + for( int i = 0; i < nPnt; ++i ) + pPoints[i].Y() = -pPoints[i].Y(); + + // insert into polypolygon + Polygon aPoly( nPnt, pPoints, (bHasOfflinePoints ? pFlags : NULL) ); + // convert to B2DPolyPolygon + // TODO: get rid of the intermediate PolyPolygon + rB2DPolyPoly.append( aPoly.getB2DPolygon() ); } + delete[] pPoints; + delete[] pFlags; + + delete[] pData; + // rescaling needed for the PolyPolygon conversion if( rB2DPolyPoly.count() ) { @@ -2723,7 +2717,7 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); } - return bRet; + return TRUE; } // ----------------------------------------------------------------------- @@ -2786,7 +2780,7 @@ int ScopedTrueTypeFont::open(void * pBuffer, sal_uInt32 nLen, return OpenTTFontBuffer(pBuffer, nLen, nFaceNum, &m_pFont); } -BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, +sal_Bool WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, const ImplFontData* pFont, long* pGlyphIDs, sal_uInt8* pEncoding, sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo ) { @@ -2804,8 +2798,6 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, ImplDoSetFont( &aIFSD, fScale, hOldFont ); ImplWinFontData* pWinFontData = (ImplWinFontData*)aIFSD.mpFontData; - pWinFontData->UpdateFromHDC( mhDC ); -/*const*/ ImplFontCharMap* pImplFontCharMap = pWinFontData->GetImplFontCharMap(); #if OSL_DEBUG_LEVEL > 1 // get font metrics @@ -2828,6 +2820,10 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, const RawFontData aRawCffData( mhDC, nCffTag ); if( aRawCffData.get() ) { + pWinFontData->UpdateFromHDC( mhDC ); + const ImplFontCharMap* pCharMap = pWinFontData->GetImplFontCharMap(); + pCharMap->AddReference(); + long nRealGlyphIds[ 256 ]; for( int i = 0; i < nGlyphCount; ++i ) { @@ -2835,13 +2831,15 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, // 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 ); + nGlyphIdx = pCharMap->GetGlyphIndex( nGlyphIdx ); if( (pGlyphIDs[i] & (GF_ROTMASK|GF_GSUB)) != 0) // TODO: vertical substitution {/*####*/} nRealGlyphIds[i] = nGlyphIdx; } + pCharMap->DeReference(); // TODO: and and use a RAII object + // provide a font subset from the CFF-table FILE* pOutFile = fopen( aToFile.GetBuffer(), "wb" ); rInfo.LoadFont( FontSubsetInfo::CFF_FONT, aRawCffData.get(), aRawCffData.size() ); @@ -2879,7 +2877,7 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, // 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 ]; + sal_uInt16 aShortIDs[ 256 ]; sal_uInt8 aTempEncs[ 256 ]; int nNotDef=-1, i; @@ -2899,7 +2897,7 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, nGlyphIdx = ::MapChar( aSftTTF.get(), cChar, bVertical ); } } - aShortIDs[i] = static_cast<USHORT>( nGlyphIdx ); + aShortIDs[i] = static_cast<sal_uInt16>( nGlyphIdx ); if( !nGlyphIdx ) if( nNotDef < 0 ) nNotDef = i; // first NotDef glyph found @@ -2970,7 +2968,7 @@ const void* WinSalGraphics::GetEmbedFontData( const ImplFontData* pFont, nFNLen--; if( nFNLen == 0 ) *pDataLen = 0; - rInfo.m_aPSName = String( reinterpret_cast<const sal_Unicode*>(aFaceName), sal::static_int_cast<USHORT>(nFNLen) ); + rInfo.m_aPSName = String( reinterpret_cast<const sal_Unicode*>(aFaceName), sal::static_int_cast<sal_uInt16>(nFNLen) ); rInfo.m_nAscent = +aTm.tmAscent; rInfo.m_nDescent = -aTm.tmDescent; rInfo.m_aFontBBox = Rectangle( Point( -aTm.tmOverhang, -aTm.tmDescent ), @@ -3082,8 +3080,9 @@ void WinSalGraphics::GetGlyphWidths( const ImplFontData* pFont, rUnicodeEnc.clear(); } const ImplWinFontData* pWinFont = static_cast<const ImplWinFontData*>(pFont); - ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); + const ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" ); + pMap->AddReference(); int nCharCount = pMap->GetCharCount(); sal_uInt32 nChar = pMap->GetFirstChar(); @@ -3099,6 +3098,8 @@ void WinSalGraphics::GetGlyphWidths( const ImplFontData* pFont, } nChar = pMap->GetNextChar( nChar ); } + + pMap->DeReference(); // TODO: and and use a RAII object } } else if( pFont->IsEmbeddable() ) diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 446b98892f6d..ccd378750580 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -80,7 +80,7 @@ private: public: VisualStylesAPI(); ~VisualStylesAPI(); - BOOL IsAvailable() { return (mhModule != NULL); } + sal_Bool IsAvailable() { return (mhModule != NULL); } HTHEME OpenThemeData( HWND hwnd, LPCWSTR pszClassList ); HRESULT CloseThemeData( HTHEME hTheme ); @@ -190,6 +190,8 @@ void SalData::deInitNWF( void ) ++iter; } aThemeMap.clear(); + if( maDwmLib ) + osl_unloadModule( maDwmLib ); } static HTHEME getThemeHandle( HWND hWnd, LPCWSTR name ) @@ -217,7 +219,7 @@ static HTHEME getThemeHandle( HWND hWnd, LPCWSTR name ) * Returns TRUE if the platform supports native * drawing of the control defined by nPart */ -BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +sal_Bool WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { HTHEME hTheme = NULL; @@ -288,6 +290,22 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP case CTRL_MENUBAR: if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Rebar"); + else if( GetSalData()->mbThemeMenuSupport ) + { + if( nPart == PART_MENU_ITEM ) + hTheme = getThemeHandle( mhWnd, L"Menu" ); + } + break; + case CTRL_MENU_POPUP: + if( GetSalData()->mbThemeMenuSupport ) + { + if( nPart == PART_ENTIRE_CONTROL || + nPart == PART_MENU_ITEM || + nPart == PART_MENU_ITEM_CHECK_MARK || + nPart == PART_MENU_ITEM_RADIO_MARK || + nPart == PART_MENU_SEPARATOR ) + hTheme = getThemeHandle( mhWnd, L"Menu" ); + } break; case CTRL_PROGRESS: if( nPart == PART_ENTIRE_CONTROL ) @@ -317,16 +335,16 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP * aPos was or was not inside the native widget specified by the * nType/nPart combination. */ -BOOL WinSalGraphics::hitTestNativeControl( ControlType, +sal_Bool WinSalGraphics::hitTestNativeControl( ControlType, ControlPart, const Rectangle&, const Point&, - BOOL& ) + sal_Bool& ) { return FALSE; } -BOOL ImplDrawTheme( HTHEME hTheme, HDC hDC, int iPart, int iState, RECT rc, const OUString& aStr) +sal_Bool ImplDrawTheme( HTHEME hTheme, HDC hDC, int iPart, int iState, RECT rc, const OUString& aStr) { HRESULT hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0); @@ -421,7 +439,7 @@ void ImplConvertSpinbuttonValues( int nControlPart, const ControlState& rState, // ---- -BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, +sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, ControlType nType, ControlPart nPart, ControlState nState, @@ -558,7 +576,7 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( aValue.getType() == CTRL_SPINBUTTONS ) { const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue*>(&aValue); - BOOL bOk = FALSE; + sal_Bool bOk = sal_False; RECT rect; ImplConvertSpinbuttonValues( pValue->mnUpperPart, pValue->mnUpperState, pValue->maUpperRect, &iPart, &iState, &rect ); @@ -583,7 +601,7 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( aValue.getType() == CTRL_SPINBUTTONS ) { const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue*>(&aValue); - BOOL bOk = FALSE; + sal_Bool bOk = sal_False; RECT rect; ImplConvertSpinbuttonValues( pValue->mnUpperPart, pValue->mnUpperState, pValue->maUpperRect, &iPart, &iState, &rect ); @@ -688,7 +706,7 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nType == CTRL_RADIOBUTTON ) { iPart = BP_RADIOBUTTON; - BOOL bChecked = ( aValue.getTristateVal() == BUTTONVALUE_ON ); + sal_Bool bChecked = ( aValue.getTristateVal() == BUTTONVALUE_ON ); if( nState & CTRL_STATE_PRESSED ) iState = bChecked ? RBS_CHECKEDPRESSED : RBS_UNCHECKEDPRESSED; @@ -834,7 +852,7 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nPart == PART_BUTTON ) { iPart = TP_BUTTON; - BOOL bChecked = ( aValue.getTristateVal() == BUTTONVALUE_ON ); + sal_Bool bChecked = ( aValue.getTristateVal() == BUTTONVALUE_ON ); if( !(nState & CTRL_STATE_ENABLED) ) //iState = TS_DISABLED; // disabled buttons are typically not painted at all but we need visual @@ -869,15 +887,23 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nType == CTRL_MENUBAR ) { - if( nPart != PART_ENTIRE_CONTROL ) - return FALSE; - - if( aValue.getType() == CTRL_MENUBAR ) + if( nPart == PART_ENTIRE_CONTROL ) { - const MenubarValue *pValue = static_cast<const MenubarValue*>(&aValue); - rc.bottom += pValue->maTopDockingAreaHeight; // extend potential gradient to cover docking area as well + if( aValue.getType() == CTRL_MENUBAR ) + { + const MenubarValue *pValue = static_cast<const MenubarValue*>(&aValue); + rc.bottom += pValue->maTopDockingAreaHeight; // extend potential gradient to cover docking area as well + } + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); + } + else if( nPart == PART_MENU_ITEM ) + { + if( (nState & CTRL_STATE_ENABLED) ) + iState = (nState & CTRL_STATE_SELECTED) ? MBI_HOT : MBI_NORMAL; + else + iState = (nState & CTRL_STATE_SELECTED) ? MBI_DISABLEDHOT : MBI_DISABLED; + return ImplDrawTheme( hTheme, hDC, MENU_BARITEM, iState, rc, aCaption ); } - return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } if( nType == CTRL_PROGRESS ) @@ -956,6 +982,69 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption ); } + if( GetSalData()->mbThemeMenuSupport ) + { + if( nType == CTRL_MENU_POPUP ) + { + if( nPart == PART_ENTIRE_CONTROL ) + { + RECT aGutterRC = rc; + aGutterRC.left += aValue.getNumericVal(); + aGutterRC.right = aGutterRC.left+3; + return + ImplDrawTheme( hTheme, hDC, MENU_POPUPBACKGROUND, 0, rc, aCaption ) && + ImplDrawTheme( hTheme, hDC, MENU_POPUPGUTTER, 0, aGutterRC, aCaption ) + ; + } + else if( nPart == PART_MENU_ITEM ) + { + if( (nState & CTRL_STATE_ENABLED) ) + iState = (nState & CTRL_STATE_SELECTED) ? MPI_HOT : MPI_NORMAL; + else + iState = (nState & CTRL_STATE_SELECTED) ? MPI_DISABLEDHOT : MPI_DISABLED; + return ImplDrawTheme( hTheme, hDC, MENU_POPUPITEM, iState, rc, aCaption ); + } + else if( nPart == PART_MENU_ITEM_CHECK_MARK || nPart == PART_MENU_ITEM_RADIO_MARK ) + { + if( (nState & CTRL_STATE_PRESSED) ) + { + RECT aBGRect = rc; + if( aValue.getType() == CTRL_MENU_POPUP ) + { + const MenupopupValue& rMVal( static_cast<const MenupopupValue&>(aValue) ); + aBGRect.left = rMVal.maItemRect.Left(); + aBGRect.top = rMVal.maItemRect.Top(); + aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see below in drawNativeControl + aBGRect.right = rMVal.getNumericVal(); + + // FIXME: magic + aBGRect.left += 1; aBGRect.top += 1; aBGRect.bottom +=1; + } + iState = (nState & CTRL_STATE_ENABLED) ? MCB_NORMAL : MCB_DISABLED; + ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECKBACKGROUND, iState, aBGRect, aCaption ); + if( nPart == PART_MENU_ITEM_CHECK_MARK ) + iState = (nState & CTRL_STATE_ENABLED) ? MC_CHECKMARKNORMAL : MC_CHECKMARKDISABLED; + else + iState = (nState & CTRL_STATE_ENABLED) ? MC_BULLETNORMAL : MC_BULLETDISABLED; + return ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECK, iState, rc, aCaption ); + } + else + return true; // unchecked: do nothing + } + else if( nPart == PART_MENU_SEPARATOR ) + { + rc.left += aValue.getNumericVal(); // adjust for gutter position + Rectangle aRect( ImplGetThemeRect( hTheme, hDC, + MENU_POPUPSEPARATOR, 0, Rectangle( rc.left, rc.top, rc.right, rc.bottom ) ) ); + // center the separator inside the passed rectangle + long nDY = ((rc.bottom - rc.top + 1) - aRect.GetHeight()) / 2; + rc.top += nDY; + rc.bottom = rc.top+aRect.GetHeight()-1; + return ImplDrawTheme( hTheme, hDC, MENU_POPUPSEPARATOR, 0, rc, aCaption ); + } + } + } + return false; } @@ -968,14 +1057,14 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL WinSalGraphics::drawNativeControl( ControlType nType, +sal_Bool WinSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption ) { - BOOL bOk = false; + sal_Bool bOk = false; HTHEME hTheme = NULL; switch( nType ) @@ -1029,6 +1118,11 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, case CTRL_MENUBAR: if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Rebar"); + else if( GetSalData()->mbThemeMenuSupport ) + { + if( nPart == PART_MENU_ITEM ) + hTheme = getThemeHandle( mhWnd, L"Menu" ); + } break; case CTRL_PROGRESS: if( nPart == PART_ENTIRE_CONTROL ) @@ -1042,6 +1136,16 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA ) hTheme = getThemeHandle( mhWnd, L"Trackbar" ); break; + case CTRL_MENU_POPUP: + if( GetSalData()->mbThemeMenuSupport ) + { + if( nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM || + nPart == PART_MENU_ITEM_CHECK_MARK || nPart == PART_MENU_ITEM_RADIO_MARK || + nPart == PART_MENU_SEPARATOR + ) + hTheme = getThemeHandle( mhWnd, L"Menu" ); + } + break; default: hTheme = NULL; break; @@ -1085,7 +1189,7 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL WinSalGraphics::drawNativeControlText( ControlType, +sal_Bool WinSalGraphics::drawNativeControlText( ControlType, ControlPart, const Rectangle&, ControlState, @@ -1109,7 +1213,7 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType, * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, +sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, @@ -1118,7 +1222,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) { - BOOL bRet = FALSE; + sal_Bool bRet = FALSE; HDC hDC = GetDC( mhWnd ); if( nType == CTRL_TOOLBAR ) @@ -1198,7 +1302,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, HTHEME hTheme = getThemeHandle( mhWnd, L"Edit"); if( hTheme ) { - // get borderr size + // get border size Rectangle aBoxRect( rControlRegion ); Rectangle aRect( ImplGetThemeRect( hTheme, hDC, EP_BACKGROUNDWITHBORDER, EBWBS_HOT, aBoxRect ) ); @@ -1227,6 +1331,29 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, } } + if( GetSalData()->mbThemeMenuSupport ) + { + if( nType == CTRL_MENU_POPUP ) + { + if( nPart == PART_MENU_ITEM_CHECK_MARK || + nPart == PART_MENU_ITEM_RADIO_MARK ) + { + HTHEME hTheme = getThemeHandle( mhWnd, L"Menu"); + Rectangle aBoxRect( rControlRegion ); + Rectangle aRect( ImplGetThemeRect( hTheme, hDC, + MENU_POPUPCHECK, + MC_CHECKMARKNORMAL, + aBoxRect ) ); + if( aBoxRect.GetWidth() && aBoxRect.GetHeight() ) + { + rNativeContentRegion = aRect; + rNativeBoundingRegion = rNativeContentRegion; + bRet = TRUE; + } + } + } + } + if( nType == CTRL_SLIDER && ( (nPart == PART_THUMB_HORZ) || (nPart == PART_THUMB_VERT) ) ) { HTHEME hTheme = getThemeHandle( mhWnd, L"Trackbar"); diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index 16c7439fbbdd..b233f97a15ee 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -94,6 +94,7 @@ #endif +using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::ui::dialogs; @@ -129,9 +130,9 @@ static LPDEVMODEW SAL_DEVMODE_W( const ImplJobSetup* pSetupData ) // ======================================================================= -static ULONG ImplWinQueueStatusToSal( DWORD nWinStatus ) +static sal_uLong ImplWinQueueStatusToSal( DWORD nWinStatus ) { - ULONG nStatus = 0; + sal_uLong nStatus = 0; if ( nWinStatus & PRINTER_STATUS_PAUSED ) nStatus |= QUEUE_STATUS_PAUSED; if ( nWinStatus & PRINTER_STATUS_ERROR ) @@ -193,7 +194,7 @@ static void getPrinterQueueInfoOldStyle( ImplPrnQueueList* pList ) DWORD n; DWORD nBytes = 0; DWORD nInfoPrn2; - BOOL bFound = FALSE; + sal_Bool bFound = FALSE; PRINTER_INFO_2* pWinInfo2 = NULL; PRINTER_INFO_2* pGetInfo2; EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoPrn2 ); @@ -263,7 +264,7 @@ static void getPrinterQueueInfoOldStyle( ImplPrnQueueList* pList ) pTmp = pPortName; while ( *pTmp != ',' ) pTmp++; - XubString aDriver( ImplSalGetUniString( pPortName, (USHORT)(pTmp-pPortName) ) ); + XubString aDriver( ImplSalGetUniString( pPortName, (sal_uInt16)(pTmp-pPortName) ) ); pPortName = pTmp; // get port names @@ -274,11 +275,11 @@ static void getPrinterQueueInfoOldStyle( ImplPrnQueueList* pList ) while ( *pTmp && (*pTmp != ',') ) pTmp++; - String aPortName( ImplSalGetUniString( pPortName, (USHORT)(pTmp-pPortName) ) ); + String aPortName( ImplSalGetUniString( pPortName, (sal_uInt16)(pTmp-pPortName) ) ); // create new entry // look up if printer was already found in first loop - BOOL bAdd = TRUE; + sal_Bool bAdd = TRUE; if ( pWinInfo2 ) { pGetInfo2 = pWinInfo2; @@ -447,7 +448,7 @@ void WinSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) XubString WinSalInstance::GetDefaultPrinter() { static bool bGetDefPrtAPI = true; - static BOOL(WINAPI*pGetDefaultPrinter)(LPWSTR,LPDWORD) = NULL; + static sal_Bool(WINAPI*pGetDefaultPrinter)(LPWSTR,LPDWORD) = NULL; // try to use GetDefaultPrinter API (not available prior to W2000) if( bGetDefPrtAPI ) { @@ -464,7 +465,7 @@ XubString WinSalInstance::GetDefaultPrinter() pFunc = osl_getFunctionSymbol( pLib, queryFuncName.pData ); } - pGetDefaultPrinter = (BOOL(WINAPI*)(LPWSTR,LPDWORD)) pFunc; + pGetDefaultPrinter = (sal_Bool(WINAPI*)(LPWSTR,LPDWORD)) pFunc; } } if( pGetDefaultPrinter ) @@ -534,8 +535,8 @@ static DWORD ImplDeviceCaps( WinSalInfoPrinter* pPrinter, WORD nCaps, // ----------------------------------------------------------------------- -static BOOL ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, - ImplJobSetup* pSetupData, BOOL bDelete ) +static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, + ImplJobSetup* pSetupData, sal_Bool bDelete ) { if ( pSetupData && pSetupData->mpDriverData ) { @@ -659,8 +660,8 @@ static BOOL ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, // ----------------------------------------------------------------------- -static BOOL ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, - BOOL bIn, WinSalFrame* pVisibleDlgParent ) +static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, + sal_Bool bIn, WinSalFrame* pVisibleDlgParent ) { ByteString aPrinterNameA = ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ); HANDLE hPrn; @@ -683,7 +684,7 @@ static BOOL ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS LONG nSysJobSize = -1; HWND hWnd = 0; DWORD nMode = DM_OUT_BUFFER; - ULONG nDriverDataLen = 0; + sal_uLong nDriverDataLen = 0; SalDriverData* pOutBuffer = NULL; BYTE* pInBuffer = NULL; @@ -709,7 +710,7 @@ static BOOL ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN; pOutBuffer->mnVersion = aSalShlData.mbWPrinter ? SAL_DRIVERDATA_VERSION_W : SAL_DRIVERDATA_VERSION_A; // calculate driver data offset including structure padding - pOutBuffer->mnDriverOffset = sal::static_int_cast<USHORT>( + pOutBuffer->mnDriverOffset = sal::static_int_cast<sal_uInt16>( (char*)pOutBuffer->maDriverData - (char*)pOutBuffer ); @@ -728,7 +729,7 @@ static BOOL ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } // Release mutex, in the other case we don't get paints and so on - ULONG nMutexCount=0; + sal_uLong nMutexCount=0; if ( pVisibleDlgParent ) nMutexCount = ImplSalReleaseYieldMutex(); @@ -808,7 +809,7 @@ static BOOL ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS #define CHOOSE_DEVMODE(i)\ (pDevModeW ? pDevModeW->i : pDevModeA->i) -static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, ULONG nFlags ) +static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, sal_uLong nFlags ) { if ( !pSetupData || !pSetupData->mpDriverData ) return; @@ -827,7 +828,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS // PaperBin if ( nFlags & SAL_JOBSET_PAPERBIN ) { - ULONG nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); + sal_uLong nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); if ( nCount && (nCount != GDI_ERROR) ) { @@ -836,11 +837,11 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS pSetupData->mnPaperBin = 0; // search the right bin and assign index to mnPaperBin - for( ULONG i = 0; i < nCount; i++ ) + for( sal_uLong i = 0; i < nCount; i++ ) { if( CHOOSE_DEVMODE(dmDefaultSource) == pBins[ i ] ) { - pSetupData->mnPaperBin = (USHORT)i; + pSetupData->mnPaperBin = (sal_uInt16)i; break; } } @@ -859,9 +860,9 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } else { - ULONG nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); + sal_uLong nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); WORD* pPapers = NULL; - ULONG nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); + sal_uLong nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); POINT* pPaperSizes = NULL; if ( nPaperCount && (nPaperCount != GDI_ERROR) ) { @@ -875,7 +876,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } if( nPaperSizeCount == nPaperCount && pPaperSizes && pPapers ) { - for( ULONG i = 0; i < nPaperCount; i++ ) + for( sal_uLong i = 0; i < nPaperCount; i++ ) { if( pPapers[ i ] == CHOOSE_DEVMODE(dmPaperSize) ) { @@ -1076,7 +1077,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS // ----------------------------------------------------------------------- -static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, ULONG nFlags ) +static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, sal_uLong nFlags ) { if ( !pSetupData || !pSetupData->mpDriverData ) return; @@ -1096,7 +1097,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS // PaperBin if ( nFlags & SAL_JOBSET_PAPERBIN ) { - ULONG nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); + sal_uLong nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); if ( nCount && (nCount != GDI_ERROR) ) { @@ -1274,9 +1275,9 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS default: { short nPaper = 0; - ULONG nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); + sal_uLong nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); WORD* pPapers = NULL; - ULONG nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); + sal_uLong nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); POINT* pPaperSizes = NULL; DWORD nLandscapeAngle = ImplDeviceCaps( pPrinter, DC_ORIENTATION, NULL, pSetupData ); if ( nPaperCount && (nPaperCount != GDI_ERROR) ) @@ -1293,7 +1294,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS { PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight); // compare paper formats and select a good match - for ( ULONG i = 0; i < nPaperCount; i++ ) + for ( sal_uLong i = 0; i < nPaperCount; i++ ) { if ( aInfo.sloppyEqual(PaperInfo(pPaperSizes[i].x*10, pPaperSizes[i].y*10))) { @@ -1308,7 +1309,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS if ( !nPaper && nLandscapeAngle != 0 ) { PaperInfo aRotatedInfo(pSetupData->mnPaperHeight, pSetupData->mnPaperWidth); - for ( ULONG i = 0; i < nPaperCount; i++ ) + for ( sal_uLong i = 0; i < nPaperCount; i++ ) { if ( aRotatedInfo.sloppyEqual(PaperInfo(pPaperSizes[i].x*10, pPaperSizes[i].y*10)) ) { @@ -1464,7 +1465,7 @@ static WinSalGraphics* ImplCreateSalPrnGraphics( HDC hDC ) // ----------------------------------------------------------------------- -static BOOL ImplUpdateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData ) +static sal_Bool ImplUpdateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData ) { HDC hNewDC = ImplCreateSalPrnIC( pPrinter, pSetupData ); if ( !hNewDC ) @@ -1624,7 +1625,7 @@ void WinSalInfoPrinter::ReleaseGraphics( SalGraphics* ) // ----------------------------------------------------------------------- -BOOL WinSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) +sal_Bool WinSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) { if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, static_cast<WinSalFrame*>(pFrame) ) ) { @@ -1637,7 +1638,7 @@ BOOL WinSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) // ----------------------------------------------------------------------- -BOOL WinSalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) +sal_Bool WinSalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) { if ( !ImplTestSalJobSetup( this, pSetupData, FALSE ) ) return FALSE; @@ -1646,7 +1647,7 @@ BOOL WinSalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) // ----------------------------------------------------------------------- -BOOL WinSalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) +sal_Bool WinSalInfoPrinter::SetData( sal_uLong nFlags, ImplJobSetup* pSetupData ) { ImplJobSetupToDevMode( this, pSetupData, nFlags ); if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, NULL ) ) @@ -1660,7 +1661,7 @@ BOOL WinSalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) // ----------------------------------------------------------------------- -ULONG WinSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData ) +sal_uLong WinSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData ) { DWORD nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData ); if ( nRet && (nRet != GDI_ERROR) ) @@ -1671,7 +1672,7 @@ ULONG WinSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData ) // ----------------------------------------------------------------------- -XubString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ) +XubString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sal_uLong nPaperBin ) { XubString aPaperBinName; @@ -1701,7 +1702,7 @@ XubString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, UL // ----------------------------------------------------------------------- -ULONG WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType ) +sal_uLong WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ) { DWORD nRet; @@ -1783,11 +1784,11 @@ void WinSalInstance::DestroyPrinter( SalPrinter* pPrinter ) // ======================================================================= -WIN_BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) +BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) { SalData* pSalData = GetSalData(); WinSalPrinter* pPrinter; - BOOL bWhile = TRUE; + sal_Bool bWhile = TRUE; int i = 0; do @@ -1796,8 +1797,11 @@ WIN_BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) MSG aMsg; if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) ) { - TranslateMessage( &aMsg ); - ImplDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplDispatchMessage( &aMsg ); + } i++; if ( i > 15 ) bWhile = FALSE; @@ -1824,19 +1828,19 @@ WIN_BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) // ----------------------------------------------------------------------- -static LPDEVMODEA ImplSalSetCopies( LPDEVMODEA pDevMode, ULONG nCopies, BOOL bCollate ) +static LPDEVMODEA ImplSalSetCopies( LPDEVMODEA pDevMode, sal_uLong nCopies, sal_Bool bCollate ) { LPDEVMODEA pNewDevMode = pDevMode; if ( pDevMode && (nCopies > 1) ) { if ( nCopies > 32765 ) nCopies = 32765; - ULONG nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra; + sal_uLong nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra; pNewDevMode = (LPDEVMODEA)rtl_allocateMemory( nDevSize ); memcpy( pNewDevMode, pDevMode, nDevSize ); pDevMode = pNewDevMode; pDevMode->dmFields |= DM_COPIES; - pDevMode->dmCopies = (short)(USHORT)nCopies; + pDevMode->dmCopies = (short)(sal_uInt16)nCopies; pDevMode->dmFields |= DM_COLLATE; if ( bCollate ) pDevMode->dmCollate = DMCOLLATE_TRUE; @@ -1847,19 +1851,19 @@ static LPDEVMODEA ImplSalSetCopies( LPDEVMODEA pDevMode, ULONG nCopies, BOOL bCo return pNewDevMode; } -static LPDEVMODEW ImplSalSetCopies( LPDEVMODEW pDevMode, ULONG nCopies, BOOL bCollate ) +static LPDEVMODEW ImplSalSetCopies( LPDEVMODEW pDevMode, sal_uLong nCopies, sal_Bool bCollate ) { LPDEVMODEW pNewDevMode = pDevMode; if ( pDevMode && (nCopies > 1) ) { if ( nCopies > 32765 ) nCopies = 32765; - ULONG nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra; + sal_uLong nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra; pNewDevMode = (LPDEVMODEW)rtl_allocateMemory( nDevSize ); memcpy( pNewDevMode, pDevMode, nDevSize ); pDevMode = pNewDevMode; pDevMode->dmFields |= DM_COPIES; - pDevMode->dmCopies = (short)(USHORT)nCopies; + pDevMode->dmCopies = (short)(sal_uInt16)nCopies; pDevMode->dmFields |= DM_COLLATE; if ( bCollate ) pDevMode->dmCollate = DMCOLLATE_TRUE; @@ -1952,10 +1956,10 @@ static int lcl_StartDocA( HDC hDC, DOCINFOA* pInfo, WinSalPrinter* pPrt ) return nRet; } -BOOL WinSalPrinter::StartJob( const XubString* pFileName, +sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString&, - ULONG nCopies, + sal_uLong nCopies, bool bCollate, bool /*bDirect*/, ImplJobSetup* pSetupData ) @@ -2044,7 +2048,7 @@ BOOL WinSalPrinter::StartJob( const XubString* pFileName, // Wegen Telocom Balloon Fax-Treiber, der uns unsere Messages // ansonsten oefters schickt, versuchen wir vorher alle // zu verarbeiten und dann eine Dummy-Message reinstellen - BOOL bWhile = TRUE; + sal_Bool bWhile = TRUE; int i = 0; do { @@ -2052,8 +2056,12 @@ BOOL WinSalPrinter::StartJob( const XubString* pFileName, MSG aMsg; if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) ) { - TranslateMessage( &aMsg ); - ImplDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplDispatchMessage( &aMsg ); + } + i++; if ( i > 15 ) bWhile = FALSE; @@ -2069,16 +2077,16 @@ BOOL WinSalPrinter::StartJob( const XubString* pFileName, if( mpInfoPrinter->maPortName.EqualsIgnoreCaseAscii( "FILE:" ) && !(pFileName && pFileName->Len()) ) { - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); if( xFactory.is() ) { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( + uno::Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); + uno::Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); + uno::Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) { Sequence< Any > aServiceType( 1 ); @@ -2172,7 +2180,7 @@ BOOL WinSalPrinter::StartJob( const XubString* pFileName, // ----------------------------------------------------------------------- -BOOL WinSalPrinter::EndJob() +sal_Bool WinSalPrinter::EndJob() { DWORD err = 0; HDC hDC = mhDC; @@ -2192,7 +2200,7 @@ BOOL WinSalPrinter::EndJob() // call, however the real solution is supposed to be the threading // framework yet to come. SalData* pSalData = GetSalData(); - ULONG nAcquire = pSalData->mpFirstInstance->ReleaseYieldMutex(); + sal_uLong nAcquire = pSalData->mpFirstInstance->ReleaseYieldMutex(); CATCH_DRIVER_EX_BEGIN; if( ::EndDoc( hDC ) <= 0 ) err = GetLastError(); @@ -2208,7 +2216,7 @@ BOOL WinSalPrinter::EndJob() // ----------------------------------------------------------------------- -BOOL WinSalPrinter::AbortJob() +sal_Bool WinSalPrinter::AbortJob() { mbAbort = TRUE; @@ -2265,7 +2273,7 @@ void ImplSalPrinterAbortJobAsync( HDC hPrnDC ) // ----------------------------------------------------------------------- -SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData ) +SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJobData ) { if( ! isValid() || mhDC == 0 ) return NULL; @@ -2320,7 +2328,7 @@ SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobDat // ----------------------------------------------------------------------- -BOOL WinSalPrinter::EndPage() +sal_Bool WinSalPrinter::EndPage() { HDC hDC = mhDC; if ( hDC && mpGraphics ) @@ -2350,7 +2358,7 @@ BOOL WinSalPrinter::EndPage() // ----------------------------------------------------------------------- -ULONG WinSalPrinter::GetErrorCode() +sal_uLong WinSalPrinter::GetErrorCode() { return mnError; } diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index a076409aa0ea..40b13dc9bf17 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -39,7 +39,7 @@ // ======================================================================= static HBITMAP ImplCreateVirDevBitmap( HDC hDC, long nDX, long nDY, - USHORT nBitCount ) + sal_uInt16 nBitCount ) { HBITMAP hBitmap; @@ -79,14 +79,14 @@ static HBITMAP ImplCreateVirDevBitmap( HDC hDC, long nDX, long nDY, SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, long nDX, long nDY, - USHORT nBitCount, + sal_uInt16 nBitCount, const SystemGraphicsData* pData ) { WinSalGraphics* pGraphics = static_cast<WinSalGraphics*>(pSGraphics); HDC hDC = NULL; HBITMAP hBmp = NULL; - BOOL bOk = FALSE; + sal_Bool bOk = FALSE; if( pData ) { @@ -227,7 +227,7 @@ void WinSalVirtualDevice::ReleaseGraphics( SalGraphics* ) // ----------------------------------------------------------------------- -BOOL WinSalVirtualDevice::SetSize( long nDX, long nDY ) +sal_Bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) { if( mbForeignDC || !mhBmp ) return TRUE; // ??? diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index d0d71d4d100c..1c47b21d550d 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -58,11 +58,9 @@ #define USE_UNISCRIBE #ifdef USE_UNISCRIBE -#define ULONG WIN_ULONG #include <Usp10.h> #include <ShLwApi.h> #include <winver.h> -#undef ULONG #endif // USE_UNISCRIBE #include <boost/unordered_map.hpp> @@ -245,13 +243,11 @@ HFONT WinLayout::DisableFontScaling() const if( mfFontScale == 1.0 ) return 0; - HFONT hHugeFont = 0; LOGFONTW aLogFont; ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); - hHugeFont = ::CreateFontIndirectW( &aLogFont); - + HFONT hHugeFont = ::CreateFontIndirectW( &aLogFont); if( !hHugeFont ) return 0; @@ -661,57 +657,31 @@ void SimpleWinLayout::DrawText( SalGraphics& rGraphics ) const Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) ); - // #108267#, limit the number of glyphs to avoid paint errors - UINT limitedGlyphCount = Min( 8192, mnGlyphCount ); - if( mnDrawOptions ) - { - // #108267#, break up into glyph portions of a limited size required by Win32 API - const unsigned int maxGlyphCount = 8192; - UINT numGlyphPortions = mnGlyphCount / maxGlyphCount; - UINT remainingGlyphs = mnGlyphCount % maxGlyphCount; - - if( numGlyphPortions ) - { - // #108267#,#109387# break up string into smaller chunks - // the output positions will be updated by windows (SetTextAlign) - unsigned int i,n; - POINT oldPos; - UINT oldTa = ::GetTextAlign( aHDC ); - ::SetTextAlign( aHDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP ); - ::MoveToEx( aHDC, aPos.X(), aPos.Y(), &oldPos ); - for( i=n=0; n<numGlyphPortions; n++, i+=maxGlyphCount ) - ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL, - mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i ); + // #108267#, break up into glyph portions of a limited size required by Win32 API + const unsigned int maxGlyphCount = 8192; + UINT numGlyphPortions = mnGlyphCount / maxGlyphCount; + UINT remainingGlyphs = mnGlyphCount % maxGlyphCount; + + if( numGlyphPortions ) + { + // #108267#,#109387# break up string into smaller chunks + // the output positions will be updated by windows (SetTextAlign) + POINT oldPos; + UINT oldTa = ::GetTextAlign( aHDC ); + ::SetTextAlign( aHDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP ); + ::MoveToEx( aHDC, aPos.X(), aPos.Y(), &oldPos ); + unsigned int i = 0; + for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount ) ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL, - mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i ); - ::MoveToEx( aHDC, oldPos.x, oldPos.y, (LPPOINT) NULL); - ::SetTextAlign( aHDC, oldTa ); - } - else - ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, - mpOutGlyphs, mnGlyphCount, mpGlyphAdvances ); + mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i ); + ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL, + mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i ); + ::MoveToEx( aHDC, oldPos.x, oldPos.y, (LPPOINT) NULL); + ::SetTextAlign( aHDC, oldTa ); } else - { - // #108267#, On Win9x, we get paint errors when drawing huge strings, even when - // split into pieces (see above), seems to be a problem in the internal text clipping - // so we just cut off the string - if( !mpGlyphOrigAdvs ) - ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), 0, NULL, - mpOutGlyphs, limitedGlyphCount, NULL ); - else - { - // workaround for problem in #106259# - long nXPos = mnBaseAdv; - for( unsigned int i = 0; i < limitedGlyphCount; ++i ) - { - ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), 0, NULL, - mpOutGlyphs+i, 1, NULL ); - nXPos += mpGlyphAdvances[ i ]; - aPos = GetDrawPosition( Point( nXPos, 0 ) ); - } - } - } + ::ExtTextOutW( aHDC, aPos.X(), aPos.Y(), mnDrawOptions, NULL, + mpOutGlyphs, mnGlyphCount, mpGlyphAdvances ); if( hOrigFont ) DeleteFont( SelectFont( aHDC, hOrigFont ) ); @@ -1240,7 +1210,7 @@ static bool InitUSP() DWORD nHandle; DWORD nBufSize = ::GetFileVersionInfoSizeW( const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(pModuleFileCStr)), &nHandle ); char* pBuffer = (char*)alloca( nBufSize ); - WIN_BOOL bRC = ::GetFileVersionInfoW( const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(pModuleFileCStr)), nHandle, nBufSize, pBuffer ); + BOOL bRC = ::GetFileVersionInfoW( const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(pModuleFileCStr)), nHandle, nBufSize, pBuffer ); VS_FIXEDFILEINFO* pFixedFileInfo = NULL; UINT nFixedFileSize = 0; if( bRC ) @@ -2061,6 +2031,13 @@ void UniscribeLayout::MoveGlyph( int nStartx8, long nNewXPos ) // move the visual item by having an offset pVI->mnXOffset += nDelta; } + // move subsequent items - this often isn't necessary because subsequent + // moves will correct subsequent items. However, if there is a contiguous + // range not involving fallback which spans items, this will be needed + while (++pVI - mpVisualItems < mnItemCount) + { + pVI->mnXOffset += nDelta; + } } // ----------------------------------------------------------------------- @@ -2341,6 +2318,10 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const if( rVisualItem.IsEmpty() ) continue; + if (mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK) + { + nXPos = rVisualItem.mnXOffset; + } // get glyph positions // TODO: handle when rVisualItem's glyph range is only partially used for( i = rVisualItem.mnMinGlyphPos; i < rVisualItem.mnEndGlyphPos; ++i ) @@ -2374,13 +2355,17 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const } } - // fixup unknown character positions to neighbor - for( i = 0; i < nMaxIdx; ++i ) + if (!(mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK)) { - if( pCaretXArray[ i ] >= 0 ) - nXPos = pCaretXArray[ i ]; - else - pCaretXArray[ i ] = nXPos; + nXPos = 0; + // fixup unknown character positions to neighbor + for( i = 0; i < nMaxIdx; ++i ) + { + if( pCaretXArray[ i ] >= 0 ) + nXPos = pCaretXArray[ i ]; + else + pCaretXArray[ i ] = nXPos; + } } } diff --git a/vcl/win/source/src/ase.cur b/vcl/win/source/src/ase.cur Binary files differindex 7634a7d34a7b..7634a7d34a7b 100755..100644 --- a/vcl/win/source/src/ase.cur +++ b/vcl/win/source/src/ase.cur diff --git a/vcl/win/source/src/asn.cur b/vcl/win/source/src/asn.cur Binary files differindex e444e42bf37e..e444e42bf37e 100755..100644 --- a/vcl/win/source/src/asn.cur +++ b/vcl/win/source/src/asn.cur diff --git a/vcl/win/source/src/asne.cur b/vcl/win/source/src/asne.cur Binary files differindex e92cc65e7eb1..e92cc65e7eb1 100755..100644 --- a/vcl/win/source/src/asne.cur +++ b/vcl/win/source/src/asne.cur diff --git a/vcl/win/source/src/asns.cur b/vcl/win/source/src/asns.cur Binary files differindex 04d0b09c353e..04d0b09c353e 100755..100644 --- a/vcl/win/source/src/asns.cur +++ b/vcl/win/source/src/asns.cur diff --git a/vcl/win/source/src/asnswe.cur b/vcl/win/source/src/asnswe.cur Binary files differindex a0e25b16de1f..a0e25b16de1f 100755..100644 --- a/vcl/win/source/src/asnswe.cur +++ b/vcl/win/source/src/asnswe.cur diff --git a/vcl/win/source/src/asnw.cur b/vcl/win/source/src/asnw.cur Binary files differindex 20322bc97b16..20322bc97b16 100755..100644 --- a/vcl/win/source/src/asnw.cur +++ b/vcl/win/source/src/asnw.cur diff --git a/vcl/win/source/src/ass.cur b/vcl/win/source/src/ass.cur Binary files differindex 7166636a1a77..7166636a1a77 100755..100644 --- a/vcl/win/source/src/ass.cur +++ b/vcl/win/source/src/ass.cur diff --git a/vcl/win/source/src/asse.cur b/vcl/win/source/src/asse.cur Binary files differindex 8cb71234b0a9..8cb71234b0a9 100755..100644 --- a/vcl/win/source/src/asse.cur +++ b/vcl/win/source/src/asse.cur diff --git a/vcl/win/source/src/assw.cur b/vcl/win/source/src/assw.cur Binary files differindex fddaf3f57cbf..fddaf3f57cbf 100755..100644 --- a/vcl/win/source/src/assw.cur +++ b/vcl/win/source/src/assw.cur diff --git a/vcl/win/source/src/asw.cur b/vcl/win/source/src/asw.cur Binary files differindex 0ccac50f4596..0ccac50f4596 100755..100644 --- a/vcl/win/source/src/asw.cur +++ b/vcl/win/source/src/asw.cur diff --git a/vcl/win/source/src/aswe.cur b/vcl/win/source/src/aswe.cur Binary files differindex c238b7e10aef..c238b7e10aef 100755..100644 --- a/vcl/win/source/src/aswe.cur +++ b/vcl/win/source/src/aswe.cur diff --git a/vcl/win/source/src/chain.cur b/vcl/win/source/src/chain.cur Binary files differindex 02abb7ab714f..02abb7ab714f 100755..100644 --- a/vcl/win/source/src/chain.cur +++ b/vcl/win/source/src/chain.cur diff --git a/vcl/win/source/src/chainnot.cur b/vcl/win/source/src/chainnot.cur Binary files differindex 938ece03f329..938ece03f329 100755..100644 --- a/vcl/win/source/src/chainnot.cur +++ b/vcl/win/source/src/chainnot.cur diff --git a/vcl/win/source/src/timemove.cur b/vcl/win/source/src/timemove.cur Binary files differindex 319b6edc5774..319b6edc5774 100755..100644 --- a/vcl/win/source/src/timemove.cur +++ b/vcl/win/source/src/timemove.cur diff --git a/vcl/win/source/src/timesize.cur b/vcl/win/source/src/timesize.cur Binary files differindex 1ec23de05b71..1ec23de05b71 100755..100644 --- a/vcl/win/source/src/timesize.cur +++ b/vcl/win/source/src/timesize.cur diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 4548427addef..15be14eac5be 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -96,6 +96,7 @@ using ::std::max; #include <time.h> using ::rtl::OUString; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; @@ -120,8 +121,8 @@ void MyOutputDebugString( char *s) { OutputDebugString( s ); } // misssing prototypes and constants for LayeredWindows extern "C" { - //WINUSERAPI BOOL WINAPI SetLayeredWindowAttributes(HWND,COLORREF,BYTE,DWORD); - typedef BOOL ( WINAPI * SetLayeredWindowAttributes_Proc_T ) (HWND,COLORREF,BYTE,DWORD); + //WINUSERAPI sal_Bool WINAPI SetLayeredWindowAttributes(HWND,COLORREF,BYTE,DWORD); + typedef sal_Bool ( WINAPI * SetLayeredWindowAttributes_Proc_T ) (HWND,COLORREF,BYTE,DWORD); static SetLayeredWindowAttributes_Proc_T lpfnSetLayeredWindowAttributes; }; @@ -129,7 +130,7 @@ extern "C" { const unsigned int WM_USER_SYSTEM_WINDOW_ACTIVATED = RegisterWindowMessageA("SYSTEM_WINDOW_ACTIVATED"); -BOOL WinSalFrame::mbInReparent = FALSE; +sal_Bool WinSalFrame::mbInReparent = FALSE; // ======================================================================= @@ -160,7 +161,7 @@ static void ImplSaveFrameState( WinSalFrame* pFrame ) // Position, Groesse und Status fuer GetWindowState() merken if ( !pFrame->mbFullScreen ) { - BOOL bVisible = (GetWindowStyle( pFrame->mhWnd ) & WS_VISIBLE) != 0; + sal_Bool bVisible = (GetWindowStyle( pFrame->mhWnd ) & WS_VISIBLE) != 0; if ( IsIconic( pFrame->mhWnd ) ) { pFrame->maState.mnState |= SAL_FRAMESTATE_MINIMIZED; @@ -344,13 +345,13 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) // ======================================================================= SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, - HWND hWndParent, ULONG nSalFrameStyle ) + HWND hWndParent, sal_uLong nSalFrameStyle ) { WinSalFrame* pFrame = new WinSalFrame; HWND hWnd; DWORD nSysStyle = 0; DWORD nExSysStyle = 0; - BOOL bSubFrame = FALSE; + sal_Bool bSubFrame = FALSE; if( getenv( "SAL_SYNCHRONIZE" ) ) // no buffering of drawing commands GdiSetBatchLimit( 1 ); @@ -583,11 +584,11 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, // helper that only creates the HWND // to allow for easy reparenting of system windows, (i.e. destroy and create new) -HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, BOOL bAsChild ) +HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, sal_Bool bAsChild ) { HINSTANCE hInstance = GetSalData()->mhInst; - ULONG nSysStyle = GetWindowLong( oldhWnd, GWL_STYLE ); - ULONG nExSysStyle = GetWindowLong( oldhWnd, GWL_EXSTYLE ); + sal_uLong nSysStyle = GetWindowLong( oldhWnd, GWL_STYLE ); + sal_uLong nExSysStyle = GetWindowLong( oldhWnd, GWL_EXSTYLE ); if( bAsChild ) { @@ -606,7 +607,7 @@ HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, BOOL bAsChild ) // Uebersetzungstabelle von System-Keycodes in StarView-Keycodes #define KEY_TAB_SIZE 146 -static USHORT aImplTranslateKeyTab[KEY_TAB_SIZE] = +static sal_uInt16 aImplTranslateKeyTab[KEY_TAB_SIZE] = { // StarView-Code System-Code Index 0, // 0 @@ -863,11 +864,11 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, try { - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); + uno::Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + uno::Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < xMultiMon->getCount()) ) { - Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW ); + uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW ); com::sun::star::awt::Rectangle aRect; if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect ) { @@ -903,7 +904,7 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, // ----------------------------------------------------------------------- -static void ImplSalFrameFullScreenPos( WinSalFrame* pFrame, BOOL bAlways = FALSE ) +static void ImplSalFrameFullScreenPos( WinSalFrame* pFrame, sal_Bool bAlways = FALSE ) { if ( bAlways || !IsIconic( pFrame->mhWnd ) ) { @@ -1167,9 +1168,9 @@ void WinSalFrame::ReleaseGraphics( SalGraphics* pGraphics ) // ----------------------------------------------------------------------- -BOOL WinSalFrame::PostEvent( void* pData ) +sal_Bool WinSalFrame::PostEvent( void* pData ) { - return (BOOL)ImplPostMessage( mhWnd, SAL_MSG_USEREVENT, 0, (LPARAM)pData ); + return (sal_Bool)ImplPostMessage( mhWnd, SAL_MSG_USEREVENT, 0, (LPARAM)pData ); } // ----------------------------------------------------------------------- @@ -1187,7 +1188,7 @@ void WinSalFrame::SetTitle( const XubString& rTitle ) // ----------------------------------------------------------------------- -void WinSalFrame::SetIcon( USHORT nIcon ) +void WinSalFrame::SetIcon( sal_uInt16 nIcon ) { // If we have a window without an Icon (for example a dialog), ignore this call if ( mbNoIcon ) @@ -1244,7 +1245,7 @@ SalFrame* WinSalFrame::GetParent() const // ----------------------------------------------------------------------- -static void ImplSalShow( HWND hWnd, BOOL bVisible, BOOL bNoActivate ) +static void ImplSalShow( HWND hWnd, sal_Bool bVisible, sal_Bool bNoActivate ) { WinSalFrame* pFrame = GetWindowPtr( hWnd ); if ( !pFrame ) @@ -1329,7 +1330,7 @@ void WinSalFrame::SetExtendedFrameStyle( SalExtStyle ) // ----------------------------------------------------------------------- -void WinSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) +void WinSalFrame::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. @@ -1342,7 +1343,7 @@ void WinSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) // ----------------------------------------------------------------------- -void WinSalFrame::Enable( BOOL bEnable ) +void WinSalFrame::Enable( sal_Bool bEnable ) { EnableWindow( mhWnd, bEnable ); } @@ -1364,9 +1365,9 @@ void WinSalFrame::SetMaxClientSize( long nWidth, long nHeight ) // ----------------------------------------------------------------------- void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, - USHORT nFlags ) + sal_uInt16 nFlags ) { - BOOL bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; + sal_Bool bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; if ( !bVisible ) { Window *pClientWin = GetWindow()->ImplGetClientWindow(); @@ -1381,7 +1382,7 @@ void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, ShowWindow( mhWnd, SW_RESTORE ); } - USHORT nEvent = 0; + sal_uInt16 nEvent = 0; UINT nPosSize = 0; RECT aClientRect, aWindowRect; GetClientRect( mhWnd, &aClientRect ); // x,y always 0,0, but width and height without border @@ -1533,7 +1534,7 @@ void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, // 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) ) @@ -1576,7 +1577,7 @@ void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, // ----------------------------------------------------------------------- -static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, BOOL bAsChild ) +static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, sal_Bool bAsChild ) { // save hwnd, will be overwritten in WM_CREATE during createwindow HWND hWndOld = pThis->mhWnd; @@ -1609,8 +1610,8 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, BOOL bAs pObject = pObject->mpNextObject; } - BOOL bNeedGraphics = pThis->mbGraphics; - BOOL bNeedCacheDC = FALSE; + sal_Bool bNeedGraphics = pThis->mbGraphics; + sal_Bool bNeedCacheDC = FALSE; HFONT hFont = NULL; HPEN hPen = NULL; @@ -1850,8 +1851,8 @@ void WinSalFrame::SetWindowState( const SalFrameState* pState ) GetWindowPlacement( mhWnd, &aPlacement ); // Status setzen - BOOL bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; - BOOL bUpdateHiddenFramePos = FALSE; + sal_Bool bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; + sal_Bool bUpdateHiddenFramePos = FALSE; if ( !bVisible ) { aPlacement.showCmd = SW_HIDE; @@ -1932,7 +1933,7 @@ void WinSalFrame::SetWindowState( const SalFrameState* pState ) // ----------------------------------------------------------------------- -BOOL WinSalFrame::GetWindowState( SalFrameState* pState ) +sal_Bool WinSalFrame::GetWindowState( SalFrameState* pState ) { if ( maState.mnWidth && maState.mnHeight ) { @@ -1986,7 +1987,7 @@ void WinSalFrame::SetApplicationID( const rtl::OUString &/*rApplicationID*/ ) // ----------------------------------------------------------------------- -void WinSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) +void WinSalFrame::ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ) { if ( (mbFullScreen == bFullScreen) && (!bFullScreen || (mnDisplay == nDisplay)) ) return; @@ -2019,7 +2020,7 @@ void WinSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) { // wenn ShowState wieder hergestellt werden muss, hiden wir zuerst // das Fenster, damit es nicht so sehr flackert - BOOL bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; + sal_Bool bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; if ( bVisible && (mnShowState != mnFullScreenShowState) ) ShowWindow( mhWnd, SW_HIDE ); @@ -2051,7 +2052,7 @@ void WinSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) // ----------------------------------------------------------------------- -void WinSalFrame::StartPresentation( BOOL bStart ) +void WinSalFrame::StartPresentation( sal_Bool bStart ) { if ( mbPresentation == bStart ) return; @@ -2106,7 +2107,7 @@ void WinSalFrame::StartPresentation( BOOL bStart ) // ----------------------------------------------------------------------- -void WinSalFrame::SetAlwaysOnTop( BOOL bOnTop ) +void WinSalFrame::SetAlwaysOnTop( sal_Bool bOnTop ) { HWND hWnd; if ( bOnTop ) @@ -2118,7 +2119,7 @@ void WinSalFrame::SetAlwaysOnTop( BOOL bOnTop ) // ----------------------------------------------------------------------- -static void ImplSalToTop( HWND hWnd, USHORT nFlags ) +static void ImplSalToTop( HWND hWnd, sal_uInt16 nFlags ) { WinSalFrame* pToTopFrame = GetWindowPtr( hWnd ); if( pToTopFrame && (pToTopFrame->mnStyle & SAL_FRAME_STYLE_SYSTEMCHILD) != 0 ) @@ -2174,7 +2175,7 @@ static void ImplSalToTop( HWND hWnd, USHORT nFlags ) // ----------------------------------------------------------------------- -void WinSalFrame::ToTop( USHORT nFlags ) +void WinSalFrame::ToTop( sal_uInt16 nFlags ) { nFlags &= ~SAL_FRAME_TOTOP_GRABFOCUS; // this flag is not needed on win32 // Post this Message to the window, because this only works @@ -2325,7 +2326,7 @@ void WinSalFrame::SetPointer( PointerStyle ePointerStyle ) // ----------------------------------------------------------------------- -void WinSalFrame::CaptureMouse( BOOL bCapture ) +void WinSalFrame::CaptureMouse( sal_Bool bCapture ) { // Send this Message to the window, because CaptureMouse() only work // in the thread of the window, which has create this window @@ -2367,7 +2368,7 @@ void WinSalFrame::Sync() static void ImplSalFrameSetInputContext( HWND hWnd, const SalInputContext* pContext ) { WinSalFrame* pFrame = GetWindowPtr( hWnd ); - BOOL bIME = (pContext->mnOptions & SAL_INPUTCONTEXT_TEXT) != 0; + sal_Bool bIME = (pContext->mnOptions & SAL_INPUTCONTEXT_TEXT) != 0; if ( bIME ) { if ( !pFrame->mbIME ) @@ -2434,7 +2435,7 @@ void WinSalFrame::SetInputContext( SalInputContext* pContext ) // ----------------------------------------------------------------------- -static void ImplSalFrameEndExtTextInput( HWND hWnd, USHORT nFlags ) +static void ImplSalFrameEndExtTextInput( HWND hWnd, sal_uInt16 nFlags ) { HIMC hIMC = ImmGetContext( hWnd ); if ( hIMC ) @@ -2452,7 +2453,7 @@ static void ImplSalFrameEndExtTextInput( HWND hWnd, USHORT nFlags ) // ----------------------------------------------------------------------- -void WinSalFrame::EndExtTextInput( USHORT nFlags ) +void WinSalFrame::EndExtTextInput( sal_uInt16 nFlags ) { // Must be called in the main thread! ImplSendMessage( mhWnd, SAL_MSG_ENDEXTTEXTINPUT, (WPARAM)nFlags, 0 ); @@ -2523,7 +2524,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, // ----------------------------------------------------------------------- -XubString WinSalFrame::GetKeyName( USHORT nKeyCode ) +XubString WinSalFrame::GetKeyName( sal_uInt16 nKeyCode ) { static const int nMaxKeyLen = 350; sal_Unicode aKeyBuf[ nMaxKeyLen ]; @@ -2533,26 +2534,26 @@ XubString WinSalFrame::GetKeyName( USHORT nKeyCode ) if ( nKeyCode & KEY_MOD1 ) { nSysCode = MapVirtualKey( VK_CONTROL, 0 ); - nSysCode = (nSysCode << 16) | (((ULONG)1) << 25); + nSysCode = (nSysCode << 16) | (((sal_uLong)1) << 25); ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen, nMaxKeyLen, "Ctrl" ); } if ( nKeyCode & KEY_MOD2 ) { nSysCode = MapVirtualKey( VK_MENU, 0 ); - nSysCode = (nSysCode << 16) | (((ULONG)1) << 25); + nSysCode = (nSysCode << 16) | (((sal_uLong)1) << 25); ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen, nMaxKeyLen, "Alt" ); } if ( nKeyCode & KEY_SHIFT ) { nSysCode = MapVirtualKey( VK_SHIFT, 0 ); - nSysCode = (nSysCode << 16) | (((ULONG)1) << 25); + nSysCode = (nSysCode << 16) | (((sal_uLong)1) << 25); ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen, nMaxKeyLen, "Shift" ); } - USHORT nCode = nKeyCode & 0x0FFF; - ULONG nSysCode2 = 0; + sal_uInt16 nCode = nKeyCode & 0x0FFF; + sal_uLong nSysCode2 = 0; sal_Char* pReplace = NULL; sal_Unicode cSVCode = 0; sal_Char aFBuf[4]; @@ -2591,42 +2592,42 @@ XubString WinSalFrame::GetKeyName( USHORT nKeyCode ) { case KEY_DOWN: nSysCode = VK_DOWN; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Down"; break; case KEY_UP: nSysCode = VK_UP; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Up"; break; case KEY_LEFT: nSysCode = VK_LEFT; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Left"; break; case KEY_RIGHT: nSysCode = VK_RIGHT; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Right"; break; case KEY_HOME: nSysCode = VK_HOME; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Home"; break; case KEY_END: nSysCode = VK_END; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "End"; break; case KEY_PAGEUP: nSysCode = VK_PRIOR; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Page Up"; break; case KEY_PAGEDOWN: nSysCode = VK_NEXT; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Page Down"; break; case KEY_RETURN: @@ -2651,12 +2652,12 @@ XubString WinSalFrame::GetKeyName( USHORT nKeyCode ) break; case KEY_INSERT: nSysCode = VK_INSERT; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Insert"; break; case KEY_DELETE: nSysCode = VK_DELETE; - nSysCode2 = (((ULONG)1) << 24); + nSysCode2 = (((sal_uLong)1) << 24); pReplace = "Delete"; break; @@ -2720,12 +2721,12 @@ XubString WinSalFrame::GetKeyName( USHORT nKeyCode ) if( !nKeyBufLen ) return XubString(); - return XubString( aKeyBuf, sal::static_int_cast< USHORT >(nKeyBufLen) ); + return XubString( aKeyBuf, sal::static_int_cast< sal_uInt16 >(nKeyBufLen) ); } // ----------------------------------------------------------------------- -XubString WinSalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) +XubString WinSalFrame::GetSymbolKeyName( const XubString&, sal_uInt16 nKeyCode ) { return GetKeyName( nKeyCode ); } @@ -2803,6 +2804,29 @@ static long ImplA2I( const BYTE* pStr ) } // ----------------------------------------------------------------------- +static HRESULT WINAPI backwardCompatibleDwmIsCompositionEnabled( BOOL* pOut ) +{ + *pOut = FALSE; + return S_OK; +} + +static BOOL ImplDwmIsCompositionEnabled() +{ + SalData* pSalData = GetSalData(); + if( ! pSalData->mpDwmIsCompositionEnabled ) + { + rtl::OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "Dwmapi.dll" ) ); + pSalData->maDwmLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); + if( pSalData->maDwmLib ) + pSalData->mpDwmIsCompositionEnabled = (DwmIsCompositionEnabled_ptr)osl_getAsciiFunctionSymbol( pSalData->maDwmLib, "DwmIsCompositionEnabled" ); + if( ! pSalData->mpDwmIsCompositionEnabled ) // something failed + pSalData->mpDwmIsCompositionEnabled = backwardCompatibleDwmIsCompositionEnabled; + } + BOOL aResult = FALSE; + HRESULT nError = pSalData->mpDwmIsCompositionEnabled( &aResult ); + return nError == S_OK && aResult; +} + void WinSalFrame::UpdateSettings( AllSettings& rSettings ) { @@ -2828,34 +2852,30 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) &nType, aValueBuf, &nValueSize ) == ERROR_SUCCESS ) { if ( nType == REG_SZ ) - aMouseSettings.SetMenuDelay( (ULONG)ImplA2I( aValueBuf ) ); + aMouseSettings.SetMenuDelay( (sal_uLong)ImplA2I( aValueBuf ) ); } RegCloseKey( hRegKey ); } StyleSettings aStyleSettings = rSettings.GetStyleSettings(); - BOOL bCompBorder = (aStyleSettings.GetOptions() & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE)) == 0; // TODO: once those options vanish: just set bCompBorder to TRUE // to have the system colors read aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) ); aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) ); aStyleSettings.SetCursorBlinkTime( GetCaretBlinkTime() ); - if ( bCompBorder ) - { - aStyleSettings.SetFloatTitleHeight( GetSystemMetrics( SM_CYSMCAPTION ) ); - aStyleSettings.SetTitleHeight( GetSystemMetrics( SM_CYCAPTION ) ); - aStyleSettings.SetActiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVEBORDER ) ) ); - aStyleSettings.SetDeactiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVEBORDER ) ) ); - aStyleSettings.SetActiveColor2( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTACTIVECAPTION ) ) ); - aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTINACTIVECAPTION ) ) ); - aStyleSettings.SetFaceColor( ImplWinColorToSal( GetSysColor( COLOR_3DFACE ) ) ); - aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); - aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( COLOR_3DHILIGHT ) ) ); - aStyleSettings.SetLightBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DLIGHT ) ) ); - aStyleSettings.SetShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); - aStyleSettings.SetDarkShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DDKSHADOW ) ) ); - } + aStyleSettings.SetFloatTitleHeight( GetSystemMetrics( SM_CYSMCAPTION ) ); + aStyleSettings.SetTitleHeight( GetSystemMetrics( SM_CYCAPTION ) ); + aStyleSettings.SetActiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVEBORDER ) ) ); + aStyleSettings.SetDeactiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVEBORDER ) ) ); + aStyleSettings.SetActiveColor2( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTACTIVECAPTION ) ) ); + aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTINACTIVECAPTION ) ) ); + aStyleSettings.SetFaceColor( ImplWinColorToSal( GetSysColor( COLOR_3DFACE ) ) ); + aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); + aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( COLOR_3DHILIGHT ) ) ); + aStyleSettings.SetLightBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DLIGHT ) ) ); + aStyleSettings.SetShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); + aStyleSettings.SetDarkShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DDKSHADOW ) ) ); aStyleSettings.SetWorkspaceColor( ImplWinColorToSal( GetSysColor( COLOR_APPWORKSPACE ) ) ); aStyleSettings.SetHelpColor( ImplWinColorToSal( GetSysColor( COLOR_INFOBK ) ) ); aStyleSettings.SetHelpTextColor( ImplWinColorToSal( GetSysColor( COLOR_INFOTEXT ) ) ); @@ -2877,37 +2897,52 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetHighlightTextColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) ) ); aStyleSettings.SetMenuHighlightColor( aStyleSettings.GetHighlightColor() ); aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetHighlightTextColor() ); - if ( bCompBorder ) - { - aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) ) ); - aStyleSettings.SetMenuBarColor( aStyleSettings.GetMenuColor() ); - aStyleSettings.SetMenuBorderColor( aStyleSettings.GetLightBorderColor() ); // overriden below for flat menus - aStyleSettings.SetUseFlatBorders( FALSE ); - aStyleSettings.SetUseFlatMenues( FALSE ); - aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); - aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); - aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) ); - aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) ); - aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) ); - aStyleSettings.SetDeactiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ) ); - if ( aSalShlData.mbWXP ) + + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maNWFData.mnMenuFormatExtraBorder = 0; + pSVData->maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); + GetSalData()->mbThemeMenuSupport = FALSE; + aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) ) ); + aStyleSettings.SetMenuBarColor( aStyleSettings.GetMenuColor() ); + aStyleSettings.SetMenuBorderColor( aStyleSettings.GetLightBorderColor() ); // overriden below for flat menus + aStyleSettings.SetUseFlatBorders( FALSE ); + aStyleSettings.SetUseFlatMenues( FALSE ); + aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); + aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); + aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) ); + aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) ); + aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) ); + aStyleSettings.SetDeactiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ) ); + if ( aSalShlData.mbWXP ) + { + // only xp supports a different menu bar color + long bFlatMenues = 0; + SystemParametersInfo( SPI_GETFLATMENU, 0, &bFlatMenues, 0); + if( bFlatMenues ) { - // only xp supports a different menu bar color - long bFlatMenues = 0; - SystemParametersInfo( SPI_GETFLATMENU, 0, &bFlatMenues, 0); - if( bFlatMenues ) - { - aStyleSettings.SetUseFlatMenues( TRUE ); - aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( COLOR_MENUBAR ) ) ); - aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) ); - aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); - - // flat borders for our controls etc. as well in this mode (ie, no 3d borders) - // this is not active in the classic style appearance - aStyleSettings.SetUseFlatBorders( TRUE ); - } + aStyleSettings.SetUseFlatMenues( TRUE ); + aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( COLOR_MENUBAR ) ) ); + aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) ); + aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); + + // flat borders for our controls etc. as well in this mode (ie, no 3d borders) + // this is not active in the classic style appearance + aStyleSettings.SetUseFlatBorders( TRUE ); } } + // check if vista or newer runs + // in Aero theme (and similar ?) the menu text color does not change + // for selected items; also on WinXP and earlier menus are not themed + if( aSalShlData.maVersionInfo.dwMajorVersion >= 6 && + ImplDwmIsCompositionEnabled() + ) + { + // in aero menuitem highlight text is drawn in the same color as normal + aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() ); + pSVData->maNWFData.mnMenuFormatExtraBorder = 2; + pSVData->maNWFData.maMenuBarHighlightTextColor = aStyleSettings.GetMenuTextColor(); + GetSalData()->mbThemeMenuSupport = TRUE; + } // Bei hellgrau geben wir die Farbe vor, damit es besser aussieht if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); @@ -2916,9 +2951,9 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) // 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); + BYTE nRed = (BYTE)(((sal_uInt16)aColor1.GetRed() + (sal_uInt16)aColor2.GetRed())/2); + BYTE nGreen = (BYTE)(((sal_uInt16)aColor1.GetGreen() + (sal_uInt16)aColor2.GetGreen())/2); + BYTE nBlue = (BYTE)(((sal_uInt16)aColor1.GetBlue() + (sal_uInt16)aColor2.GetBlue())/2); aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); } @@ -2998,10 +3033,10 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetInfoFont( aAppFont ); aStyleSettings.SetToolFont( aAppFont ); - WIN_BOOL bDragFull; + BOOL bDragFull; if ( SystemParametersInfo( SPI_GETDRAGFULLWINDOWS, 0, &bDragFull, 0 ) ) { - ULONG nDragFullOptions = aStyleSettings.GetDragFullOptions(); + sal_uLong nDragFullOptions = aStyleSettings.GetDragFullOptions(); if ( bDragFull ) nDragFullOptions |= DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT; else @@ -3024,7 +3059,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) { if ( nType == REG_SZ ) { - nValue = (ULONG)ImplA2I( aValueBuf ); + nValue = (sal_uLong)ImplA2I( aValueBuf ); if ( (nValue > 1000) && (nValue < 10000) ) { MiscSettings aMiscSettings = rSettings.GetMiscSettings(); @@ -3055,7 +3090,7 @@ SalBitmap* WinSalFrame::SnapShot() HDC hDC = GetWindowDC( mhWnd ); HBITMAP hBmpBitmap = CreateCompatibleBitmap( hDC, nDX, nDY ); HDC hBmpDC = ImplGetCachedDC( CACHED_HDC_1, hBmpBitmap ); - BOOL bRet; + sal_Bool bRet; bRet = BitBlt( hBmpDC, 0, 0, nDX, nDY, hDC, 0, 0, SRCCOPY ) ? TRUE : FALSE; ImplReleaseCachedDC( CACHED_HDC_1 ); @@ -3143,7 +3178,7 @@ SalFrame::SalIndicatorState WinSalFrame::GetIndicatorState() return aState; } -void WinSalFrame::SimulateKeyPress( USHORT nKeyCode ) +void WinSalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) { BYTE nVKey = 0; switch (nKeyCode) @@ -3175,11 +3210,11 @@ void WinSalFrame::ResetClipRegion() // ----------------------------------------------------------------------- -void WinSalFrame::BeginSetClipRegion( ULONG nRects ) +void WinSalFrame::BeginSetClipRegion( sal_uLong nRects ) { if( mpClipRgnData ) delete [] (BYTE*)mpClipRgnData; - ULONG nRectBufSize = sizeof(RECT)*nRects; + sal_uLong nRectBufSize = sizeof(RECT)*nRects; mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize]; mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER ); mpClipRgnData->rdh.iType = RDH_RECTANGLES; @@ -3251,7 +3286,7 @@ void WinSalFrame::EndSetClipRegion() } else { - ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); + sal_uLong nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); hRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); } delete [] (BYTE*)mpClipRgnData; @@ -3296,8 +3331,8 @@ static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg, } SalMouseEvent aMouseEvt; long nRet; - USHORT nEvent = 0; - BOOL bCall = TRUE; + sal_uInt16 nEvent = 0; + sal_Bool bCall = TRUE; aMouseEvt.mnX = (short)LOWORD( lParam ); aMouseEvt.mnY = (short)HIWORD( lParam ); @@ -3531,9 +3566,9 @@ static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar // ----------------------------------------------------------------------- -static USHORT ImplSalGetKeyCode( WPARAM wParam ) +static sal_uInt16 ImplSalGetKeyCode( WPARAM wParam ) { - USHORT nKeyCode; + sal_uInt16 nKeyCode; // convert KeyCode if ( wParam < KEY_TAB_SIZE ) @@ -3541,7 +3576,7 @@ static USHORT ImplSalGetKeyCode( WPARAM wParam ) else { SalData* pSalData = GetSalData(); - std::map< UINT, USHORT >::const_iterator it = pSalData->maVKMap.find( (UINT)wParam ); + std::map< UINT, sal_uInt16 >::const_iterator it = pSalData->maVKMap.find( (UINT)wParam ); if( it != pSalData->maVKMap.end() ) nKeyCode = it->second; else @@ -3555,7 +3590,7 @@ static USHORT ImplSalGetKeyCode( WPARAM wParam ) static UINT ImplStrToNum( const sal_Char* pStr ) { - USHORT n = 0; + sal_uInt16 n = 0; // Solange es sich um eine Ziffer handelt, String umwandeln while( (*pStr >= 48) && (*pStr <= 57) ) @@ -3572,7 +3607,7 @@ static UINT ImplStrToNum( const sal_Char* pStr ) static void ImplUpdateInputLang( WinSalFrame* pFrame ) { - BOOL bLanguageChange = FALSE; + sal_Bool bLanguageChange = FALSE; UINT nLang = LOWORD( GetKeyboardLayout( 0 ) ); if ( nLang && nLang != pFrame->mnInputLang ) { @@ -3612,9 +3647,9 @@ LanguageType WinSalFrame::GetInputLanguage() // ----------------------------------------------------------------------- -BOOL WinSalFrame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ) +sal_Bool WinSalFrame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ) { - BOOL bRet = FALSE; + sal_Bool bRet = FALSE; HKL hkl = 0; // just use the passed language identifier, do not try to load additional keyboard support @@ -3654,14 +3689,14 @@ BOOL WinSalFrame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangT static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rResult ) { - static BOOL bIgnoreCharMsg = FALSE; + static sal_Bool bIgnoreCharMsg = FALSE; static WPARAM nDeadChar = 0; static WPARAM nLastVKChar = 0; - static USHORT nLastChar = 0; - static USHORT nLastModKeyCode = 0; + static sal_uInt16 nLastChar = 0; + static sal_uInt16 nLastModKeyCode = 0; static bool bWaitForModKeyRelease = false; - USHORT nRepeat = LOWORD( lParam )-1; - USHORT nModCode = 0; + sal_uInt16 nRepeat = LOWORD( lParam )-1; + sal_uInt16 nModCode = 0; // Key wurde evtl. durch SysChild an uns weitergeleitet und // darf somit dann nicht doppelt verarbeitet werden @@ -3721,11 +3756,11 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg, SalKeyEvent aKeyEvt; if ( (wParam >= '0') && (wParam <= '9') ) - aKeyEvt.mnCode = sal::static_int_cast<USHORT>(KEYGROUP_NUM + wParam - '0'); + aKeyEvt.mnCode = sal::static_int_cast<sal_uInt16>(KEYGROUP_NUM + wParam - '0'); else if ( (wParam >= 'A') && (wParam <= 'Z') ) - aKeyEvt.mnCode = sal::static_int_cast<USHORT>(KEYGROUP_ALPHA + wParam - 'A'); + aKeyEvt.mnCode = sal::static_int_cast<sal_uInt16>(KEYGROUP_ALPHA + wParam - 'A'); else if ( (wParam >= 'a') && (wParam <= 'z') ) - aKeyEvt.mnCode = sal::static_int_cast<USHORT>(KEYGROUP_ALPHA + wParam - 'a'); + aKeyEvt.mnCode = sal::static_int_cast<sal_uInt16>(KEYGROUP_ALPHA + wParam - 'a'); else if ( wParam == 0x0D ) // RETURN aKeyEvt.mnCode = KEY_RETURN; else if ( wParam == 0x1B ) // ESCAPE @@ -3793,7 +3828,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg, aModEvt.mnCode = nModCode; aModEvt.mnModKeyCode = 0; // no command events will be sent if this member is 0 - USHORT tmpCode = 0; + sal_uInt16 tmpCode = 0; if( GetKeyState( VK_LSHIFT ) & 0x8000 ) tmpCode |= MODKEY_LSHIFT; if( GetKeyState( VK_RSHIFT ) & 0x8000 ) @@ -3827,11 +3862,11 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg, else { SalKeyEvent aKeyEvt; - USHORT nEvent; + sal_uInt16 nEvent; MSG aCharMsg; - WIN_BOOL bCharPeek = FALSE; + BOOL bCharPeek = FALSE; UINT nCharMsg = WM_CHAR; - BOOL bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP); + sal_Bool bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP); nLastModKeyCode = 0; // make sure no modkey messages are sent if they belong to a hotkey (see above) aKeyEvt.mnCharCode = 0; @@ -3946,8 +3981,8 @@ long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, if ( !pFrame ) return 0; - USHORT nRepeat = LOWORD( lParam )-1; - USHORT nModCode = 0; + sal_uInt16 nRepeat = LOWORD( lParam )-1; + sal_uInt16 nModCode = 0; // determine modifiers if ( GetKeyState( VK_SHIFT ) & 0x8000 ) @@ -3960,8 +3995,8 @@ long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, if ( (wParam != VK_SHIFT) && (wParam != VK_CONTROL) && (wParam != VK_MENU) ) { SalKeyEvent aKeyEvt; - USHORT nEvent; - BOOL bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP); + sal_uInt16 nEvent; + sal_Bool bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP); // convert KeyCode aKeyEvt.mnCode = ImplSalGetKeyCode( wParam ); @@ -3996,9 +4031,9 @@ long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam ) if ( !pFrame ) return 0; - USHORT nRepeat = LOWORD( lParam )-1; - USHORT nModCode = 0; - USHORT cKeyCode = (USHORT)wParam; + sal_uInt16 nRepeat = LOWORD( lParam )-1; + sal_uInt16 nModCode = 0; + sal_uInt16 cKeyCode = (sal_uInt16)wParam; // determine modifiers if ( GetKeyState( VK_SHIFT ) & 0x8000 ) @@ -4030,7 +4065,7 @@ long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam ) static bool ImplHandlePaintMsg( HWND hWnd ) { - BOOL bMutex = FALSE; + sal_Bool bMutex = FALSE; if ( ImplSalYieldMutexTryToAcquire() ) bMutex = TRUE; @@ -4386,7 +4421,7 @@ static long ImplHandleShutDownMsg( HWND hWnd ) static void ImplHandleSettingsChangeMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { - USHORT nSalEvent = SALEVENT_SETTINGSCHANGED; + sal_uInt16 nSalEvent = SALEVENT_SETTINGSCHANGED; if ( nMsg == WM_DEVMODECHANGE ) nSalEvent = SALEVENT_PRINTERCHANGED; @@ -4482,7 +4517,7 @@ static void ImplHandleForcePalette( HWND hWnd ) // ----------------------------------------------------------------------- -static LRESULT ImplHandlePalette( BOOL bFrame, HWND hWnd, UINT nMsg, +static LRESULT ImplHandlePalette( sal_Bool bFrame, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef ) { SalData* pSalData = GetSalData(); @@ -4500,7 +4535,7 @@ static LRESULT ImplHandlePalette( BOOL bFrame, HWND hWnd, UINT nMsg, return 0; } - BOOL bReleaseMutex = FALSE; + sal_Bool bReleaseMutex = FALSE; if ( (nMsg == WM_QUERYNEWPALETTE) || (nMsg == WM_PALETTECHANGED) ) { // Da Windows diese Messages auch sendet, muss hier auch die @@ -4519,8 +4554,8 @@ static LRESULT ImplHandlePalette( BOOL bFrame, HWND hWnd, UINT nMsg, HDC hDC; HPALETTE hOldPal; UINT nCols; - BOOL bStdDC; - BOOL bUpdate; + sal_Bool bStdDC; + sal_Bool bUpdate; pSalData->mbInPalChange = TRUE; @@ -4713,7 +4748,7 @@ static int ImplHandleMinMax( HWND hWnd, LPARAM lParam ) // the pointer is stored in every item, so if no position // is specified we just use the first item (ie, pos=0) // if bByPosition is FALSE then nPos denotes a menu id instead of a position -static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, BOOL bByPosition=TRUE ) +static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, sal_Bool bByPosition=TRUE ) { DWORD err=0; @@ -4868,9 +4903,9 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) COLORREF clrPrevText, clrPrevBkgnd; HFONT hfntOld; HBRUSH hbrOld; - BOOL fChecked = (pDI->itemState & ODS_CHECKED) ? TRUE : FALSE; - BOOL fSelected = (pDI->itemState & ODS_SELECTED) ? TRUE : FALSE; - BOOL fDisabled = (pDI->itemState & (ODS_DISABLED | ODS_GRAYED)) ? TRUE : FALSE; + sal_Bool fChecked = (pDI->itemState & ODS_CHECKED) ? TRUE : FALSE; + sal_Bool fSelected = (pDI->itemState & ODS_SELECTED) ? TRUE : FALSE; + sal_Bool fDisabled = (pDI->itemState & (ODS_DISABLED | ODS_GRAYED)) ? TRUE : FALSE; // Set the appropriate foreground and background colors. RECT aRect = pDI->rcItem; @@ -5014,7 +5049,7 @@ static int ImplHandleMenuActivate( HWND hWnd, WPARAM wParam, LPARAM ) HMENU hMenu = (HMENU) wParam; // WORD nPos = LOWORD (lParam); - // BOOL bWindowMenu = (BOOL) HIWORD(lParam); + // sal_Bool bWindowMenu = (sal_Bool) HIWORD(lParam); // Send activate and deactivate together, so we have not keep track of opened menues // this will be enough to have the menues updated correctly @@ -5049,7 +5084,7 @@ static int ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam ) if( !GetSalData()->IsKnownMenuHandle( hMenu ) ) return 0; - BOOL bByPosition = FALSE; + sal_Bool bByPosition = FALSE; if( nFlags & MF_POPUP ) bByPosition = TRUE; @@ -5149,8 +5184,8 @@ static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam ) if ( pFrame->mbFullScreen ) { - WIN_BOOL bMaximize = IsZoomed( pFrame->mhWnd ); - WIN_BOOL bMinimize = IsIconic( pFrame->mhWnd ); + BOOL bMaximize = IsZoomed( pFrame->mhWnd ); + BOOL bMinimize = IsIconic( pFrame->mhWnd ); if ( (nCommand == SC_SIZE) || (!bMinimize && (nCommand == SC_MOVE)) || (!bMaximize && (nCommand == SC_MAXIMIZE)) || @@ -5214,7 +5249,7 @@ static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam ) if ( ((cKeyCode >= 48) && (cKeyCode <= 57)) || ((cKeyCode >= 97) && (cKeyCode <= 122)) ) { - USHORT nModCode = 0; + sal_uInt16 nModCode = 0; if ( GetKeyState( VK_SHIFT ) & 0x8000 ) nModCode |= KEY_SHIFT; if ( GetKeyState( VK_CONTROL ) & 0x8000 ) @@ -5303,9 +5338,9 @@ static void ImplUpdateIMECursorPos( WinSalFrame* pFrame, HIMC hIMC ) // ----------------------------------------------------------------------- -static BOOL ImplHandleIMEStartComposition( HWND hWnd ) +static sal_Bool ImplHandleIMEStartComposition( HWND hWnd ) { - BOOL bDef = TRUE; + sal_Bool bDef = TRUE; ImplSalYieldMutexAcquireWithWait(); @@ -5333,10 +5368,10 @@ static BOOL ImplHandleIMEStartComposition( HWND hWnd ) // ----------------------------------------------------------------------- -static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, +static sal_Bool ImplHandleIMECompositionInput( WinSalFrame* pFrame, HIMC hIMC, LPARAM lParam ) { - BOOL bDef = TRUE; + sal_Bool bDef = TRUE; // Init Event SalExtTextInputEvent aEvt; @@ -5377,7 +5412,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, { bDef = FALSE; - USHORT* pSalAttrAry = NULL; + sal_uInt16* pSalAttrAry = NULL; LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 0, 0 ) / sizeof( WCHAR ); if ( nTextLen > 0 ) { @@ -5386,23 +5421,23 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, aEvt.maText = XubString( reinterpret_cast<const xub_Unicode*>(pTextBuf), (xub_StrLen)nTextLen ); delete [] pTextBuf; - WIN_BYTE* pAttrBuf = NULL; + BYTE* pAttrBuf = NULL; LONG nAttrLen = ImmGetCompositionStringW( hIMC, GCS_COMPATTR, 0, 0 ); if ( nAttrLen > 0 ) { - pAttrBuf = new WIN_BYTE[nAttrLen]; + pAttrBuf = new BYTE[nAttrLen]; ImmGetCompositionStringW( hIMC, GCS_COMPATTR, pAttrBuf, nAttrLen ); } if ( pAttrBuf ) { xub_StrLen nTextLen = aEvt.maText.Len(); - pSalAttrAry = new USHORT[nTextLen]; - memset( pSalAttrAry, 0, nTextLen*sizeof( USHORT ) ); + pSalAttrAry = new sal_uInt16[nTextLen]; + memset( pSalAttrAry, 0, nTextLen*sizeof( sal_uInt16 ) ); for ( xub_StrLen i = 0; (i < nTextLen) && (i < nAttrLen); i++ ) { - WIN_BYTE nWinAttr = pAttrBuf[i]; - USHORT nSalAttr; + BYTE nWinAttr = pAttrBuf[i]; + sal_uInt16 nSalAttr; if ( nWinAttr == ATTR_TARGET_CONVERTED ) { nSalAttr = SAL_EXTTEXTINPUT_ATTR_BOLDUNDERLINE; @@ -5465,9 +5500,9 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, // ----------------------------------------------------------------------- -static BOOL ImplHandleIMEComposition( HWND hWnd, LPARAM lParam ) +static sal_Bool ImplHandleIMEComposition( HWND hWnd, LPARAM lParam ) { - BOOL bDef = TRUE; + sal_Bool bDef = TRUE; ImplSalYieldMutexAcquireWithWait(); WinSalFrame* pFrame = GetWindowPtr( hWnd ); @@ -5513,9 +5548,9 @@ static BOOL ImplHandleIMEComposition( HWND hWnd, LPARAM lParam ) // ----------------------------------------------------------------------- -static BOOL ImplHandleIMEEndComposition( HWND hWnd ) +static sal_Bool ImplHandleIMEEndComposition( HWND hWnd ) { - BOOL bDef = TRUE; + sal_Bool bDef = TRUE; ImplSalYieldMutexAcquireWithWait(); @@ -5701,8 +5736,8 @@ static LRESULT ImplHandleIMEConfirmReconvertString( HWND hWnd, LPARAM lParam ) pFrame->CallCallback( SALEVENT_SURROUNDINGTEXTREQUEST, (void*)&aEvt ); - ULONG nTmpStart = pReconvertString->dwCompStrOffset / sizeof(WCHAR); - ULONG nTmpEnd = nTmpStart + pReconvertString->dwCompStrLen; + sal_uLong nTmpStart = pReconvertString->dwCompStrOffset / sizeof(WCHAR); + sal_uLong nTmpEnd = nTmpStart + pReconvertString->dwCompStrLen; if( nTmpStart != aEvt.mnStart || nTmpEnd != aEvt.mnEnd ) { @@ -6090,11 +6125,11 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP rDef = FALSE; break; case SAL_MSG_TOTOP: - ImplSalToTop( hWnd, (USHORT)wParam ); + ImplSalToTop( hWnd, (sal_uInt16)wParam ); rDef = FALSE; break; case SAL_MSG_SHOW: - ImplSalShow( hWnd, (BOOL)wParam, (BOOL)lParam ); + ImplSalShow( hWnd, (sal_Bool)wParam, (sal_Bool)lParam ); rDef = FALSE; break; case SAL_MSG_SETINPUTCONTEXT: @@ -6102,7 +6137,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP rDef = FALSE; break; case SAL_MSG_ENDEXTTEXTINPUT: - ImplSalFrameEndExtTextInput( hWnd, (USHORT)(ULONG)(void*)wParam ); + ImplSalFrameEndExtTextInput( hWnd, (sal_uInt16)(sal_uLong)(void*)wParam ); rDef = FALSE; break; @@ -6269,11 +6304,11 @@ LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l // ----------------------------------------------------------------------- -BOOL ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rlResult ) +sal_Bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rlResult ) { // handle all messages concerning all frames so they get processed only once // Must work for Unicode and none Unicode - BOOL bResult = FALSE; + sal_Bool bResult = FALSE; if ( (nMsg == WM_PALETTECHANGED) || (nMsg == SAL_MSG_POSTPALCHANGED) ) { int bDef = TRUE; @@ -6292,7 +6327,7 @@ BOOL ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LR // ----------------------------------------------------------------------- -BOOL ImplWriteLastError( DWORD lastError, const char *szApiCall ) +sal_Bool ImplWriteLastError( DWORD lastError, const char *szApiCall ) { static int first=1; // if VCL_LOGFILE_ENABLED is set, Win32 API error messages can be written @@ -6300,7 +6335,7 @@ BOOL ImplWriteLastError( DWORD lastError, const char *szApiCall ) static char *logEnabled = getenv("VCL_LOGFILE_ENABLED"); if( logEnabled ) { - BOOL bSuccess = FALSE; + sal_Bool bSuccess = FALSE; static char *szTmp = getenv("TMP"); if( !szTmp || !*szTmp ) szTmp = getenv("TEMP"); diff --git a/vcl/win/source/window/salmenu.cxx b/vcl/win/source/window/salmenu.cxx index e86e3f27903d..d92039194f7a 100644 --- a/vcl/win/source/window/salmenu.cxx +++ b/vcl/win/source/window/salmenu.cxx @@ -48,7 +48,7 @@ static DWORD myerr=0; // ======================================================================= -BOOL SalData::IsKnownMenuHandle( HMENU hMenu ) +sal_Bool SalData::IsKnownMenuHandle( HMENU hMenu ) { if( mhMenuSet.find( hMenu ) == mhMenuSet.end() ) return FALSE; @@ -60,7 +60,7 @@ BOOL SalData::IsKnownMenuHandle( HMENU hMenu ) // WinSalInst factory methods -SalMenu* WinSalInstance::CreateMenu( BOOL bMenuBar ) +SalMenu* WinSalInstance::CreateMenu( sal_Bool bMenuBar, Menu* ) { WinSalMenu *pSalMenu = new WinSalMenu(); @@ -169,7 +169,7 @@ WinSalMenu::~WinSalMenu() ::DestroyMenu( mhMenu ); } -BOOL WinSalMenu::VisibleMenuBar() +sal_Bool WinSalMenu::VisibleMenuBar() { // The Win32 implementation never shows a native // menubar. Thus, native menues are only visible @@ -295,13 +295,13 @@ void WinSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsig } } -void WinSalMenu::CheckItem( unsigned nPos, BOOL bCheck ) +void WinSalMenu::CheckItem( unsigned nPos, sal_Bool bCheck ) { if( -1 != ::CheckMenuItem( mhMenu, nPos, MF_BYPOSITION|(bCheck ? MF_CHECKED : MF_UNCHECKED) ) ) ImplDrawMenuBar( this ); } -void WinSalMenu::EnableItem( unsigned nPos, BOOL bEnable ) +void WinSalMenu::EnableItem( unsigned nPos, sal_Bool bEnable ) { if( -1 != ::EnableMenuItem( mhMenu, nPos, MF_BYPOSITION|(bEnable ? MF_ENABLED : (MF_DISABLED|MF_GRAYED) ) ) ) ImplDrawMenuBar( this ); diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index bfa365af7ba2..5e034564d4cf 100644 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx @@ -38,10 +38,11 @@ #include <salframe.h> #include <salobj.h> #include <tools/debug.hxx> +#include <vcl/svapp.hxx> // ======================================================================= -static BOOL ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild ) +static sal_Bool ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild ) { if ( hWndParent == hWndChild ) return TRUE; @@ -102,6 +103,46 @@ WinSalFrame* ImplFindSalObjectFrame( HWND hWnd ) // ----------------------------------------------------------------------- +sal_Bool ImplInterceptChildWindowKeyDown( MSG& rMsg ) +{ + sal_Bool bResult = sal_False; + if ( rMsg.message == WM_KEYDOWN ) + { + wchar_t pClassName[10]; + sal_Int32 nLen = GetClassNameW( rMsg.hwnd, pClassName, 10 ); + if ( !( nLen == 9 && wcsncmp( pClassName, SAL_OBJECT_CLASSNAMEW, nLen ) == 0 ) ) + { + // look for the first SalObject in the parent hierarchy + HWND hWin = rMsg.hwnd; + HWND hLastOLEWindow = hWin; + WinSalObject* pSalObj = NULL; + do + { + hLastOLEWindow = hWin; + hWin = ::GetParent( hWin ); + if ( hWin ) + { + nLen = GetClassNameW( hWin, pClassName, 10 ); + if ( nLen == 9 && wcsncmp( pClassName, SAL_OBJECT_CLASSNAMEW, nLen ) == 0 ) + pSalObj = GetSalObjWindowPtr( hWin ); + } + } while( hWin && !pSalObj ); + + if ( pSalObj && pSalObj->mbInterceptChildWindowKeyDown && pSalObj->maSysData.hWnd ) + { + bResult = ( 1 == ImplSendMessage( pSalObj->maSysData.hWnd, rMsg.message, rMsg.wParam, rMsg.lParam ) ); + } + } + } + + return bResult; +} + +// ----------------------------------------------------------------------- + + +// ----------------------------------------------------------------------- + LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) { // Used for Unicode and none Unicode @@ -160,7 +201,7 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) // ----------------------------------------------------------------------- -BOOL ImplSalPreDispatchMsg( MSG* pMsg ) +sal_Bool ImplSalPreDispatchMsg( MSG* pMsg ) { // Used for Unicode and none Unicode SalData* pSalData = GetSalData(); @@ -185,7 +226,7 @@ BOOL ImplSalPreDispatchMsg( MSG* pMsg ) // SysKeys werden als WM_SYSCOMMAND verarbeitet // Char-Events verarbeiten wir nicht, da wir nur // Accelerator relevante Keys verarbeiten wollen - BOOL bWantedKeyCode = FALSE; + sal_Bool bWantedKeyCode = FALSE; // A-Z, 0-9 nur in Verbindung mit Control-Taste if ( ((pMsg->wParam >= 65) && (pMsg->wParam <= 90)) || ((pMsg->wParam >= 48) && (pMsg->wParam <= 57)) ) @@ -213,13 +254,13 @@ BOOL ImplSalPreDispatchMsg( MSG* pMsg ) { pSalData->mnSalObjWantKeyEvt = 0; - USHORT nKeyCode = LOWORD( pMsg->wParam ); + sal_uInt16 nKeyCode = LOWORD( pMsg->wParam ); // Nur 0-9 und A-Z if ( ((nKeyCode >= 48) && (nKeyCode <= 57)) || ((nKeyCode >= 65) && (nKeyCode <= 90)) || ((nKeyCode >= 97) && (nKeyCode <= 122)) ) { - BOOL bRet = FALSE; + sal_Bool bRet = FALSE; ImplSalYieldMutexAcquireWithWait(); pObject = ImplFindSalObject( pMsg->hwnd ); if ( pObject ) @@ -337,7 +378,7 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l { pSysObj = GetSalObjWindowPtr( hWnd ); HWND hFocusWnd = ::GetFocus(); - USHORT nEvent; + sal_uInt16 nEvent; if ( hFocusWnd && ImplIsSysWindowOrChild( hWnd, hFocusWnd ) ) nEvent = SALOBJ_EVENT_GETFOCUS; else @@ -612,6 +653,7 @@ WinSalObject::WinSalObject() mhLastFocusWnd = 0; maSysData.nSize = sizeof( SystemEnvData ); mpStdClipRgnData = NULL; + mbInterceptChildWindowKeyDown = sal_False; // Insert object in objectlist mpNextObject = pSalData->mpFirstObject; @@ -671,16 +713,16 @@ void WinSalObject::ResetClipRegion() // ----------------------------------------------------------------------- -USHORT WinSalObject::GetClipRegionType() +sal_uInt16 WinSalObject::GetClipRegionType() { return SAL_OBJECT_CLIP_INCLUDERECTS; } // ----------------------------------------------------------------------- -void WinSalObject::BeginSetClipRegion( ULONG nRectCount ) +void WinSalObject::BeginSetClipRegion( sal_uLong nRectCount ) { - ULONG nRectBufSize = sizeof(RECT)*nRectCount; + sal_uLong nRectBufSize = sizeof(RECT)*nRectCount; if ( nRectCount < SAL_CLIPRECT_COUNT ) { if ( !mpStdClipRgnData ) @@ -752,7 +794,7 @@ void WinSalObject::EndSetClipRegion() } else { - ULONG nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); + sal_uLong nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER); hRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData ); if ( mpClipRgnData != mpStdClipRgnData ) delete [] (BYTE*)mpClipRgnData; @@ -766,8 +808,8 @@ void WinSalObject::EndSetClipRegion() void WinSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) { - ULONG nStyle = 0; - BOOL bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; + sal_uLong nStyle = 0; + sal_Bool bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; if ( bVisible ) { ShowWindow( mhWnd, SW_HIDE ); @@ -780,7 +822,7 @@ void WinSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) // ----------------------------------------------------------------------- -void WinSalObject::Show( BOOL bVisible ) +void WinSalObject::Show( sal_Bool bVisible ) { if ( bVisible ) ShowWindow( mhWnd, SW_SHOWNORMAL ); @@ -790,7 +832,7 @@ void WinSalObject::Show( BOOL bVisible ) // ----------------------------------------------------------------------- -void WinSalObject::Enable( BOOL bEnable ) +void WinSalObject::Enable( sal_Bool bEnable ) { EnableWindow( mhWnd, bEnable ); } @@ -826,4 +868,11 @@ const SystemEnvData* WinSalObject::GetSystemData() const return &maSysData; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +// ----------------------------------------------------------------------- + +void WinSalObject::InterceptChildWindowKeyDown( sal_Bool bIntercept ) +{ + mbInterceptChildWindowKeyDown = bIntercept; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file |