diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-22 13:29:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-26 07:20:25 +0100 |
commit | ace95cf48ee88d78a17765e5f4f26bb93d5940cf (patch) | |
tree | 206d070d4b9eef0c84a78deda5df863ac174354c | |
parent | fa2dd2ba03f8be1f148dca8f6164daaf7bbf7d96 (diff) |
ColorData->Color in various
Change-Id: I22018b6a535224316d93bfd621771248b873a218
Reviewed-on: https://gerrit.libreoffice.org/50167
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | accessibility/source/extended/textwindowaccessibility.cxx | 4 | ||||
-rw-r--r-- | canvas/source/tools/canvastools.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/cfgchart.cxx | 36 | ||||
-rw-r--r-- | cui/source/options/cfgchart.hxx | 2 | ||||
-rw-r--r-- | cui/source/options/optchart.cxx | 2 | ||||
-rw-r--r-- | desktop/source/splash/splash.cxx | 16 | ||||
-rw-r--r-- | editeng/source/items/itemtype.cxx | 12 | ||||
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.cxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 24 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export.cxx | 4 | ||||
-rw-r--r-- | vcl/qa/cppunit/BitmapProcessorTest.cxx | 2 |
11 files changed, 50 insertions, 56 deletions
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 5183af524492..3b62c886d7af 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -2360,9 +2360,9 @@ css::uno::Any Document::mapFontColor(::Color const & rColor) // static ::Color Document::mapFontColor(css::uno::Any const & rColor) { - ::sal_Int32 nColor = 0; + ::Color nColor; rColor >>= nColor; - return ::Color(static_cast< ::ColorData >(nColor)); + return nColor; } // static diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 477ba03b3703..63f264779b9a 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -894,7 +894,7 @@ namespace canvas const sal_Int8* pCols( rColor.getConstArray() ); return ::Color( pCols[3], pCols[0], pCols[1], pCols[2] ); #else - return ::Color( *reinterpret_cast< const ::ColorData* >(rColor.getConstArray()) ); + return ::Color( *reinterpret_cast< const ::sal_uInt32* >(rColor.getConstArray()) ); #endif } diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx index 678ccb333297..29351cfa7f6a 100644 --- a/cui/source/options/cfgchart.cxx +++ b/cui/source/options/cfgchart.cxx @@ -56,7 +56,7 @@ const XColorEntry & SvxChartColorTable::operator[]( size_t _nIndex ) const return m_aColorEntries[ _nIndex ]; } -ColorData SvxChartColorTable::getColorData( size_t _nIndex ) const +Color SvxChartColorTable::getColor( size_t _nIndex ) const { if ( _nIndex >= m_aColorEntries.size() ) { @@ -100,19 +100,19 @@ void SvxChartColorTable::replace( size_t _nIndex, const XColorEntry & _rEntry ) void SvxChartColorTable::useDefault() { - ColorData aColors[] = { - RGB_COLORDATA( 0x00, 0x45, 0x86 ), - RGB_COLORDATA( 0xff, 0x42, 0x0e ), - RGB_COLORDATA( 0xff, 0xd3, 0x20 ), - RGB_COLORDATA( 0x57, 0x9d, 0x1c ), - RGB_COLORDATA( 0x7e, 0x00, 0x21 ), - RGB_COLORDATA( 0x83, 0xca, 0xff ), - RGB_COLORDATA( 0x31, 0x40, 0x04 ), - RGB_COLORDATA( 0xae, 0xcf, 0x00 ), - RGB_COLORDATA( 0x4b, 0x1f, 0x6f ), - RGB_COLORDATA( 0xff, 0x95, 0x0e ), - RGB_COLORDATA( 0xc5, 0x00, 0x0b ), - RGB_COLORDATA( 0x00, 0x84, 0xd1 ) + Color aColors[] = { + Color( 0x00, 0x45, 0x86 ), + Color( 0xff, 0x42, 0x0e ), + Color( 0xff, 0xd3, 0x20 ), + Color( 0x57, 0x9d, 0x1c ), + Color( 0x7e, 0x00, 0x21 ), + Color( 0x83, 0xca, 0xff ), + Color( 0x31, 0x40, 0x04 ), + Color( 0xae, 0xcf, 0x00 ), + Color( 0x4b, 0x1f, 0x6f ), + Color( 0xff, 0x95, 0x0e ), + Color( 0xc5, 0x00, 0x0b ), + Color( 0x00, 0x84, 0xd1 ) }; clear(); @@ -158,7 +158,7 @@ bool SvxChartColorTable::operator==( const SvxChartColorTable & _rOther ) const { for( size_t i = 0; i < m_aColorEntries.size(); ++i ) { - if( getColorData( i ) != _rOther.getColorData( i )) + if( getColor( i ) != _rOther.getColor( i )) { bEqual = false; break; @@ -232,7 +232,7 @@ bool SvxChartOptions::RetrieveOptions() // set color values for( sal_Int32 i=0; i < nCount; i++ ) { - aCol = static_cast< ColorData >(aColorSeq[ i ]); + aCol = Color(aColorSeq[ i ]); aName = aPrefix + OUString::number(i + 1) + aPostfix; @@ -256,8 +256,8 @@ void SvxChartOptions::ImplCommit() uno::Sequence< sal_Int64 > aColors( nCount ); for( size_t i=0; i < nCount; i++ ) { - ColorData aData = maDefColors.getColorData( i ); - aColors[ i ] = aData; + Color aData = maDefColors.getColor( i ); + aColors[ i ] = sal_uInt32(aData); } aValues[ 0 ] <<= aColors; diff --git a/cui/source/options/cfgchart.hxx b/cui/source/options/cfgchart.hxx index 171419378576..b5e783d8ad5d 100644 --- a/cui/source/options/cfgchart.hxx +++ b/cui/source/options/cfgchart.hxx @@ -41,7 +41,7 @@ public: // accessors size_t size() const; const XColorEntry & operator[]( size_t _nIndex ) const; - ColorData getColorData( size_t _nIndex ) const; + Color getColor( size_t _nIndex ) const; // mutators void clear(); diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index 0cedb6e21e9b..6cb02b2731f7 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -272,7 +272,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, AddChartColor, Button*, void) { if( pColorConfig ) { - ColorData const black = RGB_COLORDATA( 0x00, 0x00, 0x00 ); + Color const black( 0x00, 0x00, 0x00 ); pColorConfig->GetColorList().append (XColorEntry ( black, pColorConfig->GetColorList().getDefaultName(pColorConfig->GetColorList().size()))); diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 5856410ec9d8..a58b8227d928 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -39,6 +39,7 @@ #include <vcl/virdev.hxx> #define NOT_LOADED (long(-1)) +#define NOT_LOADED_COLOR (Color(0xffffffff)) using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; @@ -148,9 +149,9 @@ void SplashScreenWindow::Redraw() SplashScreen::SplashScreen() : pWindow( VclPtr<SplashScreenWindow>::Create(this) ) - , _cProgressFrameColor(sal::static_int_cast< ColorData >(NOT_LOADED)) - , _cProgressBarColor(sal::static_int_cast< ColorData >(NOT_LOADED)) - , _cProgressTextColor(sal::static_int_cast< ColorData >(NOT_LOADED)) + , _cProgressFrameColor(NOT_LOADED_COLOR) + , _cProgressBarColor(NOT_LOADED_COLOR) + , _cProgressTextColor(NOT_LOADED_COLOR) , _bNativeProgress(true) , _iMax(100) , _iProgress(0) @@ -294,12 +295,10 @@ SplashScreen::initialize( const css::uno::Sequence< css::uno::Any>& aArguments ) if ( NOT_LOADED == _textBaseline ) _textBaseline = _height; - if ( sal::static_int_cast< ColorData >(NOT_LOADED) == - _cProgressFrameColor.GetColor() ) + if ( NOT_LOADED_COLOR == _cProgressFrameColor ) _cProgressFrameColor = Color( COL_LIGHTGRAY ); - if ( sal::static_int_cast< ColorData >(NOT_LOADED) == - _cProgressBarColor.GetColor() ) + if ( NOT_LOADED_COLOR == _cProgressBarColor ) { // progress bar: new color only for big bitmap format if ( _width > 500 ) @@ -308,8 +307,7 @@ SplashScreen::initialize( const css::uno::Sequence< css::uno::Any>& aArguments ) _cProgressBarColor = Color( COL_BLUE ); } - if ( sal::static_int_cast< ColorData >(NOT_LOADED) == - _cProgressTextColor.GetColor() ) + if ( NOT_LOADED_COLOR == _cProgressTextColor ) _cProgressTextColor = Color( COL_BLACK ); Application::AddEventListener( diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index f3b26da98e09..3167a5996870 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -144,20 +144,15 @@ OUString GetColorString( const Color& rCol ) if (rCol.GetColor() == COL_AUTO) return EditResId(RID_SVXSTR_AUTOMATIC); - OUString sStr; - - ColorData nColData = - RGB_COLORDATA( rCol.GetRed(), rCol.GetGreen(), rCol.GetBlue() ); - sal_uInt16 nColor = 0; - - static const ColorData aColAry[] = { + static const Color aColAry[] = { COL_BLACK, COL_BLUE, COL_GREEN, COL_CYAN, COL_RED, COL_MAGENTA, COL_BROWN, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTGREEN, COL_LIGHTCYAN, COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE }; + sal_uInt16 nColor = 0; while ( nColor < SAL_N_ELEMENTS(aColAry) && - aColAry[nColor] != nColData ) + aColAry[nColor] != rCol.GetRGBColor() ) { nColor += 1; } @@ -184,6 +179,7 @@ OUString GetColorString( const Color& rCol ) static_assert(SAL_N_ELEMENTS(aColAry) == SAL_N_ELEMENTS(RID_SVXITEMS_COLORS), "must match"); + OUString sStr; if ( nColor < SAL_N_ELEMENTS(aColAry) ) sStr = EditResId(RID_SVXITEMS_COLORS[nColor]); diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 26d154eb1880..76417c0a1216 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -654,7 +654,7 @@ namespace pcr css::util::Color nColor = COL_TRANSPARENT; if (_rValue.hasValue()) _rValue >>= nColor; - getTypedControlWindow()->SelectEntry(::Color(static_cast<ColorData>(nColor))); + getTypedControlWindow()->SelectEntry(::Color(sal_uInt32(nColor))); } Any SAL_CALL OColorControl::getValue() diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 85c62dc146a3..4fcc325b2370 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -622,7 +622,7 @@ void SdImportTest::testFdo68594() const SvxColorItem *pC = &pTxtObj->GetMergedItem(EE_CHAR_COLOR); CPPUNIT_ASSERT_MESSAGE( "no color item", pC != nullptr); // Color should be black - CPPUNIT_ASSERT_EQUAL_MESSAGE( "Placeholder color mismatch", static_cast<ColorData>(0), pC->GetValue().GetColor()); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Placeholder color mismatch", sal_uInt32(0), sal_uInt32(pC->GetValue()) ); xDocShRef->DoClose(); } @@ -1019,7 +1019,7 @@ void SdImportTest::testBnc904423() CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue()); const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>( pObj->GetMergedItem(XATTR_FILLCOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0x00CC99), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00CC99), sal_uInt32(rColorItem.GetColorValue())); } // Second shape's background color is defined by theme @@ -1032,7 +1032,7 @@ void SdImportTest::testBnc904423() CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue()); const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>( pObj->GetMergedItem(XATTR_FILLCOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0x3333CC), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x3333CC), sal_uInt32(rColorItem.GetColorValue())); } // Third shape's background color is defined by direct formatting @@ -1045,7 +1045,7 @@ void SdImportTest::testBnc904423() CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue()); const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>( pObj->GetMergedItem(XATTR_FILLCOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem.GetColorValue())); } xDocShRef->DoClose(); @@ -1069,7 +1069,7 @@ void SdImportTest::testShapeLineStyle() const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>( pObj->GetMergedItem(XATTR_LINECOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem.GetColorValue())); const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>( pObj->GetMergedItem(XATTR_LINEWIDTH)); @@ -1087,7 +1087,7 @@ void SdImportTest::testShapeLineStyle() const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>( pObj->GetMergedItem(XATTR_LINECOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0x3333CC), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x3333CC), sal_uInt32(rColorItem.GetColorValue())); const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>( pObj->GetMergedItem(XATTR_LINEWIDTH)); @@ -1105,7 +1105,7 @@ void SdImportTest::testShapeLineStyle() const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>( pObj->GetMergedItem(XATTR_LINECOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0x7030A0), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x7030A0), sal_uInt32(rColorItem.GetColorValue())); const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>( pObj->GetMergedItem(XATTR_LINEWIDTH)); @@ -1499,7 +1499,7 @@ void SdImportTest::testTdf95932() CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue()); const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>( pObj->GetMergedItem(XATTR_FILLCOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0x76bf3d), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x76bf3d), sal_uInt32(rColorItem.GetColorValue())); xDocShRef->DoClose(); } @@ -1708,7 +1708,7 @@ void SdImportTest::testTdf104015() CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue()); const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>( pObj->GetMergedItem(XATTR_FILLCOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem.GetColorValue())); } // Should have a blue line { @@ -1718,7 +1718,7 @@ void SdImportTest::testTdf104015() const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>( pObj->GetMergedItem(XATTR_LINECOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0x0000FF), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x0000FF), sal_uInt32(rColorItem.GetColorValue())); } // Should have some shadow { @@ -1747,7 +1747,7 @@ void SdImportTest::testTdf104201() CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue()); const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>( pObj->GetMergedItem(XATTR_FILLCOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0x00FF00), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FF00), sal_uInt32(rColorItem.GetColorValue())); } // Second shape has blue fill, but this should be overwritten by green group fill { @@ -1758,7 +1758,7 @@ void SdImportTest::testTdf104201() CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue()); const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>( pObj->GetMergedItem(XATTR_FILLCOLOR)); - CPPUNIT_ASSERT_EQUAL(ColorData(0x00FF00), rColorItem.GetColorValue().GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FF00), sal_uInt32(rColorItem.GetColorValue())); } } diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index f63260bcc056..f3ad01808c09 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -1370,8 +1370,8 @@ DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt") uno::Reference<beans::XPropertySet> xStyle( getStyles("CharacterStyles")->getByName(charStyleName), uno::UNO_QUERY); - ColorData charColor = getProperty<util::Color>(xStyle, "CharColor"); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, charColor); + Color charColor(getProperty<util::Color>(xStyle, "CharColor")); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(COL_AUTO), sal_uInt32(charColor)); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/vcl/qa/cppunit/BitmapProcessorTest.cxx b/vcl/qa/cppunit/BitmapProcessorTest.cxx index d7f0b525d1b7..558401f84771 100644 --- a/vcl/qa/cppunit/BitmapProcessorTest.cxx +++ b/vcl/qa/cppunit/BitmapProcessorTest.cxx @@ -50,7 +50,7 @@ void BitmapProcessorTest::testDisabledImage() { Bitmap::ScopedReadAccess pReadAccess(aDisabledBitmap); Color aColor(pReadAccess->GetPixel(0, 0).GetColor()); - CPPUNIT_ASSERT_EQUAL(ColorData(0x001E1E1E), aColor.GetColor()); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x001E1E1E), sal_uInt32(aColor)); } } |