diff options
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/drawingml.cxx | 75 |
1 files changed, 69 insertions, 6 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 2287fdff8dda..36c0a9615b1e 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1764,6 +1764,48 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa } } +sal_Int32 DrawingML::getBulletMarginIndentation (Reference< XPropertySet > rXPropSet,sal_Int16 nLevel, const OUString& propName) +{ + if( nLevel < 0 || !GETA( NumberingRules ) ) + return 0; + + Reference< XIndexAccess > rXIndexAccess; + + if (!(mAny >>= rXIndexAccess) || nLevel >= rXIndexAccess->getCount()) + return 0; + + DBG(fprintf (stderr, "numbering rules\n")); + + Sequence<PropertyValue> aPropertySequence; + rXIndexAccess->getByIndex(nLevel) >>= aPropertySequence; + + if (!aPropertySequence.hasElements()) + return 0; + + sal_Int32 nPropertyCount = aPropertySequence.getLength(); + + const PropertyValue* pPropValue = aPropertySequence.getArray(); + + sal_Int16 nNumberingType = SVX_NUM_NUMBER_NONE; + + for ( sal_Int32 i = 0; i < nPropertyCount; i++ ) + { + const void* pValue = pPropValue[ i ].Value.getValue(); + if ( pValue ) + { + OUString aPropName( pPropValue[ i ].Name ); + DBG(fprintf (stderr, "pro name: %s\n", OUStringToOString( aPropName, RTL_TEXTENCODING_UTF8 ).getStr())); + if ( aPropName == propName ) + return *( static_cast<sal_Int32 const *>(pValue) ); + } + } + + if (nNumberingType == SVX_NUM_NUMBER_NONE) + return 0; + + return 0; +} + const char* DrawingML::GetAlignment( sal_Int32 nAlignment ) { const char* sAlignment = NULL; @@ -1832,16 +1874,37 @@ void DrawingML::WriteParagraphProperties( Reference< XTextContent > rParagraph ) } } + sal_Int32 nParaLeftMargin = 0; + sal_Int32 nParaFirstLineIndent = 0; + + GET( nParaLeftMargin, ParaLeftMargin ); + GET( nParaFirstLineIndent,ParaFirstLineIndent); + + sal_Int32 nLeftMargin = getBulletMarginIndentation ( rXPropSet, nLevel,"LeftMargin"); + sal_Int32 nLineIndentation = getBulletMarginIndentation ( rXPropSet, nLevel,"FirstLineOffset"); + if( nLevel != -1 || nAlignment != style::ParagraphAdjust_LEFT || bHasLinespacing ) { - mpFS->startElementNS( XML_a, XML_pPr, - XML_lvl, nLevel > 0 ? I32S( nLevel ) : NULL, - XML_marL, NULL, - XML_algn, GetAlignment( nAlignment ), - XML_rtl, bRtl ? BS(bRtl) : NULL, - FSEND ); + if (nParaLeftMargin) // For Paraghraph + mpFS->startElementNS( XML_a, XML_pPr, + XML_lvl, nLevel > 0 ? I32S( nLevel ) : NULL, + XML_marL, nParaLeftMargin > 0 ? I32S( oox::drawingml::convertHmmToEmu( nParaLeftMargin ) ) : NULL, + XML_indent, nParaFirstLineIndent ? I32S( oox::drawingml::convertHmmToEmu( nParaFirstLineIndent ) ) : NULL, + XML_algn, GetAlignment( nAlignment ), + XML_rtl, bRtl ? BS(bRtl) : NULL, + FSEND ); + else + mpFS->startElementNS( XML_a, XML_pPr, + XML_lvl, nLevel > 0 ? I32S( nLevel ) : NULL, + XML_marL, nLeftMargin > 0 ? I32S( oox::drawingml::convertHmmToEmu( nLeftMargin ) ) : NULL, + XML_indent, nLineIndentation ? I32S( oox::drawingml::convertHmmToEmu( nLineIndentation ) ) : NULL, + XML_algn, GetAlignment( nAlignment ), + XML_rtl, bRtl ? BS(bRtl) : NULL, + FSEND ); + + if( bHasLinespacing ) { |