diff options
author | Xiaofei Zhang <Zhangxiaofei@openoffice.org> | 2010-11-10 13:50:33 +0800 |
---|---|---|
committer | Xiaofei Zhang <Zhangxiaofei@openoffice.org> | 2010-11-10 13:50:33 +0800 |
commit | 3491b4ac4fe34cacea5f4d0a4594d4a88cbbe7b2 (patch) | |
tree | 8dc60b794b88dd87c965d149c93fa3ac81e3096c /vcl/win | |
parent | 66e7dc1197e76e686ba731382d032a9a72849959 (diff) | |
parent | 95f71183414a50d12cd4bbacf47d711672e63268 (diff) |
removetooltypes01: #i112600# resync to DEV300_m92; remove tooltypes from xmloff, linguistic, vcl, svtools, accessibility, fpicker, uui and framework
Diffstat (limited to 'vcl/win')
-rwxr-xr-x[-rw-r--r--] | vcl/win/inc/salgdi.h | 43 | ||||
-rwxr-xr-x[-rw-r--r--] | vcl/win/inc/salinst.h | 12 | ||||
-rw-r--r-- | vcl/win/source/app/salinfo.cxx | 3 | ||||
-rw-r--r-- | vcl/win/source/app/salinst.cxx | 12 | ||||
-rw-r--r-- | vcl/win/source/gdi/salbmp.cxx | 4 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi3.cxx | 40 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi_gdiplus.cxx | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | vcl/win/source/gdi/salnativewidgets-luna.cxx | 110 | ||||
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/gdi/winlayout.cxx | 38 | ||||
-rwxr-xr-x[-rw-r--r--] | vcl/win/source/window/salframe.cxx | 57 | ||||
-rwxr-xr-x[-rw-r--r--] | vcl/win/source/window/salmenu.cxx | 2 |
11 files changed, 201 insertions, 125 deletions
diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index b0e251eb19ca..456c6c0778ec 100644..100755 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -57,10 +57,10 @@ class ImplFontAttrCache; class ImplWinFontData : public ImplFontData { public: - ImplWinFontData( const ImplDevFontAttributes&, + explicit ImplWinFontData( const ImplDevFontAttributes&, int nFontHeight, BYTE eWinCharSet, BYTE nPitchAndFamily ); - ~ImplWinFontData(); + virtual ~ImplWinFontData(); virtual ImplFontData* Clone() const; virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; @@ -82,7 +82,7 @@ public: bool SupportsGraphite() const { return mbHasGraphiteSupport; } #endif - ImplFontCharMap* GetImplFontCharMap() const; + const ImplFontCharMap* GetImplFontCharMap() const; const Ucs2SIntMap* GetEncodingVector() const { return mpEncodingVector; } void SetEncodingVector( const Ucs2SIntMap* pNewVec ) const { @@ -127,9 +127,9 @@ public: #endif // GNG_VERT_HACK }; -// ------------------- -// - SalGraphicsData - -// ------------------- +// ------------------ +// - WinSalGraphics - +// ------------------ class WinSalGraphics : public SalGraphics { @@ -179,7 +179,7 @@ public: HFONT ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont ); public: - WinSalGraphics(); + explicit WinSalGraphics(); virtual ~WinSalGraphics(); protected: @@ -194,9 +194,9 @@ protected: virtual void drawPolygon( sal_uIntPtr nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin); - virtual sal_Bool drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); - virtual sal_Bool drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); + virtual sal_Bool drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); + virtual sal_Bool drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); // CopyArea --> No RasterOp, but ClipRegion @@ -227,17 +227,17 @@ protected: virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize ); // native widget rendering methods that require mirroring - virtual sal_Bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual sal_Bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, sal_Bool& rIsInside ); - virtual sal_Bool drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual sal_Bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); - virtual sal_Bool drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual sal_Bool drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); - virtual sal_Bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, + virtual sal_Bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, @@ -282,12 +282,12 @@ public: // set the font virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); // get the current font's etrics - virtual void GetFontMetric( ImplFontMetricData* ); + virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); // get kernign pairs of the current font // return only PairCount if (pKernPairs == NULL) virtual sal_uIntPtr GetKernPairs( sal_uIntPtr nPairs, ImplKernPairData* pKernPairs ); // get the repertoire of the current font - virtual ImplFontCharMap* GetImplFontCharMap() const; + virtual const ImplFontCharMap* GetImplFontCharMap() const; // graphics must fill supplied font list virtual void GetDevFontList( ImplDevFontList* ); // graphics should call ImplAddDevFontSubstitute on supplied @@ -359,11 +359,11 @@ public: }; // Init/Deinit Graphics -void ImplSalInitGraphics( WinSalGraphics* mpData ); -void ImplSalDeInitGraphics( WinSalGraphics* mpData ); +void ImplSalInitGraphics( WinSalGraphics* ); +void ImplSalDeInitGraphics( WinSalGraphics* ); void ImplUpdateSysColorEntries(); int ImplIsSysColorEntry( SalColor nSalColor ); -void ImplGetLogFontFromFontSelect( HDC hDC, const ImplFontSelectData*, +void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*, LOGFONTW&, bool bTestVerticalAvail ); // ----------- @@ -397,7 +397,10 @@ inline bool ImplWinFontData::HasChar( sal_uInt32 cChar ) const cChar -= 0xF000; else if( mbAliasSymbolsHigh && (cChar <= 0xFF) ) cChar += 0xF000; + else + return false; return mpUnicodeMap->HasChar( cChar ); } #endif // _SV_SALGDI_H + diff --git a/vcl/win/inc/salinst.h b/vcl/win/inc/salinst.h index 85f107e1fe12..f08f99898915 100644..100755 --- a/vcl/win/inc/salinst.h +++ b/vcl/win/inc/salinst.h @@ -54,7 +54,7 @@ public: virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uIntPtr nStyle ); virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uIntPtr nStyle ); virtual void DestroyFrame( SalFrame* pFrame ); - virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = TRUE ); + virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ); virtual void DestroyObject( SalObject* pObject ); virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, long nDX, long nDY, @@ -75,13 +75,15 @@ public: virtual SalSystem* CreateSalSystem(); virtual SalBitmap* CreateSalBitmap(); virtual vos::IMutex* GetYieldMutex(); - virtual sal_uIntPtr ReleaseYieldMutex(); + virtual sal_uIntPtr ReleaseYieldMutex(); virtual void AcquireYieldMutex( sal_uIntPtr nCount ); + virtual bool CheckYieldMutex(); + virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ); virtual bool AnyInput( sal_uInt16 nType ); - virtual SalMenu* CreateMenu( sal_Bool bMenuBar ); + virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* ); virtual void DestroyMenu( SalMenu* ); - virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); + virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); virtual void DestroyMenuItem( SalMenuItem* ); virtual SalSession* CreateSalSession(); virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ); @@ -97,7 +99,7 @@ public: SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, HWND hWndParent, sal_uIntPtr nSalFrameStyle ); SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent ); HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, sal_Bool bAsChild ); -void ImplSalStartTimer( sal_uIntPtr nMS, sal_Bool bMutex = FALSE ); +void ImplSalStartTimer( sal_uIntPtr nMS, sal_Bool bMutex = sal_False ); void ImplSalPrinterAbortJobAsync( HDC hPrnDC ); #endif // _SV_SALINST_H diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index 808504c9542e..c635fdfc9845 100644 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx @@ -160,7 +160,8 @@ bool WinSalSystem::initMonitors() std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDeviceStringCount; while( EnumDisplayDevicesW( NULL, nDevice++, &aDev, 0 ) ) { - if( (aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) == 0 ) // sort out non monitors + if( (aDev.StateFlags & DISPLAY_DEVICE_ACTIVE) + && !(aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ) // sort out non/disabled monitors { aDev.DeviceName[31] = 0; aDev.DeviceString[127] = 0; diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 1a536348ce54..b900c8a9e2d1 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -323,10 +323,9 @@ void ImplSalAcquireYieldMutex( sal_uIntPtr nCount ) // ----------------------------------------------------------------------- -#ifdef DBG_UTIL - -void ImplDbgTestSolarMutex() +bool WinSalInstance::CheckYieldMutex() { + bool bRet = true; SalData* pSalData = GetSalData(); DWORD nCurThreadId = GetCurrentThreadId(); if ( pSalData->mnAppThreadId != nCurThreadId ) @@ -336,7 +335,7 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" ); + bRet = false; } } } @@ -347,14 +346,13 @@ void ImplDbgTestSolarMutex() SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex; if ( pYieldMutex->mnThreadId != nCurThreadId ) { - DBG_ERROR( "SolarMutex not locked in the main thread" ); + bRet = false; } } } + return bRet; } -#endif - // ======================================================================= void SalData::initKeyCodeMap() diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 97b2683ff1f8..536cf40c1043 100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx @@ -509,8 +509,8 @@ void WinSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) { PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB ); const sal_uInt16 nCount = pBuffer->maPalette.GetEntryCount(); - - memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGBQUAD ) ); + const sal_uInt16 nDIBColorCount = ImplGetDIBColorCount( mhDIB ); + memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), Min( nDIBColorCount, nCount ) * sizeof( RGBQUAD ) ); GlobalUnlock( mhDIB ); } diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index ada39acae35b..f0215a22937f 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -533,9 +533,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 ) { @@ -543,6 +544,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, nMatchCount += pCharMap->HasChar( uChar ); break; // for now } + pCharMap->DeReference(); const bool bHasMatches = (nMatchCount > 0); return bHasMatches; @@ -1206,11 +1208,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; } @@ -1320,6 +1321,7 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const if( !mpUnicodeMap ) mpUnicodeMap = ImplFontCharMap::GetDefaultMap( bIsSymbolFont ); + mpUnicodeMap->AddReference(); } // ======================================================================= @@ -1760,8 +1762,11 @@ sal_uInt16 WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLeve // ----------------------------------------------------------------------- -void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) +void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel ) { + // 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]; @@ -1775,8 +1780,12 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) pMetric->maName = ImplSalGetUniString( aFaceName ); } + // get the font metric TEXTMETRICA aWinMetric; - if( !GetTextMetricsA( mhDC, &aWinMetric ) ) + const bool bOK = GetTextMetricsA( mhDC, &aWinMetric ); + // restore the HDC to the font in the base level + SelectFont( mhDC, hOldFont ); + if( !bOK ) return; // device independent font attributes @@ -1815,7 +1824,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) // #107888# improved metric compatibility for Asian fonts... // TODO: assess workaround below for CWS >= extleading // TODO: evaluate use of aWinMetric.sTypo* members for CJK - if( mpWinFontData[0] && mpWinFontData[0]->SupportsCJK() ) + if( mpWinFontData[nFallbackLevel] && mpWinFontData[nFallbackLevel]->SupportsCJK() ) { pMetric->mnIntLeading += pMetric->mnExtLeading; @@ -1836,7 +1845,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) // #109280# HACK korean only: increase descent for wavelines and impr if( !aSalShlData.mbWNT ) - if( mpWinFontData[0]->SupportsKorean() ) + if( mpWinFontData[nFallbackLevel]->SupportsKorean() ) pMetric->mnDescent += pMetric->mnExtLeading; } @@ -2053,7 +2062,7 @@ sal_uIntPtr WinSalGraphics::GetKernPairs( sal_uIntPtr nPairs, ImplKernPairData* // ----------------------------------------------------------------------- -ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const +const ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const { if( !mpWinFontData[0] ) return ImplFontCharMap::GetDefaultMap(); @@ -2875,8 +2884,6 @@ sal_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 @@ -2899,6 +2906,10 @@ sal_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 ) { @@ -2906,13 +2917,15 @@ sal_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() ); @@ -3160,8 +3173,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(); @@ -3177,6 +3191,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/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index c621d81dce40..88efbb29d30a 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -189,14 +189,15 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly return true; } -bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin) +bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin ) { const sal_uInt32 nCount(rPolygon.count()); if(mbPen && nCount) { Gdiplus::Graphics aGraphics(mhDC); - Gdiplus::Color aTestColor(255, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); + const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) ); + Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); Gdiplus::GraphicsPath aPath; bool bNoLineJoin(false); diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index f5634fc64380..8d8409e51607 100644..100755 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -317,7 +317,7 @@ sal_Bool WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar */ sal_Bool WinSalGraphics::hitTestNativeControl( ControlType, ControlPart, - const Region&, + const Rectangle&, const Point&, sal_Bool& ) { @@ -553,10 +553,10 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, } if( nType == CTRL_SPINBUTTONS && nPart == PART_ALL_BUTTONS ) { - SpinbuttonValue *pValue = (SpinbuttonValue*) aValue.getOptionalVal(); - if( pValue ) + if( aValue.getType() == CTRL_SPINBUTTONS ) { - sal_Bool bOk = FALSE; + const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue*>(&aValue); + sal_Bool bOk = sal_False; RECT rect; ImplConvertSpinbuttonValues( pValue->mnUpperPart, pValue->mnUpperState, pValue->maUpperRect, &iPart, &iState, &rect ); @@ -578,10 +578,10 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, //rc.bottom--; if( nPart == PART_ALL_BUTTONS ) { - SpinbuttonValue *pValue = (SpinbuttonValue*) aValue.getOptionalVal(); - if( pValue ) + if( aValue.getType() == CTRL_SPINBUTTONS ) { - sal_Bool bOk = FALSE; + const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue*>(&aValue); + sal_Bool bOk = sal_False; RECT rect; ImplConvertSpinbuttonValues( pValue->mnUpperPart, pValue->mnUpperState, pValue->maUpperRect, &iPart, &iState, &rect ); @@ -787,20 +787,19 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iPart = TABP_TABITEMLEFTEDGE; rc.bottom--; - TabitemValue *pValue = (TabitemValue*) aValue.getOptionalVal(); - if( pValue ) + OSL_ASSERT( aValue.getType() == CTRL_TAB_ITEM ); + + const TabitemValue *pValue = static_cast<const TabitemValue*>(&aValue); + if( pValue->isBothAligned() ) { - if( pValue->isBothAligned() ) - { - iPart = TABP_TABITEMLEFTEDGE; - rc.right--; - } - else if( pValue->isLeftAligned() ) - iPart = TABP_TABITEMLEFTEDGE; - else if( pValue->isRightAligned() ) - iPart = TABP_TABITEMRIGHTEDGE; - else iPart = TABP_TABITEM; + iPart = TABP_TABITEMLEFTEDGE; + rc.right--; } + else if( pValue->isLeftAligned() ) + iPart = TABP_TABITEMLEFTEDGE; + else if( pValue->isRightAligned() ) + iPart = TABP_TABITEMRIGHTEDGE; + else iPart = TABP_TABITEM; if( !(nState & CTRL_STATE_ENABLED) ) iState = TILES_DISABLED; @@ -856,9 +855,12 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, } else if( nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT ) { - ToolbarValue *pValue = (ToolbarValue*) aValue.getOptionalVal(); - if( pValue && pValue->mbIsTopDockingArea ) - rc.top = 0; // extend potential gradient to cover menu bar as well + if( aValue.getType() == CTRL_TOOLBAR ) + { + const ToolbarValue *pValue = static_cast<const ToolbarValue*>(&aValue); + if( pValue->mbIsTopDockingArea ) + rc.top = 0; // extend potential gradient to cover menu bar as well + } return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } } @@ -868,9 +870,11 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nPart != PART_ENTIRE_CONTROL ) return FALSE; - MenubarValue *pValue = (MenubarValue*) aValue.getOptionalVal(); - if( pValue ) + 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); } @@ -918,7 +922,8 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, ImplDrawTheme( hTheme, hDC, iPart, iState, aTRect, aCaption ); RECT aThumbRect; - SliderValue* pVal = (SliderValue*)aValue.getOptionalVal(); + OSL_ASSERT( aValue.getType() == CTRL_SLIDER ); + const SliderValue* pVal = static_cast<const SliderValue*>(&aValue); aThumbRect.left = pVal->maThumbRect.Left(); aThumbRect.top = pVal->maThumbRect.Top(); aThumbRect.right = pVal->maThumbRect.Right(); @@ -963,7 +968,7 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, */ sal_Bool WinSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption ) @@ -1043,7 +1048,7 @@ sal_Bool WinSalGraphics::drawNativeControl( ControlType nType, if( !hTheme ) return false; - Rectangle buttonRect = rControlRegion.GetBoundRect(); + Rectangle buttonRect = rControlRegion; RECT rc; rc.left = buttonRect.Left(); rc.right = buttonRect.Right()+1; @@ -1080,7 +1085,7 @@ sal_Bool WinSalGraphics::drawNativeControl( ControlType nType, */ sal_Bool WinSalGraphics::drawNativeControlText( ControlType, ControlPart, - const Region&, + const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) @@ -1104,12 +1109,12 @@ sal_Bool WinSalGraphics::drawNativeControlText( ControlType, */ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& rControlValue, const OUString&, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ) + Rectangle &rNativeBoundingRegion, + Rectangle &rNativeContentRegion ) { sal_Bool bRet = FALSE; @@ -1146,7 +1151,7 @@ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, if( hTheme ) { Rectangle aRect( ImplGetThemeRect( hTheme, hDC, TP_SPLITBUTTONDROPDOWN, - TS_HOT, rControlRegion.GetBoundRect() ) ); + TS_HOT, rControlRegion ) ); rNativeContentRegion = aRect; rNativeBoundingRegion = rNativeContentRegion; if( !rNativeContentRegion.IsEmpty() ) @@ -1160,7 +1165,7 @@ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, if( hTheme ) { Rectangle aRect( ImplGetThemeRect( hTheme, hDC, PP_BAR, - 0, rControlRegion.GetBoundRect() ) ); + 0, rControlRegion ) ); rNativeContentRegion = aRect; rNativeBoundingRegion = rNativeContentRegion; if( !rNativeContentRegion.IsEmpty() ) @@ -1172,12 +1177,9 @@ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, HTHEME hTheme = getThemeHandle( mhWnd, L"Combobox"); if( hTheme ) { - Rectangle aBoxRect( rControlRegion.GetBoundRect() ); + Rectangle aBoxRect( rControlRegion ); Rectangle aRect( ImplGetThemeRect( hTheme, hDC, CP_DROPDOWNBUTTON, CBXS_NORMAL, aBoxRect ) ); - Rectangle aBrdRect( ImplGetThemeRect( hTheme, hDC, CP_BORDER, - CBB_HOT, aBoxRect ) ); - aRect.Top() -= aBrdRect.GetHeight(); if( aRect.GetHeight() > aBoxRect.GetHeight() ) aBoxRect.Bottom() = aBoxRect.Top() + aRect.GetHeight(); if( aRect.GetWidth() > aBoxRect.GetWidth() ) @@ -1195,7 +1197,7 @@ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, if( hTheme ) { // get borderr size - Rectangle aBoxRect( rControlRegion.GetBoundRect() ); + Rectangle aBoxRect( rControlRegion ); Rectangle aRect( ImplGetThemeRect( hTheme, hDC, EP_BACKGROUNDWITHBORDER, EBWBS_HOT, aBoxRect ) ); // ad app font height @@ -1234,7 +1236,7 @@ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, if( nPart == PART_THUMB_HORZ ) { long nW = aThumbRect.GetWidth(); - Rectangle aRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( rControlRegion ); aRect.Right() = aRect.Left() + nW - 1; rNativeContentRegion = aRect; rNativeBoundingRegion = rNativeContentRegion; @@ -1242,7 +1244,7 @@ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, else { long nH = aThumbRect.GetHeight(); - Rectangle aRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( rControlRegion ); aRect.Bottom() = aRect.Top() + nH - 1; rNativeContentRegion = aRect; rNativeBoundingRegion = rNativeContentRegion; @@ -1253,30 +1255,30 @@ sal_Bool WinSalGraphics::getNativeControlRegion( ControlType nType, if ( ( nType == CTRL_TAB_ITEM ) && ( nPart == PART_ENTIRE_CONTROL ) ) { - Rectangle aControlRect( rControlRegion.GetBoundRect() ); + Rectangle aControlRect( rControlRegion ); rNativeContentRegion = aControlRect; --aControlRect.Bottom(); - TabitemValue *pValue = static_cast< TabitemValue* >( rControlValue.getOptionalVal() ); - if ( pValue ) + if( rControlValue.getType() == CTRL_TAB_ITEM ) { + const TabitemValue *pValue = static_cast<const TabitemValue*>(&rControlValue); if ( pValue->isBothAligned() ) --aControlRect.Right(); - } - if ( nState & CTRL_STATE_SELECTED ) - { - aControlRect.Left() -= 2; - if ( pValue && !pValue->isBothAligned() ) + if ( nState & CTRL_STATE_SELECTED ) { - if ( pValue->isLeftAligned() || pValue->isNotAligned() ) - aControlRect.Right() += 2; - if ( pValue->isRightAligned() ) - aControlRect.Right() += 1; + aControlRect.Left() -= 2; + if ( pValue && !pValue->isBothAligned() ) + { + if ( pValue->isLeftAligned() || pValue->isNotAligned() ) + aControlRect.Right() += 2; + if ( pValue->isRightAligned() ) + aControlRect.Right() += 1; + } + aControlRect.Top() -= 2; + aControlRect.Bottom() += 2; } - aControlRect.Top() -= 2; - aControlRect.Bottom() += 2; } rNativeBoundingRegion = aControlRect; bRet = TRUE; diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 1737d12de1b0..d90e659d1a5c 100755..100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -2076,6 +2076,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; + } } // ----------------------------------------------------------------------- @@ -2203,7 +2210,9 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ ) const int k = mpGlyphs2Chars[ i ]; mpGlyphs2Chars[ j ] = k; const int nRelGlyphPos = (j++) - rVI.mnMinGlyphPos; - mpLogClusters[ k ] = static_cast<WORD>(nRelGlyphPos); + if( k < 0) // extra glyphs are already mapped + continue; + mpLogClusters[ k ] = static_cast<WORD>(nRelGlyphPos); } rVI.mnEndGlyphPos = j; @@ -2362,6 +2371,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 ) @@ -2395,13 +2408,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; + } } } @@ -2821,7 +2838,7 @@ sal_GlyphId GraphiteLayoutWinImpl::getKashidaGlyph(int & rWidth) class GraphiteWinLayout : public WinLayout { private: - mutable gr::WinFont mpFont; + mutable GraphiteWinFont mpFont; grutils::GrFeatureParser * mpFeatures; mutable GraphiteLayoutWinImpl maImpl; public: @@ -2894,6 +2911,11 @@ void GraphiteWinLayout::RestoreDC(gr::Segment & segment) const bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args) { + if (args.mnMinCharPos >= args.mnEndCharPos) + { + maImpl.clear(); + return true; + } HFONT hUnRotatedFont; if (args.mnOrientation) { diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 6fecfdf398b3..dc011dba8de7 100644..100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -161,7 +161,7 @@ sal_Bool WinSalFrame::mbInReparent = FALSE; // ======================================================================= static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame ); -static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame ); +static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect = NULL ); static void ImplSaveFrameState( WinSalFrame* pFrame ) { @@ -182,6 +182,25 @@ static void ImplSaveFrameState( WinSalFrame* pFrame ) if ( bVisible ) pFrame->mnShowState = SW_SHOWMAXIMIZED; pFrame->mbRestoreMaximize = TRUE; + + WINDOWPLACEMENT aPlacement; + aPlacement.length = sizeof(aPlacement); + if( GetWindowPlacement( pFrame->mhWnd, &aPlacement ) ) + { + RECT aRect = aPlacement.rcNormalPosition; + RECT aRect2 = aRect; + AdjustWindowRectEx( &aRect2, GetWindowStyle( pFrame->mhWnd ), + FALSE, GetWindowExStyle( pFrame->mhWnd ) ); + long nTopDeco = abs( aRect.top - aRect2.top ); + long nLeftDeco = abs( aRect.left - aRect2.left ); + long nBottomDeco = abs( aRect.bottom - aRect2.bottom ); + long nRightDeco = abs( aRect.right - aRect2.right ); + + pFrame->maState.mnX = aRect.left + nLeftDeco; + pFrame->maState.mnY = aRect.top + nTopDeco; + pFrame->maState.mnWidth = aRect.right - aRect.left - nLeftDeco - nRightDeco; + pFrame->maState.mnHeight = aRect.bottom - aRect.top - nTopDeco - nBottomDeco; + } } else { @@ -1934,17 +1953,25 @@ void WinSalFrame::SetWindowState( const SalFrameState* pState ) } } - // Wenn Fenster nicht minimiert/maximiert ist oder nicht optisch - // umgesetzt werden muss, dann SetWindowPos() benutzen, da - // SetWindowPlacement() die TaskBar mit einrechnet + // if a window is neither minimized nor maximized or need not be + // positioned visibly (that is in visible state), do not use + // SetWindowPlacement since it calculates including the TaskBar if ( !IsIconic( mhWnd ) && !IsZoomed( mhWnd ) && (!bVisible || (aPlacement.showCmd == SW_RESTORE)) ) { if( bUpdateHiddenFramePos ) { + RECT aStateRect; + aStateRect.left = nX; + aStateRect.top = nY; + aStateRect.right = nX+nWidth; + aStateRect.bottom = nY+nHeight; // #96084 set a useful internal window size because // the window will not be maximized (and the size updated) before show() - SetMaximizedFrameGeometry( mhWnd, this ); + SetMaximizedFrameGeometry( mhWnd, this, &aStateRect ); + SetWindowPos( mhWnd, 0, + maGeometry.nX, maGeometry.nY, maGeometry.nWidth, maGeometry.nHeight, + SWP_NOZORDER | SWP_NOACTIVATE | nPosSize ); } else SetWindowPos( mhWnd, 0, @@ -4197,23 +4224,27 @@ static void ImplHandlePaintMsg2( HWND hWnd, RECT* pRect ) // ----------------------------------------------------------------------- -static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame ) +static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect ) { // calculate and set frame geometry of a maximized window - useful if the window is still hidden // dualmonitor support: // Get screensize of the monitor whith the mouse pointer - POINT pt; - GetCursorPos( &pt ); RECT aRectMouse; - aRectMouse.left = pt.x; - aRectMouse.top = pt.y; - aRectMouse.right = pt.x+2; - aRectMouse.bottom = pt.y+2; + if( ! pParentRect ) + { + POINT pt; + GetCursorPos( &pt ); + aRectMouse.left = pt.x; + aRectMouse.top = pt.y; + aRectMouse.right = pt.x+2; + aRectMouse.bottom = pt.y+2; + pParentRect = &aRectMouse; + } RECT aRect; - ImplSalGetWorkArea( hWnd, &aRect, &aRectMouse ); + ImplSalGetWorkArea( hWnd, &aRect, pParentRect ); // a maximized window has no other borders than the caption pFrame->maGeometry.nLeftDecoration = pFrame->maGeometry.nRightDecoration = pFrame->maGeometry.nBottomDecoration = 0; diff --git a/vcl/win/source/window/salmenu.cxx b/vcl/win/source/window/salmenu.cxx index bbb0b4288a4e..23295838bfc9 100644..100755 --- a/vcl/win/source/window/salmenu.cxx +++ b/vcl/win/source/window/salmenu.cxx @@ -59,7 +59,7 @@ sal_Bool SalData::IsKnownMenuHandle( HMENU hMenu ) // WinSalInst factory methods -SalMenu* WinSalInstance::CreateMenu( sal_Bool bMenuBar ) +SalMenu* WinSalInstance::CreateMenu( sal_Bool bMenuBar, Menu* ) { WinSalMenu *pSalMenu = new WinSalMenu(); |