update dev300-m57
[ooovba.git] / applied_patches / 0347-vba-interior-object-fix.diff
blobf4a45c4748264512a1e7ac06e7fd90ecc5fed6bd
1 diff --git sc/source/ui/vba/vbainterior.cxx sc/source/ui/vba/vbainterior.cxx
2 index 99f1bd7..e9f538a 100644
3 --- sc/source/ui/vba/vbainterior.cxx
4 +++ sc/source/ui/vba/vbainterior.cxx
5 @@ -162,11 +162,19 @@ ScVbaInterior::setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno
7 sal_Int32 nIndex = 0;
8 _colorindex >>= nIndex;
9 -
10 - // setColor expects colors in XL RGB values
11 - // #FIXME this is daft we convert OO RGB val to XL RGB val and
12 - // then back again to OO RGB value
13 - setColor( OORGBToXLRGB( GetIndexColor( nIndex ) ) );
15 + // hackly for excel::XlColorIndex::xlColorIndexNone
16 + if( nIndex == excel::XlColorIndex::xlColorIndexNone )
17 + {
18 + m_xProps->setPropertyValue( BACKCOLOR, uno::makeAny( sal_Int32( -1 ) ) );
19 + }
20 + else
21 + {
22 + // setColor expects colors in XL RGB values
23 + // #FIXME this is daft we convert OO RGB val to XL RGB val and
24 + // then back again to OO RGB value
25 + setColor( OORGBToXLRGB( GetIndexColor( nIndex ) ) );
26 + }
28 uno::Any
29 ScVbaInterior::GetIndexColor( const sal_Int32& nColorIndex )
30 @@ -204,13 +212,21 @@ uno::Any SAL_CALL
31 ScVbaInterior::getColorIndex() throw ( css::uno::RuntimeException )
33 sal_Int32 nColor = 0;
34 + // hackly for excel::XlColorIndex::xlColorIndexNone
35 + uno::Any aColor = m_xProps->getPropertyValue( BACKCOLOR );
36 + if( ( aColor >>= nColor ) && ( nColor == -1 ) )
37 + {
38 + nColor = excel::XlColorIndex::xlColorIndexNone;
39 + return uno::makeAny( nColor );
40 + }
42 // getColor returns Xl ColorValue, need to convert it to OO val
43 // as the palette deals with OO RGB values
44 // #FIXME this is daft in getColor we convert OO RGB val to XL RGB val
45 // and then back again to OO RGB value
46 XLRGBToOORGB( getColor() ) >>= nColor;
48 - return uno::makeAny( GetIndexColor( nColor ) );
49 + return uno::makeAny( GetColorIndex( nColor ) );
51 Color
52 ScVbaInterior::GetPatternColor( const Color& rPattColor, const Color& rBackColor, sal_uInt32 nXclPattern )