summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-09-23 10:27:10 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-09-23 11:06:52 +0200
commit56b647b3a384db53bc55c56b2ae70e08c20e148b (patch)
tree83854f4c7afde3bffeb9d14ae8b359d3b3344fba /writerfilter
parentcb466794aff56cc9cf2c83d26f5cda9dacdd6c81 (diff)
DOCX filter: roundtrip SDT properties on Frame TextPortions
Change-Id: Icb3dc9595a025c4386577d858c8ca96e2f9bbef7
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx26
1 files changed, 19 insertions, 7 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 7e68473c4eaa..bf5a748a3ea6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4455,6 +4455,22 @@ void DomainMapper_Impl::ImportGraphic(writerfilter::Reference< Properties >::Po
uno::Reference<text::XTextContent> xTextContent
(m_pGraphicImport->GetGraphicObject());
+ // In case the SDT starts with the text portion of the graphic, then set the SDT properties here.
+ bool bHasGrabBag = false;
+ uno::Reference<beans::XPropertySet> xPropertySet(xTextContent, uno::UNO_QUERY);
+ if (xPropertySet.is())
+ {
+ uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
+ bHasGrabBag = xPropertySetInfo->hasPropertyByName("FrameInteropGrabBag");
+ // In case we're outside a paragraph, then the SDT properties are stored in the paragraph grab-bag, not the frame one.
+ if (!m_pSdtHelper->isInteropGrabBagEmpty() && bHasGrabBag && !m_pSdtHelper->isOutsideAParagraph())
+ {
+ comphelper::SequenceAsHashMap aFrameGrabBag(xPropertySet->getPropertyValue("FrameInteropGrabBag"));
+ aFrameGrabBag["SdtPr"] = uno::makeAny(m_pSdtHelper->getInteropGrabBagAndClear());
+ xPropertySet->setPropertyValue("FrameInteropGrabBag", uno::makeAny(aFrameGrabBag.getAsConstPropertyValueList()));
+ }
+ }
+
/* Set "SdtEndBefore" property on Drawing.
* It is required in a case when Drawing appears immediately after first run i.e.
* there is no text/space/tab in between two runs.
@@ -4462,20 +4478,16 @@ void DomainMapper_Impl::ImportGraphic(writerfilter::Reference< Properties >::Po
*/
if(IsSdtEndBefore())
{
- uno::Reference< beans::XPropertySet > xGraphicObjectProperties(xTextContent,
- uno::UNO_QUERY_THROW);
- uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
- if(xGraphicObjectProperties.is())
+ if(xPropertySet.is())
{
- xPropSetInfo = xGraphicObjectProperties->getPropertySetInfo();
- if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("FrameInteropGrabBag"))
+ if (bHasGrabBag)
{
uno::Sequence<beans::PropertyValue> aFrameGrabBag(1);
beans::PropertyValue aRet;
aRet.Name = "SdtEndBefore";
aRet.Value <<= uno::makeAny(true);
aFrameGrabBag[0] = aRet;
- xGraphicObjectProperties->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aFrameGrabBag));
+ xPropertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aFrameGrabBag));
}
}
}