summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper_Impl.cxx
diff options
context:
space:
mode:
authorPallavi Jadhav <pallavi.jadhav@synerzip.com>2014-08-08 17:20:31 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-08-11 08:28:57 +0000
commitf6e7b94042070241cd1cfb1d7f8610fe1801b4f2 (patch)
treec723d3680b05f35a468371db60508115f7500915 /writerfilter/source/dmapper/DomainMapper_Impl.cxx
parentba774649fb6f53c8d3251d417c4537ae7c495881 (diff)
fdo#82123 : DOCX: Corruption: File was getting corrupt fafter RT
Issue : - In issue file there were two runs(first run=SDT, second run=Image). - These two runs were consecutive(no text/space/tab was there in between two runs). - Due to such scenario, "SdtEndBefore" was not getting set. - Hence at Export EndSdtBlock() was getting called form EndParagraph() Instead EndSdtBlock() should ge called from EndRun() in order to end sdt after first run(as in Original file) Implementation : - Set "SdtEndBefore" on Graphic in DomainMapper_Impl::ImportGraphic() - Retrieved same property at export. - Added export unit test case. Change-Id: Id514b91f1831af371924f94388f0a404d762c042 Reviewed-on: https://gerrit.libreoffice.org/10827 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx47
1 files changed, 47 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1bf28fac2627..feb11e028efb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4394,6 +4394,53 @@ void DomainMapper_Impl::ImportGraphic(writerfilter::Reference< Properties >::Po
uno::Reference<text::XTextContent> xTextContent
(m_pGraphicImport->GetGraphicObject());
+ /* 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.
+ * In this case "SdtEndBefore" property needs to be set on Drawing.
+ */
+ PropertyMapPtr pContext = GetTopContextOfType(CONTEXT_CHARACTER);
+ if(pContext)
+ {
+ uno::Sequence< beans::PropertyValue > currentCharProps = pContext->GetPropertyValues();
+ for (int i =0; i< currentCharProps.getLength(); i++)
+ {
+ if (currentCharProps[i].Name == "CharInteropGrabBag")
+ {
+ uno::Sequence<beans::PropertyValue> aCharGrabBag;
+ currentCharProps[i].Value >>= aCharGrabBag;
+ for (int j=0; j < aCharGrabBag.getLength();j++)
+ {
+ if(aCharGrabBag[j].Name == "SdtEndBefore")
+ {
+ bool bIsSdtEndBefore;
+ aCharGrabBag[j].Value >>= bIsSdtEndBefore;
+ if (bIsSdtEndBefore)
+ {
+ uno::Reference< beans::XPropertySet > xGraphicObjectProperties(xTextContent,
+ uno::UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
+ if(xGraphicObjectProperties.is())
+ {
+ xPropSetInfo = xGraphicObjectProperties->getPropertySetInfo();
+ if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("FrameInteropGrabBag"))
+ {
+ 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));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
// Update the shape properties if it is embedded object.
if(m_xEmbedded.is()){
UpdateEmbeddedShapeProps(m_pGraphicImport->GetXShapeObject());