summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2010-08-18 17:20:31 +0200
committerDaniel Rentz <dr@openoffice.org>2010-08-18 17:20:31 +0200
commit4eed799a79cffa08a9cae7e8980a0f4673441289 (patch)
tree08c2bcda5bd378211e56833b4b3c4443c143eecf /sc
parentmib18: rebase to OOO330m4 (diff)
downloadcore-4eed799a79cffa08a9cae7e8980a0f4673441289.tar.gz
core-4eed799a79cffa08a9cae7e8980a0f4673441289.zip
mib19: #163305# do not fire sheet activation events, when a sheet gets inserted/deleted etc. and the active sheet just changes its index
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/viewuno.hxx3
-rw-r--r--sc/source/ui/inc/tabview.hxx9
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx7
-rwxr-xr-xsc/source/ui/vba/vbaeventshelper.cxx22
-rw-r--r--sc/source/ui/view/tabview3.cxx4
-rw-r--r--sc/source/ui/view/tabview5.cxx4
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx9
7 files changed, 30 insertions, 28 deletions
diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index 19b5c60fd070..0f03e0e9b111 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -225,7 +225,8 @@ public:
void SelectionChanged();
void VisAreaChanged();
- void SheetChanged();
+ // bSameTabButMoved = true if the same sheet as before is activated, used after moving/copying/inserting/deleting a sheet
+ void SheetChanged( bool bSameTabButMoved = false );
bool IsMouseListening() const;
sal_Bool MousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
sal_Bool MouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index a6e99613f2ea..ab21a6161752 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -287,7 +287,8 @@ public:
BOOL IsMinimized() const { return bMinimized; }
- void TabChanged();
+ // bSameTabButMoved = true if the same sheet as before is activated, used after moving/copying/inserting/deleting a sheet
+ void TabChanged( bool bSameTabButMoved = false );
void SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll );
SC_DLLPUBLIC void RefreshZoom();
void SetPagebreakMode( BOOL bSet );
@@ -387,10 +388,8 @@ public:
void SetNewStartIfMarking();
- //<!--Added by PengYunQuan for Validity Cell Range Picker
- //void SetTabNo( SCTAB nTab, BOOL bNew = FALSE, BOOL bExtendSelection = FALSE );
- SC_DLLPUBLIC void SetTabNo( SCTAB nTab, BOOL bNew = FALSE, BOOL bExtendSelection = FALSE );
- //-->Added by PengYunQuan for Validity Cell Range Picker
+ // bSameTabButMoved = true if the same sheet as before is activated, used after moving/copying/inserting/deleting a sheet
+ SC_DLLPUBLIC void SetTabNo( SCTAB nTab, BOOL bNew = FALSE, BOOL bExtendSelection = FALSE, bool bSameTabButMoved = false );
void SelectNextTab( short nDir, BOOL bExtendSelection = FALSE );
void ActivateView( BOOL bActivate, BOOL bFirst );
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index fd1e655b8ffb..7646e52c030f 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -572,7 +572,7 @@ void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, sal_Int32 nEvent )
}
}
-void ScTabViewObj::SheetChanged()
+void ScTabViewObj::SheetChanged( bool bSameTabButMoved )
{
if ( !GetViewShell() )
return;
@@ -600,9 +600,10 @@ void ScTabViewObj::SheetChanged()
}
}
- // handle sheet events
+ /* Handle sheet events, but do not trigger event handlers, if the old
+ active sheet gets re-activated after inserting/deleting/moving a sheet. */
SCTAB nNewTab = pViewData->GetTabNo();
- if ( nNewTab != nPreviousTab )
+ if ( !bSameTabButMoved && (nNewTab != nPreviousTab) )
{
lcl_CallActivate( pDocSh, nPreviousTab, SC_SHEETEVENT_UNFOCUS );
lcl_CallActivate( pDocSh, nNewTab, SC_SHEETEVENT_FOCUS );
diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx
index 45667adf2f2c..f19a2e57e549 100755
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -470,14 +470,12 @@ bool ScVbaEventsHelper::implEventsEnabled() throw (uno::RuntimeException)
bool ScVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue,
const EventHandlerInfo& rInfo, const uno::Sequence< uno::Any >& rArgs ) throw (uno::RuntimeException)
{
- // check preconditions for some events, add more events if needed
- bool bExecuteEvent = true;
+ // framework and Calc fire a few events before 'opened', ignore them
+ bool bExecuteEvent = mbOpened;
+
+ // special handling for some events
switch( rInfo.mnEventId )
{
- case WORKBOOK_ACTIVATE:
- // while loading, framework fires this before 'opened' event, delay it
- bExecuteEvent = mbOpened;
- break;
case WORKBOOK_OPEN:
bExecuteEvent = !mbOpened;
if( bExecuteEvent )
@@ -490,15 +488,17 @@ bool ScVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue,
break;
case WORKSHEET_SELECTIONCHANGE:
// if selection is not changed, then do not fire the event
- bExecuteEvent = mbOpened && isSelectionChanged( rArgs, 0 );
+ bExecuteEvent = bExecuteEvent && isSelectionChanged( rArgs, 0 );
break;
}
// add workbook event associated to a sheet event
- bool bSheetEvent = false;
- rInfo.maUserData >>= bSheetEvent;
- if( bSheetEvent && bExecuteEvent )
- rEventQueue.push_back( EventQueueEntry( rInfo.mnEventId + USERDEFINED_START, rArgs ) );
+ if( bExecuteEvent )
+ {
+ bool bSheetEvent = false;
+ if( (rInfo.maUserData >>= bSheetEvent) && bSheetEvent )
+ rEventQueue.push_back( EventQueueEntry( rInfo.mnEventId + USERDEFINED_START, rArgs ) );
+ }
return bExecuteEvent;
}
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 90bfe0c24e5c..93d1edd7fee5 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1549,7 +1549,7 @@ void ScTabView::SelectNextTab( short nDir, BOOL bExtendSelection )
// SetTabNo - angezeigte Tabelle
-void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
+void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection, bool bSameTabButMoved )
{
if ( !ValidTab(nTab) )
{
@@ -1681,7 +1681,7 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
pGridWin[i]->UpdateEditViewPos();
}
- TabChanged(); // DrawView
+ TabChanged( bSameTabButMoved ); // DrawView
aViewData.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
if ( !bUnoRefDialog )
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index f0ac3fc42869..f5a4a37784a9 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -267,7 +267,7 @@ void ScTabView::DoAddWin( ScGridWindow* pWin )
//==================================================================
-void ScTabView::TabChanged()
+void ScTabView::TabChanged( bool bSameTabButMoved )
{
if (pDrawView)
{
@@ -339,7 +339,7 @@ void ScTabView::TabChanged()
{
ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
if (pImp)
- pImp->SheetChanged();
+ pImp->SheetChanged( bSameTabButMoved );
}
}
}
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 1a3dd6928a17..12f08ec6d0e2 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -249,7 +249,7 @@ void __EXPORT ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
// kann und dann auch die aktive View umgeschaltet werden muss.
SCTAB nNewTab = nActiveTab;
- BOOL bForce = FALSE;
+ bool bStayOnActiveTab = true;
switch (nId)
{
case SC_TAB_INSERTED:
@@ -260,7 +260,7 @@ void __EXPORT ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
if ( nTab1 < nNewTab ) // vorher geloescht
--nNewTab;
else if ( nTab1 == nNewTab ) // aktuelle geloescht
- bForce = TRUE;
+ bStayOnActiveTab = false;
break;
case SC_TAB_MOVED:
if ( nNewTab == nTab1 ) // verschobene Tabelle
@@ -282,7 +282,7 @@ void __EXPORT ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
break;
case SC_TAB_HIDDEN:
if ( nTab1 == nNewTab ) // aktuelle ausgeblendet
- bForce = TRUE;
+ bStayOnActiveTab = false;
break;
}
@@ -290,7 +290,8 @@ void __EXPORT ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
if ( nNewTab >= pDoc->GetTableCount() )
nNewTab = pDoc->GetTableCount() - 1;
- SetTabNo( nNewTab, bForce );
+ BOOL bForce = !bStayOnActiveTab;
+ SetTabNo( nNewTab, bForce, FALSE, bStayOnActiveTab );
}
else if (rHint.ISA(ScIndexHint))
{