summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorumeshkadam <umesh.kadam@synerzip.com>2014-04-18 13:12:53 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-22 12:09:40 +0200
commit255194801e9eb8e3aaede56837450af35f8313e0 (patch)
treeaa423243a383fc9236c0229ef87d468ac98dddf2 /oox
parentf12237c4c6239428b00dd4885a25bbc3b4f14368 (diff)
fod#77122 DOCX filter: link between textboxes is not being preserved
Added support for linked textboxes for docx interoperability. Reviewed on: https://gerrit.libreoffice.org/9092 Change-Id: I7db4f5a1783afff53c64908d182788b262f5e863
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx19
-rw-r--r--oox/source/shape/WpsContext.cxx35
-rw-r--r--oox/source/token/tokens.txt1
3 files changed, 54 insertions, 1 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f7150db048d1..1d0d4525801f 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -139,6 +139,8 @@ Shape::Shape( const ShapePtr& pSourceShape )
, mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
, mbLockedCanvas( pSourceShape->mbLockedCanvas )
, mbWps( pSourceShape->mbWps )
+, maLinkedTxbxAttr()
+, mbHasLinkedTxbx(false)
, maDiagramDoms( pSourceShape->maDiagramDoms )
{}
@@ -677,6 +679,23 @@ Reference< XShape > Shape::createAndInsert(
aGrabBag[length].Value = uno::makeAny(mpCustomShapePropertiesPtr->getShapePresetTypeName());
propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag));
}
+ //If the text box has links then save the link information so that
+ //it can be accessed in DomainMapper_Impl.cxx while chaining the text frames.
+ if (this->isLinkedTxbx())
+ {
+ uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aGrabBag;
+ propertySet->getPropertyValue("FrameInteropGrabBag") >>= 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("FrameInteropGrabBag",uno::makeAny(aGrabBag));
+ }
// TextFrames have BackColor, not FillColor
if (aShapeProps.hasProperty(PROP_FillColor))
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index c30992d316ac..57237095c5e6 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -109,9 +109,42 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
}
break;
case XML_txbx:
+ {
mpShape->getCustomShapeProperties()->setShapeTypeOverride(true);
mpShape->setServiceName("com.sun.star.text.TextFrame");
- break;
+ //in case if the textbox is linked, save the attributes
+ //for further processing.
+ if (rAttribs.hasAttribute(XML_id))
+ {
+ OptValue<OUString> id = rAttribs.getString(XML_id);
+ if (id.has())
+ {
+ oox::drawingml::LinkedTxbxAttr linkedTxtBoxAttr ;
+ linkedTxtBoxAttr.id = id.get().toInt32();
+ mpShape->setTxbxHasLinkedTxtBox(true);
+ mpShape->setLinkedTxbxAttributes(linkedTxtBoxAttr);
+ }
+ }
+ }
+ break;
+ case XML_linkedTxbx:
+ {
+ //in case if the textbox is linked, save the attributes
+ //for further processing.
+ mpShape->getCustomShapeProperties()->setShapeTypeOverride(true);
+ mpShape->setServiceName("com.sun.star.text.TextFrame");
+ OptValue<OUString> id = rAttribs.getString(XML_id);
+ OptValue<OUString> seq = rAttribs.getString(XML_seq);
+ if (id.has() && seq.has())
+ {
+ oox::drawingml::LinkedTxbxAttr linkedTxtBoxAttr ;
+ linkedTxtBoxAttr.id = id.get().toInt32();
+ linkedTxtBoxAttr.seq = seq.get().toInt32();
+ mpShape->setTxbxHasLinkedTxtBox(true);
+ mpShape->setLinkedTxbxAttributes(linkedTxtBoxAttr);
+ }
+ }
+ break;
default:
SAL_WARN("oox", "WpsContext::createFastChildContext: unhandled element: " << getBaseToken(nElementToken));
break;
diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index e2740015a9b6..bab7cf1dc859 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -3074,6 +3074,7 @@ lines
linesAndChars
linestyle
link
+linkedTxbx
linkStyles
linkTarget
linkToQuery