diff options
author | Muthu Subramanian <sumuthu@novell.com> | 2011-08-24 13:34:37 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@novell.com> | 2011-08-24 21:32:38 +0530 |
commit | f1a2b0cb3c221c6cc09fd2d1091d20254ddbcb3a (patch) | |
tree | 2c3e49e6efc0eb0ce847169cf63ac80bce34fc26 /oox | |
parent | a02a4272e05d863061ea7c2ac142420d1f51b7ca (diff) |
n#592912: When text is vertical, horiz & vert aligns are swapped.
- vert270 doesn't seem to be supported by LO.
- vert270 would be WritingMode_TB_LR ? otherwise we need to support it
by doing other operations like rotation or flip. Is that necessary ?
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/textbodypropertiescontext.cxx | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 7cc7affbbb24..ed95ee7be1bc 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -86,21 +86,6 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, mrTextBodyProp.maPropertyMap[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( nBottonInset ); } - // ST_TextAnchoringType - if( xAttributes->hasAttribute( XML_anchor ) ) { - drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP ); - switch( xAttributes->getOptionalValueToken( XML_anchor, XML_t ) ) - { - case XML_b : eVA = drawing::TextVerticalAdjust_BOTTOM; break; - case XML_dist : - case XML_just : - case XML_ctr : eVA = drawing::TextVerticalAdjust_CENTER; break; - default: - case XML_t : eVA = drawing::TextVerticalAdjust_TOP; break; - } - mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= eVA; - } - bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false ); if( xAttributes->hasAttribute( XML_anchorCtr ) ) { if( bAnchorCenter ) @@ -139,11 +124,39 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, // workaround for TB_LR as using WritingMode2 doesn't work if( !bAnchorCenter ) mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<= - TextHorizontalAdjust_LEFT; + (tVert == XML_vert270) ? TextHorizontalAdjust_RIGHT : TextHorizontalAdjust_LEFT; + // Default for vert270 + if( tVert == XML_vert270 ) + mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= drawing::TextVerticalAdjust_BOTTOM; } else mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ] <<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB ); } + + // ST_TextAnchoringType + if( xAttributes->hasAttribute( XML_anchor ) ) { + drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP ); + switch( xAttributes->getOptionalValueToken( XML_anchor, XML_t ) ) + { + case XML_b : eVA = drawing::TextVerticalAdjust_BOTTOM; break; + case XML_dist : + case XML_just : + case XML_ctr : eVA = drawing::TextVerticalAdjust_CENTER; break; + default: + case XML_t : eVA = drawing::TextVerticalAdjust_TOP; break; + } + if( !xAttributes->hasAttribute( XML_vert ) ) + mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= eVA; + else + { + if( ( mrTextBodyProp.moVert.get( XML_horz ) == XML_vert && eVA == drawing::TextVerticalAdjust_TOP ) || + ( mrTextBodyProp.moVert.get( XML_horz ) == XML_vert270 && eVA == drawing::TextVerticalAdjust_BOTTOM ) ) + { + mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<= + TextHorizontalAdjust_RIGHT; + } + } + } } // -------------------------------------------------------------------- |