diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-14 16:07:05 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-05-14 17:30:35 +0100 |
commit | 30f84257b34eb956027c21934ec9fa63cb25fcf4 (patch) | |
tree | 85f6a5deea8f25594f3ac99cf33460205e58dd5e | |
parent | fdo#40481 run SelectLanguage custom action during silent install, too (diff) | |
download | core-30f84257b34eb956027c21934ec9fa63cb25fcf4.tar.gz core-30f84257b34eb956027c21934ec9fa63cb25fcf4.zip |
Resolves: fdo#49897 add+use SwDoc::containsUpdatableFields
Change-Id: I03ab6367a40ddc5748a499c4e2c7f108a3ef8a08
Signed-off-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r-- | sw/inc/doc.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/doc/docfld.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/uiview/view.cxx | 13 |
3 files changed, 23 insertions, 5 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 29be2a7c28e2..7943925fc06a 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -841,6 +841,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 019e1606022e..b7c65498134a 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -415,6 +415,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 e291c1906097..b387b34023cb 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -966,11 +966,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 ); } |