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

New commits:
commit 9a21ce2aa66009583839e3629bafabcda53ca6a4
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jul 12 23:34:50 2024 +0900
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Sep 20 08:12:49 2024 +0200

    lok: add media (video) info to the presentation info JSON
    
    Change-Id: Iba8f58d48cbe252b12f10ba20f9f5e2b10029c25
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173658
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 539148a3a78c..73d69c4e4791 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -69,6 +69,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>
@@ -3129,6 +3130,8 @@ OString SdXImpressDocument::getPresentationInfo() const
                         xPropSet->getPropertyValue("Visible") >>= bIsVisible;
                         if (bIsVisible)
                         {
+                            SdrPage* pPage = SdPage::getImplementation(xSlide);
+
                             auto aSlideNode = aJsonWriter.startStruct();
                             std::string sSlideHash = GetInterfaceHash(xSlide);
                             aJsonWriter.put("hash", sSlideHash);
@@ -3173,6 +3176,28 @@ OString SdXImpressDocument::getPresentationInfo() const
                                 }
                             }
 
+                            {
+                                auto aVideoList = 
aJsonWriter.startArray("videos");
+                                SdrObjListIter aIterator(pPage, 
SdrIterMode::DeepWithGroups);
+                                while (aIterator.IsMore())
+                                {
+                                    auto* pObject = aIterator.Next();
+                                    if (pObject->GetObjIdentifier() == 
SdrObjKind::Media)
+                                    {
+                                        auto 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