diff options
author | PriyankaGaikwad <priyanka.gaikwad@synerzip.com> | 2015-03-26 13:41:47 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-05-12 08:40:32 +0000 |
commit | a878ffae876610bf7522d79685b6e07191a88214 (patch) | |
tree | 455e2c5d747489dcc39bc1a4fddaedb67ed8d2a9 /oox/source | |
parent | 511499b3ba08024e3d6853f096ad1d96f96b216d (diff) |
tdf#90246 PPTX paragraph and bullet leftMargin and Indentation is not exported
Problem Description :
XML Difference
Original :
<a:pPr marL="360000" indent="-456840">
After RT :
<a:pPr>
Solution : added support for marL and indent for paragraph and bullet.
Change-Id: I1132d7b90ac1d7fc924f9a048f189e07e255e33b
Reviewed-on: https://gerrit.libreoffice.org/15016
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox/source')
-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 ) { |