Kaydet (Commit) 3f1f2d71 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

drawingml: remove AUTONUM macro, unneded checks

Change-Id: Ie0ad7ed9df9d0d1b19fa09b3a4b93a5cbd6b41c6
üst 2fa3aed1
...@@ -1386,7 +1386,8 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun ) ...@@ -1386,7 +1386,8 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun )
if( sText.isEmpty()) { if( sText.isEmpty()) {
Reference< XPropertySet > xPropSet( rRun, UNO_QUERY ); Reference< XPropertySet > xPropSet( rRun, UNO_QUERY );
try { try
{
if( !xPropSet.is() || !( xPropSet->getPropertyValue( "PlaceholderText" ) >>= sText ) ) if( !xPropSet.is() || !( xPropSet->getPropertyValue( "PlaceholderText" ) >>= sText ) )
return; return;
if( sText.isEmpty() ) if( sText.isEmpty() )
...@@ -1422,44 +1423,45 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun ) ...@@ -1422,44 +1423,45 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun )
mpFS->endElementNS( XML_a, XML_r ); mpFS->endElementNS( XML_a, XML_r );
} }
#define AUTONUM(x) \ OUString GetAutoNumType(sal_Int16 nNumberingType, bool bSDot, bool bPBehind, bool bPBoth)
if( bPBoth ) \
pAutoNumType = #x "ParenBoth"; \
else if( bPBehind ) \
pAutoNumType = #x "ParenR"; \
else if( bSDot ) \
pAutoNumType = #x "Period";
inline static const char* GetAutoNumType( sal_Int16 nNumberingType, bool bSDot, bool bPBehind, bool bPBoth )
{ {
const char* pAutoNumType = NULL; OUString sPrefixSuffix;
if (bPBoth)
sPrefixSuffix = "ParenBoth";
else if (bPBehind)
sPrefixSuffix = "ParenR";
else if (bSDot)
sPrefixSuffix = "Period";
switch( (SvxExtNumType)nNumberingType ) switch( (SvxExtNumType)nNumberingType )
{ {
case SVX_NUM_CHARS_UPPER_LETTER_N : case SVX_NUM_CHARS_UPPER_LETTER_N :
case SVX_NUM_CHARS_UPPER_LETTER : case SVX_NUM_CHARS_UPPER_LETTER :
AUTONUM( alphaUc ); return OUString("alphaUc") + sPrefixSuffix;
break;
case SVX_NUM_CHARS_LOWER_LETTER_N : case SVX_NUM_CHARS_LOWER_LETTER_N :
case SVX_NUM_CHARS_LOWER_LETTER : case SVX_NUM_CHARS_LOWER_LETTER :
AUTONUM( alphaLc ); return OUString("alphaLc") + sPrefixSuffix;
break;
case SVX_NUM_ROMAN_UPPER : case SVX_NUM_ROMAN_UPPER :
AUTONUM( romanUc ); return OUString("romanUc") + sPrefixSuffix;
break;
case SVX_NUM_ROMAN_LOWER : case SVX_NUM_ROMAN_LOWER :
AUTONUM( romanLc ); return OUString("romanLc") + sPrefixSuffix;
break;
case SVX_NUM_ARABIC : case SVX_NUM_ARABIC :
AUTONUM( arabic ) {
if (sPrefixSuffix.isEmpty())
return OUString("arabicPlain");
else else
pAutoNumType = "arabicPlain"; return OUString("arabic") + sPrefixSuffix;
break; }
default: default:
break; break;
} }
return pAutoNumType; return OUString();
} }
void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sal_Int16 nLevel ) void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sal_Int16 nLevel )
...@@ -1520,7 +1522,6 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1520,7 +1522,6 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
else if ( aPropName == "BulletChar" ) else if ( aPropName == "BulletChar" )
{ {
aBulletChar = OUString ( *( (OUString*)pValue ) )[ 0 ]; aBulletChar = OUString ( *( (OUString*)pValue ) )[ 0 ];
//printf ("bullet char: %d\n", aBulletChar.getStr());
} }
else if ( aPropName == "BulletFont" ) else if ( aPropName == "BulletFont" )
{ {
...@@ -1549,7 +1550,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1549,7 +1550,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
if ( pPropValue[ i ].Value.getValueType() == cppu::UnoType<awt::Size>::get()) if ( pPropValue[ i ].Value.getValueType() == cppu::UnoType<awt::Size>::get())
{ {
// don't cast awt::Size to Size as on 64-bits they are not the same. // don't cast awt::Size to Size as on 64-bits they are not the same.
::com::sun::star::awt::Size aSize; css::awt::Size aSize;
pPropValue[ i ].Value >>= aSize; pPropValue[ i ].Value >>= aSize;
//aBuGraSize.nA = aSize.Width; //aBuGraSize.nA = aSize.Width;
//aBuGraSize.nB = aSize.Height; //aBuGraSize.nB = aSize.Height;
...@@ -1559,10 +1560,6 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1559,10 +1560,6 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
} }
} }
const char* pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth );
if( nLevel >= 0 )
{
if( !aGraphicURL.isEmpty() ) if( !aGraphicURL.isEmpty() )
{ {
OUString sRelId = WriteImage( aGraphicURL ); OUString sRelId = WriteImage( aGraphicURL );
...@@ -1582,13 +1579,18 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1582,13 +1579,18 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
XML_charset, (aFontDesc.CharSet == awt::CharSet::SYMBOL) ? "2" : NULL, XML_charset, (aFontDesc.CharSet == awt::CharSet::SYMBOL) ? "2" : NULL,
FSEND ); FSEND );
if( pAutoNumType ) OUString pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth );
mpFS->singleElementNS( XML_a, XML_buAutoNum, XML_type, pAutoNumType, FSEND );
if (!pAutoNumType.isEmpty())
{
mpFS->singleElementNS(XML_a, XML_buAutoNum,
XML_type, OUStringToOString(pAutoNumType, RTL_TEXTENCODING_UTF8).getStr(),
FSEND);
}
else else
{ {
aBulletChar = SubstituteBullet( aBulletChar, aFontDesc ); aBulletChar = SubstituteBullet( aBulletChar, aFontDesc );
mpFS->singleElementNS( XML_a, XML_buChar, XML_char, USS( OUString( aBulletChar ) ), FSEND ); mpFS->singleElementNS(XML_a, XML_buChar, XML_char, USS( OUString( aBulletChar ) ), FSEND);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment