diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-11-25 18:52:50 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-11-28 21:07:13 +0100 |
commit | 0e4ff2261f3c2c9dada5816f11095652e028c3dd (patch) | |
tree | 517042ca6f076fadaefb20e3129a2e35c5014ecb | |
parent | ff41bc546edb4f28ac0852fc8a95fe5dbde40a10 (diff) |
tdf#67866 sc,sd: PDF/UA export: set language in Catalog
sw already does this, and it's recommended in
https://www.w3.org/WAI/GL/WCAG20-TECHS/PDF16.html
Change-Id: I0ce36442ec1b223c40f53fac3683ad7bb0e2bc6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143307
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 6 | ||||
-rw-r--r-- | vcl/qa/cppunit/pdfexport/pdfexport.cxx | 10 |
3 files changed, 22 insertions, 0 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index d6d8f1ae0583..cf3ad3e3f755 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2225,6 +2225,12 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >(pDev->GetExtOutDevData() ); if ( nRenderer == nTabStart ) { + if (pPDFData) + { + css::lang::Locale const docLocale(LanguageTag(ScGlobal::GetEditDefaultLanguage()).getLocale()); + pPDFData->SetDocumentLocale(docLocale); + } + // first page of a sheet: add outline item for the sheet name if ( pPDFData && pPDFData->GetIsExportBookmarks() ) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 0106f00a98a6..a6a4afa98d25 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1867,6 +1867,12 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r !(pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportHiddenSlides()) ) return; + if (pPDFExtOutDevData) + { + css::lang::Locale const docLocale(Application::GetSettings().GetLanguageTag().getLocale()); + pPDFExtOutDevData->SetDocumentLocale(docLocale); + } + ::sd::ClientView aView( mpDocShell, pOut ); ::tools::Rectangle aVisArea( Point(), mpDoc->GetSdPage( static_cast<sal_uInt16>(nPageNumber) - 1, ePageKind )->GetSize() ); vcl::Region aRegion( aVisArea ); diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 962995a0d6e1..1e7a6788acf4 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -839,6 +839,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testAlternativeText) } } } + + // tdf#67866 check that Catalog contains Lang + auto* pCatalog = aDocument.GetCatalog(); + CPPUNIT_ASSERT(pCatalog); + auto* pCatalogDictionary = pCatalog->GetDictionary(); + CPPUNIT_ASSERT(pCatalogDictionary); + auto pLang = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( + pCatalogDictionary->LookupElement("Lang")); + CPPUNIT_ASSERT(pLang); + CPPUNIT_ASSERT_EQUAL(OString("en-US"), pLang->GetValue()); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) |