sc/source/ui/view/output2.cxx     |    8 ++++----
 vcl/inc/pdf/pdfwriter_impl.hxx    |    8 ++++++++
 vcl/source/gdi/pdfwriter_impl.cxx |   11 ++++-------
 3 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit cc94f402853bbdce40165a00fe317910d6270562
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed May 29 16:59:04 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu May 30 09:48:46 2024 +0200

    'tagged' pdf export of spreadsheets doesn't perform well
    
    m_aStructure is appended to for every row and cell, so a spreadsheet
    with 20 cols and 100,000 rows is many seconds slower to export in 24.8
    than 24.4
    
    since:
    
    commit b3c93b16d62e809500005edc749af4b8ad10162c
    Date:   Wed Jan 3 11:18:19 2024 +0100
    
        tdf#123870 sc: fix tagged content for accessible PDF export
    
        Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161581
    
    shave a sliver of work off.
    
    Change-Id: Ibeb817083fef3c9499326abe381527a31917303b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168226
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 1e9bb41a2716..8ddb8722f6ea 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1486,7 +1486,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
         if (!bReopenTag)
         {
             sal_Int32 nId = pPDF->EnsureStructureElement(nullptr);
-            pPDF->InitStructureElement(nId, vcl::PDFWriter::Table, "Table");
+            pPDF->InitStructureElement(nId, vcl::PDFWriter::Table, 
u"Table"_ustr);
             pPDF->BeginStructureElement(nId);
             pPDF->GetScPDFState()->m_TableId = nId;
         }
@@ -1565,7 +1565,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
                 if (!bReopenTag)
                 {
                     sal_Int32 nId = pPDF->EnsureStructureElement(nullptr);
-                    pPDF->InitStructureElement(nId, vcl::PDFWriter::TableRow, 
"TR");
+                    pPDF->InitStructureElement(nId, vcl::PDFWriter::TableRow, 
u"TR"_ustr);
                     pPDF->BeginStructureElement(nId);
                     pPDF->GetScPDFState()->m_TableRowMap.emplace(nY, nId);
                 }
@@ -1577,7 +1577,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
             for (SCCOL nX=nLoopStartX; nX<=nX2; nX++)
             {
                 if (bTaggedPDF)
-                    pPDF->WrapBeginStructureElement(vcl::PDFWriter::TableData, 
"TD");
+                    pPDF->WrapBeginStructureElement(vcl::PDFWriter::TableData, 
u"TD"_ustr);
 
                 bool bMergeEmpty = false;
                 const ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nX);
@@ -2123,7 +2123,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
                         if (!aString.isEmpty())
                         {
                             if (bTaggedPDF)
-                                
pPDF->WrapBeginStructureElement(vcl::PDFWriter::Paragraph, "P");
+                                
pPDF->WrapBeginStructureElement(vcl::PDFWriter::Paragraph, u"P"_ustr);
 
                             // If the string is clipped, make it shorter for
                             // better performance since drawing by HarfBuzz is
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index b0388ecd27a1..2afab075dbe6 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -603,6 +603,14 @@ struct PDFStructureElement
     {
     }
 
+    PDFStructureElement(sal_Int32 nOwnElement, sal_Int32 nParentElement, 
sal_Int32 nFirstPageObject)
+        : m_nObject(0)
+        , m_nOwnElement(nOwnElement)
+        , m_nParentElement(nParentElement)
+        , m_nFirstPageObject(nFirstPageObject)
+        , m_bOpenMCSeq(false )
+    {
+    }
 };
 
 // helper structure for drawLayout and friends
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 17e7c2744a23..ba786d7bb34b 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10813,13 +10813,10 @@ sal_Int32 PDFWriterImpl::ensureStructureElement()
         return -1;
 
     sal_Int32 nNewId = sal_Int32(m_aStructure.size());
-    m_aStructure.emplace_back();
-    PDFStructureElement& rEle = m_aStructure.back();
-    // leave rEle.m_oType uninitialised
-    rEle.m_nOwnElement      = nNewId;
-    // temporary parent
-    rEle.m_nParentElement   = m_nCurrentStructElement;
-    rEle.m_nFirstPageObject = m_aPages[ m_nCurrentPage ].m_nPageObject;
+
+    // use m_nCurrentStructElement as temporary parent
+    m_aStructure.emplace_back(nNewId, m_nCurrentStructElement, 
m_aPages[m_nCurrentPage].m_nPageObject);
+
     m_aStructure[ m_nCurrentStructElement ].m_aChildren.push_back( nNewId );
     return nNewId;
 }

Reply via email to