Kaydet (Commit) a57a4078 authored tarafından Radek Doulik's avatar Radek Doulik

oox-pptx-import-fix-placeholder-text-style.diff: fix placeholders style.

n#592906, n#479834
üst 166bd174
...@@ -95,7 +95,8 @@ Reference< XFastContextHandler > ShapeContext::createFastChildContext( sal_Int32 ...@@ -95,7 +95,8 @@ Reference< XFastContextHandler > ShapeContext::createFastChildContext( sal_Int32
} }
case XML_ph: case XML_ph:
mpShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); mpShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) );
mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); if( xAttribs->hasAttribute( XML_idx ) )
mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );
break; break;
// nvSpPr CT_ShapeNonVisual end // nvSpPr CT_ShapeNonVisual end
......
...@@ -80,7 +80,8 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_ ...@@ -80,7 +80,8 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_
} }
case XML_ph: case XML_ph:
mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) ); mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) );
mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); if( xAttribs->hasAttribute( XML_idx ) )
mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );
break; break;
// nvSpPr CT_ShapeNonVisual end // nvSpPr CT_ShapeNonVisual end
......
...@@ -89,23 +89,26 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, ...@@ -89,23 +89,26 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent,
} }
// ST_TextAnchoringType // ST_TextAnchoringType
drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP ); if( xAttributes->hasAttribute( XML_anchor ) ) {
switch( xAttributes->getOptionalValueToken( XML_anchor, XML_t ) ) 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_b : eVA = drawing::TextVerticalAdjust_BOTTOM; break;
case XML_just : case XML_dist :
case XML_ctr : eVA = drawing::TextVerticalAdjust_CENTER; break; case XML_just :
default: case XML_ctr : eVA = drawing::TextVerticalAdjust_CENTER; break;
case XML_t : eVA = drawing::TextVerticalAdjust_TOP; break; default:
case XML_t : eVA = drawing::TextVerticalAdjust_TOP; break;
}
mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= eVA;
} }
mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= eVA;
bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false ); bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false );
if( bAnchorCenter ) if( xAttributes->hasAttribute( XML_anchorCtr ) ) {
mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<= if( bAnchorCenter )
TextHorizontalAdjust_CENTER; mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<=
TextHorizontalAdjust_CENTER;
}
// bool bCompatLineSpacing = aAttribs.getBool( XML_compatLnSpc, false ); // bool bCompatLineSpacing = aAttribs.getBool( XML_compatLnSpc, false );
// bool bForceAA = aAttribs.getBool( XML_forceAA, false ); // bool bForceAA = aAttribs.getBool( XML_forceAA, false );
// bool bFromWordArt = aAttribs.getBool( XML_fromWordArt, false ); // bool bFromWordArt = aAttribs.getBool( XML_fromWordArt, false );
...@@ -128,19 +131,21 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, ...@@ -128,19 +131,21 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent,
// bool bUpRight = aAttribs.getBool( XML_upright, 0 ); // bool bUpRight = aAttribs.getBool( XML_upright, 0 );
// ST_TextVerticalType // ST_TextVerticalType
mrTextBodyProp.moVert = aAttribs.getToken( XML_vert ); if( xAttributes->hasAttribute( XML_vert ) ) {
bool bRtl = aAttribs.getBool( XML_rtl, false ); mrTextBodyProp.moVert = aAttribs.getToken( XML_vert );
sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz ); bool bRtl = aAttribs.getBool( XML_rtl, false );
if( tVert == XML_vert || tVert == XML_eaVert || tVert == XML_vert270 || tVert == XML_mongolianVert ) { sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz );
mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ] if( tVert == XML_vert || tVert == XML_eaVert || tVert == XML_vert270 || tVert == XML_mongolianVert ) {
<<= WritingMode_TB_RL; mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ]
// workaround for TB_LR as using WritingMode2 doesn't work <<= WritingMode_TB_RL;
if( !bAnchorCenter ) // workaround for TB_LR as using WritingMode2 doesn't work
mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<= if( !bAnchorCenter )
TextHorizontalAdjust_LEFT; mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<=
} else TextHorizontalAdjust_LEFT;
mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ] } else
<<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB ); mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ]
<<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB );
}
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
......
...@@ -132,7 +132,8 @@ Reference< XFastContextHandler > PPTGraphicShapeContext::createFastChildContext( ...@@ -132,7 +132,8 @@ Reference< XFastContextHandler > PPTGraphicShapeContext::createFastChildContext(
OUString sIdx( xAttribs->getOptionalValue( XML_idx ) ); OUString sIdx( xAttribs->getOptionalValue( XML_idx ) );
sal_Bool bHasIdx = sIdx.getLength() > 0; sal_Bool bHasIdx = sIdx.getLength() > 0;
sal_Int32 nIdx = sIdx.toInt32(); sal_Int32 nIdx = sIdx.toInt32();
mpShapePtr->setSubTypeIndex( nIdx ); if( xAttribs->hasAttribute( XML_idx ) )
mpShapePtr->setSubTypeIndex( nIdx );
if ( nSubType || bHasIdx ) if ( nSubType || bHasIdx )
{ {
......
...@@ -170,7 +170,11 @@ void PPTShape::addShape( ...@@ -170,7 +170,11 @@ void PPTShape::addShape(
} }
} }
/* OSL_TRACE("shape service: %s", rtl::OUStringToOString(sServiceName, RTL_TEXTENCODING_UTF8 ).getStr());
if( mnSubType && aMasterTextListStyle && getSubTypeIndex() != -1 )
aMasterTextListStyle.reset();
// use placeholder index if possible // use placeholder index if possible
if( mnSubType && getSubTypeIndex() && rSlidePersist.getMasterPersist().get() ) { if( mnSubType && getSubTypeIndex() && rSlidePersist.getMasterPersist().get() ) {
oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() ); oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() );
...@@ -184,7 +188,7 @@ void PPTShape::addShape( ...@@ -184,7 +188,7 @@ void PPTShape::addShape(
aMasterTextListStyle = pNewTextListStyle; aMasterTextListStyle = pNewTextListStyle;
} }
} }
*/
if ( sServiceName.getLength() ) if ( sServiceName.getLength() )
{ {
// use style from master slide for placeholders only, otherwise use slide's style, which might be the default style from presentation // use style from master slide for placeholders only, otherwise use slide's style, which might be the default style from presentation
......
...@@ -116,7 +116,8 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In ...@@ -116,7 +116,8 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In
{ {
sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) );
mpShapePtr->setSubType( nSubType ); mpShapePtr->setSubType( nSubType );
mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); if( xAttribs->hasAttribute( XML_idx ) )
mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );
if ( nSubType ) if ( nSubType )
{ {
PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() ); PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() );
......
...@@ -82,7 +82,8 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s ...@@ -82,7 +82,8 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s
} }
case NMSP_PPT|XML_ph: case NMSP_PPT|XML_ph:
mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) ); mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) );
mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); if( xAttribs->hasAttribute( XML_idx ) )
mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );
break; break;
// nvSpPr CT_ShapeNonVisual end // nvSpPr CT_ShapeNonVisual end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment