summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-06-11 12:36:26 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-06-13 00:31:24 +0200
commit3ba25e534d5a433778a6d6c77117a13c6d796761 (patch)
treeecafdd0be51b42ab032ddb60c56f2c6bd8633db4 /sd
parent053fbcfdbe572f4e18f35d66dd365c78a1e6e54e (diff)
Introduce HAVE_FEATURE_GLTF to enable/disable gltf related code
When it is a release build then enable it only on Windows and Linux. Change-Id: I7c462aeb75e6ab60eeaa0fa42ca7853a6369b742 (cherry picked from commit fe70101856332663f600df144b39d2638b3d0570)
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/media_embedding.odpbin216243 -> 4068424 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx18
-rw-r--r--sd/source/ui/func/fuinsert.cxx8
-rw-r--r--sd/source/ui/inc/fuinsert.hxx5
-rw-r--r--sd/source/ui/view/drviews2.cxx5
-rw-r--r--sd/source/ui/view/drviews7.cxx10
-rw-r--r--sd/source/ui/view/sdview4.cxx4
7 files changed, 42 insertions, 8 deletions
diff --git a/sd/qa/unit/data/media_embedding.odp b/sd/qa/unit/data/media_embedding.odp
index 14ea4606448c..e70300edba59 100644
--- a/sd/qa/unit/data/media_embedding.odp
+++ b/sd/qa/unit/data/media_embedding.odp
Binary files differ
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 7a6c14f7c935..384a6c7da817 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>
@@ -1166,7 +1168,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 ) );
@@ -1177,6 +1179,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 b0bec1dfd256..81e2e005a14c 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;
@@ -1592,6 +1594,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 )