summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-01-03 12:06:56 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-01-03 13:25:52 +0000
commit81aef113056270ce65f9dee5fe31b6f60617973c (patch)
treecec4fc7b7cb67ab6a5db6980d53d09c017e39243 /sw
parent91a176b864ac0492f5c0d2386292118dd3095df4 (diff)
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@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx31
1 files changed, 29 insertions, 2 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 8cdb593e4e0a..b9d218195d6f 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();
}