summaryrefslogtreecommitdiff
path: root/reportdesign
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 /reportdesign
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>
Diffstat (limited to 'reportdesign')
-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
7 files changed, 14 insertions, 14 deletions
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