diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-06-04 15:06:14 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-06-04 15:06:14 +0000 |
commit | f9278148dc944e947fa8ed2b786098bcdba39004 (patch) | |
tree | 87ab1c5352b57526c3bcf3e34c5a4a4ad98ea453 | |
parent | cf1a66987abce026206ef2be5089847dcca1ae88 (diff) |
CWS-TOOLING: integrate CWS vcl102
pl: resync to m49
pl: #i102082# correct index access
pl: #i102082# correct index access
pl: merge tag
pl: #i101674# update selection background markers for toolbars and menus
pl: fix debug compile
pl: #i101461# improve xdg functionality (thanks oblin)
pl: #i100501# get IsAddStream from configuration setting in direct export case
pl: #i100725# check for null ptr
pl: #i100617# fix got lost in merge
-rw-r--r-- | vcl/aqua/source/a11y/aqua11ywrapper.mm | 8 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salgdi.cxx | 90 | ||||
-rw-r--r-- | vcl/inc/vcl/window.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/keycod.cxx | 40 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 19 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 52 | ||||
-rw-r--r-- | vcl/unx/kde/kdedata.cxx | 2 |
8 files changed, 126 insertions, 89 deletions
diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index 066748cc1525..d6f99c7020d6 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -178,9 +178,11 @@ static MacOSBOOL isPopupMenuOpen = NO; -(Reference < XAccessible >)getFirstRadioButtonInGroup { Reference < XAccessibleRelationSet > rxAccessibleRelationSet = [ self accessibleContext ] -> getAccessibleRelationSet(); - AccessibleRelation relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType::MEMBER_OF ); - if ( relationMemberOf.RelationType == AccessibleRelationType::MEMBER_OF && relationMemberOf.TargetSet.hasElements() ) { - return Reference < XAccessible > ( relationMemberOf.TargetSet[0], UNO_QUERY ); + if( rxAccessibleRelationSet.is() ) + { + AccessibleRelation relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType::MEMBER_OF ); + if ( relationMemberOf.RelationType == AccessibleRelationType::MEMBER_OF && relationMemberOf.TargetSet.hasElements() ) + return Reference < XAccessible > ( relationMemberOf.TargetSet[0], UNO_QUERY ); } return Reference < XAccessible > (); } diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 314753302534..3ee54afe2fba 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -346,64 +346,80 @@ void AquaSalGraphics::updateResolution() void AquaSalGraphics::initResolution( NSWindow* pWin ) { - NSScreen* pScreen = nil; + // #i100617# read DPI only once; there is some kind of weird caching going on + // if the main screen changes + // FIXME: this is really unfortunate and needs to be investigated - /* #i91301# - many woes went into the try to have different resolutions - on different screens. The result of these trials is that OOo is not ready - for that yet, vcl and applications would need to be adapted. + SalData* pSalData = GetSalData(); + if( pSalData->mnDPIX == 0 || pSalData->mnDPIY == 0 ) + { + NSScreen* pScreen = nil; - Unfortunately this is not possible in the 3.0 timeframe. - So let's stay with one resolution for all Windows and VirtualDevices - which is the resolution of the main screen + /* #i91301# + many woes went into the try to have different resolutions + on different screens. The result of these trials is that OOo is not ready + for that yet, vcl and applications would need to be adapted. - This of course also means that measurements are exact only on the main screen. - For activating different resolutions again just comment out the two lines below. + Unfortunately this is not possible in the 3.0 timeframe. + So let's stay with one resolution for all Windows and VirtualDevices + which is the resolution of the main screen - if( pWin ) + This of course also means that measurements are exact only on the main screen. + For activating different resolutions again just comment out the two lines below. + + if( pWin ) pScreen = [pWin screen]; - */ - if( pScreen == nil ) - { - NSArray* pScreens = [NSScreen screens]; - if( pScreens ) - pScreen = [pScreens objectAtIndex: 0]; - } + */ + if( pScreen == nil ) + { + NSArray* pScreens = [NSScreen screens]; + if( pScreens ) + pScreen = [pScreens objectAtIndex: 0]; + } - mnRealDPIX = mnRealDPIY = 96; - if( pScreen ) - { - NSDictionary* pDev = [pScreen deviceDescription]; - if( pDev ) + mnRealDPIX = mnRealDPIY = 96; + if( pScreen ) { - NSNumber* pVal = [pDev objectForKey: @"NSScreenNumber"]; - if( pVal ) + NSDictionary* pDev = [pScreen deviceDescription]; + if( pDev ) { - // FIXME: casting a long to CGDirectDisplayID is evil, but - // Apple suggest to do it this way - const CGDirectDisplayID nDisplayID = (CGDirectDisplayID)[pVal longValue]; - const CGSize aSize = CGDisplayScreenSize( nDisplayID ); // => result is in millimeters - mnRealDPIX = static_cast<long>((CGDisplayPixelsWide( nDisplayID ) * 25.4) / aSize.width); - mnRealDPIY = static_cast<long>((CGDisplayPixelsHigh( nDisplayID ) * 25.4) / aSize.height); + NSNumber* pVal = [pDev objectForKey: @"NSScreenNumber"]; + if( pVal ) + { + // FIXME: casting a long to CGDirectDisplayID is evil, but + // Apple suggest to do it this way + const CGDirectDisplayID nDisplayID = (CGDirectDisplayID)[pVal longValue]; + const CGSize aSize = CGDisplayScreenSize( nDisplayID ); // => result is in millimeters + mnRealDPIX = static_cast<long>((CGDisplayPixelsWide( nDisplayID ) * 25.4) / aSize.width); + mnRealDPIY = static_cast<long>((CGDisplayPixelsHigh( nDisplayID ) * 25.4) / aSize.height); + } + else + { + DBG_ERROR( "no resolution found in device description" ); + } } else { - DBG_ERROR( "no resolution found in device description" ); + DBG_ERROR( "no device description" ); } } else { - DBG_ERROR( "no device description" ); + DBG_ERROR( "no screen found" ); } + + // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) + mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; + + pSalData->mnDPIX = mnRealDPIX; + pSalData->mnDPIY = mnRealDPIY; } else { - DBG_ERROR( "no screen found" ); + mnRealDPIX = pSalData->mnDPIX; + mnRealDPIY = pSalData->mnDPIY; } - // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) - mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; - mfFakeDPIScale = 1.0; } diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 6f7c18ac2730..3f05383d4f80 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -983,6 +983,8 @@ public: void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly ); // the same, but fills a passed Color with a text color complementing the selection background void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, Color* pSelectionTextColor ); + // support rounded edges in the selection rect + void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, long nCornerRadius, Color* pSelectionTextColor, Color* pPaintColor ); void ShowTracking( const Rectangle& rRect, USHORT nFlags = SHOWTRACK_SMALL ); diff --git a/vcl/source/window/keycod.cxx b/vcl/source/window/keycod.cxx index 77af28241cb3..21030b9422fb 100644 --- a/vcl/source/window/keycod.cxx +++ b/vcl/source/window/keycod.cxx @@ -49,27 +49,27 @@ // ======================================================================= -static USHORT aImplKeyFuncTab[(KEYFUNC_FRONT+1)*3] = +static USHORT aImplKeyFuncTab[(KEYFUNC_FRONT+1)*4] = { - 0, 0, 0, // KEYFUNC_DONTKNOW - KEY_N | KEY_MOD1, 0, 0, // KEYFUNC_NEW - KEY_O | KEY_MOD1, KEY_OPEN, 0, // KEYFUNC_OPEN - KEY_S | KEY_MOD1, 0, 0, // KEYFUNC_SAVE - 0, 0, 0, // KEYFUNC_SAVEAS - KEY_P | KEY_MOD1, 0, 0, // KEYFUNC_PRINT - KEY_W | KEY_MOD1, KEY_F4 | KEY_MOD1, 0, // KEYFUNC_CLOSE - KEY_Q | KEY_MOD1, KEY_F4 | KEY_MOD2, 0, // KEYFUNC_QUIT - KEY_X | KEY_MOD1, KEY_DELETE | KEY_SHIFT, KEY_CUT, // KEYFUNC_CUT - KEY_C | KEY_MOD1, KEY_INSERT | KEY_MOD1, KEY_COPY, // KEYFUNC_COPY - KEY_V | KEY_MOD1, KEY_INSERT | KEY_SHIFT, KEY_PASTE, // KEYFUNC_PASTE - KEY_Z | KEY_MOD1, KEY_BACKSPACE | KEY_MOD2, KEY_UNDO, // KEYFUNC_UNDO - 0, 0, 0, // KEYFUNC_REDO - KEY_DELETE, 0, 0, // KEYFUNC_DELETE - KEY_REPEAT, 0, 0, // KEYFUNC_REPEAT - KEY_F | KEY_MOD1, KEY_FIND, 0, // KEYFUNC_FIND - KEY_F | KEY_SHIFT | KEY_MOD1, KEY_SHIFT | KEY_FIND, 0, // KEYFUNC_FINDBACKWARD - KEY_RETURN | KEY_MOD2, 0, 0, // KEYFUNC_PROPERTIES - 0, 0, 0 // KEYFUNC_FRONT + 0, 0, 0, 0, // KEYFUNC_DONTKNOW + KEY_N | KEY_MOD1, 0, 0, 0, // KEYFUNC_NEW + KEY_O | KEY_MOD1, KEY_OPEN, 0, 0, // KEYFUNC_OPEN + KEY_S | KEY_MOD1, 0, 0, 0, // KEYFUNC_SAVE + 0, 0, 0, 0, // KEYFUNC_SAVEAS + KEY_P | KEY_MOD1, 0, 0, 0, // KEYFUNC_PRINT + KEY_W | KEY_MOD1, KEY_F4 | KEY_MOD1, 0, 0, // KEYFUNC_CLOSE + KEY_Q | KEY_MOD1, KEY_F4 | KEY_MOD2, 0, 0, // KEYFUNC_QUIT + KEY_X | KEY_MOD1, KEY_DELETE | KEY_SHIFT, KEY_CUT, 0, // KEYFUNC_CUT + KEY_C | KEY_MOD1, KEY_INSERT | KEY_MOD1, KEY_COPY, 0, // KEYFUNC_COPY + KEY_V | KEY_MOD1, KEY_INSERT | KEY_SHIFT, KEY_PASTE, 0, // KEYFUNC_PASTE + KEY_Z | KEY_MOD1, KEY_BACKSPACE | KEY_MOD2, KEY_UNDO, 0, // KEYFUNC_UNDO + 0, 0, 0, 0, // KEYFUNC_REDO + KEY_DELETE, 0, 0, 0, // KEYFUNC_DELETE + KEY_REPEAT, 0, 0, 0, // KEYFUNC_REPEAT + KEY_F | KEY_MOD1, KEY_FIND, 0, 0, // KEYFUNC_FIND + KEY_F | KEY_SHIFT | KEY_MOD1, KEY_SHIFT | KEY_FIND, 0, 0, // KEYFUNC_FINDBACKWARD + KEY_RETURN | KEY_MOD2, 0, 0, 0, // KEYFUNC_PROPERTIES + 0, 0, 0, 0 // KEYFUNC_FRONT }; // ----------------------------------------------------------------------- diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index b074a658ac3b..c827905e94e6 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2487,23 +2487,8 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec if( ! bNativeOk ) { const StyleSettings& rSettings = i_pWindow->GetSettings().GetStyleSettings(); - if( i_bHighlight ) - { - i_pWindow->Push( PUSH_ALL ); - Color aCol = rSettings.GetMenuHighlightTextColor(); - i_pWindow->SetFillColor( rSettings.GetMenuHighlightTextColor() ); - if( aCol.IsDark() ) - aCol.IncreaseLuminance( 128 ); - else - aCol.DecreaseLuminance( 128 ); - i_pWindow->SetLineColor( aCol ); - Polygon aPoly( i_rRect ); - PolyPolygon aPolyPoly( aPoly ); - i_pWindow->DrawTransparent( aPolyPoly, 20 ); - i_pWindow->Pop(); - } - else - i_pWindow->DrawSelectionBackground( i_rRect, 1, FALSE, TRUE, FALSE ); + Color aColor( i_bHighlight ? rSettings.GetMenuHighlightTextColor() : rSettings.GetHighlightColor() ); + i_pWindow->DrawSelectionBackground( i_rRect, 0, i_bHighlight, TRUE, FALSE, 2, NULL, &aColor ); } } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 07d56588c80e..bb1f428c6626 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -3378,7 +3378,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, USHORT highl } if( !bNativeOk ) - pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, TRUE, bIsWindow ); + pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, TRUE, bIsWindow, 2, NULL, NULL ); } void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLayout ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 676375db10bf..279775d712e4 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9240,19 +9240,34 @@ BOOL Window::ImplGetCurrentBackgroundColor( Color& rCol ) void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly ) { - DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, NULL ); + DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, NULL, NULL ); } void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, Color* pSelectionTextColor ) { + DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, pSelectionTextColor, NULL ); +} + +void Window::DrawSelectionBackground( const Rectangle& rRect, + USHORT highlight, + BOOL bChecked, + BOOL bDrawBorder, + BOOL bDrawExtBorderOnly, + long nCornerRadius, + Color* pSelectionTextColor, + Color* pPaintColor + ) +{ if( rRect.IsEmpty() ) return; + bool bRoundEdges = nCornerRadius > 0; + const StyleSettings& rStyles = GetSettings().GetStyleSettings(); // colors used for item highlighting - Color aSelectionBorderCol( rStyles.GetHighlightColor() ); + Color aSelectionBorderCol( pPaintColor ? *pPaintColor : rStyles.GetHighlightColor() ); Color aSelectionFillCol( aSelectionBorderCol ); BOOL bDark = rStyles.GetFaceColor().IsDark(); @@ -9261,7 +9276,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, int c1 = aSelectionBorderCol.GetLuminance(); int c2 = GetDisplayBackground().GetColor().GetLuminance(); - if( !bDark && !bBright && abs( c2-c1 ) < 75 ) + if( !bDark && !bBright && abs( c2-c1 ) < (pPaintColor ? 40 : 75) ) { // constrast too low USHORT h,s,b; @@ -9272,6 +9287,14 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, aSelectionBorderCol = aSelectionFillCol; } + if( bRoundEdges ) + { + if( aSelectionBorderCol.IsDark() ) + aSelectionBorderCol.IncreaseLuminance( 128 ); + else + aSelectionBorderCol.DecreaseLuminance( 128 ); + } + Rectangle aRect( rRect ); if( bDrawExtBorderOnly ) { @@ -9294,7 +9317,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, if( bDark ) aSelectionFillCol = COL_BLACK; else - nPercent = 80; // just checked (light) + nPercent = bRoundEdges ? 90 : 80; // just checked (light) } else { @@ -9309,7 +9332,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, nPercent = 0; } else - nPercent = 20; // selected, pressed or checked ( very dark ) + nPercent = bRoundEdges ? 50 : 20; // selected, pressed or checked ( very dark ) } else if( bChecked || highlight == 1 ) { @@ -9322,7 +9345,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, nPercent = 0; } else - nPercent = 35; // selected, pressed or checked ( very dark ) + nPercent = bRoundEdges ? 70 : 35; // selected, pressed or checked ( very dark ) } else { @@ -9338,7 +9361,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, nPercent = 0; } else - nPercent = 70; // selected ( dark ) + nPercent = bRoundEdges ? 80 : 70; // selected ( dark ) } } @@ -9368,9 +9391,18 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, } else { - Polygon aPoly( aRect ); - PolyPolygon aPolyPoly( aPoly ); - DrawTransparent( aPolyPoly, nPercent ); + if( bRoundEdges ) + { + Polygon aPoly( aRect, nCornerRadius, nCornerRadius ); + PolyPolygon aPolyPoly( aPoly ); + DrawTransparent( aPolyPoly, nPercent ); + } + else + { + Polygon aPoly( aRect ); + PolyPolygon aPolyPoly( aPoly ); + DrawTransparent( aPolyPoly, nPercent ); + } } SetFillColor( oldFillCol ); diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index d0da9ec0cbce..f29ef1d4ff96 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -248,7 +248,7 @@ extern "C" { if( nMajor != 3 || nMinor < 2 || (nMinor == 2 && nMicro < 2) ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "unsuitable qt version %d.%d.%d\n", (int)nMajor, (int)nMinor, (int)nMicro ); + fprintf( stderr, "unsuitable qt version %"SAL_PRIdINT32".%"SAL_PRIdINT32".%"SAL_PRIdINT32"\n", nMajor, nMinor, nMicro ); #endif return NULL; } |