Files
odfstudio/sfx2/source
Michael Stahl 7978401cfc 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 1e007e8f17 - 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 d06a6d2c19
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
f5ccfd60c2 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 1e007e8f17 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 <michael.stahl@collabora.com>
2025-10-01 11:59:18 +02:00
..
2024-05-10 18:42:35 +02:00
2024-05-10 18:42:35 +02:00
2024-10-26 19:25:03 +02:00
2024-05-10 18:42:35 +02:00
2025-09-05 19:45:45 +02:00
2024-05-10 18:42:35 +02:00