summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-14 16:07:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-05-14 16:09:44 +0100
commitcb235067de2bf7feef3c03eeb08492e60da0d083 (patch)
tree7e44a4221fc3feb15aa9b73ef0d19673d7865306 /sw
parenta0c36a1e39c0874b3dc9731544ddfe5b2822e42f (diff)
Resolves: fdo#49897 add+use SwDoc::containsUpdatableFields
Change-Id: I03ab6367a40ddc5748a499c4e2c7f108a3ef8a08
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/doc.hxx1
-rw-r--r--sw/source/core/doc/docfld.cxx14
-rw-r--r--sw/source/ui/uiview/view.cxx13
3 files changed, 23 insertions, 5 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 7f4a1cc47ca3..2552022aee12 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 f19d64c58876..9290e02d9c64 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 bd9a726385b8..93e643a0c606 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 );
}