diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-04-05 12:24:43 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-04-05 15:39:37 +0200 |
commit | 5cc69594e4382c258f0e3e3b1ef210567fce1bd8 (patch) | |
tree | dadd5f3282f36fd6d62fb679eb5eea97f6f6ab1d /vcl/source/gdi | |
parent | a5225ba82e94a549f44420f56a7cb9d7906561cc (diff) |
vcl,sw,sd: PDF/UA export: produce better /CT for SdrMediaObj
7.18.6.2 Media clip data
In the media clip data dictionary, the optional CT and Alt keys
(ISO 32000-1:2008, 13.2.4.2, Table 274) are required.
Presumably writing a potentially wrong hard-coded mime type here isn't
intended.
Change-Id: Ifa8ee199a4cf9ce83f410860d59b6c30475f80e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150050
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/pdfextoutdevdata.cxx | 12 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 8 |
3 files changed, 15 insertions, 9 deletions
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 21f340fc2107..ff99fdbbcd90 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -200,12 +200,15 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) rWriter.Push(PushFlags::MAPMODE); rWriter.SetMapMode(mParaMapModes.front()); mParaMapModes.pop_front(); - mParaIds.push_back(rWriter.CreateScreen(mParaRects.front(), mParaInts.front(), mParaOUStrings.front())); + OUString const altText(mParaOUStrings.front()); + mParaOUStrings.pop_front(); + OUString const mimeType(mParaOUStrings.front()); + mParaOUStrings.pop_front(); + mParaIds.push_back(rWriter.CreateScreen(mParaRects.front(), mParaInts.front(), altText, mimeType)); // resolve AnnotIds structural attribute rWriter.SetLinkPropertyID(mParaIds.back(), sal_Int32(mParaIds.size()-1)); mParaRects.pop_front(); mParaInts.pop_front(); - mParaOUStrings.pop_front(); rWriter.Pop(); } break; @@ -704,13 +707,16 @@ sal_Int32 PDFExtOutDevData::CreateLink(const tools::Rectangle& rRect, OUString c return mpGlobalSyncData->mCurId++; } -sal_Int32 PDFExtOutDevData::CreateScreen(const tools::Rectangle& rRect, OUString const& rAltText, sal_Int32 nPageNr, SdrObject const*const pObj) +sal_Int32 PDFExtOutDevData::CreateScreen(const tools::Rectangle& rRect, + OUString const& rAltText, OUString const& rMimeType, + sal_Int32 nPageNr, SdrObject const*const pObj) { mpGlobalSyncData->mActions.push_back(PDFExtOutDevDataSync::CreateScreen); mpGlobalSyncData->mParaRects.push_back(rRect); mpGlobalSyncData->mParaMapModes.push_back(mrOutDev.GetMapMode()); mpGlobalSyncData->mParaInts.push_back(nPageNr); mpGlobalSyncData->mParaOUStrings.push_back(rAltText); + mpGlobalSyncData->mParaOUStrings.push_back(rMimeType); auto const ret(mpGlobalSyncData->mCurId++); m_ScreenAnnotations[pObj].push_back(ret); return ret; diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index f0314ce0fe82..dda44d2f4adb 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -335,9 +335,9 @@ sal_Int32 PDFWriter::CreateLink(const tools::Rectangle& rRect, sal_Int32 nPageNr return xImplementation->createLink(rRect, nPageNr, rAltText); } -sal_Int32 PDFWriter::CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText) +sal_Int32 PDFWriter::CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText, OUString const& rMimeType) { - return xImplementation->createScreen(rRect, nPageNr, rAltText); + return xImplementation->createScreen(rRect, nPageNr, rAltText, rMimeType); } sal_Int32 PDFWriter::RegisterDestReference( sal_Int32 nDestId, const tools::Rectangle& rRect, sal_Int32 nPageNr, DestAreaType eType ) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6415ac76e90e..83d5e6ea9a83 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -3616,8 +3616,8 @@ bool PDFWriterImpl::emitScreenAnnotations() // Allow playing the video via a tempfile. aLine.append("/P <</TF (TEMPACCESS)>>"); // ISO 14289-1:2014, Clause: 7.18.6.2 - // Until the real MIME type (instead of application/vnd.sun.star.media) is available here. - aLine.append("/CT (video/mp4)"); + aLine.append("/CT "); + appendLiteralStringEncrypt(rScreen.m_MimeType, rScreen.m_nObject, aLine); // ISO 14289-1:2014, Clause: 7.18.6.2 // Alt text is a "Multi-language Text Array" aLine.append(" /Alt [ () "); @@ -10383,7 +10383,7 @@ sal_Int32 PDFWriterImpl::createLink(const tools::Rectangle& rRect, sal_Int32 nPa return nRet; } -sal_Int32 PDFWriterImpl::createScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText) +sal_Int32 PDFWriterImpl::createScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, OUString const& rAltText, OUString const& rMimeType) { if (nPageNr < 0) nPageNr = m_nCurrentPage; @@ -10393,7 +10393,7 @@ sal_Int32 PDFWriterImpl::createScreen(const tools::Rectangle& rRect, sal_Int32 n sal_Int32 nRet = m_aScreens.size(); - m_aScreens.emplace_back(rAltText); + m_aScreens.emplace_back(rAltText, rMimeType); m_aScreens.back().m_nObject = createObject(); m_aScreens.back().m_nPage = nPageNr; m_aScreens.back().m_aRect = rRect; |