summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2015-07-02 14:03:13 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-07-08 06:07:46 +0000
commit9ab3e9292b093fc02c07fc52b25430d253277d1c (patch)
treed896bc30499941bd5b0e4db5037000f7fde5c86d /oox
parent66ed003f66b7b3171684d9aa8f753d5aeddb8e81 (diff)
tdf#87348 implement nonsequential and mso-next-textbox textbox chaining
cherry picked from commits 976add10b35e482251ed4c75957baeb6811e6e2c and 091fe76b6329b4bb974987554369cbfadd8f2401 Change-Id: I017049a8f3578ad4c2a1f549be1c683f98c20318 Reviewed-on: https://gerrit.libreoffice.org/16692 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/vml/vmlshape.cxx77
-rw-r--r--oox/source/vml/vmlshapecontext.cxx1
-rw-r--r--oox/source/vml/vmltextboxcontext.cxx2
3 files changed, 75 insertions, 5 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 6342140dc49a..539467787866 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -312,21 +312,64 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
if( aShapeProp.hasProperty( PROP_Name ) )
aShapeProp.setProperty( PROP_Name, getShapeName() );
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"))
{
uno::Sequence<beans::PropertyValue> aGrabBag;
uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
- sal_Int32 length = aGrabBag.getLength();
+ sal_Int32 length;
+ length = aGrabBag.getLength();
aGrabBag.realloc( length+1 );
aGrabBag[length].Name = "VML-Z-ORDER";
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())
{
- aGrabBag.realloc( length+2 );
- aGrabBag[length+1].Name = "mso-rotation-angle";
- aGrabBag[length+1].Value = uno::makeAny(sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100)));
+ length = aGrabBag.getLength();
+ aGrabBag.realloc( length+1 );
+ aGrabBag[length].Name = "mso-rotation-angle";
+ aGrabBag[length].Value = uno::makeAny(sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100)));
}
propertySet->setPropertyValue( "FrameInteropGrabBag", uno::makeAny(aGrabBag) );
sal_Int32 backColorTransparency = 0;
@@ -346,10 +389,34 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
uno::Sequence<beans::PropertyValue> aGrabBag;
uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
propertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
- sal_Int32 length = aGrabBag.getLength();
+ sal_Int32 length;
+
+ length = aGrabBag.getLength();
aGrabBag.realloc( length+1 );
aGrabBag[length].Name = "VML-Z-ORDER";
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) );
}
}
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 2f69efe3e7f2..4ea10e87bd98 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -269,6 +269,7 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r
// shape identifier and shape name
bool bHasOspid = rAttribs.hasAttribute( O_TOKEN( spid ) );
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" );
// if the o:spid attribute exists, the id attribute contains the user-defined shape name
if( bHasOspid )
diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx
index 8a1d5fb3077c..d1a8b1256d74 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -212,6 +212,8 @@ TextBoxContext::TextBoxContext( ContextHandler2Helper& rParent, TextBox& rTextBo
rTextBox.mrTypeModel.mbAutoHeight = true;
else if (aName == "mso-layout-flow-alt")
rTextBox.mrTypeModel.maLayoutFlowAlt = aValue;
+ else if (aName == "mso-next-textbox")
+ rTextBox.msNextTextbox = aValue;
else
SAL_WARN("oox", "unhandled style property: " << aName);
}