diff options
-rw-r--r-- | avmedia/Library_avmedia.mk | 7 | ||||
-rw-r--r-- | avmedia/source/inc/mediamisc.hxx | 5 | ||||
-rw-r--r-- | avmedia/source/viewer/mediawindow_impl.cxx | 9 | ||||
-rw-r--r-- | config_host/config_features.h.in | 5 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | sd/qa/unit/data/media_embedding.odp | bin | 216243 -> 4068424 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/inc/fuinsert.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/view/sdview4.cxx | 4 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/viewmediashape.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdomedia.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 13 |
16 files changed, 97 insertions, 14 deletions
diff --git a/avmedia/Library_avmedia.mk b/avmedia/Library_avmedia.mk index 40ba35bbf976..63e9067ec38c 100644 --- a/avmedia/Library_avmedia.mk +++ b/avmedia/Library_avmedia.mk @@ -47,6 +47,12 @@ $(eval $(call gb_Library_use_libraries,avmedia,\ $(gb_UWINAPI) \ )) +ifeq ($(ENABLE_GLTF),TRUE) +$(eval $(call gb_Library_add_exception_objects,avmedia,\ + avmedia/source/framework/modeltools \ +)) +endif + ifneq (,$(filter COLLADA2GLTF,$(BUILD_TYPE))) $(eval $(call gb_Library_set_warnings_not_errors,avmedia)) @@ -74,7 +80,6 @@ $(eval $(call gb_Library_add_exception_objects,avmedia,\ avmedia/source/framework/mediamisc \ avmedia/source/framework/mediaplayer \ avmedia/source/framework/mediatoolbox \ - avmedia/source/framework/modeltools \ avmedia/source/framework/soundhandler \ avmedia/source/viewer/mediaevent_impl \ avmedia/source/viewer/mediawindow \ diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx index 38a1e9db3f96..06e40665cc76 100644 --- a/avmedia/source/inc/mediamisc.hxx +++ b/avmedia/source/inc/mediamisc.hxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_features.h> + #ifndef INCLUDED_AVMEDIA_SOURCE_INC_MEDIAMISC_HXX #define INCLUDED_AVMEDIA_SOURCE_INC_MEDIAMISC_HXX @@ -42,7 +44,10 @@ class ResMgr; // Mime types #define AVMEDIA_MIMETYPE_COMMON "application/vnd.sun.star.media" + +#if HAVE_FEATURE_GLTF #define AVMEDIA_MIMETYPE_JSON "application/vnd.gltf+json" +#endif namespace avmedia diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 114ab9b2ddc9..c22bdcb26f0e 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -16,6 +16,9 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + +#include <config_features.h> + #include <iostream> #include "mediawindow_impl.hxx" #include "mediaevent_impl.hxx" @@ -83,10 +86,12 @@ MediaChildWindow::MediaChildWindow( Window* pParent ) : { } +#if HAVE_FEATURE_GLTF MediaChildWindow::MediaChildWindow( Window* pParent, SystemWindowData* pData ) : SystemChildWindow( pParent, WB_CLIPCHILDREN, pData ) { } +#endif MediaChildWindow::~MediaChildWindow() { @@ -242,10 +247,12 @@ uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& xPlayer = createPlayer(rURL, aServiceName, xContext); } } +#if HAVE_FEATURE_GLTF else if ( *pMimeType == AVMEDIA_MIMETYPE_JSON ) { xPlayer = createPlayer(rURL, AVMEDIA_OPENGL_MANAGER_SERVICE_NAME, xContext); } +#endif return xPlayer; } @@ -501,12 +508,14 @@ void MediaWindowImpl::onURLChanged() { mpChildWindow.reset(new MediaChildWindow(this) ); } +#if HAVE_FEATURE_GLTF else if ( m_sMimeType == AVMEDIA_MIMETYPE_JSON ) { SystemWindowData aWinData = OpenGLContext::generateWinData(this); mpChildWindow.reset(new MediaChildWindow(this,&aWinData)); mbEventTransparent = false; } +#endif if( !mpChildWindow ) return; mpChildWindow->SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in index 55232c64d066..3fd1da5b5dce 100644 --- a/config_host/config_features.h.in +++ b/config_host/config_features.h.in @@ -137,4 +137,9 @@ */ #define HAVE_EXPORT_VALIDATION 0 +/* + * Whether we have glTF support. + */ +#define HAVE_FEATURE_GLTF 0 + #endif diff --git a/configure.ac b/configure.ac index 298aa3c5f4ae..5c78dff5ee72 100644 --- a/configure.ac +++ b/configure.ac @@ -10512,12 +10512,18 @@ AC_SUBST(ENABLE_OPENCL) dnl =================================================================== dnl Check whether to enable glTF support dnl =================================================================== +AC_MSG_CHECKING([whether to enable glTF support]) +if test "$ENABLE_RELEASE_BUILD" = "TRUE"; then + if test $_os == iOS -o $_os == Android -o $_os = Darwin; then + enable_gltf=no + fi +fi ENABLE_GLTF= -AC_MSG_CHECKING([whether to enable glTF support]) if test "x$enable_gltf" != "xno"; then ENABLE_GLTF=TRUE AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_FEATURE_GLTF,1) BUILD_TYPE="$BUILD_TYPE LIBGLTF" if test "$test_freetype" = "no"; then BUILD_TYPE="$BUILD_TYPE FREETYPE" diff --git a/sd/qa/unit/data/media_embedding.odp b/sd/qa/unit/data/media_embedding.odp Binary files differindex 14ea4606448c..e70300edba59 100644 --- a/sd/qa/unit/data/media_embedding.odp +++ b/sd/qa/unit/data/media_embedding.odp diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index cc9339acda69..949bd853e8a1 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -25,6 +25,7 @@ #include <svx/svdotext.hxx> #include <svx/svdoashp.hxx> +#include <svx/svdograf.hxx> #include <svx/svdogrp.hxx> #include <svx/svdomedia.hxx> #include <svx/svdoole2.hxx> @@ -46,6 +47,8 @@ #include <com/sun/star/chart2/data/XDataSequence.hpp> #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> +#include <config_features.h> + using namespace ::com::sun::star; /// Impress import filters tests. @@ -715,17 +718,26 @@ void SdFiltersTest::testMediaEmbedding() const SdrPage *pPage = pDoc->GetPage (1); CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); +#if HAVE_FEATURE_GLTF // First object is a glTF model - SdrMediaObj *pModelObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 1 )); + SdrMediaObj *pModelObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 2 )); CPPUNIT_ASSERT_MESSAGE( "missing model", pModelObj != NULL); - CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Model/duck/duck.json" ), pModelObj->getMediaProperties().getURL()); + CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Model/jeep/jeep.json" ), pModelObj->getMediaProperties().getURL()); CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.gltf+json" ), pModelObj->getMediaProperties().getMimeType()); +#else + // If glTF is not supported, then the fallback image is imported + SdrGrafObj *pGrafic = dynamic_cast<SdrGrafObj*>( pPage->GetObj( 2 )); + CPPUNIT_ASSERT_MESSAGE( "Could not load glTF fallback image", pGrafic != NULL); + CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Pictures/jeep.png" ), pGrafic->GetGrafStreamURL()); +#endif // Second object is a sound - SdrMediaObj *pMediaObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 2 )); + SdrMediaObj *pMediaObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 3 )); CPPUNIT_ASSERT_MESSAGE( "missing media object", pMediaObj != NULL); CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Media/button-1.wav" ), pMediaObj->getMediaProperties().getURL()); CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.sun.star.media" ), pMediaObj->getMediaProperties().getMimeType()); + + xDocShRef->DoClose(); } void SdFiltersTest::testBnc870237() diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index c16e6fc0e62b..c7bd348aa617 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -85,6 +85,8 @@ #include <boost/scoped_ptr.hpp> #include "glob.hrc" +#include <config_features.h> + using namespace com::sun::star; namespace sd { @@ -93,7 +95,6 @@ TYPEINIT1( FuInsertGraphic, FuPoor ); TYPEINIT1( FuInsertClipboard, FuPoor ); TYPEINIT1( FuInsertOLE, FuPoor ); TYPEINIT1( FuInsertAVMedia, FuPoor ); -TYPEINIT1( FuInsert3DModel, FuPoor ); FuInsertGraphic::FuInsertGraphic ( ViewShell* pViewSh, @@ -763,6 +764,9 @@ void FuInsertAVMedia::DoExecute( SfxRequest& rReq ) } } +#if HAVE_FEATURE_GLTF +TYPEINIT1( FuInsert3DModel, FuPoor ); + FuInsert3DModel::FuInsert3DModel( ViewShell* pViewSh, ::sd::Window* pWin, @@ -826,7 +830,7 @@ void FuInsert3DModel::DoExecute( SfxRequest& ) mpWindow->LeaveWait(); } } - +#endif } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/fuinsert.hxx b/sd/source/ui/inc/fuinsert.hxx index 60276cd146a6..25b7ed329312 100644 --- a/sd/source/ui/inc/fuinsert.hxx +++ b/sd/source/ui/inc/fuinsert.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SD_SOURCE_UI_INC_FUINSERT_HXX #include "fupoor.hxx" +#include <config_features.h> namespace sd { @@ -104,7 +105,7 @@ private: SdDrawDocument* pDoc, SfxRequest& rReq); }; - +#if HAVE_FEATURE_GLTF class FuInsert3DModel : public FuPoor { @@ -122,7 +123,7 @@ private: SdDrawDocument* pDoc, SfxRequest& rReq); }; - +#endif } // end of namespace sd #endif diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 2c42638a8cf1..2d503cd3fc87 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -32,6 +32,8 @@ #include <comphelper/processfactory.hxx> +#include <config_features.h> + #include <editeng/editdata.hxx> #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> @@ -1164,7 +1166,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) Invalidate(SID_DRAWTBX_INSERT); } break; - +#if HAVE_FEATURE_GLTF case SID_INSERT_3DMODEL: { SetCurrentFunction( FuInsert3DModel::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); @@ -1175,6 +1177,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) Invalidate(SID_DRAWTBX_INSERT); } break; +#endif case SID_COPYOBJECTS: { diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 06d60f676789..d57b4a6ad2ba 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -80,6 +80,8 @@ #include "fubullet.hxx" #include "fuformatpaintbrush.hxx" +#include <config_features.h> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -1658,6 +1660,14 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) } } +#if !HAVE_FEATURE_GLTF + if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_INSERT_3DMODEL)) + { + rSet.DisableItem(SID_INSERT_3DMODEL); + rSet.Put(SfxVisibilityItem(SID_INSERT_3DMODEL, false)); + } +#endif + GetModeSwitchingMenuState (rSet); } diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index c14465d6da56..e698e6457996 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -61,6 +61,8 @@ #include <svx/svdoashp.hxx> #include "glob.hrc" +#include <config_features.h> + using namespace com::sun::star; namespace sd { @@ -289,6 +291,7 @@ SdrMediaObj* View::InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction, return InsertMediaObj( realURL, "application/vnd.sun.star.media", rAction, rPos, rSize ); } +#if HAVE_FEATURE_GLTF SdrMediaObj* View::Insert3DModelURL( const OUString& rModelURL, sal_Int8& rAction, const Point& rPos, const Size& rSize, @@ -313,6 +316,7 @@ SdrMediaObj* View::Insert3DModelURL( pRetObject->setMediaProperties(aItem); return pRetObject; } +#endif SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rMimeType, sal_Int8& rAction, const Point& rPos, const Size& rSize ) diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index ce507174cb49..b95e0988bc5d 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -469,6 +469,7 @@ namespace slideshow rRangePix.getMinY(), rRangePix.getMaxX() - rRangePix.getMinX(), rRangePix.getMaxY() - rRangePix.getMinY() ); +#if HAVE_FEATURE_GLTF if( avmedia::IsModel(rMimeType) ) { mpEventHandlerParent.reset(new Window(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL)); @@ -482,6 +483,7 @@ namespace slideshow Size( aAWTRect.Width, aAWTRect.Height ) ); } else +#endif { mpMediaWindow.reset( new SystemChildWindow( pWindow, WB_CLIPCHILDREN ) ); mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ), diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index c05da8cdcc4f..e34a7285c90e 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_features.h> + #include <svx/svdomedia.hxx> #include <rtl/ustring.hxx> @@ -263,6 +265,7 @@ uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream() return tempFile.openStream(); } +#if HAVE_FEATURE_GLTF static bool lcl_HandleJsonPackageURL( const OUString& rURL, SdrModel* const pModel, @@ -321,6 +324,7 @@ static bool lcl_HandleJsonPackageURL( } return true; } +#endif /// copy a stream from XStorage to temp file static bool lcl_HandlePackageURL( @@ -401,9 +405,11 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper { OUString tempFileURL; bool bSuccess; +#if HAVE_FEATURE_GLTF if( url.endsWith(".json") ) bSuccess = lcl_HandleJsonPackageURL(url, GetModel(), tempFileURL); else +#endif bSuccess = lcl_HandlePackageURL( url, GetModel(), tempFileURL); if (bSuccess) { diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 66577bac9594..0597ada5694c 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -114,6 +114,8 @@ #include "XMLImageMapExport.hxx" #include <boost/scoped_ptr.hpp> +#include <config_features.h> + using namespace ::com::sun::star; using namespace ::xmloff::EnhancedCustomShapeToken; using namespace ::xmloff::token; @@ -3157,6 +3159,7 @@ lcl_StoreMediaAndGetURL(SvXMLExport & rExport, } } +#if HAVE_FEATURE_GLTF static void lcl_StoreJsonExternalsAndFallback( SvXMLExport& rExport, const uno::Reference<beans::XPropertySet> xPropSet, @@ -3243,6 +3246,7 @@ static void lcl_StoreJsonExternalsAndFallback( } } } +#endif void XMLShapeExport::ImpExportMediaShape( const uno::Reference< drawing::XShape >& xShape, @@ -3270,8 +3274,10 @@ void XMLShapeExport::ImpExportMediaShape( OUString const persistentURL = lcl_StoreMediaAndGetURL(GetExport(), xPropSet, aMediaURL, sMimeType); +#if HAVE_FEATURE_GLTF if( sMimeType == "application/vnd.gltf+json" ) lcl_StoreJsonExternalsAndFallback(GetExport(), xPropSet, aMediaURL); +#endif mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, persistentURL ); mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 9a17bd220d33..a62eefb167a1 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -82,6 +82,8 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/vector/b2dvector.hxx> +#include <config_features.h> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing; @@ -3076,10 +3078,12 @@ void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Referen if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( aLocalName, XML_MIME_TYPE ) ) { - if( xAttrList->getValueByIndex( n ).equalsAscii( "application/vnd.sun.star.media" ) || - xAttrList->getValueByIndex( n ).equalsAscii( "application/vnd.gltf+json" )) + if( xAttrList->getValueByIndex( n ).equalsAscii( "application/vnd.sun.star.media" ) ) mbMedia = true; - +#if HAVE_FEATURE_GLTF + if( xAttrList->getValueByIndex( n ).equalsAscii( "application/vnd.gltf+json" ) ) + mbMedia = true; +#endif // leave this loop n = nAttrCount - 1; } @@ -3595,6 +3599,7 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPref } } } +#if HAVE_FEATURE_GLTF // For glTF models the fallback image is placed before the real shape. // So we need to remove the fallback image after real shape is detected. else if ( mxImplContext.Is() && IsXMLToken(mxImplContext->GetLocalName(), XML_IMAGE) && @@ -3607,7 +3612,7 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPref if( pContext ) removeGraphicFromImportContext(*mxImplContext); } - +#endif // call parent for content if(!pContext) pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); |