chart2/source/model/template/ChartTypeTemplate.cxx   |    3 
 configure.ac                                         |    4 
 download.lst                                         |   12 
 editeng/source/editeng/impedit3.cxx                  |    4 
 filter/source/config/cache/typedetection.cxx         |    8 
 framework/source/services/autorecovery.cxx           |   40 +
 linguistic/source/spelldsp.cxx                       |   32 +
 linguistic/source/spelldsp.hxx                       |    2 
 sc/inc/column.hxx                                    |    1 
 sc/qa/uitest/autofilter2/tdf161457.py                |   42 +
 sc/qa/uitest/data/autofilter/tdf161457.ods           |binary
 sc/source/core/data/column3.cxx                      |   13 
 sc/source/core/data/table1.cxx                       |    2 
 sc/source/core/data/table4.cxx                       |    2 
 sc/source/core/tool/typedstrdata.cxx                 |    8 
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |   60 ++
 sc/source/ui/condformat/condformatdlgentry.cxx       |   66 +-
 sc/source/ui/drawfunc/drawsh2.cxx                    |   23 
 sc/source/ui/inc/AccessibleSpreadsheet.hxx           |    2 
 sc/source/ui/unoobj/docuno.cxx                       |   20 
 sc/source/ui/unoobj/textuno.cxx                      |   10 
 sc/source/ui/vba/vbaapplication.cxx                  |   10 
 sc/source/ui/vba/vbawindow.cxx                       |   46 +
 sc/source/ui/vba/vbaworksheet.cxx                    |   13 
 sd/source/ui/animations/CustomAnimationPane.cxx      |    9 
 sd/source/ui/annotations/annotationmanager.cxx       |    3 
 sd/source/ui/func/fubullet.cxx                       |    7 
 sd/source/ui/tools/EventMultiplexer.cxx              |    5 
 sd/source/ui/view/outlview.cxx                       |    4 
 sfx2/source/doc/objmisc.cxx                          |    8 
 sfx2/source/doc/objserv.cxx                          |   67 +-
 sfx2/source/view/viewprn.cxx                         |   15 
 sfx2/source/view/viewsh.cxx                          |    5 
 solenv/flatpak-manifest.in                           |    4 
 starmath/source/ooxmlimport.cxx                      |    4 
 svtools/source/control/scrolladaptor.cxx             |    2 
 sw/inc/fesh.hxx                                      |    2 
 sw/qa/extras/layout/data/tdf158658a.rtf              |   25 +
 sw/qa/extras/layout/data/tdf158658b.rtf              |   27 +
 sw/qa/extras/layout/data/tdf158658c.rtf              |   26 +
 sw/qa/extras/layout/data/tdf161508.fodt              |   54 ++
 sw/qa/extras/layout/layout2.cxx                      |    6 
 sw/qa/extras/layout/layout3.cxx                      |   84 +++
 sw/qa/extras/odfexport/data/tdf160877.odt            |binary
 sw/qa/extras/odfexport/odfexport2.cxx                |   14 
 sw/qa/extras/ooxmlexport/data/tdf158023_export.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx            |    9 
 sw/qa/extras/ooxmlimport/data/tdf158023_import.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx            |   20 
 sw/qa/extras/rtfexport/data/tdf158023.rtf            |    8 
 sw/qa/extras/rtfexport/rtfexport.cxx                 |   10 
 sw/qa/extras/uiwriter/data/tdf157533.fodt            |  438 +++++++++++++++++++
 sw/qa/extras/uiwriter/data/tdf161426.fodt            |  197 ++++++++
 sw/qa/extras/uiwriter/uiwriter6.cxx                  |  401 +++++++++++++++++
 sw/source/core/crsr/crstrvl.cxx                      |    5 
 sw/source/core/doc/docdesc.cxx                       |   20 
 sw/source/core/edit/edfcol.cxx                       |   52 +-
 sw/source/core/fields/reffld.cxx                     |   26 -
 sw/source/core/frmedt/feshview.cxx                   |   72 ++-
 sw/source/core/layout/flycnt.cxx                     |   20 
 sw/source/core/layout/flylay.cxx                     |   38 +
 sw/source/core/layout/paintfrm.cxx                   |    4 
 sw/source/core/layout/tabfrm.cxx                     |   28 +
 sw/source/core/text/frminf.cxx                       |    7 
 sw/source/core/text/inftxt.cxx                       |    6 
 sw/source/core/text/itratr.cxx                       |    9 
 sw/source/core/text/portab.hxx                       |    2 
 sw/source/core/text/txttab.cxx                       |   12 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx  |   15 
 sw/source/uibase/docvw/edtwin.cxx                    |   11 
 sw/source/uibase/shells/frmsh.cxx                    |    4 
 sw/source/uibase/shells/textsh1.cxx                  |    7 
 vcl/quartz/salgdi.cxx                                |   33 +
 vcl/skia/gdiimpl.cxx                                 |    7 
 vcl/source/filter/itiff/itiff.cxx                    |    3 
 vcl/unx/generic/printer/cupsmgr.cxx                  |    5 
 winaccessibility/source/UAccCOM/AccTextBase.cxx      |   22 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx    |   30 -
 writerfilter/source/dmapper/DomainMapper_Impl.hxx    |    4 
 xmloff/source/core/xmlimp.cxx                        |   35 +
 80 files changed, 2058 insertions(+), 296 deletions(-)

New commits:
commit 8d4baa85c202d64160ba5c5f31604e412f016d2a
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Jun 16 21:27:34 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:52:55 2024 +0200

    fix crash in "delete comments by author" in impress
    
    insert comment, click on it to expand it, click on menubutton and
    use "delete all comments by..."
    
    crash on use of invalid iterator as callback trashes the vector
    being iterated over
    
    Change-Id: Ia86de87207f706f35a023efa433c5e67b8bb436a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168971
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins

diff --git a/sd/source/ui/annotations/annotationmanager.cxx 
b/sd/source/ui/annotations/annotationmanager.cxx
index d05ce18d5844..11d59f7aa530 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -691,7 +691,8 @@ void AnnotationManagerImpl::DeleteAnnotationsByAuthor( 
std::u16string_view sAuth
 
         if( pPage )
         {
-            for (auto const& xAnnotation : pPage->getAnnotations())
+            sdr::annotation::AnnotationVector aAnnotations( 
pPage->getAnnotations() ); // intentionally copy
+            for (auto const& xAnnotation : aAnnotations)
             {
                 if( xAnnotation->getAuthor() == sAuthor )
                 {
commit 41755c200423f5ce6264a12812f80225baaad029
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Jun 6 09:54:23 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:23 2024 +0200

    crashreporting: crash in CustomAnimationPane::UpdateAnimationLB
    
    speculative fix
    
    sd/source/ui/animations/CustomAnimationPane.cxx:2189
    vcl/source/control/ctrl.cxx:298
    sd/source/ui/animations/CustomAnimationPane.cxx:2189
    vcl/source/control/listbox.cxx:907
    vcl/source/window/paint.cxx:781
    vcl/source/control/ctrl.cxx:485
    vcl/source/control/listbox.cxx:906
    vcl/source/control/listbox.cxx:189
    vcl/source/control/imp_listbox.cxx:722
    vcl/source/control/imp_listbox.cxx:686
    vcl/source/control/imp_listbox.cxx:1133
    
    Change-Id: I707fcbcd8a86ef7cf736b5244d9e4a78fd7b4ef0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168446
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx 
b/sd/source/ui/animations/CustomAnimationPane.cxx
index 7eb623138713..9f07b9744a2a 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -2189,8 +2189,13 @@ IMPL_LINK_NOARG(CustomAnimationPane, SelectionHandler, 
Timer*, void)
 IMPL_LINK_NOARG(CustomAnimationPane, UpdateAnimationLB, weld::ComboBox&, void)
 {
     //FIXME: first effect only? what if there is more?
-    CustomAnimationEffectPtr pEffect = maListSelection.front();
-    fillAnimationLB( pEffect->hasText() );
+    bool bHasText = false;
+    if (!maListSelection.empty())
+    {
+        CustomAnimationEffectPtr pEffect = maListSelection.front();
+        bHasText = pEffect && pEffect->hasText();
+    }
+    fillAnimationLB(bHasText);
 }
 
 IMPL_LINK_NOARG(CustomAnimationPane, DurationModifiedHdl, 
weld::MetricSpinButton&, void)
commit 35feccda4a66eca545f26b2d210866398d6ebb56
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Tue May 21 10:59:29 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:23 2024 +0200

    tdf#161190: fix crash when exporting spreadsheet as PDF...
    
    with "whole sheet export" option'
    
    See bt here:
    https://bug-attachments.documentfoundation.org/attachment.cgi?id=194240
    
    Change-Id: I453882be5c8bb761a722482f9c94a2b2bb5c7dd4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167890
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167897
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index fbc5cad3bea4..7d962641178a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2178,7 +2178,7 @@ static void lcl_SetMediaScreen(const 
uno::Reference<drawing::XShape>& xMediaShap
         pPDF->SetScreenURL(nScreenId, sMediaURL);
 }
 
-static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const 
ScPrintState& rState,
+static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const 
std::unique_ptr<ScPrintState>& rState,
                                           ScDocument& rDoc, SCTAB nTab, 
tools::Long nStartPage,
                                           bool bSinglePageSheets)
 {
@@ -2228,12 +2228,12 @@ static void lcl_PDFExportMediaShapeScreen(const 
OutputDevice* pDev, const ScPrin
                         if (bTopDown) // top-bottom page order
                         {
                             nX1 = 0;
-                            for (size_t i = 0; i < rState.nPagesX; ++i)
+                            for (size_t i = 0; i < rState->nPagesX; ++i)
                             {
-                                nX2 = (*rState.xPageEndX)[i];
-                                for (size_t j = 0; j < rState.nPagesY; ++j)
+                                nX2 = (*rState->xPageEndX)[i];
+                                for (size_t j = 0; j < rState->nPagesY; ++j)
                                 {
-                                    auto& rPageRow = (*rState.xPageRows)[j];
+                                    auto& rPageRow = (*rState->xPageRows)[j];
                                     nY1 = rPageRow.GetStartRow();
                                     nY2 = rPageRow.GetEndRow();
 
@@ -2253,15 +2253,15 @@ static void lcl_PDFExportMediaShapeScreen(const 
OutputDevice* pDev, const ScPrin
                         }
                         else // left to right page order
                         {
-                            for (size_t i = 0; i < rState.nPagesY; ++i)
+                            for (size_t i = 0; i < rState->nPagesY; ++i)
                             {
-                                auto& rPageRow = (*rState.xPageRows)[i];
+                                auto& rPageRow = (*rState->xPageRows)[i];
                                 nY1 = rPageRow.GetStartRow();
                                 nY2 = rPageRow.GetEndRow();
                                 nX1 = 0;
-                                for (size_t j = 0; j < rState.nPagesX; ++j)
+                                for (size_t j = 0; j < rState->nPagesX; ++j)
                                 {
-                                    nX2 = (*rState.xPageEndX)[j];
+                                    nX2 = (*rState->xPageEndX)[j];
 
                                     tools::Rectangle 
aPageRect(rDoc.GetMMRect(nX1, nY1, nX2, nY2, nTab));
                                     tools::Rectangle 
aTmpRect(aPageRect.GetIntersection(pObj->GetCurrentBoundRect()));
@@ -2375,7 +2375,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, 
const uno::Any& aSelec
     tools::Long nTabStart = pPrintFuncCache->GetTabStart(nTab);
 
     if (nRenderer == nTabStart)
-        lcl_PDFExportMediaShapeScreen(pDev, *m_pPrintState, rDoc, nTab, 
nTabStart, bSinglePageSheets);
+        lcl_PDFExportMediaShapeScreen(pDev, m_pPrintState, rDoc, nTab, 
nTabStart, bSinglePageSheets);
 
     ScRange aRange;
     const ScRange* pSelRange = nullptr;
commit 3147a82bfea47baad686f30f24abf67a03a751c8
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri May 31 12:40:45 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:22 2024 +0200

    sfx2: use SAL_RET_MAYBENULL in GetDispatcher() and GetFrame()
    
    Change-Id: Ic9876dbdd0dc0ce887a6eb135bd411f8e3dc9e12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168288
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168394
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx 
b/sc/source/ui/condformat/condformatdlgentry.cxx
index 171c9ecd135b..99187b9e0693 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -442,42 +442,44 @@ void StyleSelect(weld::Window* pDialogParent, 
weld::ComboBox& rLbStyle, const Sc
         // (SetDispatcherLock would affect all Calc documents)
         if (ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell())
         {
-            SfxDispatcher* pDisp = pViewShell->GetDispatcher();
-            bool bLocked = pDisp->IsLocked();
-            if (bLocked)
-                pDisp->Lock(false);
-
-            // Execute the "new style" slot, complete with undo and all 
necessary updates.
-            // The return value (SfxUInt16Item) is ignored, look for new 
styles instead.
-            pDisp->ExecuteList(SID_STYLE_NEW,
-                SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
-                { &aFamilyItem, &aRefItem }, { &aDialogParent });
-
-            if (bLocked)
-                pDisp->Lock(true);
-
-            // Find the new style and add it into the style list boxes
-            SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), 
SfxStyleFamily::Para );
-            bool bFound = false;
-            for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle && 
!bFound; pStyle = aStyleIter.Next() )
+            if (SfxDispatcher* pDisp = pViewShell->GetDispatcher())
             {
-                const OUString& aName = pStyle->GetName();
-                if (rLbStyle.find_text(aName) == -1)    // all lists contain 
the same entries
+                bool bLocked = pDisp->IsLocked();
+                if (bLocked)
+                    pDisp->Lock(false);
+
+                // Execute the "new style" slot, complete with undo and all 
necessary updates.
+                // The return value (SfxUInt16Item) is ignored, look for new 
styles instead.
+                pDisp->ExecuteList(SID_STYLE_NEW,
+                    SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
+                    { &aFamilyItem, &aRefItem }, { &aDialogParent });
+
+                if (bLocked)
+                    pDisp->Lock(true);
+
+                // Find the new style and add it into the style list boxes
+                SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), 
SfxStyleFamily::Para );
+                bool bFound = false;
+                for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle 
&& !bFound; pStyle = aStyleIter.Next() )
                 {
-                    for( sal_Int32 i = 1, n = rLbStyle.get_count(); i <= n && 
!bFound; ++i)
+                    const OUString& aName = pStyle->GetName();
+                    if (rLbStyle.find_text(aName) == -1)    // all lists 
contain the same entries
                     {
-                        OUString aStyleName = 
ScGlobal::getCharClass().uppercase(rLbStyle.get_text(i));
-                        if( i == n )
+                        for( sal_Int32 i = 1, n = rLbStyle.get_count(); i <= n 
&& !bFound; ++i)
                         {
-                            rLbStyle.append_text(aName);
-                            rLbStyle.set_active_text(aName);
-                            bFound = true;
-                        }
-                        else if( aStyleName > 
ScGlobal::getCharClass().uppercase(aName) )
-                        {
-                            rLbStyle.insert_text(i, aName);
-                            rLbStyle.set_active_text(aName);
-                            bFound = true;
+                            OUString aStyleName = 
ScGlobal::getCharClass().uppercase(rLbStyle.get_text(i));
+                            if( i == n )
+                            {
+                                rLbStyle.append_text(aName);
+                                rLbStyle.set_active_text(aName);
+                                bFound = true;
+                            }
+                            else if( aStyleName > 
ScGlobal::getCharClass().uppercase(aName) )
+                            {
+                                rLbStyle.insert_text(i, aName);
+                                rLbStyle.set_active_text(aName);
+                                bFound = true;
+                            }
                         }
                     }
                 }
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx 
b/sc/source/ui/drawfunc/drawsh2.cxx
index 8556c18e6b94..33846cf0e1d3 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -61,12 +61,14 @@ using namespace com::sun::star;
 
 ScDrawShell::ScDrawShell( ScViewData& rData ) :
     SfxShell(rData.GetViewShell()),
-    rViewData( rData ),
-    mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
-            [this] () { return this->GetSidebarContextName(); },
-            GetFrame()->GetFrame().GetController(),
-            vcl::EnumContext::Context::Cell))
+    rViewData( rData )
 {
+    SfxViewFrame* pFrame = GetFrame();
+    assert(pFrame);
+    mpSelectionChangeHandler = new svx::sidebar::SelectionChangeHandler(
+            [this] () { return this->GetSidebarContextName(); },
+            pFrame->GetFrame().GetController(),
+            vcl::EnumContext::Context::Cell);
     SetPool( &rViewData.GetScDrawView()->GetModel().GetItemPool() );
     SfxUndoManager* pMgr = rViewData.GetSfxDocShell()->GetUndoManager();
     SetUndoManager( pMgr );
@@ -548,10 +550,13 @@ void ScDrawShell::GetDrawAttrStateForIFBX( SfxItemSet& 
rSet )
 
 void ScDrawShell::Activate (const bool)
 {
-    ContextChangeEventMultiplexer::NotifyContextChange(
-        GetFrame()->GetFrame().GetController(),
-        vcl::EnumContext::GetContextEnum(
-            GetSidebarContextName()));
+    if (SfxViewFrame* pFrame = GetFrame())
+    {
+        ContextChangeEventMultiplexer::NotifyContextChange(
+            pFrame->GetFrame().GetController(),
+            vcl::EnumContext::GetContextEnum(
+                GetSidebarContextName()));
+    }
 }
 
 const OUString & ScDrawShell::GetSidebarContextName()
diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
index 688ac67a83e6..aeddeeae8fff 100644
--- a/sd/source/ui/func/fubullet.cxx
+++ b/sd/source/ui/func/fubullet.cxx
@@ -189,7 +189,12 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & 
rReq )
             aSet.Put( *pFontItem );
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-        auto xFrame = mpViewShell ? 
mpViewShell->GetFrame()->GetFrame().GetFrameInterface() : nullptr;
+        css::uno::Reference<css::frame::XFrame> xFrame;
+        if (mpViewShell)
+        {
+            if (SfxViewFrame* pFrame = mpViewShell->GetFrame())
+                xFrame = pFrame->GetFrame().GetFrameInterface();
+        }
         ScopedVclPtr<SfxAbstractDialog> pDlg( 
pFact->CreateCharMapDialog(mpView->GetViewShell()->GetFrameWeld(), aSet,
             xFrame) );
 
diff --git a/sd/source/ui/tools/EventMultiplexer.cxx 
b/sd/source/ui/tools/EventMultiplexer.cxx
index 59cf49569d92..deb02a1931e0 100644
--- a/sd/source/ui/tools/EventMultiplexer.cxx
+++ b/sd/source/ui/tools/EventMultiplexer.cxx
@@ -193,8 +193,9 @@ EventMultiplexer::Implementation::Implementation 
(ViewShellBase& rBase)
 {
     // Connect to the frame to listen for controllers being exchanged.
     // Listen to changes of certain properties.
-    Reference<frame::XFrame> xFrame =
-        mrBase.GetFrame()->GetFrame().GetFrameInterface();
+    Reference<frame::XFrame> xFrame;
+    if (SfxViewFrame* pFrame = mrBase.GetFrame())
+        xFrame = pFrame->GetFrame().GetFrameInterface();
     mxFrameWeak = xFrame;
     if (xFrame.is())
     {
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index d424f0117c27..d35aedb67fb2 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -113,7 +113,9 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, 
vcl::Window* pWindow, OutlineVie
     Link<tools::EventMultiplexerEvent&,void> aLink( 
LINK(this,OutlineView,EventMultiplexerListener) );
     
mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->AddEventListener(aLink);
 
-    Reference<XFrame> xFrame = 
mrOutlineViewShell.GetViewShellBase().GetFrame()->GetFrame().GetFrameInterface();
+    Reference<XFrame> xFrame;
+    if (SfxViewFrame* pFrame = 
mrOutlineViewShell.GetViewShellBase().GetFrame())
+        xFrame = pFrame->GetFrame().GetFrameInterface();
     maSlideImage = 
vcl::CommandInfoProvider::GetImageForCommand(".uno:ShowSlide", xFrame, 
vcl::ImageType::Size26);
 
     // Tell undo manager of the document about the undo manager of the
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 0437204670c6..ba5310761e0c 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -332,14 +332,17 @@ void SfxObjectShell::CheckOut( )
         xCmisDoc->checkOut( );
 
         // Remove the info bar
-        SfxViewFrame* pViewFrame = GetFrame();
-        pViewFrame->RemoveInfoBar( u"checkout" );
+        if (SfxViewFrame* pViewFrame = GetFrame())
+            pViewFrame->RemoveInfoBar( u"checkout" );
     }
     catch ( const uno::RuntimeException& e )
     {
-        std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(GetFrame()->GetFrameWeld(),
-                                                  VclMessageType::Warning, 
VclButtonsType::Ok, e.Message));
-        xBox->run();
+        if (SfxViewFrame* pFrame = GetFrame())
+        {
+            std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(pFrame->GetFrameWeld(),
+                                                      VclMessageType::Warning, 
VclButtonsType::Ok, e.Message));
+            xBox->run();
+        }
     }
 }
 
@@ -356,9 +359,12 @@ void SfxObjectShell::CancelCheckOut( )
     }
     catch ( const uno::RuntimeException& e )
     {
-        std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(GetFrame()->GetFrameWeld(),
-                                                  VclMessageType::Warning, 
VclButtonsType::Ok, e.Message));
-        xBox->run();
+        if (SfxViewFrame* pFrame = GetFrame())
+        {
+            std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(pFrame->GetFrameWeld(),
+                                                      VclMessageType::Warning, 
VclButtonsType::Ok, e.Message));
+            xBox->run();
+        }
     }
 }
 
@@ -368,20 +374,26 @@ void SfxObjectShell::CheckIn( )
     {
         uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), 
uno::UNO_QUERY_THROW );
         // Pop up dialog to ask for comment and major
-        SfxCheckinDialog checkinDlg(GetFrame()->GetFrameWeld());
-        if (checkinDlg.run() == RET_OK)
+        if (SfxViewFrame* pFrame = GetFrame())
         {
-            xCmisDoc->checkIn(checkinDlg.IsMajor(), checkinDlg.GetComment());
-            uno::Reference< util::XModifiable > xModifiable( GetModel( ), 
uno::UNO_QUERY );
-            if ( xModifiable.is( ) )
-                xModifiable->setModified( false );
+            SfxCheckinDialog checkinDlg(pFrame->GetFrameWeld());
+            if (checkinDlg.run() == RET_OK)
+            {
+                xCmisDoc->checkIn(checkinDlg.IsMajor(), 
checkinDlg.GetComment());
+                uno::Reference< util::XModifiable > xModifiable( GetModel( ), 
uno::UNO_QUERY );
+                if ( xModifiable.is( ) )
+                    xModifiable->setModified( false );
+            }
         }
     }
     catch ( const uno::RuntimeException& e )
     {
-        std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(GetFrame()->GetFrameWeld(),
-                                                  VclMessageType::Warning, 
VclButtonsType::Ok, e.Message));
-        xBox->run();
+        if (SfxViewFrame* pFrame = GetFrame())
+        {
+            std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(pFrame->GetFrameWeld(),
+                                                      VclMessageType::Warning, 
VclButtonsType::Ok, e.Message));
+            xBox->run();
+        }
     }
 }
 
@@ -394,9 +406,12 @@ uno::Sequence< document::CmisVersion > 
SfxObjectShell::GetCmisVersions( ) const
     }
     catch ( const uno::RuntimeException& e )
     {
-        std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(GetFrame()->GetFrameWeld(),
-                                                  VclMessageType::Warning, 
VclButtonsType::Ok, e.Message));
-        xBox->run();
+        if (SfxViewFrame* pFrame = GetFrame())
+        {
+            std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(pFrame->GetFrameWeld(),
+                                                      VclMessageType::Warning, 
VclButtonsType::Ok, e.Message));
+            xBox->run();
+        }
     }
     return uno::Sequence< document::CmisVersion > ( );
 }
@@ -553,8 +568,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                 // Reload to show how the PDF actually looks like after 
signing. This also
                 // changes "finish signing" on the infobar back to "sign 
document" as a side
                 // effect.
-                SfxViewFrame* pFrame = GetFrame();
-                if (pFrame)
+                if (SfxViewFrame* pFrame = GetFrame())
                 {
                     // Store current page before reload.
                     SfxAllItemSet aSet(SfxGetpApp()->GetPool());
@@ -1245,8 +1259,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                 const SfxBoolItem* saveTo = 
rReq.GetArg<SfxBoolItem>(SID_SAVETO);
                 if (saveTo == nullptr || !saveTo->GetValue())
                 {
-                    SfxViewFrame *pFrame = GetFrame();
-                    if (pFrame)
+                    if (SfxViewFrame* pFrame = GetFrame())
                         pFrame->RemoveInfoBar(u"readonly");
                     SetReadOnlyUI(false);
                 }
@@ -1357,8 +1370,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                 CancelCheckOut( );
 
                 // Reload the document as we may still have local changes
-                SfxViewFrame *pFrame = GetFrame();
-                if ( pFrame )
+                if (SfxViewFrame* pFrame = GetFrame())
                     pFrame->GetDispatcher()->Execute(SID_RELOAD);
             }
             break;
@@ -2227,8 +2239,7 @@ void SfxObjectShell::SignSignatureLine(weld::Window* 
pDialogParent,
 
     // Reload the document to get the updated graphic
     // FIXME: Update just the signature line graphic instead of reloading the 
document
-    SfxViewFrame *pFrame = GetFrame();
-    if (pFrame)
+    if (SfxViewFrame* pFrame = GetFrame())
         pFrame->GetDispatcher()->Execute(SID_RELOAD);
 }
 
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index f1a95138db86..b945855c7cea 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2442,7 +2442,10 @@ ErrCode SfxViewShell::DoVerb(sal_Int32 /*nVerb*/)
 void SfxViewShell::OutplaceActivated( bool bActive )
 {
     if ( !bActive )
-        GetFrame()->GetFrame().Appear();
+    {
+        if (SfxViewFrame* pFrame = GetFrame())
+            pFrame->GetFrame().Appear();
+    }
 }
 
 void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ )
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 57e561e1f444..66d459064247 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -655,15 +655,19 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc 
&rChged )
     }
     getIDocumentState().SetModified();
 
-    SfxBindings* pBindings =
-        ( GetDocShell() && GetDocShell()->GetDispatcher() ) ? 
GetDocShell()->GetDispatcher()->GetBindings() : nullptr;
-    if ( pBindings )
+    if (SwDocShell* pShell = GetDocShell())
     {
-        pBindings->Invalidate( SID_ATTR_PAGE_COLUMN );
-        pBindings->Invalidate( SID_ATTR_PAGE );
-        pBindings->Invalidate( SID_ATTR_PAGE_SIZE );
-        pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE );
-        pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE );
+        if (SfxDispatcher* pDispatcher = pShell->GetDispatcher())
+        {
+            if (SfxBindings* pBindings = pDispatcher->GetBindings())
+            {
+                pBindings->Invalidate( SID_ATTR_PAGE_COLUMN );
+                pBindings->Invalidate( SID_ATTR_PAGE );
+                pBindings->Invalidate( SID_ATTR_PAGE_SIZE );
+                pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE );
+                pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE );
+            }
+        }
     }
 
     //h/f of first-left page must not be unique but same as first master or 
left
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index d85379ffb1ee..af80113edef3 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -120,11 +120,16 @@ void OnlineAccessibilityCheck::updateNodeStatus(SwNode* 
pNode, bool bIssueObject
 
 void OnlineAccessibilityCheck::updateStatusbar()
 {
-    SfxBindings* pBindings = m_rDocument.GetDocShell() && 
m_rDocument.GetDocShell()->GetDispatcher()
-                                 ? 
m_rDocument.GetDocShell()->GetDispatcher()->GetBindings()
-                                 : nullptr;
-    if (pBindings)
-        pBindings->Invalidate(FN_STAT_ACCESSIBILITY_CHECK);
+    if (SwDocShell* pShell = m_rDocument.GetDocShell())
+    {
+        if (SfxDispatcher* pDispatcher = pShell->GetDispatcher())
+        {
+            if (SfxBindings* pBindings = pDispatcher->GetBindings())
+            {
+                pBindings->Invalidate(FN_STAT_ACCESSIBILITY_CHECK);
+            }
+        }
+    }
 }
 
 void OnlineAccessibilityCheck::runAccessibilityCheck(SwNode* pNode)
diff --git a/sw/source/uibase/shells/frmsh.cxx 
b/sw/source/uibase/shells/frmsh.cxx
index fc41058cd62e..10fb2cffc53b 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -890,7 +890,9 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
                                 }
                             }
                         }
-                        OUString 
aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame()->GetFrame().GetFrameInterface()));
+                        OUString aModuleName;
+                        if (SfxViewFrame* pFrame = GetFrame())
+                            aModuleName = 
vcl::CommandInfoProvider::GetModuleIdentifier(pFrame->GetFrame().GetFrameInterface());
                         switch (nWhich)
                         {
                             case SID_OBJECT_ALIGN_UP :
commit 00e8a6c93bc7b43a6f2453a5b3db318fe99ab4e2
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon May 27 13:14:55 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:22 2024 +0200

    sc: warning C6011: Dereferencing NULL pointer
    
    Change-Id: I37d541f4c75f053023f67fc3617492bf38a13ea3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168095
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168136
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/vba/vbaapplication.cxx 
b/sc/source/ui/vba/vbaapplication.cxx
index f951cbd4581b..c22b3a1bb99e 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -664,11 +664,14 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const 
uno::Any& Scroll )
     OUString sRangeName;
     if( Reference >>= sRangeName )
     {
+        ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext );
+        if (!pShell)
+            return;
+
         uno::Reference< frame::XModel > xModel( getCurrentDocument(), 
uno::UNO_SET_THROW );
         uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
                 xModel->getCurrentController(), uno::UNO_QUERY_THROW );
 
-        ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext );
         ScGridWindow* gridWindow = 
static_cast<ScGridWindow*>(pShell->GetWindow());
         try
         {
@@ -709,8 +712,11 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const 
uno::Any& Scroll )
     uno::Reference< excel::XRange > xRange;
     if( Reference >>= xRange )
     {
-        uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY );
         ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext );
+        if (!pShell)
+            return;
+
+        uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY );
         ScGridWindow* gridWindow = 
static_cast<ScGridWindow*>(pShell->GetWindow());
         if ( xVbaRange.is() )
         {
diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index bd0ebd463500..c8614ed53901 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -380,15 +380,17 @@ ScVbaWindow::getWindowState()
 {
     sal_Int32 nwindowState = xlNormal;
     // !! TODO !! get view shell from controller
-    ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
-    SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
-    WorkWindow* pWork = static_cast<WorkWindow*>( 
rViewFrame.GetFrame().GetSystemWindow() );
-    if ( pWork )
+    if (ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ))
     {
-        if ( pWork -> IsMaximized())
-            nwindowState = xlMaximized;
-        else if (pWork -> IsMinimized())
-            nwindowState = xlMinimized;
+        SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+        WorkWindow* pWork = static_cast<WorkWindow*>( 
rViewFrame.GetFrame().GetSystemWindow() );
+        if ( pWork )
+        {
+            if ( pWork -> IsMaximized())
+                nwindowState = xlMaximized;
+            else if (pWork -> IsMinimized())
+                nwindowState = xlMinimized;
+        }
     }
     return uno::Any( nwindowState );
 }
@@ -399,19 +401,21 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate 
)
     sal_Int32 nwindowState = xlMaximized;
     _windowstate >>= nwindowState;
     // !! TODO !! get view shell from controller
-    ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
-    SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
-    WorkWindow* pWork = static_cast<WorkWindow*>( 
rViewFrame.GetFrame().GetSystemWindow() );
-    if ( pWork )
-    {
-        if ( nwindowState == xlMaximized)
-            pWork -> Maximize();
-        else if (nwindowState == xlMinimized)
-            pWork -> Minimize();
-        else if (nwindowState == xlNormal)
-            pWork -> Restore();
-        else
-            throw uno::RuntimeException("Invalid Parameter" );
+    if (ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ))
+    {
+        SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+        WorkWindow* pWork = static_cast<WorkWindow*>( 
rViewFrame.GetFrame().GetSystemWindow() );
+        if ( pWork )
+        {
+            if ( nwindowState == xlMaximized)
+                pWork -> Maximize();
+            else if (nwindowState == xlMinimized)
+                pWork -> Minimize();
+            else if (nwindowState == xlNormal)
+                pWork -> Restore();
+            else
+                throw uno::RuntimeException(u"Invalid Parameter"_ustr );
+        }
     }
 }
 
diff --git a/sc/source/ui/vba/vbaworksheet.cxx 
b/sc/source/ui/vba/vbaworksheet.cxx
index 466e904d6f55..fbfdc5b72906 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -868,14 +868,13 @@ void SAL_CALL
 ScVbaWorksheet::ShowDataForm( )
 {
     uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_SET_THROW );
-    ScTabViewShell* pTabViewShell = excel::getBestViewShell( xModel );
-
-    ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
-
-    ScopedVclPtr<AbstractScDataFormDlg> 
pDlg(pFact->CreateScDataFormDlg(pTabViewShell->GetFrameWeld(),
+    if (ScTabViewShell* pTabViewShell = excel::getBestViewShell( xModel ))
+    {
+        ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+        ScopedVclPtr<AbstractScDataFormDlg> 
pDlg(pFact->CreateScDataFormDlg(pTabViewShell->GetFrameWeld(),
                                                                         
pTabViewShell));
-
-    pDlg->Execute();
+        pDlg->Execute();
+    }
 }
 
 uno::Any SAL_CALL
commit 968015242b55336256e019dfb60fc0cca32f10a2
Author:     Chris Mayo <aklh...@gmail.com>
AuthorDate: Sat May 18 17:13:31 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:22 2024 +0200

    Fix bashism in configure tests for curl and libcmis
    
    When /bin/sh is dash:
    
    ./configure: 35165: test: yes: unexpected operator
    checking whether to enable breakpad... no
    ./configure: 35218: test: yes: unexpected operator
    
    Causing HAVE_FEATURE_CURL not to be set to 1 and build to fail:
    
    sw/source/ui/misc/translatelangselect.cxx:160:24: error: no member named 
'TranslateDocumentCancellable' in namespace 'SwTranslateHelper'
      160 |     SwTranslateHelper::TranslateDocumentCancellable(m_rWrtSh, 
aConfig, m_bCancelTranslation);
          |     ~~~~~~~~~~~~~~~~~~~^
    
    Introduced in:
    
    5bf7c2fa5794 ("Fix --disable-curl build", 2023-09-14)
    
    Change-Id: Ifbc4bc1a7cde86101ff13b05ec7cee6836798605
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167831
    Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167909

diff --git a/configure.ac b/configure.ac
index 774a357ffdbd..4a01a51f9389 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10944,7 +10944,7 @@ AC_SUBST(ICU_MINOR)
 dnl ==================================================================
 dnl CURL
 dnl ==================================================================
-if test "$enable_curl" == "yes"; then
+if test "$enable_curl" = "yes"; then
     AC_DEFINE([HAVE_FEATURE_CURL])
 fi
 
@@ -10990,7 +10990,7 @@ AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
 dnl ==================================================================
 dnl libcmis
 dnl ==================================================================
-if test "$enable_libcmis" == "yes"; then
+if test "$enable_libcmis" = "yes"; then
     if test "$enable_curl" != "yes"; then
         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is 
used])
     fi
commit 7a1318aabe6f16cab671b8547543a7bbf61f734f
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Jun 19 11:54:13 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:22 2024 +0200

    tdf#161631 writerfilter: move another member to SubstreamContext
    
    The problem is that the bugdoc contains a table in the footer, which
    causes m_bDummyParaAddedForTableInSection to be set, which erroneously
    causes the last paragraph in the body to be removed.
    
    (regression from commit 86ad08f9d25110e91e92a0badf6de75e785b3644)
    
    Change-Id: I148785c54c37dc25f7d239b5898aec9fb5455f40
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169191
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit ef77086255821d61838a7e26fee9baadaca0b9e0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169209

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2bad7d4bff7b..74a4afd186b7 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -370,7 +370,6 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_bIsParaMarkerChange( false ),
         m_bIsParaMarkerMove( false ),
         m_bRedlineImageInPreviousRun( false ),
-        m_bDummyParaAddedForTableInSection( false ),
         m_bTextFrameInserted(false),
         m_bIsLastSectionGroup( false ),
         m_bUsingEnhancedFields( false ),
@@ -962,10 +961,9 @@ void DomainMapper_Impl::SetIsFirstParagraphInShape(bool 
bIsFirst)
 
 void DomainMapper_Impl::SetIsDummyParaAddedForTableInSection( bool bIsAdded )
 {
-    m_bDummyParaAddedForTableInSection = bIsAdded;
+    m_StreamStateStack.top().bDummyParaAddedForTableInSection = bIsAdded;
 }
 
-
 void DomainMapper_Impl::SetIsTextFrameInserted( bool bIsInserted )
 {
     m_bTextFrameInserted  = bIsInserted;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index af75015d83dc..cdc538368b1f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -214,6 +214,7 @@ struct SubstreamContext
     bool bParaWithInlineObject = false;
     /// This is a continuation of already finished paragraph - e.g., first in 
an index section
     bool bRemoveThisParagraph = false;
+    bool bDummyParaAddedForTableInSection = false; // tdf#161631
 };
 
 /// Information about a paragraph to be finished after a field end.
@@ -630,7 +631,6 @@ private:
     bool                            m_bRedlineImageInPreviousRun;
 
     bool                            m_bIsFirstParaInShape = false;
-    bool                            m_bDummyParaAddedForTableInSection;
     bool                            m_bTextFrameInserted;
     bool                            m_bIsLastSectionGroup;
     bool                            m_bUsingEnhancedFields;
@@ -755,7 +755,7 @@ public:
     void SetIsFirstParagraphInShape(bool bIsFirst);
     bool GetIsFirstParagraphInShape() const { return m_bIsFirstParaInShape; }
     void SetIsDummyParaAddedForTableInSection( bool bIsAdded );
-    bool GetIsDummyParaAddedForTableInSection() const { return 
m_bDummyParaAddedForTableInSection;}
+    bool GetIsDummyParaAddedForTableInSection() const { return 
m_StreamStateStack.top().bDummyParaAddedForTableInSection; }
 
     /// Track if a textframe has been inserted into this section
     void SetIsTextFrameInserted( bool bIsInserted );
commit 7f67833c50cf9ef9470da07085d366772393d6e4
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jun 14 09:38:52 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:21 2024 +0200

    tdf#144208 speedup doc with lots of redline (10)
    
    don't call SwRDFHelper::getStatements for every single paragraph, we can
    call this once and re-use the result
    
    Change-Id: I0277ecbb113b8333839172bddd7978f4b3a7259a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168850
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 0e33dff4252f3124c7ecc591befa56f0fb0e1895)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168809
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168865

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 29ea37b52d3d..076f1fc3f7d0 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -617,7 +617,7 @@ bool lcl_UpdateParagraphClassificationField(SwDoc* pDoc,
     return lcl_DoUpdateParagraphSignatureField(*pDoc, xField, sDisplayText);
 }
 
-void lcl_ValidateParagraphSignatures(SwDoc& rDoc, const 
uno::Reference<text::XTextContent>& xParagraph, const bool updateDontRemove)
+void lcl_ValidateParagraphSignatures(SwDoc& rDoc, const 
uno::Reference<text::XTextContent>& xParagraph, const bool updateDontRemove, 
const uno::Sequence<uno::Reference<css::rdf::XURI>>& rGraphNames)
 {
     SwDocShell* pDocShell = rDoc.GetDocShell();
     if (!pDocShell)
@@ -628,8 +628,10 @@ void lcl_ValidateParagraphSignatures(SwDoc& rDoc, const 
uno::Reference<text::XTe
     // Check if the paragraph is signed.
     try
     {
-        const std::pair<OUString, OUString> pair = lcl_getRDF(xModel, 
xParagraph, ParagraphSignatureLastIdRDFName);
-        if (pair.second.isEmpty())
+        const css::uno::Reference<css::rdf::XResource> xSubject(xParagraph, 
uno::UNO_QUERY);
+        std::map<OUString, OUString> aStatements = 
SwRDFHelper::getStatements(xModel, rGraphNames, xSubject);
+        const auto it = aStatements.find(ParagraphSignatureLastIdRDFName);
+        if (it == aStatements.end() || it->second.isEmpty())
             return;
     }
     catch (const ::css::uno::Exception&)
@@ -1847,8 +1849,13 @@ void 
SwEditShell::ValidateParagraphSignatures(SwTextNode* pNode, bool updateDont
             SetParagraphSignatureValidation(bOldValidationFlag);
         });
 
+    SwDocShell* pDocShell = GetDoc()->GetDocShell();
+    if (!pDocShell)
+        return;
+
+    uno::Sequence<uno::Reference<css::rdf::XURI>> aGraphNames = 
SwRDFHelper::getGraphNames(pDocShell->GetBaseModel(), MetaNS);
     rtl::Reference<SwXParagraph> xParentText = 
SwXParagraph::CreateXParagraph(*GetDoc(), pNode, nullptr);
-    lcl_ValidateParagraphSignatures(*GetDoc(), xParentText, updateDontRemove);
+    lcl_ValidateParagraphSignatures(*GetDoc(), xParentText, updateDontRemove, 
aGraphNames);
 }
 
 void SwEditShell::ValidateCurrentParagraphSignatures(bool updateDontRemove)
@@ -1884,10 +1891,11 @@ void SwEditShell::ValidateAllParagraphSignatures(bool 
updateDontRemove)
     uno::Reference<container::XEnumeration> xParagraphs = 
xParagraphEnumerationAccess->createEnumeration();
     if (!xParagraphs.is())
         return;
+    uno::Sequence<uno::Reference<css::rdf::XURI>> aGraphNames = 
SwRDFHelper::getGraphNames(pDocShell->GetBaseModel(), MetaNS);
     while (xParagraphs->hasMoreElements())
     {
         uno::Reference<text::XTextContent> 
xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY);
-        lcl_ValidateParagraphSignatures(*GetDoc(), xParagraph, 
updateDontRemove);
+        lcl_ValidateParagraphSignatures(*GetDoc(), xParagraph, 
updateDontRemove, aGraphNames);
     }
 }
 
@@ -1939,7 +1947,7 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
 
     static constexpr OUString sBlank(u""_ustr);
     const sfx::ClassificationKeyCreator 
aKeyCreator(SfxClassificationHelper::getPolicyType());
-
+    uno::Sequence<uno::Reference<css::rdf::XURI>> aGraphNames = 
SwRDFHelper::getGraphNames(xModel, MetaNS);
     while (xParagraphs->hasMoreElements())
     {
         uno::Reference<text::XTextContent> 
xParaOrTable(xParagraphs->nextElement(), uno::UNO_QUERY);
@@ -1948,7 +1956,9 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
         try
         {
             const css::uno::Reference<css::rdf::XResource> 
xSubject(xParagraph);
-            const OUString sFieldNames = lcl_getRDF(xModel, xSubject, 
ParagraphClassificationFieldNamesRDFName).second;
+            std::map<OUString, OUString> aParagraphStatements = 
SwRDFHelper::getStatements(xModel, aGraphNames, xSubject);
+            auto it = 
aParagraphStatements.find(ParagraphClassificationFieldNamesRDFName);
+            const OUString sFieldNames = (it != aParagraphStatements.end()) ? 
it->second : OUString();
 
             std::vector<svx::ClassificationResult> aResults;
             if (!sFieldNames.isEmpty())
@@ -1961,9 +1971,14 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
                     if (sCurFieldName.isEmpty())
                         break;
 
-                    const std::pair<OUString, OUString> fieldNameValue = 
lcl_getRDF(xModel, xSubject, sCurFieldName);
-                    const OUString sName = fieldNameValue.first;
-                    const OUString sValue = fieldNameValue.second;
+                    OUString sName;
+                    OUString sValue;
+                    it = aParagraphStatements.find(sCurFieldName);
+                    if (it != aParagraphStatements.end())
+                    {
+                        sName = it->first;
+                        sValue = it->second;
+                    }
 
                     if (aKeyCreator.isMarkingTextKey(sName))
                     {
@@ -1998,7 +2013,7 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
 
             // Get Signatures
             std::map<OUString, SignatureDescr> aSignatures;
-            for (const auto& pair : lcl_getRDFStatements(xModel, 
uno::Reference<css::text::XTextContent>(xParagraph)))
+            for (const auto& pair : aParagraphStatements)
             {
                 const OUString& sName = pair.first;
                 if (sName.startsWith(ParagraphSignatureRDFNamespace))
@@ -2039,7 +2054,7 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
                 }
             }
 
-            lcl_ValidateParagraphSignatures(*GetDoc(), xParagraph, true); // 
Validate and Update signatures.
+            lcl_ValidateParagraphSignatures(*GetDoc(), xParagraph, true, 
aGraphNames); // Validate and Update signatures.
         }
         catch (const std::exception&)
         {
commit 23f564485f1a48440de677b43b137b8fe7891c56
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Jun 5 13:55:08 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:21 2024 +0200

    tdf#160877: call lcl_getRDF since graph-names can change
    
    partially revert 3750d0533e0e00941e5aef92fe5a26b6e7e27734
    "sw: paragraph-sign: get graph-names only once"
    
    Change-Id: I7f99679f4a361acdd841037b782421a53350dbbb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168477
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168671
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/qa/extras/odfexport/data/tdf160877.odt 
b/sw/qa/extras/odfexport/data/tdf160877.odt
new file mode 100644
index 000000000000..7137eee8067a
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf160877.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index fb45d5c8e93c..a2acec11393f 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -1373,6 +1373,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf160700)
     assertXPath(pXmlDoc, 
"//office:text/text:list/text:list-item/text:p/text:bookmark"_ostr);
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf160877, "tdf160877.odt")
+{
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    uno::Reference<text::XText> xHeaderTextPage1 = 
getProperty<uno::Reference<text::XText>>(
+        getStyles("PageStyles")->getByName("Standard"), "HeaderTextFirst");
+    CPPUNIT_ASSERT_EQUAL(OUString("Classification: General Business"), 
xHeaderTextPage1->getString());
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: (Sign GB)Test
+    // - Actual  : Test
+    CPPUNIT_ASSERT_EQUAL(OUString("(Sign GB)Test"), 
getParagraph(1)->getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index f02273e07318..29ea37b52d3d 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1939,7 +1939,6 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
 
     static constexpr OUString sBlank(u""_ustr);
     const sfx::ClassificationKeyCreator 
aKeyCreator(SfxClassificationHelper::getPolicyType());
-    const css::uno::Sequence<css::uno::Reference<rdf::XURI>> aGraphNames = 
SwRDFHelper::getGraphNames(xModel, MetaNS);
 
     while (xParagraphs->hasMoreElements())
     {
@@ -1949,14 +1948,11 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
         try
         {
             const css::uno::Reference<css::rdf::XResource> 
xSubject(xParagraph);
-            const std::map<OUString, OUString> aStatements = 
SwRDFHelper::getStatements(xModel, aGraphNames, xSubject);
+            const OUString sFieldNames = lcl_getRDF(xModel, xSubject, 
ParagraphClassificationFieldNamesRDFName).second;
 
-            const auto it = 
aStatements.find(ParagraphClassificationFieldNamesRDFName);
-            const OUString sFieldNames = (it != aStatements.end() ? it->second 
: sBlank);
             std::vector<svx::ClassificationResult> aResults;
             if (!sFieldNames.isEmpty())
             {
-                assert(it != aStatements.end() && "can only be non-empty if it 
was valid");
                 // Order the fields
                 sal_Int32 nIndex = 0;
                 do
@@ -1965,10 +1961,9 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
                     if (sCurFieldName.isEmpty())
                         break;
 
-                    const auto it2 = aStatements.find(sCurFieldName);
-                    bool bStatementFound = it2 != aStatements.end();
-                    const OUString sName = bStatementFound ? it->first : 
sBlank;
-                    const OUString sValue = bStatementFound ? it->second : 
sBlank;
+                    const std::pair<OUString, OUString> fieldNameValue = 
lcl_getRDF(xModel, xSubject, sCurFieldName);
+                    const OUString sName = fieldNameValue.first;
+                    const OUString sValue = fieldNameValue.second;
 
                     if (aKeyCreator.isMarkingTextKey(sName))
                     {
@@ -1976,14 +1971,14 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
                     }
                     else if (aKeyCreator.isCategoryNameKey(sName))
                     {
-                        const auto it3 = 
aStatements.find(ParagraphClassificationAbbrRDFName);
-                        const OUString sAbbreviatedName = (it3 != 
aStatements.end() && !it3->second.isEmpty() ? it3->second : sValue);
+                        const std::pair<OUString, OUString> pairAbbr = 
lcl_getRDF(xModel, xSubject, ParagraphClassificationAbbrRDFName);
+                        const OUString sAbbreviatedName = 
(!pairAbbr.second.isEmpty() ? pairAbbr.second : sValue);
                         aResults.push_back({ 
svx::ClassificationType::CATEGORY, sValue, sAbbreviatedName, sBlank });
                     }
                     else if (aKeyCreator.isCategoryIdentifierKey(sName))
                     {
-                        const auto it3 = 
aStatements.find(ParagraphClassificationAbbrRDFName);
-                        const OUString sAbbreviatedName = (it3 != 
aStatements.end() && !it3->second.isEmpty() ? it3->second : sValue);
+                        const std::pair<OUString, OUString> pairAbbr = 
lcl_getRDF(xModel, xSubject, ParagraphClassificationAbbrRDFName);
+                        const OUString sAbbreviatedName = 
(!pairAbbr.second.isEmpty() ? pairAbbr.second : sValue);
                         aResults.push_back({ 
svx::ClassificationType::CATEGORY, sBlank, sAbbreviatedName, sValue });
                     }
                     else if (aKeyCreator.isMarkingKey(sName))
commit fc97a6dd598678f542f689b85909a3e30dc98b38
Author:     Irgaliev Amin <irgalie...@mail.ru>
AuthorDate: Mon Dec 25 20:13:34 2023 +0400
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:21 2024 +0200

    tdf#158023 Add \ before parentheses if they are in the <t> tag.
    
    MSO allows you to write unpair opening or closing parentheses in the t tag.
    The patch adds a backslash before parentheses, which allows you to correctly
    recognize and correctly save such formulas when exporting.
    
    Also add a test to check whether the parentheses are wrapped correctly.
    
    Change-Id: Ib1a941858f0843742b56b8089f3c14983ba1222c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158794
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 8148dd6ed3c61eaf5f9fe3a060ecda9d11611f39)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169103
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx
index 4023a5e652ac..b0932c43919c 100644
--- a/starmath/source/ooxmlimport.cxx
+++ b/starmath/source/ooxmlimport.cxx
@@ -602,9 +602,9 @@ OUString SmOoxmlImport::handleR()
             {
                 XmlStream::Tag rtag = m_rStream.ensureOpeningTag( M_TOKEN( t 
));
                 if( rtag.attribute( OOX_TOKEN( xml, space )) != "preserve" )
-                    text.append(o3tl::trim(rtag.text));
+                    text.append(o3tl::trim(rtag.text.replaceAll("(", 
"\(").replaceAll(")", "\)")));
                 else
-                    text.append(rtag.text);
+                    text.append(rtag.text.replaceAll("(", 
"\(").replaceAll(")", "\)"));
                 m_rStream.ensureClosingTag( M_TOKEN( t ));
                 break;
             }
diff --git a/sw/qa/extras/ooxmlexport/data/tdf158023_export.docx 
b/sw/qa/extras/ooxmlexport/data/tdf158023_export.docx
new file mode 100644
index 000000000000..289619a7e4b6
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf158023_export.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 6e27f9a6a1ab..e18c1eebca5e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -261,7 +261,14 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentsNested)
 CPPUNIT_TEST_FIXTURE(Test, testMathEscape)
 {
     loadAndReload("math-escape.docx");
-    CPPUNIT_ASSERT_EQUAL(OUString("\{ left [ right ] left ( right ) \}"), 
getFormula(getRun(getParagraph(1), 1)));
+    CPPUNIT_ASSERT_EQUAL(OUString("\{ left [ right ] \( \) \}"), 
getFormula(getRun(getParagraph(1), 1)));
+}
+
+// Saving left and right for parentheses when importing not from the m:t tag 
(docx)
+CPPUNIT_TEST_FIXTURE(Test, testTdf158023Export)
+{
+    loadAndReload("tdf158023_export.docx");
+    CPPUNIT_ASSERT_EQUAL(OUString("left [ right ] left ( right ) left lbrace  
right rbrace"), getFormula(getRun(getParagraph(1), 1)));
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testFdo51034)
diff --git a/sw/qa/extras/ooxmlimport/data/tdf158023_import.docx 
b/sw/qa/extras/ooxmlimport/data/tdf158023_import.docx
new file mode 100644
index 000000000000..1095499e2ebf
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf158023_import.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 0c29484d765e..642c05b14aa8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -697,6 +697,26 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf119200)
     CPPUNIT_ASSERT_EQUAL(u" size 12{ func \u2287 } {}"_ustr, 
getFormula(getRun(xPara, 7)));
 }
 
+// Checking a formula where the closing brackets
+// come first, and then the opening ones
+CPPUNIT_TEST_FIXTURE(Test, testTdf158023Import)
+{
+    auto verify = [this]() {
+        auto xPara = getParagraph(1);
+        CPPUNIT_ASSERT_EQUAL(u"\) sqrt {\)2\(} \("_ustr, 
getFormula(getRun(xPara, 1)));
+    };
+    auto verifyReload = [this]() {
+        auto xPara = getParagraph(1);
+        CPPUNIT_ASSERT_EQUAL(u"\) sqrt {\) 2 \(} \("_ustr, 
getFormula(getRun(xPara, 1)));
+    };
+
+    createSwDoc("tdf158023_import.docx");
+    verify();
+
+    saveAndReload("Office Open XML Text");
+    verifyReload();
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf115094)
 {
     createSwDoc("tdf115094.docx");
diff --git a/sw/qa/extras/rtfexport/data/tdf158023.rtf 
b/sw/qa/extras/rtfexport/data/tdf158023.rtf
new file mode 100644
index 000000000000..cdcddc4532fc
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158023.rtf
@@ -0,0 +1,8 @@
+{ tf1
+{\mmath {\*\moMath
+{\md {\mdPr {\mbegChr [}{\mendChr ]}}{\me {\mr a}}}
+{\md {\mdPr {\mbegChr (}{\mendChr )}}{\me {\mr b}}}
+{\md {\mdPr {\mbegChr \{}{\mendChr \}}}{\me {\mr c}}}
+}}
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index bbb09090500e..193d0c6e54fb 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -371,7 +371,15 @@ CPPUNIT_TEST_FIXTURE(Test, testMathRuns)
 {
     loadAndReload("math-runs.rtf");
     // was [](){}, i.e. first curly bracket had an incorrect position
-    CPPUNIT_ASSERT_EQUAL(OUString("\{ left [ right ] left ( right ) \}"),
+    CPPUNIT_ASSERT_EQUAL(OUString("\{ left [ right ] \( \) \}"),
+                         getFormula(getRun(getParagraph(1), 1)));
+}
+
+// Saving left and right for parentheses when importing not from the m:t tag 
(rtf)
+CPPUNIT_TEST_FIXTURE(Test, testTdf158023_rtf)
+{
+    loadAndReload("tdf158023.rtf");
+    CPPUNIT_ASSERT_EQUAL(OUString("left [a right ] left (b right ) left lbrace 
c right rbrace"),
                          getFormula(getRun(getParagraph(1), 1)));
 }
 
commit a42e6122cd35b7da0e4bd9475abba73bd17410a0
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Fri Jun 14 11:26:22 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:21 2024 +0200

    tdf#150582 linguistic: fix always rejected words with U+2019 apostrophe
    
    During spell checking, words added to the user dictionaries still
    weren't recognized by Calc, Impress and Draw because of the unnecessary
    conversion their typographic apostrophes to ASCII apostrophes.
    
    Note: Writer has no such problem because of its (obsolete) apostrophe
    conversion for the user dictionary.
    
    First skip the obsolete apostrophe conversion in isValid(), but keep
    it as a fallback for Writer users.
    
    Change-Id: I09870a35d7a91017281ba4b228d338336e7bd9c1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168858
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit 8de1941fe61b461be617e1e88bb362bbd8315654)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168878
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 92b2d4c3efbd..cf83b3a2e3b7 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -199,10 +199,19 @@ sal_Bool SAL_CALL
             const css::uno::Sequence< ::css::beans::PropertyValue >& 
rProperties )
 {
     MutexGuard  aGuard( GetLinguMutex() );
-    return isValid_Impl( rWord, LinguLocaleToLanguage( rLocale ), rProperties 
);
+    // for historical reasons, the word can be only with ASCII apostrophe in 
the dictionaries,
+    // so as a fallback, convert typographical apostrophes to avoid annoying 
users, if they
+    // have old (user) dictionaries only with the obsolete ASCII apostrophe.
+    bool bConvert = false;
+    bool bRet = isValid_Impl( rWord, LinguLocaleToLanguage( rLocale ), 
rProperties, bConvert );
+    if (!bRet && bConvert)
+    {
+        // fallback: convert the apostrophes
+        bRet = isValid_Impl( rWord, LinguLocaleToLanguage( rLocale ), 
rProperties, bConvert );
+    }
+    return bRet;
 }
 
-
 Reference< XSpellAlternatives > SAL_CALL
     SpellCheckerDispatcher::spell( const OUString& rWord, const Locale& 
rLocale,
             const css::uno::Sequence< ::css::beans::PropertyValue >& 
rProperties )
@@ -249,7 +258,8 @@ static Reference< XDictionaryEntry > 
lcl_GetRulingDictionaryEntry(
 bool SpellCheckerDispatcher::isValid_Impl(
             const OUString& rWord,
             LanguageType nLanguage,
-            const PropertyValues& rProperties)
+            const PropertyValues& rProperties,
+            bool& rConvertApostrophe)
 {
     MutexGuard  aGuard( GetLinguMutex() );
 
@@ -267,11 +277,21 @@ bool SpellCheckerDispatcher::isValid_Impl(
         OUString aChkWord( rWord );
         Locale aLocale( LanguageTag::convertToLocale( nLanguage ) );
 
-        // replace typographical apostroph by ascii apostroph
+        // replace typographical apostrophe by ASCII apostrophe only as a 
fallback
+        // for old user dictionaries before the time of the default 
typographical apostrophe
+        // (Note: otherwise also no problem with non-Unicode Hunspell 
dictionaries, because
+        // the character conversion converts also the typographical apostrophe 
to the ASCII one)
         OUString aSingleQuote( GetLocaleDataWrapper( nLanguage 
).getQuotationMarkEnd() );
         DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of 
quotation mark" );
-        if (!aSingleQuote.isEmpty())
-            aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
+        if (!aSingleQuote.isEmpty() && aChkWord.indexOf(aSingleQuote[0]) > -1)
+        {
+            // tdf#150582 first check with the original typographical 
apostrophe,
+            // and convert it only on the second try
+            if (rConvertApostrophe)
+                aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
+            else
+                rConvertApostrophe = true;
+        }
 
         RemoveHyphens( aChkWord );
         if (IsIgnoreControlChars( rProperties, GetPropSet() ))
diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx
index 73fe59579ff3..c05676e1c9f0 100644
--- a/linguistic/source/spelldsp.hxx
+++ b/linguistic/source/spelldsp.hxx
@@ -69,7 +69,7 @@ class SpellCheckerDispatcher :
     /// @throws css::uno::RuntimeException
     /// @throws css::lang::IllegalArgumentException
     bool    isValid_Impl(const OUString& aWord, LanguageType nLanguage,
-                    const css::beans::PropertyValues& aProperties);
+                    const css::beans::PropertyValues& aProperties, bool& 
rConvertApostrophe);
 
     /// @throws css::uno::RuntimeException
     /// @throws css::lang::IllegalArgumentException
commit c56a01b251b024b856a4d56bb3fdef80a03648c4
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jun 17 22:31:12 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:21 2024 +0200

    language-subtag-registry: upgrade to 2024-06-14
    
    How the file was created:
    mkdir data
    cd data
    wget
    
https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
    cd ..
    tar cvjf language-subtag-registry-2024-06-14.tar.bz2 
data/language-subtag-registry
    
    Change-Id: Ib85b9072590a97fde37be85b9866bf53f77d1f4e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169061
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins
    (cherry picked from commit 62c99a31de22561e0e38dd10f3b3fd2b6dd9971d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169099
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/download.lst b/download.lst
index 88d97ccb2a30..d33987c1c093 100644
--- a/download.lst
+++ b/download.lst
@@ -422,8 +422,8 @@ LIBJPEG_TURBO_TARBALL := libjpeg-turbo-2.1.5.1.tar.gz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-LANGTAGREG_SHA256SUM := 
9090265f2bb0f4fb20ec1f7357062c033b9556b362b70c441985c1c905dd9a73
-LANGTAGREG_TARBALL := language-subtag-registry-2024-05-16.tar.bz2
+LANGTAGREG_SHA256SUM := 
75bc394dd83ddfd62b172a462db1b66bdb5950f40823ed63b8c7db6b71e37e75
+LANGTAGREG_TARBALL := language-subtag-registry-2024-06-14.tar.bz2
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
commit 469deb7f8c0bdc338eecf6852947a90dc7ada569
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Sun Jun 16 20:35:33 2024 -0400
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:20 2024 +0200

    tdf#148569 set extra drawing constraints when scaling
    
    Previously, setting stroke width and cap was only done when running
    unit tests. But the same drawing contraints are necessary when running
    with a Retina display on macOS.
    
    Change-Id: I74f7347d30a410f7d3485388ffec61b32730b948
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168973
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    (cherry picked from commit a4488013ee6c87a97501b620dbbf56622fb70246)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168948

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 5a04a08b6438..e1e6333761b8 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -720,7 +720,12 @@ void SkiaSalGraphicsImpl::drawPixel(tools::Long nX, 
tools::Long nY, Color nColor
     SkPaint paint = makePixelPaint(nColor);
     // Apparently drawPixel() is actually expected to set the pixel and not 
draw it.
     paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
-    if (mScaling != 1 && isUnitTestRunning())
+
+    // tdf#148569 set extra drawing constraints when scaling
+    // Previously, setting stroke width and cap was only done when running
+    // unit tests. But the same drawing contraints are necessary when running
+    // with a Retina display on macOS.
+    if (mScaling != 1)
     {
         // On HiDPI displays, draw a square on the entire non-hidpi "pixel" 
when running unittests,
         // since tests often require precise pixel drawing.
commit 86742dfbc232a1cd39f8035ddbc5b58d059780b2
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Wed May 22 10:25:10 2024 -0400
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:42:20 2024 +0200

    tdf#158914 add back reusing weakly cached ScAccessibleCells
    
    While commit 8e886993f32b7db11a99bdecf06451e6de6c3842
    fixed tdf#157568, moving the selected cell rapidly creates
    a large number of stale ScAccessibleCell instances that
    aren't deleted until the Calc document is closed. So reduce
    memory usage by adding back the ScAccessibleCell cache that
    was in commit f22cb3dfab413a2917cd810b8e1b8f644a016327 now
    that a new fix for tdf#157568 has been implemented.
    
    The new fix for tdf#157568 is to do the following:
    
    - Check if the edit engine text has changed. If the input
    string is different than the edit engine's existing text,
    force update of the edit engine's text. Otherwise, the edit
    engine will still to be set to its existing text.
    
    - Before a cell loses focus, check if any accessible text
    changes have occurred and fire text and value changed
    notifications if needed.
    
    Change-Id: I106ad0138d5d834367be59ca625d41a692696d4a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167961
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit ab5ad0c8b5056da8f699cea233dd31eceb3d80a4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168888

diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx 
b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 020386a69af8..52857bec9ea0 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -33,6 +33,7 @@
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <comphelper/accessibletexthelper.hxx>
 #include <sal/log.hxx>
 #include <tools/gen.hxx>
 #include <svtools/colorcfg.hxx>
@@ -315,6 +316,7 @@ void SAL_CALL ScAccessibleSpreadsheet::disposing()
     m_mapSelectionSend.clear();
     m_mapFormulaSelectionSend.clear();
     m_pAccFormulaCell.clear();
+    m_mapCells.clear();
 
     ScAccessibleTableBase::disposing();
 }
@@ -680,7 +682,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, 
const SfxHint& rHint
                     if (pScDoc)
                     {
                         OUString 
valStr(pScDoc->GetString(aNewCell.Col(),aNewCell.Row(),aNewCell.Tab()));
-                        if(m_strCurCellValue != valStr)
+                        if(mpAccCell.is() && m_strCurCellValue != valStr)
                         {
                             AccessibleEventObject aEvent;
                             aEvent.EventId = AccessibleEventId::VALUE_CHANGED;
@@ -755,6 +757,43 @@ void ScAccessibleSpreadsheet::CommitFocusCell(const 
ScAddress &aNewCell)
     {
         return ;
     }
+
+    // Related tdf#158914: check if focussed cell has changed
+    // Some accessiblity tools, such as NVDA on Windows, appear to need
+    // a value changed notification before it will refetch a cell's
+    // accessible text. While Notify() is able to fire text and value changed
+    // notifications, it seems to be rarely called and when it is called,
+    // such as when undoing a cell, it can be called before the cell's
+    // accessible taxt has been updated.
+    // So before a cell loses focus, check if any accessible text changes
+    // have occurred and fire text and value changed notifications if needed.
+    ScDocument* pScDoc= GetDocument(mpViewShell);
+    if (pScDoc && mpAccCell.is())
+    {
+        const ScAddress aOldActiveCell = mpAccCell->GetCellAddress();
+        OUString 
valStr(pScDoc->GetString(aOldActiveCell.Col(),aOldActiveCell.Row(),aOldActiveCell.Tab()));
+        if(m_strCurCellValue != valStr)
+        {
+            uno::Any aOldValue;
+            uno::Any aNewValue;
+            
(void)comphelper::OCommonAccessibleText::implInitTextChangedEvent(m_strCurCellValue,
 valStr, aOldValue, aNewValue);
+            AccessibleEventObject aTextChangedEvent;
+            aTextChangedEvent.EventId = AccessibleEventId::TEXT_CHANGED;
+            aTextChangedEvent.OldValue = aOldValue;
+            aTextChangedEvent.NewValue = aNewValue;
+            mpAccCell->CommitChange(aTextChangedEvent);
+
+            if (pScDoc->HasValueData(maActiveCell))
+            {
+                AccessibleEventObject aEvent;
+                aEvent.EventId = AccessibleEventId::VALUE_CHANGED;
+                mpAccCell->CommitChange(aEvent);
+            }
+
+            m_strCurCellValue = valStr;
+        }
+    }
+
     AccessibleEventObject aEvent;
     aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
     aEvent.Source = uno::Reference< XAccessible >(this);
@@ -763,7 +802,6 @@ void ScAccessibleSpreadsheet::CommitFocusCell(const 
ScAddress &aNewCell)
     mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col());
     aEvent.NewValue <<= uno::Reference<XAccessible>(mpAccCell);
     maActiveCell = aNewCell;
-    ScDocument* pScDoc= GetDocument(mpViewShell);
     if (pScDoc)
     {
         m_strCurCellValue = 
pScDoc->GetString(maActiveCell.Col(),maActiveCell.Row(),maActiveCell.Tab());
@@ -931,7 +969,23 @@ rtl::Reference<ScAccessibleCell> 
ScAccessibleSpreadsheet::GetAccessibleCellAt(sa
         }
         else
         {
-            return ScAccessibleCell::create(this, mpViewShell, aCellAddress, 
getAccessibleIndex(nRow, nColumn), meSplitPos, mpAccDoc);
+            // tdf#158914 add back reusing weakly cached ScAccessibleCells
+            // While commit 8e886993f32b7db11a99bdecf06451e6de6c3842
+            // fixed tdf#157568, moving the selected cell rapidly creates
+            // a large number of stale ScAccessibleCell instances that
+            // aren't deleted until the Calc document is closed. So reduce
+            // memory usage by adding back the ScAccessibleCell cache that
+            // was in commit f22cb3dfab413a2917cd810b8e1b8f644a016327 now
+            // that a new fix for tdf#157568 has been implemented.
+            rtl::Reference<ScAccessibleCell> xCell;
+            auto it = m_mapCells.find(aCellAddress);
+            if (it != m_mapCells.end())
+                xCell = it->second.get();
+            if (xCell)
+                return xCell;
+            xCell = ScAccessibleCell::create(this, mpViewShell, aCellAddress, 
getAccessibleIndex(nRow, nColumn), meSplitPos, mpAccDoc);
+            m_mapCells.insert(std::make_pair(aCellAddress, xCell));
+            return xCell;
         }
     }
 }
diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx 
b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
index 5cf8b7018b01..49c9f1c27946 100644
--- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx
+++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <sal/config.h>
+#include <unotools/weakref.hxx>
 
 #include <rtl/ref.hxx>
 
@@ -267,6 +268,7 @@ private:
     OUString      m_strCurCellValue;
     ScRangeList   m_LastMarkedRanges;
     OUString      m_strOldTabName;
+    std::map<ScAddress, unotools::WeakReference<ScAccessibleCell>> m_mapCells;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 6102cdb9fac2..6094934a6ac6 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -807,7 +807,15 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
         {
             sal_uInt32 nFormat = rDoc.GetNumberFormat(aCellPos);
             OUString aText = ScCellFormat::GetInputString(aCell, nFormat, 
*rDoc.GetFormatTable(), rDoc);
-            if (!aText.isEmpty())
+            // tdf#157568 check if edit engine already has text
+            // If the input string is empty but the edit engine's existing
+            // text is not empty, force update of the edit engine's text.
+            // Otherwise, the edit engine will still to be set to its
+            // existing text.
+            // Note: CppunitTest_sc_macros_test testTdf116127 will fail if
+            // pEditEngine->SetTextNewDefaults() is passed an empty string
+            // and pEditEngine->GetText() is empty string.
+            if (!aText.isEmpty() || !pEditEngine->GetText().isEmpty())
                 pEditEngine->SetTextNewDefaults(aText, aDefaults);
             else
                 pEditEngine->SetDefaults(aDefaults);
commit 3bcfca0544679a41f5db07754f7937015b0b8b5f
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Jun 14 19:03:30 2024 +0500
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:36:56 2024 +0200

    tdf#161573: Do not show unrelated messages during broken ZIP detection
    
    Change-Id: Iab7f4bb492e24eb2ca6448f3540d219a18c15d79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168869
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 278008f76835a128025b2a37ba8c9a7613284b6d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168883
    Reviewed-by: Justin Luth <jl...@mail.com>
    (cherry picked from commit 0612048edb676d2c4f2e7dbefa0fcb464c25f016)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168884

diff --git a/filter/source/config/cache/typedetection.cxx 
b/filter/source/config/cache/typedetection.cxx
index 065fe483a3dd..66706a027259 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -926,6 +926,12 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep(      
utl::MediaDescriptor& r
     {
         try
         {
+            // tdf#161573: do not interact with the user about possible 
unrelated failures (e.g.,
+            // missing file). If needed, that will happen later, in the main 
detection phase.
+            auto 
aInteraction(rDescriptor.getValue(utl::MediaDescriptor::PROP_INTERACTIONHANDLER));
+            rDescriptor.erase(utl::MediaDescriptor::PROP_INTERACTIONHANDLER);
+            comphelper::ScopeGuard interactionHelperGuard([&rDescriptor, 
&aInteraction]
+                { rDescriptor[utl::MediaDescriptor::PROP_INTERACTIONHANDLER] = 
aInteraction; });
             impl_openStream(rDescriptor);
             if (auto xStream = rDescriptor.getUnpackedValueOrDefault(
                     utl::MediaDescriptor::PROP_INPUTSTREAM,
@@ -943,7 +949,7 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep(      
utl::MediaDescriptor& r
                 if (isBrokenZIP(xStream, xContext))
                 {
                     if (css::uno::Reference<css::task::XInteractionHandler> 
xInteraction{
-                            
rDescriptor.getValue(utl::MediaDescriptor::PROP_INTERACTIONHANDLER),
+                            aInteraction,
                             css::uno::UNO_QUERY })
                     {
                         INetURLObject 
aURL(rDescriptor.getUnpackedValueOrDefault(
commit 5b6631f6fa1297638f015729863b3f827f55a748
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Jun 13 19:56:06 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:36:56 2024 +0200

    when SAL_CUPS_PPD_RETAIN_TMP is set output what the ppd file was saved as
    
    Change-Id: Ib17ec39a5b2691190c5eb1291d1977e1b83eba15
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168800
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/vcl/unx/generic/printer/cupsmgr.cxx 
b/vcl/unx/generic/printer/cupsmgr.cxx
index 1fab7a172353..c387b7404ca6 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -43,6 +43,7 @@
 
 #include <algorithm>
 #include <cstddef>
+#include <iostream>
 #include <string_view>
 
 using namespace psp;
@@ -541,7 +542,9 @@ const PPDParser* CUPSManager::createCUPSParser( const 
OUString& rPrinter )
 
                     // remove temporary PPD file
                     if (!getenv("SAL_CUPS_PPD_RETAIN_TMP"))
-                        unlink( aPPDFile.getStr() );
+                        unlink(aPPDFile.getStr());
+                    else
+                        std::cout << "Saved PPD file as: " << aPPDFile << 
std::endl;
                 }
                 else
                     SAL_INFO("vcl.unx.print", "cupsGetPPD failed, falling back 
to generic driver");
commit e34c17c01308949e6d8b4057ff3a45446c1e74be
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jun 14 10:57:58 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:36:56 2024 +0200

    wina11y: Fix handling for special text offset -1
    
    As described in the IAccessible2 spec [1], -1 can be used as a
    special text offset:
    
    > Using IA2_TEXT_OFFSET_LENGTH (-1) as an offset in any of the
    > IAccessibleText or IAccessibleEditableText methods is the same
    > as specifying the length of the string.
    
    Replace -1 by the text length *before* doing the
    check whether end offset is smaller than the start offset.
    
    Otherwise, trying to query the whole text of a Writer paragraph
    containing the text "hello" in NVDA's Python console would
    incorrectly trigger an error:
    
        >>> focus.IAccessibleTextObject.text(0,-1)
        Traceback (most recent call last):
          File "<console>", line 1, in <module>
          File "comtypes\__init__.pyc", line 856, in __call__
          File "monkeyPatches        _ctypes.COMError: (-2147467259, 
'Unspecified error', (None, None, None, 0, None))
    
    With this commit in place, it works as expected:
    
        >>> focus.IAccessibleTextObject.text(0,-1)
        'hello'
    
    [1] 
https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/_general_info.html#_specialOffsets
    
    Change-Id: I489a42270a56178cc8ee0564eec3dc82e15969c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168853
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins
    (cherry picked from commit 0c7928dc10da2c8c5ce9910fe20cea439573f2ae)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168886
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/winaccessibility/source/UAccCOM/AccTextBase.cxx 
b/winaccessibility/source/UAccCOM/AccTextBase.cxx
index a50cee9dd41c..857b52f2f53f 100644
--- a/winaccessibility/source/UAccCOM/AccTextBase.cxx
+++ b/winaccessibility/source/UAccCOM/AccTextBase.cxx
@@ -438,25 +438,13 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP 
CAccTextBase::get_text(long startOffset, long
     if(!pRXText.is())
         return E_FAIL;
 
-    if (endOffset < -1 || endOffset < startOffset )
-    {
-        return E_FAIL;
-    }
+    if (endOffset == -1)
+        endOffset = pRXText->getCharacterCount();
 
-    OUString ouStr;
-    if (endOffset == -1 )
-    {
-        long nLen=0;
-        if(SUCCEEDED(get_characterCount(&nLen)))
-        {
-            ouStr = pRXText->getTextRange(0, nLen);
-        }
-    }
-    else
-    {
-        ouStr = pRXText->getTextRange(startOffset, endOffset);
-    }
+    if (endOffset < 0 || endOffset < startOffset)
+        return E_FAIL;
 
+    const OUString ouStr = pRXText->getTextRange(startOffset, endOffset);
     SysFreeString(*text);
     *text = SysAllocString(o3tl::toW(ouStr.getStr()));
     return S_OK;
commit fcdf8aa52707b0888e9bf4292b5328c3cbb5b161
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Jun 15 21:10:10 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:36:56 2024 +0200

    Resolves: tdf#159741 canceling printing results in 'modified' document
    
    Change-Id: I627487a79f819351ec38e34b3fac432c36670d7b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168933
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 19fddbffdfa0..493440977776 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -68,6 +68,7 @@ class SfxPrinterController : public vcl::PrinterController, 
public SfxListener
     mutable Reference<awt::XDevice>         mxDevice;
     SfxViewShell*                           mpViewShell;
     SfxObjectShell*                         mpObjectShell;
+    bool        m_bJobStarted;
     bool        m_bOrigStatus;
     bool        m_bNeedsChange;
     bool        m_bApi;
@@ -114,6 +115,7 @@ SfxPrinterController::SfxPrinterController( const 
VclPtr<Printer>& i_rPrinter,
     , mpLastPrinter( nullptr )
     , mpViewShell( pView )
     , mpObjectShell(nullptr)
+    , m_bJobStarted( false )
     , m_bOrigStatus( false )
     , m_bNeedsChange( false )
     , m_bApi(i_bApi)
@@ -291,6 +293,8 @@ void SfxPrinterController::jobStarted()
     if ( !mpObjectShell )
         return;
 
+    m_bJobStarted = true;
+
     m_bOrigStatus = mpObjectShell->IsEnableSetModified();
 
     // check configuration: shall update of printing information in DocInfo 
set the document to "modified"?
@@ -348,10 +352,13 @@ void SfxPrinterController::jobFinished( 
css::view::PrintableState nState )
         }
         case view::PrintableState_JOB_ABORTED :
         {
-            // printing not successful, reset DocInfo
-            uno::Reference<document::XDocumentProperties> 
xDocProps(mpObjectShell->getDocProperties());
-            xDocProps->setPrintedBy(m_aLastPrintedBy);
-            xDocProps->setPrintDate(m_aLastPrinted);
+            // printing not successful, reset DocInfo if the job started and 
so DocInfo was modified
+            if (m_bJobStarted)
+            {
+                uno::Reference<document::XDocumentProperties> 
xDocProps(mpObjectShell->getDocProperties());
+                xDocProps->setPrintedBy(m_aLastPrintedBy);
+                xDocProps->setPrintDate(m_aLastPrinted);
+            }
             break;
         }
 
commit ee625ff99dceba9b095c6e352f46de1d53a7acb2
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Tue Jun 11 13:10:36 2024 -0400
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:36:56 2024 +0200

    tdf#155212 clear the cached system font list after loading a font
    
    If the system font is not cached in SalData, loading embedded
    fonts will be extremely slow and will trigger each frame and each
    of its internal subframes to reload the system font list when
    loading documents with embedded fonts.
    
    So instead, reenable caching of the system font list in SalData
    by reverting commit 3b6e9582ce43242a2304047561116bb26808408b.
    Then, to prevent tdf#72456 from reoccurring, clear the cached
    system font list after a font has been loaded or unloaded.
    This should cause the first frame's request to reload the cached
    system font list and all subsequent frames will avoid doing
    duplicate font reloads.
    
    Change-Id: If2a36f8c17d8e25f818275f30a19af8517478884
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168734
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    Tested-by: Jenkins
    (cherry picked from commit 195ed184dd1552816bdebfe9c54fb6408bf91cc1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168728
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    (cherry picked from commit c270131be7a8ecc9599dc0f0fe6ea24c650f32ed)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168801

diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 0522ff8d58e7..983a98a5a614 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -216,7 +216,24 @@ static bool AddTempDevFont(const OUString& rFontFileURL)
 
     CFErrorRef error;
     bool success = CTFontManagerRegisterFontsForURL(rFontURL, 
kCTFontManagerScopeProcess, &error);
-    if (!success)
+    if (success)
+    {
+        // tdf155212 clear the cached system font list after loading a font
+        // If the system font is not cached in SalData, loading embedded
+        // fonts will be extremely slow and will trigger each frame and each
+        // of its internal subframes to reload the system font list when
+        // loading documents with embedded fonts.
+        // So instead, reenable caching of the system font list in SalData
+        // by reverting commit 3b6e9582ce43242a2304047561116bb26808408b.
+        // Then, to prevent tdf#72456 from reoccurring, clear the cached
+        // system font list after a font has been loaded or unloaded.
+        // This should cause the first frame's request to reload the cached
+        // system font list and all subsequent frames will avoid doing
+        // duplicate font reloads.
+        SalData* pSalData = GetSalData();
+        pSalData->mpFontList.reset();
+    }
+    else
     {
         CFRelease(error);
     }
@@ -271,8 +288,20 @@ void 
AquaSalGraphics::GetDevFontList(vcl::font::PhysicalFontCollection* pFontCol
 
     AddLocalTempFontDirs();
 
+    // The idea is to cache the list of system fonts once it has been 
generated.
+    // SalData seems to be a good place for this caching. However we have to
+    // carefully make the access to the font list thread-safe. If we register
+    // a font-change event handler to update the font list in case fonts have
+    // changed on the system we have to lock access to the list. The right
+    // way to do that is the solar mutex since GetDevFontList is protected
+    // through it as should be all event handlers
+
+    // Related tdf#155212: the system font list needs to be cached but that
+    // should not cause tdf#72456 to reoccur now that the cached system font
+    // is cleared immediately after a font has been loaded
     SalData* pSalData = GetSalData();
-    pSalData->mpFontList = GetCoretextFontList();
+    if( !pSalData->mpFontList )
+        pSalData->mpFontList = GetCoretextFontList();
 
     // Copy all PhysicalFontFace objects contained in the SystemFontList
     pSalData->mpFontList->AnnounceFonts( *pFontCollection );
commit e2bcb083a3c7ec65725cd4158ae478cb1c6135d5
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jun 14 15:43:22 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:36:56 2024 +0200

    tdf#160522 Chart > 4 columns, Only 4 colors
    
    regression from
        commit 337a9a454c1bc95214111578d3f9c0622c55c509
        Author: Noel Grandin <noel.gran...@collabora.co.uk>
        Date:   Mon May 18 09:17:04 2020 +0200
        use for-range on Sequence in chart2
    
    Change-Id: I94f9460e45e5910af1de905605158f9dc1dbedfb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168868
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 013282b1421c0bba66ef54ccbfe4a649a4b97628)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168880
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx 
b/chart2/source/model/template/ChartTypeTemplate.cxx
index 49c93766cd53..74fb0d7c65ef 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -222,7 +222,8 @@ void ChartTypeTemplate::changeDiagram( const 
rtl::Reference< Diagram >& xDiagram
             for( auto const & j : i )
             {
                 if( nIndex >= nFormerSeriesCount )
-                    lcl_applyDefaultStyle( j, nIndex++, xDiagram );
+                    lcl_applyDefaultStyle( j, nIndex, xDiagram );
+                nIndex++;
             }
 
         // remove charttype groups from all coordinate systems
commit bbf9989edbe0ec4a940bfa89e0ea30fdf1116d96
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Jun 12 17:16:01 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:36:56 2024 +0200

    sw: fix SwTextFrameInfo::GetSpaces() for line containing only spaces
    
    This would assert:
    frminf.cxx:139: void AddRange(): Assertion `rRanges.empty() || 
rRanges.back().second <= nPos' failed.
    
    Change-Id: Ib41f4c6c971fee9307140c108e74d5df7d94c973
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168824
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit f97008c50ff88a7cf0a80a583a743ee1fb041327)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168808
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx
index a123691db703..386f40942f5f 100644
--- a/sw/source/core/text/frminf.cxx
+++ b/sw/source/core/text/frminf.cxx
@@ -172,14 +172,15 @@ void SwTextFrameInfo::GetSpaces(
             // in the selection
             if( aLine.GetNext() )
             {
-                nPos = aLine.GetTextEnd();
+                TextFrameIndex const nEndPos{aLine.GetTextEnd()};
 
-                if( nPos < aLine.GetEnd() )
+                // if only whitespace in line, nEndPos < nPos !
+                if (nPos < nEndPos && nEndPos < aLine.GetEnd())
                 {
                     TextFrameIndex const nOff( !bWithLineBreak && CH_BREAK ==
                         aLine.GetInfo().GetChar(aLine.GetEnd() - 
TextFrameIndex(1))
                                 ? 1 : 0 );
-                    AddRange( rRanges, nPos, aLine.GetEnd() - nPos - nOff );
+                    AddRange(rRanges, nEndPos, aLine.GetEnd() - nEndPos - 
nOff);
                 }
             }
         }
commit 3f3b3e1888a3d0d5a1f0fd051fb6b9aa6478621f
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jun 13 15:46:31 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jun 24 16:36:55 2024 +0200

    tdf#158658 sw: text formatting: make TabOverMargin even more crazy
    
    ... to better match Word's formatting.
    
    The bugdoc has a special case where a right-aligned tab is positioned at
    the right margin exactly, which causes the bFull condition in
    SwTabPortion::PreFormat() to be true.
    
    An obvious change to replace rInf.Width() - rInf.X() with
    rInf.GetLineWidth() in the condition makes no difference because
    m_pLastTab was already reset previously; instead, pass in the last tab
    from Format(), which indicates that the right edge position of the
    previous text portion was found via that tab.
    
    Additionally, change the condition that checks for TabOverMargin to also
    allow equal positions, i.e., exactly at the end of the paragraph.
    
    Change-Id: I5d3b1c13eca0bffa640745d7c5f4113699f79cad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168823
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 69d873e1c46f3cc8c524e18ac5a307a8d32ddd0f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168864
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/qa/extras/layout/data/tdf158658c.rtf 
b/sw/qa/extras/layout/data/tdf158658c.rtf
new file mode 100644
index 000000000000..4148eb6d9a51
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf158658c.rtf
@@ -0,0 +1,26 @@
+{ 
tf1deflang1025nsinsicpg1250\uc1deff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038
       hemelang1038    hemelangfe0     hemelangcs0
+{onttbl{0bidi romancharset0prq2 Times New Roman;}
+{himinor31506bidi swisscharset0prq2 Calibri;}
+{biminor31507bidi romancharset0prq2 Times New Roman;}
+}
+{\*\defchp 31506s22\lang1038\langfe1033\langfenp1033 }{\*\defpap \ql \li0 
i0\sa160\sl259\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 }
oqfpromote
+{\stylesheet{\ql \li0 
i0\sa160\sl259\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright 
in0\lin0\itap0  tlchcs1 f31507fs22lang1025 
+\ltrchcs0 31506s22\lang1038\langfe1033+{\s15\ql \li0 i0\widctlpar   qc      
x4513   qr      x9026\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 
 tlchcs1 f31507fs22lang1025 \ltrchcs0 31506
s22\lang1038\langfe1033+\sbasedon0 \snext15 \slink16 \sunhideused header;}}
+\paperw11906\paperh16838\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
 
+\deftab708\widowctrltnbjenddoc\hyphhotz425   rackmoves0      
rackformatting1\donotembedsysfont1 elyonvml0\donotembedlingdata0\grfdocevents0
alidatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1
oxlattoyenxpshrtn
oultrlspc\dntblnsbdb
ospaceforul
ormshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1
+\jexpandiewkind1iewscale100\pgbrdrhead\pgbrdrfoot\splytwnine
tnlytwnine\htmautsp
olnhtadjtbl\useltbalnlntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
obrkwrptbl\snaptogridincellllowfieldendsel\wrppunct
+sianbrkrule
ewtblstyruls
ogrowautofit\usenormstyforlist
oindnmbrtselnbrelev
ocxsptable\indrlsweleven
oafcnsttblfelev\utinl\hwelev\spltpgpar
otcvasp
otbrkcnstfrctbl
otvatxbx\krnprsnet+
ofeaturethrottle1\ilfomacatclnup0
+\ltrpar \sectd \ltrsect\linex0\headery708ootery708+   qc      x4513   qr      
x9026\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f31507fs22lang1025 \ltrchcs0 31506s22\lang1038\langfe1033+      ab World  
      ab Here come some tabs: ab      ab      ab      ab      ab      ab      
ab      ab      ab      ab      ab      ab      ab      ab      ab      ab      
ab      ab      ab      ab 
+\par }}
+\pard\plain \ltrpar\ql \li0 i0\sa160\sl259\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f31507fs22lang1025 \ltrchcs0 31506s22\lang1038\langfe1033+ tlchcs1 
f31507 \ltrchcs0 
+\par }
+}
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 2fc4bf2cb10a..b96b66992cef 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -453,6 +453,28 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658b)
         0);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658c)
+{
+    createSwDoc("tdf158658c.rtf");
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+    // Word 2013 puts all tabs into one line, the last 17 of them are off the 
page
+    assertXPath(pXmlDoc, 
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout"_ostr, 1);
+    assertXPath(
+        pXmlDoc,
+        
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabCenter']"_ostr,
+        1);
+    // the right tab is exactly at the margin of the paragraph
+    assertXPath(
+        pXmlDoc,
+        
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr,
+        1);
+    assertXPath(
+        pXmlDoc,
+        
"/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft']"_ostr,
+        20);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf155177)
 {
     createSwDoc("tdf155177-1-min.odt");
diff --git a/sw/source/core/text/portab.hxx b/sw/source/core/text/portab.hxx
index 9ffe7be50651..42c21204c7b7 100644
--- a/sw/source/core/text/portab.hxx
+++ b/sw/source/core/text/portab.hxx
@@ -27,7 +27,7 @@ class SwTabPortion : public SwFixPortion
     const bool m_bAutoTabStop;
 
     // Format() branches either into PreFormat() or PostFormat()
-    bool PreFormat( SwTextFormatInfo &rInf );
+    bool PreFormat(SwTextFormatInfo &rInf, SwTabPortion const*);
 public:
     SwTabPortion( const sal_uInt16 nTabPos, const sal_Unicode cFill, const 
bool bAutoTab = true );
     virtual void Paint( const SwTextPaintInfo &rInf ) const override;
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 3f72f5375000..c34692e0024a 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -345,7 +345,7 @@ bool SwTabPortion::Format( SwTextFormatInfo &rInf )
         return PostFormat( rInf );
     if( pLastTab )
         pLastTab->PostFormat( rInf );
-    return PreFormat( rInf );
+    return PreFormat(rInf, pLastTab);
 }
 
 void SwTabPortion::FormatEOL( SwTextFormatInfo &rInf )
@@ -354,7 +354,7 @@ void SwTabPortion::FormatEOL( SwTextFormatInfo &rInf )
         PostFormat( rInf );
 }
 
-bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
+bool SwTabPortion::PreFormat(SwTextFormatInfo &rInf, SwTabPortion const*const 
pLastTab)
 {
     OSL_ENSURE( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" 
);
 
@@ -396,7 +396,8 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
     // 1. Minimal width does not fit to line anymore.
     // 2. An underflow event was called for the tab portion.
     bool bFull = ( bTabCompat && rInf.IsUnderflow() ) ||
-e 
... etc. - the rest is truncated

Reply via email to