summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-05-18 01:11:41 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2021-12-01 16:50:23 +0100
commitf9e79a91f15e10ededad0f103c4ffe0ca38fcb31 (patch)
tree6bd058d7bc28fa48d2ae510f958beb617d1b2bb5 /svx/source/svdraw
parentb8084b0dee7d28f4fc8fa92eae6171880ac3a9c8 (diff)
Fix --disable-avmedia for DESKTOP build
Probably additional bits can be removed, but this now passes. Change-Id: I366bec43cfd6fb02e914c85c711b3b19586d534d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126161 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/MediaShellHelpers.cxx9
-rw-r--r--svx/source/svdraw/svdomedia.cxx16
2 files changed, 22 insertions, 3 deletions
diff --git a/svx/source/svdraw/MediaShellHelpers.cxx b/svx/source/svdraw/MediaShellHelpers.cxx
index 752a6882c038..3277f05add98 100644
--- a/svx/source/svdraw/MediaShellHelpers.cxx
+++ b/svx/source/svdraw/MediaShellHelpers.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
#include <svx/MediaShellHelpers.hxx>
#include <avmedia/mediaitem.hxx>
#include <sfx2/request.hxx>
@@ -41,6 +42,7 @@ void GetState(const SdrMarkView* pSdrView, SfxItemSet& rSet)
if (SID_AVMEDIA_TOOLBOX != nWhich)
continue;
+#if HAVE_FEATURE_AVMEDIA
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
bool bDisable = true;
@@ -60,12 +62,18 @@ void GetState(const SdrMarkView* pSdrView, SfxItemSet& rSet)
}
if (bDisable)
+#endif
rSet.DisableItem(SID_AVMEDIA_TOOLBOX);
}
}
const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView, SfxRequest const& rReq)
{
+#if !HAVE_FEATURE_AVMEDIA
+ (void)pSdrView;
+ (void)rReq;
+ return nullptr;
+#else
if (!pSdrView)
return nullptr;
@@ -96,6 +104,7 @@ const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView, SfxRequest cons
.executeMediaItem(*pMediaItem);
return pMediaItem;
+#endif
}
} // end of namespace svx::MediaShellHelpers
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 515bdff11b42..3df53dbf3523 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -44,10 +44,12 @@ using namespace ::com::sun::star;
struct SdrMediaObj::Impl
{
::avmedia::MediaItem m_MediaProperties;
+#if HAVE_FEATURE_AVMEDIA
// Note: the temp file is read only, until it is deleted!
// It may be shared between multiple documents in case of copy/paste,
// hence the shared_ptr.
std::shared_ptr< ::avmedia::MediaTempFile > m_pTempFile;
+#endif
uno::Reference< graphic::XGraphic > m_xCachedSnapshot;
OUString m_LastFailedPkgURL;
};
@@ -62,7 +64,9 @@ SdrMediaObj::SdrMediaObj(SdrModel& rSdrModel, SdrMediaObj const & rSource)
: SdrRectObj(rSdrModel, rSource)
,m_xImpl( new Impl )
{
+#if HAVE_FEATURE_AVMEDIA
m_xImpl->m_pTempFile = rSource.m_xImpl->m_pTempFile; // before props
+#endif
setMediaProperties( rSource.getMediaProperties() );
m_xImpl->m_xCachedSnapshot = rSource.m_xImpl->m_xCachedSnapshot;
}
@@ -218,7 +222,7 @@ const OUString& SdrMediaObj::getURL() const
#if HAVE_FEATURE_AVMEDIA
return m_xImpl->m_MediaProperties.getURL();
#else
-static OUString ret;
+ static OUString ret;
return ret;
#endif
}
@@ -236,6 +240,7 @@ const ::avmedia::MediaItem& SdrMediaObj::getMediaProperties() const
uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream() const
{
+#if HAVE_FEATURE_AVMEDIA
if (!m_xImpl->m_pTempFile)
{
SAL_WARN("svx", "this is only intended for embedded media");
@@ -245,10 +250,16 @@ uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream() const
uno::Reference<ucb::XCommandEnvironment>(),
comphelper::getProcessComponentContext());
return tempFile.openStream();
+#else
+ return nullptr;
+#endif
}
void SdrMediaObj::SetInputStream(uno::Reference<io::XInputStream> const& xStream)
{
+#if !HAVE_FEATURE_AVMEDIA
+ (void) xStream;
+#else
if (m_xImpl->m_pTempFile || m_xImpl->m_LastFailedPkgURL.isEmpty())
{
SAL_WARN("svx", "this is only intended for embedded media");
@@ -265,12 +276,11 @@ void SdrMediaObj::SetInputStream(uno::Reference<io::XInputStream> const& xStream
if (bSuccess)
{
m_xImpl->m_pTempFile = std::make_shared<::avmedia::MediaTempFile>(tempFileURL);
-#if HAVE_FEATURE_AVMEDIA
m_xImpl->m_MediaProperties.setURL(
m_xImpl->m_LastFailedPkgURL, tempFileURL, "");
-#endif
}
m_xImpl->m_LastFailedPkgURL.clear(); // once only
+#endif
}
/// copy a stream from XStorage to temp file