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-26 08:18:55 +0200 |
commit | 038c4a42834014b421a2e8a99ae436eb2dc8f8c5 (patch) | |
tree | 2e519361c64ef0e940b4788bdc6df6111069ea0d /svx/source | |
parent | 110370baa621f33a095e1da908f89bdfb5a68ce6 (diff) |
lok: support embedded media
Change-Id: Ie8f3ed188cec0050a10a5d49325756931b902ef1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141807
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svx/source')
-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 8539c78c7c94..3e4383c89137 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> @@ -1153,6 +1154,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() == SdrObjKind::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 421ead2fe082..e2e4731e129a 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -29,6 +29,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> @@ -458,4 +462,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.getOpenWidth()); + json.put("h", aRect.getOpenHeight()); + + 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 90723501be91..f579a50911e4 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> @@ -628,6 +629,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())) |