sw/inc/doc.hxx | 1 + sw/source/core/doc/docfld.cxx | 14 ++++++++++++++ sw/source/ui/uiview/view.cxx | 13 ++++++++----- 3 files changed, 23 insertions(+), 5 deletions(-)
New commits: commit cb235067de2bf7feef3c03eeb08492e60da0d083 Author: Caolán McNamara <caol...@redhat.com> Date: Mon May 14 16:07:05 2012 +0100 Resolves: fdo#49897 add+use SwDoc::containsUpdatableFields Change-Id: I03ab6367a40ddc5748a499c4e2c7f108a3ef8a08 diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 7f4a1cc..2552022 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -849,6 +849,7 @@ public: @return pointer to field at the given position or NULL in case no field is found */ static SwTxtFld* GetTxtFld(const SwPosition& rPos); + bool containsUpdatableFields(); /** IDocumentContentOperations */ diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index f19d64c..9290e02 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -411,6 +411,20 @@ void SwDoc::UpdateRefFlds( SfxPoolItem* pHt ) pFldType->ModifyNotification( 0, pHt ); } +//For simplicity assume that all field types have updatable contents so +//optimization currently only available when no fields exist. +bool SwDoc::containsUpdatableFields() +{ + for (sal_uInt16 i = 0; i < pFldTypes->Count(); ++i) + { + SwFieldType* pFldType = (*pFldTypes)[i]; + SwIterator<SwFmtFld,SwFieldType> aIter(*pFldType); + if (aIter.First()) + return true; + } + return false; +} + void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) { OSL_ENSURE( !pHt || RES_TABLEFML_UPDATE == pHt->Which(), diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index bd9a726..93e643a 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -970,11 +970,14 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) if( pWrtShell->GetDoc()->IsUpdateExpFld() ) { - SET_CURR_SHELL( pWrtShell ); - pWrtShell->StartAction(); - pWrtShell->CalcLayout(); - pWrtShell->GetDoc()->UpdateFlds(NULL, false); - pWrtShell->EndAction(); + if (pWrtShell->GetDoc()->containsUpdatableFields()) + { + SET_CURR_SHELL( pWrtShell ); + pWrtShell->StartAction(); + pWrtShell->CalcLayout(); + pWrtShell->GetDoc()->UpdateFlds(NULL, false); + pWrtShell->EndAction(); + } pWrtShell->GetDoc()->SetUpdateExpFldStat( sal_False ); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits