summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2010-09-13 20:07:15 +0200
committerNiklas Nebel <nn@openoffice.org>2010-09-13 20:07:15 +0200
commit389977a4e4c8678ec1f5de6b93c08232cac248c4 (patch)
tree318337fd9898e968b48650c67bad4e161bbed586 /sc
parentmib19: #163557# cleanup VBA XDocuments implementation, trigger Workbook_Open ... (diff)
downloadcore-389977a4e4c8678ec1f5de6b93c08232cac248c4.tar.gz
core-389977a4e4c8678ec1f5de6b93c08232cac248c4.zip
mib19: #163566# if the VBA event processor is set, check HasAnyCalcNotification before HasAnySheetEventScript in ScModelObj::Notify
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx1
-rw-r--r--sc/source/core/data/documen3.cxx8
-rw-r--r--sc/source/ui/unoobj/docuno.cxx17
3 files changed, 24 insertions, 2 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 02a6ee5b4c00..90aac02aab7f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -748,6 +748,7 @@ public:
bool HasSheetEventScript( SCTAB nTab, sal_Int32 nEvent, bool bWithVbaEvents = false ) const;
bool HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents = false ) const; // on any sheet
+ bool HasAnyCalcNotification() const;
BOOL HasCalcNotification( SCTAB nTab ) const;
void SetCalcNotification( SCTAB nTab );
void ResetCalcNotifications();
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 8fea4b8af2b9..f3b3f1ab32c6 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -544,6 +544,14 @@ bool ScDocument::HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents )
return false;
}
+bool ScDocument::HasAnyCalcNotification() const
+{
+ for (SCTAB nTab = 0; nTab <= MAXTAB; nTab++)
+ if (pTab[nTab] && pTab[nTab]->GetCalcNotification())
+ return true;
+ return false;
+}
+
BOOL ScDocument::HasCalcNotification( SCTAB nTab ) const
{
if (VALIDTAB(nTab) && pTab[nTab])
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 3d3f0f479601..89193ad8ddf0 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -590,8 +590,21 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
DELETEZ( pPrintFuncCache );
// handle "OnCalculate" sheet events (search also for VBA event handlers)
- if ( pDocShell && pDocShell->GetDocument()->HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true ) )
- HandleCalculateEvents();
+ if ( pDocShell )
+ {
+ ScDocument* pDoc = pDocShell->GetDocument();
+ if ( pDoc->GetVbaEventProcessor().is() )
+ {
+ // If the VBA event processor is set, HasAnyCalcNotification is much faster than HasAnySheetEventScript
+ if ( pDoc->HasAnyCalcNotification() && pDoc->HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true ) )
+ HandleCalculateEvents();
+ }
+ else
+ {
+ if ( pDoc->HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE ) )
+ HandleCalculateEvents();
+ }
+ }
}
}
else if ( rHint.ISA( ScPointerChangedHint ) )