diff options
author | Vladislav Tarakanov <vladislav.tarakanov@bk.ru> | 2024-07-28 14:26:21 +0400 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-07-28 17:05:53 +0200 |
commit | c658efe24f7a7eb4234c1c64668ea115788272e7 (patch) | |
tree | 646d4d4fce0114b70cff69ead1d92fd1bcb46efb /slideshow/source/engine/shapes/viewmediashape.cxx | |
parent | 78090581d246cd391d99575680b5b8f8d9de7840 (diff) |
tdf#158510 Don't change the initial URL when using fallback
The current aURL conversions in the file "unoshap4.cxx"
result in the URL obtained when importing the file being replaced with a
new one formed from the presentation directory and file name.
As a result, the model changes and saving is requested
even if no changes were made to the presentation.
To fix this problem, we added saving the
presentation directory URL into the context for
transfer from SlideImpl to ViewMediaShape.
Regression after: fe897b36aef28dfe175461c43614e22588fcfd84
Change-Id: Ifda8610d0a4874ffa17e759fd45ddbbd2f934c0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170528
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'slideshow/source/engine/shapes/viewmediashape.cxx')
-rw-r--r-- | slideshow/source/engine/shapes/viewmediashape.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
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 ); } } |