diff options
-rw-r--r-- | sw/inc/editsh.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/edit/edfld.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 15 |
3 files changed, 20 insertions, 1 deletions
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 20efecf886ab..44d04c93a437 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -386,6 +386,7 @@ public: void UpdateExpFields(bool bCloseDB = false);///< only every expression fields update void LockExpFields(); void UnlockExpFields(); + bool IsExpFieldsLocked() const; SwFieldUpdateFlags GetFieldUpdateFlags(bool bDocSettings = false) const; void SetFieldUpdateFlags( SwFieldUpdateFlags eFlags ); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 4a5e60c2dae3..e4d259de962d 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -403,6 +403,11 @@ void SwEditShell::UnlockExpFields() GetDoc()->getIDocumentFieldsAccess().UnlockExpFields(); } +bool SwEditShell::IsExpFieldsLocked() const +{ + return GetDoc()->getIDocumentFieldsAccess().IsExpFieldsLocked(); +} + void SwEditShell::SetFieldUpdateFlags( SwFieldUpdateFlags eFlags ) { getIDocumentSettingAccess().setFieldUpdateFlags( eFlags ); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index c5a3c60c8be6..a5c97013a7ba 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1199,14 +1199,21 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, pWorkDoc->getIDocumentLinksAdministration().EmbedAllLinks(); // #i69458# lock fields to prevent access to the result set while calculating layout + // tdf#92324: and do not unlock: keep document locked during printing to avoid + // ExpFields update during printing, generation of preview, etc. rWorkShell.LockExpFields(); rWorkShell.CalcLayout(); - rWorkShell.UnlockExpFields(); } SwWrtShell& rWorkShell = pWorkView->GetWrtShell(); SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), xWorkDocSh)); + // tdf#92324: Allow ExpFields update only by explicit instruction to avoid + // database cursor movement on any other fields update, for example during + // print preview and other operations + if ( rWorkShell.IsExpFieldsLocked() ) + rWorkShell.UnlockExpFields(); rWorkShell.SwViewShell::UpdateFields(); + rWorkShell.LockExpFields(); SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), xWorkDocSh)); // launch MailMergeEvent if required @@ -1442,6 +1449,12 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, } while( !bCancel && (bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord())); + if ( xWorkDocSh.Is() && pWorkView->GetWrtShell().IsExpFieldsLocked() ) + { + // Unlock ducment fields after merge complete + pWorkView->GetWrtShell().UnlockExpFields(); + } + if( !bCreateSingleFile ) { if( rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER ) |