[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/inc sw/source
Michael Meeks
michael at kemper.freedesktop.org
Mon May 14 09:28:07 PDT 2012
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 30f84257b34eb956027c21934ec9fa63cb25fcf4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 14 16:07:05 2012 +0100
Resolves: fdo#49897 add+use SwDoc::containsUpdatableFields
Change-Id: I03ab6367a40ddc5748a499c4e2c7f108a3ef8a08
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 29be2a7..7943925 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 019e160..b7c6549 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 e291c19..b387b34 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 );
}
More information about the Libreoffice-commits
mailing list