summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-01-15 14:49:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-16 10:07:07 +0100
commit63a68064bb33f180b8a231f7524d99405d910226 (patch)
tree7ecf05b057c5ca4d80a48af045998a4b34484561
parentd534a4c7b45ff254b339e806c6a11f13d9ff0043 (diff)
make the Color constructors explicitly specify transparency
to reduce the churn, we leave the existing constructor in place, and add a clang plugin to detect when the value passed to the existing constructor may contain transparency/alpha data. i.e. we leave expressions like Color(0xffffff) alone, but warn about any non-constant expression, and any expression like Color(0xff000000) Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--UnoControls/source/controls/progressbar.cxx4
-rw-r--r--UnoControls/source/inc/progressbar.hxx8
-rw-r--r--UnoControls/source/inc/progressmonitor.hxx4
-rw-r--r--UnoControls/source/inc/statusindicator.hxx6
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx4
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx2
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx2
-rw-r--r--chart2/source/view/main/VDataSeries.cxx8
-rw-r--r--compilerplugins/clang/colorcheck.cxx95
-rw-r--r--cui/source/options/cfgchart.cxx2
-rw-r--r--cui/source/tabpages/tpcolor.cxx2
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx15
-rw-r--r--desktop/source/splash/splash.cxx2
-rw-r--r--drawinglayer/source/primitive2d/sceneprimitive2d.cxx10
-rw-r--r--drawinglayer/source/tools/emfpbrush.cxx18
-rw-r--r--drawinglayer/source/tools/emfphelperdata.cxx4
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx8
-rw-r--r--editeng/source/items/frmitems.cxx8
-rw-r--r--editeng/source/items/textitem.cxx8
-rw-r--r--editeng/source/uno/unonrule.cxx6
-rw-r--r--emfio/source/reader/mtftools.cxx2
-rw-r--r--extensions/source/propctrlr/fontdialog.cxx4
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx2
-rw-r--r--filter/qa/cppunit/msfilter-test.cxx2
-rw-r--r--filter/source/graphicfilter/ieps/ieps.cxx2
-rw-r--r--filter/source/graphicfilter/itga/itga.cxx2
-rw-r--r--filter/source/msfilter/escherex.cxx8
-rw-r--r--forms/source/component/Grid.cxx2
-rw-r--r--forms/source/component/navigationbar.cxx4
-rw-r--r--include/oox/helper/helper.hxx2
-rw-r--r--include/sax/tools/converter.hxx10
-rw-r--r--include/svx/ColorSets.hxx2
-rw-r--r--include/svx/colorwindow.hxx2
-rw-r--r--include/tools/color.hxx38
-rw-r--r--include/vcl/BitmapColor.hxx18
-rw-r--r--include/vcl/RawBitmap.hxx2
-rw-r--r--include/vcl/salgtype.hxx2
-rw-r--r--oox/source/drawingml/chart/objectformatter.cxx4
-rw-r--r--oox/source/drawingml/color.cxx8
-rw-r--r--oox/source/drawingml/shape.cxx4
-rw-r--r--oox/source/export/chartexport.cxx8
-rw-r--r--oox/source/export/drawingml.cxx22
-rw-r--r--oox/source/export/shapes.cxx2
-rw-r--r--oox/source/ole/olehelper.cxx2
-rw-r--r--reportdesign/source/core/api/ImageControl.cxx2
-rw-r--r--reportdesign/source/core/api/Section.cxx2
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx4
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx6
-rw-r--r--reportdesign/source/ui/report/FixedTextColor.cxx6
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx4
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx4
-rw-r--r--sc/qa/extras/new_cond_format.cxx2
-rw-r--r--sc/source/core/tool/appoptio.cxx8
-rw-r--r--sc/source/core/tool/viewopti.cxx7
-rw-r--r--sc/source/filter/excel/xestream.cxx2
-rw-r--r--sc/source/filter/excel/xestyle.cxx2
-rw-r--r--sc/source/filter/excel/xlchart.cxx4
-rw-r--r--sc/source/filter/ftools/fapihelper.cxx4
-rw-r--r--sc/source/filter/inc/condformatbuffer.hxx2
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx2
-rw-r--r--sc/source/filter/oox/pagesettings.cxx2
-rw-r--r--sc/source/filter/oox/stylesbuffer.cxx6
-rw-r--r--sc/source/filter/orcus/interface.cxx2
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx2
-rw-r--r--sc/source/ui/drawfunc/drawsh2.cxx2
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx10
-rw-r--r--sc/source/ui/unoobj/condformatuno.cxx4
-rw-r--r--sc/source/ui/unoobj/confuno.cxx7
-rw-r--r--sc/source/ui/vba/vbaborders.cxx2
-rw-r--r--sc/source/ui/vba/vbainterior.cxx10
-rw-r--r--sc/source/ui/view/editsh.cxx2
-rw-r--r--sc/source/ui/view/formatsh.cxx2
-rw-r--r--sc/source/ui/view/tabview3.cxx2
-rw-r--r--sd/source/filter/eppt/pptx-stylesheet.cxx6
-rw-r--r--sd/source/filter/html/htmlex.cxx20
-rw-r--r--sd/source/filter/ppt/ppt97animations.cxx2
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx13
-rw-r--r--sd/source/ui/dlg/copydlg.cxx4
-rw-r--r--sd/source/ui/presenter/PresenterTextView.cxx8
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx4
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterService.cxx8
-rw-r--r--sd/source/ui/view/drtxtob1.cxx2
-rw-r--r--sd/source/ui/view/drviews2.cxx2
-rw-r--r--sd/source/ui/view/drviews7.cxx2
-rw-r--r--sfx2/source/control/recentdocsview.cxx8
-rw-r--r--sfx2/source/control/templatedefaultview.cxx8
-rw-r--r--sfx2/source/sidebar/Theme.cxx6
-rw-r--r--starmath/inc/token.hxx2
-rw-r--r--starmath/source/mathmlexport.cxx2
-rw-r--r--starmath/source/node.cxx2
-rw-r--r--svtools/source/config/colorcfg.cxx4
-rw-r--r--svtools/source/config/optionsdrawinglayer.cxx8
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx2
-rw-r--r--svx/source/dialog/hexcolorcontrol.cxx2
-rw-r--r--svx/source/fmcomp/fmgridif.cxx8
-rw-r--r--svx/source/svdraw/svdattr.cxx2
-rw-r--r--svx/source/tbxctrls/PaletteManager.cxx4
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx6
-rw-r--r--svx/source/xoutdev/xattr.cxx34
-rw-r--r--svx/source/xoutdev/xtabcolr.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx20
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport2.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport3.cxx4
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport8.cxx2
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx4
-rw-r--r--sw/qa/extras/rtfexport/rtfexport2.cxx6
-rw-r--r--sw/qa/extras/rtfexport/rtfexport4.cxx2
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx6
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx16
-rw-r--r--sw/source/core/access/AccessibilityCheck.cxx8
-rw-r--r--sw/source/core/access/acccell.cxx2
-rw-r--r--sw/source/core/access/accpara.cxx10
-rw-r--r--sw/source/core/access/acctable.cxx2
-rw-r--r--sw/source/core/inc/wrong.hxx8
-rw-r--r--sw/source/core/layout/atrfrm.cxx4
-rw-r--r--sw/source/core/unocore/unotbl.cxx2
-rw-r--r--sw/source/filter/html/htmlforw.cxx4
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx6
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx4
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx18
-rw-r--r--sw/source/filter/xml/xmlimpit.cxx5
-rw-r--r--sw/source/uibase/app/docsh2.cxx2
-rw-r--r--sw/source/uibase/config/modcfg.cxx8
-rw-r--r--sw/source/uibase/shells/basesh.cxx2
-rw-r--r--sw/source/uibase/shells/drawdlg.cxx2
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx2
-rw-r--r--sw/source/uibase/shells/textsh1.cxx4
-rw-r--r--sw/source/uibase/utlui/shdwcrsr.cxx2
-rw-r--r--toolkit/source/awt/stylesettings.cxx2
-rw-r--r--toolkit/source/awt/vclxgraphics.cxx10
-rw-r--r--toolkit/source/awt/vclxwindow.cxx39
-rw-r--r--toolkit/source/awt/vclxwindows.cxx31
-rw-r--r--tools/qa/cppunit/test_color.cxx4
-rw-r--r--vbahelper/source/vbahelper/vbacolorformat.cxx2
-rw-r--r--vcl/headless/CustomWidgetDraw.cxx139
-rw-r--r--vcl/headless/svpgdi.cxx2
-rw-r--r--vcl/inc/bitmap/ScanlineTools.hxx2
-rw-r--r--vcl/qa/cppunit/BitmapExTest.cxx12
-rw-r--r--vcl/qa/cppunit/BitmapProcessorTest.cxx6
-rw-r--r--vcl/qa/cppunit/BitmapTest.cxx14
-rw-r--r--vcl/qa/cppunit/ScanlineToolsTest.cxx15
-rw-r--r--vcl/qa/cppunit/bitmapcolor.cxx2
-rw-r--r--vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx27
-rw-r--r--vcl/qa/cppunit/png/PngFilterTest.cxx120
-rw-r--r--vcl/qt5/Qt5AccessibleWidget.cxx4
-rw-r--r--vcl/qt5/Qt5Graphics_GDI.cxx5
-rw-r--r--vcl/skia/gdiimpl.cxx2
-rw-r--r--vcl/skia/salbmp.cxx2
-rw-r--r--vcl/source/app/settings.cxx2
-rw-r--r--vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx9
-rw-r--r--vcl/source/bitmap/BitmapDisabledImageFilter.cxx2
-rw-r--r--vcl/source/bitmap/BitmapReadAccess.cxx16
-rw-r--r--vcl/source/gdi/gdimtf.cxx4
-rw-r--r--vcl/source/graphic/GraphicObject2.cxx2
-rw-r--r--vcl/source/helper/canvastools.cxx2
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx8
-rw-r--r--vcl/source/window/menubarwindow.cxx2
-rw-r--r--vcl/unx/generic/app/saldisp.cxx6
-rw-r--r--writerfilter/source/dmapper/BorderHandler.cxx2
-rw-r--r--writerfilter/source/dmapper/CellColorHandler.cxx6
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx2
-rw-r--r--writerfilter/source/dmapper/TDefTableHandler.cxx2
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx19
-rw-r--r--xmloff/source/chart/ColorPropertySet.cxx2
-rw-r--r--xmloff/source/style/TransGradientStyle.cxx4
-rw-r--r--xmloff/source/style/xmlnumi.cxx6
170 files changed, 767 insertions, 595 deletions
diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx
index f88aca35034b..a2a8222c0529 100644
--- a/UnoControls/source/controls/progressbar.cxx
+++ b/UnoControls/source/controls/progressbar.cxx
@@ -140,7 +140,7 @@ void SAL_CALL ProgressBar::setForegroundColor( sal_Int32 nColor )
MutexGuard aGuard (m_aMutex);
// Safe color for later use.
- m_nForegroundColor = Color(nColor);
+ m_nForegroundColor = Color(ColorTransparency, nColor);
// Repaint control
impl_paint ( 0, 0, impl_getGraphicsPeer() );
@@ -154,7 +154,7 @@ void SAL_CALL ProgressBar::setBackgroundColor ( sal_Int32 nColor )
MutexGuard aGuard (m_aMutex);
// Safe color for later use.
- m_nBackgroundColor = Color(nColor);
+ m_nBackgroundColor = Color(ColorTransparency, nColor);
// Repaint control
impl_paint ( 0, 0, impl_getGraphicsPeer() );
diff --git a/UnoControls/source/inc/progressbar.hxx b/UnoControls/source/inc/progressbar.hxx
index 1f735286377b..f327b453b19b 100644
--- a/UnoControls/source/inc/progressbar.hxx
+++ b/UnoControls/source/inc/progressbar.hxx
@@ -30,14 +30,14 @@ namespace unocontrols {
#define PROGRESSBAR_FREESPACE 4
#define PROGRESSBAR_DEFAULT_HORIZONTAL true
#define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1)
-#define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR sal_Int32(Color( 0x00, 0xC0, 0xC0, 0xC0 )) // lightgray
-#define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR sal_Int32(Color( 0x00, 0x00, 0x00, 0x80 )) // blue
+#define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR sal_Int32(Color( 0xC0, 0xC0, 0xC0 )) // lightgray
+#define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR sal_Int32(Color( 0x00, 0x00, 0x80 )) // blue
#define PROGRESSBAR_DEFAULT_MINRANGE INT_MIN
#define PROGRESSBAR_DEFAULT_MAXRANGE INT_MAX
#define PROGRESSBAR_DEFAULT_BLOCKVALUE 1
#define PROGRESSBAR_DEFAULT_VALUE PROGRESSBAR_DEFAULT_MINRANGE
-#define PROGRESSBAR_LINECOLOR_BRIGHT sal_Int32(Color( 0x00, 0xFF, 0xFF, 0xFF )) // white
-#define PROGRESSBAR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00, 0x00 )) // black
+#define PROGRESSBAR_LINECOLOR_BRIGHT sal_Int32(Color( 0xFF, 0xFF, 0xFF )) // white
+#define PROGRESSBAR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00 )) // black
class ProgressBar final : public css::awt::XControlModel
, public css::awt::XProgressBar
diff --git a/UnoControls/source/inc/progressmonitor.hxx b/UnoControls/source/inc/progressmonitor.hxx
index 7be8056396f3..3fe17c578751 100644
--- a/UnoControls/source/inc/progressmonitor.hxx
+++ b/UnoControls/source/inc/progressmonitor.hxx
@@ -39,8 +39,8 @@ class ProgressBar;
#define PROGRESSMONITOR_FREEBORDER 10 // border around and between the controls
#define PROGRESSMONITOR_DEFAULT_TOPIC ""
#define PROGRESSMONITOR_DEFAULT_TEXT ""
-#define PROGRESSMONITOR_LINECOLOR_BRIGHT sal_Int32(Color( 0x00, 0xFF, 0xFF, 0xFF )) // white
-#define PROGRESSMONITOR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00, 0x00 )) // black
+#define PROGRESSMONITOR_LINECOLOR_BRIGHT sal_Int32(Color( 0xFF, 0xFF, 0xFF )) // white
+#define PROGRESSMONITOR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00 )) // black
#define PROGRESSMONITOR_DEFAULT_WIDTH 350
#define PROGRESSMONITOR_DEFAULT_HEIGHT 100
diff --git a/UnoControls/source/inc/statusindicator.hxx b/UnoControls/source/inc/statusindicator.hxx
index f47a52cbd814..14ac4e03b8d9 100644
--- a/UnoControls/source/inc/statusindicator.hxx
+++ b/UnoControls/source/inc/statusindicator.hxx
@@ -36,9 +36,9 @@ namespace unocontrols {
class ProgressBar;
#define STATUSINDICATOR_FREEBORDER 5 // border around and between the controls
-#define STATUSINDICATOR_BACKGROUNDCOLOR sal_Int32(Color( 0x00, 0xC0, 0xC0, 0xC0 )) // lightgray
-#define STATUSINDICATOR_LINECOLOR_BRIGHT sal_Int32(Color( 0x00, 0xFF, 0xFF, 0xFF )) // white
-#define STATUSINDICATOR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00, 0x00 )) // black
+#define STATUSINDICATOR_BACKGROUNDCOLOR sal_Int32(Color( 0xC0, 0xC0, 0xC0 )) // lightgray
+#define STATUSINDICATOR_LINECOLOR_BRIGHT sal_Int32(Color( 0xFF, 0xFF, 0xFF )) // white
+#define STATUSINDICATOR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00 )) // black
#define STATUSINDICATOR_DEFAULT_WIDTH 300
#define STATUSINDICATOR_DEFAULT_HEIGHT 25
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 2f29fd09b225..a5df0dcc03e4 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -646,11 +646,11 @@ void DataBrowser::RenewTable()
{
auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, m_pColorsWin );
Reference< beans::XPropertySet > xSeriesProp( elemHeader.m_xDataSeries, uno::UNO_QUERY );
- sal_Int32 nColor = 0;
+ Color nColor;
// @todo: Set "DraftColor", i.e. interpolated colors for gradients, bitmaps, etc.
if( xSeriesProp.is() &&
( xSeriesProp->getPropertyValue( "Color" ) >>= nColor ))
- spHeader->SetColor( Color( nColor ));
+ spHeader->SetColor( nColor );
spHeader->SetChartType( elemHeader.m_xChartType, elemHeader.m_bSwapXAndYAxis );
spHeader->SetSeriesName(
DataSeriesHelper::getDataSeriesLabel(
@@ -1278,10 +1278,10 @@ void DataBrowser::RenewSeriesHeaders()
{
auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, m_pColorsWin );
Reference< beans::XPropertySet > xSeriesProp(elemHeader.m_xDataSeries, uno::UNO_QUERY);
- sal_Int32 nColor = 0;
+ Color nColor;
if( xSeriesProp.is() &&
( xSeriesProp->getPropertyValue( "Color" ) >>= nColor ))
- spHeader->SetColor( Color( nColor ));
+ spHeader->SetColor( nColor );
spHeader->SetChartType( elemHeader.m_xChartType, elemHeader.m_bSwapXAndYAxis );
spHeader->SetSeriesName(
DataSeriesHelper::getDataSeriesLabel(
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 07ce43a171b0..16fd2d2c9f56 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -153,7 +153,7 @@ namespace
Color lcl_getAmbientColor(
const uno::Reference< beans::XPropertySet > & xSceneProperties )
{
- sal_Int32 nResult = 0x000000;
+ Color nResult;
try
{
xSceneProperties->getPropertyValue("D3DSceneAmbientColor") >>= nResult;
@@ -162,7 +162,7 @@ namespace
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
- return Color( nResult );
+ return nResult;
}
void lcl_setAmbientColor(
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 7693c6ccfa37..2c27b6ae7dc1 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -216,7 +216,7 @@ DataPointItemConverter::DataPointItemConverter(
m_bDataSeries( bDataSeries ),
m_bOverwriteLabelsForAttributedDataPointsAlso(m_bDataSeries && bOverwriteLabelsForAttributedDataPointsAlso),
m_bUseSpecialFillColor(bUseSpecialFillColor),
- m_nSpecialFillColor(nSpecialFillColor),
+ m_nSpecialFillColor(ColorTransparency, nSpecialFillColor),
m_nNumberFormat(nNumberFormat),
m_nPercentNumberFormat(nPercentNumberFormat),
m_aAvailableLabelPlacements(),
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index a5feac9eb7a6..55b4bed88ab6 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -1004,7 +1004,7 @@ void ChartController::executeDispatch_LineColor(sal_uInt32 nColor)
}
if( xPropSet.is() )
- xPropSet->setPropertyValue( "LineColor", css::uno::makeAny( Color(nColor) ) );
+ xPropSet->setPropertyValue( "LineColor", css::uno::makeAny( Color(ColorTransparency, nColor) ) );
}
}
catch( const uno::Exception& )
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index e1fdc3299e59..55a756c6edf3 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -504,7 +504,7 @@ void ChartAreaPanel::updateData()
{
sal_uInt32 nFillColor = 0;
xPropSet->getPropertyValue("FillColor") >>= nFillColor;
- XFillColorItem aFillColorItem("", Color(nFillColor));
+ XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor));
updateFillColor(true, &aFillColorItem);
}
}
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index bb628a9419e3..d3c4dcd857e8 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -1125,13 +1125,13 @@ double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropN
if(rPropName.endsWith("Color"))
{
//optimized interpolation for color values
- Color aColor(static_cast<sal_uInt32>(fValue));
- Color aOldColor(static_cast<sal_uInt32>(fOldValue));
+ Color aColor(ColorTransparency, static_cast<sal_uInt32>(fValue));
+ Color aOldColor(ColorTransparency, static_cast<sal_uInt32>(fOldValue));
sal_uInt8 r = aOldColor.GetRed() + (aColor.GetRed() - aOldColor.GetRed()) * mnPercent;
sal_uInt8 g = aOldColor.GetGreen() + (aColor.GetGreen() - aOldColor.GetGreen()) * mnPercent;
sal_uInt8 b = aOldColor.GetBlue() + (aColor.GetBlue() - aOldColor.GetBlue()) * mnPercent;
- sal_uInt8 t = 255 - (aOldColor.GetAlpha() + (aColor.GetAlpha() - aOldColor.GetAlpha()) * mnPercent);
- Color aRet(t, r, g, b);
+ sal_uInt8 a = aOldColor.GetAlpha() + (aColor.GetAlpha() - aOldColor.GetAlpha()) * mnPercent;
+ Color aRet(ColorAlpha, a, r, g, b);
return sal_uInt32(aRet);
}
return fOldValue + (fValue - fOldValue) * mnPercent;
diff --git a/compilerplugins/clang/colorcheck.cxx b/compilerplugins/clang/colorcheck.cxx
new file mode 100644
index 000000000000..83f9a9688381
--- /dev/null
+++ b/compilerplugins/clang/colorcheck.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef LO_CLANG_SHARED_PLUGINS
+
+#include <memory>
+#include <cassert>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <set>
+
+#include "check.hxx"
+#include "plugin.hxx"
+
+/**
+*/
+
+namespace
+{
+class ColorCheck : public loplugin::FilteringPlugin<ColorCheck>
+{
+public:
+ explicit ColorCheck(loplugin::InstantiationData const& data)
+ : FilteringPlugin(data)
+ {
+ }
+
+ virtual void run() override
+ {
+ if (preRun())
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+
+ bool VisitCXXConstructExpr(const CXXConstructExpr*);
+};
+
+bool ColorCheck::VisitCXXConstructExpr(const CXXConstructExpr* constructExpr)
+{
+ if (ignoreLocation(constructExpr))
+ return true;
+
+ if (constructExpr->getNumArgs() != 1)
+ return true;
+
+ auto tc = loplugin::TypeCheck(constructExpr->getType());
+ if (!tc.Class("Color").GlobalNamespace())
+ return true;
+
+ StringRef aFileName = getFilenameOfLocation(
+ compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(constructExpr)));
+ if (loplugin::isSamePathname(aFileName, SRCDIR "/include/tools/color.hxx"))
+ return true;
+
+ const CXXConstructorDecl* constructorDecl = constructExpr->getConstructor();
+ constructorDecl = constructorDecl->getCanonicalDecl();
+
+ if (!loplugin::TypeCheck(constructorDecl->getParamDecl(0)->getType())
+ .Typedef("sal_uInt32")
+ .GlobalNamespace())
+ return true;
+
+ auto arg0 = constructExpr->getArg(0);
+ if (arg0->isCXX11ConstantExpr(compiler.getASTContext()))
+ {
+ if (!arg0->isValueDependent())
+ {
+ llvm::Optional<llvm::APSInt> xVal
+ = compat::getIntegerConstantExpr(arg0, compiler.getASTContext());
+ if (xVal && *xVal > 0xffffff)
+ report(DiagnosticsEngine::Warning,
+ "Rather use the ColorTransparency or ColorAlpha version of this constructor",
+ arg0->getExprLoc());
+ return true;
+ }
+ }
+ report(DiagnosticsEngine::Warning,
+ "Rather use the ColorTransparency or ColorAlpha version of this constructor",
+ arg0->getExprLoc());
+
+ return true;
+}
+
+loplugin::Plugin::Registration<ColorCheck> colorcheck("colorcheck");
+
+} // namespace
+
+#endif // LO_CLANG_SHARED_PLUGINS
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx
index 660241519110..525761c3c86c 100644
--- a/cui/source/options/cfgchart.cxx
+++ b/cui/source/options/cfgchart.cxx
@@ -217,7 +217,7 @@ bool SvxChartOptions::RetrieveOptions()
// set color values
for( sal_Int32 i=0; i < nCount; i++ )
{
- aCol = Color(aColorSeq[ i ]);
+ aCol = Color(ColorTransparency, aColorSeq[ i ]);
aName = aPrefix + OUString::number(i + 1) + aPostfix;
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 1956d0c8f86a..e6eadad2075b 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -286,7 +286,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, SpinValueHdl_Impl, weld::SpinButton&, void)
IMPL_LINK_NOARG(SvxColorTabPage, MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void)
{
// read current MtrFields, if cmyk, then k-value as transparency
- aCurrentColor = Color(static_cast<sal_uInt8>(PercentToColor_Impl(m_xKcustom->get_value(FieldUnit::NONE))),
+ aCurrentColor = Color(ColorTransparency, static_cast<sal_uInt8>(PercentToColor_Impl(m_xKcustom->get_value(FieldUnit::NONE))),
static_cast<sal_uInt8>(PercentToColor_Impl(m_xCcustom->get_value(FieldUnit::NONE))),
static_cast<sal_uInt8>(PercentToColor_Impl(m_xYcustom->get_value(FieldUnit::NONE))),
static_cast<sal_uInt8>(PercentToColor_Impl(m_xMcustom->get_value(FieldUnit::NONE))));
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 5b1be584b18f..174a2d4e4ea7 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -330,10 +330,9 @@ bool ORTFImportExport::Write()
bool bUnderline = ( css::awt::FontUnderline::NONE != m_aFont.Underline );
bool bStrikeout = ( css::awt::FontStrikeout::NONE != m_aFont.Strikeout );
- sal_Int32 nColor = 0;
+ ::Color aColor;
if(m_xObject.is())
- m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
- ::Color aColor(nColor);
+ m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
OString aFonts(OUStringToOString(m_aFont.Name, RTL_TEXTENCODING_MS_1252));
if (aFonts.isEmpty())
@@ -661,10 +660,9 @@ void OHTMLImportExport::WriteBody()
// default Textcolour black
m_pStream->WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_text ).WriteChar( '=' );
- sal_Int32 nColor = 0;
+ ::Color aColor;
if(m_xObject.is())
- m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
- ::Color aColor(nColor);
+ m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
m_pStream->WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=" );
@@ -931,10 +929,9 @@ void OHTMLImportExport::FontOn()
"=";
m_pStream->WriteOString( aStrOut );
- sal_Int32 nColor = 0;
+ ::Color aColor;
if(m_xObject.is())
- m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
- ::Color aColor(nColor);
+ m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
m_pStream->WriteCharPtr( ">" );
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index a354b2960942..250765832cec 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -35,7 +35,7 @@
#include <vcl/virdev.hxx>
#define NOT_LOADED (tools::Long(-1))
-#define NOT_LOADED_COLOR (Color(0xffffffff))
+#define NOT_LOADED_COLOR (Color(ColorTransparency, 0xffffffff))
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::task;
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index b96cca222e7f..21bf591aecc0 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -82,14 +82,14 @@ namespace
if(nAlpha)
{
- aContent.SetPixel(y, x, Color(
- 255 - static_cast<sal_uInt8>(nAlpha),
+ aContent.SetPixel(y, x, Color(ColorAlpha,
+ static_cast<sal_uInt8>(nAlpha),
static_cast<sal_uInt8>(nRed / nDivisor),
static_cast<sal_uInt8>(nGreen / nDivisor),
static_cast<sal_uInt8>(nBlue / nDivisor) ));
}
else
- aContent.SetPixel(y, x, Color(255, 0, 0, 0));
+ aContent.SetPixel(y, x, Color(ColorAlpha, 0, 0, 0, 0));
}
}
}
@@ -105,10 +105,10 @@ namespace
if(rPixel.getAlpha())
{
- aContent.SetPixel(y, x, Color(255 - rPixel.getAlpha(), rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue()));
+ aContent.SetPixel(y, x, Color(ColorAlpha, rPixel.getAlpha(), rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue()));
}
else
- aContent.SetPixel(y, x, Color(255, 0, 0, 0));
+ aContent.SetPixel(y, x, Color(ColorAlpha, 0, 0, 0, 0));
}
}
}
diff --git a/drawinglayer/source/tools/emfpbrush.cxx b/drawinglayer/source/tools/emfpbrush.cxx
index ca0c27b23ecf..24c3f281812b 100644
--- a/drawinglayer/source/tools/emfpbrush.cxx
+++ b/drawinglayer/source/tools/emfpbrush.cxx
@@ -77,7 +77,7 @@ namespace emfplushelper
sal_uInt32 color;
s.ReadUInt32(color);
- solidColor = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ solidColor = ::Color(ColorAlpha, (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tSolid color: 0x" << std::hex << color << std::dec);
break;
}
@@ -91,8 +91,8 @@ namespace emfplushelper
s.ReadUInt32(backgroundColor);
hatchStyle = static_cast<EmfPlusHatchStyle>(style);
- solidColor = ::Color(0xff - (foregroundColor >> 24), (foregroundColor >> 16) & 0xff, (foregroundColor >> 8) & 0xff, foregroundColor & 0xff);
- secondColor = ::Color(0xff - (backgroundColor >> 24), (backgroundColor >> 16) & 0xff, (backgroundColor >> 8) & 0xff, backgroundColor & 0xff);
+ solidColor = ::Color(ColorAlpha, (foregroundColor >> 24), (foregroundColor >> 16) & 0xff, (foregroundColor >> 8) & 0xff, foregroundColor & 0xff);
+ secondColor = ::Color(ColorAlpha, (backgroundColor >> 24), (backgroundColor >> 16) & 0xff, (backgroundColor >> 8) & 0xff, backgroundColor & 0xff);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tHatch style: 0x" << std::hex << style);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tForeground color: 0x" << solidColor.AsRGBHexString());
SAL_INFO("drawinglayer", "EMF+\t\t\t\tBackground color: 0x" << secondColor.AsRGBHexString());
@@ -109,7 +109,7 @@ namespace emfplushelper
SAL_INFO("drawinglayer", "EMF+\t\t\t\tAdditional flags: 0x" << std::hex << additionalFlags << std::dec);
sal_uInt32 color;
s.ReadUInt32(color);
- solidColor = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ solidColor = ::Color(ColorAlpha, (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tCenter color: 0x" << std::hex << color << std::dec);
s.ReadFloat(firstPointX).ReadFloat(firstPointY);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tCenter point: " << firstPointX << "," << firstPointY);
@@ -126,7 +126,7 @@ namespace emfplushelper
for (int i = 0; i < surroundColorsNumber; i++)
{
s.ReadUInt32(color);
- surroundColors[i] = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ surroundColors[i] = ::Color(ColorAlpha, (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
if (i == 0)
secondColor = surroundColors[0];
SAL_INFO("drawinglayer", "EMF+\t\t\t\tSurround color[" << i << "]: 0x" << std::hex << color << std::dec);
@@ -236,7 +236,7 @@ namespace emfplushelper
for (int i = 0; i < colorblendPoints; i++)
{
s.ReadUInt32(color);
- colorblendColors[i] = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ colorblendColors[i] = ::Color(ColorAlpha, (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tColor[" << i << "]: 0x" << std::hex << color << std::dec);
}
}
@@ -252,10 +252,10 @@ namespace emfplushelper
<< ", size " << aWidth << "x" << aHeight);
sal_uInt32 color;
s.ReadUInt32(color);
- solidColor = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ solidColor = ::Color(ColorAlpha, (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tfirst color: 0x" << std::hex << color << std::dec);
s.ReadUInt32(color);
- secondColor = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ secondColor = ::Color(ColorAlpha, (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tsecond color: 0x" << std::hex << color << std::dec);
// repeated colors, unknown meaning, see http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/ObjectBrush.html
@@ -318,7 +318,7 @@ namespace emfplushelper
for (int i = 0; i < colorblendPoints; i++)
{
s.ReadUInt32(color);
- colorblendColors[i] = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ colorblendColors[i] = ::Color(ColorAlpha, (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
SAL_INFO("drawinglayer", "EMF+\t\t\t\tColor[" << i << "]: 0x" << std::hex << color << std::dec);
}
}
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index fb34dac496e2..d55babc0e960 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -454,7 +454,7 @@ namespace emfplushelper
Color color;
if (flags & 0x8000) // we use a color
{
- color = Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff,
+ color = Color(ColorAlpha, (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff,
(brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff);
}
else // we use a pen
@@ -724,7 +724,7 @@ namespace emfplushelper
// EMF Alpha (1 byte): An 8-bit unsigned integer that specifies the transparency of the background,
// ranging from 0 for completely transparent to 0xFF for completely opaque.
- const Color color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff);
+ const Color color(ColorAlpha, (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff);
EMFPPlusFillPolygonSolidColor(polygon, color);
mrPropertyHolders.Current().setFillColor(color.getBColor());
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 6900e8cf8e1d..ac4bbe1ada4d 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -1471,7 +1471,7 @@ namespace accessibility
if (rRes.Name == "CharColor")
{
uno::Any &anyChar = rRes.Value;
- Color crChar = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
+ Color crChar(ColorTransparency, static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved)));
if (COL_AUTO == crChar )
{
uno::Reference< css::accessibility::XAccessibleComponent > xComponent(mxParent,uno::UNO_QUERY);
@@ -1485,7 +1485,7 @@ namespace accessibility
}
else
{
- Color cr(xComponent->getBackground());
+ Color cr(ColorTransparency, xComponent->getBackground());
crChar = cr.IsDark() ? COL_WHITE : COL_BLACK;
anyChar <<= crChar;
}
@@ -1502,7 +1502,7 @@ namespace accessibility
if (rRes.Name == "CharUnderlineColor")
{
uno::Any &anyCharUnderLine = rRes.Value;
- Color crCharUnderLine = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>( anyCharUnderLine.pReserved));
+ Color crCharUnderLine(ColorTransparency, static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>( anyCharUnderLine.pReserved)));
if (COL_AUTO == crCharUnderLine )
{
uno::Reference< css::accessibility::XAccessibleComponent > xComponent(mxParent,uno::UNO_QUERY);
@@ -1516,7 +1516,7 @@ namespace accessibility
}
else
{
- Color cr(xComponent->getBackground());
+ Color cr(ColorTransparency, xComponent->getBackground());
crCharUnderLine = cr.IsDark() ? COL_WHITE : COL_BLACK;
anyCharUnderLine <<= crCharUnderLine;
}
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 589bde044152..184bf21cd994 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -1084,7 +1084,7 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
sal_Int32 nTransparence = 0;
if ((rVal >>= nTransparence) && !o3tl::checked_multiply<sal_Int32>(nTransparence, 255, nTransparence))
{
- Color aColor(aShadow.Color);
+ Color aColor(ColorTransparency, aShadow.Color);
aColor.SetAlpha(255 - rtl::math::round(float(nTransparence) / 100));
aShadow.Color = sal_Int32(aColor);
}
@@ -1106,7 +1106,7 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
nWidth = bConvert ? convertMm100ToTwip(aShadow.ShadowWidth) : aShadow.ShadowWidth;
- Color aSet(aShadow.Color);
+ Color aSet(ColorTransparency, aShadow.Color);
aShadowColor = aSet;
}
@@ -1439,7 +1439,7 @@ namespace
bool
lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, bool bConvert, bool bGuessWidth)
{
- rSvxLine.SetColor( Color(rLine.Color));
+ rSvxLine.SetColor( Color(ColorTransparency, rLine.Color));
if ( bGuessWidth )
{
rSvxLine.GuessLinesWidths( rSvxLine.GetBorderLineStyle(),
@@ -2735,7 +2735,7 @@ bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId )
switch ( nMemId )
{
- case MID_FG_COLOR: pLine->SetColor( Color(nVal) ); break;
+ case MID_FG_COLOR: pLine->SetColor( Color(ColorTransparency, nVal) ); break;
case MID_LINE_STYLE:
pLine->SetBorderLineStyle(static_cast<SvxBorderLineStyle>(nVal));
break;
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index e83d08b35504..e63b9c786e1d 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -990,7 +990,7 @@ bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
break;
case MID_TL_COLOR:
{
- sal_Int32 nCol = 0;
+ Color nCol;
if( !( rVal >>= nCol ) )
bRet = false;
else
@@ -998,7 +998,7 @@ bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
// Keep transparence, because it contains the information
// whether the font color or the stored color should be used
sal_uInt8 nAlpha = mColor.GetAlpha();
- mColor = Color( nCol );
+ mColor = nCol;
mColor.SetAlpha( nAlpha );
}
}
@@ -1354,7 +1354,7 @@ bool SvxBackgroundColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) c
bool SvxBackgroundColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
nMemberId &= ~CONVERT_TWIPS;
- sal_Int32 nColor = 0;
+ Color nColor;
Color aColor = SvxColorItem::GetValue();
switch( nMemberId )
@@ -1369,7 +1369,7 @@ bool SvxBackgroundColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId
{
if(!(rVal >>= nColor))
return false;
- SvxColorItem::SetValue( Color(nColor) );
+ SvxColorItem::SetValue( nColor );
break;
}
}
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 761fa305e3f4..4e81037a36ae 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -427,10 +427,10 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence<beans::Propert
}
else if ( rPropName == UNO_NAME_NRULE_BULLET_COLOR )
{
- sal_Int32 nColor = 0;
- if( aVal >>= nColor )
+ Color aColor;
+ if( aVal >>= aColor )
{
- aFmt.SetBulletColor( static_cast<Color>(nColor) );
+ aFmt.SetBulletColor( aColor );
continue;
}
}
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index e1e80ec8bb04..b05beeb2a9dc 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -875,7 +875,7 @@ namespace emfio
mnTextAlign(TA_LEFT | TA_TOP | TA_NOUPDATECP),
maLatestTextColor(),
maTextColor(),
- maLatestBkColor(0x12345678),
+ maLatestBkColor(ColorTransparency, 0x12345678),
maBkColor(COL_WHITE),
mnLatestTextLayoutMode(ComplexTextLayoutFlags::Default),
mnTextLayoutMode(ComplexTextLayoutFlags::Default),
diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx
index 995f0b94f25f..af276592fc41 100644
--- a/extensions/source/propctrlr/fontdialog.cxx
+++ b/extensions/source/propctrlr/fontdialog.cxx
@@ -233,9 +233,9 @@ namespace pcr
SvxWordLineModeItem aWordLineModeItem(bWordLineMode, CFID_WORDLINEMODE);
SvxUnderlineItem aUnderlineItem(eUnderline,CFID_UNDERLINE);
- aUnderlineItem.SetColor(Color(nTextLineColor));
+ aUnderlineItem.SetColor(Color(ColorTransparency, nTextLineColor));
- SvxColorItem aSvxColorItem(Color(nColor32),CFID_CHARCOLOR);
+ SvxColorItem aSvxColorItem(Color(ColorTransparency, nColor32),CFID_CHARCOLOR);
SvxLanguageItem aLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), CFID_LANGUAGE);
// the 2 CJK props
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index c5b03aa270e5..c20f6287fe8d 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -478,7 +478,7 @@ namespace pcr
css::util::Color nColor = sal_uInt32(COL_TRANSPARENT);
if (_rValue.hasValue())
_rValue >>= nColor;
- getTypedControlWindow()->SelectEntry(nColor);
+ getTypedControlWindow()->SelectEntry(::Color(ColorTransparency, nColor));
}
Any SAL_CALL OColorControl::getValue()
diff --git a/filter/qa/cppunit/msfilter-test.cxx b/filter/qa/cppunit/msfilter-test.cxx
index ce7b4b7c4cbd..439aad88b674 100644
--- a/filter/qa/cppunit/msfilter-test.cxx
+++ b/filter/qa/cppunit/msfilter-test.cxx
@@ -56,7 +56,7 @@ void MSFilterTest::testTransColToIco()
{
const OString sMessage = "Index of unmatched color: " + OString::number(i);
CPPUNIT_ASSERT_EQUAL_MESSAGE(sMessage.getStr(), aExpected[i],
- static_cast<sal_uInt16>(msfilter::util::TransColToIco( Color(aStdCol[i]) )));
+ static_cast<sal_uInt16>(msfilter::util::TransColToIco( Color(ColorTransparency, aStdCol[i]) )));
}
// tdf#92471
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index e5753510bbd9..b70407027b7d 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -738,7 +738,7 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
if (!bIsValid)
break;
if ( nBitDepth == 1 )
- aBitmap.SetPixel( y, x, Color(static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1) );
+ aBitmap.SetPixel( y, x, Color(ColorTransparency, static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1) );
else
{
aBitmap.SetPixel( y, x, nDat ? COL_WHITE : COL_BLACK ); // nBitDepth == 8
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
index bbaee08117eb..023351c33b4e 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -638,7 +638,7 @@ bool TGAReader::ImplReadBody()
return false;
if ( nDummy >= mpFileHeader->nColorMapLength )
return false;
- mpBitmap->SetPixel( nY, nX, Color(nDummy) );
+ mpBitmap->SetPixel( nY, nX, Color(ColorTransparency, nDummy) );
}
break;
default:
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 5df267f3f954..31d382796f43 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -376,12 +376,12 @@ sal_uInt32 EscherPropertyContainer::GetGradientColor(
if ( nStartColor & 1 )
{
nIntensity = pGradient->StartIntensity;
- aColor = Color(pGradient->StartColor);
+ aColor = Color(ColorTransparency, pGradient->StartColor);
}
else
{
nIntensity = pGradient->EndIntensity;
- aColor = Color(pGradient->EndColor);
+ aColor = Color(ColorTransparency, pGradient->EndColor);
}
}
sal_uInt32 nRed = ( aColor.GetRed() * nIntensity ) / 100;
@@ -1452,7 +1452,7 @@ Graphic lclDrawHatch( const drawing::Hatch& rHatch, const Color& rBackColor, boo
pVDev->SetLineColor();
pVDev->SetFillColor(bFillBackground ? rBackColor : COL_TRANSPARENT);
pVDev->DrawRect(rRect);
- pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch(static_cast<HatchStyle>(rHatch.Style), Color(rHatch.Color), rHatch.Distance,
+ pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch(static_cast<HatchStyle>(rHatch.Style), Color(ColorTransparency, rHatch.Color), rHatch.Distance,
Degree10(rHatch.Angle)));
aMtf.Stop();
aMtf.WindStart();
@@ -1547,7 +1547,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
Color aBackColor;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "FillColor" ) )
{
- aBackColor = Color(ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny), false ));
+ aBackColor = Color(ColorTransparency, ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny), false ));
}
bool bFillBackground = false;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "FillBackground", true ) )
diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx
index 10b210b7b1bf..0677420f0bea 100644
--- a/forms/source/component/Grid.cxx
+++ b/forms/source/component/Grid.cxx
@@ -953,7 +953,7 @@ void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream)
if (nAnyMask & TEXTCOLOR)
{
sal_Int32 nValue = _rxInStream->readLong();
- setTextColor( ::Color(nValue) );
+ setTextColor( ::Color(ColorTransparency, nValue) );
}
// new since version 6
if (nVersion > 5)
diff --git a/forms/source/component/navigationbar.cxx b/forms/source/component/navigationbar.cxx
index 3d602d2abfa0..368ab62d3fa9 100644
--- a/forms/source/component/navigationbar.cxx
+++ b/forms/source/component/navigationbar.cxx
@@ -280,12 +280,12 @@ namespace frm
m_aBackgroundColor.clear();
if ( nNonVoids & PERSIST_TEXTCOLOR )
- setTextColor( ::Color(_rxInStream->readLong()) );
+ setTextColor( ::Color(ColorTransparency, _rxInStream->readLong()) );
else
clearTextColor();
if ( nNonVoids & PERSIST_TEXTLINECOLOR )
- setTextLineColor( ::Color(_rxInStream->readLong()) );
+ setTextLineColor( ::Color(ColorTransparency, _rxInStream->readLong()) );
else
clearTextLineColor();
}
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index da28c88b9e4b..63718ca0ebed 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -78,7 +78,7 @@ const sal_uInt8 WINDOWS_CHARSET_EASTERN = 238;
const sal_uInt8 WINDOWS_CHARSET_OEM = 255;
-const ::Color API_RGB_TRANSPARENT (0xffffffff); ///< Transparent color for API calls.
+const ::Color API_RGB_TRANSPARENT (ColorTransparency, 0xffffffff); ///< Transparent color for API calls.
const sal_uInt32 UNSIGNED_RGB_TRANSPARENT = static_cast<sal_uInt32>(-1); ///< Transparent color for unsigned int32 places.
const ::Color API_RGB_BLACK (0x000000); ///< Black color for API calls.
const ::Color API_RGB_GRAY (0x808080); ///< Gray color for API calls.
diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
index 0d3d68ba301c..88cea1c33ab7 100644
--- a/include/sax/tools/converter.hxx
+++ b/include/sax/tools/converter.hxx
@@ -123,7 +123,15 @@ public:
{
sal_Int32 n(rColor);
bool b = convertColor( n, rValue );
- if (b) rColor = n;
+ if (b) rColor = Color(ColorTransparency, n);
+ return b;
+ }
+ static bool convertColor( ::Color& rColor,
+ std::string_view rValue )
+ {
+ sal_Int32 n(rColor);
+ bool b = convertColor( n, rValue );
+ if (b) rColor = Color(ColorTransparency, n);
return b;
}
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 3b347ede0690..8b4a035a1857 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -30,7 +30,7 @@ public:
void add(sal_uInt32 nIndex, sal_uInt32 aColorData)
{
- maColors[nIndex] = Color(aColorData);
+ maColors[nIndex] = Color(ColorTransparency, aColorData);
}
const OUString& getName() const
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
index 05917b2dfcfc..136d7621c0e7 100644
--- a/include/svx/colorwindow.hxx
+++ b/include/svx/colorwindow.hxx
@@ -44,7 +44,7 @@ public:
class Button;
-#define COL_NONE_COLOR ::Color(0x80, 0xFF, 0xFF, 0xFF)
+#define COL_NONE_COLOR ::Color(ColorTransparency, 0x80, 0xFF, 0xFF, 0xFF)
class SvxColorToolBoxControl;
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index aca6b0ed79b7..3226184ca117 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -40,6 +40,10 @@ constexpr sal_uInt8 ColorChannelMerge(sal_uInt8 nDst, sal_uInt8 nSrc, sal_uInt8
}
+/** used to deliberately select the right constructor */
+enum ColorTransparencyTag { ColorTransparency = 0 };
+enum ColorAlphaTag { ColorAlpha = 0 };
+
// Color
class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Color
@@ -70,21 +74,37 @@ public:
: mValue(0) // black
{}
- constexpr Color(sal_uInt32 nColor)
+ constexpr Color(const sal_uInt32 nColor)
: mValue(nColor)
- {}
+ {
+ assert(nColor <= 0xffffff && "don't pass transparency to this constructor, use the Color(ColorTransparencyTag,...) or Color(ColorAlphaTag,...) constructor to make it explicit");
+ }
- constexpr Color(sal_uInt8 nTransparency, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ constexpr Color(enum ColorTransparencyTag, sal_uInt32 nColor)
+ : mValue(nColor)
+ {
+ }
+
+ constexpr Color(enum ColorAlphaTag, sal_uInt32 nColor)
+ : mValue((nColor & 0xffffff) | (255 - (nColor >> 24)))
+ {
+ }
+
+ constexpr Color(enum ColorTransparencyTag, sal_uInt8 nTransparency, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
: mValue(sal_uInt32(nBlue) | (sal_uInt32(nGreen) << 8) | (sal_uInt32(nRed) << 16) | (sal_uInt32(nTransparency) << 24))
{}
+ constexpr Color(enum ColorAlphaTag, sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ : Color(ColorTransparency, 255 - nAlpha, nRed, nGreen, nBlue)
+ {}
+
constexpr Color(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
- : Color(0, nRed, nGreen, nBlue)
+ : Color(ColorTransparency, 0, nRed, nGreen, nBlue)
{}
// constructor to create a tools-Color from ::basegfx::BColor
explicit Color(const basegfx::BColor& rBColor)
- : Color(0,
+ : Color(ColorTransparency, 0,
sal_uInt8(std::lround(rBColor.getRed() * 255.0)),
sal_uInt8(std::lround(rBColor.getGreen() * 255.0)),
sal_uInt8(std::lround(rBColor.getBlue() * 255.0)))
@@ -394,7 +414,7 @@ inline bool operator >>=( const css::uno::Any & rAny, Color & value )
sal_Int32 nTmp = {}; // spurious -Werror=maybe-uninitialized
if (!(rAny >>= nTmp))
return false;
- value = Color(nTmp);
+ value = Color(ColorTransparency, nTmp);
return true;
}
@@ -413,7 +433,7 @@ namespace com::sun::star::uno {
// Test compile time conversion of Color to sal_uInt32
-static_assert (sal_uInt32(Color(0x00, 0x12, 0x34, 0x56)) == 0x00123456);
+static_assert (sal_uInt32(Color(ColorTransparency, 0x00, 0x12, 0x34, 0x56)) == 0x00123456);
static_assert (sal_uInt32(Color(0x12, 0x34, 0x56)) == 0x00123456);
// Color types
@@ -437,8 +457,8 @@ constexpr ::Color COL_LIGHTMAGENTA ( 0xFF, 0x00, 0xFF );
constexpr ::Color COL_LIGHTGRAYBLUE ( 0xE0, 0xE0, 0xFF );
constexpr ::Color COL_YELLOW ( 0xFF, 0xFF, 0x00 );
constexpr ::Color COL_WHITE ( 0xFF, 0xFF, 0xFF );
-constexpr ::Color COL_TRANSPARENT ( 0xFF, 0xFF, 0xFF, 0xFF );
-constexpr ::Color COL_AUTO ( 0xFF, 0xFF, 0xFF, 0xFF );
+constexpr ::Color COL_TRANSPARENT ( ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF );
+constexpr ::Color COL_AUTO ( ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF );
constexpr ::Color COL_AUTHOR1_DARK ( 198, 146, 0 );
constexpr ::Color COL_AUTHOR1_NORMAL ( 255, 255, 158 );
constexpr ::Color COL_AUTHOR1_LIGHT ( 255, 255, 195 );
diff --git a/include/vcl/BitmapColor.hxx b/include/vcl/BitmapColor.hxx
index 634ae6902d27..b5364b4d146f 100644
--- a/include/vcl/BitmapColor.hxx
+++ b/include/vcl/BitmapColor.hxx
@@ -27,7 +27,9 @@ class VCL_DLLPUBLIC BitmapColor final : public Color
{
public:
inline BitmapColor();
- constexpr BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha = 0 );
+ constexpr BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue );
+ constexpr BitmapColor( ColorTransparencyTag, sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cTransparency );
+ constexpr BitmapColor( ColorAlphaTag, sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha );
inline BitmapColor( const Color& rColor );
explicit inline BitmapColor( sal_uInt8 cIndex );
@@ -45,8 +47,18 @@ inline BitmapColor::BitmapColor( const Color& rColor )
{
}
-constexpr BitmapColor::BitmapColor(sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha)
- : Color(cAlpha, cRed, cGreen, cBlue)
+constexpr BitmapColor::BitmapColor(sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue)
+ : Color(cRed, cGreen, cBlue)
+{
+}
+
+constexpr BitmapColor::BitmapColor(ColorTransparencyTag, sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cTransparency)
+ : Color(ColorTransparency, cTransparency, cRed, cGreen, cBlue)
+{
+}
+
+constexpr BitmapColor::BitmapColor(ColorAlphaTag, sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha)
+ : Color(ColorAlpha, cAlpha, cRed, cGreen, cBlue)
{
}
diff --git a/include/vcl/RawBitmap.hxx b/include/vcl/RawBitmap.hxx
index 79cef7c47e00..d3dcb642cf6c 100644
--- a/include/vcl/RawBitmap.hxx
+++ b/include/vcl/RawBitmap.hxx
@@ -55,7 +55,7 @@ public:
if (mnBitCount == 24)
return Color(mpData[p], mpData[p + 1], mpData[p + 2]);
else
- return Color(mpData[p + 3], mpData[p], mpData[p + 1], mpData[p + 2]);
+ return Color(ColorTransparency, mpData[p + 3], mpData[p], mpData[p + 1], mpData[p + 2]);
}
// so we don't accidentally leave any code in that uses palette color indexes
void SetPixel(tools::Long nY, tools::Long nX, BitmapColor nColor) = delete;
diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index 902170555526..1ab62fbdb6c7 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -34,7 +34,7 @@ enum class DeviceFormat {
#endif
};
-constexpr ::Color SALCOLOR_NONE ( 0xFF, 0xFF, 0xFF, 0xFF );
+constexpr ::Color SALCOLOR_NONE ( ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF );
struct SalTwoRect
{
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index d3b274e1fa3d..ecaa4c5121e4 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -727,7 +727,7 @@ struct ObjectFormatterData
DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) :
mrData( rData ),
- mnPhClr( 0xffffffff )
+ mnPhClr( ColorTransparency, 0xffffffff )
{
if( !pAutoFormatEntry )
return;
@@ -749,7 +749,7 @@ DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const Auto
DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const AutoTextEntry* pAutoTextEntry ) :
mrData( rData ),
- mnPhClr( 0xffffffff )
+ mnPhClr( ColorTransparency, 0xffffffff )
{
if( pAutoTextEntry && (pAutoTextEntry->mnColorToken != XML_TOKEN_INVALID) )
mnPhClr = getSchemeColor( pAutoTextEntry->mnColorToken, XML_TOKEN_INVALID, 0 );
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index e87079945600..1cd5d2ebaed7 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -261,7 +261,7 @@ void Color::setSrgbClr( sal_Int32 nRgb )
{
OSL_ENSURE( (0 <= nRgb) && (nRgb <= 0xFFFFFF), "Color::setSrgbClr - invalid RGB value" );
meMode = COLOR_RGB;
- lclRgbToRgbComponents( mnC1, mnC2, mnC3, ::Color(nRgb) );
+ lclRgbToRgbComponents( mnC1, mnC2, mnC3, ::Color(ColorTransparency, nRgb) );
}
void Color::setScrgbClr( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB )
@@ -495,10 +495,10 @@ void Color::clearTransparence()
case COLOR_SCHEME: setResolvedRgb( rGraphicHelper.getSchemeColor( mnC1 ) ); break;
case COLOR_PALETTE: setResolvedRgb( rGraphicHelper.getPaletteColor( mnC1 ) ); break;
- case COLOR_SYSTEM: setResolvedRgb( rGraphicHelper.getSystemColor( mnC1, ::Color(mnC2) ) ); break;
+ case COLOR_SYSTEM: setResolvedRgb( rGraphicHelper.getSystemColor( mnC1, ::Color(ColorTransparency, mnC2) ) ); break;
case COLOR_PH: setResolvedRgb( nPhClr ); break;
- case COLOR_FINAL: return ::Color(mnC1);
+ case COLOR_FINAL: return ::Color(ColorTransparency, mnC1);
}
// if color is UNUSED or turns to UNUSED in setResolvedRgb, do not perform transformations
@@ -647,7 +647,7 @@ void Color::clearTransparence()
}
if( meMode == COLOR_FINAL )
maTransforms.clear();
- return ::Color(nRet);
+ return ::Color(ColorTransparency, nRet);
}
bool Color::hasTransparency() const
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 98ef5de040b7..f5aa1c2cd9f2 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -967,8 +967,8 @@ Reference< XShape > const & Shape::createAndInsert(
const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();
- ::Color nLinePhClr(0xffffffff);
- ::Color nFillPhClr(0xffffffff);
+ ::Color nLinePhClr(ColorTransparency, 0xffffffff);
+ ::Color nFillPhClr(ColorTransparency, 0xffffffff);
// TODO: use ph color when applying effect properties
//sal_Int32 nEffectPhClr = -1;
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 24fc7dc88aad..177660e42f85 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -481,7 +481,7 @@ static sal_Int32 lcl_generateRandomValue()
static sal_Int32 lcl_getAlphaFromTransparenceGradient(const awt::Gradient& rGradient, bool bStart)
{
// Our alpha is a gray color value.
- sal_uInt8 nRed = ::Color(bStart ? rGradient.StartColor : rGradient.EndColor).GetRed();
+ sal_uInt8 nRed = ::Color(ColorTransparency, bStart ? rGradient.StartColor : rGradient.EndColor).GetRed();
// drawingML alpha is a percentage on a 0..100000 scale.
return (255 - nRed) * oox::drawingml::MAX_PERCENT / 255;
}
@@ -1839,7 +1839,7 @@ void ChartExport::exportSolidFill(const Reference< XPropertySet >& xPropSet)
mpFS->endElementNS(XML_a, XML_gradFill);
}
else
- WriteSolidFill(::Color(nFillColor & 0xffffff), nAlpha);
+ WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xffffff), nAlpha);
}
void ChartExport::exportHatch( const Reference< XPropertySet >& xPropSet )
@@ -3880,7 +3880,7 @@ void ChartExport::exportDataPoints(
else
{
// property set only containing the color
- xPropSet.set( new ColorPropertySet( xColorScheme->getColorByIndex( nElement )));
+ xPropSet.set( new ColorPropertySet( ColorTransparency, xColorScheme->getColorByIndex( nElement )));
}
if( xPropSet.is() )
@@ -4245,7 +4245,7 @@ void ChartExport::exportMarker(const Reference< XPropertySet >& xPropSet)
pFS->singleElement(FSNS(XML_a, XML_noFill));
}
else
- WriteSolidFill(::Color(aColor));
+ WriteSolidFill(::Color(ColorTransparency, aColor));
pFS->endElement( FSNS( XML_c, XML_spPr ) );
}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 897fb0ff42a8..54003cd32fc7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -139,7 +139,7 @@ namespace
sal_Int32 GetAlphaFromTransparenceGradient(const awt::Gradient& rGradient, bool bStart)
{
// Our alpha is a gray color value.
- sal_uInt8 nRed = ::Color(bStart ? rGradient.StartColor : rGradient.EndColor).GetRed();
+ sal_uInt8 nRed = ::Color(ColorTransparency, bStart ? rGradient.StartColor : rGradient.EndColor).GetRed();
// drawingML alpha is a percentage on a 0..100000 scale.
return (255 - nRed) * oox::drawingml::MAX_PERCENT / 255;
}
@@ -481,7 +481,7 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
else if ( nFillColor != nOriginalColor )
{
// the user has set a different color for the shape
- WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha );
+ WriteSolidFill( ::Color(ColorTransparency, nFillColor & 0xffffff), nAlpha );
}
else if ( !sColorFillScheme.isEmpty() )
{
@@ -492,7 +492,7 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
{
// the shape had a custom color and the user didn't change it
// tdf#124013
- WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha );
+ WriteSolidFill( ::Color(ColorTransparency, nFillColor & 0xffffff), nAlpha );
}
}
@@ -505,7 +505,7 @@ void DrawingML::WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nA
::Color DrawingML::ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity )
{
- return ::Color(( ( ( nColor & 0xff ) * nIntensity ) / 100 )
+ return ::Color(ColorTransparency, ( ( ( nColor & 0xff ) * nIntensity ) / 100 )
| ( ( ( ( ( nColor & 0xff00 ) >> 8 ) * nIntensity ) / 100 ) << 8 )
| ( ( ( ( ( nColor & 0xff0000 ) >> 8 ) * nIntensity ) / 100 ) << 8 ));
}
@@ -918,7 +918,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc
default:
if (GetProperty(rXPropSet, "LineColor"))
{
- nColor = ::Color(mAny.get<sal_uInt32>() & 0xffffff);
+ nColor = ::Color(ColorTransparency, mAny.get<sal_uInt32>() & 0xffffff);
bColorSet = true;
}
if (GetProperty(rXPropSet, "LineTransparence"))
@@ -1578,7 +1578,7 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs
mpFS->startElementNS(XML_a, XML_pattFill, XML_prst, GetHatchPattern(rHatch));
mpFS->startElementNS(XML_a, XML_fgClr);
- WriteColor(::Color(rHatch.Color));
+ WriteColor(::Color(ColorTransparency, rHatch.Color));
mpFS->endElementNS( XML_a , XML_fgClr );
::Color nColor = COL_WHITE;
@@ -2023,7 +2023,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
&& eState == beans::PropertyState_DIRECT_VALUE)
|| GetProperty(rXPropSet, "CharColor"))
{
- ::Color color( *o3tl::doAccess<sal_uInt32>(mAny) );
+ ::Color color( ColorTransparency, *o3tl::doAccess<sal_uInt32>(mAny) );
SAL_INFO("oox.shape", "run color: " << sal_uInt32(color) << " auto: " << sal_uInt32(COL_AUTO));
// WriteSolidFill() handles MAX_PERCENT as "no transparency".
@@ -2053,7 +2053,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
{
if (GetProperty(rXPropSet, "CharBackColor"))
{
- ::Color color(*o3tl::doAccess<sal_uInt32>(mAny));
+ ::Color color(ColorTransparency, *o3tl::doAccess<sal_uInt32>(mAny));
if( color != COL_AUTO )
{
mpFS->startElementNS(XML_a, XML_highlight);
@@ -2069,7 +2069,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
&& eState == beans::PropertyState_DIRECT_VALUE)
|| GetProperty(rXPropSet, "CharUnderlineColor")))
{
- ::Color color(*o3tl::doAccess<sal_uInt32>(mAny));
+ ::Color color(ColorTransparency, *o3tl::doAccess<sal_uInt32>(mAny));
// if color is automatic, then we shouldn't write information about color but to take color from character
if( color != COL_AUTO )
{
@@ -2426,7 +2426,7 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
}
else if(aPropName == "BulletColor")
{
- nBulletColor = ::Color(*o3tl::doAccess<sal_uInt32>(rPropValue.Value));
+ nBulletColor = ::Color(ColorTransparency, *o3tl::doAccess<sal_uInt32>(rPropValue.Value));
bHasBulletColor = true;
}
else if ( aPropName == "BulletChar" )
@@ -2514,7 +2514,7 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
{
if (nBulletColor == COL_AUTO )
{
- nBulletColor = ::Color(mbIsBackgroundDark ? 0xffffff : 0x000000);
+ nBulletColor = ::Color(ColorTransparency, mbIsBackgroundDark ? 0xffffff : 0x000000);
}
mpFS->startElementNS(XML_a, XML_buClr);
WriteColor( nBulletColor );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 58246d08f231..9033e1d40d88 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1805,7 +1805,7 @@ void ShapeExport::WriteBorderLine(const sal_Int32 XML_line, const BorderLine2& r
if ( rBorderLine.Color == sal_Int32( COL_AUTO ) )
mpFS->singleElementNS(XML_a, XML_noFill);
else
- DrawingML::WriteSolidFill( ::Color(rBorderLine.Color) );
+ DrawingML::WriteSolidFill( ::Color(ColorTransparency, rBorderLine.Color) );
mpFS->endElementNS( XML_a, XML_line );
}
}
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index 1ffbbec89a30..0a50bc23327c 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -81,7 +81,7 @@ sal_uInt32 lclSwapRedBlue( sal_uInt32 nColor )
/** Returns the UNO RGB color from the passed encoded OLE BGR color. */
::Color lclDecodeBgrColor( sal_uInt32 nOleColor )
{
- return ::Color( lclSwapRedBlue( nOleColor ) & 0xFFFFFF );
+ return ::Color( ColorTransparency, lclSwapRedBlue( nOleColor ) & 0xFFFFFF );
}
const sal_uInt32 OLE_STDPIC_ID = 0x0000746C;
diff --git a/reportdesign/source/core/api/ImageControl.cxx b/reportdesign/source/core/api/ImageControl.cxx
index 1d08baa1aa6a..3260af26e25f 100644
--- a/reportdesign/source/core/api/ImageControl.cxx
+++ b/reportdesign/source/core/api/ImageControl.cxx
@@ -213,7 +213,7 @@ void SAL_CALL OImageControl::setHyperLinkName(const OUString & the_value)
::sal_Int32 SAL_CALL OImageControl::getControlBackground()
{
::osl::MutexGuard aGuard(m_aMutex);
- return sal_Int32(m_aProps.aFormatProperties.m_bBackgroundTransparent ? COL_TRANSPARENT : m_aProps.aFormatProperties.nBackgroundColor);
+ return m_aProps.aFormatProperties.m_bBackgroundTransparent ? static_cast<sal_Int32>(COL_TRANSPARENT) : m_aProps.aFormatProperties.nBackgroundColor;
}
void SAL_CALL OImageControl::setControlBackground( ::sal_Int32 _backgroundcolor )
diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx
index cc75f83da045..2ff6228b7ade 100644
--- a/reportdesign/source/core/api/Section.cxx
+++ b/reportdesign/source/core/api/Section.cxx
@@ -245,7 +245,7 @@ void SAL_CALL OSection::setHeight( ::sal_uInt32 _height )
::sal_Int32 SAL_CALL OSection::getBackColor()
{
::osl::MutexGuard aGuard(m_aMutex);
- return sal_Int32(m_bBacktransparent ? COL_TRANSPARENT : m_nBackgroundColor);
+ return m_bBacktransparent ? static_cast<sal_Int32>(COL_TRANSPARENT) : m_nBackgroundColor;
}
void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor )
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index baa7a948f37e..3f440f3494be 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -323,9 +323,9 @@ void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat
aFont.SetFontHeight(OutputDevice::LogicToLogic(Size(0, aFont.GetFontHeight()), MapMode(MapUnit::MapPoint), MapMode(MapUnit::MapTwip)).Height());
aFont.SetEmphasisMark( static_cast< FontEmphasisMark >( _xReportControlFormat->getControlTextEmphasis() ) );
aFont.SetRelief( static_cast< FontRelief >( _xReportControlFormat->getCharRelief() ) );
- aFont.SetColor( Color(_xReportControlFormat->getCharColor()) );
+ aFont.SetColor( Color(ColorTransparency, _xReportControlFormat->getCharColor()) );
m_aPreview.SetFont( aFont, aFont, aFont );
- m_aPreview.SetTextLineColor( Color( _xReportControlFormat->getCharUnderlineColor() ) );
+ m_aPreview.SetTextLineColor( Color( ColorTransparency, _xReportControlFormat->getCharUnderlineColor() ) );
}
catch( const Exception& )
{
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 60b0b48bdb6a..10a7197582d5 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -345,12 +345,12 @@ namespace
_rItemSet.Put(SvxCharHiddenItem(_rxReportControlFormat->getCharHidden(),ITEMID_CHARHIDDEN));
_rItemSet.Put(SvxTwoLinesItem(_rxReportControlFormat->getCharCombineIsOn(),_rxReportControlFormat->getCharCombinePrefix().toChar(),_rxReportControlFormat->getCharCombineSuffix().toChar(),ITEMID_TWOLINES));
SvxUnderlineItem aUnderLineItem(aFont.GetUnderline(),ITEMID_UNDERLINE);
- aUnderLineItem.SetColor(Color(_rxReportControlFormat->getCharUnderlineColor()));
+ aUnderLineItem.SetColor(Color(ColorTransparency, _rxReportControlFormat->getCharUnderlineColor()));
_rItemSet.Put(aUnderLineItem);
_rItemSet.Put(SvxKerningItem(_rxReportControlFormat->getCharKerning(),ITEMID_KERNING));
_rItemSet.Put(SvxEmphasisMarkItem(static_cast<FontEmphasisMark>(_rxReportControlFormat->getCharEmphasis()),ITEMID_EMPHASISMARK));
_rItemSet.Put(SvxCharReliefItem(static_cast<FontRelief>(_rxReportControlFormat->getCharRelief()),ITEMID_CHARRELIEF));
- _rItemSet.Put(SvxColorItem(::Color(_rxReportControlFormat->getCharColor()),ITEMID_COLOR));
+ _rItemSet.Put(SvxColorItem(::Color(ColorTransparency, _rxReportControlFormat->getCharColor()),ITEMID_COLOR));
_rItemSet.Put(SvxCharRotateItem(Degree10(_rxReportControlFormat->getCharRotation()),false,ITEMID_CHARROTATE));
_rItemSet.Put(SvxCharScaleWidthItem(_rxReportControlFormat->getCharScaleWidth(),ITEMID_CHARSCALE_W));
@@ -363,7 +363,7 @@ namespace
uno::Reference< report::XShape> xShape(_rxReportControlFormat,uno::UNO_QUERY);
if ( !xShape.is() )
- _rItemSet.Put(SvxBrushItem(::Color(_rxReportControlFormat->getControlBackground()),ITEMID_BRUSH));
+ _rItemSet.Put(SvxBrushItem(::Color(ColorTransparency, _rxReportControlFormat->getControlBackground()),ITEMID_BRUSH));
lcl_setFont(_rxReportControlFormat, _rItemSet,ASIAN,ITEMID_FONT_ASIAN,ITEMID_FONTHEIGHT_ASIAN,ITEMID_LANGUAGE_ASIAN,ITEMID_POSTURE_ASIAN,ITEMID_WEIGHT_ASIAN );
lcl_setFont(_rxReportControlFormat, _rItemSet,COMPLEX,ITEMID_FONT_COMPLEX,ITEMID_FONTHEIGHT_COMPLEX,ITEMID_LANGUAGE_COMPLEX,ITEMID_POSTURE_COMPLEX,ITEMID_WEIGHT_COMPLEX );
diff --git a/reportdesign/source/ui/report/FixedTextColor.cxx b/reportdesign/source/ui/report/FixedTextColor.cxx
index 92894cfcb3eb..a73858fcf86a 100644
--- a/reportdesign/source/ui/report/FixedTextColor.cxx
+++ b/reportdesign/source/ui/report/FixedTextColor.cxx
@@ -96,7 +96,7 @@ namespace rptui
try
{
bool bIsDark = false;
- const Color nBackColor( xFixedText->getControlBackground() );
+ const Color nBackColor( ColorTransparency, xFixedText->getControlBackground() );
if (nBackColor == COL_TRANSPARENT)
{
uno::Reference <report::XSection> xSection(xFixedText->getParent(), uno::UNO_QUERY_THROW);
@@ -112,7 +112,7 @@ namespace rptui
else
{
css::util::Color aColor2 = xSection->getBackColor();
- Color aBackColor(aColor2);
+ Color aBackColor(ColorTransparency, aColor2);
bIsDark = aBackColor.IsDark();
}
}
@@ -132,7 +132,7 @@ namespace rptui
else
{
util::Color aLabelColor = xFixedText->getCharColor();
- setPropertyTextColor(xVclWindowPeer, ::Color(aLabelColor));
+ setPropertyTextColor(xVclWindowPeer, ::Color(ColorTransparency, aLabelColor));
}
}
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 5f5386555a2e..40cc8421c5d8 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2421,7 +2421,7 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges));
// fill it
if ( _xSection.is() )
- pDescriptor->Put(SvxBrushItem(::Color(_xSection->getBackColor()),RPTUI_ID_BRUSH));
+ pDescriptor->Put(SvxBrushItem(::Color(ColorTransparency, _xSection->getBackColor()),RPTUI_ID_BRUSH));
else
{
pDescriptor->Put(SvxSizeItem(RPTUI_ID_SIZE,VCLSize(getStyleProperty<awt::Size>(m_xReportDefinition,PROPERTY_PAPERSIZE))));
@@ -2441,7 +2441,7 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
aPageItem.SetLandscape(getStyleProperty<bool>(m_xReportDefinition,PROPERTY_ISLANDSCAPE));
aPageItem.SetNumType(static_cast<SvxNumType>(getStyleProperty<sal_Int16>(m_xReportDefinition,PROPERTY_NUMBERINGTYPE)));
pDescriptor->Put(aPageItem);
- pDescriptor->Put(SvxBrushItem(::Color(getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH));
+ pDescriptor->Put(SvxBrushItem(::Color(ColorTransparency, getStyleProperty<sal_Int32>(m_xReportDefinition,PROPERTY_BACKCOLOR)),RPTUI_ID_BRUSH));
}
}
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index a1ea65141ae2..5ea227f5e184 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -206,7 +206,7 @@ void OReportSection::fill()
sal_Int32 nColor = m_xSection->getBackColor();
if ( nColor == static_cast<sal_Int32>(COL_TRANSPARENT) )
nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_BACKCOLOR);
- m_pView->SetApplicationDocumentColor(Color(nColor));
+ m_pView->SetApplicationDocumentColor(Color(ColorTransparency, nColor));
uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
@@ -454,7 +454,7 @@ void OReportSection::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
sal_Int32 nColor = m_xSection->getBackColor();
if ( nColor == static_cast<sal_Int32>(COL_TRANSPARENT) )
nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_BACKCOLOR);
- m_pView->SetApplicationDocumentColor(Color(nColor));
+ m_pView->SetApplicationDocumentColor(Color(ColorTransparency, nColor));
Invalidate(InvalidateFlags::NoChildren|InvalidateFlags::NoErase);
}
else
diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index 817b4c6c9eab..257d2e7f92be 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -356,7 +356,7 @@ void testColorScaleEntry(uno::Reference<sheet::XColorScaleEntry> const & xEntry,
sal_Int32 nType, const OUString& rString, Color nColor)
{
CPPUNIT_ASSERT_EQUAL(nType, xEntry->getType());
- CPPUNIT_ASSERT_EQUAL(nColor, Color(xEntry->getColor()));
+ CPPUNIT_ASSERT_EQUAL(nColor, Color(ColorTransparency, xEntry->getColor()));
switch (nType)
{
case sheet::ColorScaleEntryType::COLORSCALE_VALUE:
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index d71d59a3b66b..fda7236be3c6 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -422,16 +422,16 @@ ScAppCfg::ScAppCfg() :
switch(nProp)
{
case SCREVISOPT_CHANGE:
- if (pValues[nProp] >>= nIntVal) SetTrackContentColor( Color(nIntVal) );
+ if (pValues[nProp] >>= nIntVal) SetTrackContentColor( Color(ColorTransparency, nIntVal) );
break;
case SCREVISOPT_INSERTION:
- if (pValues[nProp] >>= nIntVal) SetTrackInsertColor( Color(nIntVal) );
+ if (pValues[nProp] >>= nIntVal) SetTrackInsertColor( Color(ColorTransparency, nIntVal) );
break;
case SCREVISOPT_DELETION:
- if (pValues[nProp] >>= nIntVal) SetTrackDeleteColor( Color(nIntVal) );
+ if (pValues[nProp] >>= nIntVal) SetTrackDeleteColor( Color(ColorTransparency, nIntVal) );
break;
case SCREVISOPT_MOVEDENTRY:
- if (pValues[nProp] >>= nIntVal) SetTrackMoveColor( Color(nIntVal) );
+ if (pValues[nProp] >>= nIntVal) SetTrackMoveColor( Color(ColorTransparency, nIntVal) );
break;
}
}
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index 3678e1866a17..45b06b47a1fa 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -294,9 +294,12 @@ ScViewCfg::ScViewCfg() :
switch(nProp)
{
case SCLAYOUTOPT_GRIDCOLOR:
- if ( pValues[nProp] >>= nIntVal )
- SetGridColor( Color(nIntVal), EMPTY_OUSTRING );
+ {
+ Color aColor;
+ if ( pValues[nProp] >>= aColor )
+ SetGridColor( aColor, EMPTY_OUSTRING );
break;
+ }
case SCLAYOUTOPT_GRIDLINES:
SetOption( VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
break;
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index f02c37bee841..18647bbd3c02 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -880,7 +880,7 @@ sax_fastparser::FSHelperPtr XclXmlUtils::WriteFontData( sax_fastparser::FSHelper
lcl_WriteValue( pStream, XML_u, bHaveUnderline ? pUnderline : nullptr );
lcl_WriteValue( pStream, XML_vertAlign, bHaveVertAlign ? pVertAlign : nullptr );
lcl_WriteValue( pStream, XML_sz, OString::number( rFontData.mnHeight / 20.0 ).getStr() ); // Twips->Pt
- if( rFontData.maColor != Color( 0xFF, 0xFF, 0xFF, 0xFF ) )
+ if( rFontData.maColor != Color( ColorAlpha, 0, 0xFF, 0xFF, 0xFF ) )
pStream->singleElement( XML_color,
// OOXTODO: XML_auto, bool
// OOXTODO: XML_indexed, uint
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 031639564a78..a138f62c3d44 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1834,7 +1834,7 @@ static void lcl_WriteBorder( XclExpXmlStream& rStrm, sal_Int32 nElement, sal_uIn
sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
if( nLineStyle == EXC_LINE_NONE )
rStyleSheet->singleElement(nElement);
- else if( rColor == Color( 0, 0, 0, 0 ) )
+ else if( rColor == Color( 0, 0, 0 ) )
rStyleSheet->singleElement(nElement, XML_style, ToLineStyle(nLineStyle));
else
{
diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx
index 3503ba9567fe..3a178c10dc06 100644
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -886,8 +886,8 @@ void XclChPropSetHelper::ReadMarkerProperties(
rMarkerFmt.mnMarkerSize = XclTools::GetTwipsFromHmm( nApiSize );
// symbol colors
- rMarkerFmt.maLineColor = Color( aApiSymbol.BorderColor );
- rMarkerFmt.maFillColor = Color( aApiSymbol.FillColor );
+ rMarkerFmt.maLineColor = Color( ColorTransparency, aApiSymbol.BorderColor );
+ rMarkerFmt.maFillColor = Color( ColorTransparency, aApiSymbol.FillColor );
}
sal_uInt16 XclChPropSetHelper::ReadRotationProperties( const ScfPropertySet& rPropSet, bool bSupportsStacked )
diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx
index b5833a697b5d..a1271eb81602 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -202,7 +202,7 @@ bool ScfPropertySet::GetColorProperty( Color& rColor, const OUString& rPropName
{
sal_Int32 nApiColor = 0;
bool bRet = GetProperty( nApiColor, rPropName );
- rColor = Color( nApiColor );
+ rColor = Color( ColorTransparency, nApiColor );
return bRet;
}
@@ -320,7 +320,7 @@ void ScfPropSetHelper::ReadValue( Color& rColor )
{
sal_Int32 nApiColor(0);
ReadValue( nApiColor );
- rColor = Color( nApiColor );
+ rColor = Color( ColorTransparency, nApiColor );
}
void ScfPropSetHelper::ReadValue( bool& rbValue )
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index d8c60dad324d..3746a26230dd 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -235,7 +235,7 @@ private:
struct ExCfRuleModel
{
- ExCfRuleModel() : mnAxisColor( UNSIGNED_RGB_TRANSPARENT ), mnNegativeColor( UNSIGNED_RGB_TRANSPARENT ), mbGradient( false ), mbIsLower( true ) {}
+ ExCfRuleModel() : mnAxisColor( ColorTransparency, UNSIGNED_RGB_TRANSPARENT ), mnNegativeColor( ColorTransparency, UNSIGNED_RGB_TRANSPARENT ), mbGradient( false ), mbIsLower( true ) {}
// AxisColor
::Color mnAxisColor;
// NegativeFillColor
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index ca28b0ebf818..13ca11ed9333 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -172,7 +172,7 @@ namespace {
{
::Color nColor;
if( rAttribs.hasAttribute( XML_rgb ) )
- nColor = ::Color(rAttribs.getUnsignedHex( XML_rgb, UNSIGNED_RGB_TRANSPARENT ));
+ nColor = ::Color(ColorTransparency, rAttribs.getUnsignedHex( XML_rgb, UNSIGNED_RGB_TRANSPARENT ));
else if( rAttribs.hasAttribute( XML_theme ) )
{
sal_uInt32 nThemeIndex = rAttribs.getUnsigned( XML_theme, 0 );
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index d6fd828c79dd..bc80fc42a1f8 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -855,7 +855,7 @@ void HeaderFooterParser::convertFontColor( const OUString& rColor )
static_cast< double >( rColor.copy( 2 ).toInt32() ) / 100.0 );
else
// RGB color: RRGGBB
- maFontModel.maColor.setRgb( ::Color(rColor.toUInt32( 16 )) );
+ maFontModel.maColor.setRgb( ::Color(ColorTransparency, rColor.toUInt32( 16 )) );
}
void HeaderFooterParser::finalizePortion()
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index e688a5221e48..17cf305392e2 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -219,7 +219,7 @@ const sal_uInt8 BIFF_FONTUNDERL_DOUBLE_ACC = 34;
nValue |= nG;
nValue <<= 8;
nValue |= nB;
- return ::Color(nValue);
+ return ::Color(ColorTransparency, nValue);
}
} // namespace
@@ -277,7 +277,7 @@ void Color::importColor( const AttributeList& rAttribs )
if( rAttribs.hasAttribute( XML_theme ) )
setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( XML_tint, 0.0 ) );
else if( rAttribs.hasAttribute( XML_rgb ) )
- setRgb( rAttribs.getIntegerHex( XML_rgb, sal_Int32(API_RGB_TRANSPARENT) ), rAttribs.getDouble( XML_tint, 0.0 ) );
+ setRgb( ::Color(ColorTransparency, rAttribs.getIntegerHex( XML_rgb, sal_Int32(API_RGB_TRANSPARENT) ) ), rAttribs.getDouble( XML_tint, 0.0 ) );
else if( rAttribs.hasAttribute( XML_indexed ) )
setIndexed( rAttribs.getInteger( XML_indexed, -1 ), rAttribs.getDouble( XML_tint, 0.0 ) );
else if( rAttribs.getBool( XML_auto, false ) )
@@ -377,7 +377,7 @@ ColorPalette::ColorPalette( const WorkbookHelper& rHelper )
void ColorPalette::importPaletteColor( const AttributeList& rAttribs )
{
- appendColor( rAttribs.getIntegerHex( XML_rgb, sal_Int32(API_RGB_WHITE) ) );
+ appendColor( ::Color(ColorTransparency, rAttribs.getIntegerHex( XML_rgb, sal_Int32(API_RGB_WHITE) ) ) );
}
void ColorPalette::importPaletteColor( SequenceInputStream& rStrm )
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 7bf9bd059def..49ea4d07a2b3 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1727,7 +1727,7 @@ void ScOrcusStyles::set_font_underline_color(orcus::spreadsheet::color_elem_t al
orcus::spreadsheet::color_elem_t green,
orcus::spreadsheet::color_elem_t blue)
{
- maCurrentFont.maUnderlineColor = Color(alpha, red, green, blue);
+ maCurrentFont.maUnderlineColor = Color(ColorTransparency, alpha, red, green, blue);
}
void ScOrcusStyles::set_font_color(orcus::spreadsheet::color_elem_t /*alpha*/,
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 3bfa5bbdc1e8..60d3b2114e29 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -85,7 +85,7 @@ namespace
if (sColor == "transparent")
aColor = COL_TRANSPARENT;
else
- aColor = Color(sColor.toInt32(16));
+ aColor = Color(ColorTransparency, sColor.toInt32(16));
switch (nSlot)
{
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index ca3713ef46f8..1b2ef3240c1e 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -333,7 +333,7 @@ static void setupFillColorForChart(SfxViewShell* pShell, SfxItemSet& rSet)
sal_uInt32 nFillColor = 0;
xPropSet->getPropertyValue("FillColor") >>= nFillColor;
- XFillColorItem aFillColorItem("", Color(nFillColor));
+ XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor));
rSet.Put(aFillColorItem);
if (comphelper::LibreOfficeKit::isActive())
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 4647b2bd3b4e..a12d8d1c9f2f 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -7877,17 +7877,15 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
{
if (rDoc.IsScenario(nTab))
{
- sal_Int32 nNewColor = 0;
- if (aValue >>= nNewColor)
+ Color aColor;
+ if (aValue >>= aColor)
{
OUString aName;
OUString aComment;
- Color aColor;
ScScenarioFlags nFlags;
+ Color aTmp;
rDoc.GetName( nTab, aName );
- rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
-
- aColor = Color(static_cast<sal_uInt32>(nNewColor));
+ rDoc.GetScenarioData( nTab, aComment, aTmp, nFlags );
pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index c679f423bb48..b64fd3ec96b6 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -886,7 +886,7 @@ void setColorScaleEntry(ScColorScaleEntry* pEntry, uno::Reference<sheet::XColorS
throw lang::IllegalArgumentException();
pEntry->SetType(eType);
- pEntry->SetColor(Color(xEntry->getColor()));
+ pEntry->SetColor(Color(ColorTransparency, xEntry->getColor()));
switch (eType)
{
case COLORSCALE_FORMULA:
@@ -1020,7 +1020,7 @@ sal_Int32 ScColorScaleEntryObj::getColor()
void ScColorScaleEntryObj::setColor(sal_Int32 aColor)
{
- getCoreObject()->SetColor(Color(aColor));
+ getCoreObject()->SetColor(Color(ColorTransparency, aColor));
}
sal_Int32 ScColorScaleEntryObj::getType()
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 5e06f7b1afb2..b95566ed667f 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -155,12 +155,9 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if ( aPropertyName == SC_UNO_GRIDCOLOR )
{
- sal_Int64 nColor = 0;
- if (aValue >>= nColor)
- {
- Color aColor(static_cast<sal_uInt32>(nColor));
+ Color aColor;
+ if (aValue >>= aColor)
aViewOpt.SetGridColor(aColor, OUString());
- }
}
else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx
index 34998adcbb16..b4366a4e1897 100644
--- a/sc/source/ui/vba/vbaborders.cxx
+++ b/sc/source/ui/vba/vbaborders.cxx
@@ -165,7 +165,7 @@ public:
{
table::BorderLine aBorderLine;
if ( getBorderLine( aBorderLine ) )
- return uno::makeAny( OORGBToXLRGB( Color(aBorderLine.Color) ) );
+ return uno::makeAny( OORGBToXLRGB( Color(ColorTransparency, aBorderLine.Color) ) );
throw uno::RuntimeException("No Implementation available" );
}
void SAL_CALL setColor( const uno::Any& _color ) override
diff --git a/sc/source/ui/vba/vbainterior.cxx b/sc/source/ui/vba/vbainterior.cxx
index c4f83e972789..241099a00624 100644
--- a/sc/source/ui/vba/vbainterior.cxx
+++ b/sc/source/ui/vba/vbainterior.cxx
@@ -102,7 +102,7 @@ ScVbaInterior::SetMixedColor()
if( aPatternColor.hasValue() )
{
sal_uInt32 nPatternColor = GetAttributeData( aPatternColor );
- m_aPattColor = Color(nPatternColor);
+ m_aPattColor = Color(ColorTransparency, nPatternColor);
}
Color nPatternColor = m_aPattColor;
// back color
@@ -216,7 +216,7 @@ Color
ScVbaInterior::GetMixedColor( const Color& rFore, const Color& rBack, sal_uInt8 nTrans )
{
return Color(
- nTrans,
+ ColorTransparency, nTrans,
GetMixedColorComp( rFore.GetRed(), rBack.GetRed(), nTrans ),
GetMixedColorComp( rFore.GetGreen(), rBack.GetGreen(), nTrans ),
GetMixedColorComp( rFore.GetBlue(), rBack.GetBlue(), nTrans ));
@@ -301,7 +301,7 @@ ScVbaInterior::GetBackColor()
if( aColor.hasValue() )
{
nColor = GetAttributeData( aColor );
- aBackColor = Color(nColor);
+ aBackColor = Color(ColorTransparency, nColor);
}
else
{
@@ -309,7 +309,7 @@ ScVbaInterior::GetBackColor()
if( aAny >>= nColor )
{
nColor = XLRGBToOORGB( nColor );
- aBackColor = Color(nColor);
+ aBackColor = Color(ColorTransparency, nColor);
SetUserDefinedAttributes( BACKCOLOR, SetAttributeData( nColor ) );
}
}
@@ -323,7 +323,7 @@ ScVbaInterior::getPatternColor()
if( aPatternColor.hasValue() )
{
sal_uInt32 nPatternColor = GetAttributeData( aPatternColor );
- return uno::makeAny( OORGBToXLRGB( Color(nPatternColor) ) );
+ return uno::makeAny( OORGBToXLRGB( Color(ColorTransparency, nPatternColor) ) );
}
return uno::makeAny( sal_Int32( 0 ) );
}
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 4b1b414f329e..7e22423f28a5 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -956,7 +956,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq)
if ( sColor == "transparent" )
aColor = COL_TRANSPARENT;
else
- aColor = Color( sColor.toInt32( 16 ) );
+ aColor = Color( ColorTransparency, sColor.toInt32( 16 ) );
aSet.Put( SvxColorItem( aColor, EE_CHAR_COLOR ) );
}
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 9b38ac794412..865b129c6610 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1644,7 +1644,7 @@ namespace
if (sColor == "transparent")
rColor = COL_TRANSPARENT;
else
- rColor = Color(sColor.toInt32(16));
+ rColor = Color(ColorTransparency, sColor.toInt32(16));
return true;
}
return false;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 29b699a96eb6..ba73413c7fc2 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2551,7 +2551,7 @@ void ScTabView::DoChartSelection(
for (chart2::data::HighlightedRange const & rHighlightedRange : rHilightRanges)
{
- Color aSelColor(rHighlightedRange.PreferredColor);
+ Color aSelColor(ColorTransparency, rHighlightedRange.PreferredColor);
ScRangeList aRangeList;
ScDocument& rDoc = aViewData.GetDocShell()->GetDocument();
if( ScRangeStringConverter::GetRangeListFromString(
diff --git a/sd/source/filter/eppt/pptx-stylesheet.cxx b/sd/source/filter/eppt/pptx-stylesheet.cxx
index 27fc7f3ac598..459020278fc9 100644
--- a/sd/source/filter/eppt/pptx-stylesheet.cxx
+++ b/sd/source/filter/eppt/pptx-stylesheet.cxx
@@ -79,7 +79,7 @@ void PPTExCharSheet::SetStyleSheet( const css::uno::Reference< css::beans::XProp
PPTExCharLevel& rLev = maCharLevel[ nLevel ];
if ( aPortionObj.meCharColor == css::beans::PropertyState_DIRECT_VALUE )
- rLev.mnFontColor = aPortionObj.mnCharColor;
+ rLev.mnFontColor = Color(ColorTransparency, aPortionObj.mnCharColor);
if ( aPortionObj.meCharEscapement == css::beans::PropertyState_DIRECT_VALUE )
rLev.mnEscapement = aPortionObj.mnCharEscapement;
if ( aPortionObj.meCharHeight == css::beans::PropertyState_DIRECT_VALUE )
@@ -111,7 +111,7 @@ void PPTExCharSheet::Write( SvStream& rSt, sal_uInt16 nLev, bool bSimpleText,
css::uno::Any aAny;
if ( PropValue::GetPropertyValue( aAny, rPagePropSet, "IsBackgroundDark", true ) )
aAny >>= bIsDark;
- nFontColor = bIsDark ? 0xffffff : 0x000000;
+ nFontColor = Color(ColorTransparency, bIsDark ? 0xffffff : 0x000000);
}
nFontColor.SetAlpha(1);
if ( bSimpleText )
@@ -447,7 +447,7 @@ bool PPTExStyleSheet::IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel,
case CharAttr_AsianOrComplexFont : return ( rChar.mnAsianOrComplexFont != nValue );
case CharAttr_Symbol : return true;
case CharAttr_FontHeight : return ( rChar.mnFontHeight != nValue );
- case CharAttr_FontColor : return ( rChar.mnFontColor != nValue );
+ case CharAttr_FontColor : return ( rChar.mnFontColor != Color(ColorTransparency, nValue) );
case CharAttr_Escapement : return ( rChar.mnEscapement != nValue );
default:
break;
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index c7819eafa3a9..87d90336e554 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -499,37 +499,37 @@ void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams
}
else if ( rParam.Name == "BackColor" )
{
- sal_Int32 temp = 0;
+ Color temp;
rParam.Value >>= temp;
- maBackColor = Color(temp);
+ maBackColor = temp;
mbUserAttr = true;
}
else if ( rParam.Name == "TextColor" )
{
- sal_Int32 temp = 0;
+ Color temp;
rParam.Value >>= temp;
- maTextColor = Color(temp);
+ maTextColor = temp;
mbUserAttr = true;
}
else if ( rParam.Name == "LinkColor" )
{
- sal_Int32 temp = 0;
+ Color temp ;
rParam.Value >>= temp;
- maLinkColor = Color(temp);
+ maLinkColor = temp;
mbUserAttr = true;
}
else if ( rParam.Name == "VLinkColor" )
{
- sal_Int32 temp = 0;
+ Color temp;
rParam.Value >>= temp;
- maVLinkColor = Color(temp);
+ maVLinkColor = temp;
mbUserAttr = true;
}
else if ( rParam.Name == "ALinkColor" )
{
- sal_Int32 temp = 0;
+ Color temp;
rParam.Value >>= temp;
- maALinkColor = Color(temp);
+ maALinkColor = temp;
mbUserAttr = true;
}
else if ( rParam.Name == "IsUseDocumentColors" )
diff --git a/sd/source/filter/ppt/ppt97animations.cxx b/sd/source/filter/ppt/ppt97animations.cxx
index 96d578019753..cc0b37afd913 100644
--- a/sd/source/filter/ppt/ppt97animations.cxx
+++ b/sd/source/filter/ppt/ppt97animations.cxx
@@ -35,7 +35,7 @@ void Ppt97AnimationInfoAtom::ReadStream( SvStream& rIn )
{
sal_uInt32 nTmp;
rIn.ReadUInt32( nTmp );
- nDimColor = Color(nTmp);
+ nDimColor = Color(ColorTransparency, nTmp);
rIn.ReadUInt32( nFlags );
rIn.ReadUInt32( nSoundRef );
rIn.ReadInt32( nDelayTime );
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index a4b247662855..fb8a5bc68efd 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -208,9 +208,9 @@ SdColorPropertyBox::SdColorPropertyBox(weld::Label* pLabel, weld::Container* pPa
pLabel->set_mnemonic_widget(&mxControl->get_widget());
mxControl->show();
- sal_Int32 nColor = 0;
+ Color nColor;
rValue >>= nColor;
- mxControl->SelectEntry(Color(nColor));
+ mxControl->SelectEntry(nColor);
}
IMPL_LINK_NOARG(SdColorPropertyBox, OnSelect, ColorListBox&, void)
@@ -222,11 +222,11 @@ void SdColorPropertyBox::setValue( const Any& rValue, const OUString& )
{
if (mxControl)
{
- sal_Int32 nColor = 0;
+ Color nColor;
rValue >>= nColor;
mxControl->SetNoSelection();
- mxControl->SelectEntry(Color(nColor));
+ mxControl->SelectEntry(nColor);
}
}
@@ -1000,9 +1000,8 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage(weld::Container* pPar
if( aDimColor.hasValue() )
{
- sal_Int32 nColor = 0;
- aDimColor >>= nColor;
- Color aColor(nColor);
+ Color aColor;
+ aDimColor >>= aColor;
mxCLBDimColor->SelectEntry(aColor);
}
else
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index 5de5d71bcd8d..89eb7992ea73 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -169,8 +169,8 @@ void CopyDlg::Reset()
m_xMtrFldAngle->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64(), FieldUnit::NONE);
m_xMtrFldWidth->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64(), FieldUnit::NONE);
m_xMtrFldHeight->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64(), FieldUnit::NONE);
- m_xLbStartColor->SelectEntry( Color( aStr.getToken(0, TOKEN, nIdx).toUInt32() ) );
- m_xLbEndColor->SelectEntry( Color( aStr.getToken(0, TOKEN, nIdx).toUInt32() ) );
+ m_xLbStartColor->SelectEntry( Color( ColorTransparency, aStr.getToken(0, TOKEN, nIdx).toUInt32() ) );
+ m_xLbEndColor->SelectEntry( Color( ColorTransparency, aStr.getToken(0, TOKEN, nIdx).toUInt32() ) );
}
}
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx
index 46daeb6f061d..4a3301bbefc4 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -161,15 +161,15 @@ Any PresenterTextView::SetPropertyValue (
}
else if (rsPropertyName == gsBackgroundColorPropertyName)
{
- util::Color aColor = util::Color();
+ ::Color aColor;
if (rValue >>= aColor)
- mpImplementation->SetBackgroundColor(Color(aColor));
+ mpImplementation->SetBackgroundColor(aColor);
}
else if (rsPropertyName == gsTextColorPropertyName)
{
- util::Color aColor = util::Color();
+ ::Color aColor;
if (rValue >>= aColor)
- mpImplementation->SetTextColor(Color(aColor));
+ mpImplementation->SetTextColor(aColor);
}
else if (rsPropertyName == gsFontDescriptorPropertyName)
{
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 5b4574261934..77bab18a6c70 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -1417,7 +1417,7 @@ void SAL_CALL SlideshowImpl::blankScreen( sal_Int32 nColor )
if( mpShowWindow && mpSlideController )
{
- if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), Color(nColor) ) )
+ if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), Color(ColorTransparency, nColor) ) )
{
pause();
}
@@ -2107,7 +2107,7 @@ IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu, bool )
else if (sMenuId == "color")
{
//Open a color picker based on SvColorDialog
- ::Color aColor( mnUserPaintColor );
+ ::Color aColor( ColorTransparency, mnUserPaintColor );
SvColorDialog aColorDlg;
aColorDlg.SetColor( aColor );
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
index cd9b167d6eff..41d05c37f0b3 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
@@ -310,7 +310,7 @@ void SAL_CALL SlideSorterService::setBackgroundColor (sal_Int32 aBackgroundColor
{
ThrowIfDisposed();
if (mpSlideSorter != nullptr && mpSlideSorter->IsValid())
- mpSlideSorter->GetProperties()->SetBackgroundColor(Color(aBackgroundColor));
+ mpSlideSorter->GetProperties()->SetBackgroundColor(Color(ColorTransparency, aBackgroundColor));
}
sal_Int32 SAL_CALL SlideSorterService::getTextColor()
@@ -327,7 +327,7 @@ void SAL_CALL SlideSorterService::setTextColor (sal_Int32 aTextColor)
{
ThrowIfDisposed();
if (mpSlideSorter != nullptr && mpSlideSorter->IsValid())
- mpSlideSorter->GetProperties()->SetTextColor(Color(aTextColor));
+ mpSlideSorter->GetProperties()->SetTextColor(Color(ColorTransparency, aTextColor));
}
sal_Int32 SAL_CALL SlideSorterService::getSelectionColor()
@@ -344,7 +344,7 @@ void SAL_CALL SlideSorterService::setSelectionColor (sal_Int32 aSelectionColor)
{
ThrowIfDisposed();
if (mpSlideSorter != nullptr && mpSlideSorter->IsValid())
- mpSlideSorter->GetProperties()->SetSelectionColor(Color(aSelectionColor));
+ mpSlideSorter->GetProperties()->SetSelectionColor(Color(ColorTransparency, aSelectionColor));
}
sal_Int32 SAL_CALL SlideSorterService::getHighlightColor()
@@ -361,7 +361,7 @@ void SAL_CALL SlideSorterService::setHighlightColor (sal_Int32 aHighlightColor)
{
ThrowIfDisposed();
if (mpSlideSorter != nullptr && mpSlideSorter->IsValid())
- mpSlideSorter->GetProperties()->SetHighlightColor(Color(aHighlightColor));
+ mpSlideSorter->GetProperties()->SetHighlightColor(Color(ColorTransparency, aHighlightColor));
}
sal_Bool SAL_CALL SlideSorterService::getIsUIReadOnly()
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 582223ed0fa3..2c92f0b66d06 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -82,7 +82,7 @@ namespace
if (sColor == "transparent")
aColor = COL_TRANSPARENT;
else
- aColor = Color(sColor.toInt32(16));
+ aColor = Color(ColorTransparency, sColor.toInt32(16));
switch (nSlot)
{
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index b11da7048b01..d60ebb701298 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -562,7 +562,7 @@ public:
if (sColor == "transparent")
aColor = COL_TRANSPARENT;
else
- aColor = Color(sColor.toInt32(16));
+ aColor = Color(ColorTransparency, sColor.toInt32(16));
switch (nSlot)
{
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 9ce0bab63e4d..6e695b1d4f06 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1813,7 +1813,7 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
if (sColor == "transparent")
aColor = COL_TRANSPARENT;
else
- aColor = Color(sColor.toInt32(16));
+ aColor = Color(ColorTransparency, sColor.toInt32(16));
XFillColorItem aColorItem(OUString(), aColor);
rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_SOLID ) );
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 8bb669f2cf4e..be9b179d66d4 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -137,10 +137,10 @@ RecentDocsView::RecentDocsView(std::unique_ptr<weld::ScrolledWindow> xWindow, st
setItemMaxTextLength( 30 );
setItemDimensions( mnItemMaxSize, mnItemMaxSize, gnTextHeight, gnItemPadding );
- maFillColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsBackgroundColor::get());
- maTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsTextColor::get());
- maHighlightColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightColor::get());
- maHighlightTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightTextColor::get());
+ maFillColor = Color(ColorTransparency, officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsBackgroundColor::get());
+ maTextColor = Color(ColorTransparency, officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsTextColor::get());
+ maHighlightColor = Color(ColorTransparency, officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightColor::get());
+ maHighlightTextColor = Color(ColorTransparency, officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightTextColor::get());
mfHighlightTransparence = 0.25;
UpdateColors();
diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx
index f92309c93389..da174413e578 100644
--- a/sfx2/source/control/templatedefaultview.cxx
+++ b/sfx2/source/control/templatedefaultview.cxx
@@ -31,10 +31,10 @@ TemplateDefaultView::TemplateDefaultView(std::unique_ptr<weld::ScrolledWindow> x
updateThumbnailDimensions(nItemMaxSize);
// startcenter specific settings
- maFillColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsBackgroundColor::get());
- maTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsTextColor::get());
- maHighlightColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightColor::get());
- maHighlightTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightTextColor::get());
+ maFillColor = Color(ColorTransparency, officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsBackgroundColor::get());
+ maTextColor = Color(ColorTransparency, officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsTextColor::get());
+ maHighlightColor = Color(ColorTransparency, officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightColor::get());
+ maHighlightTextColor = Color(ColorTransparency, officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightTextColor::get());
mfHighlightTransparence = 0.25;
UpdateColors();
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index 140d203a495a..6ad2b891657c 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -744,11 +744,9 @@ void Theme::ProcessNewValue (
}
case PT_Color:
{
- sal_Int32 nColorValue (0);
+ Color nColorValue;
if (rValue >>= nColorValue)
- {
- maColors[nIndex] = Color(nColorValue);
- }
+ maColors[nIndex] = nColorValue;
break;
}
case PT_Integer:
diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx
index cc295cc5fe28..cb485a531ac8 100644
--- a/starmath/inc/token.hxx
+++ b/starmath/inc/token.hxx
@@ -200,7 +200,7 @@ struct SmColorTokenTableEntry
: pIdent(name)
, cIdent(codename)
, eType(ctype)
- , cColor(ncolor)
+ , cColor(ColorTransparency, ncolor)
{
}
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 8416dc7ba6c3..de7216f30bc7 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -1159,7 +1159,7 @@ void SmXMLExport::ExportFont(const SmNode* pNode, int nLevel)
sStrBuf.append('#');
std::unique_ptr<SmColorTokenTableEntry> aSmColorTokenTableEntry;
nc = pNode->GetToken().aText.toUInt32(16);
- sStrBuf.append(Color(nc).AsRGBHEXString());
+ sStrBuf.append(Color(ColorTransparency, nc).AsRGBHEXString());
OUString ssStr(sStrBuf.makeStringAndClear());
AddAttribute(XML_NAMESPACE_MATH, XML_MATHCOLOR, ssStr);
}
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 9ab23e172d8d..f6fc8f0aed10 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -1632,7 +1632,7 @@ void SmFontNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
case TICONICCOL :
case THEX :
nc = GetToken().aText.toUInt32(16);
- SetColor(Color(nc));
+ SetColor(Color(ColorTransparency, nc));
break;
default:
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index bbb2f3ba1cfc..6a17045de74a 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -225,9 +225,9 @@ void ColorConfig_Impl::Load(const OUString& rScheme)
{
if(pColors[nIndex].hasValue())
{
- sal_Int32 nTmp(0);
+ Color nTmp;
pColors[nIndex] >>= nTmp;
- m_aConfigValues[i].nColor = Color(nTmp);
+ m_aConfigValues[i].nColor = nTmp;
}
else
m_aConfigValues[i].nColor = COL_AUTO;
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 18a2ab4a00a7..f975ee9fc8af 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -332,18 +332,18 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() :
case PROPERTYHANDLE_STRIPE_COLOR_A:
{
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" );
- sal_Int32 nValue = 0;
+ Color nValue;
seqValues[nProperty] >>= nValue;
- m_bStripeColorA = Color(nValue);
+ m_bStripeColorA = nValue;
}
break;
case PROPERTYHANDLE_STRIPE_COLOR_B:
{
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" );
- sal_Int32 nValue = 0;
+ Color nValue;
seqValues[nProperty] >>= nValue;
- m_bStripeColorB = Color(nValue);
+ m_bStripeColorB = nValue;
}
break;
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index f069cad74cc9..96f3722b994c 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -653,7 +653,7 @@ namespace svt::table
{
::std::vector< ::Color > aColors( aAPIColors.getLength() );
std::transform(aAPIColors.begin(), aAPIColors.end(), aColors.begin(),
- [](const css::util::Color& rAPIColor) -> ::Color { return Color(rAPIColor); });
+ [](const css::util::Color& rAPIColor) -> ::Color { return Color(ColorTransparency, rAPIColor); });
m_aRowColors = aColors;
}
}
diff --git a/svx/source/dialog/hexcolorcontrol.cxx b/svx/source/dialog/hexcolorcontrol.cxx
index 3a559e889710..ff9b10ca8da8 100644
--- a/svx/source/dialog/hexcolorcontrol.cxx
+++ b/svx/source/dialog/hexcolorcontrol.cxx
@@ -84,7 +84,7 @@ Color HexColorControl::GetColor() const
m_xEntry->set_message_type(nColor != -1 ? weld::EntryMessageType::Normal
: weld::EntryMessageType::Error);
- return Color(nColor);
+ return Color(ColorTransparency, nColor);
}
IMPL_STATIC_LINK(HexColorControl, ImplProcessInputHdl, OUString&, rTest, bool)
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index b74a31cec7d9..164aee16dc24 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1785,7 +1785,7 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value)
if ( PropertyName == FM_PROP_TEXTLINECOLOR )
{
- ::Color aTextLineColor( bVoid ? COL_TRANSPARENT : ::Color(::comphelper::getINT32( Value )) );
+ ::Color aTextLineColor( bVoid ? COL_TRANSPARENT : ::Color(ColorTransparency, ::comphelper::getINT32( Value )) );
if (bVoid)
{
pGrid->SetTextLineColor();
@@ -1846,7 +1846,7 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value)
if (bVoid)
pGrid->SetCursorColor(COL_TRANSPARENT);
else
- pGrid->SetCursorColor( ::Color(::comphelper::getINT32(Value)));
+ pGrid->SetCursorColor( ::Color(ColorTransparency, ::comphelper::getINT32(Value)));
if (isDesignMode())
pGrid->Invalidate();
}
@@ -1898,7 +1898,7 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value)
}
else
{
- ::Color aColor( ::comphelper::getINT32(Value) );
+ ::Color aColor( ColorTransparency, ::comphelper::getINT32(Value) );
pGrid->SetBackground( aColor );
pGrid->SetControlBackground( aColor );
}
@@ -1911,7 +1911,7 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value)
}
else
{
- ::Color aColor( ::comphelper::getINT32(Value) );
+ ::Color aColor( ColorTransparency, ::comphelper::getINT32(Value) );
pGrid->SetTextColor( aColor );
pGrid->SetControlForeground( aColor );
}
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index a683704d41a1..43c332a68029 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -280,7 +280,7 @@ SdrItemPool::SdrItemPool(
rPoolDefaults[ SDRATTR_3DSCENE_DISTANCE - SDRATTR_START ] = new SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, 100);
rPoolDefaults[ SDRATTR_3DSCENE_FOCAL_LENGTH - SDRATTR_START ] = new SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, 100);
rPoolDefaults[ SDRATTR_3DSCENE_TWO_SIDED_LIGHTING - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, false);
- rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_1 - SDRATTR_START ] = new SvxColorItem(Color(0xffcccccc), SDRATTR_3DSCENE_LIGHTCOLOR_1);
+ rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_1 - SDRATTR_START ] = new SvxColorItem(Color(ColorTransparency, 0xffcccccc), SDRATTR_3DSCENE_LIGHTCOLOR_1);
rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_2 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_2);
rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_3 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_3);
rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_4 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_4);
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index f3630cc492aa..4084dffc993c 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -135,7 +135,7 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
int nIx = 1;
for (int i = 0; i < CustomColorList.getLength(); ++i)
{
- Color aColor(CustomColorList[i]);
+ Color aColor(ColorTransparency, CustomColorList[i]);
rColorSet.InsertItem(nIx, aColor, CustomColorNameList[i]);
++nIx;
}
@@ -169,7 +169,7 @@ void PaletteManager::ReloadRecentColorSet(SvxColorValueSet& rColorSet)
const bool bHasColorNames = Colorlist.getLength() == ColorNamelist.getLength();
for (int i = 0; i < Colorlist.getLength(); ++i)
{
- Color aColor(Colorlist[i]);
+ Color aColor(ColorTransparency, Colorlist[i]);
OUString sColorName = bHasColorNames ? ColorNamelist[i] : ("#" + aColor.AsRGBHexString().toAsciiUpperCase());
maRecentColors.emplace_back(aColor, sColorName);
rColorSet.InsertItem(nIx, aColor, sColorName);
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index acd7d6aac958..39d861327aa8 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -485,7 +485,7 @@ std::unique_ptr<XPropertyEntry> SvxUnoXHatchTable::createEntry(const OUString& r
XHatch aXHatch;
aXHatch.SetHatchStyle( aUnoHatch.Style );
- aXHatch.SetColor( Color(aUnoHatch.Color) );
+ aXHatch.SetColor( Color(ColorTransparency, aUnoHatch.Color) );
aXHatch.SetDistance( aUnoHatch.Distance );
aXHatch.SetAngle( Degree10(aUnoHatch.Angle) );
@@ -564,8 +564,8 @@ std::unique_ptr<XPropertyEntry> SvxUnoXGradientTable::createEntry(const OUString
XGradient aXGradient;
aXGradient.SetGradientStyle( aGradient.Style );
- aXGradient.SetStartColor( Color(aGradient.StartColor) );
- aXGradient.SetEndColor( Color(aGradient.EndColor) );
+ aXGradient.SetStartColor( Color(ColorTransparency, aGradient.StartColor) );
+ aXGradient.SetEndColor( Color(ColorTransparency, aGradient.EndColor) );
aXGradient.SetAngle( Degree10(aGradient.Angle) );
aXGradient.SetBorder( aGradient.Border );
aXGradient.SetXOffset( aGradient.XOffset );
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 79ee53600f63..8efd50c25418 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -307,9 +307,9 @@ bool XColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
bool XColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
{
- sal_Int32 nValue = 0;
+ Color nValue;
rVal >>= nValue;
- SetColorValue( Color(nValue) );
+ SetColorValue( nValue );
return true;
}
@@ -978,7 +978,7 @@ bool XLineColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*
if(!(rVal >>= nValue))
return false;
- SetColorValue( Color(nValue) );
+ SetColorValue( Color(ColorTransparency, nValue) );
return true;
}
@@ -1901,11 +1901,11 @@ bool XFillColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) c
bool XFillColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
{
- sal_Int32 nValue = 0;
+ Color nValue;
if(!(rVal >>= nValue ))
return false;
- SetColorValue( Color(nValue) );
+ SetColorValue( nValue );
return true;
}
@@ -2021,8 +2021,8 @@ namespace
{
XGradient aGradient;
- aGradient.SetStartColor(rMap["startcolor"].toInt32(16));
- aGradient.SetEndColor(rMap["endcolor"].toInt32(16));
+ aGradient.SetStartColor(Color(ColorTransparency, rMap["startcolor"].toInt32(16)));
+ aGradient.SetEndColor(Color(ColorTransparency, rMap["endcolor"].toInt32(16)));
aGradient.SetGradientStyle(lcl_getStyleFromString(rMap["style"]));
aGradient.SetAngle(Degree10(rMap["angle"].toInt32()));
@@ -2284,8 +2284,8 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId
XGradient aXGradient;
aXGradient.SetGradientStyle( aGradient2.Style );
- aXGradient.SetStartColor( Color(aGradient2.StartColor) );
- aXGradient.SetEndColor( Color(aGradient2.EndColor) );
+ aXGradient.SetStartColor( Color(ColorTransparency, aGradient2.StartColor) );
+ aXGradient.SetEndColor( Color(ColorTransparency, aGradient2.EndColor) );
aXGradient.SetAngle( Degree10(aGradient2.Angle) );
aXGradient.SetBorder( aGradient2.Border );
aXGradient.SetXOffset( aGradient2.XOffset );
@@ -2321,8 +2321,8 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId
XGradient aXGradient;
aXGradient.SetGradientStyle( aGradient2.Style );
- aXGradient.SetStartColor( Color(aGradient2.StartColor) );
- aXGradient.SetEndColor( Color(aGradient2.EndColor) );
+ aXGradient.SetStartColor( Color(ColorTransparency, aGradient2.StartColor) );
+ aXGradient.SetEndColor( Color(ColorTransparency, aGradient2.EndColor) );
aXGradient.SetAngle( Degree10(aGradient2.Angle) );
aXGradient.SetBorder( aGradient2.Border );
aXGradient.SetXOffset( aGradient2.XOffset );
@@ -2338,16 +2338,16 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId
case MID_GRADIENT_STARTCOLOR:
case MID_GRADIENT_ENDCOLOR:
{
- sal_Int32 nVal = 0;
+ Color nVal;
if(!(rVal >>= nVal ))
return false;
XGradient aXGradient = GetGradientValue();
if ( nMemberId == MID_GRADIENT_STARTCOLOR )
- aXGradient.SetStartColor( Color(nVal) );
+ aXGradient.SetStartColor( nVal );
else
- aXGradient.SetEndColor( Color(nVal) );
+ aXGradient.SetEndColor( nVal );
SetGradientValue( aXGradient );
break;
}
@@ -2708,7 +2708,7 @@ bool XFillHatchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
if ( bHatch )
{
aHatch.SetHatchStyle( aUnoHatch.Style );
- aHatch.SetColor( Color(aUnoHatch.Color) );
+ aHatch.SetColor( Color(ColorTransparency, aUnoHatch.Color) );
aHatch.SetDistance( aUnoHatch.Distance );
aHatch.SetAngle( Degree10(aUnoHatch.Angle) );
}
@@ -2726,7 +2726,7 @@ bool XFillHatchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
return false;
aHatch.SetHatchStyle( aUnoHatch.Style );
- aHatch.SetColor( Color(aUnoHatch.Color) );
+ aHatch.SetColor( Color(ColorTransparency, aUnoHatch.Color) );
aHatch.SetDistance( aUnoHatch.Distance );
aHatch.SetAngle( Degree10(aUnoHatch.Angle) );
break;
@@ -2759,7 +2759,7 @@ bool XFillHatchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
return false;
if ( nMemberId == MID_HATCH_COLOR )
- aHatch.SetColor( Color(nVal) );
+ aHatch.SetColor( Color(ColorTransparency, nVal) );
else if ( nMemberId == MID_HATCH_DISTANCE )
aHatch.SetDistance( nVal );
else
diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx
index 3fe4947f2b03..67e963ce92a6 100644
--- a/svx/source/xoutdev/xtabcolr.cxx
+++ b/svx/source/xoutdev/xtabcolr.cxx
@@ -118,7 +118,7 @@ bool XColorList::Create()
for(b = 0; b < nNumColorsInGroup; b++)
{
- Insert( std::make_unique<XColorEntry>( Color(aStdCol[nOffset + b]), aStrCol[b] + aSuffix ) );
+ Insert( std::make_unique<XColorEntry>( Color(ColorTransparency, aStdCol[nOffset + b]), aStrCol[b] + aSuffix ) );
}
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 8569a93b29cd..936c7d03d348 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -51,9 +51,9 @@ protected:
DECLARE_OOXMLEXPORT_TEST(testTdf57589_hashColor, "tdf57589_hashColor.docx")
{
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle"));
- CPPUNIT_ASSERT_EQUAL(COL_LIGHTMAGENTA, Color(getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_LIGHTMAGENTA, Color(ColorTransparency, getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor")));
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getParagraph(2), "FillStyle"));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(getParagraph(2), "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(getParagraph(2), "ParaBackColor")));
}
DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAuto, "tdf90906_colAuto.docx")
@@ -65,7 +65,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAuto, "tdf90906_colAuto.docx")
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(getRun(xPara, 1, "Nazwa"), "CharBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(getRun(xPara, 1, "Nazwa"), "CharBackColor")));
}
DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAutoB, "tdf90906_colAutoB.docx")
@@ -75,23 +75,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAutoB, "tdf90906_colAutoB.docx")
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
uno::Reference<table::XCell> xCell = xTable->getCellByName("A1");
- CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, Color(getProperty<sal_uInt32>(xCell, "BackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor")));
xCell.set(xTable->getCellByName("A2"));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xCell, "BackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor")));
xCell.set(xTable->getCellByName("B1"));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xCell, "BackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor")));
xCell.set(xTable->getCellByName("B2"));
- CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, Color(getProperty<sal_uInt32>(xCell, "BackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor")));
uno::Reference<text::XTextRange> xText(getParagraph(2, "Paragraphs too"));
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle"));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xText, "ParaBackColor")));
}
DECLARE_OOXMLEXPORT_TEST(testTdf92524_autoColor, "tdf92524_autoColor.doc")
{
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle"));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor")));
}
DECLARE_OOXMLEXPORT_TEST(testTdf116436_rowFill, "tdf116436_rowFill.odt")
@@ -1323,7 +1323,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123189_tableBackground, "table-black_fill.docx")
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
uno::Reference<table::XCell> xCell = xTable->getCellByName("A1");
- CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, Color(getProperty<sal_uInt32>(xCell, "BackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor")));
}
DECLARE_OOXMLEXPORT_TEST(testTdf116084, "tdf116084.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 857f27ee636d..aa1378398992 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -1077,7 +1077,7 @@ DECLARE_OOXMLEXPORT_TEST(testParaShadow, "para-shadow.docx")
{
// The problem was that in w:pBdr, child elements had a w:shadow attribute, but that was ignored.
table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(getParagraph(2), "ParaShadowFormat");
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color));
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color));
CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
// w:sz="48" is in eights of a point, 1 pt is 20 twips.
CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(24/8*20)), aShadow.ShadowWidth);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index a7cca71375f3..5d973cc0551e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -133,7 +133,7 @@ DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt")
width: any -> border width */
{
const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat");
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color));
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color));
CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
}
@@ -143,7 +143,7 @@ DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt")
{
uno::Reference<beans::XPropertySet> xMiddleRun(getRun(getParagraph(2),2), uno::UNO_QUERY);
const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xMiddleRun, "CharShadowFormat");
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color));
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color));
CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 3a099e4a5df9..f11b7d8ae140 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -1012,7 +1012,7 @@ DECLARE_OOXMLEXPORT_TEST(testPageBorderShadow, "page-border-shadow.docx")
{
// The problem was that in w:pgBorders, child elements had a w:shadow attribute, but that was ignored.
table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(getStyles("PageStyles")->getByName("Standard"), "ShadowFormat");
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color));
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color));
CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
// w:sz="48" is in eights of a point, 1 pt is 20 twips.
CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(48/8*20)), aShadow.ShadowWidth);
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 9cd64eebf6f6..737821f73286 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -690,7 +690,7 @@ DECLARE_RTFEXPORT_TEST(testParaShadow, "para-shadow.rtf")
// The problem was that \brdrsh was ignored.
table::ShadowFormat aShadow
= getProperty<table::ShadowFormat>(getParagraph(2), "ParaShadowFormat");
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color));
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color));
CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(60)), aShadow.ShadowWidth);
}
@@ -733,7 +733,7 @@ DECLARE_RTFEXPORT_TEST(testCharacterBorder, "charborder.odt")
{
const table::ShadowFormat aShadow
= getProperty<table::ShadowFormat>(xRun, "CharShadowFormat");
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color));
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color));
CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
}
diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx
index 62154c0eaaca..d34e8cb5a969 100644
--- a/sw/qa/extras/rtfexport/rtfexport2.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport2.cxx
@@ -922,7 +922,8 @@ DECLARE_RTFEXPORT_TEST(testDoDhgtOld, "do-dhgt-old.rtf")
xShape.set(getShape(2), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xShape, "ZOrder"));
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(getProperty<sal_uInt32>(xShape, "FillColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK,
+ Color(ColorTransparency, getProperty<sal_uInt32>(xShape, "FillColor")));
xShape.set(getShape(3), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xShape, "ZOrder"));
@@ -935,7 +936,8 @@ DECLARE_RTFEXPORT_TEST(testFdo61909, "fdo61909.rtf")
// Was the Writer default font.
CPPUNIT_ASSERT_EQUAL(OUString("Courier New"),
getProperty<OUString>(xTextRange, "CharFontName"));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xTextRange, "CharBackColor")));
+ CPPUNIT_ASSERT_EQUAL(
+ COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xTextRange, "CharBackColor")));
}
DECLARE_RTFEXPORT_TEST(testFdo62288, "fdo62288.rtf")
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 55eb4a2b8c48..cf9a25e40d7c 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -275,7 +275,7 @@ DECLARE_RTFEXPORT_TEST(testTdf129631_lostBorders, "tdf129631_lostBorders.rtf")
CPPUNIT_ASSERT(sal_uInt32(0) != aBorderLine.LineWidth);
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"The border style has normal black borders", COL_BLACK,
- Color(getProperty<table::BorderLine>(xStyleProps, "RightBorder").Color));
+ Color(ColorTransparency, getProperty<table::BorderLine>(xStyleProps, "RightBorder").Color));
aBorderLine = getProperty<table::BorderLine2>(getParagraph(2), "RightBorder");
CPPUNIT_ASSERT(sal_uInt32(0) != aBorderLine.LineWidth);
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 3857cd895422..333b26b5230e 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -892,7 +892,7 @@ DECLARE_WW8EXPORT_TEST(testFdo45724, "fdo45724.odt")
// The text and background color of the control shape was not correct.
uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
uno::Reference<form::validation::XValidatableFormComponent> xComponent(xControlShape->getControl(), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(getProperty<sal_uInt32>(xComponent, "BackgroundColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(ColorTransparency, getProperty<sal_uInt32>(xComponent, "BackgroundColor")));
CPPUNIT_ASSERT_EQUAL(OUString("xxx"), xComponent->getCurrentValue().get<OUString>());
}
@@ -1015,7 +1015,7 @@ DECLARE_WW8EXPORT_TEST(testCharacterBorder, "charborder.odt")
width: any -> border width */
{
const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat");
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color));
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color));
CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location);
CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth);
}
@@ -1556,7 +1556,7 @@ DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt")
uno::Reference<beans::XPropertySet> xStyle(
getStyles("CharacterStyles")->getByName(charStyleName),
uno::UNO_QUERY);
- Color charColor(getProperty<util::Color>(xStyle, "CharColor"));
+ Color charColor(ColorTransparency, getProperty<util::Color>(xStyle, "CharColor"));
CPPUNIT_ASSERT_EQUAL(sal_uInt32(COL_AUTO), sal_uInt32(charColor));
}
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 5bb4d752cd41..b8e2117d4d6e 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -361,10 +361,10 @@ DECLARE_WW8EXPORT_TEST(testTdf134948, "tdf134948.odt")
DECLARE_WW8EXPORT_TEST(testTdf132726, "tdf132726.odt")
{
uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 1, "What sentence has a yellow background? ");
- CPPUNIT_ASSERT_EQUAL( COL_AUTO, Color(getProperty<sal_uInt32>(xRun, "CharBackColor")) );
+ CPPUNIT_ASSERT_EQUAL( COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xRun, "CharBackColor")) );
xRun = getRun(getParagraph(1), 2, "Why, this sentence of course");
- CPPUNIT_ASSERT_EQUAL( COL_YELLOW, Color(getProperty<sal_uInt32>(xRun, "CharBackColor")) );
+ CPPUNIT_ASSERT_EQUAL( COL_YELLOW, Color(ColorTransparency, getProperty<sal_uInt32>(xRun, "CharBackColor")) );
}
DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement, "tdf127316_autoEscapement.odt")
@@ -409,18 +409,18 @@ DECLARE_WW8EXPORT_TEST(testTdf133453_realFontSize, "tdf133453_realFontSize.doc")
DECLARE_WW8EXPORT_TEST(testTdf116194, "tdf116194.doc")
{
- CPPUNIT_ASSERT_EQUAL( Color(192,0,0), Color(getProperty<sal_uInt32>(getRun(getParagraph(1), 1), "CharColor")) );
+ CPPUNIT_ASSERT_EQUAL( Color(192,0,0), Color(ColorTransparency, getProperty<sal_uInt32>(getRun(getParagraph(1), 1), "CharColor")) );
}
DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.docx")
{
uno::Reference<beans::XPropertySet> xStyle(getStyles("ParagraphStyles")->getByName("Numbering - First level"),
uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(Color(184,204,228), Color(getProperty<sal_uInt32>(xStyle, "ParaBackColor")));//R:184 G:204 B:228
+ CPPUNIT_ASSERT_EQUAL(Color(184,204,228), Color(ColorTransparency, getProperty<sal_uInt32>(xStyle, "ParaBackColor")));//R:184 G:204 B:228
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
uno::Reference<text::XTextRange> xText(getParagraph(12));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xText, "ParaBackColor")));
CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle"));
}
@@ -428,7 +428,7 @@ DECLARE_WW8EXPORT_TEST(testTdf128608_fillStyleNoneB, "tdf128608_fillStyleNoneB.o
{
CPPUNIT_ASSERT_EQUAL(1, getPages());
uno::Reference<text::XTextRange> xText(getParagraph(1));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xText, "ParaBackColor")));
CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle"));
}
@@ -463,7 +463,7 @@ DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc
{
uno::Reference<text::XTextRange> xText(getParagraph(12));
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle"));
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xText, "ParaBackColor")));
}
DECLARE_WW8EXPORT_TEST(testTdf127862_pageFillStyle, "tdf127862_pageFillStyle.odt")
@@ -484,7 +484,7 @@ DECLARE_WW8EXPORT_TEST(testTdf128608_tableParaBackColor, "tdf128608_tableParaBac
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
// ParaBackColor doesn't seem to be used in this case, but keep it here to make sure it stays as AUTO.
- CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xPara, "ParaBackColor")));
+ CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xPara, "ParaBackColor")));
// No paragraph background colour/fill. (The cell background colour should be used.)
CPPUNIT_ASSERT_EQUAL_MESSAGE("No fillstyle", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xPara, "FillStyle"));
}
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index b8dc54b69ccf..82589ef9f715 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -343,7 +343,7 @@ private:
uno::Reference<text::XTextContent> const& xParagraph,
const SwTextNode* pTextNode)
{
- sal_Int32 nParaBackColor(COL_AUTO);
+ Color nParaBackColor(COL_AUTO);
uno::Reference<beans::XPropertySet> xParagraphProperties(xParagraph, uno::UNO_QUERY);
if (!(xParagraphProperties->getPropertyValue("ParaBackColor") >>= nParaBackColor))
{
@@ -362,7 +362,7 @@ private:
SAL_WARN("sw.a11y", "CharColor void");
return;
}
- Color aForegroundColor(nCharColor);
+ Color aForegroundColor(ColorTransparency, nCharColor);
if (aForegroundColor == COL_AUTO)
return;
@@ -381,7 +381,7 @@ private:
aPageBackground = rXFillColorItem->GetColorValue();
}
- sal_Int32 nCharBackColor(COL_AUTO);
+ Color nCharBackColor(COL_AUTO);
if (!(xProperties->getPropertyValue("CharBackColor") >>= nCharBackColor))
{
@@ -394,7 +394,7 @@ private:
// If not character background color, try paragraph background color
if (aBackgroundColor == COL_AUTO)
- aBackgroundColor = Color(nParaBackColor);
+ aBackgroundColor = nParaBackColor;
// If not paragraph background color, try page color
if (aBackgroundColor == COL_AUTO)
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index 9d2aa207cfc8..206dd51b5784 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -419,7 +419,7 @@ sal_Int32 SAL_CALL SwAccessibleCell::getBackground()
uno::Reference<XAccessibleComponent> xComponentDoc(xAccDoc, uno::UNO_QUERY);
if (xComponentDoc.is())
{
- crBack = Color(xComponentDoc->getBackground());
+ crBack = Color(ColorTransparency, xComponentDoc->getBackground());
}
}
}
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 29bd4be8a1e0..05cd3f4e2bc4 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1917,7 +1917,7 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
{
uno::Any &anyChar = rValue.Value;
sal_uInt32 crBack = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
- if (COL_AUTO == Color(crBack))
+ if (COL_AUTO == Color(ColorTransparency, crBack))
{
uno::Reference<XAccessibleComponent> xComponent(this);
if (xComponent.is())
@@ -1937,12 +1937,12 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
uno::Any &anyChar = rValue.Value;
sal_uInt32 crChar = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
- if( COL_AUTO == Color(crChar) )
+ if( COL_AUTO == Color(ColorTransparency, crChar) )
{
uno::Reference<XAccessibleComponent> xComponent(this);
if (xComponent.is())
{
- Color cr(xComponent->getBackground());
+ Color cr(ColorTransparency, xComponent->getBackground());
crChar = sal_uInt32(cr.IsDark() ? COL_WHITE : COL_BLACK);
rValue.Value <<= crChar;
}
@@ -1993,12 +1993,12 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
uno::Any &anyChar = rValue.Value;
sal_uInt32 crUnderline = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
- if ( COL_AUTO == Color(crUnderline) )
+ if ( COL_AUTO == Color(ColorTransparency, crUnderline) )
{
uno::Reference<XAccessibleComponent> xComponent(this);
if (xComponent.is())
{
- Color cr(xComponent->getBackground());
+ Color cr(ColorTransparency, xComponent->getBackground());
crUnderline = sal_uInt32(cr.IsDark() ? COL_WHITE : COL_BLACK);
rValue.Value <<= crUnderline;
}
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index c9de6594f484..679b23fc9d37 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -1496,7 +1496,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getBackground()
uno::Reference<XAccessibleComponent> xComponentDoc(xAccDoc,uno::UNO_QUERY);
if (xComponentDoc.is())
{
- crBack = Color(xComponentDoc->getBackground());
+ crBack = Color(ColorTransparency, xComponentDoc->getBackground());
}
}
}
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index ac1e2a4db165..dcd8503ef6aa 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -94,11 +94,11 @@ private:
if (xPropertyBag.is())
{
css::uno::Any aLineColor = xPropertyBag->getValue("LineColor");
- css::util::Color lineColor = 0;
+ ::Color lineColor;
if (aLineColor >>= lineColor)
{
- return Color( lineColor );
+ return lineColor;
}
}
}
@@ -160,11 +160,11 @@ private:
if (xPropertyBag.is())
{
css::uno::Any aLineColor = xPropertyBag->getValue("LineColor");
- css::util::Color lineColor = 0;
+ ::Color lineColor;
if (aLineColor >>= lineColor)
{
- return Color( lineColor );
+ return lineColor;
}
}
}
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index ebddb8ebab27..0ec7d5cd6362 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2257,10 +2257,10 @@ bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
case MID_GRID_COLOR:
{
- sal_Int32 nTmp = 0;
+ Color nTmp;
bRet = (rVal >>= nTmp);
if( bRet )
- SetColor( Color(nTmp) );
+ SetColor( nTmp );
}
break;
case MID_GRID_LINES:
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 90f8894bc08a..132a43a55a62 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -171,7 +171,7 @@ namespace
static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine)
{
- rSvxLine.SetColor(Color(rLine.Color));
+ rSvxLine.SetColor(Color(ColorTransparency, rLine.Color));
rSvxLine.GuessLinesWidths( SvxBorderLineStyle::NONE,
convertMm100ToTwip( rLine.OuterLineWidth ),
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 2e99b3d770b2..91262fac3763 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -1049,7 +1049,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
aTmp = xPropSet->getPropertyValue( "BackgroundColor" );
if( auto n = o3tl::tryAccess<sal_Int32>(aTmp) )
{
- Color aCol(*n);
+ Color aCol(ColorTransparency, *n);
aItemSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ) );
}
}
@@ -1058,7 +1058,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
aTmp = xPropSet->getPropertyValue( "TextColor" );
if( auto n = o3tl::tryAccess<sal_Int32>(aTmp) )
{
- Color aColor( *n );
+ Color aColor( ColorTransparency, *n );
aItemSet.Put( SvxColorItem( aColor, RES_CHRATR_COLOR ) );
}
}
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index 6a699d6c0674..6c16d3c139ef 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -193,7 +193,7 @@ const SvxBrushItem *SwWriteTable::GetLineBrush( const SwTableBox *pBox,
void SwWriteTable::MergeBorders( const SvxBorderLine* pBorderLine,
bool bTable )
{
- if( Color(0xffffffff) == m_nBorderColor )
+ if( Color(ColorTransparency, 0xffffffff) == m_nBorderColor )
{
if( !pBorderLine->GetColor().IsRGBEqual( COL_GRAY ) )
m_nBorderColor = pBorderLine->GetColor();
@@ -730,7 +730,7 @@ void SwWriteTable::FillTableRowsCols( tools::Long nStartRPos, sal_uInt16 nStartR
SwWriteTable::SwWriteTable(const SwTable* pTable, const SwTableLines& rLines, tools::Long nWidth,
sal_uInt32 nBWidth, bool bRel, sal_uInt16 nMaxDepth, sal_uInt16 nLSub, sal_uInt16 nRSub, sal_uInt32 nNumOfRowsToRepeat)
- : m_pTable(pTable), m_nBorderColor(sal_uInt32(-1)), m_nCellSpacing(0), m_nCellPadding(0), m_nBorder(0),
+ : m_pTable(pTable), m_nBorderColor(ColorTransparency, sal_uInt32(-1)), m_nCellSpacing(0), m_nCellPadding(0), m_nBorder(0),
m_nInnerBorder(0), m_nBaseWidth(nBWidth), m_nHeadEndRow(USHRT_MAX),
m_nLeftSub(nLSub), m_nRightSub(nRSub), m_nTabWidth(nWidth), m_bRelWidths(bRel),
m_bUseLayoutHeights(true),
@@ -763,7 +763,7 @@ SwWriteTable::SwWriteTable(const SwTable* pTable, const SwTableLines& rLines, to
}
SwWriteTable::SwWriteTable(const SwTable* pTable, const SwHTMLTableLayout *pLayoutInfo)
- : m_pTable(pTable), m_nBorderColor(sal_uInt32(-1)), m_nCellSpacing(0), m_nCellPadding(0), m_nBorder(0),
+ : m_pTable(pTable), m_nBorderColor(ColorTransparency, sal_uInt32(-1)), m_nCellSpacing(0), m_nCellPadding(0), m_nBorder(0),
m_nInnerBorder(0), m_nBaseWidth(pLayoutInfo->GetWidthOption()), m_nHeadEndRow(0),
m_nLeftSub(0), m_nRightSub(0), m_nTabWidth(pLayoutInfo->GetWidthOption()),
m_bRelWidths(pLayoutInfo->HasPercentWidthOption()), m_bUseLayoutHeights(false),
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 29da55150a6a..991f6335539b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3355,7 +3355,7 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT
// no need to write them.
if( rStyleProps != nullptr && pBorderLine && !pBorderLine->isEmpty() &&
pBorderLine->GetBorderLineStyle() == static_cast<SvxBorderLineStyle>(rStyleProps->LineStyle) &&
- pBorderLine->GetColor() == Color(rStyleProps->Color) &&
+ pBorderLine->GetColor() == Color(ColorTransparency, rStyleProps->Color) &&
pBorderLine->GetWidth() == convertMm100ToTwip( rStyleProps->LineWidth ) )
return;
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index b79641c5372a..aedca139434b 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -524,8 +524,8 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const ww8::Frame &rFly,
{
WW8_BRCVer9 aBrc90 = WW8Export::TranslateBorderLine( *pLn,
pBox->GetDistance( i ), bShadow );
- sal_uInt8 ico = msfilter::util::TransColToIco(msfilter::util::BGRToRGB(
- aBrc90.cv()));
+ sal_uInt8 ico = msfilter::util::TransColToIco(Color(ColorTransparency, msfilter::util::BGRToRGB(
+ aBrc90.cv())));
aBrc = WW8_BRC(aBrc90.dptLineWidth(), aBrc90.brcType(), ico,
aBrc90.dptSpace(), aBrc90.fShadow(), aBrc90.fFrame());
}
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index e6501dc34ca3..2d5ae8d3a31a 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4408,7 +4408,7 @@ void WW8Export::Out_BorderLine(ww::bytes& rO, const SvxBorderLine* pLine,
if( pLine && pLine->GetBorderLineStyle() != SvxBorderLineStyle::NONE )
{
aBrcVer9 = TranslateBorderLine( *pLine, nDist, bShadow );
- sal_uInt8 ico = msfilter::util::TransColToIco( msfilter::util::BGRToRGB(aBrcVer9.cv()) );
+ sal_uInt8 ico = msfilter::util::TransColToIco( Color(ColorTransparency, msfilter::util::BGRToRGB(aBrcVer9.cv())) );
aBrcVer8 = WW8_BRC( aBrcVer9.dptLineWidth(), aBrcVer9.brcType(), ico,
aBrcVer9.dptSpace(), aBrcVer9.fShadow(), aBrcVer9.fFrame() );
}
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 762ea0c81869..e717e797a2a9 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -1458,7 +1458,7 @@ static void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace,
aLine.SetWidth(fConverted);
//No AUTO for borders as yet, so if AUTO, use BLACK
- Color col = (cv==0xff000000) ? COL_BLACK : msfilter::util::BGRToRGB(cv);
+ Color col = (cv==0xff000000) ? COL_BLACK : Color(ColorTransparency, msfilter::util::BGRToRGB(cv));
aLine.SetColor(col);
@@ -2631,7 +2631,7 @@ void SwWW8ImplReader::StopApo()
if (nNewWidth)
m_xSFlyPara->BoxUpWidth(nNewWidth);
- Color aBg(0xFE, 0xFF, 0xFF, 0xFF); //Transparent by default
+ Color aBg(ColorTransparency, 0xFE, 0xFF, 0xFF, 0xFF); //Transparent by default
SwTextNode* pNd = aPref.GetNode().GetTextNode();
SwTextNode* pJoinNext = nullptr;
@@ -3600,7 +3600,7 @@ void SwWW8ImplReader::Read_TextForeColor(sal_uInt16, const sal_uInt8* pData, sho
m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_COLOR );
else
{
- Color aColor(msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)));
+ Color aColor(ColorTransparency, msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)));
// At least when transparency is 0xff and the color is black, Word renders that as black.
if (aColor.IsTransparent() && aColor != COL_AUTO)
@@ -3634,7 +3634,7 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh
{
const SwAttrSet& aSet = m_pCurrentColl->GetAttrSet();
std::unique_ptr<SvxUnderlineItem> pUnderline(aSet.Get(RES_CHRATR_UNDERLINE, false).Clone());
- pUnderline->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) );
+ pUnderline->SetColor( Color(ColorTransparency, msfilter::util::BGRToRGB(SVBT32ToUInt32(pData))) );
m_pCurrentColl->SetFormatAttr( *pUnderline );
}
}
@@ -3646,7 +3646,7 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh
if (nLen >= 4)
{
std::unique_ptr<SvxUnderlineItem> pUnderline(m_xCurrentItemSet->Get(RES_CHRATR_UNDERLINE, false).Clone());
- pUnderline->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) );
+ pUnderline->SetColor( Color(ColorTransparency,msfilter::util::BGRToRGB(SVBT32ToUInt32(pData))) );
m_xCurrentItemSet->Put( std::move(pUnderline) );
}
}
@@ -3655,7 +3655,7 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh
{
SvxUnderlineItem* pUnderlineAttr = const_cast<SvxUnderlineItem*>(static_cast<const SvxUnderlineItem*>(m_xCtrlStck->GetOpenStackAttr( *m_pPaM->GetPoint(), RES_CHRATR_UNDERLINE )));
if (pUnderlineAttr && nLen >= 4)
- pUnderlineAttr->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32( pData ) ));
+ pUnderlineAttr->SetColor( Color(ColorTransparency, msfilter::util::BGRToRGB(SVBT32ToUInt32( pData ) )));
}
}
}
@@ -4945,15 +4945,15 @@ void SwWW8ImplReader::Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, sho
Color SwWW8ImplReader::ExtractColour(const sal_uInt8* &rpData, bool bVer67)
{
OSL_ENSURE(!bVer67, "Impossible");
- Color nFore = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData));
+ Color nFore(ColorTransparency, msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData)));
rpData+=4;
- Color nBack = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData));
+ Color nBack(ColorTransparency, msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData)));
rpData+=4;
sal_uInt16 nIndex = SVBT16ToUInt16(rpData);
rpData+=2;
//Being a transparent background colour doesn't actually show the page
//background through, it merely acts like white
- if (nBack == Color(0xFF000000))
+ if (nBack == Color(ColorTransparency, 0xFF000000))
nBack = COL_AUTO;
OSL_ENSURE(nBack == COL_AUTO || !nBack.IsTransparent(),
"ww8: don't know what to do with such a transparent bg colour, report");
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index 2d0ea2bc046d..bfb29a7af264 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -694,7 +694,7 @@ bool SvXMLImportItemMapper::PutXMLValue(
{
SvxBrushItem& rBrush = dynamic_cast<SvxBrushItem&>(rItem);
- sal_Int32 nTempColor(0);
+ Color aTempColor;
switch( nMemberId )
{
case MID_BACK_COLOR:
@@ -703,9 +703,8 @@ bool SvXMLImportItemMapper::PutXMLValue(
rBrush.GetColor().SetAlpha(0);
bOk = true;
}
- else if (::sax::Converter::convertColor(nTempColor, rValue))
+ else if (::sax::Converter::convertColor(aTempColor, rValue))
{
- Color aTempColor(nTempColor);
aTempColor.SetAlpha(255);
rBrush.SetColor( aTempColor );
bOk = true;
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index fcab21afe6d2..e916c877304d 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1258,7 +1258,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
if ( pArgs->GetItemState( SID_WATERMARK_TRANSPARENCY, false, &pItem ) == SfxItemState::SET )
aItem.SetTransparency( static_cast<const SfxInt16Item*>( pItem )->GetValue() );
if ( pArgs->GetItemState( SID_WATERMARK_COLOR, false, &pItem ) == SfxItemState::SET )
- aItem.SetColor( Color(static_cast<const SfxUInt32Item*>( pItem )->GetValue()) );
+ aItem.SetColor( Color(ColorTransparency, static_cast<const SfxUInt32Item*>( pItem )->GetValue()) );
pSh->SetWatermark( aItem );
}
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 9fc5f70f1d95..f5a9b4a201ad 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -341,13 +341,13 @@ void SwRevisionConfig::Load()
switch (nProp)
{
case 0 : lcl_ConvertCfgToAttr(nVal, m_aInsertAttr); break;
- case 1 : m_aInsertAttr.m_nColor = Color(nVal); break;
+ case 1 : m_aInsertAttr.m_nColor = Color(ColorTransparency, nVal); break;
case 2 : lcl_ConvertCfgToAttr(nVal, m_aDeletedAttr, true); break;
- case 3 : m_aDeletedAttr.m_nColor = Color(nVal); break;
+ case 3 : m_aDeletedAttr.m_nColor = Color(ColorTransparency, nVal); break;
case 4 : lcl_ConvertCfgToAttr(nVal, m_aFormatAttr); break;
- case 5 : m_aFormatAttr.m_nColor = Color(nVal); break;
+ case 5 : m_aFormatAttr.m_nColor = Color(ColorTransparency, nVal); break;
case 6 : m_nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break;
- case 7 : m_aMarkColor = Color(nVal); break;
+ case 7 : m_aMarkColor = Color(ColorTransparency, nVal); break;
}
}
}
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 1523f40c5a84..ed92f2c35ee5 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2381,7 +2381,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
}
else
{
- Color aColor(sColor.toInt32(16));
+ Color aColor(ColorTransparency, sColor.toInt32(16));
aBrushItem->SetColor(aColor);
diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx
index 114b7f33b055..47b4064642e0 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -229,7 +229,7 @@ namespace
if (sColor == "transparent")
aColor = COL_TRANSPARENT;
else
- aColor = Color(sColor.toInt32(16));
+ aColor = Color(ColorTransparency, sColor.toInt32(16));
switch (nSlot)
{
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 6350f2548b2d..7bec3a0f82d4 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -98,7 +98,7 @@ namespace
if (sColor == "transparent")
aColor = COL_TRANSPARENT;
else
- aColor = Color(sColor.toInt32(16));
+ aColor = Color(ColorTransparency, sColor.toInt32(16));
switch (nSlot)
{
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 1344ecacf894..1aae087262d0 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1187,7 +1187,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
else if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
{
OUString sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
- aSet = Color(sColor.toInt32(16));
+ aSet = Color(ColorTransparency, sColor.toInt32(16));
bHasItem = true;
}
@@ -1221,7 +1221,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
if (sColor == "transparent")
aSet = COL_TRANSPARENT;
else
- aSet = Color(sColor.toInt32(16));
+ aSet = Color(ColorTransparency, sColor.toInt32(16));
}
else if (pItem)
aSet = static_cast<const SvxColorItem*>(pItem)->GetValue();
diff --git a/sw/source/uibase/utlui/shdwcrsr.cxx b/sw/source/uibase/utlui/shdwcrsr.cxx
index dfe40700d726..72b313fb7d0d 100644
--- a/sw/source/uibase/utlui/shdwcrsr.cxx
+++ b/sw/source/uibase/utlui/shdwcrsr.cxx
@@ -74,7 +74,7 @@ void SwShadowCursor::DrawCursor( const Point& rPt, tools::Long nHeight, sal_uInt
pWin->SetMapMode(MapMode(MapUnit::MapPixel));
pWin->SetRasterOp( RasterOp::Xor );
- pWin->SetLineColor( Color( sal_uInt32(aCol) ^ sal_uInt32(COL_WHITE) ) );
+ pWin->SetLineColor( Color( ColorTransparency, sal_uInt32(aCol) ^ sal_uInt32(COL_WHITE) ) );
// 1. The Line:
pWin->DrawLine( Point( rPt.X(), rPt.Y() + 1),
diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index 65218b33aa32..6d6419090c38 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -145,7 +145,7 @@ namespace toolkit
VclPtr<vcl::Window> pWindow = i_rData.pOwningWindow->GetWindow();
AllSettings aAllSettings = pWindow->GetSettings();
StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
- (aStyleSettings.*i_pSetter)( Color(i_nColor) );
+ (aStyleSettings.*i_pSetter)( Color(ColorTransparency, i_nColor) );
aAllSettings.SetStyleSettings( aStyleSettings );
pWindow->SetSettings( aAllSettings );
}
diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx
index 54f6286b8993..3125a0341030 100644
--- a/toolkit/source/awt/vclxgraphics.cxx
+++ b/toolkit/source/awt/vclxgraphics.cxx
@@ -168,28 +168,28 @@ void VCLXGraphics::setTextColor( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
- maTextColor = Color( nColor );
+ maTextColor = Color( ColorTransparency, nColor );
}
void VCLXGraphics::setTextFillColor( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
- maTextFillColor = Color( nColor );
+ maTextFillColor = Color( ColorTransparency, nColor );
}
void VCLXGraphics::setLineColor( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
- maLineColor = Color( nColor );
+ maLineColor = Color( ColorTransparency, nColor );
}
void VCLXGraphics::setFillColor( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
- maFillColor = Color( nColor );
+ maFillColor = Color( ColorTransparency, nColor );
}
void VCLXGraphics::setRasterOp( awt::RasterOperation eROP )
@@ -436,7 +436,7 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_
return;
InitOutputDevice( InitOutDevFlags::COLORS );
- Gradient aGradient(static_cast<GradientStyle>(rGradient.Style), Color(rGradient.StartColor), Color(rGradient.EndColor));
+ Gradient aGradient(static_cast<GradientStyle>(rGradient.Style), Color(ColorTransparency, rGradient.StartColor), Color(ColorTransparency, rGradient.EndColor));
aGradient.SetAngle(Degree10(rGradient.Angle));
aGradient.SetBorder(rGradient.Border);
aGradient.SetOfsX(rGradient.XOffset);
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 18ce820ab417..1e7c15918ab4 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -1126,7 +1126,7 @@ void VCLXWindow::setBackground( sal_Int32 nColor )
if ( !GetWindow() )
return;
- Color aColor(nColor);
+ Color aColor(ColorTransparency, nColor);
GetWindow()->SetBackground( aColor );
GetWindow()->SetControlBackground( aColor );
@@ -1199,7 +1199,7 @@ void VCLXWindow::setForeground( sal_Int32 nColor )
if ( GetWindow() )
{
- GetWindow()->SetControlForeground( Color(nColor) );
+ GetWindow()->SetControlForeground( Color(ColorTransparency, nColor) );
}
}
@@ -1252,7 +1252,7 @@ namespace toolkit
AllSettings aSettings = _pWindow->GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- (aStyleSettings.*pSetter)( Color( nColor ) );
+ (aStyleSettings.*pSetter)( Color( ColorTransparency, nColor ) );
aSettings.SetStyleSettings( aStyleSettings );
_pWindow->SetSettings( aSettings, true );
@@ -1597,10 +1597,9 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
}
else
{
- sal_Int32 nColor = 0;
- if ( Value >>= nColor )
+ Color aColor;
+ if ( Value >>= aColor )
{
- Color aColor( nColor );
pWindow->SetControlBackground( aColor );
pWindow->SetBackground( aColor );
switch ( eWinType )
@@ -1627,12 +1626,11 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
}
else
{
- sal_Int32 nColor = 0;
+ Color nColor ;
if ( Value >>= nColor )
{
- Color aColor( nColor );
- pWindow->SetTextColor( aColor );
- pWindow->SetControlForeground( aColor );
+ pWindow->SetTextColor( nColor );
+ pWindow->SetControlForeground( nColor );
}
}
break;
@@ -1643,12 +1641,9 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
}
else
{
- sal_Int32 nColor = 0;
+ Color nColor;
if ( Value >>= nColor )
- {
- Color aColor( nColor );
- pWindow->SetTextLineColor( aColor );
- }
+ pWindow->SetTextLineColor( nColor );
}
break;
case BASEPROPERTY_FILLCOLOR:
@@ -1656,12 +1651,9 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
pWindow->SetFillColor();
else
{
- sal_Int32 nColor = 0;
+ Color nColor;
if ( Value >>= nColor )
- {
- Color aColor( nColor );
- pWindow->SetFillColor( aColor );
- }
+ pWindow->SetFillColor( nColor );
}
break;
case BASEPROPERTY_LINECOLOR:
@@ -1669,12 +1661,9 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
pWindow->SetLineColor();
else
{
- sal_Int32 nColor = 0;
+ Color nColor;
if ( Value >>= nColor )
- {
- Color aColor( nColor );
- pWindow->SetLineColor( aColor );
- }
+ pWindow->SetLineColor( nColor );
}
break;
case BASEPROPERTY_BORDER:
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index d7404132d545..a589db2cd3a1 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -118,20 +118,20 @@ namespace toolkit
}
else
{
- sal_Int32 nBackgroundColor = 0;
+ Color nBackgroundColor;
_rColorValue >>= nBackgroundColor;
- aStyleSettings.SetFaceColor( Color(nBackgroundColor) );
+ aStyleSettings.SetFaceColor( nBackgroundColor );
// for the real background (everything except the buttons and the thumb),
// use an average between the desired color and "white"
Color aWhite( COL_WHITE );
- Color aBackground( nBackgroundColor );
- aBackground.SetRed( ( aBackground.GetRed() + aWhite.GetRed() ) / 2 );
- aBackground.SetGreen( ( aBackground.GetGreen() + aWhite.GetGreen() ) / 2 );
- aBackground.SetBlue( ( aBackground.GetBlue() + aWhite.GetBlue() ) / 2 );
- aStyleSettings.SetCheckedColor( aBackground );
+ Color aCheckedBackground( nBackgroundColor );
+ aCheckedBackground.SetRed( ( aCheckedBackground.GetRed() + aWhite.GetRed() ) / 2 );
+ aCheckedBackground.SetGreen( ( aCheckedBackground.GetGreen() + aWhite.GetGreen() ) / 2 );
+ aCheckedBackground.SetBlue( ( aCheckedBackground.GetBlue() + aWhite.GetBlue() ) / 2 );
+ aStyleSettings.SetCheckedColor( aCheckedBackground );
- sal_Int32 nBackgroundLuminance = Color( nBackgroundColor ).GetLuminance();
+ sal_Int32 nBackgroundLuminance = nBackgroundColor.GetLuminance();
sal_Int32 nWhiteLuminance = COL_WHITE.GetLuminance();
Color aLightShadow( nBackgroundColor );
@@ -6354,7 +6354,7 @@ void VCLXProgressBar::setForegroundColor( sal_Int32 nColor )
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
- pWindow->SetControlForeground( Color(nColor) );
+ pWindow->SetControlForeground( Color(ColorTransparency, nColor) );
}
}
@@ -6365,7 +6365,7 @@ void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor )
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
- Color aColor( nColor );
+ Color aColor( ColorTransparency, nColor );
pWindow->SetBackground( aColor );
pWindow->SetControlBackground( aColor );
pWindow->Invalidate();
@@ -6450,12 +6450,9 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const css::uno:
}
else
{
- sal_Int32 nColor = 0;
+ Color nColor;
if ( Value >>= nColor )
- {
- Color aColor( nColor );
- pWindow->SetControlForeground( aColor );
- }
+ pWindow->SetControlForeground( nColor );
}
}
}
@@ -7834,9 +7831,9 @@ void SAL_CALL SVTXDateField::setProperty( const OUString& PropertyName, const cs
pSubEdit->SetTextLineColor();
else
{
- sal_Int32 nColor = 0;
+ Color nColor;
if ( Value >>= nColor )
- pSubEdit->SetTextLineColor( Color( nColor ) );
+ pSubEdit->SetTextLineColor( nColor );
}
break;
}
diff --git a/tools/qa/cppunit/test_color.cxx b/tools/qa/cppunit/test_color.cxx
index 567aac90a03c..28e2118dc99a 100644
--- a/tools/qa/cppunit/test_color.cxx
+++ b/tools/qa/cppunit/test_color.cxx
@@ -185,9 +185,9 @@ void Test::testInvert()
CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0x77).AsRGBHexString(), aColor.AsRGBHexString());
// Alpha should be unaffected
- aColor = Color(0x22, 0xFF, 0x00, 0x88);
+ aColor = Color(ColorTransparency, 0x22, 0xFF, 0x00, 0x88);
aColor.Invert();
- CPPUNIT_ASSERT_EQUAL(Color(0x22, 0x00, 0xFF, 0x77).AsRGBHexString(), aColor.AsRGBHexString());
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0x22, 0x00, 0xFF, 0x77).AsRGBHexString(), aColor.AsRGBHexString());
}
void Test::testBColor()
diff --git a/vbahelper/source/vbahelper/vbacolorformat.cxx b/vbahelper/source/vbahelper/vbacolorformat.cxx
index 49089f994517..ec33f899054a 100644
--- a/vbahelper/source/vbahelper/vbacolorformat.cxx
+++ b/vbahelper/source/vbahelper/vbacolorformat.cxx
@@ -76,7 +76,7 @@ ScVbaColorFormat::getRGB()
default:
throw uno::RuntimeException( "Second parameter of ColorFormat is wrong." );
}
- nRGB = OORGBToXLRGB( Color(nRGB) );
+ nRGB = OORGBToXLRGB( Color(ColorTransparency, nRGB) );
return nRGB;
}
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 6ff10a34c7bb..b9341e648700 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -339,74 +339,87 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
{
StyleSettings aStyleSet = rSettings.GetStyleSettings();
- aStyleSet.SetFaceColor(aStyle.maFaceColor);
- aStyleSet.SetCheckedColor(aStyle.maCheckedColor);
- aStyleSet.SetLightColor(aStyle.maLightColor);
- aStyleSet.SetLightBorderColor(aStyle.maLightBorderColor);
- aStyleSet.SetShadowColor(aStyle.maShadowColor);
- aStyleSet.SetDarkShadowColor(aStyle.maDarkShadowColor);
- aStyleSet.SetDefaultButtonTextColor(aStyle.maDefaultButtonTextColor);
- aStyleSet.SetButtonTextColor(aStyle.maButtonTextColor);
- aStyleSet.SetDefaultActionButtonTextColor(aStyle.maDefaultActionButtonTextColor);
- aStyleSet.SetActionButtonTextColor(aStyle.maActionButtonTextColor);
- aStyleSet.SetFlatButtonTextColor(aStyle.maFlatButtonTextColor);
- aStyleSet.SetDefaultButtonRolloverTextColor(aStyle.maDefaultButtonRolloverTextColor);
- aStyleSet.SetButtonRolloverTextColor(aStyle.maButtonRolloverTextColor);
+ aStyleSet.SetFaceColor(Color(ColorTransparency, aStyle.maFaceColor));
+ aStyleSet.SetCheckedColor(Color(ColorTransparency, aStyle.maCheckedColor));
+ aStyleSet.SetLightColor(Color(ColorTransparency, aStyle.maLightColor));
+ aStyleSet.SetLightBorderColor(Color(ColorTransparency, aStyle.maLightBorderColor));
+ aStyleSet.SetShadowColor(Color(ColorTransparency, aStyle.maShadowColor));
+ aStyleSet.SetDarkShadowColor(Color(ColorTransparency, aStyle.maDarkShadowColor));
+ aStyleSet.SetDefaultButtonTextColor(
+ Color(ColorTransparency, aStyle.maDefaultButtonTextColor));
+ aStyleSet.SetButtonTextColor(Color(ColorTransparency, aStyle.maButtonTextColor));
+ aStyleSet.SetDefaultActionButtonTextColor(
+ Color(ColorTransparency, aStyle.maDefaultActionButtonTextColor));
+ aStyleSet.SetActionButtonTextColor(
+ Color(ColorTransparency, aStyle.maActionButtonTextColor));
+ aStyleSet.SetFlatButtonTextColor(Color(ColorTransparency, aStyle.maFlatButtonTextColor));
+ aStyleSet.SetDefaultButtonRolloverTextColor(
+ Color(ColorTransparency, aStyle.maDefaultButtonRolloverTextColor));
+ aStyleSet.SetButtonRolloverTextColor(
+ Color(ColorTransparency, aStyle.maButtonRolloverTextColor));
aStyleSet.SetDefaultActionButtonRolloverTextColor(
- aStyle.maDefaultActionButtonRolloverTextColor);
- aStyleSet.SetActionButtonRolloverTextColor(aStyle.maActionButtonRolloverTextColor);
- aStyleSet.SetFlatButtonRolloverTextColor(aStyle.maFlatButtonRolloverTextColor);
+ Color(ColorTransparency, aStyle.maDefaultActionButtonRolloverTextColor));
+ aStyleSet.SetActionButtonRolloverTextColor(
+ Color(ColorTransparency, aStyle.maActionButtonRolloverTextColor));
+ aStyleSet.SetFlatButtonRolloverTextColor(
+ Color(ColorTransparency, aStyle.maFlatButtonRolloverTextColor));
aStyleSet.SetDefaultButtonPressedRolloverTextColor(
- aStyle.maDefaultButtonPressedRolloverTextColor);
- aStyleSet.SetButtonPressedRolloverTextColor(aStyle.maButtonPressedRolloverTextColor);
+ Color(ColorTransparency, aStyle.maDefaultButtonPressedRolloverTextColor));
+ aStyleSet.SetButtonPressedRolloverTextColor(
+ Color(ColorTransparency, aStyle.maButtonPressedRolloverTextColor));
aStyleSet.SetDefaultActionButtonPressedRolloverTextColor(
- aStyle.maDefaultActionButtonPressedRolloverTextColor);
+ Color(ColorTransparency, aStyle.maDefaultActionButtonPressedRolloverTextColor));
aStyleSet.SetActionButtonPressedRolloverTextColor(
- aStyle.maActionButtonPressedRolloverTextColor);
+ Color(ColorTransparency, aStyle.maActionButtonPressedRolloverTextColor));
aStyleSet.SetFlatButtonPressedRolloverTextColor(
- aStyle.maFlatButtonPressedRolloverTextColor);
- aStyleSet.SetRadioCheckTextColor(aStyle.maRadioCheckTextColor);
- aStyleSet.SetGroupTextColor(aStyle.maGroupTextColor);
- aStyleSet.SetLabelTextColor(aStyle.maLabelTextColor);
- aStyleSet.SetWindowColor(aStyle.maWindowColor);
- aStyleSet.SetWindowTextColor(aStyle.maWindowTextColor);
- aStyleSet.SetDialogColor(aStyle.maDialogColor);
- aStyleSet.SetDialogTextColor(aStyle.maDialogTextColor);
- aStyleSet.SetWorkspaceColor(aStyle.maWorkspaceColor);
- aStyleSet.SetMonoColor(aStyle.maMonoColor);
- aStyleSet.SetFieldColor(Color(aStyle.maFieldColor));
- aStyleSet.SetFieldTextColor(aStyle.maFieldTextColor);
- aStyleSet.SetFieldRolloverTextColor(aStyle.maFieldRolloverTextColor);
- aStyleSet.SetActiveColor(aStyle.maActiveColor);
- aStyleSet.SetActiveTextColor(aStyle.maActiveTextColor);
- aStyleSet.SetActiveBorderColor(aStyle.maActiveBorderColor);
- aStyleSet.SetDeactiveColor(aStyle.maDeactiveColor);
- aStyleSet.SetDeactiveTextColor(aStyle.maDeactiveTextColor);
- aStyleSet.SetDeactiveBorderColor(aStyle.maDeactiveBorderColor);
- aStyleSet.SetMenuColor(aStyle.maMenuColor);
- aStyleSet.SetMenuBarColor(aStyle.maMenuBarColor);
- aStyleSet.SetMenuBarRolloverColor(aStyle.maMenuBarRolloverColor);
- aStyleSet.SetMenuBorderColor(aStyle.maMenuBorderColor);
- aStyleSet.SetMenuTextColor(aStyle.maMenuTextColor);
- aStyleSet.SetMenuBarTextColor(aStyle.maMenuBarTextColor);
- aStyleSet.SetMenuBarRolloverTextColor(aStyle.maMenuBarRolloverTextColor);
- aStyleSet.SetMenuBarHighlightTextColor(aStyle.maMenuBarHighlightTextColor);
- aStyleSet.SetMenuHighlightColor(aStyle.maMenuHighlightColor);
- aStyleSet.SetMenuHighlightTextColor(aStyle.maMenuHighlightTextColor);
- aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
- aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
- aStyleSet.SetActiveTabColor(aStyle.maActiveTabColor);
- aStyleSet.SetInactiveTabColor(aStyle.maInactiveTabColor);
- aStyleSet.SetTabTextColor(aStyle.maTabTextColor);
- aStyleSet.SetTabRolloverTextColor(aStyle.maTabRolloverTextColor);
- aStyleSet.SetTabHighlightTextColor(aStyle.maTabHighlightTextColor);
- aStyleSet.SetDisableColor(aStyle.maDisableColor);
- aStyleSet.SetHelpColor(aStyle.maHelpColor);
- aStyleSet.SetHelpTextColor(aStyle.maHelpTextColor);
- aStyleSet.SetLinkColor(aStyle.maLinkColor);
- aStyleSet.SetVisitedLinkColor(aStyle.maVisitedLinkColor);
- aStyleSet.SetToolTextColor(aStyle.maToolTextColor);
- aStyleSet.SetFontColor(aStyle.maFontColor);
+ Color(ColorTransparency, aStyle.maFlatButtonPressedRolloverTextColor));
+ aStyleSet.SetRadioCheckTextColor(Color(ColorTransparency, aStyle.maRadioCheckTextColor));
+ aStyleSet.SetGroupTextColor(Color(ColorTransparency, aStyle.maGroupTextColor));
+ aStyleSet.SetLabelTextColor(Color(ColorTransparency, aStyle.maLabelTextColor));
+ aStyleSet.SetWindowColor(Color(ColorTransparency, aStyle.maWindowColor));
+ aStyleSet.SetWindowTextColor(Color(ColorTransparency, aStyle.maWindowTextColor));
+ aStyleSet.SetDialogColor(Color(ColorTransparency, aStyle.maDialogColor));
+ aStyleSet.SetDialogTextColor(Color(ColorTransparency, aStyle.maDialogTextColor));
+ aStyleSet.SetWorkspaceColor(Color(ColorTransparency, aStyle.maWorkspaceColor));
+ aStyleSet.SetMonoColor(Color(ColorTransparency, aStyle.maMonoColor));
+ aStyleSet.SetFieldColor(Color(ColorTransparency, aStyle.maFieldColor));
+ aStyleSet.SetFieldTextColor(Color(ColorTransparency, aStyle.maFieldTextColor));
+ aStyleSet.SetFieldRolloverTextColor(
+ Color(ColorTransparency, aStyle.maFieldRolloverTextColor));
+ aStyleSet.SetActiveColor(Color(ColorTransparency, aStyle.maActiveColor));
+ aStyleSet.SetActiveTextColor(Color(ColorTransparency, aStyle.maActiveTextColor));
+ aStyleSet.SetActiveBorderColor(Color(ColorTransparency, aStyle.maActiveBorderColor));
+ aStyleSet.SetDeactiveColor(Color(ColorTransparency, aStyle.maDeactiveColor));
+ aStyleSet.SetDeactiveTextColor(Color(ColorTransparency, aStyle.maDeactiveTextColor));
+ aStyleSet.SetDeactiveBorderColor(Color(ColorTransparency, aStyle.maDeactiveBorderColor));
+ aStyleSet.SetMenuColor(Color(ColorTransparency, aStyle.maMenuColor));
+ aStyleSet.SetMenuBarColor(Color(ColorTransparency, aStyle.maMenuBarColor));
+ aStyleSet.SetMenuBarRolloverColor(Color(ColorTransparency, aStyle.maMenuBarRolloverColor));
+ aStyleSet.SetMenuBorderColor(Color(ColorTransparency, aStyle.maMenuBorderColor));
+ aStyleSet.SetMenuTextColor(Color(ColorTransparency, aStyle.maMenuTextColor));
+ aStyleSet.SetMenuBarTextColor(Color(ColorTransparency, aStyle.maMenuBarTextColor));
+ aStyleSet.SetMenuBarRolloverTextColor(
+ Color(ColorTransparency, aStyle.maMenuBarRolloverTextColor));
+ aStyleSet.SetMenuBarHighlightTextColor(
+ Color(ColorTransparency, aStyle.maMenuBarHighlightTextColor));
+ aStyleSet.SetMenuHighlightColor(Color(ColorTransparency, aStyle.maMenuHighlightColor));
+ aStyleSet.SetMenuHighlightTextColor(
+ Color(ColorTransparency, aStyle.maMenuHighlightTextColor));
+ aStyleSet.SetHighlightColor(Color(ColorTransparency, aStyle.maHighlightColor));
+ aStyleSet.SetHighlightTextColor(Color(ColorTransparency, aStyle.maHighlightTextColor));
+ aStyleSet.SetActiveTabColor(Color(ColorTransparency, aStyle.maActiveTabColor));
+ aStyleSet.SetInactiveTabColor(Color(ColorTransparency, aStyle.maInactiveTabColor));
+ aStyleSet.SetTabTextColor(Color(ColorTransparency, aStyle.maTabTextColor));
+ aStyleSet.SetTabRolloverTextColor(Color(ColorTransparency, aStyle.maTabRolloverTextColor));
+ aStyleSet.SetTabHighlightTextColor(
+ Color(ColorTransparency, aStyle.maTabHighlightTextColor));
+ aStyleSet.SetDisableColor(Color(ColorTransparency, aStyle.maDisableColor));
+ aStyleSet.SetHelpColor(Color(ColorTransparency, aStyle.maHelpColor));
+ aStyleSet.SetHelpTextColor(Color(ColorTransparency, aStyle.maHelpTextColor));
+ aStyleSet.SetLinkColor(Color(ColorTransparency, aStyle.maLinkColor));
+ aStyleSet.SetVisitedLinkColor(Color(ColorTransparency, aStyle.maVisitedLinkColor));
+ aStyleSet.SetToolTextColor(Color(ColorTransparency, aStyle.maToolTextColor));
+ aStyleSet.SetFontColor(Color(ColorTransparency, aStyle.maFontColor));
rSettings.SetStyleSettings(aStyleSet);
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 4bbd6f76ec5c..60366f1184de 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -2308,7 +2308,7 @@ Color SvpSalGraphics::getPixel( tools::Long nX, tools::Long nY )
sal_uInt8 b = unpremultiply_table[a][data[SVP_CAIRO_BLUE]];
sal_uInt8 g = unpremultiply_table[a][data[SVP_CAIRO_GREEN]];
sal_uInt8 r = unpremultiply_table[a][data[SVP_CAIRO_RED]];
- Color aColor(0xFF - a, r, g, b);
+ Color aColor(ColorAlpha, a, r, g, b);
cairo_surface_destroy(target);
return aColor;
diff --git a/vcl/inc/bitmap/ScanlineTools.hxx b/vcl/inc/bitmap/ScanlineTools.hxx
index 1e3ab5023638..c343cf34f61e 100644
--- a/vcl/inc/bitmap/ScanlineTools.hxx
+++ b/vcl/inc/bitmap/ScanlineTools.hxx
@@ -39,7 +39,7 @@ public:
virtual Color readPixel() override
{
- const Color aColor(pData[4], pData[1], pData[2], pData[3]);
+ const Color aColor(ColorTransparency, pData[4], pData[1], pData[2], pData[3]);
pData += 4;
return aColor;
}
diff --git a/vcl/qa/cppunit/BitmapExTest.cxx b/vcl/qa/cppunit/BitmapExTest.cxx
index 5e18b990f77d..5e0fe1dddfc6 100644
--- a/vcl/qa/cppunit/BitmapExTest.cxx
+++ b/vcl/qa/cppunit/BitmapExTest.cxx
@@ -37,17 +37,18 @@ void BitmapExTest::testGetPixelColor24_8()
Bitmap aBitmap(Size(3, 3), 24);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);
- pWriteAccess->Erase(Color(0x00, 0x00, 0xFF, 0x00));
+ pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0x00, 0xFF, 0x00));
}
AlphaMask aMask(Size(3, 3));
{
AlphaScopedWriteAccess pWriteAccess(aMask);
- pWriteAccess->Erase(Color(0x00, 0xAA, 0xAA, 0xAA));
+ pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0xAA, 0xAA, 0xAA));
}
BitmapEx aBitmapEx(aBitmap, aMask);
- CPPUNIT_ASSERT_EQUAL(Color(0xAA, 0x00, 0xFF, 0x00), aBitmapEx.GetPixelColor(0, 0));
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xAA, 0x00, 0xFF, 0x00),
+ aBitmapEx.GetPixelColor(0, 0));
}
void BitmapExTest::testGetPixelColor32()
@@ -61,12 +62,13 @@ void BitmapExTest::testGetPixelColor32()
Bitmap aBitmap(Size(3, 3), 32);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);
- pWriteAccess->Erase(Color(0xAA, 0x00, 0xFF, 0x00));
+ pWriteAccess->Erase(Color(ColorTransparency, 0xAA, 0x00, 0xFF, 0x00));
}
BitmapEx aBitmapEx(aBitmap);
- CPPUNIT_ASSERT_EQUAL(Color(0xAA, 0x00, 0xFF, 0x00), aBitmapEx.GetPixelColor(0, 0));
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xAA, 0x00, 0xFF, 0x00),
+ aBitmapEx.GetPixelColor(0, 0));
}
void BitmapExTest::testTransformBitmapEx()
diff --git a/vcl/qa/cppunit/BitmapProcessorTest.cxx b/vcl/qa/cppunit/BitmapProcessorTest.cxx
index 2cc0cbe783d6..07e49b47ca1b 100644
--- a/vcl/qa/cppunit/BitmapProcessorTest.cxx
+++ b/vcl/qa/cppunit/BitmapProcessorTest.cxx
@@ -35,7 +35,7 @@ void BitmapProcessorTest::testDisabledImage()
Bitmap aBitmap(Size(3, 3), 24);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);
- pWriteAccess->Erase(Color(0x00, 0x00, 0xFF, 0x00));
+ pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0x00, 0xFF, 0x00));
}
BitmapEx aBitmapEx(aBitmap);
BitmapDisabledImageFilter aDisabledImageFilter;
@@ -52,12 +52,12 @@ void BitmapProcessorTest::testDisabledImage()
Bitmap aBitmap(Size(3, 3), 24);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);
- pWriteAccess->Erase(Color(0x00, 0x00, 0xFF, 0x00));
+ pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0x00, 0xFF, 0x00));
}
AlphaMask aMask(Size(3, 3));
{
AlphaScopedWriteAccess pWriteAccess(aMask);
- pWriteAccess->Erase(Color(0x00, 0xAA, 0xAA, 0xAA));
+ pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0xAA, 0xAA, 0xAA));
}
BitmapEx aBitmapEx(aBitmap, aMask);
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 56395358863b..0c96977a880a 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -562,7 +562,7 @@ void BitmapTest::testErase()
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapColor aColor(pReadAccess->GetPixel(0, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x11, 0x22, 0x33, 0x00), aColor);
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x11, 0x22, 0x33, 0x00), aColor);
}
}
@@ -577,20 +577,20 @@ void BitmapTest::testBitmap32()
Bitmap aBitmap(Size(3, 3), 32);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);
- pWriteAccess->Erase(Color(0xFF, 0x11, 0x22, 0x33));
- pWriteAccess->SetPixel(1, 1, BitmapColor(0x44, 0xFF, 0xBB, 0x00));
- pWriteAccess->SetPixel(2, 2, BitmapColor(0x99, 0x77, 0x66, 0x55));
+ pWriteAccess->Erase(Color(ColorTransparency, 0xFF, 0x11, 0x22, 0x33));
+ pWriteAccess->SetPixel(1, 1, BitmapColor(ColorTransparency, 0x44, 0xFF, 0xBB, 0x00));
+ pWriteAccess->SetPixel(2, 2, BitmapColor(ColorTransparency, 0x99, 0x77, 0x66, 0x55));
}
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapColor aColor = pReadAccess->GetPixel(0, 0);
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x00, 0xFF), aColor);
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x00, 0xFF), aColor);
aColor = pReadAccess->GetPixel(1, 1);
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x44, 0xFF, 0xBB, 0x00), aColor);
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x44, 0xFF, 0xBB, 0x00), aColor);
aColor = pReadAccess->GetPixel(2, 2);
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x99, 0x77, 0x66, 0x55), aColor);
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x99, 0x77, 0x66, 0x55), aColor);
}
}
diff --git a/vcl/qa/cppunit/ScanlineToolsTest.cxx b/vcl/qa/cppunit/ScanlineToolsTest.cxx
index bf053d3bc890..c6751b827ca1 100644
--- a/vcl/qa/cppunit/ScanlineToolsTest.cxx
+++ b/vcl/qa/cppunit/ScanlineToolsTest.cxx
@@ -42,8 +42,9 @@ void ScanlineToolsTest::ScanlineTransformer_32_ARGB()
pScanlineTransformer->startLine(aScanLine.data());
std::vector<Color> aColors{
- Color(0, 10, 250, 120), Color(50, 30, 230, 110), Color(100, 50, 210, 100),
- Color(150, 70, 190, 90), Color(200, 90, 170, 80),
+ Color(ColorTransparency, 0, 10, 250, 120), Color(ColorTransparency, 50, 30, 230, 110),
+ Color(ColorTransparency, 100, 50, 210, 100), Color(ColorTransparency, 150, 70, 190, 90),
+ Color(ColorTransparency, 200, 90, 170, 80),
};
for (Color const& aColor : aColors)
@@ -70,8 +71,9 @@ void ScanlineToolsTest::ScanlineTransformer_24_BGR()
pScanlineTransformer->startLine(aScanLine.data());
std::vector<Color> aColors{
- Color(0, 10, 250, 120), Color(50, 30, 230, 110), Color(100, 50, 210, 100),
- Color(150, 70, 190, 90), Color(200, 90, 170, 80),
+ Color(ColorTransparency, 0, 10, 250, 120), Color(ColorTransparency, 50, 30, 230, 110),
+ Color(ColorTransparency, 100, 50, 210, 100), Color(ColorTransparency, 150, 70, 190, 90),
+ Color(ColorTransparency, 200, 90, 170, 80),
};
for (Color const& aColor : aColors)
@@ -91,8 +93,9 @@ void ScanlineToolsTest::ScanlineTransformer_24_BGR()
void ScanlineToolsTest::ScanlineTransformer_8bit_Palette()
{
std::vector<Color> aColors{
- Color(0, 10, 250, 120), Color(50, 30, 230, 110), Color(100, 50, 210, 100),
- Color(150, 70, 190, 90), Color(200, 90, 170, 80),
+ Color(ColorTransparency, 0, 10, 250, 120), Color(ColorTransparency, 50, 30, 230, 110),
+ Color(ColorTransparency, 100, 50, 210, 100), Color(ColorTransparency, 150, 70, 190, 90),
+ Color(ColorTransparency, 200, 90, 170, 80),
};
BitmapPalette aPalette(256);
diff --git a/vcl/qa/cppunit/bitmapcolor.cxx b/vcl/qa/cppunit/bitmapcolor.cxx
index 7329564d46c4..f62e19dabcd5 100644
--- a/vcl/qa/cppunit/bitmapcolor.cxx
+++ b/vcl/qa/cppunit/bitmapcolor.cxx
@@ -137,7 +137,7 @@ void BitmapColorTest::colorClassConstructor()
// Transparency / Alpha
{
- BitmapColor aBmpColor(Color(255, 128, 64, 0));
+ BitmapColor aBmpColor(Color(ColorTransparency, 255, 128, 64, 0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Red wrong", static_cast<sal_uInt8>(128), aBmpColor.GetRed());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", static_cast<sal_uInt8>(64),
diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
index 201d10e56fd3..bbf8a38da0f6 100644
--- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
+++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
@@ -152,20 +152,23 @@ void BitmapRenderTest::testDrawAlphaBitmapEx()
}
// Check the bitmap has pixels we expect
- CPPUNIT_ASSERT_EQUAL(Color(0xFF, 0x00, 0x00, 0x00), aBitmapEx.GetPixelColor(0, 0));
- CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0xFF, 0x00), aBitmapEx.GetPixelColor(1, 1));
- CPPUNIT_ASSERT_EQUAL(Color(0x7F, 0x00, 0xFF, 0x00), aBitmapEx.GetPixelColor(2, 2));
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xFF, 0x00, 0x00, 0x00),
+ aBitmapEx.GetPixelColor(0, 0));
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0x00, 0xFF, 0xFF, 0x00),
+ aBitmapEx.GetPixelColor(1, 1));
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0x7F, 0x00, 0xFF, 0x00),
+ aBitmapEx.GetPixelColor(2, 2));
pVDev->DrawBitmapEx(Point(), aBitmapEx);
- CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0xFF, 0xFF), pVDev->GetPixel(Point(0, 0)));
- CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0xFF, 0x00), pVDev->GetPixel(Point(1, 1)));
+ CPPUNIT_ASSERT_EQUAL(Color(0xFF, 0xFF, 0xFF), pVDev->GetPixel(Point(0, 0)));
+ CPPUNIT_ASSERT_EQUAL(Color(0xFF, 0xFF, 0x00), pVDev->GetPixel(Point(1, 1)));
#if defined(_WIN32) || defined(MACOSX) || defined(IOS)
// sometimes on Windows we get rounding error in blending so let's ignore this on Windows for now.
- CPPUNIT_ASSERT_LESS(2, deltaColor(Color(0x00, 0x7F, 0xFF, 0x7F), pVDev->GetPixel(Point(2, 2))));
+ CPPUNIT_ASSERT_LESS(2, deltaColor(Color(0x7F, 0xFF, 0x7F), pVDev->GetPixel(Point(2, 2))));
#else
- CPPUNIT_ASSERT_EQUAL(Color(0x00, 0x7F, 0xFF, 0x7F), pVDev->GetPixel(Point(2, 2)));
+ CPPUNIT_ASSERT_EQUAL(Color(0x7F, 0xFF, 0x7F), pVDev->GetPixel(Point(2, 2)));
#endif
}
@@ -211,14 +214,14 @@ void BitmapRenderTest::testAlphaVirtualDevice()
#endif
// Draw an semi-transparent pixel
- pAlphaVirtualDevice->DrawPixel(Point(0, 0), Color(0x44, 0x22, 0xff, 0x55));
+ pAlphaVirtualDevice->DrawPixel(Point(0, 0), Color(ColorTransparency, 0x44, 0x22, 0xff, 0x55));
aColor = pAlphaVirtualDevice->GetPixel(Point(0, 0));
// Read back the semi-transparent pixel
#if defined _WIN32
- CPPUNIT_ASSERT_LESS(6, deltaColor(Color(0x4422FF55), aColor));
+ CPPUNIT_ASSERT_LESS(6, deltaColor(Color(ColorTransparency, 0x4422FF55), aColor));
#else
- CPPUNIT_ASSERT_EQUAL(Color(0x4422FF55), aColor);
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0x4422FF55), aColor);
#endif
// Read back the BitmapEx and check the semi-transparent pixel
@@ -228,9 +231,9 @@ void BitmapRenderTest::testAlphaVirtualDevice()
aColor = aBitmap.GetPixelColor(0, 0);
#if defined _WIN32
- CPPUNIT_ASSERT_LESS(6, deltaColor(Color(0x4422FF55), aColor));
+ CPPUNIT_ASSERT_LESS(6, deltaColor(Color(ColorTransparency, 0x4422FF55), aColor));
#else
- CPPUNIT_ASSERT_EQUAL(Color(0x4422FF55), aColor);
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0x4422FF55), aColor);
#endif
}
diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx
index 42a25652134f..28e6c719f6fd 100644
--- a/vcl/qa/cppunit/png/PngFilterTest.cxx
+++ b/vcl/qa/cppunit/png/PngFilterTest.cxx
@@ -70,15 +70,23 @@ void PngFilterTest::testPng()
if (pAccess->GetBitCount() == 24 || pAccess->GetBitCount() == 32)
{
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(0, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(3, 3));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(3, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(0, 3));
-
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x00, 0x00), pAccess->GetPixel(1, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x00, 0x00), pAccess->GetPixel(1, 2));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x00, 0x00), pAccess->GetPixel(2, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x00, 0x00), pAccess->GetPixel(2, 2));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(0, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(3, 3));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(3, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(0, 3));
+
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x00, 0x00),
+ pAccess->GetPixel(1, 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x00, 0x00),
+ pAccess->GetPixel(1, 2));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x00, 0x00),
+ pAccess->GetPixel(2, 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x00, 0x00),
+ pAccess->GetPixel(2, 2));
}
else
{
@@ -102,15 +110,23 @@ void PngFilterTest::testPng()
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Height());
if (pAccess->GetBitCount() == 24 || pAccess->GetBitCount() == 32)
{
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(0, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(3, 3));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(3, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(0, 3));
-
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0x00, 0x00, 0x00), pAccess->GetPixel(1, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0xFF, 0x00, 0x00), pAccess->GetPixel(1, 2));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0xFF, 0x00), pAccess->GetPixel(2, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0x00, 0x00), pAccess->GetPixel(2, 2));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(0, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(3, 3));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(3, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(0, 3));
+
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0x00, 0x00, 0x00),
+ pAccess->GetPixel(1, 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0xFF, 0x00, 0x00),
+ pAccess->GetPixel(1, 2));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xFF, 0x00),
+ pAccess->GetPixel(2, 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0x00, 0x00),
+ pAccess->GetPixel(2, 2));
}
else
{
@@ -134,15 +150,23 @@ void PngFilterTest::testPng()
if (pAccess->GetBitCount() == 24)
{
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(0, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(3, 3));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(3, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x00), pAccess->GetPixel(0, 3));
-
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0x00, 0x00, 0x00), pAccess->GetPixel(1, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0xFF, 0x00, 0x00), pAccess->GetPixel(1, 2));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0xFF, 0x00), pAccess->GetPixel(2, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0x00, 0x00), pAccess->GetPixel(2, 2));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(0, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(3, 3));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(3, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x00),
+ pAccess->GetPixel(0, 3));
+
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0x00, 0x00, 0x00),
+ pAccess->GetPixel(1, 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0xFF, 0x00, 0x00),
+ pAccess->GetPixel(1, 2));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xFF, 0x00),
+ pAccess->GetPixel(2, 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0x00, 0x00),
+ pAccess->GetPixel(2, 2));
AlphaMask aAlpha = aBitmapEx.GetAlpha();
{
@@ -151,36 +175,44 @@ void PngFilterTest::testPng()
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAlphaAccess->Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAlphaAccess->Height());
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x80, 0x00),
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x80, 0x00),
pAlphaAccess->GetPixel(0, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x80, 0x00),
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x80, 0x00),
pAlphaAccess->GetPixel(3, 3));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x80, 0x00),
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x80, 0x00),
pAlphaAccess->GetPixel(3, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x80, 0x00),
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x80, 0x00),
pAlphaAccess->GetPixel(0, 3));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x40, 0x00),
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x40, 0x00),
pAlphaAccess->GetPixel(1, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0xC0, 0x00),
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xC0, 0x00),
pAlphaAccess->GetPixel(1, 2));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0xC0, 0x00),
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xC0, 0x00),
pAlphaAccess->GetPixel(2, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0x40, 0x00),
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x40, 0x00),
pAlphaAccess->GetPixel(2, 2));
}
}
else if (pAccess->GetBitCount() == 32)
{
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x80), pAccess->GetPixel(0, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x80), pAccess->GetPixel(3, 3));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x80), pAccess->GetPixel(3, 0));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0xFF, 0x80), pAccess->GetPixel(0, 3));
-
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0x00, 0x00, 0x40), pAccess->GetPixel(1, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0xFF, 0x00, 0xC0), pAccess->GetPixel(1, 2));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0x00, 0xFF, 0xC0), pAccess->GetPixel(2, 1));
- CPPUNIT_ASSERT_EQUAL(BitmapColor(0xFF, 0xFF, 0x00, 0x40), pAccess->GetPixel(2, 2));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80),
+ pAccess->GetPixel(0, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80),
+ pAccess->GetPixel(3, 3));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80),
+ pAccess->GetPixel(3, 0));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0xFF, 0x80),
+ pAccess->GetPixel(0, 3));
+
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0x00, 0x00, 0x40),
+ pAccess->GetPixel(1, 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0xFF, 0x00, 0xC0),
+ pAccess->GetPixel(1, 2));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0xFF, 0xC0),
+ pAccess->GetPixel(2, 1));
+ CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0xFF, 0xFF, 0x00, 0x40),
+ pAccess->GetPixel(2, 2));
}
else
{
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index 1f33cec86e3c..879c451ec277 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -666,7 +666,7 @@ QColor Qt5AccessibleWidget::foregroundColor() const
return QColor();
Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY);
- return toQColor(xAccessibleComponent->getForeground());
+ return toQColor(Color(ColorTransparency, xAccessibleComponent->getForeground()));
}
QColor Qt5AccessibleWidget::backgroundColor() const
@@ -676,7 +676,7 @@ QColor Qt5AccessibleWidget::backgroundColor() const
return QColor();
Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY);
- return toQColor(xAccessibleComponent->getBackground());
+ return toQColor(Color(ColorTransparency, xAccessibleComponent->getBackground()));
}
void* Qt5AccessibleWidget::interface_cast(QAccessible::InterfaceType t)
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index 559ff4baca39..a40a96e9fb29 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -516,7 +516,10 @@ std::shared_ptr<SalBitmap> Qt5Graphics::getBitmap(tools::Long nX, tools::Long nY
return std::make_shared<Qt5Bitmap>(m_pQImage->copy(nX, nY, nWidth, nHeight));
}
-Color Qt5Graphics::getPixel(tools::Long nX, tools::Long nY) { return m_pQImage->pixel(nX, nY); }
+Color Qt5Graphics::getPixel(tools::Long nX, tools::Long nY)
+{
+ return Color(ColorTransparency, m_pQImage->pixel(nX, nY));
+}
void Qt5Graphics::invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
SalInvert nFlags)
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 8266fe938bbf..f9fdfcaa1300 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -216,7 +216,7 @@ SkColor toSkColorWithIntensity(Color color, int intensity)
Color fromSkColor(SkColor color)
{
- return Color(255 - SkColorGetA(color), SkColorGetR(color), SkColorGetG(color),
+ return Color(ColorAlpha, SkColorGetA(color), SkColorGetR(color), SkColorGetG(color),
SkColorGetB(color));
}
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 77bb784241f0..70405e2b5111 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -939,7 +939,7 @@ void SkiaSalBitmap::PerformErase()
abort();
Color fastColor = mEraseColor;
if (!!mPalette)
- fastColor = mPalette.GetBestIndex(fastColor);
+ fastColor = Color(ColorTransparency, mPalette.GetBestIndex(fastColor));
if (!ImplFastEraseBitmap(*bitmapBuffer, fastColor))
{
FncSetPixel setPixel = BitmapReadAccess::SetPixelFunction(bitmapBuffer->mnFormat);
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 2f0495c58446..556e1f7e69cf 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2301,7 +2301,7 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot
if ( nIndex > 0 )
{
OUString aColor = aPersonaSettings.getToken( 0, ';', ++nIndex );
- rMenuBarTextColor = Color( aColor.toUInt32( 16 ) );
+ rMenuBarTextColor = Color( ColorTransparency, aColor.toUInt32( 16 ) );
}
}
diff --git a/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx b/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx
index f3b371e03f1c..8bc038b486f9 100644
--- a/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx
+++ b/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx
@@ -38,7 +38,7 @@ struct FilterSharedData
, mpWriteAccess(rWriteAccess.get())
, mnRadius(nRadius)
, mnOutsideVal(nOutsideVal)
- , maOutsideColor(nOutsideVal, nOutsideVal, nOutsideVal, nOutsideVal)
+ , maOutsideColor(ColorTransparency, nOutsideVal, nOutsideVal, nOutsideVal, nOutsideVal)
{
}
};
@@ -92,8 +92,9 @@ template <typename MorphologyOp, int nComponentWidth> struct Value
template <typename MorphologyOp> struct Value<MorphologyOp, 0>
{
- static constexpr Color initColor{ MorphologyOp::initVal, MorphologyOp::initVal,
- MorphologyOp::initVal, MorphologyOp::initVal };
+ static constexpr Color initColor{ ColorTransparency, MorphologyOp::initVal,
+ MorphologyOp::initVal, MorphologyOp::initVal,
+ MorphologyOp::initVal };
Color aResult;
@@ -107,7 +108,7 @@ template <typename MorphologyOp> struct Value<MorphologyOp, 0>
sal_uInt8* /*pHint*/ = nullptr)
{
const auto& rSource = pReadAccess->GetColor(y, x);
- aResult = Color(255 - MorphologyOp::apply(rSource.GetAlpha(), aResult.GetAlpha()),
+ aResult = Color(ColorAlpha, MorphologyOp::apply(rSource.GetAlpha(), aResult.GetAlpha()),
MorphologyOp::apply(rSource.GetRed(), aResult.GetRed()),
MorphologyOp::apply(rSource.GetGreen(), aResult.GetGreen()),
MorphologyOp::apply(rSource.GetBlue(), aResult.GetBlue()));
diff --git a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
index 9c4e469191a8..82b6c7f07d5e 100644
--- a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
+++ b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
@@ -40,7 +40,7 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const
// Get the luminance from RGB color and remap the value from 0-255 to 160-224
const BitmapColor aColor = pRead->GetPixelFromData(pReadScan, nX);
sal_uInt8 nLum(aColor.GetLuminance() / 4 + 160);
- BitmapColor aGreyValue(nLum, nLum, nLum, 255 - aColor.GetAlpha());
+ BitmapColor aGreyValue(ColorAlpha, nLum, nLum, nLum, aColor.GetAlpha());
pGrey->SetPixelOnData(pGreyScan, nX, aGreyValue);
}
}
diff --git a/vcl/source/bitmap/BitmapReadAccess.cxx b/vcl/source/bitmap/BitmapReadAccess.cxx
index 0a39835a364c..a978e3f77388 100644
--- a/vcl/source/bitmap/BitmapReadAccess.cxx
+++ b/vcl/source/bitmap/BitmapReadAccess.cxx
@@ -405,8 +405,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcAbgr(ConstScanline pScanline, t
sal_uInt8 g = *pScanline++;
sal_uInt8 r = *pScanline;
- return BitmapColor(vcl::bitmap::unpremultiply(r, a), vcl::bitmap::unpremultiply(g, a),
- vcl::bitmap::unpremultiply(b, a), 0xFF - a);
+ return BitmapColor(ColorAlpha, vcl::bitmap::unpremultiply(r, a),
+ vcl::bitmap::unpremultiply(g, a), vcl::bitmap::unpremultiply(b, a), a);
}
BitmapColor BitmapReadAccess::GetPixelForN32BitTcXbgr(ConstScanline pScanline, tools::Long nX,
@@ -454,8 +454,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcArgb(ConstScanline pScanline, t
sal_uInt8 g = *pScanline++;
sal_uInt8 b = *pScanline;
- return BitmapColor(vcl::bitmap::unpremultiply(r, a), vcl::bitmap::unpremultiply(g, a),
- vcl::bitmap::unpremultiply(b, a), 0xFF - a);
+ return BitmapColor(ColorAlpha, vcl::bitmap::unpremultiply(r, a),
+ vcl::bitmap::unpremultiply(g, a), vcl::bitmap::unpremultiply(b, a), a);
}
BitmapColor BitmapReadAccess::GetPixelForN32BitTcXrgb(ConstScanline pScanline, tools::Long nX,
@@ -503,8 +503,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcBgra(ConstScanline pScanline, t
sal_uInt8 r = *pScanline++;
sal_uInt8 a = *pScanline;
- return BitmapColor(vcl::bitmap::unpremultiply(r, a), vcl::bitmap::unpremultiply(g, a),
- vcl::bitmap::unpremultiply(b, a), 0xFF - a);
+ return BitmapColor(ColorAlpha, vcl::bitmap::unpremultiply(r, a),
+ vcl::bitmap::unpremultiply(g, a), vcl::bitmap::unpremultiply(b, a), a);
}
BitmapColor BitmapReadAccess::GetPixelForN32BitTcBgrx(ConstScanline pScanline, tools::Long nX,
@@ -552,8 +552,8 @@ BitmapColor BitmapReadAccess::GetPixelForN32BitTcRgba(ConstScanline pScanline, t
sal_uInt8 b = *pScanline++;
sal_uInt8 a = *pScanline;
- return BitmapColor(vcl::bitmap::unpremultiply(r, a), vcl::bitmap::unpremultiply(g, a),
- vcl::bitmap::unpremultiply(b, a), 0xFF - a);
+ return BitmapColor(ColorAlpha, vcl::bitmap::unpremultiply(r, a),
+ vcl::bitmap::unpremultiply(g, a), vcl::bitmap::unpremultiply(b, a), a);
}
BitmapColor BitmapReadAccess::GetPixelForN32BitTcRgbx(ConstScanline pScanline, tools::Long nX,
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 8d65c7b1a31f..e42e7feedb87 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -1725,7 +1725,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R
Color GDIMetaFile::ImplColAdjustFnc( const Color& rColor, const void* pColParam )
{
- return Color( 255 - rColor.GetAlpha(),
+ return Color( ColorAlpha, rColor.GetAlpha(),
static_cast<const ImplColAdjustParam*>(pColParam)->pMapR[ rColor.GetRed() ],
static_cast<const ImplColAdjustParam*>(pColParam)->pMapG[ rColor.GetGreen() ],
static_cast<const ImplColAdjustParam*>(pColParam)->pMapB[ rColor.GetBlue() ] );
@@ -1751,7 +1751,7 @@ Color GDIMetaFile::ImplColConvertFnc( const Color& rColor, const void* pColParam
if( MtfConversion::N1BitThreshold == static_cast<const ImplColConvertParam*>(pColParam)->eConversion )
cLum = ( cLum < 128 ) ? 0 : 255;
- return Color( 255 - rColor.GetAlpha(), cLum, cLum, cLum );
+ return Color( ColorTransparency, 255 - rColor.GetAlpha(), cLum, cLum, cLum );
}
BitmapEx GDIMetaFile::ImplBmpConvertFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx
index 82ce4dd07fcf..f2a67a6f8203 100644
--- a/vcl/source/graphic/GraphicObject2.cxx
+++ b/vcl/source/graphic/GraphicObject2.cxx
@@ -476,7 +476,7 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx,
}
aBmpEx2.Scale(Size(nPadTotalWidth, nPadTotalHeight));
- aBmpEx2.Erase( Color(0xFF,0,0,0) );
+ aBmpEx2.Erase( Color(ColorAlpha,0,0,0,0) );
aBmpEx2.CopyPixel( tools::Rectangle( Point(nPadLeft, nPadTop), aBmpSize ), tools::Rectangle( Point(0, 0), aBmpSize ), &rBmpEx );
rBmpEx = aBmpEx2;
}
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index dc57592944ab..c1ee370537cc 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -609,7 +609,7 @@ namespace vcl::unotools
const rendering::ARGBColor aARGBColor(
xColorSpace->convertToARGB(rColor)[0]);
- return Color( 255-toByteColor(aARGBColor.Alpha),
+ return Color( ColorAlpha, toByteColor(aARGBColor.Alpha),
toByteColor(aARGBColor.Red),
toByteColor(aARGBColor.Green),
toByteColor(aARGBColor.Blue) );
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index bdd3fed7b4d4..42fb1370ce9f 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -657,7 +657,7 @@ Color PDFiumPageObject::getFillColor()
unsigned int nR, nG, nB, nA;
if (FPDFPageObj_GetFillColor(mpPageObject, &nR, &nG, &nB, &nA))
{
- aColor = Color(0xFF - nA, nR, nG, nB);
+ aColor = Color(ColorAlpha, nA, nR, nG, nB);
}
return aColor;
}
@@ -668,7 +668,7 @@ Color PDFiumPageObject::getStrokeColor()
unsigned int nR, nG, nB, nA;
if (FPDFPageObj_GetStrokeColor(mpPageObject, &nR, &nG, &nB, &nA))
{
- aColor = Color(0xFF - nA, nR, nG, nB);
+ aColor = Color(ColorAlpha, nA, nR, nG, nB);
}
return aColor;
}
@@ -857,7 +857,7 @@ Color PDFiumAnnotationImpl::getColor()
unsigned int nR, nG, nB, nA;
if (FPDFAnnot_GetColor(mpAnnotation, FPDFANNOT_COLORTYPE_Color, &nR, &nG, &nB, &nA))
{
- aColor = Color(0xFF - nA, nR, nG, nB);
+ aColor = Color(ColorAlpha, nA, nR, nG, nB);
}
return aColor;
}
@@ -868,7 +868,7 @@ Color PDFiumAnnotationImpl::getInteriorColor()
unsigned int nR, nG, nB, nA;
if (FPDFAnnot_GetColor(mpAnnotation, FPDFANNOT_COLORTYPE_InteriorColor, &nR, &nG, &nB, &nA))
{
- aColor = Color(0xFF - nA, nR, nG, nB);
+ aColor = Color(ColorAlpha, nA, nR, nG, nB);
}
return aColor;
}
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 6c47c8a0ac01..c29a827b2c38 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -92,7 +92,7 @@ void DecoToolBox::SetImages( tools::Long nMaxHeight, bool bForce )
lastSize = nMaxHeight - border;
- Color aEraseColor( 255, 255, 255, 255 );
+ Color aEraseColor( ColorTransparency, 255, 255, 255, 255 );
BitmapEx aBmpExDst( maImage.GetBitmapEx() );
BitmapEx aBmpExSrc( aBmpExDst );
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index efc154e14cb6..26624925dfe8 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -2430,7 +2430,7 @@ SalVisual::SalVisual( const XVisualInfo* pXVI )
Color SalVisual::GetTCColor( Pixel nPixel ) const
{
if( SALCOLOR == eRGBMode_ )
- return static_cast<Color>(nPixel);
+ return Color(ColorTransparency, nPixel);
if( SALCOLORREVERSE == eRGBMode_ )
return Color( (nPixel & 0x0000FF),
@@ -2715,7 +2715,7 @@ Color SalColormap::GetColor( Pixel nPixel ) const
if( !m_hColormap )
{
SAL_WARN("vcl", "SalColormap::GetColor() !m_hColormap");
- return nPixel;
+ return Color(ColorTransparency, nPixel);
}
// DirectColor, StaticColor, StaticGray, GrayScale
@@ -2791,7 +2791,7 @@ Pixel SalColormap::GetPixel( Color nColor ) const
{
XColor aInversColor;
- Color nInversColor = sal_uInt32(nColor) ^ 0xFFFFFF;
+ Color nInversColor(ColorTransparency, sal_uInt32(nColor) ^ 0xFFFFFF);
GetXPixel( aInversColor,
nInversColor.GetRed(),
diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx
index 5769daa5b335..0045805d6e85 100644
--- a/writerfilter/source/dmapper/BorderHandler.cxx
+++ b/writerfilter/source/dmapper/BorderHandler.cxx
@@ -66,7 +66,7 @@ void BorderHandler::lcl_attribute(Id rName, Value & rVal)
break;
case NS_ooxml::LN_CT_Border_color:
m_nLineColor = nIntValue;
- appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
+ appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency, nIntValue))));
break;
case NS_ooxml::LN_CT_Border_space: // border distance in points
m_nLineDistance = ConversionHelper::convertTwipToMM100( nIntValue * 20 );
diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx
index 805f6e1bb6da..193477a31fc2 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -107,7 +107,7 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
}
break;
case NS_ooxml::LN_CT_Shd_fill:
- createGrabBag("fill", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue))));
+ createGrabBag("fill", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency, nIntValue)))));
if( nIntValue == sal_Int32(COL_AUTO) )
nIntValue = 0xffffff; //fill color auto means white
else
@@ -117,7 +117,7 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
m_bFillSpecified = true;
break;
case NS_ooxml::LN_CT_Shd_color:
- createGrabBag("color", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue))));
+ createGrabBag("color", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency, nIntValue)))));
if( nIntValue == sal_Int32(COL_AUTO) )
nIntValue = 0; //shading color auto means black
//color of the shading
@@ -286,7 +286,7 @@ TablePropertyMapPtr CellColorHandler::getProperties()
pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
: PROP_CHAR_BACK_COLOR, uno::makeAny( nApplyColor ));
- createGrabBag("originalColor", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nApplyColor))));
+ createGrabBag("originalColor", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency, nApplyColor)))));
return pPropertyMap;
}
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index c3d246523a12..74502be05b3f 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -328,7 +328,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Color_val:
if (m_pImpl->GetTopContext())
m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, uno::makeAny( nIntValue ) );
- m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
+ m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency,nIntValue))));
break;
case NS_ooxml::LN_CT_Underline_color:
if (m_pImpl->GetTopContext())
diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx b/writerfilter/source/dmapper/TDefTableHandler.cxx
index deac21075535..9d7059feece6 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -284,7 +284,7 @@ void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
appendGrabBag("val", TDefTableHandler::getBorderTypeString(nIntValue));
break;
case NS_ooxml::LN_CT_Border_color:
- appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
+ appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency,nIntValue))));
m_nLineColor = nIntValue;
break;
case NS_ooxml::LN_CT_Border_space:
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index bf94d9cf8097..074252fd768b 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -442,14 +442,16 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
xPropertySet->setPropertyValue("FillColor", aAny);
// fillType will decide, possible it'll be the start color of a gradient.
- aFillModel.moColor.set(
- "#" + OUString::fromUtf8(msfilter::util::ConvertColor(aAny.get<sal_Int32>())));
+ aFillModel.moColor.set("#"
+ + OUString::fromUtf8(msfilter::util::ConvertColor(
+ Color(ColorTransparency, aAny.get<sal_Int32>()))));
}
else if (rProperty.first == "fillBackColor")
// fillType will decide, possible it'll be the end color of a gradient.
- aFillModel.moColor2.set("#"
- + OUString::fromUtf8(msfilter::util::ConvertColor(
- msfilter::util::BGRToRGB(rProperty.second.toInt32()))));
+ aFillModel.moColor2.set(
+ "#"
+ + OUString::fromUtf8(msfilter::util::ConvertColor(Color(
+ ColorTransparency, msfilter::util::BGRToRGB(rProperty.second.toInt32())))));
else if (rProperty.first == "lineColor")
aLineColor <<= msfilter::util::BGRToRGB(rProperty.second.toInt32());
else if (rProperty.first == "lineBackColor")
@@ -670,9 +672,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
aShadowModel.mbHasShadow = true;
}
else if (rProperty.first == "shadowColor")
- aShadowModel.moColor.set("#"
- + OUString::fromUtf8(msfilter::util::ConvertColor(
- msfilter::util::BGRToRGB(rProperty.second.toInt32()))));
+ aShadowModel.moColor.set(
+ "#"
+ + OUString::fromUtf8(msfilter::util::ConvertColor(Color(
+ ColorTransparency, msfilter::util::BGRToRGB(rProperty.second.toInt32())))));
else if (rProperty.first == "shadowOffsetX")
// EMUs to points
aShadowModel.moOffset.set(OUString::number(rProperty.second.toDouble() / 12700) + "pt");
diff --git a/xmloff/source/chart/ColorPropertySet.cxx b/xmloff/source/chart/ColorPropertySet.cxx
index ea15d40161dc..6e3e046923df 100644
--- a/xmloff/source/chart/ColorPropertySet.cxx
+++ b/xmloff/source/chart/ColorPropertySet.cxx
@@ -77,7 +77,7 @@ namespace xmloff::chart
{
ColorPropertySet::ColorPropertySet( sal_Int32 nColor ) :
- m_nColor( nColor ),
+ m_nColor( ColorTransparency, nColor ),
m_nDefaultColor( 0x0099ccff ) // blue 8
{}
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
index a745440a1197..110c25061e27 100644
--- a/xmloff/source/style/TransGradientStyle.cxx
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -219,14 +219,14 @@ void XMLTransGradientStyleExport::exportXML(
}
// Transparency start
- Color aColor(aGradient.StartColor);
+ Color aColor(ColorTransparency, aGradient.StartColor);
sal_Int32 aStartValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
::sax::Converter::convertPercent( aOut, aStartValue );
aStrValue = aOut.makeStringAndClear();
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START, aStrValue );
// Transparency end
- aColor = Color(aGradient.EndColor);
+ aColor = Color(ColorTransparency, aGradient.EndColor);
sal_Int32 aEndValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
::sax::Converter::convertPercent( aOut, aEndValue );
aStrValue = aOut.makeStringAndClear();
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 7688ea74ac67..80f65a55f90b 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -617,11 +617,9 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
case XML_ELEMENT(FO, XML_COLOR):
case XML_ELEMENT(FO_COMPAT, XML_COLOR):
{
- sal_Int32 nColor(0);
+ Color nColor;
if (::sax::Converter::convertColor( nColor, aIter.toView() ))
- {
- rListLevel.SetColor( Color(nColor) );
- }
+ rListLevel.SetColor( nColor );
}
break;
case XML_ELEMENT(STYLE, XML_USE_WINDOW_FONT_COLOR):