ooxml10: oox-import-text-vert-anchor-and-anchorctr.diff from ooo-build

This commit is contained in:
Tor Lillqvist 2010-03-23 14:36:59 +02:00
parent 805c67052e
commit 5cfbc81647
7 changed files with 53 additions and 5 deletions

View file

@ -30,6 +30,7 @@
#include <boost/shared_ptr.hpp>
#include <com/sun/star/style/TabAlign.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
@ -118,6 +119,9 @@ float GetTextSize( const ::rtl::OUString& rValue );
/** converts the ST_TextSpacingPoint to 1/100mm */
sal_Int32 GetTextSpacingPoint( const ::rtl::OUString& sValue );
sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue );
::com::sun::star::drawing::TextVerticalAdjust GetTextVerticalAdjust( sal_Int32 nToken );
/** */
::com::sun::star::style::TabAlign GetTabAlign( ::sal_Int32 aToken );

View file

@ -52,6 +52,7 @@ struct TextCharacterProperties
Color maHighlightColor;
OptValue< ::rtl::OUString > moLang;
OptValue< sal_Int32 > moHeight;
OptValue< sal_Int32 > moSpacing;
OptValue< sal_Int32 > moUnderline;
OptValue< sal_Int32 > moStrikeout;
OptValue< sal_Int32 > moCaseMap;

View file

@ -37,8 +37,9 @@ using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::xml::sax::XFastAttributeList;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::style;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::geometry;
using namespace ::com::sun::star::style;
namespace oox {
namespace drawingml {
@ -125,10 +126,30 @@ sal_Int32 GetTextSpacingPoint( const OUString& sValue )
{
sal_Int32 nRet;
if( ::sax::Converter::convertNumber( nRet, sValue ) )
nRet = ( nRet * 254 + 360 ) / 720;
nRet = GetTextSpacingPoint( nRet );
return nRet;
}
sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue )
{
return ( nValue * 254 + 360 ) / 720;
}
TextVerticalAdjust GetTextVerticalAdjust( sal_Int32 nToken )
{
TextVerticalAdjust rVal = TextVerticalAdjust_TOP;
switch( nToken ) {
case XML_b:
rVal = TextVerticalAdjust_BOTTOM;
break;
case XML_ctr:
rVal = TextVerticalAdjust_CENTER;
break;
}
return rVal;
}
float GetFontHeight( sal_Int32 nHeight )
{

View file

@ -27,7 +27,9 @@
#include "oox/drawingml/textbodypropertiescontext.hxx"
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
#include <com/sun/star/text/WritingMode.hpp>
#include "oox/drawingml/textbodyproperties.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/helper/attributelist.hxx"
@ -38,8 +40,9 @@
using ::rtl::OUString;
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::text;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
namespace oox { namespace drawingml {
@ -78,9 +81,12 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent,
// ST_TextAnchoringType
// sal_Int32 nAnchoringType = xAttributes->getOptionalValueToken( XML_anchor, XML_t );
mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= GetTextVerticalAdjust( xAttributes->getOptionalValueToken( XML_anchor, XML_t ) );
// bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false );
bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false );
if( bAnchorCenter )
mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<=
TextHorizontalAdjust_CENTER;
// bool bCompatLineSpacing = aAttribs.getBool( XML_compatLnSpc, false );
// bool bForceAA = aAttribs.getBool( XML_forceAA, false );
@ -105,6 +111,15 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent,
// ST_TextVerticalType
mrTextBodyProp.moVert = aAttribs.getToken( XML_vert );
bool bRtl = aAttribs.getBool( XML_rtl, false );
if( mrTextBodyProp.moVert.get( XML_horz ) == XML_vert ) {
mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ]
<<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB );
// workaround for TB_LR as using WritingMode2 doesn't work
if( !bAnchorCenter )
mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<=
TextHorizontalAdjust_LEFT;
}
}
// --------------------------------------------------------------------

View file

@ -59,6 +59,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource
maHighlightColor.assignIfUsed( rSourceProps.maHighlightColor );
maUnderlineColor.assignIfUsed( rSourceProps.maUnderlineColor );
moHeight.assignIfUsed( rSourceProps.moHeight );
moSpacing.assignIfUsed( rSourceProps.moSpacing );
moUnderline.assignIfUsed( rSourceProps.moUnderline );
moStrikeout.assignIfUsed( rSourceProps.moStrikeout );
moCaseMap.assignIfUsed( rSourceProps.moCaseMap );
@ -126,6 +127,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
rPropMap[ PROP_CharHeightComplex ] <<= fHeight;
}
rPropMap[ PROP_CharKerning ] <<= (sal_Int16) GetTextSpacingPoint( moSpacing.get( 0 ) );
rPropMap[ PROP_CharUnderline ] <<= GetFontUnderline( moUnderline.get( XML_none ) );
rPropMap[ PROP_CharStrikeout ] <<= GetFontStrikeout( moStrikeout.get( XML_noStrike ) );
rPropMap[ PROP_CharCaseMap ] <<= GetCaseMap( moCaseMap.get( XML_none ) );

View file

@ -58,6 +58,7 @@ TextCharacterPropertiesContext::TextCharacterPropertiesContext(
AttributeList aAttribs( rXAttributes );
mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang );
mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz );
mrTextCharacterProperties.moSpacing = aAttribs.getInteger( XML_spc );
mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u );
mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike );
// mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap );

View file

@ -57,6 +57,7 @@ CharFontPitchComplex
CharHeight
CharHeightAsian
CharHeightComplex
CharKerning
CharLocale
CharLocaleAsian
CharLocaleComplex
@ -363,12 +364,14 @@ TargetFrame
TextAutoGrowHeight
TextBreak
TextColor
TextHorizontalAdjust
TextLeftDistance
TextLowerDistance
TextOverlap
TextRightDistance
TextRotation
TextUpperDistance
TextVerticalAdjust
TextWordWrap
TextWritingMode
Toggle