diff options
Diffstat (limited to 'vcl/win/source')
-rw-r--r-- | vcl/win/source/app/saldata.cxx | 37 | ||||
-rwxr-xr-x[-rw-r--r--] | vcl/win/source/app/salinst.cxx | 68 | ||||
-rwxr-xr-x[-rw-r--r--] | vcl/win/source/gdi/salgdi3.cxx | 480 | ||||
-rwxr-xr-x | vcl/win/source/gdi/salnativewidgets-luna.cxx | 143 | ||||
-rw-r--r-- | vcl/win/source/gdi/salprn.cxx | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | vcl/win/source/gdi/winlayout.cxx | 93 | ||||
-rwxr-xr-x | vcl/win/source/window/salframe.cxx | 257 | ||||
-rw-r--r-- | vcl/win/source/window/salobj.cxx | 62 |
8 files changed, 492 insertions, 663 deletions
diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx index bb8a198a96e6..5f94029ad817 100644 --- a/vcl/win/source/app/saldata.cxx +++ b/vcl/win/source/app/saldata.cxx @@ -119,42 +119,28 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ) LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong ) { - if ( aSalShlData.mbWNT ) - return SetWindowLongW( hWnd, nIndex, dwNewLong ); - else - return SetWindowLongA( hWnd, nIndex, dwNewLong ); + return SetWindowLongW( hWnd, nIndex, dwNewLong ); } // ----------------------------------------------------------------------- LONG ImplGetWindowLong( HWND hWnd, int nIndex ) { - if ( aSalShlData.mbWNT ) - return GetWindowLongW( hWnd, nIndex ); - else - return GetWindowLongA( hWnd, nIndex ); + return GetWindowLongW( hWnd, nIndex ); } // ----------------------------------------------------------------------- WIN_BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { - if ( aSalShlData.mbWNT ) - return PostMessageW( hWnd, nMsg, wParam, lParam ); - else - return PostMessageA( hWnd, nMsg, wParam, lParam ); + return PostMessageW( hWnd, nMsg, wParam, lParam ); } // ----------------------------------------------------------------------- WIN_BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { - WIN_BOOL bRet; - if ( aSalShlData.mbWNT ) - bRet = SendMessageW( hWnd, nMsg, wParam, lParam ); - else - bRet = SendMessageA( hWnd, nMsg, wParam, lParam ); - + WIN_BOOL bRet = SendMessageW( hWnd, nMsg, wParam, lParam ); return bRet; } @@ -162,29 +148,20 @@ WIN_BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) WIN_BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ) { - if ( aSalShlData.mbWNT ) - return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax ); - else - return GetMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax ); + return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax ); } // ----------------------------------------------------------------------- WIN_BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) { - if ( aSalShlData.mbWNT ) - return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg ); - else - return PeekMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg ); + return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg ); } // ----------------------------------------------------------------------- LONG ImplDispatchMessage( CONST MSG *lpMsg ) { - if ( aSalShlData.mbWNT ) - return DispatchMessageW( lpMsg ); - else - return DispatchMessageA( lpMsg ); + return DispatchMessageW( lpMsg ); } diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 419723ee6442..2a2a1827a515 100644..100755 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -47,7 +47,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> @@ -434,9 +434,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(); @@ -503,7 +506,6 @@ SalInstance* CreateSalInstance() SalData* pSalData = GetSalData(); // determine the windows version - aSalShlData.mbWNT = 0; aSalShlData.mbWXP = 0; aSalShlData.mbWPrinter = 0; WORD nVer = (WORD)GetVersion(); @@ -516,7 +518,6 @@ SalInstance* CreateSalInstance() { if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) { - aSalShlData.mbWNT = 1; // Windows XP ? if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 || ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) ) @@ -531,8 +532,6 @@ SalInstance* CreateSalInstance() // register frame class if ( !pSalData->mhPrevInst ) { - if ( aSalShlData.mbWNT ) - { WNDCLASSEXW aWndClassEx; aWndClassEx.cbSize = sizeof( aWndClassEx ); aWndClassEx.style = CS_OWNDC; @@ -568,53 +567,11 @@ SalInstance* CreateSalInstance() aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEW; if ( !RegisterClassExW( &aWndClassEx ) ) return NULL; - } - else - { - WNDCLASSEXA aWndClassEx; - aWndClassEx.cbSize = sizeof( aWndClassEx ); - aWndClassEx.style = CS_OWNDC; - aWndClassEx.lpfnWndProc = SalFrameWndProcA; - aWndClassEx.cbClsExtra = 0; - aWndClassEx.cbWndExtra = SAL_FRAME_WNDEXTRA; - aWndClassEx.hInstance = pSalData->mhInst; - aWndClassEx.hCursor = 0; - aWndClassEx.hbrBackground = 0; - aWndClassEx.lpszMenuName = 0; - aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAMEA; - ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm ); - if ( !RegisterClassExA( &aWndClassEx ) ) - return NULL; - - aWndClassEx.hIcon = 0; - aWndClassEx.hIconSm = 0; - aWndClassEx.style |= CS_SAVEBITS; - aWndClassEx.lpszClassName = SAL_SUBFRAME_CLASSNAMEA; - if ( !RegisterClassExA( &aWndClassEx ) ) - return NULL; - - aWndClassEx.style = 0; - aWndClassEx.lpfnWndProc = SalComWndProcA; - aWndClassEx.cbWndExtra = 0; - aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEA; - if ( !RegisterClassExA( &aWndClassEx ) ) - return NULL; - } } - HWND hComWnd; - if ( aSalShlData.mbWNT ) - { - 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 ); - } - else - { - hComWnd = CreateWindowExA( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEA, - "", WS_POPUP, 0, 0, 0, 0, 0, 0, - pSalData->mhInst, NULL ); - } if ( !hComWnd ) return NULL; @@ -719,8 +676,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 @@ -731,8 +692,11 @@ void ImplSalYield( BOOL bWait, BOOL bHandleAllCurrentEvents ) { if ( ImplGetMessage( &aMsg, 0, 0, 0 ) ) { - TranslateMessage( &aMsg ); - ImplSalDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplSalDispatchMessage( &aMsg ); + } } } } diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index c8e0210196e6..91662fb8aded 100644..100755 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -1366,10 +1366,6 @@ int CALLBACK SalEnumQueryFontProcExA( const ENUMLOGFONTEXA*, bool ImplIsFontAvailable( HDC hDC, const UniString& rName ) { - bool bAvailable = false; - - if ( aSalShlData.mbWNT ) - { // Test, if Font available LOGFONTW aLogFont; memset( &aLogFont, 0, sizeof( aLogFont ) ); @@ -1381,27 +1377,9 @@ bool ImplIsFontAvailable( HDC hDC, const UniString& rName ) memcpy( aLogFont.lfFaceName, rName.GetBuffer(), nNameLen*sizeof( wchar_t ) ); aLogFont.lfFaceName[nNameLen] = 0; - EnumFontFamiliesExW( hDC, &aLogFont, (FONTENUMPROCW)SalEnumQueryFontProcExW, - (LPARAM)(void*)&bAvailable, 0 ); - } - else - { - ByteString aTemp = ImplSalGetWinAnsiString( rName ); - - // Test, if Font available - LOGFONTA aLogFont; - memset( &aLogFont, 0, sizeof( aLogFont ) ); - aLogFont.lfCharSet = DEFAULT_CHARSET; - - UINT nNameLen = aTemp.Len(); - if ( nNameLen > sizeof( aLogFont.lfFaceName )-1 ) - nNameLen = sizeof( aLogFont.lfFaceName )-1; - memcpy( aLogFont.lfFaceName, aTemp.GetBuffer(), nNameLen ); - aLogFont.lfFaceName[nNameLen] = 0; - - EnumFontFamiliesExA( hDC, &aLogFont, (FONTENUMPROCA)SalEnumQueryFontProcExA, + bool bAvailable = false; + EnumFontFamiliesExW( hDC, &aLogFont, (FONTENUMPROCW)SalEnumQueryFontProcExW, (LPARAM)(void*)&bAvailable, 0 ); - } return bAvailable; } @@ -1564,7 +1542,7 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont // only required for virtual devices, see below for details hdcScreen = GetDC(0); - if( aSalShlData.mbWNT ) + if( true/*aSalShlData.mbWNT*/ ) { LOGFONTW aLogFont; ImplGetLogFontFromFontSelect( mhDC, i_pFont, aLogFont, true ); @@ -1624,63 +1602,6 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont hNewFont = hNewFont2; } } - else - { - if( !mpLogFont ) - // mpLogFont is needed for getting the kerning pairs - // TODO: get them from somewhere else - mpLogFont = new LOGFONTA; - LOGFONTA& aLogFont = *mpLogFont; - ImplGetLogFontFromFontSelect( mhDC, i_pFont, aLogFont, true ); - - // on the display we prefer Courier New when Courier is a - // bitmap only font and we need to stretch or rotate it - if( mbScreen - && (i_pFont->mnWidth != 0 - || i_pFont->mnOrientation != 0 - || i_pFont->mpFontData == NULL - || (i_pFont->mpFontData->GetHeight() != i_pFont->mnHeight)) - && !bImplSalCourierScalable - && bImplSalCourierNew - && (stricmp( aLogFont.lfFaceName, "Courier" ) == 0) ) - strncpy( aLogFont.lfFaceName, "Courier New", 11 ); - - // limit font requests to MAXFONTHEIGHT to work around driver problems - // TODO: share MAXFONTHEIGHT font instance - if( -aLogFont.lfHeight <= MAXFONTHEIGHT ) - o_rFontScale = 1.0; - else - { - o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT; - aLogFont.lfHeight = -MAXFONTHEIGHT; - aLogFont.lfWidth = static_cast<LONG>( aLogFont.lfWidth / o_rFontScale ); - } - - hNewFont = ::CreateFontIndirectA( &aLogFont ); - if( hdcScreen ) - { - // select font into screen hdc first to get an antialiased font - // see knowledge base article 305290: - // "PRB: Fonts Not Drawn Antialiased on Device Context for DirectDraw Surface" - ::SelectFont( hdcScreen, ::SelectFont( hdcScreen , hNewFont ) ); - } - o_rOldFont = ::SelectFont( mhDC, hNewFont ); - - TEXTMETRICA aTextMetricA; - // when the font doesn't work try a replacement - if ( !::GetTextMetricsA( mhDC, &aTextMetricA ) ) - { - // the selected font doesn't work => try a replacement - // TODO: use its font fallback instead - LOGFONTA aTempLogFont = aLogFont; - strncpy( aTempLogFont.lfFaceName, "Courier New", 11 ); - aTempLogFont.lfPitchAndFamily = FIXED_PITCH; - HFONT hNewFont2 = CreateFontIndirectA( &aTempLogFont ); - ::SelectFont( mhDC, hNewFont2 ); - ::DeleteFont( hNewFont ); - hNewFont = hNewFont2; - } - } if( hdcScreen ) ::ReleaseDC( NULL, hdcScreen ); @@ -1767,18 +1688,9 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe // temporarily change the HDC to the font in the fallback level HFONT hOldFont = SelectFont( mhDC, mhFonts[nFallbackLevel] ); - if ( aSalShlData.mbWNT ) - { wchar_t aFaceName[LF_FACESIZE+60]; if( ::GetTextFaceW( mhDC, sizeof(aFaceName)/sizeof(wchar_t), aFaceName ) ) pMetric->maName = reinterpret_cast<const sal_Unicode*>(aFaceName); - } - else - { - char aFaceName[LF_FACESIZE+60]; - if( ::GetTextFaceA( mhDC, sizeof(aFaceName), aFaceName ) ) - pMetric->maName = ImplSalGetUniString( aFaceName ); - } // get the font metric TEXTMETRICA aWinMetric; @@ -1842,11 +1754,6 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe pMetric->mnAscent += nHalfTmpExtLeading; pMetric->mnDescent += nOtherHalfTmpExtLeading; - - // #109280# HACK korean only: increase descent for wavelines and impr - if( !aSalShlData.mbWNT ) - if( mpWinFontData[nFallbackLevel]->SupportsKorean() ) - pMetric->mnDescent += pMetric->mnExtLeading; } pMetric->mnMinKashida = GetMinKashidaWidth(); @@ -2000,45 +1907,21 @@ ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) } mnFontKernPairCount = 0; - if ( aSalShlData.mbWNT ) + KERNINGPAIR* pPairs = NULL; + int nCount = ::GetKerningPairsW( mhDC, 0, NULL ); + if( nCount ) { - KERNINGPAIR* pPairs = NULL; - int nCount = ::GetKerningPairsW( mhDC, 0, NULL ); - if( nCount ) - { -#ifdef GCP_KERN_HACK - pPairs = new KERNINGPAIR[ nCount+1 ]; - mpFontKernPairs = pPairs; - mnFontKernPairCount = nCount; - ::GetKerningPairsW( mhDC, nCount, pPairs ); -#else // GCP_KERN_HACK - pPairs = pKernPairs; - nCount = (nCount < nPairs) : nCount : nPairs; - ::GetKerningPairsW( mhDC, nCount, pPairs ); - return nCount; -#endif // GCP_KERN_HACK - } - } - else - { - if ( !mnFontCharSetCount ) - ImplGetAllFontCharSets( this ); - - if ( mnFontCharSetCount <= 1 ) - ImplAddKerningPairs( this ); - else - { - // Query All Kerning Pairs from all possible CharSets - for ( BYTE i = 0; i < mnFontCharSetCount; i++ ) - { - mpLogFont->lfCharSet = mpFontCharSets[i]; - HFONT hNewFont = CreateFontIndirectA( mpLogFont ); - HFONT hOldFont = SelectFont( mhDC, hNewFont ); - ImplAddKerningPairs( this ); - SelectFont( mhDC, hOldFont ); - DeleteFont( hNewFont ); - } - } + #ifdef GCP_KERN_HACK + pPairs = new KERNINGPAIR[ nCount+1 ]; + mpFontKernPairs = pPairs; + mnFontKernPairCount = nCount; + ::GetKerningPairsW( mhDC, nCount, pPairs ); + #else // GCP_KERN_HACK + pPairs = pKernPairs; + nCount = (nCount < nPairs) : nCount : nPairs; + ::GetKerningPairsW( mhDC, nCount, pPairs ); + return nCount; + #endif // GCP_KERN_HACK } mbFontKernInit = FALSE; @@ -2270,19 +2153,7 @@ void ImplReleaseTempFonts( SalData& rSalData ) } else { - if( aSalShlData.mbWNT ) - ::RemoveFontResourceW( reinterpret_cast<LPCWSTR>(p->maFontFilePath.getStr()) ); - else - { - // poor man's string conversion because converter is gone - int nLen = p->maFontFilePath.getLength(); - char* pNameA = new char[ nLen + 1 ]; - for( int i = 0; i < nLen; ++i ) - pNameA[i] = (char)(p->maFontFilePath.getStr())[i]; - pNameA[ nLen ] = 0; - ::RemoveFontResourceA( pNameA ); - delete[] pNameA; - } + ::RemoveFontResourceW( reinterpret_cast<LPCWSTR>(p->maFontFilePath.getStr()) ); } rSalData.mpTempFontItem = p->mpNextItem; @@ -2424,14 +2295,6 @@ bool WinSalGraphics::AddTempDevFont( ImplDevFontList* pFontList, return false; UINT nPreferedCharSet = DEFAULT_CHARSET; - if ( !aSalShlData.mbWNT ) - { - // for W98 guess charset preference from active codepage - CHARSETINFO aCharSetInfo; - DWORD nCP = GetACP(); - if ( TranslateCharsetInfo( (DWORD*)nCP, &aCharSetInfo, TCI_SRCCODEPAGE ) ) - nPreferedCharSet = aCharSetInfo.ciCharset; - } // create matching FontData struct aDFA.mbSymbolFlag = false; // TODO: how to know it without accessing the font? @@ -2536,24 +2399,12 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) if ( TranslateCharsetInfo( (DWORD*)nCP, &aCharSetInfo, TCI_SRCCODEPAGE ) ) aInfo.mnPreferedCharSet = aCharSetInfo.ciCharset; - if ( aSalShlData.mbWNT ) - { - LOGFONTW aLogFont; - memset( &aLogFont, 0, sizeof( aLogFont ) ); - aLogFont.lfCharSet = DEFAULT_CHARSET; - aInfo.mpLogFontW = &aLogFont; - EnumFontFamiliesExW( mhDC, &aLogFont, + LOGFONTW aLogFont; + memset( &aLogFont, 0, sizeof( aLogFont ) ); + aLogFont.lfCharSet = DEFAULT_CHARSET; + aInfo.mpLogFontW = &aLogFont; + EnumFontFamiliesExW( mhDC, &aLogFont, (FONTENUMPROCW)SalEnumFontsProcExW, (LPARAM)(void*)&aInfo, 0 ); - } - else - { - LOGFONTA aLogFont; - memset( &aLogFont, 0, sizeof( aLogFont ) ); - aLogFont.lfCharSet = DEFAULT_CHARSET; - aInfo.mpLogFontA = &aLogFont; - EnumFontFamiliesExA( mhDC, &aLogFont, - (FONTENUMPROCA)SalEnumFontsProcExA, (LPARAM)(void*)&aInfo, 0 ); - } // Feststellen, was es fuer Courier-Schriften auf dem Bildschirm gibt, // um in SetFont() evt. Courier auf Courier New zu mappen @@ -2592,12 +2443,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; - if ( aSalShlData.mbWNT ) - nSize = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); - else if( (nGGOFlags & GGO_GLYPH_INDEX) || (nIndex <= 255) ) - nSize = ::GetGlyphOutlineA( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); - + DWORD nSize = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); if( nSize == GDI_ERROR ) return false; @@ -2617,7 +2463,6 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, { rB2DPolyPoly.clear(); - BOOL bRet = FALSE; HDC hDC = mhDC; // use unity matrix @@ -2631,171 +2476,160 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, nIndex &= GF_IDXMASK; GLYPHMETRICS aGlyphMetrics; - DWORD nSize1 = GDI_ERROR; - if ( aSalShlData.mbWNT ) - nSize1 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat ); - else if( (nGGOFlags & GGO_GLYPH_INDEX) || (nIndex <= 255) ) - nSize1 = ::GetGlyphOutlineA( 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 ) - { - BYTE* pData = new BYTE[ nSize1 ]; - DWORD nSize2; - if ( aSalShlData.mbWNT ) - nSize2 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, - &aGlyphMetrics, nSize1, pData, &aMat ); - else - nSize2 = ::GetGlyphOutlineA( hDC, nIndex, nGGOFlags, - &aGlyphMetrics, nSize1, pData, &aMat ); + return TRUE; + else if( nSize1 == GDI_ERROR ) + return FALSE; - if( nSize1 == nSize2 ) - { - bRet = TRUE; + 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 ) + { + // only outline data is interesting + if( pHeader->dwType != TT_POLYGON_TYPE ) + break; - int nPtSize = 512; - Point* pPoints = new Point[ nPtSize ]; - BYTE* pFlags = new BYTE[ nPtSize ]; + // get start point; next start points are end points + // of previous segment + USHORT nPnt = 0; - TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData; - while( (BYTE*)pHeader < pData+nSize2 ) + 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 ) + { + 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( USHORT 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() ) { @@ -2803,7 +2637,7 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); } - return bRet; + return TRUE; } // ----------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 8197fb37cd6d..97e3e1b48c79 100755 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -188,6 +188,8 @@ void SalData::deInitNWF( void ) iter++; } aThemeMap.clear(); + if( maDwmLib ) + osl_unloadModule( maDwmLib ); } static HTHEME getThemeHandle( HWND hWnd, LPCWSTR name ) @@ -286,6 +288,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 ) @@ -867,15 +885,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 ) @@ -954,6 +980,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; } @@ -1027,6 +1116,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 ) @@ -1040,6 +1134,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; @@ -1196,7 +1300,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 ) ); @@ -1225,6 +1329,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 9d8d41723f64..702ff639ed84 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -1798,8 +1798,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; @@ -2060,8 +2063,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; diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 82fa9bb4b5e1..a4c588f059d4 100644..100755 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -244,24 +244,11 @@ HFONT WinLayout::DisableFontScaling() const if( mfFontScale == 1.0 ) return 0; - HFONT hHugeFont = 0; - if( aSalShlData.mbWNT ) - { - LOGFONTW aLogFont; - ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); - aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); - aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); - hHugeFont = ::CreateFontIndirectW( &aLogFont); - } - else - { - LOGFONTA aLogFont; - ::GetObjectA( mhFont, sizeof(LOGFONTA), &aLogFont); - aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); - aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); - hHugeFont = ::CreateFontIndirectA( &aLogFont); - } - + LOGFONTW aLogFont; + ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); + aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); + aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); + HFONT hHugeFont = ::CreateFontIndirectW( &aLogFont); if( !hHugeFont ) return 0; @@ -671,57 +658,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 || aSalShlData.mbWNT ) - { - // #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 ) ); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index f0ca1d68ef41..89a191c99ef6 100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -508,7 +508,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, } // create frame - if ( aSalShlData.mbWNT ) + if( true/*aSalShlData.mbWNT*/ ) { LPCWSTR pClassName; if ( bSubFrame ) @@ -536,17 +536,6 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, lpfnSetLayeredWindowAttributes( hWnd, 0, 230, 0x00000002 /*LWA_ALPHA*/ ); #endif } - else - { - LPCSTR pClassName; - if ( bSubFrame ) - pClassName = SAL_SUBFRAME_CLASSNAMEA; - else - pClassName = SAL_FRAME_CLASSNAMEA; - hWnd = CreateWindowExA( nExSysStyle, pClassName, "", nSysStyle, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, - hWndParent, 0, pInst->mhInst, (void*)pFrame ); - } if ( !hWnd ) { delete pFrame; @@ -617,21 +606,10 @@ HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, BOOL bAsChild ) nExSysStyle = 0; } - HWND hWnd = NULL; - if ( aSalShlData.mbWNT ) - { - LPCWSTR pClassName = SAL_SUBFRAME_CLASSNAMEW; - hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle, + LPCWSTR pClassName = SAL_SUBFRAME_CLASSNAMEW; + HWND hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWndParent, 0, hInstance, (void*)GetWindowPtr( oldhWnd ) ); - } - else - { - LPCSTR pClassName = SAL_SUBFRAME_CLASSNAMEA; - hWnd = CreateWindowExA( nExSysStyle, pClassName, "", nSysStyle, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, - hWndParent, 0, hInstance, (void*)GetWindowPtr( oldhWnd ) ); - } return hWnd; } @@ -2531,7 +2509,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, int nKeyLen = 0; if ( lParam ) { - if ( aSalShlData.mbWNT ) + if ( true/*aSalShlData.mbWNT*/ ) { nKeyLen = GetKeyNameTextW( lParam, aKeyBuf, nMaxKeyLen ); // #i12401# the current unicows.dll has a bug in CharUpperBuffW, which corrupts the stack @@ -2553,32 +2531,6 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, } } } - else // !mbWnt - { - sal_Char aAnsiKeyBuf[ nMaxKeyLen ]; - int nAnsiKeyLen = GetKeyNameTextA( lParam, aAnsiKeyBuf, nMaxKeyLen ); - DBG_ASSERT( nAnsiKeyLen <= nMaxKeyLen, "Invalid key name length!" ); - if( nAnsiKeyLen > nMaxKeyLen ) - nAnsiKeyLen = 0; - else if( nAnsiKeyLen > 0 ) - { - // Capitalize just the first letter of key names - // TODO: check MCBS key names - CharLowerBuffA( aAnsiKeyBuf, nAnsiKeyLen ); - - bool bUpper = true; - for( sal_Char *pA=aAnsiKeyBuf, *pE=pA+nAnsiKeyLen; pA < pE; ++pA ) - { - if( bUpper ) - CharUpperBuffA( pA, 1 ); - bUpper = (*pA=='+') || (*pA=='-') || (*pA==' ') || (*pA=='.'); - } - - // Convert to Unicode and copy the data in the Unicode Buffer - nKeyLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, - aAnsiKeyBuf, nAnsiKeyLen, aKeyBuf, nMaxKeyLen ); - } - } } if ( (nKeyLen > 0) || pReplace ) @@ -2883,6 +2835,29 @@ static long ImplA2I( const BYTE* pStr ) } // ----------------------------------------------------------------------- +static HRESULT WINAPI backwardCompatibleDwmIsCompositionEnabled( WIN_BOOL* pOut ) +{ + *pOut = FALSE; + return S_OK; +} + +static WIN_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; + } + WIN_BOOL aResult = FALSE; + HRESULT nError = pSalData->mpDwmIsCompositionEnabled( &aResult ); + return nError == S_OK && aResult; +} + void WinSalFrame::UpdateSettings( AllSettings& rSettings ) { @@ -2915,30 +2890,26 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) } 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 ) ) ); - if ( aSalShlData.mnVersion >= 410 ) - { - 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 ) ) ); + if ( aSalShlData.mnVersion >= 410 ) + { + 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 ) ) ); @@ -2960,37 +2931,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 ) ); @@ -3027,7 +3013,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) Font aAppFont = aStyleSettings.GetAppFont(); Font aIconFont = aStyleSettings.GetIconFont(); HDC hDC = GetDC( 0 ); - if ( aSalShlData.mbWNT ) + if( true/*aSalShlData.mbWNT*/ ) { NONCLIENTMETRICSW aNonClientMetrics; aNonClientMetrics.cbSize = sizeof( aNonClientMetrics ); @@ -3044,23 +3030,6 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) ImplSalUpdateStyleFontW( hDC, aLogFont, aIconFont ); } } - else - { - NONCLIENTMETRICSA aNonClientMetrics; - aNonClientMetrics.cbSize = sizeof( aNonClientMetrics ); - if ( SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) ) - { - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfMenuFont, aMenuFont ); - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfCaptionFont, aTitleFont ); - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfSmCaptionFont, aFloatTitleFont ); - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfStatusFont, aHelpFont ); - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfMessageFont, aAppFont ); - - LOGFONTA aLogFont; - if ( SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &aLogFont, 0 ) ) - ImplSalUpdateStyleFontA( hDC, aLogFont, aIconFont ); - } - } // get screen font resolution to calculate toolbox item size long nDPIY = GetDeviceCaps( hDC, LOGPIXELSY ); @@ -3649,27 +3618,7 @@ static void ImplUpdateInputLang( WinSalFrame* pFrame ) // If we are on Windows NT we use Unicode FrameProcs and so we // get Unicode charcodes directly from Windows // no need to set up a code page - if ( aSalShlData.mbWNT ) - return; - - if ( !nLang ) - { - pFrame->mnInputLang = 0; - pFrame->mnInputCodePage = GetACP(); - } - else if ( bLanguageChange ) - { - sal_Char aBuf[10]; - if ( GetLocaleInfoA( MAKELCID( nLang, SORT_DEFAULT ), LOCALE_IDEFAULTANSICODEPAGE, - aBuf, sizeof(aBuf) ) > 0 ) - { - pFrame->mnInputCodePage = ImplStrToNum( aBuf ); - if ( !pFrame->mnInputCodePage ) - pFrame->mnInputCodePage = GetACP(); - } - else - pFrame->mnInputCodePage = GetACP(); - } + return; } @@ -3679,29 +3628,7 @@ static sal_Unicode ImplGetCharCode( WinSalFrame* pFrame, WPARAM nCharCode ) // If we are on Windows NT we use Unicode FrameProcs and so we // get Unicode charcodes directly from Windows - if ( aSalShlData.mbWNT ) - return (sal_Unicode)nCharCode; - - sal_Char aCharBuf[2]; - int nCharLen; - WCHAR c; - if ( nCharCode > 0xFF ) - { - aCharBuf[0] = (sal_Char)(nCharCode>>8); - aCharBuf[1] = (sal_Char)nCharCode; - nCharLen = 2; - } - else - { - aCharBuf[0] = (sal_Char)nCharCode; - nCharLen = 1; - } - if ( ::MultiByteToWideChar( pFrame->mnInputCodePage, - MB_PRECOMPOSED, - aCharBuf, nCharLen, &c, 1 ) ) - return (sal_Unicode)c; - else - return (sal_Unicode)nCharCode; + return (sal_Unicode)nCharCode; } // ----------------------------------------------------------------------- @@ -4507,16 +4434,8 @@ static void ImplHandleSettingsChangeMsg( HWND hWnd, UINT nMsg, { if ( lParam ) { - if ( aSalShlData.mbWNT ) - { if ( ImplSalWICompareAscii( (const wchar_t*)lParam, "devices" ) == 0 ) nSalEvent = SALEVENT_PRINTERCHANGED; - } - else - { - if ( stricmp( (const char*)lParam, "devices" ) == 0 ) - nSalEvent = SALEVENT_PRINTERCHANGED; - } } } diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index 2f657968284f..bf0f29bb72d3 100644 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx @@ -39,6 +39,7 @@ #include <salframe.h> #include <salobj.h> #include <tools/debug.hxx> +#include <vcl/svapp.hxx> // ======================================================================= @@ -103,6 +104,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 @@ -493,20 +534,10 @@ SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent ) // Hook installieren, wenn es das erste SalObject ist if ( !pSalData->mpFirstObject ) { - if ( aSalShlData.mbWNT ) - { - pSalData->mhSalObjMsgHook = SetWindowsHookExW( WH_CALLWNDPROC, - SalSysMsgProc, - pSalData->mhInst, - pSalData->mnAppThreadId ); - } - else - { - pSalData->mhSalObjMsgHook = SetWindowsHookExA( WH_CALLWNDPROC, + pSalData->mhSalObjMsgHook = SetWindowsHookExW( WH_CALLWNDPROC, SalSysMsgProc, pSalData->mhInst, pSalData->mnAppThreadId ); - } } if ( !pSalData->mbObjClassInit ) @@ -623,6 +654,7 @@ WinSalObject::WinSalObject() mhLastFocusWnd = 0; maSysData.nSize = sizeof( SystemEnvData ); mpStdClipRgnData = NULL; + mbInterceptChildWindowKeyDown = sal_False; // Insert object in objectlist mpNextObject = pSalData->mpFirstObject; @@ -836,3 +868,11 @@ const SystemEnvData* WinSalObject::GetSystemData() const { return &maSysData; } + +// ----------------------------------------------------------------------- + +void WinSalObject::InterceptChildWindowKeyDown( sal_Bool bIntercept ) +{ + mbInterceptChildWindowKeyDown = bIntercept; +} + |