diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-02-21 21:49:56 +0100 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-02-21 22:11:35 +0100 |
commit | 12f22bd7811d75eacc36f8ee8bc448bdbccb0b65 (patch) | |
tree | 26c837c42311202db44ce16e25fd30b675a81989 /oox/source/drawingml | |
parent | a14f55e0785664d04ec74aa060e6a1bcd661f183 (diff) |
drawingML import: paragraph spacing inside group shape
unotext: a conversion was missing during the corresponding
SvxLineSpacingItem was filled with "ParaLineSpacing" UNO property.
Change-Id: I02559ed7e8b46150a88eed2bf20afdf084aec47b
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/textparagraph.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/textparagraphproperties.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/textparagraphpropertiescontext.cxx | 68 |
3 files changed, 66 insertions, 8 deletions
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx index 70108470df06..0ac8b05b38a2 100644 --- a/oox/source/drawingml/textparagraph.cxx +++ b/oox/source/drawingml/textparagraph.cxx @@ -114,7 +114,7 @@ void TextParagraph::insertAt( && (*maRuns.begin())->getTextCharacterProperties().maCharColor.isUsed() ) aioBulletList[ PROP_BulletColor ] <<= (*maRuns.begin())->getTextCharacterProperties().maCharColor.getColor( rFilterBase.getGraphicHelper() ); - float fCharacterSize = nCharHeight > 0 ? GetFontHeight ( nCharHeight ) : pTextParagraphStyle->getCharHeightPoints( 18 ); + float fCharacterSize = nCharHeight > 0 ? GetFontHeight ( nCharHeight ) : pTextParagraphStyle->getCharHeightPoints( 12 ); aParaProp.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), sal_True, fCharacterSize, true ); } diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx index 585695deb042..65dd0aa130b6 100644 --- a/oox/source/drawingml/textparagraphproperties.cxx +++ b/oox/source/drawingml/textparagraphproperties.cxx @@ -400,9 +400,9 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p maBulletList.pushToPropMap( pFilterBase, rioBulletMap ); if ( maParaTopMargin.bHasValue || bPushDefaultValues ) - aPropSet.setProperty( PROP_ParaTopMargin, maParaTopMargin.toMargin( fCharacterSize != 0.0 ? fCharacterSize : getCharHeightPoints ( 18.0 ) ) ); + aPropSet.setProperty( PROP_ParaTopMargin, maParaTopMargin.toMargin( fCharacterSize != 0.0 ? fCharacterSize : getCharHeightPoints ( 12.0 ) ) ); if ( maParaBottomMargin.bHasValue || bPushDefaultValues ) - aPropSet.setProperty( PROP_ParaBottomMargin, maParaBottomMargin.toMargin( fCharacterSize != 0.0 ? fCharacterSize : getCharHeightPoints ( 18.0 ) ) ); + aPropSet.setProperty( PROP_ParaBottomMargin, maParaBottomMargin.toMargin( fCharacterSize != 0.0 ? fCharacterSize : getCharHeightPoints ( 12.0 ) ) ); if ( nNumberingType == NumberingType::BITMAP ) { fCharacterSize = getCharHeightPoints( fCharacterSize ); diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index 36860f08c02c..99a0c0c18ee4 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -263,12 +263,70 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl break; case OOX_TOKEN( doc, spacing ): { - OptValue<OUString> oBefore = rAttribs.getString(OOX_TOKEN(doc, before)); - if (oBefore.has()) + // Spacing before + if( !rAttribs.getBool(OOX_TOKEN(doc, beforeAutospacing), false) ) { - TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); - rSpacing.nValue = TWIPS_TO_MM(oBefore.get().toInt32()); - rSpacing.bHasValue = true; + OptValue<sal_Int32> oBefore = rAttribs.getInteger(OOX_TOKEN(doc, before)); + if (oBefore.has()) + { + TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); + rSpacing.nUnit = TextSpacing::POINTS; + rSpacing.nValue = TWIPS_TO_MM(oBefore.get()); + rSpacing.bHasValue = true; + } + else + { + OptValue<sal_Int32> oBeforeLines = rAttribs.getInteger(OOX_TOKEN(doc, beforeLines)); + if (oBeforeLines.has()) + { + TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); + rSpacing.nUnit = TextSpacing::PERCENT; + rSpacing.nValue = oBeforeLines.get() * MAX_PERCENT / 100; + rSpacing.bHasValue = true; + } + } + } + + // Spacing after + if( !rAttribs.getBool(OOX_TOKEN(doc, afterAutospacing), false) ) + { + OptValue<sal_Int32> oAfter = rAttribs.getInteger(OOX_TOKEN(doc, after)); + if (oAfter.has()) + { + TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); + rSpacing.nUnit = TextSpacing::POINTS; + rSpacing.nValue = TWIPS_TO_MM(oAfter.get()); + rSpacing.bHasValue = true; + } + else + { + OptValue<sal_Int32> oAfterLines = rAttribs.getInteger(OOX_TOKEN(doc, afterLines)); + if (oAfterLines.has()) + { + TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); + rSpacing.nUnit = TextSpacing::PERCENT; + rSpacing.nValue = oAfterLines.get() * MAX_PERCENT / 100; + rSpacing.bHasValue = true; + } + } + } + + // Line spacing + OptValue<OUString> oLineRule = rAttribs.getString(OOX_TOKEN(doc, lineRule)); + OptValue<sal_Int32> oLineSpacing = rAttribs.getInteger(OOX_TOKEN(doc, line)); + if (oLineSpacing.has()) + { + if( !oLineRule.has() || oLineRule.get() == "auto" ) + { + maLineSpacing.nUnit = TextSpacing::PERCENT; + maLineSpacing.nValue = oLineSpacing.get() * MAX_PERCENT / 240; + } + else + { + maLineSpacing.nUnit = TextSpacing::POINTS; + maLineSpacing.nValue = TWIPS_TO_MM(oLineSpacing.get()); + } + maLineSpacing.bHasValue = true; } } break; |