diff options
author | Hannah Meeks <hmeeks4135@gmail.com> | 2022-12-23 21:54:01 +0000 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-20 16:55:31 +0000 |
commit | 0548269ca03f093c41f6292e783cc6c77328808e (patch) | |
tree | a71544a66c43a6341607e61a2f5d9e0b9130ae16 /vbahelper | |
parent | 9ba251fb3e7d3b76c8ce730e4b3a3a7859bc119b (diff) |
VBA: Remove conversions in writer from OORGBTOXLRGB (XLRGB is actually BGR!)
Enum to store if document is Writer or Calc because font colors are treated
differently depending on this:
In writer the colors come in as RGB but in calc they are in BGR and both palettes
are in RBG so we only need this conversion for calc.
Includes testdoc for calc - to show this still works
Change-Id: I79d9d585dbfc527c0781543ce1f1095c4db190b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144788
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbafontbase.cxx | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/vbahelper/source/vbahelper/vbafontbase.cxx b/vbahelper/source/vbahelper/vbafontbase.cxx index 50bac8f92d25..797fefd5cd7e 100644 --- a/vbahelper/source/vbahelper/vbafontbase.cxx +++ b/vbahelper/source/vbahelper/vbafontbase.cxx @@ -37,10 +37,12 @@ VbaFontBase::VbaFontBase( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::container::XIndexAccess >& xPalette, const uno::Reference< beans::XPropertySet >& xPropertySet, + Component eWhich, bool bFormControl ) : VbaFontBase_BASE( xParent, xContext ), mxFont( xPropertySet, uno::UNO_SET_THROW ), mxPalette( xPalette, uno::UNO_SET_THROW ), + meWhich( eWhich ), mbFormControl( bFormControl ) { } @@ -141,10 +143,12 @@ VbaFontBase::setColorIndex( const uno::Any& _colorindex ) --nIndex; // OOo indices are zero bases - // setColor expects colors in XL RGB values - // #FIXME this is daft we convert OO RGB val to XL RGB val and - // then back again to OO RGB value - setColor( OORGBToXLRGB(mxPalette->getByIndex( nIndex )) ); + if (meWhich == EXCEL){ + setColor( OORGBToXLRGB(mxPalette->getByIndex( nIndex )) ); + } + else{ + setColor( mxPalette->getByIndex( nIndex )); + } } @@ -153,7 +157,13 @@ VbaFontBase::getColorIndex() { sal_Int32 nColor = 0; - XLRGBToOORGB( getColor() ) >>= nColor; + if (meWhich == EXCEL){ + XLRGBToOORGB( getColor() ) >>= nColor; + } + else{ + getColor() >>= nColor; + } + sal_Int32 nElems = mxPalette->getCount(); sal_Int32 nIndex = -1; for ( sal_Int32 count=0; count<nElems; ++count ) @@ -257,8 +267,14 @@ VbaFontBase::getName() uno::Any VbaFontBase::getColor() { - uno::Any aAny = OORGBToXLRGB( mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharColor", "TextColor" ) ) ); - return aAny; + if (meWhich == EXCEL){ + uno::Any aAny = OORGBToXLRGB( mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharColor", "TextColor" ) ) ); + return aAny; + } + else{ + uno::Any aAny = mxFont->getPropertyValue( VBAFONTBASE_PROPNAME( "CharColor", "TextColor" ) ); + return aAny; + } } void |