summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-12-20 00:28:28 +0100
committerMichael Stahl <mstahl@redhat.com>2015-12-20 00:56:07 +0100
commit89e85e5d2ec337aaccfa74bd7017898df42529b4 (patch)
treec0ca0aedb4b39af5187b08336d0aca552f5e1f7a /oox
parentd60398ff5b42ff77a4002dcd13b7fb8c9a73eade (diff)
oox: fix indentation of ShapeExport::WriteOLE2Shape
Change-Id: I9057cd9d574d545929a9f43f40f49164179a6dcc
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/shapes.cxx267
1 files changed, 133 insertions, 134 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index db6ec66c5d29..e6025334cbe6 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;
}