diff options
author | Kurt Zenker <kz@openoffice.org> | 2010-07-13 14:21:59 +0200 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2010-07-13 14:21:59 +0200 |
commit | 2e7d5613508eaa7017d59dffe43461f378123eda (patch) | |
tree | ff776cb834ee40bd2d88fbb9f78f4f963798a174 /vcl/unx/kde4 | |
parent | be588658ea127a6a05390435126f1d739a477b58 (diff) | |
parent | ca96ec380d07cb9f3c3d130bbf9d73c2a888b3c0 (diff) |
CWS-TOOLING: integrate CWS ooo30gsl01_OOO330
Diffstat (limited to 'vcl/unx/kde4')
-rw-r--r-- | vcl/unx/kde4/KDESalGraphics.cxx | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 5f8b5d2ae59e..fdc9a8bbcee1 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -195,6 +195,22 @@ namespace kapp->style()->drawComplexControl(element, option, &painter); } + int getFrameWidth() + { + static int s_nFrameWidth = -1; + if( s_nFrameWidth < 0 ) + { + // fill in a default + s_nFrameWidth = 2; + QFrame aFrame( NULL ); + aFrame.setFrameRect( QRect(0, 0, 100, 30) ); + aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + aFrame.ensurePolished(); + s_nFrameWidth = aFrame.frameWidth(); + } + return s_nFrameWidth; + } + void lcl_drawFrame(QStyle::PrimitiveElement element, QImage* image, QStyle::State state) { #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) @@ -480,18 +496,25 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, lcl_drawFrame( QStyle::PE_Frame, m_image, vclStateValue2StateFlag(nControlState, value) ); - int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); + // draw just the border, see http://qa.openoffice.org/issues/show_bug.cgi?id=107945 + int nFrameWidth = getFrameWidth(); pTempClipRegion = XCreateRegion(); XRectangle xRect = { widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height() }; XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion ); - XLIB_Region pSubtract = XCreateRegion(); - xRect.x += size; - xRect.y += size; - xRect.width -= 2* size; - xRect.height -= 2*size; - XUnionRectWithRegion( &xRect, pSubtract, pSubtract ); - XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion ); - XDestroyRegion( pSubtract ); + xRect.x += nFrameWidth; + xRect.y += nFrameWidth; + + // do not crash for too small widgets, see http://qa.openoffice.org/issues/show_bug.cgi?id=112102 + if( xRect.width > 2*nFrameWidth && xRect.height > 2*nFrameWidth ) + { + xRect.width -= 2*nFrameWidth; + xRect.height -= 2*nFrameWidth; + + XLIB_Region pSubtract = XCreateRegion(); + XUnionRectWithRegion( &xRect, pSubtract, pSubtract ); + XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion ); + XDestroyRegion( pSubtract ); + } } else if (type == CTRL_FIXEDBORDER) { @@ -744,14 +767,14 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, { if( part == PART_BORDER ) { - int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); + int nFrameWidth = getFrameWidth(); USHORT nStyle = val.getNumericVal(); if( nStyle & FRAME_DRAW_NODRAW ) { // in this case the question is: how thick would a frame be // see brdwin.cxx, decoview.cxx // most probably the behavior in decoview.cxx is wrong. - contentRect.adjust(size, size, -size, -size); + contentRect.adjust(nFrameWidth, nFrameWidth, -nFrameWidth, -nFrameWidth); } retVal = true; } |