[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Jan 3 13:26:13 UTC 2017


 sw/source/core/text/EnhancedPDFExportHelper.cxx |   31 ++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 81aef113056270ce65f9dee5fe31b6f60617973c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jan 3 12:06:56 2017 +0100

    Related: tdf#104841 sw PDF export: handle linked videos
    
    This is the sw-specific part only, the real work is done by the common
    CreateScreen() / SetScreenURL() API added for sd earlier.
    
    Change-Id: Ief9fd80082960ddd1f92f413eac79577621551ce
    Reviewed-on: https://gerrit.libreoffice.org/32687
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 8cdb593..b9d2181 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -75,6 +75,7 @@
 #include <stack>
 
 #include <tools/globname.hxx>
+#include <svx/svdobj.hxx>
 
 using namespace ::com::sun::star;
 
@@ -1735,11 +1736,11 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
 
         // HYPERLINKS (Graphics, Frames, OLEs )
 
-        const SwFrameFormats* pTable = pDoc->GetSpzFrameFormats();
+        SwFrameFormats* pTable = pDoc->GetSpzFrameFormats();
         const size_t nSpzFrameFormatsCount = pTable->size();
         for( size_t n = 0; n < nSpzFrameFormatsCount; ++n )
         {
-            const SwFrameFormat* pFrameFormat = (*pTable)[n];
+            SwFrameFormat* pFrameFormat = (*pTable)[n];
             const SfxPoolItem* pItem;
             if ( RES_DRAWFRMFMT != pFrameFormat->Which() &&
                  SfxItemState::SET == pFrameFormat->GetAttrSet().GetItemState( RES_URL, true, &pItem ) )
@@ -1810,6 +1811,32 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
                     }
                 }
             }
+            else if (pFrameFormat->Which() == RES_DRAWFRMFMT)
+            {
+                // Handle linked videos.
+                if (SdrObject* pObject = pFrameFormat->FindRealSdrObject())
+                {
+                    SwRect aSnapRect = pObject->GetSnapRect();
+                    std::vector<sal_Int32> aScreenPageNums = CalcOutputPageNums(aSnapRect);
+                    if (aScreenPageNums.empty())
+                        continue;
+
+                    uno::Reference<drawing::XShape> xShape(pObject->getUnoShape(), uno::UNO_QUERY);
+                    if (xShape->getShapeType() == "com.sun.star.drawing.MediaShape")
+                    {
+                        uno::Reference<beans::XPropertySet> xShapePropSet(xShape, uno::UNO_QUERY);
+                        OUString aMediaURL;
+                        xShapePropSet->getPropertyValue("MediaURL") >>= aMediaURL;
+                        if (!aMediaURL.isEmpty())
+                        {
+                            const SwPageFrame* pCurrPage = mrSh.GetLayout()->GetPageAtPos(aSnapRect.Center());
+                            Rectangle aPDFRect(SwRectToPDFRect(pCurrPage, aSnapRect.SVRect()));
+                            sal_Int32 nScreenId = pPDFExtOutDevData->CreateScreen(aPDFRect);
+                            pPDFExtOutDevData->SetScreenURL(nScreenId, aMediaURL);
+                        }
+                    }
+                }
+            }
             mrSh.SwCursorShell::ClearMark();
         }
 


More information about the Libreoffice-commits mailing list