22 #include <com/sun/star/text/WritingMode.hpp>
23 #include <com/sun/star/drawing/TextFitToSizeType.hpp>
24 #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
25 #include <com/sun/star/text/XTextColumns.hpp>
34 #include <oox/token/namespaces.hxx>
35 #include <oox/token/properties.hxx>
36 #include <oox/token/tokens.hxx>
50 const AttributeList& rAttribs,
52 : TextBodyPropertiesContext(rParent, rAttribs, pShapePtr->getTextBody()->getTextProperties())
54 mpShapePtr = pShapePtr;
58 const AttributeList& rAttribs, TextBodyProperties& rTextBodyProp )
59 : ContextHandler2( rParent )
60 , mrTextBodyProp( rTextBodyProp )
63 sal_Int32 nWrappingType = rAttribs.getToken( XML_wrap, XML_square );
64 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextWordWrap, nWrappingType == XML_square );
68 sal_Int32 aIns[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns };
71 sValue = rAttribs.getString( aIns[
i] ).get();
72 if( !sValue.isEmpty() )
76 mrTextBodyProp.mbAnchorCtr = rAttribs.getBool( XML_anchorCtr,
false );
77 if( mrTextBodyProp.mbAnchorCtr )
78 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextHorizontalAdjust, TextHorizontalAdjust_CENTER );
82 bool bFromWordArt = rAttribs.getBool(XML_fromWordArt,
false);
83 mrTextBodyProp.maPropertyMap.setProperty(PROP_FromWordArt, bFromWordArt);
86 mrTextBodyProp.msHorzOverflow = rAttribs.getString(XML_horzOverflow,
"");
88 mrTextBodyProp.msVertOverflow = rAttribs.getString(XML_vertOverflow,
"");
91 if (
const sal_Int32 nColumns = rAttribs.getInteger(XML_numCol, 0); nColumns > 0)
94 css::uno::UNO_QUERY_THROW);
95 xCols->setColumnCount(nColumns);
96 css::uno::Reference<css::beans::XPropertySet> xProps(xCols, css::uno::UNO_QUERY_THROW);
98 const sal_Int32 nSpacing =
o3tl::convert(rAttribs.getInteger(XML_spcCol, 0),
100 xProps->setPropertyValue(
"AutomaticDistance", css::uno::Any(nSpacing));
101 mrTextBodyProp.maPropertyMap.setAnyProperty(PROP_TextColumns, css::uno::Any(xCols));
105 mrTextBodyProp.moRotation = rAttribs.getInteger( XML_rot );
112 bool bUpright = rAttribs.getBool(XML_upright,
false);
114 mrTextBodyProp.moUpright =
true;
117 if( rAttribs.hasAttribute( XML_vert ) ) {
118 mrTextBodyProp.moVert = rAttribs.getToken( XML_vert );
119 sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz );
120 if (tVert == XML_vert || tVert == XML_eaVert || tVert == XML_mongolianVert)
121 mrTextBodyProp.moRotation = 5400000;
122 else if (tVert == XML_vert270)
123 mrTextBodyProp.moRotation = 5400000 * 3;
125 bool bRtl = rAttribs.getBool( XML_rtl,
false );
126 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextWritingMode,
127 ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB ));
132 if( rAttribs.hasAttribute( XML_anchor ) )
135 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextVerticalAdjust, mrTextBodyProp.meVA);
139 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextAutoGrowHeight,
false);
140 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextFitToSize, drawing::TextFitToSizeType_NONE);
145 switch( aElementToken )
148 case A_TOKEN( prstTxWarp ):
157 *(
mpShapePtr->getCustomShapeProperties() ) );
162 case A_TOKEN( prot ):
166 case A_TOKEN( noAutofit ):
169 case A_TOKEN( normAutofit ):
176 case A_TOKEN( spAutoFit ):
179 if( tVert != XML_vert && tVert != XML_eaVert && tVert != XML_vert270 && tVert != XML_mongolianVert )
184 case A_TOKEN( scene3d ):
193 case A_TOKEN( sp3d ):
198 mpShapePtr->getTextBody()->get3DProperties().mnExtrusionH = rAttribs.
getInteger(XML_extrusionH, 0);
210 case A_TOKEN( flatTx ):
TextVerticalAdjust GetTextVerticalAdjust(sal_Int32 nToken)
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
OptValue< OUString > getString(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute.
css::uno::Reference< css::uno::XInterface > SvxXTextColumns_createInstance() noexcept
OptValue< sal_Int32 > moVert
bool hasAttribute(sal_Int32 nAttrToken) const
Returns true, if the specified attribute is present.
#define SAL_N_ELEMENTS(arr)
TextBodyPropertiesContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttributes, TextBodyProperties &rTextBodyProp)
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
Provides access to attribute values of an element.
sal_Int32 mnFontScale
Normal autofit: font scale (default: 100%).
sal_Int32 GetCoordinate(sal_Int32 nValue)
converts EMUs into 1/100th mmm
TextBodyProperties & mrTextBodyProp
std::shared_ptr< Shape > ShapePtr
PropertyMap maPropertyMap
OptValue< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.