summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorRadek Doulik <rodo@novell.com>2011-03-30 17:32:44 +0200
committerRadek Doulik <rodo@novell.com>2011-03-30 17:36:59 +0200
commit97ed03b04834e56ab0b9360eef6638e7cfc56076 (patch)
treea97a2fdcfe10ef62b0c1cf2ba80147de19aedf91 /oox/source
parent4912be984caa4d33e9d43d61d70e34449c355d8e (diff)
fix import of percentual top and bottom paragraph margins
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/drawingml/textfield.cxx7
-rw-r--r--oox/source/drawingml/textparagraph.cxx10
-rw-r--r--oox/source/drawingml/textparagraphproperties.cxx4
-rw-r--r--oox/source/drawingml/textrun.cxx7
4 files changed, 21 insertions, 7 deletions
diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx
index a02cebc7bf8a..2eb831c89c09 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -139,12 +139,13 @@ void lclCreateTextFields( std::list< Reference< XTextField > > & aFields,
} // namespace
-void TextField::insertAt(
+sal_Int32 TextField::insertAt(
const ::oox::core::XmlFilterBase& rFilterBase,
const Reference < XText > & xText,
const Reference < XTextCursor > &xAt,
const TextCharacterProperties& rTextCharacterStyle ) const
{
+ sal_Int32 nCharHeight = 0;
try
{
PropertyMap aioBulletList;
@@ -157,6 +158,8 @@ void TextField::insertAt(
TextCharacterProperties aTextCharacterProps( rTextCharacterStyle );
aTextCharacterProps.assignUsed( maTextParagraphProperties.getTextCharacterProperties() );
aTextCharacterProps.assignUsed( getTextCharacterProperties() );
+ if ( aTextCharacterProps.moHeight.has() )
+ nCharHeight = aTextCharacterProps.moHeight.get();
aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase );
std::list< Reference< XTextField > > fields;
@@ -191,6 +194,8 @@ void TextField::insertAt(
{
OSL_TRACE("OOX: TextField::insertAt() exception");
}
+
+ return nCharHeight;
}
} }
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx
index 9ca2650bc7ba..54ae10ba1f80 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -80,19 +80,23 @@ void TextParagraph::insertAt(
xText->insertControlCharacter( xStart, ControlCharacter::APPEND_PARAGRAPH, sal_False );
xAt->gotoEnd( sal_True );
}
+
+ sal_Int32 nCharHeight = 0;
if ( maRuns.begin() == maRuns.end() )
{
PropertySet aPropSet( xStart );
TextCharacterProperties aTextCharacterProps( aTextCharacterStyle );
aTextCharacterProps.assignUsed( maEndProperties );
+ if ( aTextCharacterProps.moHeight.has() )
+ nCharHeight = aTextCharacterProps.moHeight.get();
aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase );
}
else
{
for( TextRunVector::const_iterator aIt = maRuns.begin(), aEnd = maRuns.end(); aIt != aEnd; ++aIt )
{
- (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle );
+ nCharHeight = std::max< sal_Int32 >( nCharHeight, (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle ) );
nParagraphSize += (*aIt)->getText().getLength();
}
}
@@ -100,11 +104,11 @@ void TextParagraph::insertAt(
PropertyMap aioBulletList;
Reference< XPropertySet > xProps( xStart, UNO_QUERY);
- float fCharacterSize = 18;
+ float fCharacterSize = nCharHeight > 0 ? GetFontHeight( nCharHeight ) : 18;
if ( pTextParagraphStyle.get() )
{
pTextParagraphStyle->pushToPropSet( &rFilterBase, xProps, aioBulletList, NULL, sal_False, fCharacterSize );
- fCharacterSize = pTextParagraphStyle->getCharHeightPoints( 18 );
+ fCharacterSize = pTextParagraphStyle->getCharHeightPoints( fCharacterSize );
}
maProperties.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), sal_True, fCharacterSize );
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index dbcc6f0194aa..e2130b394d60 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -405,9 +405,9 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
maBulletList.pushToPropMap( pFilterBase, rioBulletMap );
if ( maParaTopMargin.bHasValue )
- aPropSet.setProperty( PROP_ParaTopMargin, maParaTopMargin.toMargin( getCharHeightPoints( 18.0 ) ) );
+ aPropSet.setProperty( PROP_ParaTopMargin, maParaTopMargin.toMargin( fCharacterSize != 0.0 ? fCharacterSize : getCharHeightPoints ( 18.0 ) ) );
if ( maParaBottomMargin.bHasValue )
- aPropSet.setProperty( PROP_ParaBottomMargin, maParaBottomMargin.toMargin( getCharHeightPoints( 18.0 ) ) );
+ aPropSet.setProperty( PROP_ParaBottomMargin, maParaBottomMargin.toMargin( fCharacterSize != 0.0 ? fCharacterSize : getCharHeightPoints ( 18.0 ) ) );
if ( nNumberingType == NumberingType::BITMAP )
{
fCharacterSize = getCharHeightPoints( fCharacterSize );
diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx
index 89fa6d832db8..931970bcf394 100644
--- a/oox/source/drawingml/textrun.cxx
+++ b/oox/source/drawingml/textrun.cxx
@@ -55,18 +55,21 @@ TextRun::~TextRun()
{
}
-void TextRun::insertAt(
+sal_Int32 TextRun::insertAt(
const ::oox::core::XmlFilterBase& rFilterBase,
const Reference < XText > & xText,
const Reference < XTextCursor > &xAt,
const TextCharacterProperties& rTextCharacterStyle ) const
{
+ sal_Int32 nCharHeight = 0;
try {
Reference< XTextRange > xStart( xAt, UNO_QUERY );
PropertySet aPropSet( xStart );
TextCharacterProperties aTextCharacterProps( rTextCharacterStyle );
aTextCharacterProps.assignUsed( maTextCharacterProperties );
+ if ( aTextCharacterProps.moHeight.has() )
+ nCharHeight = aTextCharacterProps.moHeight.get();
aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase );
if( maTextCharacterProperties.maHyperlinkPropertyMap.empty() )
@@ -163,6 +166,8 @@ void TextRun::insertAt(
{
OSL_TRACE("OOX: TextRun::insertAt() exception");
}
+
+ return nCharHeight;
}