[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - 2 commits - oox/source

Caolán McNamara caolanm at redhat.com
Tue Jan 12 01:01:09 PST 2016


 oox/source/export/shapes.cxx |  283 ++++++++++++++++++++++---------------------
 1 file changed, 146 insertions(+), 137 deletions(-)

New commits:
commit 6a1f52054fefdcf5905a5ba3616b20fee7e5e26f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 10 16:24:27 2016 +0000

    crashtesting: don't fail on export of fdo65321-3.ods to xlsx
    
    with broken ole object
    
    Change-Id: I8dc9e1035893d5cb931d13eafcc3e3ec1c9c00d4
    (cherry picked from commit 680abab7710b7e8e6f2ba9cee37a5ccd224e2993)
    Reviewed-on: https://gerrit.libreoffice.org/21354
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index e602533..9f028e6 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1587,14 +1587,18 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
     if (!xPropSet.is())
         return *this;
 
+    bool bIsChart(false);
     OUString clsid;
     xPropSet->getPropertyValue("CLSID") >>= clsid;
-    assert(!clsid.isEmpty());
-    SvGlobalName aClassID;
-    bool const isValid(aClassID.MakeId(clsid));
-    assert(isValid); (void)isValid;
+    if (!clsid.isEmpty())
+    {
+        SvGlobalName aClassID;
+        bool const isValid = aClassID.MakeId(clsid);
+        assert(isValid); (void)isValid;
+        bIsChart = SotExchange::IsChart(aClassID);
+    }
 
-    if (SotExchange::IsChart(aClassID))
+    if (bIsChart)
     {
         Reference< XChartDocument > xChartDoc;
         xPropSet->getPropertyValue("Model") >>= xChartDoc;
@@ -1604,154 +1608,160 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
         ChartExport aChartExport( mnXmlNamespace, GetFS(), xModel, GetFB(), GetDocumentType() );
         static sal_Int32 nChartCount = 0;
         aChartExport.WriteChartObj( xShape, ++nChartCount );
+        return *this;
     }
-    else
+
+    uno::Reference<embed::XEmbeddedObject> const xObj(
+        xPropSet->getPropertyValue("EmbeddedObject"), uno::UNO_QUERY);
+
+    if (!xObj.is())
     {
-        uno::Reference<embed::XEmbeddedObject> const xObj(
-            xPropSet->getPropertyValue("EmbeddedObject"), uno::UNO_QUERY);
+        SAL_WARN("oox", "ShapeExport::WriteOLE2Shape: no object");
+        return *this;
+    }
 
-        uno::Reference<beans::XPropertySet> const xParent(
-            uno::Reference<container::XChild>(xObj, uno::UNO_QUERY)->getParent(),
-            uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> const xParent(
+        uno::Reference<container::XChild>(xObj, uno::UNO_QUERY)->getParent(),
+        uno::UNO_QUERY);
 
-        uno::Sequence<beans::PropertyValue> grabBag;
-        xParent->getPropertyValue("InteropGrabBag") >>= grabBag;
+    uno::Sequence<beans::PropertyValue> grabBag;
+    xParent->getPropertyValue("InteropGrabBag") >>= grabBag;
 
-        OUString const entryName(
-            uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY)->getEntryName());
-        OUString progID;
+    OUString const entryName(
+        uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY)->getEntryName());
+    OUString progID;
 
-        for (auto const& it : grabBag)
+    for (auto const& it : grabBag)
+    {
+        if (it.Name == "EmbeddedObjects")
         {
-            if (it.Name == "EmbeddedObjects")
+            uno::Sequence<beans::PropertyValue> objects;
+            it.Value >>= objects;
+            for (auto const& object : objects)
             {
-                uno::Sequence<beans::PropertyValue> objects;
-                it.Value >>= objects;
-                for (auto const& object : objects)
+                if (object.Name == entryName)
                 {
-                    if (object.Name == entryName)
+                    uno::Sequence<beans::PropertyValue> props;
+                    object.Value >>= props;
+                    for (auto const& prop : props)
                     {
-                        uno::Sequence<beans::PropertyValue> props;
-                        object.Value >>= props;
-                        for (auto const& prop : props)
+                        if (prop.Name == "ProgID")
                         {
-                            if (prop.Name == "ProgID")
-                            {
-                                prop.Value >>= progID;
-                                break;
-                            }
+                            prop.Value >>= progID;
+                            break;
                         }
-                        break;
                     }
+                    break;
                 }
-                break;
             }
+            break;
         }
+    }
 
-        OUString sMediaType;
-        OUString sRelationType;
-        OUString sSuffix;
-        const char * pProgID(nullptr);
+    OUString sMediaType;
+    OUString sRelationType;
+    OUString sSuffix;
+    const char * pProgID(nullptr);
 
-        uno::Reference<io::XInputStream> const xInStream =
-            oox::GetOLEObjectStream(
-                mpFB->getComponentContext(), xObj, progID,
-                sMediaType, sRelationType, sSuffix, pProgID);
+    uno::Reference<io::XInputStream> const xInStream =
+        oox::GetOLEObjectStream(
+            mpFB->getComponentContext(), xObj, progID,
+            sMediaType, sRelationType, sSuffix, pProgID);
 
-        if (!xInStream.is())
-        {
-            return *this;
-        }
+    if (!xInStream.is())
+    {
+        return *this;
+    }
 
-        OString anotherProgID;
-        if (!pProgID && !progID.isEmpty())
-        {
-            anotherProgID = OUStringToOString(progID, RTL_TEXTENCODING_UTF8);
-            pProgID = anotherProgID.getStr();
-        }
+    OString anotherProgID;
+    if (!pProgID && !progID.isEmpty())
+    {
+        anotherProgID = OUStringToOString(progID, RTL_TEXTENCODING_UTF8);
+        pProgID = anotherProgID.getStr();
+    }
 
-        assert(!sMediaType.isEmpty());
-        assert(!sRelationType.isEmpty());
-        assert(!sSuffix.isEmpty());
-
-        OUString sFileName = "embeddings/oleObject" + OUString::number(mnEmbeddeDocumentCounter++) + "." + sSuffix;
-        uno::Reference<io::XOutputStream> const xOutStream(
-            mpFB->openFragmentStream(
-                OUString::createFromAscii(GetComponentDir()) + "/" + sFileName,
-                sMediaType));
-        assert(xOutStream.is()); // no reason why that could fail
-
-        try {
-            ::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
-        } catch (uno::Exception const& e) {
-            SAL_WARN("oox", "ShapeExport::WriteOLEObject: exception: " << e.Message);
-        }
+    assert(!sMediaType.isEmpty());
+    assert(!sRelationType.isEmpty());
+    assert(!sSuffix.isEmpty());
+
+    OUString sFileName = "embeddings/oleObject" + OUString::number(mnEmbeddeDocumentCounter++) + "." + sSuffix;
+    uno::Reference<io::XOutputStream> const xOutStream(
+        mpFB->openFragmentStream(
+            OUString::createFromAscii(GetComponentDir()) + "/" + sFileName,
+            sMediaType));
+    assert(xOutStream.is()); // no reason why that could fail
+
+    try {
+        ::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
+    } catch (uno::Exception const& e) {
+        SAL_WARN("oox", "ShapeExport::WriteOLEObject: exception: " << e.Message);
+    }
 
-        OUString const sRelId = mpFB->addRelation(
-            mpFS->getOutputStream(), sRelationType,
-            OUString::createFromAscii(GetRelationCompPrefix()) + sFileName);
+    OUString const sRelId = mpFB->addRelation(
+        mpFS->getOutputStream(), sRelationType,
+        OUString::createFromAscii(GetRelationCompPrefix()) + sFileName);
 
-        mpFS->startElementNS( mnXmlNamespace, XML_graphicFrame, FSEND );
+    mpFS->startElementNS( mnXmlNamespace, XML_graphicFrame, FSEND );
 
-        mpFS->startElementNS( mnXmlNamespace, XML_nvGraphicFramePr, FSEND );
+    mpFS->startElementNS( mnXmlNamespace, XML_nvGraphicFramePr, FSEND );
 
-        mpFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
-                               XML_id,     I32S( GetNewShapeID( xShape ) ),
-                               XML_name,   IDS(Object),
-                               FSEND );
+    mpFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
+                           XML_id,     I32S( GetNewShapeID( xShape ) ),
+                           XML_name,   IDS(Object),
+                           FSEND );
 
-        mpFS->singleElementNS( mnXmlNamespace, XML_cNvGraphicFramePr,
-                               FSEND );
+    mpFS->singleElementNS( mnXmlNamespace, XML_cNvGraphicFramePr,
+                           FSEND );
 
-        if (GetDocumentType() == DOCUMENT_PPTX)
-            mpFS->singleElementNS( mnXmlNamespace, XML_nvPr,
-                                   FSEND );
-        mpFS->endElementNS( mnXmlNamespace, XML_nvGraphicFramePr );
+    if (GetDocumentType() == DOCUMENT_PPTX)
+        mpFS->singleElementNS( mnXmlNamespace, XML_nvPr,
+                               FSEND );
+    mpFS->endElementNS( mnXmlNamespace, XML_nvGraphicFramePr );
 
-        WriteShapeTransformation( xShape, mnXmlNamespace );
+    WriteShapeTransformation( xShape, mnXmlNamespace );
 
-        mpFS->startElementNS( XML_a, XML_graphic, FSEND );
-        mpFS->startElementNS( XML_a, XML_graphicData,
-                              XML_uri, "http://schemas.openxmlformats.org/presentationml/2006/ole",
-                              FSEND );
-        if (pProgID)
-        {
-            mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
-                              XML_progId, pProgID,
-                              FSNS(XML_r, XML_id), USS( sRelId ),
-                              XML_spid, "",
-                              FSEND );
-        }
-        else
-        {
-            mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
+    mpFS->startElementNS( XML_a, XML_graphic, FSEND );
+    mpFS->startElementNS( XML_a, XML_graphicData,
+                          XML_uri, "http://schemas.openxmlformats.org/presentationml/2006/ole",
+                          FSEND );
+    if (pProgID)
+    {
+        mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
+                          XML_progId, pProgID,
+                          FSNS(XML_r, XML_id), USS( sRelId ),
+                          XML_spid, "",
+                          FSEND );
+    }
+    else
+    {
+        mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
 //?                                              XML_name, "Document",
-                              FSNS(XML_r, XML_id), USS( sRelId ),
-                              // The spec says that this is a required attribute, but PowerPoint can only handle an empty value.
-                              XML_spid, "",
-                              FSEND );
-        }
+                          FSNS(XML_r, XML_id), USS( sRelId ),
+                          // The spec says that this is a required attribute, but PowerPoint can only handle an empty value.
+                          XML_spid, "",
+                          FSEND );
+    }
 
-        mpFS->singleElementNS( mnXmlNamespace, XML_embed, FSEND );
+    mpFS->singleElementNS( mnXmlNamespace, XML_embed, FSEND );
 
-        // pic element
-        SdrObject* pSdrOLE2( GetSdrObjectFromXShape( xShape ) );
-        // The spec doesn't allow <p:pic> here, but PowerPoint requires it.
-        bool bEcma = mpFB->getVersion() == oox::core::ECMA_DIALECT;
-        if (pSdrOLE2 && dynamic_cast<const SdrOle2Obj*>( pSdrOLE2) != nullptr && bEcma)
-        {
-            const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic();
-            if (pGraphic)
-                WriteGraphicObjectShapePart( xShape, pGraphic );
-        }
+    // pic element
+    SdrObject* pSdrOLE2( GetSdrObjectFromXShape( xShape ) );
+    // The spec doesn't allow <p:pic> here, but PowerPoint requires it.
+    bool bEcma = mpFB->getVersion() == oox::core::ECMA_DIALECT;
+    if (pSdrOLE2 && dynamic_cast<const SdrOle2Obj*>( pSdrOLE2) != nullptr && bEcma)
+    {
+        const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic();
+        if (pGraphic)
+            WriteGraphicObjectShapePart( xShape, pGraphic );
+    }
 
-        mpFS->endElementNS( mnXmlNamespace, XML_oleObj );
+    mpFS->endElementNS( mnXmlNamespace, XML_oleObj );
 
-        mpFS->endElementNS( XML_a, XML_graphicData );
-        mpFS->endElementNS( XML_a, XML_graphic );
+    mpFS->endElementNS( XML_a, XML_graphicData );
+    mpFS->endElementNS( XML_a, XML_graphic );
+
+    mpFS->endElementNS( mnXmlNamespace, XML_graphicFrame );
 
-        mpFS->endElementNS( mnXmlNamespace, XML_graphicFrame );
-    }
     return *this;
 }
 
commit ddf27300ca209c74896994ef31fe7a1efcdad4fa
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Dec 20 00:28:28 2015 +0100

    oox: fix indentation of ShapeExport::WriteOLE2Shape
    
    Change-Id: I9057cd9d574d545929a9f43f40f49164179a6dcc
    (cherry picked from commit 89e85e5d2ec337aaccfa74bd7017898df42529b4)
    Reviewed-on: https://gerrit.libreoffice.org/21353
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index db6ec66..e602533 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1584,174 +1584,173 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
 ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
 {
     Reference< XPropertySet > xPropSet( xShape, UNO_QUERY );
-    if( xPropSet.is() ) {
-        OUString clsid;
-        xPropSet->getPropertyValue("CLSID") >>= clsid;
-        assert(!clsid.isEmpty());
-        SvGlobalName aClassID;
-        bool const isValid(aClassID.MakeId(clsid));
-        assert(isValid); (void)isValid;
+    if (!xPropSet.is())
+        return *this;
 
-        {
-            if (SotExchange::IsChart(aClassID))
-            {
-                Reference< XChartDocument > xChartDoc;
-                xPropSet->getPropertyValue("Model") >>= xChartDoc;
-                assert(xChartDoc.is());
-                //export the chart
-                Reference< XModel > xModel( xChartDoc, UNO_QUERY );
-                ChartExport aChartExport( mnXmlNamespace, GetFS(), xModel, GetFB(), GetDocumentType() );
-                static sal_Int32 nChartCount = 0;
-                aChartExport.WriteChartObj( xShape, ++nChartCount );
-            }
-            else
-            {
-                uno::Reference<embed::XEmbeddedObject> const xObj(
-                    xPropSet->getPropertyValue("EmbeddedObject"), uno::UNO_QUERY);
+    OUString clsid;
+    xPropSet->getPropertyValue("CLSID") >>= clsid;
+    assert(!clsid.isEmpty());
+    SvGlobalName aClassID;
+    bool const isValid(aClassID.MakeId(clsid));
+    assert(isValid); (void)isValid;
 
-                uno::Reference<beans::XPropertySet> const xParent(
-                    uno::Reference<container::XChild>(xObj, uno::UNO_QUERY)->getParent(),
-                    uno::UNO_QUERY);
+    if (SotExchange::IsChart(aClassID))
+    {
+        Reference< XChartDocument > xChartDoc;
+        xPropSet->getPropertyValue("Model") >>= xChartDoc;
+        assert(xChartDoc.is());
+        //export the chart
+        Reference< XModel > xModel( xChartDoc, UNO_QUERY );
+        ChartExport aChartExport( mnXmlNamespace, GetFS(), xModel, GetFB(), GetDocumentType() );
+        static sal_Int32 nChartCount = 0;
+        aChartExport.WriteChartObj( xShape, ++nChartCount );
+    }
+    else
+    {
+        uno::Reference<embed::XEmbeddedObject> const xObj(
+            xPropSet->getPropertyValue("EmbeddedObject"), uno::UNO_QUERY);
+
+        uno::Reference<beans::XPropertySet> const xParent(
+            uno::Reference<container::XChild>(xObj, uno::UNO_QUERY)->getParent(),
+            uno::UNO_QUERY);
 
-                uno::Sequence<beans::PropertyValue> grabBag;
-                xParent->getPropertyValue("InteropGrabBag") >>= grabBag;
+        uno::Sequence<beans::PropertyValue> grabBag;
+        xParent->getPropertyValue("InteropGrabBag") >>= grabBag;
 
-                OUString const entryName(
-                    uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY)->getEntryName());
-                OUString progID;
+        OUString const entryName(
+            uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY)->getEntryName());
+        OUString progID;
 
-                for (auto const& it : grabBag)
+        for (auto const& it : grabBag)
+        {
+            if (it.Name == "EmbeddedObjects")
+            {
+                uno::Sequence<beans::PropertyValue> objects;
+                it.Value >>= objects;
+                for (auto const& object : objects)
                 {
-                    if (it.Name == "EmbeddedObjects")
+                    if (object.Name == entryName)
                     {
-                        uno::Sequence<beans::PropertyValue> objects;
-                        it.Value >>= objects;
-                        for (auto const& object : objects)
+                        uno::Sequence<beans::PropertyValue> props;
+                        object.Value >>= props;
+                        for (auto const& prop : props)
                         {
-                            if (object.Name == entryName)
+                            if (prop.Name == "ProgID")
                             {
-                                uno::Sequence<beans::PropertyValue> props;
-                                object.Value >>= props;
-                                for (auto const& prop : props)
-                                {
-                                    if (prop.Name == "ProgID")
-                                    {
-                                        prop.Value >>= progID;
-                                        break;
-                                    }
-                                }
+                                prop.Value >>= progID;
                                 break;
                             }
                         }
                         break;
                     }
                 }
+                break;
+            }
+        }
 
-                OUString sMediaType;
-                OUString sRelationType;
-                OUString sSuffix;
-                const char * pProgID(nullptr);
+        OUString sMediaType;
+        OUString sRelationType;
+        OUString sSuffix;
+        const char * pProgID(nullptr);
 
-                uno::Reference<io::XInputStream> const xInStream =
-                    oox::GetOLEObjectStream(
-                        mpFB->getComponentContext(), xObj, progID,
-                        sMediaType, sRelationType, sSuffix, pProgID);
+        uno::Reference<io::XInputStream> const xInStream =
+            oox::GetOLEObjectStream(
+                mpFB->getComponentContext(), xObj, progID,
+                sMediaType, sRelationType, sSuffix, pProgID);
 
-                if (!xInStream.is())
-                {
-                    return *this;
-                }
+        if (!xInStream.is())
+        {
+            return *this;
+        }
 
-                OString anotherProgID;
-                if (!pProgID && !progID.isEmpty())
-                {
-                    anotherProgID = OUStringToOString(progID, RTL_TEXTENCODING_UTF8);
-                    pProgID = anotherProgID.getStr();
-                }
+        OString anotherProgID;
+        if (!pProgID && !progID.isEmpty())
+        {
+            anotherProgID = OUStringToOString(progID, RTL_TEXTENCODING_UTF8);
+            pProgID = anotherProgID.getStr();
+        }
 
-                assert(!sMediaType.isEmpty());
-                assert(!sRelationType.isEmpty());
-                assert(!sSuffix.isEmpty());
-
-                OUString sFileName = "embeddings/oleObject" + OUString::number(mnEmbeddeDocumentCounter++) + "." + sSuffix;
-                uno::Reference<io::XOutputStream> const xOutStream(
-                    mpFB->openFragmentStream(
-                        OUString::createFromAscii(GetComponentDir()) + "/" + sFileName,
-                        sMediaType));
-                assert(xOutStream.is()); // no reason why that could fail
-
-                try {
-                    ::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
-                } catch (uno::Exception const& e) {
-                    SAL_WARN("oox", "ShapeExport::WriteOLEObject: exception: " << e.Message);
-                }
+        assert(!sMediaType.isEmpty());
+        assert(!sRelationType.isEmpty());
+        assert(!sSuffix.isEmpty());
+
+        OUString sFileName = "embeddings/oleObject" + OUString::number(mnEmbeddeDocumentCounter++) + "." + sSuffix;
+        uno::Reference<io::XOutputStream> const xOutStream(
+            mpFB->openFragmentStream(
+                OUString::createFromAscii(GetComponentDir()) + "/" + sFileName,
+                sMediaType));
+        assert(xOutStream.is()); // no reason why that could fail
+
+        try {
+            ::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
+        } catch (uno::Exception const& e) {
+            SAL_WARN("oox", "ShapeExport::WriteOLEObject: exception: " << e.Message);
+        }
 
-                OUString const sRelId = mpFB->addRelation(
-                    mpFS->getOutputStream(), sRelationType,
-                    OUString::createFromAscii(GetRelationCompPrefix()) + sFileName);
+        OUString const sRelId = mpFB->addRelation(
+            mpFS->getOutputStream(), sRelationType,
+            OUString::createFromAscii(GetRelationCompPrefix()) + sFileName);
 
-                        mpFS->startElementNS( mnXmlNamespace, XML_graphicFrame, FSEND );
+        mpFS->startElementNS( mnXmlNamespace, XML_graphicFrame, FSEND );
 
-                        mpFS->startElementNS( mnXmlNamespace, XML_nvGraphicFramePr, FSEND );
+        mpFS->startElementNS( mnXmlNamespace, XML_nvGraphicFramePr, FSEND );
 
-                        mpFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
-                                               XML_id,     I32S( GetNewShapeID( xShape ) ),
-                                               XML_name,   IDS(Object),
-                                               FSEND );
+        mpFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
+                               XML_id,     I32S( GetNewShapeID( xShape ) ),
+                               XML_name,   IDS(Object),
+                               FSEND );
 
-                        mpFS->singleElementNS( mnXmlNamespace, XML_cNvGraphicFramePr,
-                                               FSEND );
+        mpFS->singleElementNS( mnXmlNamespace, XML_cNvGraphicFramePr,
+                               FSEND );
 
-                        if( GetDocumentType() == DOCUMENT_PPTX )
-                            mpFS->singleElementNS( mnXmlNamespace, XML_nvPr,
-                                                   FSEND );
-                        mpFS->endElementNS( mnXmlNamespace, XML_nvGraphicFramePr );
+        if (GetDocumentType() == DOCUMENT_PPTX)
+            mpFS->singleElementNS( mnXmlNamespace, XML_nvPr,
+                                   FSEND );
+        mpFS->endElementNS( mnXmlNamespace, XML_nvGraphicFramePr );
 
-                        WriteShapeTransformation( xShape, mnXmlNamespace );
+        WriteShapeTransformation( xShape, mnXmlNamespace );
 
-                        mpFS->startElementNS( XML_a, XML_graphic, FSEND );
-                        mpFS->startElementNS( XML_a, XML_graphicData,
-                                              XML_uri, "http://schemas.openxmlformats.org/presentationml/2006/ole",
-                                              FSEND );
-                        if (pProgID)
-                        {
-                            mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
-                                              XML_progId, pProgID,
-                                              FSNS(XML_r, XML_id), USS( sRelId ),
-                                              XML_spid, "",
-                                              FSEND );
-                        }
-                        else
-                        {
-                            mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
+        mpFS->startElementNS( XML_a, XML_graphic, FSEND );
+        mpFS->startElementNS( XML_a, XML_graphicData,
+                              XML_uri, "http://schemas.openxmlformats.org/presentationml/2006/ole",
+                              FSEND );
+        if (pProgID)
+        {
+            mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
+                              XML_progId, pProgID,
+                              FSNS(XML_r, XML_id), USS( sRelId ),
+                              XML_spid, "",
+                              FSEND );
+        }
+        else
+        {
+            mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
 //?                                              XML_name, "Document",
-                                              FSNS(XML_r, XML_id), USS( sRelId ),
-                                              // The spec says that this is a required attribute, but PowerPoint can only handle an empty value.
-                                              XML_spid, "",
-                                              FSEND );
-                        }
+                              FSNS(XML_r, XML_id), USS( sRelId ),
+                              // The spec says that this is a required attribute, but PowerPoint can only handle an empty value.
+                              XML_spid, "",
+                              FSEND );
+        }
 
-                        mpFS->singleElementNS( mnXmlNamespace, XML_embed, FSEND );
+        mpFS->singleElementNS( mnXmlNamespace, XML_embed, FSEND );
 
-                        // pic element
-                        SdrObject* pSdrOLE2( GetSdrObjectFromXShape( xShape ) );
-                        // The spec doesn't allow <p:pic> here, but PowerPoint requires it.
-                        bool bEcma = mpFB->getVersion() == oox::core::ECMA_DIALECT;
-                        if ( pSdrOLE2 && dynamic_cast<const SdrOle2Obj*>( pSdrOLE2) != nullptr && bEcma)
-                        {
-                            const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic();
-                            if ( pGraphic )
-                                WriteGraphicObjectShapePart( xShape, pGraphic );
-                        }
+        // pic element
+        SdrObject* pSdrOLE2( GetSdrObjectFromXShape( xShape ) );
+        // The spec doesn't allow <p:pic> here, but PowerPoint requires it.
+        bool bEcma = mpFB->getVersion() == oox::core::ECMA_DIALECT;
+        if (pSdrOLE2 && dynamic_cast<const SdrOle2Obj*>( pSdrOLE2) != nullptr && bEcma)
+        {
+            const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic();
+            if (pGraphic)
+                WriteGraphicObjectShapePart( xShape, pGraphic );
+        }
 
-                        mpFS->endElementNS( mnXmlNamespace, XML_oleObj );
+        mpFS->endElementNS( mnXmlNamespace, XML_oleObj );
 
-                        mpFS->endElementNS( XML_a, XML_graphicData );
-                        mpFS->endElementNS( XML_a, XML_graphic );
+        mpFS->endElementNS( XML_a, XML_graphicData );
+        mpFS->endElementNS( XML_a, XML_graphic );
 
-                        mpFS->endElementNS( mnXmlNamespace, XML_graphicFrame );
-            }
-        }
+        mpFS->endElementNS( mnXmlNamespace, XML_graphicFrame );
     }
     return *this;
 }


More information about the Libreoffice-commits mailing list