sc/source/ui/unoobj/docuno.cxx | 54 +++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 26 deletions(-)
New commits: commit e3338ed3861be1e48e100a2c60bfe8b1c1414684 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Mar 17 21:23:11 2024 +0000 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Mar 20 16:16:01 2024 +0100 cid#1594402 Unchecked dynamic_cast Change-Id: I01218f7c457b23539ca911ab1bf4a910198285b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164954 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164977 Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165028 diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 216cd6328be4..fc322911d7c8 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2087,32 +2087,34 @@ static void lcl_SetMediaScreen(const uno::Reference<drawing::XShape>& xMediaShap OUString sMediaURL; uno::Reference<beans::XPropertySet> xPropSet(xMediaShape, uno::UNO_QUERY); xPropSet->getPropertyValue("MediaURL") >>= sMediaURL; - if (!sMediaURL.isEmpty()) - { - OUString sTitle; - xPropSet->getPropertyValue("Title") >>= sTitle; - OUString sDescription; - xPropSet->getPropertyValue("Description") >>= sDescription; - OUString const altText(sTitle.isEmpty() ? sDescription - : sDescription.isEmpty() - ? sTitle - : OUString::Concat(sTitle) + OUString::Concat(" ") - + OUString::Concat(sDescription)); - - OUString const mimeType(xPropSet->getPropertyValue("MediaMimeType").get<OUString>()); - SdrObject* pSdrObj(SdrObject::getSdrObjectFromXShape(xMediaShape)); - vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); - sal_Int32 nScreenId = pPDF->CreateScreen(aRect, altText, mimeType, nPageNumb, pSdrObj); - if (sMediaURL.startsWith("vnd.sun.star.Package:")) - { - // Embedded media - OUString aTempFileURL; - xPropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL; - pPDF->SetScreenStream(nScreenId, aTempFileURL); - } - else // Linked media - pPDF->SetScreenURL(nScreenId, sMediaURL); - } + if (sMediaURL.isEmpty()) + return; + vcl::PDFExtOutDevData* pPDF = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); + if (!pPDF) + return; + + OUString sTitle; + xPropSet->getPropertyValue("Title") >>= sTitle; + OUString sDescription; + xPropSet->getPropertyValue("Description") >>= sDescription; + OUString const altText(sTitle.isEmpty() ? sDescription + : sDescription.isEmpty() + ? sTitle + : OUString::Concat(sTitle) + OUString::Concat(" ") + + OUString::Concat(sDescription)); + + OUString const mimeType(xPropSet->getPropertyValue("MediaMimeType").get<OUString>()); + SdrObject* pSdrObj(SdrObject::getSdrObjectFromXShape(xMediaShape)); + sal_Int32 nScreenId = pPDF->CreateScreen(aRect, altText, mimeType, nPageNumb, pSdrObj); + if (sMediaURL.startsWith("vnd.sun.star.Package:")) + { + // Embedded media + OUString aTempFileURL; + xPropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL; + pPDF->SetScreenStream(nScreenId, aTempFileURL); + } + else // Linked media + pPDF->SetScreenURL(nScreenId, sMediaURL); } static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const ScPrintState& rState,