summaryrefslogtreecommitdiff
path: root/oox/source/export/drawingml.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-02 11:43:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-05 07:35:01 +0100
commit61d79dd740958186c4a4344e18eaeb5b2c139c91 (patch)
treeabea71a038352572871ea1fb2a9c40d2f196ddd6 /oox/source/export/drawingml.cxx
parent04c9cb68dffa2af15661cc35bc61032b036ed2cd (diff)
use more Color in oox
Change-Id: I8fdc6742de5af9101e246411e7208650bae2c4c7 Reviewed-on: https://gerrit.libreoffice.org/50617 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source/export/drawingml.cxx')
-rw-r--r--oox/source/export/drawingml.cxx60
1 files changed, 30 insertions, 30 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e055ca52a87a..093ed3c4ec24 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -178,10 +178,10 @@ bool DrawingML::GetPropertyAndState( const Reference< XPropertySet >& rXProperty
return false;
}
-void DrawingML::WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha )
+void DrawingML::WriteColor( ::Color nColor, sal_Int32 nAlpha )
{
// Transparency is a separate element.
- OString sColor = OString::number( nColor & 0x00FFFFFF, 16 );
+ OString sColor = OString::number( sal_uInt32(nColor) & 0x00FFFFFF, 16 );
if( sColor.getLength() < 6 )
{
OStringBuffer sBuf( "0" );
@@ -245,7 +245,7 @@ void DrawingML::WriteColorTransformations( const Sequence< PropertyValue >& aTra
}
}
-void DrawingML::WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha )
+void DrawingML::WriteSolidFill( ::Color nColor, sal_Int32 nAlpha )
{
mpFS->startElementNS( XML_a, XML_solidFill, FSEND );
WriteColor( nColor, nAlpha );
@@ -300,7 +300,7 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
if ( nFillColor != nOriginalColor )
{
// the user has set a different color for the shape
- WriteSolidFill( nFillColor & 0xffffff, nAlpha );
+ WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha );
}
else if ( !sColorFillScheme.isEmpty() )
{
@@ -320,18 +320,18 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
}
if ( nFillColor != nThemeColor )
// the shape contains a theme but it wasn't being used
- WriteSolidFill( nFillColor & 0xffffff, nAlpha );
+ WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha );
// in case the shape used the style color and the user didn't change it,
// we must not write a <a: solidFill> tag.
}
else
{
// the shape had a custom color and the user didn't change it
- WriteSolidFill( nFillColor & 0xffffff, nAlpha );
+ WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha );
}
}
-void DrawingML::WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor )
+void DrawingML::WriteGradientStop( sal_uInt16 nStop, ::Color nColor )
{
mpFS->startElementNS( XML_a, XML_gs,
XML_pos, I32S( nStop * 1000 ),
@@ -340,11 +340,11 @@ void DrawingML::WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor )
mpFS->endElementNS( XML_a, XML_gs );
}
-sal_uInt32 DrawingML::ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity )
+::Color DrawingML::ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity )
{
- return ( ( ( nColor & 0xff ) * nIntensity ) / 100 )
+ return ::Color(( ( ( nColor & 0xff ) * nIntensity ) / 100 )
| ( ( ( ( ( nColor & 0xff00 ) >> 8 ) * nIntensity ) / 100 ) << 8 )
- | ( ( ( ( ( nColor & 0xff0000 ) >> 8 ) * nIntensity ) / 100 ) << 8 );
+ | ( ( ( ( ( nColor & 0xff0000 ) >> 8 ) * nIntensity ) / 100 ) << 8 ));
}
bool DrawingML::EqualGradients( awt::Gradient aGradient1, awt::Gradient aGradient2 )
@@ -417,7 +417,7 @@ void DrawingML::WriteGrabBagGradientFill( const Sequence< PropertyValue >& aGrad
OUString sSchemeClr;
double nPos = 0;
sal_Int16 nTransparency = 0;
- sal_Int32 nRgbClr = 0;
+ ::Color nRgbClr;
Sequence< PropertyValue > aTransformations;
for( sal_Int32 j=0; j < aGradientStop.getLength(); ++j )
{
@@ -577,7 +577,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
GET( aLineStyle, LineStyle );
sal_uInt32 nLineWidth = 0;
- sal_uInt32 nColor = 0;
+ ::Color nColor;
sal_Int32 nColorAlpha = MAX_PERCENT;
bool bColorSet = false;
const char* cap = nullptr;
@@ -588,8 +588,8 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
// get InteropGrabBag and search the relevant attributes
OUString sColorFillScheme;
- sal_uInt32 nOriginalColor = 0;
- sal_uInt32 nStyleColor = 0;
+ ::Color nOriginalColor;
+ ::Color nStyleColor;
sal_uInt32 nStyleLineWidth = 0;
Sequence<PropertyValue> aStyleProperties;
@@ -655,7 +655,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
default:
if ( GETA( LineColor ) )
{
- nColor = mAny.get<sal_uInt32>() & 0xffffff;
+ nColor = ::Color(mAny.get<sal_uInt32>() & 0xffffff);
bColorSet = true;
}
if ( GETA( LineTransparence ) )
@@ -1310,7 +1310,7 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs
mpFS->startElementNS( XML_a , XML_pattFill, XML_prst, GetHatchPattern(rHatch), FSEND );
mpFS->startElementNS( XML_a , XML_fgClr, FSEND );
- WriteColor(rHatch.Color);
+ WriteColor(::Color(rHatch.Color));
mpFS->endElementNS( XML_a , XML_fgClr );
::Color nColor = COL_WHITE;
@@ -1332,7 +1332,7 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs
}
mpFS->startElementNS( XML_a , XML_bgClr, FSEND );
- WriteColor(sal_uInt32(nColor), nAlpha);
+ WriteColor(nColor, nAlpha);
mpFS->endElementNS( XML_a , XML_bgClr );
mpFS->endElementNS( XML_a , XML_pattFill );
@@ -1738,14 +1738,14 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
// mso doesn't like text color to be placed after typeface
if( CGETAD( CharColor ) )
{
- sal_uInt32 color = *o3tl::doAccess<sal_uInt32>(mAny);
- SAL_INFO("oox.shape", "run color: " << color << " auto: " << sal_uInt32(COL_AUTO));
+ ::Color color( *o3tl::doAccess<sal_uInt32>(mAny) );
+ SAL_INFO("oox.shape", "run color: " << sal_uInt32(color) << " auto: " << sal_uInt32(COL_AUTO));
// tdf#104219 In LibreOffice and MS Office, there are two types of colors:
// Automatic and Fixed. OOXML is setting automatic color, by not providing color.
- if( color != sal_uInt32(COL_AUTO) )
+ if( color != COL_AUTO )
{
- color &= 0xffffff;
+ color.SetTransparency(0);
// TODO: special handle embossed/engraved
WriteSolidFill( color );
}
@@ -1753,9 +1753,9 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
if( ( underline != nullptr ) && CGETAD( CharUnderlineColor ) )
{
- sal_uInt32 color = *o3tl::doAccess<sal_uInt32>(mAny);
+ ::Color color = ::Color(*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 != sal_uInt32(COL_AUTO) )
+ if( color != COL_AUTO )
{
mpFS->startElementNS( XML_a, XML_uFill, FSEND);
WriteSolidFill( color );
@@ -2078,7 +2078,7 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
uno::Reference<graphic::XGraphic> xGraphic;
sal_Int16 nBulletRelSize = 0;
sal_Int16 nStartWith = 1;
- sal_uInt32 nBulletColor = 0;
+ ::Color nBulletColor;
bool bHasBulletColor = false;
awt::Size aGraphicSize;
@@ -2105,7 +2105,7 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
}
else if(aPropName == "BulletColor")
{
- nBulletColor = *o3tl::doAccess<sal_uInt32>(pPropValue[i].Value);
+ nBulletColor = ::Color(*o3tl::doAccess<sal_uInt32>(pPropValue[i].Value));
bHasBulletColor = true;
}
else if ( aPropName == "BulletChar" )
@@ -2196,9 +2196,9 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
{
if(bHasBulletColor)
{
- if (nBulletColor == sal_uInt32(COL_AUTO) )
+ if (nBulletColor == COL_AUTO )
{
- nBulletColor = mbIsBackgroundDark ? 0xffffff : 0x000000;
+ nBulletColor = ::Color(mbIsBackgroundDark ? 0xffffff : 0x000000);
}
mpFS->startElementNS( XML_a, XML_buClr, FSEND );
WriteColor( nBulletColor );
@@ -3252,7 +3252,7 @@ void DrawingML::WriteShapeEffect( const OUString& sName, const Sequence< Propert
nEffectToken = FSNS( XML_a, XML_blur );
OUString sSchemeClr;
- sal_uInt32 nRgbClr = 0;
+ ::Color nRgbClr;
sal_Int32 nAlpha = MAX_PERCENT;
Sequence< PropertyValue > aTransformations;
sax_fastparser::FastAttributeList *aOuterShdwAttrList = FastSerializerHelper::createAttrList();
@@ -3754,7 +3754,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet )
if( aExtrusionColorProps.getLength() > 0 )
{
OUString sSchemeClr;
- sal_Int32 nColor(0);
+ ::Color nColor;
sal_Int32 nTransparency(0);
Sequence< PropertyValue > aColorTransformations;
for( sal_Int32 i=0; i < aExtrusionColorProps.getLength(); ++i )
@@ -3780,7 +3780,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet )
if( aContourColorProps.getLength() > 0 )
{
OUString sSchemeClr;
- sal_Int32 nColor(0);
+ ::Color nColor;
sal_Int32 nTransparency(0);
Sequence< PropertyValue > aColorTransformations;
for( sal_Int32 i=0; i < aContourColorProps.getLength(); ++i )