DOCX import: implement linking for shapes having textboxes

Change-Id: I90deb68ab6a1029cf5df8170676638bf7e3cb469
This commit is contained in:
Miklos Vajna
2014-06-13 21:19:50 +02:00
parent cd94a84b89
commit 7b0eb08459
3 changed files with 47 additions and 4 deletions

View File

@@ -820,6 +820,22 @@ Reference< XShape > Shape::createAndInsert(
//aShapeProps.setProperty(PROP_TextBox, uno::makeAny(true));
}
if (aServiceName != "com.sun.star.text.TextFrame" && isLinkedTxbx())
{
uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aGrabBag;
propertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
sal_Int32 length = aGrabBag.getLength();
aGrabBag.realloc( length + 3 );
aGrabBag[length].Name = "TxbxHasLink";
aGrabBag[length].Value = uno::makeAny(this->isLinkedTxbx());
aGrabBag[length + 1 ].Name = "Txbx-Id";
aGrabBag[length + 1 ].Value = uno::makeAny(this->getLinkedTxbxAttributes().id);
aGrabBag[length + 2 ].Name = "Txbx-Seq";
aGrabBag[length + 2 ].Value = uno::makeAny(this->getLinkedTxbxAttributes().seq);
propertySet->setPropertyValue("InteropGrabBag",uno::makeAny(aGrabBag));
}
PropertySet( xSet ).setProperties( aShapeProps );
if (mbLockedCanvas)
{

View File

@@ -149,6 +149,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
//for further processing.
mpShape->getCustomShapeProperties()->setShapeTypeOverride(true);
mpShape->setServiceName("com.sun.star.text.TextFrame");
mpShape->setTextBox(true);
OptValue<OUString> id = rAttribs.getString(XML_id);
OptValue<OUString> seq = rAttribs.getString(XML_seq);
if (id.has() && seq.has())

View File

@@ -1881,6 +1881,14 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
xShapePropertySet->setPropertyValue(rPropNameSupplier.GetName( PROP_OPAQUE ), uno::makeAny( false ) );
checkZOredrStatus = true;
}
else if ( aGrabBag[i].Name == "TxbxHasLink" )
{
//Chaining of textboxes will happen in ~DomainMapper_Impl
//i.e when all the textboxes are read and all its attributes
//have been set ( basically the Name/LinkedDisplayName )
//which is set in Graphic Import.
m_vTextFramesForChaining.push_back(xShape);
}
}
}
if (!m_bInHeaderFooterImport && !checkZOredrStatus)
@@ -2324,8 +2332,17 @@ void DomainMapper_Impl::ChainTextFrames()
uno::Reference<text::XTextContent> xTextContent1(*outer_itr, uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xPropertySet1(xTextContent1, uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aGrabBag1;
xPropertySet1->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag1;
xPropertySet1->getPropertyValue("LinkDisplayName") >>= sName1;
uno::Reference<lang::XServiceInfo> xServiceInfo1(xPropertySet1, uno::UNO_QUERY);
if (xServiceInfo1->supportsService("com.sun.star.text.TextFrame"))
{
xPropertySet1->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag1;
xPropertySet1->getPropertyValue("LinkDisplayName") >>= sName1;
}
else
{
xPropertySet1->getPropertyValue("InteropGrabBag") >>= aGrabBag1;
xPropertySet1->getPropertyValue("ChainName") >>= sName1;
}
lcl_getGrabBagValue( aGrabBag1, "Txbx-Id") >>= nTxbxId1;
lcl_getGrabBagValue( aGrabBag1, "Txbx-Seq") >>= nTxbxSeq1;
@@ -2337,8 +2354,17 @@ void DomainMapper_Impl::ChainTextFrames()
uno::Reference<text::XTextContent> xTextContent2(*inner_itr, uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xPropertySet2(xTextContent2, uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aGrabBag2;
xPropertySet2->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag2;
xPropertySet2->getPropertyValue("LinkDisplayName") >>= sName2;
uno::Reference<lang::XServiceInfo> xServiceInfo2(xPropertySet1, uno::UNO_QUERY);
if (xServiceInfo2->supportsService("com.sun.star.text.TextFrame"))
{
xPropertySet2->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag2;
xPropertySet2->getPropertyValue("LinkDisplayName") >>= sName2;
}
else
{
xPropertySet2->getPropertyValue("InteropGrabBag") >>= aGrabBag2;
xPropertySet2->getPropertyValue("ChainName") >>= sName2;
}
lcl_getGrabBagValue( aGrabBag2, "Txbx-Id") >>= nTxbxId2;
lcl_getGrabBagValue( aGrabBag2, "Txbx-Seq") >>= nTxbxSeq2;