diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-10-28 02:28:18 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-10-30 08:21:55 +0100 |
commit | 08a43cc97ccf88faa9d3a04afc3aacd2c885a2d1 (patch) | |
tree | 11f416701d1be0a962c7653ea86060f30f708b56 /xmloff/source/draw/shapeexport.cxx | |
parent | 8d994f83568073eb79ab987069f740c3c940405e (diff) |
related: tdf#103884 remove gltf/collada feature
Change-Id: Icd26ad96c0337844ef1463dabfbe791caa00dd2d
Reviewed-on: https://gerrit.libreoffice.org/43972
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'xmloff/source/draw/shapeexport.cxx')
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index aff07db2e138..7c1c9cb206bb 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -3184,138 +3184,6 @@ lcl_StoreMediaAndGetURL(SvXMLExport & rExport, } } -#if HAVE_FEATURE_GLTF -static void lcl_StoreGltfExternals( - SvXMLExport& rExport, - const OUString& rURL ) -{ - OUString sUrlPath; - if (rURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:", &sUrlPath)) - { - sUrlPath = sUrlPath.copy(0,sUrlPath.lastIndexOf("/")); - try - { - // Base storage - uno::Reference<document::XStorageBasedDocument> const xSBD( - rExport.GetModel(), uno::UNO_QUERY_THROW); - const uno::Reference<embed::XStorage> xStorage( - xSBD->getDocumentStorage(), uno::UNO_QUERY_THROW); - - // Model source - ::comphelper::LifecycleProxy proxy; - const uno::Reference<embed::XStorage> xModelStorage( - ::comphelper::OStorageHelper::GetStorageAtPath(xStorage, sUrlPath, - embed::ElementModes::READ, proxy)); - - // Target storage - uno::Reference<embed::XStorage> const xTarget( - rExport.GetTargetStorage(), uno::UNO_QUERY_THROW); - - // Target of all models - const uno::Reference<embed::XStorage> xModelsTarget( - xTarget->openStorageElement(sUrlPath.copy(0,sUrlPath.lastIndexOf("/")), embed::ElementModes::WRITE)); - - // Target of current model - const OUString sModelName = sUrlPath.copy(sUrlPath.lastIndexOf("/")+1); - const uno::Reference<embed::XStorage> xModelTarget( - xModelsTarget->openStorageElement(sModelName, embed::ElementModes::WRITE)); - - xModelStorage->copyToStorage(xModelTarget); - - const uno::Reference<embed::XTransactedObject> xModelsTransaction(xModelsTarget, uno::UNO_QUERY); - if (xModelsTransaction.is()) - { - xModelsTransaction->commit(); - } - } - catch (uno::Exception const& e) - { - SAL_INFO("xmloff", "exception while saving embedded model: '" << e << "'"); - } - } -} - -static void lcl_StoreGltfFallback( - SvXMLExport& rExport, - const uno::Reference<beans::XPropertySet>& rPropSet, - const OUString& rURL ) -{ - OUString sUrlPath; - if (rURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:", &sUrlPath)) - { - sUrlPath = sUrlPath.copy(0,sUrlPath.lastIndexOf("/")); - try - { - // Base storage - uno::Reference<document::XStorageBasedDocument> const xSBD( - rExport.GetModel(), uno::UNO_QUERY_THROW); - const uno::Reference<embed::XStorage> xStorage( - xSBD->getDocumentStorage(), uno::UNO_QUERY_THROW); - - // Model source - ::comphelper::LifecycleProxy proxy; - const uno::Reference<embed::XStorage> xModelStorage( - ::comphelper::OStorageHelper::GetStorageAtPath(xStorage, sUrlPath, - embed::ElementModes::READ, proxy)); - - // Target storage - uno::Reference<embed::XStorage> const xTarget( - rExport.GetTargetStorage(), uno::UNO_QUERY_THROW); - - // Target of all models - const uno::Reference<embed::XStorage> xModelsTarget( - xTarget->openStorageElement(sUrlPath.copy(0,sUrlPath.lastIndexOf("/")), embed::ElementModes::WRITE)); - - /// Save the fallback image under the 'Models/Fallbacks/' folder - uno::Reference< graphic::XGraphic > xGraphic( rPropSet->getPropertyValue("FallbackGraphic"), uno::UNO_QUERY ); - if( xGraphic.is() ) - { - // Fallback storage - const uno::Reference<embed::XStorage> xFallbackTarget( - xModelsTarget->openStorageElement("Fallbacks", embed::ElementModes::WRITE)); - - const OUString sModelName = sUrlPath.copy(sUrlPath.lastIndexOf("/")+1); - uno::Reference< io::XStream > xPictureStream( - xFallbackTarget->openStreamElement( sModelName + ".png", embed::ElementModes::WRITE ), uno::UNO_QUERY_THROW ); - - uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(comphelper::getProcessComponentContext()) ); - uno::Sequence< beans::PropertyValue > aArgs( 2 ); - aArgs[ 0 ].Name = "MimeType"; - aArgs[ 0 ].Value <<= OUString( "image/png" ); - aArgs[ 1 ].Name = "OutputStream"; - aArgs[ 1 ].Value <<= xPictureStream->getOutputStream(); - xProvider->storeGraphic( xGraphic, aArgs ); - - const uno::Reference<embed::XTransactedObject> xFallbackTransaction(xFallbackTarget, uno::UNO_QUERY); - if (xFallbackTransaction.is()) - { - xFallbackTransaction->commit(); - } - - const OUString sFallbackURL( sUrlPath.copy(0,sUrlPath.lastIndexOf("/")) + "/Fallbacks/" + sModelName + ".png"); - rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sFallbackURL ); - rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); - rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); - rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); - - SvXMLElementExport aImage( rExport, XML_NAMESPACE_DRAW, XML_IMAGE, false, true ); - } - - const uno::Reference<embed::XTransactedObject> xModelsTransaction(xModelsTarget, uno::UNO_QUERY); - if (xModelsTransaction.is()) - { - xModelsTransaction->commit(); - } - } - catch (uno::Exception const& e) - { - SAL_INFO("xmloff", "exception while saving fallback image of glTF model: '" << e << "'"); - } - } -} - -#endif - void XMLShapeExport::ImpExportMediaShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint) @@ -3342,10 +3210,6 @@ void XMLShapeExport::ImpExportMediaShape( OUString const persistentURL = lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL, sMimeType); -#if HAVE_FEATURE_GLTF - if( sMimeType == "model/vnd.gltf+json" ) - lcl_StoreGltfExternals(GetExport(), aMediaURL); -#endif mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, persistentURL ); mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); @@ -3407,11 +3271,6 @@ void XMLShapeExport::ImpExportMediaShape( mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue ); delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true ) ); } - -#if HAVE_FEATURE_GLTF - if( sMimeType == "model/vnd.gltf+json" ) - lcl_StoreGltfFallback(GetExport(), xPropSet, aMediaURL); -#endif } } |