sc/source/ui/unoobj/docuno.cxx         |    6 ++++++
 sd/source/ui/unoidl/unomodel.cxx       |    6 ++++++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   10 ++++++++++
 3 files changed, 22 insertions(+)

New commits:
commit 5afdc179c52d4a71def825eaeb9deef53d57942d
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Nov 25 18:52:50 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Nov 29 10:39:52 2022 +0100

    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.st...@allotropia.de>
    (cherry picked from commit 0e4ff2261f3c2c9dada5816f11095652e028c3dd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143435
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 2f27948d0fe2..46933719e135 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2233,6 +2233,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 69807d47dab0..758ce1380099 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1866,6 +1866,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 07a0b2057d2a..6b0f90a0581f 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -891,6 +891,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)

Reply via email to