diff options
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/shapes/mediashape.cxx | 7 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/viewmediashape.cxx | 17 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/viewmediashape.hxx | 4 | ||||
-rw-r--r-- | slideshow/source/engine/slide/slideimpl.cxx | 9 | ||||
-rw-r--r-- | slideshow/source/inc/slideshowcontext.hxx | 1 |
5 files changed, 33 insertions, 5 deletions
diff --git a/slideshow/source/engine/shapes/mediashape.cxx b/slideshow/source/engine/shapes/mediashape.cxx index c81fc87072c0..d45dc7ec7b03 100644 --- a/slideshow/source/engine/shapes/mediashape.cxx +++ b/slideshow/source/engine/shapes/mediashape.cxx @@ -88,6 +88,7 @@ namespace slideshow::internal typedef ::std::vector< ViewMediaShapeSharedPtr > ViewMediaShapeVector; ViewMediaShapeVector maViewMediaShapes; bool mbIsPlaying; + OUString maFallbackDir; }; } @@ -97,7 +98,8 @@ namespace slideshow::internal const SlideShowContext& rContext ) : ExternalShapeBase( xShape, nPrio, rContext ), maViewMediaShapes(), - mbIsPlaying(false) + mbIsPlaying(false), + maFallbackDir(rContext.maFallbackDir) { } @@ -127,7 +129,8 @@ namespace slideshow::internal maViewMediaShapes.push_back( std::make_shared<ViewMediaShape>( rNewLayer, getXShape(), - mxComponentContext )); + mxComponentContext, + maFallbackDir )); // push new size to view shape maViewMediaShapes.back()->resize( getBounds() ); diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index 83acbd7e5207..b31d392d8550 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/range/b2irange.hxx> #include <canvas/canvastools.hxx> +#include <comphelper/DirectoryHelper.hxx> #include <cppcanvas/canvas.hxx> #include <avmedia/mediawindow.hxx> #include <svx/svdobj.hxx> @@ -59,7 +60,8 @@ namespace slideshow::internal { ViewMediaShape::ViewMediaShape( const ViewLayerSharedPtr& rViewLayer, uno::Reference< drawing::XShape > xShape, - uno::Reference< uno::XComponentContext > xContext ) : + uno::Reference< uno::XComponentContext > xContext, + const OUString& aFallbackDir ) : mpViewLayer( rViewLayer ), maWindowOffset( 0, 0 ), maBounds(), @@ -67,7 +69,8 @@ namespace slideshow::internal mxPlayer(), mxPlayerWindow(), mxComponentContext(std::move( xContext )), - mbIsSoundEnabled(true) + mbIsSoundEnabled(true), + maFallbackDir(aFallbackDir) { ENSURE_OR_THROW( mxShape.is(), "ViewMediaShape::ViewMediaShape(): Invalid Shape" ); ENSURE_OR_THROW( mpViewLayer, "ViewMediaShape::ViewMediaShape(): Invalid View" ); @@ -294,6 +297,16 @@ namespace slideshow::internal } else if (xPropSet->getPropertyValue(u"MediaURL"_ustr) >>= aURL) { + if ( maFallbackDir.getLength() && + aURL.startsWith("file:///") && + !comphelper::DirectoryHelper::fileExists(aURL) ) + { + auto fileNameStartIdx = aURL.lastIndexOf("/"); + if (fileNameStartIdx != -1) + { + aURL = OUString::Concat(maFallbackDir) + aURL.subView(fileNameStartIdx + 1); + } + } implInitializeMediaPlayer( aURL, sMimeType ); } } diff --git a/slideshow/source/engine/shapes/viewmediashape.hxx b/slideshow/source/engine/shapes/viewmediashape.hxx index fc37a3add8ce..34be8536b73b 100644 --- a/slideshow/source/engine/shapes/viewmediashape.hxx +++ b/slideshow/source/engine/shapes/viewmediashape.hxx @@ -65,7 +65,8 @@ namespace slideshow::internal */ ViewMediaShape( const ViewLayerSharedPtr& rViewLayer, css::uno::Reference< css::drawing::XShape > xShape, - css::uno::Reference< css::uno::XComponentContext > xContext ); + css::uno::Reference< css::uno::XComponentContext > xContext, + const OUString& aFallbackDir ); /** destroy the object */ @@ -157,6 +158,7 @@ namespace slideshow::internal css::uno::Reference< css::media::XPlayerWindow > mxPlayerWindow; css::uno::Reference< css::uno::XComponentContext> mxComponentContext; bool mbIsSoundEnabled; + OUString maFallbackDir; }; typedef ::std::shared_ptr< ViewMediaShape > ViewMediaShapeSharedPtr; diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 1468b24bff5a..a4ff70043b05 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/awt/SystemPointer.hpp> #include <com/sun/star/drawing/XMasterPageTarget.hpp> +#include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/presentation/ParagraphTarget.hpp> #include <com/sun/star/presentation/EffectNodeType.hpp> @@ -1039,6 +1040,14 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mbPaintOverlayActive( false ), mbFinalStateApplied( false ) { + if (uno::Reference<frame::XModel> xModel{ mxDrawPagesSupplier, uno::UNO_QUERY }) + { + OUString presentationURL = xModel->getURL(); + auto fileDirectoryEndIdx = presentationURL.lastIndexOf("/"); + if (presentationURL.startsWith("file:///") && fileDirectoryEndIdx != -1) + maContext.maFallbackDir = OUString::Concat(presentationURL.subView(0, fileDirectoryEndIdx + 1)); + } + // clone already existing views for slide bitmaps for( const auto& rView : rViewContainer ) viewAdded( rView ); diff --git a/slideshow/source/inc/slideshowcontext.hxx b/slideshow/source/inc/slideshowcontext.hxx index f745c30f25da..d0f8bbf432ea 100644 --- a/slideshow/source/inc/slideshowcontext.hxx +++ b/slideshow/source/inc/slideshowcontext.hxx @@ -108,6 +108,7 @@ namespace slideshow::internal const UnoViewContainer& mrViewContainer; css::uno::Reference< css::uno::XComponentContext> mxComponentContext; box2d::utils::Box2DWorldSharedPtr& mpBox2DWorld; + OUString maFallbackDir; }; } |