diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2022-05-15 10:05:54 -0400 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-10-24 08:16:55 +0200 |
commit | 8c20411adedb38453968f9ba5dbbbf196a51bd9d (patch) | |
tree | c315be823f50ec702d6456ee707187df1f215e71 /svx | |
parent | 510bca3d3ab0b2fd21f0083b4e0fe14ff8c903c3 (diff) |
lok: support embedded media
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Change-Id: Ie8f3ed188cec0050a10a5d49325756931b902ef1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141502
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 9 | ||||
-rw-r--r-- | svx/source/svdraw/svdomedia.cxx | 25 | ||||
-rw-r--r-- | svx/source/svdraw/svdxcgv.cxx | 13 |
3 files changed, 47 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index eeed5b3ddcf4..b788c2a060c3 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -23,6 +23,7 @@ #include <svx/svdpagv.hxx> #include <svx/svdpage.hxx> #include <svx/svdotable.hxx> +#include <svx/svdomedia.hxx> #include <osl/diagnose.h> #include <osl/thread.h> @@ -1146,6 +1147,14 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelectionText.getStr()); SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionTextView); } + + if (comphelper::LibreOfficeKit::isActive() && mpMarkedObj + && mpMarkedObj->GetObjIdentifier() == OBJ_MEDIA) + { + SdrMediaObj* mediaObj = dynamic_cast<SdrMediaObj*>(mpMarkedObj); + if (mediaObj) + mediaObj->notifyPropertiesForLOKit(); + } } } diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index cb78eee47766..2f5124dc8ee7 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -30,6 +30,10 @@ #include <ucbhelper/content.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <comphelper/lok.hxx> +#include <sfx2/lokhelper.hxx> +#include <boost/property_tree/json_parser.hpp> #include <vcl/svapp.hxx> @@ -428,4 +432,25 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper } } +void SdrMediaObj::notifyPropertiesForLOKit() +{ + if (!m_xImpl->m_MediaProperties.getTempURL().isEmpty()) + { + const auto mediaId = reinterpret_cast<std::size_t>(this); + + boost::property_tree::ptree json; + json.put("action", "update"); + json.put("id", mediaId); + json.put("url", m_xImpl->m_MediaProperties.getTempURL()); + + const tools::Rectangle aRect = o3tl::convert(maRect, o3tl::Length::mm100, o3tl::Length::twip); + json.put("x", aRect.getX()); + json.put("y", aRect.getY()); + json.put("w", aRect.getWidth()); + json.put("h", aRect.getHeight()); + + SfxLokHelper::notifyMediaUpdate(json); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 9a2ca91a2c92..c5281b534f59 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -27,6 +27,7 @@ #include <svx/svdoutl.hxx> #include <svx/svdundo.hxx> #include <svx/svdograf.hxx> +#include <svx/svdomedia.hxx> #include <svx/svdoole2.hxx> #include <svx/svdorect.hxx> #include <svx/svdopage.hxx> @@ -624,6 +625,18 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject) aRet = *pSdrOle2Obj->GetGraphic(); } } + else + { + // Support extracting a snapshot from video media, if possible. + const SdrMediaObj* pSdrMediaObj = dynamic_cast<const SdrMediaObj*>(&rSdrObject); + if (pSdrMediaObj) + { + const css::uno::Reference<css::graphic::XGraphic>& xGraphic + = pSdrMediaObj->getSnapshot(); + if (xGraphic.is()) + aRet = Graphic(xGraphic); + } + } // if graphic could not be retrieved => go the hard way and create a MetaFile if((GraphicType::NONE == aRet.GetType()) || (GraphicType::Default == aRet.GetType())) |