summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2015-08-02 14:40:18 +0800
committerKatarina Behrens <Katarina.Behrens@cib.de>2015-11-26 10:39:56 +0000
commit0b5e3885bc706ed02acac1c682c90171700b0cac (patch)
tree53ad17067ea8d34ba417007ddeb462a782711f52 /oox
parentd130afe6c04dd53b5500e3b9335ca2e615aa6bb6 (diff)
Fix tdf#80224 Custom text color changed to black on .PPTX export
1) Write endParaRPr so that PowerPoint display them properly. 2) Original design forbid properites with default value to be exprted, now fixed. 3) Automatic colors are written as white or black based on whether background is dark. Note that tdf#77881,tdf#80520,tdf#89525 depend on this. Change-Id: I255c16f35149b738be2daf2800b1c90389f2c7cf Reviewed-on: https://gerrit.libreoffice.org/17472 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/19862 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx33
1 files changed, 21 insertions, 12 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 493a8945db53..67a5dadabd3a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -113,6 +113,9 @@ namespace drawingml {
if ( GETA(propName) ) \
mAny >>= variable;
+#define CGETAD(propName) \
+ (( bCheckDirect && GetPropertyAndState( rXPropSet, rXPropState, OUString( #propName ), eState ) && eState == beans::PropertyState_DIRECT_VALUE )||GetProperty( rXPropSet, OUString( #propName ) ))
+
// not thread safe
int DrawingML::mnImageCounter = 1;
int DrawingML::mnWdpImageCounter = 1;
@@ -1214,7 +1217,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
sal_Int32 nSize = 1800;
sal_Int32 nCharEscapement = 0;
sal_Int32 nCharKerning = 0;
-
+ bool bCheckDirect = XML_endParaRPr != nElement ;
if( GETA( CharHeight ) )
nSize = (sal_Int32) (100*(*static_cast<float const *>(mAny.getValue())));
@@ -1245,7 +1248,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
break;
}
- if ( GETAD( CharUnderline ) )
+ if ( CGETAD( CharUnderline ) )
{
switch ( *static_cast<sal_Int16 const *>(mAny.getValue()) )
{
@@ -1300,7 +1303,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
}
}
- if ( GETAD( CharStrikeout ) )
+ if ( CGETAD( CharStrikeout ) )
{
switch ( *static_cast<sal_Int16 const *>(mAny.getValue()) )
{
@@ -1374,16 +1377,14 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
FSEND );
// mso doesn't like text color to be placed after typeface
- if( GETAD( CharColor ) )
+ if( CGETAD( CharColor ) )
{
sal_uInt32 color = *static_cast<sal_uInt32 const *>(mAny.getValue());
DBG(fprintf(stderr, "run color: %x auto: %x\n", static_cast<unsigned int>( color ), static_cast<unsigned int>( COL_AUTO )));
if( color == COL_AUTO ) // nCharColor depends to the background color
{
- bool bIsDark = false;
- GET( bIsDark, IsBackgroundDark );
- color = bIsDark ? 0xffffff : 0x000000;
+ color = mbIsBackgroundDark ? COL_WHITE : COL_BLACK ;
}
color &= 0xffffff;
@@ -1392,7 +1393,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
WriteSolidFill( color );
}
- if( GETAD( CharUnderlineColor ) )
+ if( CGETAD( CharUnderlineColor ) )
{
sal_uInt32 color = *static_cast<sal_uInt32 const *>(mAny.getValue());
@@ -1677,7 +1678,8 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
OUString aGraphicURL;
sal_Int16 nBulletRelSize = 0;
sal_Int16 nStartWith = 1;
- sal_Int32 nBulletColor = 0;
+ sal_uInt32 nBulletColor = 0;
+ bool bHasBulletColor = false;
for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
{
@@ -1704,7 +1706,8 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
}
else if(aPropName == "BulletColor")
{
- nBulletColor = *static_cast<sal_Int32 const *>(pValue);
+ nBulletColor = *static_cast<sal_uInt32 const *>(pValue);
+ bHasBulletColor = true;
}
else if ( aPropName == "BulletChar" )
{
@@ -1764,8 +1767,12 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
}
else
{
- if(nBulletColor)
+ if(bHasBulletColor)
{
+ if (nBulletColor == COL_AUTO )
+ {
+ nBulletColor = mbIsBackgroundDark ? COL_WHITE : COL_BLACK ;
+ }
mpFS->startElementNS( XML_a, XML_buClr, FSEND );
WriteColor( nBulletColor );
mpFS->endElementNS( XML_a, XML_buClr );
@@ -1962,6 +1969,7 @@ void DrawingML::WriteParagraph( Reference< XTextContent > rParagraph )
mpFS->startElementNS( XML_a, XML_p, FSEND );
+
bool bPropertiesWritten = false;
while( enumeration->hasMoreElements() )
{
@@ -1978,7 +1986,8 @@ void DrawingML::WriteParagraph( Reference< XTextContent > rParagraph )
WriteRun( run );
}
}
- mpFS->singleElementNS( XML_a, XML_endParaRPr, FSEND );
+ Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY );
+ WriteRunProperties( rXPropSet , false, XML_endParaRPr );
mpFS->endElementNS( XML_a, XML_p );
}