diff options
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/drawingml/textfield.hxx | 2 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/textrun.hxx | 2 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/textspacing.hxx | 7 | ||||
-rw-r--r-- | oox/source/drawingml/textfield.cxx | 7 | ||||
-rw-r--r-- | oox/source/drawingml/textparagraph.cxx | 10 | ||||
-rw-r--r-- | oox/source/drawingml/textparagraphproperties.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/textrun.cxx | 7 |
7 files changed, 24 insertions, 15 deletions
diff --git a/oox/inc/oox/drawingml/textfield.hxx b/oox/inc/oox/drawingml/textfield.hxx index 89febd3b5934..a10791dfd8c6 100644 --- a/oox/inc/oox/drawingml/textfield.hxx +++ b/oox/inc/oox/drawingml/textfield.hxx @@ -50,7 +50,7 @@ public: inline void setType( const ::rtl::OUString& sType ) { msType = sType; } inline void setUuid( const ::rtl::OUString & sUuid ) { msUuid = sUuid; } - virtual void insertAt( + virtual sal_Int32 insertAt( const ::oox::core::XmlFilterBase& rFilterBase, const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText, const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt, diff --git a/oox/inc/oox/drawingml/textrun.hxx b/oox/inc/oox/drawingml/textrun.hxx index 3fe6fedbd1a0..84539331ea2d 100644 --- a/oox/inc/oox/drawingml/textrun.hxx +++ b/oox/inc/oox/drawingml/textrun.hxx @@ -50,7 +50,7 @@ public: inline void setLineBreak() { mbIsLineBreak = true; } - virtual void insertAt( + virtual sal_Int32 insertAt( const ::oox::core::XmlFilterBase& rFilterBase, const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText >& xText, const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor >& xAt, diff --git a/oox/inc/oox/drawingml/textspacing.hxx b/oox/inc/oox/drawingml/textspacing.hxx index ce833851e854..6133c262418e 100644 --- a/oox/inc/oox/drawingml/textspacing.hxx +++ b/oox/inc/oox/drawingml/textspacing.hxx @@ -62,12 +62,7 @@ namespace oox { namespace drawingml { sal_Int32 toMargin( float fFontSize ) const { if ( nUnit == PERCENT ) - { - double fMargin = ( fFontSize * 2540 + 36 ) / 72; - fMargin *= nValue; - fMargin /= 100000; - return static_cast< sal_Int32 >( fMargin ); - } + return (sal_Int32) ((((fFontSize*nValue)/1000)*254 + 360)/720); else return nValue; } 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; } |