sd/source/ui/unoidl/unomodel.cxx |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit ed350639eba4dbeb88b044c5e2891f2873f3e589
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jul 12 23:34:50 2024 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Jul 16 13:06:22 2024 +0200

    lok: add media (video) info to the presentation info JSON
    
    Change-Id: Iba8f58d48cbe252b12f10ba20f9f5e2b10029c25
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170413
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 40a852e44165..775513415bc3 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -67,6 +67,7 @@
 #include <svx/svdlayer.hxx>
 #include <svx/svdsob.hxx>
 #include <svx/svdundo.hxx>
+#include <svx/svdomedia.hxx>
 #include <svx/unoapi.hxx>
 #include <svx/unofill.hxx>
 #include <svx/sdrpagewindow.hxx>
@@ -3085,6 +3086,8 @@ OString SdXImpressDocument::getPresentationInfo() const
                         xPropSet->getPropertyValue("Visible") >>= bIsVisible;
                         if (bIsVisible)
                         {
+                            SdrPage* pPage = SdPage::getImplementation(xSlide);
+
                             ::tools::ScopedJsonWriterStruct aSlideNode = 
aJsonWriter.startStruct();
                             std::string sSlideHash = GetInterfaceHash(xSlide);
                             aJsonWriter.put("hash", sSlideHash);
@@ -3129,6 +3132,28 @@ OString SdXImpressDocument::getPresentationInfo() const
                                 }
                             }
 
+                            {
+                                ::tools::ScopedJsonWriterArray aVideoList = 
aJsonWriter.startArray("videos");
+                                SdrObjListIter aIterator(pPage, 
SdrIterMode::DeepWithGroups);
+                                while (aIterator.IsMore())
+                                {
+                                    auto* pObject = aIterator.Next();
+                                    if (pObject->GetObjIdentifier() == 
SdrObjKind::Media)
+                                    {
+                                        ::tools::ScopedJsonWriterStruct 
aVideosNode = aJsonWriter.startStruct();
+                                        auto* pMediaObject = 
static_cast<SdrMediaObj*>(pObject);
+                                        auto const& rRectangle = 
pMediaObject->GetLogicRect();
+                                        auto aRectangle = 
o3tl::convert(rRectangle, o3tl::Length::mm100, o3tl::Length::twip);
+                                        aJsonWriter.put("id", 
reinterpret_cast<sal_uInt64>(pMediaObject));
+                                        aJsonWriter.put("url", 
pMediaObject->getTempURL());
+                                        aJsonWriter.put("x", 
aRectangle.Left());
+                                        aJsonWriter.put("y", aRectangle.Top());
+                                        aJsonWriter.put("width", 
aRectangle.GetWidth());
+                                        aJsonWriter.put("height", 
aRectangle.GetHeight());
+                                    }
+                                }
+                            }
+
                             sal_Int32 nTransitionType = 0;
                             xPropSet->getPropertyValue("TransitionType") >>= 
nTransitionType;
 

Reply via email to