configure.ac                                                     |    4 
 download.lst                                                     |   12 
 external/afdko/UnpackedTarball_afdko.mk                          |    1 
 external/afdko/antlr4-chrono.patch                               |   11 
 external/expat/expat-winapi.patch                                |   15 
 oox/source/export/ThemeExport.cxx                                |   15 
 package/inc/ZipOutputStream.hxx                                  |    2 
 package/source/zipapi/ZipOutputStream.cxx                        |   24 -
 package/source/zippackage/ZipPackage.cxx                         |    6 
 package/source/zippackage/ZipPackageStream.cxx                   |   17 
 sc/source/core/data/patattr.cxx                                  |    6 
 sfx2/source/doc/objserv.cxx                                      |   20 
 svl/source/numbers/zforfind.cxx                                  |    2 
 sw/inc/dbmgr.hxx                                                 |    2 
 sw/qa/extras/uiwriter/data/database-display-hidden-section.fodt  |   60 ++
 sw/qa/extras/uiwriter/data/database-display-hidden-section2.fodt |   60 ++
 sw/qa/extras/uiwriter/data/set-variable-hidden-text.fodt         |  121 +++++
 sw/qa/extras/uiwriter/uiwriter9.cxx                              |  224 
++++++++++
 sw/source/uibase/dbui/dbmgr.cxx                                  |   69 +--
 vcl/headless/svpinst.cxx                                         |    7 
 vcl/inc/headless/svpinst.hxx                                     |    1 
 vcl/inc/salinst.hxx                                              |    4 
 vcl/osx/salinst.cxx                                              |   22 
 vcl/quartz/cgutils.mm                                            |   26 +
 24 files changed, 620 insertions(+), 111 deletions(-)

New commits:
commit 04b6f76f859f7d5e68b124479bd5174e10a944a1
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Oct 13 20:11:30 2025 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:24 2025 +0200

    crashtesting: assert on exporting srgbClr with alpha
    
    Change-Id: I0420aa5c4586ab187772306be9cc1db38b9a6094
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192329
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/oox/source/export/ThemeExport.cxx 
b/oox/source/export/ThemeExport.cxx
index 400e9a09db39..14f313cb2eb3 100644
--- a/oox/source/export/ThemeExport.cxx
+++ b/oox/source/export/ThemeExport.cxx
@@ -889,7 +889,20 @@ bool ThemeExport::writeColorSet(model::Theme const& rTheme)
             model::ThemeColorType eColorType = iterator->second;
             Color aColor = pColorSet->getColor(eColorType);
             mpFS->startElementNS(XML_a, nToken);
-            mpFS->singleElementNS(XML_a, XML_srgbClr, XML_val, 
I32SHEX(sal_Int32(aColor)));
+            if (!aColor.IsTransparent())
+                mpFS->singleElementNS(XML_a, XML_srgbClr, XML_val,
+                                      
I32SHEX(sal_Int32(aColor.GetRGBColor())));
+            else
+            {
+                mpFS->startElementNS(XML_a, XML_srgbClr, XML_val,
+                                     I32SHEX(sal_Int32(aColor.GetRGBColor())));
+
+                // drawingML alpha is a percentage on a 0..100000 scale.
+                sal_Int32 nAlpha = aColor.GetAlpha() * 
oox::drawingml::MAX_PERCENT / 255;
+                mpFS->singleElementNS(XML_a, XML_alpha, XML_val, 
OUString::number(nAlpha));
+
+                mpFS->endElementNS(XML_a, XML_srgbClr);
+            }
             mpFS->endElementNS(XML_a, nToken);
         }
     }
commit 387bc394369d36630852e83f9c7f6c20d479742e
Author:     Xisco Fauli <[email protected]>
AuthorDate: Thu Sep 18 18:16:36 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:24 2025 +0200

    tiff: upgrade to 4.7.1
    
    Downloaded from https://download.osgeo.org/libtiff/tiff-4.7.1.tar.xz
    
    Change-Id: I9eda3018e55e771986968ffacf7081538baf432b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191142
    Reviewed-by: Xisco Fauli <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit b3a027d2b7273478773bd0d8624b70f9a48b0952)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191163
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/download.lst b/download.lst
index d8a8ecd0429c..4e1b35b66a7f 100644
--- a/download.lst
+++ b/download.lst
@@ -651,8 +651,8 @@ LIBPNG_TARBALL := libpng-1.6.50.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-LIBTIFF_SHA256SUM := 
273a0a73b1f0bed640afee4a5df0337357ced5b53d3d5d1c405b936501f71017
-LIBTIFF_TARBALL := tiff-4.7.0.tar.xz
+LIBTIFF_SHA256SUM := 
b92017489bdc1db3a4c97191aa4b75366673cb746de0dce5d7a749d5954681ba
+LIBTIFF_TARBALL := tiff-4.7.1.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
commit 80dfda7b70521b5b4b24d8c0801507b165f4668a
Author:     Michael Stahl <[email protected]>
AuthorDate: Wed Oct 1 15:55:08 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:24 2025 +0200

    configure: openssl 3.0.18 evidently needs perl Time::Piece
    
    Can't locate Time/Piece.pm in @INC (you may need to install the Time::Piece 
module) (@INC entries checked: ...) at Makefile.in line 37.
    
    Change-Id: Ia47eeb971f7bf91972f46be46330f10e64682799
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191735
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 0622d8d160b54b120e3955b6b0e177a2a25ca0d1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191753
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/configure.ac b/configure.ac
index 50615a50a64b..b7533ae55163 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6907,9 +6907,9 @@ if test "$enable_openssl" = "yes" -a 
"$with_system_openssl" != "yes"; then
     # OpenSSL needs that to build
     if test -n "$WSL_ONLY_AS_HELPER"; then
         # OpenSSL is built via spp, FindBin is provided by default, but deps 
might change in future
-        perl_use_string_spp="$perl_use_string_spp ; use FindBin"
+        perl_use_string_spp="$perl_use_string_spp ; use FindBin ; use 
Time::Piece"
     else
-        perl_use_string="$perl_use_string ; use FindBin"
+        perl_use_string="$perl_use_string ; use FindBin ; use Time::Piece"
     fi
 fi
 dnl in WSL_ONLY_AS_HELPER case the test should be done with 
git-bash-provided-perl and not perl from
commit 9d2038b7378c5c8a2cd343f0a8f7aa7637552757
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Sep 16 21:26:24 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:24 2025 +0200

    expat: upgrade to 2.7.2
    
    Downloaded from 
https://github.com/libexpat/libexpat/releases/download/R_2_7_2/expat-2.7.2.tar.xz
    
    Change-Id: Icf4b730291dfecc039024360b36c2fe8adb247fc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191047
    Reviewed-by: Xisco Fauli <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 953f1da9270dc10d4aa7852a91e22e4483751aba)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191055
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/download.lst b/download.lst
index 876dbfd623ff..d8a8ecd0429c 100644
--- a/download.lst
+++ b/download.lst
@@ -111,8 +111,8 @@ ETONYEK_TARBALL := 
libetonyek-0.1.$(ETONYEK_VERSION_MICRO).tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-EXPAT_SHA256SUM := 
354552544b8f99012e5062f7d570ec77f14b412a3ff5c7d8d0dae62c0d217c30
-EXPAT_TARBALL := expat-2.7.1.tar.xz
+EXPAT_SHA256SUM := 
21b778b34ec837c2ac285aef340f9fb5fa063a811b21ea4d2412a9702c88995c
+EXPAT_TARBALL := expat-2.7.2.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/expat/expat-winapi.patch 
b/external/expat/expat-winapi.patch
index fed65644a732..5cef970a2bf2 100644
--- a/external/expat/expat-winapi.patch
+++ b/external/expat/expat-winapi.patch
@@ -1,15 +1,16 @@
 --- misc/expat-2.5.0/lib/expat_external.h      2022-10-25 01:32:54.000000000 
+0900
 +++ misc/build/expat-2.5.0/lib/expat_external.h        2022-10-30 
23:09:47.339459134 +0900
-@@ -88,10 +88,6 @@
- #  ifndef XML_BUILDING_EXPAT
+@@ -88,11 +88,6 @@
+ #    ifndef XML_BUILDING_EXPAT
  /* using Expat from an application */
  
--#    if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! 
defined(__CYGWIN__)
--#      define XMLIMPORT __declspec(dllimport)
--#    endif
+-#      if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__)                     
 \
+-          && ! defined(__CYGWIN__)
+-#        define XMLIMPORT __declspec(dllimport)
+-#      endif
 -
- #  endif
- #endif /* not defined XML_STATIC */
+ #    endif
+ #  endif /* not defined XML_STATIC */
  
 --- misc/expat-2.5.0/lib/xmlparse.c    2022-10-26 00:09:08.000000000 +0900
 +++ misc/build/expat-2.5.0/lib/xmlparse.c      2022-10-30 23:09:01.843006341 
+0900
commit 8c883f4902309549375c12532a9db0bc1bf42c56
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Sep 30 20:48:36 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:24 2025 +0200

    openssl: upgrade to 3.0.18
    
    Downloaded from 
https://github.com/openssl/openssl/releases/download/openssl-3.0.18/openssl-3.0.18.tar.gz
    
    Change-Id: Ie24873924bf8a0f9d3edb37e4e69e2e64b25ce47
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191693
    Reviewed-by: Xisco Fauli <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit b9abb977cbdc90ffc5c60ac5307cede571c168d7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191698
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/download.lst b/download.lst
index ee2469a47a53..876dbfd623ff 100644
--- a/download.lst
+++ b/download.lst
@@ -611,8 +611,8 @@ OPENLDAP_TARBALL := openldap-2.6.10.tgz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-OPENSSL_SHA256SUM := 
dfdd77e4ea1b57ff3a6dbde6b0bdc3f31db5ac99e7fdd4eaf9e1fbb6ec2db8ce
-OPENSSL_TARBALL := openssl-3.0.17.tar.gz
+OPENSSL_SHA256SUM := 
d80c34f5cf902dccf1f1b5df5ebb86d0392e37049e5d73df1b3abae72e4ffe8b
+OPENSSL_TARBALL := openssl-3.0.18.tar.gz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
commit d92ab3d311f75e7d39a27ad8e3f1ee1f5e845f53
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Sep 2 11:52:38 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:24 2025 +0200

    tdf#168159 CRASH: deleting columns and undoing
    
    revert
       commit 68db5b64b8db405f9e6c0368836a8ee671b46830
       Author: Noel Grandin <[email protected]>
       Date:   Sat Jun 28 16:13:53 2025 +0200
       crashtesting ooo120243-1.ods
    and
       commit c8742f36fa2bdc9d23042378f5b587ccda8b54dd
       Author: Noel Grandin <[email protected]>
       Date:   Thu May 22 10:18:48 2025 +0200
       tdf#166684 reduce cost of CellAttributeHelper::registerAndCheck
    
    Change-Id: I4d4442c6927121e7f18e3e08eb1736fa94a896bc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190521
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    (cherry picked from commit 4834c568532ef76e156d56365d704ac68413a0b0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192068
    Reviewed-by: Bayram Çiçek <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 67498a98cc4a..60225c17532a 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -114,10 +114,12 @@ const ScPatternAttr* 
CellAttributeHelper::registerAndCheck(const ScPatternAttr&
         return mpLastHit;
     }
     const OUString* pCandidateStyleName = rCandidate.GetStyleName();
-    auto [it, itEnd] = 
maRegisteredCellAttributes.equal_range(pCandidateStyleName);
-    for (; it != itEnd; ++it)
+    auto it = maRegisteredCellAttributes.lower_bound(pCandidateStyleName);
+    for (; it != maRegisteredCellAttributes.end(); ++it)
     {
         const ScPatternAttr* pCheck = *it;
+        if (CompareStringPtr(pCheck->GetStyleName(), pCandidateStyleName) != 0)
+            break;
         if (ScPatternAttr::areSame(pCheck, &rCandidate))
         {
             pCheck->mnRefCount++;
commit e554204ffc8b81e980fc79c3c0406530ff056b41
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Oct 7 21:14:54 2025 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:24 2025 +0200

    Pre-init NSSpellCHecker to avoid SolarMutex deadlock
    
    in headless vclplug too. Same deadlock can happen in that
    mode as seen originally as:
    
    commit d193d65635de197efe32d97a99540a31a5455c41
    Date:   Thu Sep 8 17:30:38 2022 +0200
    
        tdf#151894 Pre-init NSSpellCHecker to avoid SolarMutex deadlock
    
    current example bts are main on thread 1, vcl launched to run on
    its event loop on 'lo_startmain' side thread.
    
    (lldb) thread backtrace 1
    * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
      * frame #0: 0x00000001966f489c libsystem_kernel.dylib`__psynch_mutexwait 
+ 8
        frame #1: 0x0000000196730e58 
libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_wait + 84
        frame #2: 0x000000019672e840 
libsystem_pthread.dylib`_pthread_mutex_firstfit_lock_slow + 220
        frame #3: 0x0000000105ad554c 
libuno_sal.dylib.3`osl_acquireMutex(pMutex=<unavailable>) at mutex.cxx:99:20
        frame #4: 0x000000015a6e8370 
libmergedlo.dylib`SvpSalYieldMutex::doAcquire(unsigned int) [inlined] 
osl::Mutex::acquire(this=0x00000001497e7ec8) at mutex.hxx:63:20
        frame #5: 0x000000015a6e8368 
libmergedlo.dylib`SvpSalYieldMutex::doAcquire(this=0x00000001497e7ec0, 
nLockCount=1) at svpinst.cxx:357:18
        frame #6: 0x000000015952fda8 
libmergedlo.dylib`doc_saveAs(_LibreOfficeKitDocument*, char const*, char 
const*, char const*) [inlined] 
comphelper::SolarMutex::acquire(this=0x00000001497e7ec0, nLockCount=1) at 
solarmutex.hxx:86:5
        frame #7: 0x000000015952fd98 
libmergedlo.dylib`doc_saveAs(_LibreOfficeKitDocument*, char const*, char 
const*, char const*) [inlined] 
osl::Guard<comphelper::SolarMutex>::Guard(this=<unavailable>, 
t=0x00000001497e7ec0) at mutex.hxx:144:17
        frame #8: 0x000000015952fd98 
libmergedlo.dylib`doc_saveAs(_LibreOfficeKitDocument*, char const*, char 
const*, char const*) [inlined] 
SolarMutexGuard::SolarMutexGuard(this=<unavailable>) at svapp.hxx:1344:11
        frame #9: 0x000000015952fd90 
libmergedlo.dylib`doc_saveAs(_LibreOfficeKitDocument*, char const*, char 
const*, char const*) [inlined] 
SolarMutexGuard::SolarMutexGuard(this=<unavailable>) at svapp.hxx:1344:78
        frame #10: 0x000000015952fd90 
libmergedlo.dylib`doc_saveAs(pThis=0x000060000124a9a0, 
sUrl="/tmp/ErrareHumanumEst.fodg", pFormat="fodg", 
pFilterOptions="{\"DecomposePDF\":{\"type\":\"boolean\",\"value\":\"true\"}}") 
at init.cxx:3698:21
        ...
        frame #32: 0x0000000102965334 main + 228
    (lldb) thread backtrace 11
      thread #11, name = 'lo_startmain'
        frame #0: 0x00000001966f53cc libsystem_kernel.dylib`__psynch_cvwait + 8
        frame #1: 0x00000001967340e0 libsystem_pthread.dylib`_pthread_cond_wait 
+ 984
        frame #2: 0x0000000197ddefd0 Foundation`-[NSOperation 
waitUntilFinished] + 488
        frame #3: 0x00000001967e28f8 CoreFoundation`_CFXNotificationPost + 804
        frame #4: 0x0000000197d9c680 Foundation`-[NSNotificationCenter 
postNotificationName:object:userInfo:] + 88
        frame #5: 0x000000019a737554 AppKit`-[NSMenu insertItem:atIndex:] + 892
        frame #6: 0x000000019a8f1e00 
AppKit`-[NSApplication(NSServicesMenuPrivate) _fillSpellCheckerPopupButton:] + 
1380
        frame #7: 0x000000019a8f1550 AppKit`-[NSSpellChecker 
_fillSpellCheckerPopupButton:] + 76
        frame #8: 0x000000019a8f0688 AppKit`-[NSSpellChecker init] + 248
        frame #9: 0x000000019a8f0580 AppKit`__36+[NSSpellChecker 
sharedSpellChecker]_block_invoke + 20
        frame #10: 0x000000019659585c 
libdispatch.dylib`_dispatch_client_callout + 16
        frame #11: 0x000000019657ea28 libdispatch.dylib`_dispatch_once_callout 
+ 32
        frame #12: 0x000000019a8f0568 AppKit`+[NSSpellChecker 
sharedSpellChecker] + 140
        frame #13: 0x0000000158dbb054 
libmergedlo.dylib`MacSpellChecker::getLocales(this=0x00006000006fc500) at 
macspellimp.mm:118:42
        frame #14: 0x0000000158da1e94 
libmergedlo.dylib`LngSvcMgr::GetAvailableSpellSvcs_Impl(this=0x000000014966e020)
 at lngsvcmgr.cxx:975:63
        frame #15: 0x0000000158da46f8 
libmergedlo.dylib`LngSvcMgr::getAvailableServices(this=0x000000014966e020, 
rServiceName=0x000000015c044600, rLocale=0x000000016e3ae1d0) at 
lngsvcmgr.cxx:1369:9
        frame #16: 0x0000000158d9c434 
libmergedlo.dylib`LngSvcMgr::UpdateAll(this=0x000000014966e020) at 
lngsvcmgr.cxx:655:46
        frame #17: 0x0000000158d9bd38 
libmergedlo.dylib`LngSvcMgr::LngSvcMgr(this=0x000000014966e020) at 
lngsvcmgr.cxx:414:5
        frame #18: 0x0000000158da7a70 
libmergedlo.dylib`::linguistic_LngSvcMgr_get_implementation(com::sun::star::uno::XComponentContext
 *, const com::sun::star::uno::Sequence<com::sun::star::uno::Any> &) [inlined] 
LngSvcMgr::LngSvcMgr(this=0x000000014966e020) at lngsvcmgr.cxx:402:1
        frame #19: 0x0000000158da7a6c 
libmergedlo.dylib`linguistic_LngSvcMgr_get_implementation((null)=<unavailable>, 
(null)=<unavailable>) at lngsvcmgr.cxx:1816:30
        frame #20: 0x000000012dc30ee0 
libuno_cppuhelpergcc3.dylib.3`cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
 const&) [inlined] 
std::__1::__function::__value_func<com::sun::star::uno::XInterface* 
(com::sun::star::uno::XComponentContext*, 
com::sun::star::uno::Sequence<com::sun::star::uno::Any> 
const&)>::operator()[abi:ne190102](this=0x0000000149747c90, 
__args=0x000000016e3ae310, __args=0x000000016e3ae308) const at function.h:430:12
        frame #21: 0x000000012dc30ec4 
libuno_cppuhelpergcc3.dylib.3`cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
 const&) [inlined] std::__1::function<com::sun::star::uno::XInterface* 
(com::sun::star::uno::XComponentContext*, 
com::sun::star::uno::Sequence<com::sun::star::uno::Any> 
const&)>::operator()(this= Function = linguistic_LngSvcMgr_get_implementation , 
__arg=0x0000600000cc86b8, __arg=0x000000016e3ae308) const at function.h:989:10
        frame #22: 0x000000012dc30ec4 
libuno_cppuhelpergcc3.dylib.3`cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(this=0x0000000149747c18,
 context=0x000000015c487110) at servicemanager.cxx:701:13
        frame #23: 0x000000012dc30d4c 
libuno_cppuhelpergcc3.dylib.3`cppuhelper::ServiceManager::Data::Implementation::createInstance(this=0x0000000149747c18,
 context=0x000000015c487110, singletonRequest=false) at 
servicemanager.cxx:666:30
        frame #24: 0x000000012dc34ed8 libuno_cppuhelpergcc3.dylib.3`non-virtual 
thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString 
const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> 
const&) [inlined] 
cppuhelper::ServiceManager::createInstanceWithContext(this=<unavailable>, 
aServiceSpecifier=<unavailable>, Context=0x000000015c487110) at 
servicemanager.cxx:1002:36
        frame #25: 0x000000012dc34eb4 libuno_cppuhelpergcc3.dylib.3`non-virtual 
thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString 
const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> 
const&) at servicemanager.cxx:0
        frame #26: 0x00000001588b29c8 
libmergedlo.dylib`com::sun::star::linguistic2::LinguServiceManager::create(the_context=0x000000015c487110)
 at LinguServiceManager.hpp:38:129
        frame #27: 0x00000001588b3444 libmergedlo.dylib`(anonymous 
namespace)::SpellDummy_Impl::GetSpell_Impl() [inlined] GetLngSvcMgr_Impl() at 
unolingu.cxx:60:52
        frame #28: 0x00000001588b3438 libmergedlo.dylib`(anonymous 
namespace)::SpellDummy_Impl::GetSpell_Impl(this=0x0000600002df4300) at 
unolingu.cxx:216:61
        frame #29: 0x00000001588b3314 libmergedlo.dylib`non-virtual thunk to 
(anonymous namespace)::SpellDummy_Impl::isValid(rtl::OUString const&, short, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) 
[inlined] (anonymous namespace)::SpellDummy_Impl::isValid(this=<unavailable>, 
rWord=<unavailable>, nLanguage=<unavailable>, rProperties=<unavailable>) at 
unolingu.cxx:248:5
        frame #30: 0x00000001588b3310 libmergedlo.dylib`non-virtual thunk to 
(anonymous namespace)::SpellDummy_Impl::isValid(rtl::OUString const&, short, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at 
unolingu.cxx:0
        frame #31: 0x00000001588405ec 
libmergedlo.dylib`ImpEditEngine::DoOnlineSpelling(this=0x0000000149859800, 
pThisNodeOnly=<unavailable>, bSpellAtCursorPos=<unavailable>, 
bInterruptible=<unavailable>) at impedit4.cxx:2480:37
        frame #32: 0x0000000134059498 
libsdlo.dylib`SdDrawDocument::SpellObject(this=0x000000014961cb20, 
pObj=0x0000000149646150) at drawdoc4.cxx:885:16
        frame #33: 0x00000001340591b0 
libsdlo.dylib`SdDrawDocument::OnlineSpellingHdl(this=0x000000014961cb20, 
(null)=<unavailable>) at drawdoc4.cxx:823:17
        frame #34: 0x000000015a52b9b0 
libmergedlo.dylib`Scheduler::CallbackTaskScheduling() at scheduler.cxx:584:20
        frame #35: 0x000000015a6e7bf8 
libmergedlo.dylib`SvpSalInstance::CheckTimeout(bool) [inlined] 
SalTimer::CallCallback(this=<unavailable>) at saltimer.hxx:53:13
        frame #36: 0x000000015a6e7bec 
libmergedlo.dylib`SvpSalInstance::CheckTimeout(this=<unavailable>, 
bExecuteTimers=true) at svpinst.cxx:167:53
        frame #37: 0x000000015a6e863c 
libmergedlo.dylib`SvpSalInstance::ImplYield(this=0x00006000008c50e0, 
bWait=true, bHandleAllCurrentEvents=false) at svpinst.cxx:430:17
        frame #38: 0x000000015a6e8950 
libmergedlo.dylib`SvpSalInstance::DoYield(this=0x00006000008c50e0, bWait=true, 
bHandleAllCurrentEvents=false) at svpinst.cxx:504:21
        frame #39: 0x000000015a53d920 libmergedlo.dylib`ImplYield(i_bWait=true, 
i_bAllEvents=false) at svapp.cxx:389:48
        frame #40: 0x000000015a53d328 libmergedlo.dylib`Application::Yield() at 
svapp.cxx:492:5 [artificial]
        frame #41: 0x000000015a53d210 libmergedlo.dylib`Application::Execute() 
at svapp.cxx:364:13
        frame #42: 0x00000001594ffeb4 
libmergedlo.dylib`desktop::Desktop::Main(this=0x000000016e3aeed0) at 
app.cxx:1680:13
        frame #43: 0x000000015a5475d0 libmergedlo.dylib`ImplSVMain() at 
svmain.cxx:228:35
        frame #44: 0xffffffffffffffff libmergedlo.dylib`SVMain()
        frame #45: 0x000000015951e5e4 libmergedlo.dylib`soffice_main at 
sofficemain.cxx:121:12
        frame #46: 0x00000001595669bc 
libmergedlo.dylib`lo_startmain((null)=<unavailable>) at init.cxx:7860:5
        frame #47: 0x0000000105ae59d8 
libuno_sal.dylib.3`osl_thread_start_Impl(pData=0x00006000005cb330) at 
thread.cxx:240:9
        frame #48: 0x0000000196733c0c libsystem_pthread.dylib`_pthread_start + 
136
    
    Change-Id: I8d25ed364f131434ce4f738604ddcf3f586cf6d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192052
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 267c5335a896..4220f5224ff6 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -106,6 +106,13 @@ SvpSalInstance::SvpSalInstance( 
std::unique_ptr<SalYieldMutex> pMutex )
 #endif
 }
 
+void SvpSalInstance::AfterAppInit()
+{
+#if defined(MACOSX)
+    SalInstance::MacStartupWorkarounds();
+#endif
+}
+
 SvpSalInstance::~SvpSalInstance()
 {
     if( s_pDefaultInstance == this )
diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx
index f3d9205a8981..e600259829b9 100644
--- a/vcl/inc/headless/svpinst.hxx
+++ b/vcl/inc/headless/svpinst.hxx
@@ -110,6 +110,7 @@ public:
     static SvpSalInstance*  s_pDefaultInstance;
 
     SvpSalInstance( std::unique_ptr<SalYieldMutex> pMutex );
+    virtual void AfterAppInit() override;
     virtual ~SvpSalInstance() override;
 
     SAL_DLLPRIVATE bool ImplYield(bool bWait, bool bHandleAllCurrentEvents);
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index b8549b23fc5f..f3af5cf3794d 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -83,6 +83,10 @@ protected:
     bool m_bSupportsBitmap32 = false;
     bool m_bSupportsOpenGL = false;
 
+#ifdef MACOSX
+    static void MacStartupWorkarounds();
+#endif
+
 public:
     SalInstance(std::unique_ptr<comphelper::SolarMutex> pMutex);
     virtual ~SalInstance();
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 6d6cb6d49989..85202f7cf765 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -212,27 +212,7 @@ void AquaSalInstance::AfterAppInit()
                                            object: nil ];
 #endif
 
-    // HACK: When the first call to [NSSpellChecker sharedSpellChecker] (in
-    // lingucomponent/source/spellcheck/macosxspell/macspellimp.mm) is done 
both on a thread other
-    // than the main thread and with the SolarMutex erroneously locked, then 
that can lead to
-    // deadlock as [NSSpellChecker sharedSpellChecker] internally calls
-    //   AppKit`-[NSSpellChecker init] ->
-    //   AppKit`-[NSSpellChecker _fillSpellCheckerPopupButton:] ->
-    //   AppKit`-[NSApplication(NSServicesMenuPrivate) 
_fillSpellCheckerPopupButton:] ->
-    //   AppKit`-[NSMenu insertItem:atIndex:] ->
-    //   Foundation`-[NSNotificationCenter 
postNotificationName:object:userInfo:] ->
-    //   CoreFoundation`_CFXNotificationPost ->
-    //   Foundation`-[NSOperation waitUntilFinished]
-    // waiting for work to be done on the main thread, but the main thread is 
typically already
-    // blocked (in some event handling loop) waiting to acquire the 
SolarMutex.  The real solution
-    // would be to fix all the cases where a call to [NSSpellChecker 
sharedSpellChecker] in
-    // lingucomponent/source/spellcheck/macosxspell/macspellimp.mm is done 
while the SolarMutex is
-    // locked (somewhere up the call chain), but that appears to be rather 
difficult (see e.g.
-    // <https://bugs.documentfoundation.org/show_bug.cgi?id=151894> "FILEOPEN 
a Base Document with
-    // customized event for open a startform by 'open document' LO stuck").  
So, at least for now,
-    // chicken out and do that first call to [NSSpellChecker 
sharedSpellChecker] upfront in a
-    // controlled environment:
-    [NSSpellChecker sharedSpellChecker];
+    SalInstance::MacStartupWorkarounds();
 }
 
 SalYieldMutex::SalYieldMutex()
diff --git a/vcl/quartz/cgutils.mm b/vcl/quartz/cgutils.mm
index 50b7fcd6540c..f32df8f44772 100644
--- a/vcl/quartz/cgutils.mm
+++ b/vcl/quartz/cgutils.mm
@@ -20,6 +20,7 @@
 #include <quartz/cgutils.h>
 
 #include <salbmp.hxx>
+#include <salinst.hxx>
 #ifdef MACOSX
 #include <osx/saldata.hxx>
 #else
@@ -136,6 +137,31 @@ bool DefaultMTLDeviceIsSupported()
     return bRet;
 }
 
+void SalInstance::MacStartupWorkarounds()
+{
+    // HACK: When the first call to [NSSpellChecker sharedSpellChecker] (in
+    // lingucomponent/source/spellcheck/macosxspell/macspellimp.mm) is done 
both on a thread other
+    // than the main thread and with the SolarMutex erroneously locked, then 
that can lead to
+    // deadlock as [NSSpellChecker sharedSpellChecker] internally calls
+    //   AppKit`-[NSSpellChecker init] ->
+    //   AppKit`-[NSSpellChecker _fillSpellCheckerPopupButton:] ->
+    //   AppKit`-[NSApplication(NSServicesMenuPrivate) 
_fillSpellCheckerPopupButton:] ->
+    //   AppKit`-[NSMenu insertItem:atIndex:] ->
+    //   Foundation`-[NSNotificationCenter 
postNotificationName:object:userInfo:] ->
+    //   CoreFoundation`_CFXNotificationPost ->
+    //   Foundation`-[NSOperation waitUntilFinished]
+    // waiting for work to be done on the main thread, but the main thread is 
typically already
+    // blocked (in some event handling loop) waiting to acquire the 
SolarMutex.  The real solution
+    // would be to fix all the cases where a call to [NSSpellChecker 
sharedSpellChecker] in
+    // lingucomponent/source/spellcheck/macosxspell/macspellimp.mm is done 
while the SolarMutex is
+    // locked (somewhere up the call chain), but that appears to be rather 
difficult (see e.g.
+    // <https://bugs.documentfoundation.org/show_bug.cgi?id=151894> "FILEOPEN 
a Base Document with
+    // customized event for open a startform by 'open document' LO stuck").  
So, at least for now,
+    // chicken out and do that first call to [NSSpellChecker 
sharedSpellChecker] upfront in a
+    // controlled environment:
+    [NSSpellChecker sharedSpellChecker];
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5b42a61ceda61200d4693070a57988b5ba373d2f
Author:     Tor Lillqvist <[email protected]>
AuthorDate: Mon Sep 29 15:54:55 2025 +0300
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:23 2025 +0200

    Need to include <chrono> to build afdko with current Visual Studio 2022
    
    Presumably it gets included indirectly in earlier versions of Visual
    Studio, as this afdko thing passed CI.
    
    Change-Id: I0587ad7e9f3b59281cd7d493e7164f3e8901a6d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191952
    Tested-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/external/afdko/UnpackedTarball_afdko.mk 
b/external/afdko/UnpackedTarball_afdko.mk
index bb7e6b18feec..0fe01b7a69b1 100644
--- a/external/afdko/UnpackedTarball_afdko.mk
+++ b/external/afdko/UnpackedTarball_afdko.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,afdko, \
     external/afdko/extern_makeotf.patch \
     external/afdko/warnings.patch \
     external/afdko/mergeFonts_crash.patch \
+    external/afdko/antlr4-chrono.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/afdko/antlr4-chrono.patch 
b/external/afdko/antlr4-chrono.patch
new file mode 100644
index 000000000000..08fe4fdd96eb
--- /dev/null
+++ b/external/afdko/antlr4-chrono.patch
@@ -0,0 +1,11 @@
+--- afdko/a4/runtime/src/atn/ProfilingATNSimulator.cpp
++++ afdko/a4/runtime/src/atn/ProfilingATNSimulator.cpp
+@@ -11,6 +11,8 @@
+ 
+ #include "atn/ProfilingATNSimulator.h"
+ 
++#include <chrono>
++
+ using namespace antlr4;
+ using namespace antlr4::atn;
+ using namespace antlr4::dfa;
commit b15544fae48fedba1155bda7b7c75e1b5d812b52
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Sep 21 14:48:08 2025 +0500
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:23 2025 +0200

    ImpSvNumberInputScan::StringToDouble doesn't handle scientific notation
    
    Pass respective flags to from_chars, which may shave a cycle or two :-)
    
    Change-Id: I9eec84548ec9b17e7ce403a9a9befab732c30977
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191286
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit 0410842d9f2b3a8de2112e0224c76628656be60f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191302
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 8e18d86d3d98..df8308b69f1f 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -177,7 +177,7 @@ double ImpSvNumberInputScan::StringToDouble( 
std::u16string_view aStr, bool bFor
 
     double result = 0;
     (void)fast_float::from_chars(
-        buf, p, result, fast_float::chars_format::general | 
fast_float::chars_format::no_infnan);
+        buf, p, result, fast_float::chars_format::fixed | 
fast_float::chars_format::no_infnan);
     return result;
 }
 
commit dda653ef48aea05c8d7cfcb4f729f33536dce6c5
Author:     Michael Stahl <[email protected]>
AuthorDate: Wed Sep 17 21:01:28 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:23 2025 +0200

    sw: fix "Export Directly as PDF" with set-variable fields in hidden text
    
    ... results in wrong conditional text fields.
    
    First, add a testHiddenSectionPDFExport2 for the bug that was fixed with
    commit 1e007e8f1703851b01c68884e87c906f6bae5a5e - and
    testHiddenSectionPDFExport for a slightly different scenario that also
    failed.
    
    Investigating this, it turns out that the conditions are only evaluated
    properly inside SwDBManager::Merge(), because this sets up its
    m_pImpl->pMergeData, and without that SwCalc::VarLook() will not know
    which record is currently selected and return SbxVoid (if there is no
    xConnection) or a wrong record (if there is a xConnection).
    
    There is even code in SwDBManager::Merge() that tries to store the new
    state in m_DataSourceParams so that later SwCalc are able to use it, but
    this broke in 2007 with commit d06a6d2c192076870d67f19653701fdc25d9841c
    which changed SwNewDBMgr::FindDSData() to return the m_pImpl->pMergeData
    instead of a m_DataSourceParams entry, and thus the *pTemp assignment
    became self-assignment.
    
    Also, FindDSData(bCreate=true) already does everything that this code
    was doing anyway, so if we just call that *before* creating
    m_pImpl->pMergeData we can delete all that code.
    
    Now another problem becomes apparent: an obvious mismatch between how
    SwDBManager::GetColumnCnt() and lcl_MoveAbsolute() treat
    SwDSParam::aSelection - in the caller the nAbsRecordId is an index that
    is *contained* in aSelection (see explicit search with std::any_of), in
    the callee it is an index *into* aSelection.
    
    Apparently this is a regression from commit
    f5ccfd60c2c5dab392d58870fbd079a6286bc239 and testing reveals that for
    tdf#73025 the lcl_MoveAbsolute() is never called from GetColumnCnt(),
    but only from SwDBManager::ToRecordId(), so let's have 2 different
    functions for callers expecting different behaviour.
    
    Then revert 1e007e8f1703851b01c68884e87c906f6bae5a5e as this scenario
    works with the above described fixes.
    
    Add a testHiddenTextFieldPDFExport for the new bug.
    
    Change-Id: Ibca38edec8782c06a61d4eb5c9065098de8562fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191104
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 7978401cfcdd68536b47f2dfcf4799a5dcbdd22f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191738
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 6a97e49fb6ff..1ce86a925767 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1133,20 +1133,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                     SfxViewShell::Current()->SetStoringHelper(xHelper);
 
                 QueryHiddenInformation(bIsPDFExport ? 
HiddenWarningFact::WhenCreatingPDF : HiddenWarningFact::WhenSaving);
-                SfxPoolItemHolder aItem;
-                if (SID_DIRECTEXPORTDOCASPDF == nId)
-                    aItem = GetSlotState(SID_MAIL_PREPAREEXPORT);
-                const SfxBoolItem* pItem(dynamic_cast<const 
SfxBoolItem*>(aItem.getItem()));
-
-                // Fetch value from the pool item early, because 
GUIStoreModel() can free the pool
-                // item as part of spinning the main loop if a dialog is 
opened.
-                const bool bMailPrepareExport(nullptr != pItem && 
pItem->GetValue());
-                if (bMailPrepareExport)
-                {
-                    SfxRequest aRequest(SID_MAIL_PREPAREEXPORT, 
SfxCallMode::SYNCHRON, GetPool());
-                    aRequest.AppendItem(SfxBoolItem(FN_NOUPDATE, true));
-                    ExecuteSlot(aRequest);
-                }
 
                 xHelper->GUIStoreModel( GetModel(),
                                        pSlot->GetUnoName(),
@@ -1155,12 +1141,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                                        GetDocumentSignatureState(),
                                        bIsAsync );
 
-                if (bMailPrepareExport)
-                {
-                    SfxRequest aRequest(SID_MAIL_EXPORT_FINISHED, 
SfxCallMode::SYNCHRON, GetPool());
-                    ExecuteSlot(aRequest);
-                }
-
                 // merge aDispatchArgs to the request
                 SfxAllItemSet aResultParams( GetPool() );
                 TransformParameters( nId,
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index b48749696d74..0fb132b2a972 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -359,7 +359,7 @@ public:
                             OUString& rResult, double* pNumber);
     /** create and store or find an already stored connection to a data source 
for use
     in SwFieldMgr and SwDBTreeList */
-    css::uno::Reference< css::sdbc::XConnection> const &
+    SW_DLLPUBLIC css::uno::Reference<css::sdbc::XConnection> const&
                     RegisterConnection(OUString const& rSource);
 
     void            CreateDSData(const SwDBData& rData)
diff --git a/sw/qa/extras/uiwriter/data/database-display-hidden-section.fodt 
b/sw/qa/extras/uiwriter/data/database-display-hidden-section.fodt
new file mode 100644
index 000000000000..09fac66f6f11
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/database-display-hidden-section.fodt
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:d
 r3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" 
svg:font-family="&apos;Liberation Serif&apos;" 
style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Lohit Devanagari" svg:font-family="&apos;Lohit 
Devanagari&apos;" style:font-family-generic="system" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Serif CN" 
svg:font-family="&apos;Source Han Serif CN&apos;" 
style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" 
draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" 
draw:start-line-spacing-vertical="0.283cm" 
draw:end-line-spacing-horizontal="0.283cm" 
draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" 
fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han 
Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" 
style:country-asian="CN" style:font-name-complex="Lohit Devanagari" 
style:font-size-complex="12pt" style:language-complex="hi" 
style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" 
style:punctuation-wrap="hanging" style:line-break="strict" 
style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" 
fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han 
Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" 
style:country-asian="CN" style:font-name-complex="Lohit Devanagari" 
style:font-size-complex="12pt" style:language-complex="hi" 
style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+ </office:styles>
+ <office:automatic-styles>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="21.001cm" 
fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" 
fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" 
fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" 
style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="false" style:layout-grid-display="false" 
style:footnote-max-height="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+    <style:style style:name="Sect1" style:family="section">
+      <style:section-properties style:editable="false">
+        <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+      </style:section-properties>
+    </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+
+      <text:p text:style-name="Standard">
+        <text:database-display text:table-name="biblio" 
text:table-type="table" text:column-name="Custom1" 
text:database-name="Bibliography">&lt;Custom1&gt;</text:database-display>
+      </text:p>
+      <text:p text:style-name="Standard"/>
+      <text:section text:style-name="Sect1" text:name="Section1" 
text:condition="ooow:Bibliography.biblio.Custom1==&quot;English&quot;" 
text:is-hidden="true" text:display="condition">
+        <text:p text:style-name="Standard"/>
+        <text:p text:style-name="Standard">Section cachée si "Custom1" = 
"English"</text:p>
+      </text:section>
+
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/data/database-display-hidden-section2.fodt 
b/sw/qa/extras/uiwriter/data/database-display-hidden-section2.fodt
new file mode 100644
index 000000000000..d7860b9420e4
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/database-display-hidden-section2.fodt
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:d
 r3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" 
svg:font-family="&apos;Liberation Serif&apos;" 
style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Lohit Devanagari" svg:font-family="&apos;Lohit 
Devanagari&apos;" style:font-family-generic="system" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Serif CN" 
svg:font-family="&apos;Source Han Serif CN&apos;" 
style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" 
draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" 
draw:start-line-spacing-vertical="0.283cm" 
draw:end-line-spacing-horizontal="0.283cm" 
draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" 
fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han 
Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" 
style:country-asian="CN" style:font-name-complex="Lohit Devanagari" 
style:font-size-complex="12pt" style:language-complex="hi" 
style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" 
style:punctuation-wrap="hanging" style:line-break="strict" 
style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" 
fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han 
Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" 
style:country-asian="CN" style:font-name-complex="Lohit Devanagari" 
style:font-size-complex="12pt" style:language-complex="hi" 
style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+ </office:styles>
+ <office:automatic-styles>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="21.001cm" 
fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" 
fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" 
fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" 
style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="false" style:layout-grid-display="false" 
style:footnote-max-height="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+    <style:style style:name="Sect1" style:family="section">
+      <style:section-properties style:editable="false">
+        <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+      </style:section-properties>
+    </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+
+      <text:p text:style-name="Standard">
+        <text:database-display text:table-name="biblio" 
text:table-type="table" text:column-name="Custom1" 
text:database-name="Bibliography2">&lt;Custom1&gt;</text:database-display>
+      </text:p>
+      <text:p text:style-name="Standard"/>
+      <text:section text:style-name="Sect1" text:name="Section1" 
text:condition="ooow:Bibliography2.biblio.Custom1==&quot;English&quot;" 
text:is-hidden="true" text:display="condition">
+        <text:p text:style-name="Standard"/>
+        <text:p text:style-name="Standard">Section cachée si "Custom1" = 
"English"</text:p>
+      </text:section>
+
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/data/set-variable-hidden-text.fodt 
b/sw/qa/extras/uiwriter/data/set-variable-hidden-text.fodt
new file mode 100644
index 000000000000..576604298b33
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/set-variable-hidden-text.fodt
@@ -0,0 +1,121 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:initial-creator>gcc</meta:initial-creator><meta:creation-date>2025-09-18T14:40:00.300148362</meta:creation-date><dc:date>2025-09-18T14:40:40.278151245</dc:date><dc:creator>gcc</dc:creator><meta:editing-duration>PT41S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic
 meta:table-count="0" meta:image-count="0" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="1" meta:word-count="1" 
meta:character-count="8" 
meta:non-whitespace-character-count="8"/><meta:generator>LibreOfficeDev/26.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/7954f6cb07c7219cff788ad9e6c4809ceef8f690</meta:generator></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation 
Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Lucida Sans1" svg:font-family="'Lucida Sans'" 
style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif 
CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" 
draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" 
draw:start-line-spacing-vertical="0.283cm" 
draw:end-line-spacing-horizontal="0.283cm" 
draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" loext:tab-stop-distance="0cm" 
style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="de" fo:country="DE" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" 
loext:hyphenation-keep-type="column" loext:hyphenation-keep-line="false" 
style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" 
style:line-break="strict" style:tab-stop-distance="1.251cm" 
style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="de" fo:country="DE" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" 
loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.499cm" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+  </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties text:display="none"/>
+  </style:style>
+  <style:style style:name="P2" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="10.5cm" 
fo:page-height="14.801cm" style:num-format="1" 
style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" 
fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <number:number-style style:name="N0">
+   <number:number number:min-integer-digits="1"/>
+  </number:number-style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+  </office:master-styles>
+ <office:body>
+  <office:text>
+   <text:variable-decls>
+    <text:variable-decl office:value-type="float" text:name="foo"/>
+   </text:variable-decls>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="P1"><text:variable-set text:name="foo" 
office:value-type="float" office:value="2" 
style:data-style-name="N0">2</text:variable-set></text:p>
+   <text:p text:style-name="P2"><text:conditional-text 
text:condition="ooow:foo==2" text:string-value-if-true="Expected" 
text:string-value-if-false="Fail">Expected</text:conditional-text></text:p>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 2f6fa8f1d9ec..e7dabb391b37 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -59,6 +59,8 @@
 #include <IDocumentLinksAdministration.hxx>
 #include <fmtinfmt.hxx>
 #include <rootfrm.hxx>
+#include <dbmgr.hxx>
+#include <mmconfigitem.hxx>
 #include <svx/svxids.hrc>
 #include <pagefrm.hxx>
 #include <svx/svdview.hxx>
@@ -351,6 +353,228 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, 
testPasteTableInMiddleOfParagraph)
                          
pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testHiddenSectionPDFExport)
+{
+    // this uses biblio.odb
+    createSwDoc("database-display-hidden-section.fodt");
+
+    uno::Reference<text::XTextSectionsSupplier> 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xSections(xTextSectionsSupplier->getTextSections(),
+                                                      uno::UNO_QUERY);
+    uno::Reference<text::XTextSection> xSection(xSections->getByIndex(0), 
uno::UNO_QUERY);
+
+    // apparently without a record it evaluates to hidden?
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsVisible"));
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    // somehow a timer that constructs toolbars isn't run in unit tests -
+    // it would query state of .uno:MailMergeEmailDocuments which as a side
+    // effect (!) calls this:
+    getSwDocShell()->GetView()->EnsureMailMergeConfigItem();
+
+    dispatchCommand(mxComponent, u".uno:MailMergeNextEntry"_ustr, {});
+    getParagraph(1, "English ");
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    dispatchCommand(mxComponent, u".uno:MailMergeNextEntry"_ustr, {});
+    getParagraph(1, "English ");
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    uno::Sequence<css::beans::PropertyValue> args{
+        comphelper::makePropertyValue(u"SynchronMode"_ustr, true),
+        comphelper::makePropertyValue(u"URL"_ustr, maTempFile.GetURL())
+    };
+    dispatchCommand(mxComponent, u".uno:ExportDirectToPDF"_ustr, args);
+
+    // fetch again in case it was deleted and undo
+    xSection.set(xSections->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+
+    int nObjectsHidden;
+    if (pPDFium)
+    {
+        SvFileStream aPDFFile(maTempFile.GetURL(), StreamMode::READ);
+        SvMemoryStream aMemory;
+        aMemory.WriteStream(aPDFFile);
+
+        std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+            = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), 
OString());
+        CPPUNIT_ASSERT(pPdfDocument);
+        CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+
+        std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = 
pPdfDocument->openPage(0);
+        CPPUNIT_ASSERT(pPdfPage);
+        nObjectsHidden = pPdfPage->getObjectCount();
+    }
+
+    dispatchCommand(mxComponent, u".uno:MailMergeNextEntry"_ustr, {});
+    getParagraph(1, "Deutsch ");
+    CPPUNIT_ASSERT(getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    dispatchCommand(mxComponent, u".uno:ExportDirectToPDF"_ustr, args);
+
+    // fetch again in case it was deleted and undo
+    xSection.set(xSections->getByIndex(0), uno::UNO_QUERY);
+    // the problem was that PDF export hid the section
+    CPPUNIT_ASSERT(getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    if (pPDFium)
+    {
+        SvFileStream aPDFFile(maTempFile.GetURL(), StreamMode::READ);
+        SvMemoryStream aMemory;
+        aMemory.WriteStream(aPDFFile);
+
+        std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+            = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), 
OString());
+        CPPUNIT_ASSERT(pPdfDocument);
+        CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+
+        std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = 
pPdfDocument->openPage(0);
+        CPPUNIT_ASSERT(pPdfPage);
+        // there must be more objects on the page now (currently goes 2->3)
+        CPPUNIT_ASSERT_LESS(pPdfPage->getObjectCount(), nObjectsHidden);
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testHiddenSectionPDFExport2)
+{
+    // this uses biblio.odb
+    createSwDoc("database-display-hidden-section2.fodt");
+
+    uno::Reference<text::XTextSectionsSupplier> 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xSections(xTextSectionsSupplier->getTextSections(),
+                                                      uno::UNO_QUERY);
+    uno::Reference<text::XTextSection> xSection(xSections->getByIndex(0), 
uno::UNO_QUERY);
+
+    // apparently without a record it evaluates to hidden?
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsVisible"));
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    // somehow a timer that constructs toolbars isn't run in unit tests -
+    // it would query state of .uno:MailMergeEmailDocuments which as a side
+    // effect (!) calls this:
+    auto pMMConfig = getSwDocShell()->GetView()->EnsureMailMergeConfigItem();
+
+    // ... but the file has wrong DB name so we first have to fix it
+    // in the same way as SwChangeDBDlg
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+    pWrtShell->GetDBManager()->RegisterConnection("Bibliography");
+    SwDBData data;
+    data.sDataSource = "Bibliography";
+    data.sCommand = "biblio";
+    pWrtShell->ChgDBData(data);
+    // this would be called via a SwXTextView listener
+    pMMConfig->updateCurrentDBDataFromDocument();
+    pWrtShell->ChangeDBFields({ u"Bibliography2ÿbiblioÿ0"_ustr }, 
u"Bibliographyÿbiblioÿ0"_ustr);
+
+    dispatchCommand(mxComponent, u".uno:MailMergeNextEntry"_ustr, {});
+    getParagraph(1, "English ");
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    dispatchCommand(mxComponent, u".uno:MailMergeNextEntry"_ustr, {});
+    getParagraph(1, "English ");
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    uno::Sequence<css::beans::PropertyValue> args{
+        comphelper::makePropertyValue(u"SynchronMode"_ustr, true),
+        comphelper::makePropertyValue(u"URL"_ustr, maTempFile.GetURL())
+    };
+    dispatchCommand(mxComponent, u".uno:ExportDirectToPDF"_ustr, args);
+
+    // fetch again in case it was deleted and undo
+    xSection.set(xSections->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(!getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+
+    int nObjectsHidden;
+    if (pPDFium)
+    {
+        SvFileStream aPDFFile(maTempFile.GetURL(), StreamMode::READ);
+        SvMemoryStream aMemory;
+        aMemory.WriteStream(aPDFFile);
+
+        std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+            = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), 
OString());
+        CPPUNIT_ASSERT(pPdfDocument);
+        CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+
+        std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = 
pPdfDocument->openPage(0);
+        CPPUNIT_ASSERT(pPdfPage);
+        nObjectsHidden = pPdfPage->getObjectCount();
+    }
+
+    dispatchCommand(mxComponent, u".uno:MailMergeNextEntry"_ustr, {});
+    getParagraph(1, "Deutsch ");
+    CPPUNIT_ASSERT(getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    dispatchCommand(mxComponent, u".uno:ExportDirectToPDF"_ustr, args);
+
+    // fetch again in case it was deleted and undo
+    xSection.set(xSections->getByIndex(0), uno::UNO_QUERY);
+    // the problem was that PDF export hid the section
+    CPPUNIT_ASSERT(getProperty<bool>(xSection, "IsCurrentlyVisible"));
+
+    if (pPDFium)
+    {
+        SvFileStream aPDFFile(maTempFile.GetURL(), StreamMode::READ);
+        SvMemoryStream aMemory;
+        aMemory.WriteStream(aPDFFile);
+
+        std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+            = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), 
OString());
+        CPPUNIT_ASSERT(pPdfDocument);
+        CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+
+        std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = 
pPdfDocument->openPage(0);
+        CPPUNIT_ASSERT(pPdfPage);
+        // there must be more objects on the page now (currently goes 2->3)
+        CPPUNIT_ASSERT_LESS(pPdfPage->getObjectCount(), nObjectsHidden);
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testHiddenTextFieldPDFExport)
+{
+    createSwDoc("set-variable-hidden-text.fodt");
+
+    getParagraph(1, "2");
+    getParagraph(2, "Expected");
+
+    uno::Sequence<css::beans::PropertyValue> args{
+        comphelper::makePropertyValue(u"SynchronMode"_ustr, true),
+        comphelper::makePropertyValue(u"URL"_ustr, maTempFile.GetURL())
+    };
+    dispatchCommand(mxComponent, u".uno:ExportDirectToPDF"_ustr, args);
+
+    getParagraph(1, "2");
+    // the problem was that this changed to Wrong
+    getParagraph(2, "Expected");
+
+    std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+    if (pPDFium)
+    {
+        SvFileStream aPDFFile(maTempFile.GetURL(), StreamMode::READ);
+        SvMemoryStream aMemory;
+        aMemory.WriteStream(aPDFFile);
+
+        std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+            = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), 
OString());
+        CPPUNIT_ASSERT(pPdfDocument);
+        CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+
+        std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = 
pPdfDocument->openPage(0);
+        CPPUNIT_ASSERT(pPdfPage);
+        std::unique_ptr<vcl::pdf::PDFiumTextPage> pPdfTextPage = 
pPdfPage->getTextPage();
+        CPPUNIT_ASSERT(pPdfTextPage);
+        std::unique_ptr<vcl::pdf::PDFiumPageObject> pPageObject = 
pPdfPage->getObject(0);
+        OUString sText = pPageObject->getText(pPdfTextPage);
+        // the problem was that this changed to Wrong
+        CPPUNIT_ASSERT_EQUAL(u"Expected"_ustr, sText);
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf111969)
 {
     // given a document with a field surrounded by N-dashes (–date–)
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 0fb2a04e2674..ed7e4e82ed6b 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -356,29 +356,44 @@ static bool lcl_MoveAbsolute(SwDSParam* pParam, 
tools::Long nAbsPos)
     bool bRet = false;
     try
     {
-        if(pParam->aSelection.hasElements())
+        if(pParam->bScrollable)
         {
-            if(pParam->aSelection.getLength() <= nAbsPos)
+            bRet = pParam->xResultSet->absolute( nAbsPos );
+        }
+        else
+        {
+            OSL_FAIL("no absolute positioning available");
+        }
+    }
+    catch(const uno::Exception&)
+    {
+    }
+    return bRet;
+}
+
+static bool lcl_MoveSelectionOrAbsolute(SwDSParam *const pParam, tools::Long 
const nAbsPos)
+{
+    bool bRet = false;
+    try
+    {
+        if (pParam->aSelection.hasElements())
+        {
+            if (pParam->aSelection.getLength() <= nAbsPos)
             {
                 pParam->bEndOfDB = true;
-                bRet = false;
             }
             else
             {
                 pParam->nSelectionIndex = nAbsPos;
                 sal_Int32 nPos = 0;
                 pParam->aSelection.getConstArray()[ pParam->nSelectionIndex ] 
>>= nPos;
-                pParam->bEndOfDB = !pParam->xResultSet->absolute( nPos );
-                bRet = !pParam->bEndOfDB;
+                pParam->bEndOfDB = !pParam->xResultSet->absolute(nPos);
             }
-        }
-        else if(pParam->bScrollable)
-        {
-            bRet = pParam->xResultSet->absolute( nAbsPos );
+            bRet = !pParam->bEndOfDB;
         }
         else
         {
-            OSL_FAIL("no absolute positioning available");
+            bRet = lcl_MoveAbsolute(pParam, nAbsPos);
         }
     }
     catch(const uno::Exception&)
@@ -483,33 +498,13 @@ bool SwDBManager::Merge( const SwMergeDescriptor& 
rMergeDesc )
         return false;
     }
 
+    SwDSParam *const pTemp{FindDSData(aData, true)};
+    assert(pTemp && pTemp != m_pImpl->pMergeData.get());
     m_pImpl->pMergeData.reset(new SwDSParam(aData, xResSet, aSelection));
-    SwDSParam*  pTemp = FindDSData(aData, false);
-    if(pTemp)
-        *pTemp = *m_pImpl->pMergeData;
-    else
-    {
-        // calls from the calculator may have added a connection with an 
invalid commandtype
-        //"real" data base connections added here have to re-use the already 
available
-        //DSData and set the correct CommandType
-        aData.nCommandType = -1;
-        pTemp = FindDSData(aData, false);
-        if(pTemp)
-            *pTemp = *m_pImpl->pMergeData;
-        else
-        {
-            
m_DataSourceParams.push_back(std::make_unique<SwDSParam>(*m_pImpl->pMergeData));
-            try
-            {
-                uno::Reference<lang::XComponent> 
xComponent(m_DataSourceParams.back()->xConnection, uno::UNO_QUERY);
-                if(xComponent.is())
-                    xComponent->addEventListener(m_pImpl->m_xDisposeListener);
-            }
-            catch(const uno::Exception&)
-            {
-            }
-        }
-    }
+    // assign state with selection to existing entry in m_DataSourceParams
+    // so later SwCalc can find correct record
+    *pTemp = *m_pImpl->pMergeData;
+
     if(!m_pImpl->pMergeData->xConnection.is())
         m_pImpl->pMergeData->xConnection = xConnection;
     // add an XEventListener
@@ -2310,7 +2305,7 @@ bool SwDBManager::ToRecordId(sal_Int32 nSet)
     bool bRet = false;
     sal_Int32 nAbsPos = nSet;
     assert(nAbsPos >= 0);
-    bRet = lcl_MoveAbsolute(m_pImpl->pMergeData.get(), nAbsPos);
+    bRet = lcl_MoveSelectionOrAbsolute(m_pImpl->pMergeData.get(), nAbsPos);
     m_pImpl->pMergeData->bEndOfDB = !bRet;
     return bRet;
 }
commit 06d2253e79890c3521e4178bc9697612824173e1
Author:     Michael Stahl <[email protected]>
AuthorDate: Fri Sep 19 20:06:14 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 15 10:45:23 2025 +0200

    tdf#167205 package: fix writing Zip64 local headers
    
    This would be reported on reading as an 8-byte gap at the position where
    a 32-bit DD for the entry would end.
    
    The problem is that if flag bit 3 is set, and the uncompressed size
    exceeds 2^32, writeDataDescriptor() will write 8-byte sizes, but the
    Zip64 extension header is missing - the latter should also write 0 even
    though the APPNOTE doens't appear to require it.
    
          4.3.9.2 [...] When extracting, if
          the zip64 extended information extra field is present for
          the file the compressed and uncompressed sizes will be 8
          byte values.
    
    Also make sure that the ZipEntry nSize member actually contains the
    uncompressed size, which is somewhat tricky, but is required in
    writeLOC() to check if Zip64 is needed.  (Assume that the DEFLATEd size
    is never larger than uncompressed, which is true for every XML file).
    
    Change-Id: I611e6ffda12d8e6953e9306dc4a4407be8e725a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191185
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit abfdc11fa45610f38d00999f66416c66a868426a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191736
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx
index 5b04a0e41dc8..8ffc623e564b 100644
--- a/package/inc/ZipOutputStream.hxx
+++ b/package/inc/ZipOutputStream.hxx
@@ -80,7 +80,7 @@ private:
     /// @throws css::io::IOException
     /// @throws css::uno::RuntimeException
     void writeDataDescriptor( const ZipEntry &rEntry );
-    void writeExtraFields( const ZipEntry& rEntry );
+    void writeExtraFields(const ZipEntry& rEntry, bool isLOCWithDD);
 
     // ScheduledThread handling helpers
     void 
consumeScheduledThreadTaskEntry(std::unique_ptr<ZipOutputEntryInThread> 
pCandidate);
diff --git a/package/source/zipapi/ZipOutputStream.cxx 
b/package/source/zipapi/ZipOutputStream.cxx
index da265c303b13..2217ce518aa8 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -64,7 +64,12 @@ void ZipOutputStream::setEntry(ZipEntry& rEntry)
     if (rEntry.nSize == -1 || rEntry.nCompressedSize == -1 ||
         rEntry.nCrc == -1)
     {
-        rEntry.nSize = rEntry.nCompressedSize = 0;
+        if (rEntry.nSize == -1)
+        {
+            assert(false); // how to get here
+            rEntry.nSize = 0;
+        }
+        rEntry.nCompressedSize = 0;
         rEntry.nFlag |= 8;
     }
 }
@@ -251,7 +256,7 @@ void ZipOutputStream::writeCEN( const ZipEntry &rEntry )
 
     if (bWrite64Header)
     {
-        writeExtraFields( rEntry );
+        writeExtraFields(rEntry, false);
     }
 }
 
@@ -276,13 +281,13 @@ void ZipOutputStream::writeDataDescriptor(const ZipEntry& 
rEntry)
     }
 }
 
-void ZipOutputStream::writeExtraFields(const ZipEntry& rEntry)
+void ZipOutputStream::writeExtraFields(const ZipEntry& rEntry, bool const 
isLOCWithDD)
 {
     //Could contain more fields, now we only save Zip64 extended information
     m_aChucker.WriteInt16( 1 );  //id of Zip64 extended information extra field
     m_aChucker.WriteInt16( 28 ); //data size of this field = 3*8+4 byte
-    m_aChucker.WriteUInt64( rEntry.nSize );
-    m_aChucker.WriteUInt64( rEntry.nCompressedSize );
+    m_aChucker.WriteUInt64(isLOCWithDD ? 0 : rEntry.nSize);
+    m_aChucker.WriteUInt64(isLOCWithDD ? 0 : rEntry.nCompressedSize);
     m_aChucker.WriteUInt64( rEntry.nOffset );
     m_aChucker.WriteInt32( 0 );  //Number of the disk on which this file starts
 }
@@ -311,6 +316,9 @@ void ZipOutputStream::writeLOC(std::unique_ptr<ZipEntry>&& 
pEntry, bool bEncrypt
         m_aChucker.WriteInt16( rEntry.nMethod );
 
     bool bWrite64Header = false;
+    // getTruncated must always be called to init bWrite64Header!
+    auto const nTruncCompressedSize{getTruncated(rEntry.nCompressedSize, 
&bWrite64Header)};
+    auto const nTruncSize{getTruncated(rEntry.nSize, &bWrite64Header)};
 
     m_aChucker.WriteUInt32( rEntry.nTime );
     if ((rEntry.nFlag & 8) == 8 )
@@ -322,8 +330,8 @@ void ZipOutputStream::writeLOC(std::unique_ptr<ZipEntry>&& 
pEntry, bool bEncrypt
     else
     {
         m_aChucker.WriteUInt32( rEntry.nCrc );
-        m_aChucker.WriteUInt32( getTruncated( rEntry.nCompressedSize, 
&bWrite64Header ) );
-        m_aChucker.WriteUInt32( getTruncated( rEntry.nSize, &bWrite64Header ) 
);
+        m_aChucker.WriteUInt32(nTruncCompressedSize);
+        m_aChucker.WriteUInt32(nTruncSize);
     }
     m_aChucker.WriteInt16( nNameLength );
     m_aChucker.WriteInt16( bWrite64Header ? 32 : 0 );
@@ -335,7 +343,7 @@ void ZipOutputStream::writeLOC(std::unique_ptr<ZipEntry>&& 
pEntry, bool bEncrypt
 
     if (bWrite64Header)
     {
-        writeExtraFields(rEntry);
+        writeExtraFields(rEntry, (rEntry.nFlag & 8));
     }
 }
 
diff --git a/package/source/zippackage/ZipPackage.cxx 
b/package/source/zippackage/ZipPackage.cxx
index 18fd18a2c6a5..5fd8cc3770c0 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -1178,13 +1178,14 @@ void ZipPackage::WriteManifest( ZipOutputStream& 
aZipOut, const std::vector< uno
     pEntry->sPath = "META-INF/manifest.xml";
     pEntry->nMethod = DEFLATED;
     pEntry->nCrc = -1;
-    pEntry->nSize = pEntry->nCompressedSize = -1;
+    pEntry->nCompressedSize = -1;
     pEntry->nTime = ZipOutputStream::getCurrentDosTime();
 
     xWriter->writeManifestSequence ( pBuffer,  
comphelper::containerToSequence(aManList) );
 
     sal_Int32 nBufferLength = static_cast < sal_Int32 > ( 
pBuffer->getPosition() );
     pBuffer->realloc( nBufferLength );
+    pEntry->nSize = nBufferLength;
 
     // the manifest.xml is never encrypted - so pass an empty reference
     ZipOutputStream::setEntry(*pEntry);
@@ -1204,7 +1205,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& 
aZipOut, const std::vector<
     pEntry->sPath = "[Content_Types].xml";
     pEntry->nMethod = DEFLATED;
     pEntry->nCrc = -1;
-    pEntry->nSize = pEntry->nCompressedSize = -1;
+    pEntry->nCompressedSize = -1;
     pEntry->nTime = ZipOutputStream::getCurrentDosTime();
 
     // Add default entries, the count must be updated manually when appending.
@@ -1245,6 +1246,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& 
aZipOut, const std::vector<
 
     sal_Int32 nBufferLength = static_cast < sal_Int32 > ( 
pBuffer->getPosition() );
     pBuffer->realloc( nBufferLength );
+    pEntry->nSize = nBufferLength;
 
     // there is no encryption in this format currently
     ZipOutputStream::setEntry(*pEntry);
diff --git a/package/source/zippackage/ZipPackageStream.cxx 
b/package/source/zippackage/ZipPackageStream.cxx
index 8280a048c7c5..85f18f47709a 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -511,7 +511,15 @@ bool ZipPackageStream::saveChild(
         bUseNonSeekableAccess = ( xStream.is() && !xSeek.is() );
     }
 
-    if ( !bUseNonSeekableAccess )
+    if (bUseNonSeekableAccess)
+    {
+        // this should work for XUnbufferedStream/OInputCompStream at least
+        if (pTempEntry->nSize == -1)
+        {   // this is needed in writeLOC to detect Zip64
+            pTempEntry->nSize = xStream->available();
+        }
+    }
+    else
     {
         xStream = getRawData();
 
@@ -541,6 +549,11 @@ bool ZipPackageStream::saveChild(
                     m_nOwnStreamOrigSize = xSeek->getLength();
                 }
 
+                if (pTempEntry->nSize == -1)
+                {   // this is needed in writeLOC to detect Zip64
+                    pTempEntry->nSize = xSeek->getLength();
+                }
+
                 xSeek->seek ( 0 );
             }
             else
@@ -742,7 +755,7 @@ bool ZipPackageStream::saveChild(
         {
             pTempEntry->nMethod = DEFLATED;
             pTempEntry->nCrc = -1;
-            pTempEntry->nCompressedSize = pTempEntry->nSize = -1;
+            pTempEntry->nCompressedSize = -1;
         }
 
         uno::Reference< io::XSeekable > xSeek(xStream, uno::UNO_QUERY);

Reply via email to