Kaydet (Commit) 99e256f3 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Andras Timar

tdf#87348 implement nonsequential and mso-next-textbox textbox chaining

cherry picked from commits 976add10 and
091fe76b

Change-Id: I017049a8f3578ad4c2a1f549be1c683f98c20318
Reviewed-on: https://gerrit.libreoffice.org/16692Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 95da55e5
...@@ -58,6 +58,7 @@ const sal_Int32 VML_CLIENTDATA_FORMULA = 4; ...@@ -58,6 +58,7 @@ const sal_Int32 VML_CLIENTDATA_FORMULA = 4;
struct OOX_DLLPUBLIC ShapeTypeModel struct OOX_DLLPUBLIC ShapeTypeModel
{ {
OUString maShapeId; ///< Unique identifier of the shape. OUString maShapeId; ///< Unique identifier of the shape.
OUString maLegacyId; ///< Plaintext identifier of the shape.
OUString maShapeName; ///< Name of the shape, if present. OUString maShapeName; ///< Name of the shape, if present.
OptValue< sal_Int32 > moShapeType; ///< Builtin shape type identifier. OptValue< sal_Int32 > moShapeType; ///< Builtin shape type identifier.
......
...@@ -95,6 +95,7 @@ public: ...@@ -95,6 +95,7 @@ public:
bool borderDistanceSet; bool borderDistanceSet;
int borderDistanceLeft, borderDistanceTop, borderDistanceRight, borderDistanceBottom; int borderDistanceLeft, borderDistanceTop, borderDistanceRight, borderDistanceBottom;
OUString maLayoutFlow; OUString maLayoutFlow;
OUString msNextTextbox;
private: private:
typedef ::std::vector< TextPortionModel > PortionVector; typedef ::std::vector< TextPortionModel > PortionVector;
......
...@@ -312,21 +312,64 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS ...@@ -312,21 +312,64 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
if( aShapeProp.hasProperty( PROP_Name ) ) if( aShapeProp.hasProperty( PROP_Name ) )
aShapeProp.setProperty( PROP_Name, getShapeName() ); aShapeProp.setProperty( PROP_Name, getShapeName() );
uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW ); uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW );
OUString sLinkChainName = getTypeModel().maLegacyId;
sal_Int32 id = 0;
sal_Int32 idPos = sLinkChainName.indexOf("_x");
sal_Int32 seq = 0;
sal_Int32 seqPos = sLinkChainName.indexOf("_s",idPos);
if( idPos >= 0 && idPos < seqPos )
{
id = sLinkChainName.copy(idPos+2,seqPos-idPos+2).toInt32();
seq = sLinkChainName.copy(seqPos+2).toInt32();
}
OUString s_mso_next_textbox;
if( getTextBox() )
s_mso_next_textbox = getTextBox()->msNextTextbox;
if( s_mso_next_textbox.startsWith("#") )
s_mso_next_textbox = s_mso_next_textbox.copy(1);
if (xSInfo->supportsService("com.sun.star.text.TextFrame")) if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
{ {
uno::Sequence<beans::PropertyValue> aGrabBag; uno::Sequence<beans::PropertyValue> aGrabBag;
uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag; propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
sal_Int32 length = aGrabBag.getLength(); sal_Int32 length;
length = aGrabBag.getLength();
aGrabBag.realloc( length+1 ); aGrabBag.realloc( length+1 );
aGrabBag[length].Name = "VML-Z-ORDER"; aGrabBag[length].Name = "VML-Z-ORDER";
aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() ); aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() );
if( !s_mso_next_textbox.isEmpty() )
{
length = aGrabBag.getLength();
aGrabBag.realloc( length+1 );
aGrabBag[length].Name = "mso-next-textbox";
aGrabBag[length].Value = uno::makeAny( s_mso_next_textbox );
}
if( !sLinkChainName.isEmpty() )
{
length = aGrabBag.getLength();
aGrabBag.realloc( length+4 );
aGrabBag[length].Name = "TxbxHasLink";
aGrabBag[length].Value = uno::makeAny( true );
aGrabBag[length+1].Name = "Txbx-Id";
aGrabBag[length+1].Value = uno::makeAny( id );
aGrabBag[length+2].Name = "Txbx-Seq";
aGrabBag[length+2].Value = uno::makeAny( seq );
aGrabBag[length+3].Name = "LinkChainName";
aGrabBag[length+3].Value = uno::makeAny( sLinkChainName );
}
if(!(maTypeModel.maRotation).isEmpty()) if(!(maTypeModel.maRotation).isEmpty())
{ {
aGrabBag.realloc( length+2 ); length = aGrabBag.getLength();
aGrabBag[length+1].Name = "mso-rotation-angle"; aGrabBag.realloc( length+1 );
aGrabBag[length+1].Value = uno::makeAny(sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100))); aGrabBag[length].Name = "mso-rotation-angle";
aGrabBag[length].Value = uno::makeAny(sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100)));
} }
propertySet->setPropertyValue( "FrameInteropGrabBag", uno::makeAny(aGrabBag) ); propertySet->setPropertyValue( "FrameInteropGrabBag", uno::makeAny(aGrabBag) );
sal_Int32 backColorTransparency = 0; sal_Int32 backColorTransparency = 0;
...@@ -346,10 +389,34 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS ...@@ -346,10 +389,34 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
uno::Sequence<beans::PropertyValue> aGrabBag; uno::Sequence<beans::PropertyValue> aGrabBag;
uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
propertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag; propertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
sal_Int32 length = aGrabBag.getLength(); sal_Int32 length;
length = aGrabBag.getLength();
aGrabBag.realloc( length+1 ); aGrabBag.realloc( length+1 );
aGrabBag[length].Name = "VML-Z-ORDER"; aGrabBag[length].Name = "VML-Z-ORDER";
aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() ); aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() );
if( !s_mso_next_textbox.isEmpty() )
{
length = aGrabBag.getLength();
aGrabBag.realloc( length+1 );
aGrabBag[length].Name = "mso-next-textbox";
aGrabBag[length].Value = uno::makeAny( s_mso_next_textbox );
}
if( !sLinkChainName.isEmpty() )
{
length = aGrabBag.getLength();
aGrabBag.realloc( length+4 );
aGrabBag[length].Name = "TxbxHasLink";
aGrabBag[length].Value = uno::makeAny( true );
aGrabBag[length+1].Name = "Txbx-Id";
aGrabBag[length+1].Value = uno::makeAny( id );
aGrabBag[length+2].Name = "Txbx-Seq";
aGrabBag[length+2].Value = uno::makeAny( seq );
aGrabBag[length+3].Name = "LinkChainName";
aGrabBag[length+3].Value = uno::makeAny( sLinkChainName );
}
propertySet->setPropertyValue( "InteropGrabBag", uno::makeAny(aGrabBag) ); propertySet->setPropertyValue( "InteropGrabBag", uno::makeAny(aGrabBag) );
} }
} }
......
...@@ -269,6 +269,7 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r ...@@ -269,6 +269,7 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r
// shape identifier and shape name // shape identifier and shape name
bool bHasOspid = rAttribs.hasAttribute( O_TOKEN( spid ) ); bool bHasOspid = rAttribs.hasAttribute( O_TOKEN( spid ) );
mrTypeModel.maShapeId = rAttribs.getXString( bHasOspid ? O_TOKEN( spid ) : XML_id, OUString() ); mrTypeModel.maShapeId = rAttribs.getXString( bHasOspid ? O_TOKEN( spid ) : XML_id, OUString() );
mrTypeModel.maLegacyId = rAttribs.getString( XML_id, OUString() );
OSL_ENSURE( !mrTypeModel.maShapeId.isEmpty(), "ShapeTypeContext::ShapeTypeContext - missing shape identifier" ); OSL_ENSURE( !mrTypeModel.maShapeId.isEmpty(), "ShapeTypeContext::ShapeTypeContext - missing shape identifier" );
// if the o:spid attribute exists, the id attribute contains the user-defined shape name // if the o:spid attribute exists, the id attribute contains the user-defined shape name
if( bHasOspid ) if( bHasOspid )
......
...@@ -212,6 +212,8 @@ TextBoxContext::TextBoxContext( ContextHandler2Helper& rParent, TextBox& rTextBo ...@@ -212,6 +212,8 @@ TextBoxContext::TextBoxContext( ContextHandler2Helper& rParent, TextBox& rTextBo
rTextBox.mrTypeModel.mbAutoHeight = true; rTextBox.mrTypeModel.mbAutoHeight = true;
else if (aName == "mso-layout-flow-alt") else if (aName == "mso-layout-flow-alt")
rTextBox.mrTypeModel.maLayoutFlowAlt = aValue; rTextBox.mrTypeModel.maLayoutFlowAlt = aValue;
else if (aName == "mso-next-textbox")
rTextBox.msNextTextbox = aValue;
else else
SAL_WARN("oox", "unhandled style property: " << aName); SAL_WARN("oox", "unhandled style property: " << aName);
} }
......
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