ooo-build r15554 - in trunk: . patches/dev300 patches/vba
- From: pflin svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15554 - in trunk: . patches/dev300 patches/vba
- Date: Tue, 17 Mar 2009 08:51:04 +0000 (UTC)
Author: pflin
Date: Tue Mar 17 08:51:03 2009
New Revision: 15554
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15554&view=rev
Log:
2009-03-17 Fong Lin <pfling novell com>
* patches/vba/vba-worksheet-calculate-event-fix.diff,
* patches/vba/vba-workbook-worksheet-events.diff,
* patches/vba/vba-worksheet-change-event-fix.diff: worksheet change
event rework.
* patches/dev300/apply.
Added:
trunk/patches/vba/vba-worksheet-change-event-fix.diff
Modified:
trunk/ChangeLog
trunk/patches/dev300/apply
trunk/patches/vba/vba-workbook-worksheet-events.diff
trunk/patches/vba/vba-worksheet-calculate-event-fix.diff
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Tue Mar 17 08:51:03 2009
@@ -1925,6 +1925,8 @@
fix-doc-exit-basic-error-core.diff
read-vba-dir-stream-fix.diff
vba-commandbar-enabled.diff, n#459458, Fong
+# worksheet change event rework
+vba-worksheet-change-event-fix.diff, Fong
[ VBAUntested ]
SectionOwner => noelpwer
vba-basic-null.diff i#85349, jjiao
Modified: trunk/patches/vba/vba-workbook-worksheet-events.diff
==============================================================================
--- trunk/patches/vba/vba-workbook-worksheet-events.diff (original)
+++ trunk/patches/vba/vba-workbook-worksheet-events.diff Tue Mar 17 08:51:03 2009
@@ -1505,65 +1505,6 @@
void ScDocument::ClearLookupCaches()
{
---- /home/feng/work/ooo-build/build/dev300-m14/sc/source/core/data/documen7.cxx 2008-06-16 21:30:17.000000000 +0800
-+++ sc/source/core/data/documen7.cxx 2008-06-05 18:11:39.000000000 +0800
-@@ -59,7 +59,15 @@
-
-
- #include "globstr.hrc"
-+#include <algorithm>
-+#include <vector>
-
-+
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
- extern const ScFormulaCell* pLastFormulaTreeTop; // cellform.cxx Err527 WorkAround
-
- // STATIC DATA -----------------------------------------------------------
-@@ -449,6 +457,7 @@ void ScDocument::TrackFormulas( ULONG nH
- ScFormulaCell* pTrack;
- ScFormulaCell* pNext;
- pTrack = pFormulaTrack;
-+ ::std::vector<SCTAB> aTabs;
- do
- {
- ScHint aHint( nHintId, pTrack->aPos, pTrack );
-@@ -458,6 +467,12 @@ void ScDocument::TrackFormulas( ULONG nH
- // Repaint fuer bedingte Formate mit relativen Referenzen:
- if ( pCondFormList )
- pCondFormList->SourceChanged( pTrack->aPos );
-+ ::std::vector<SCTAB>::iterator result;
-+ result = ::std::find( aTabs.begin(), aTabs.end(), pTrack->aPos.Tab() );
-+ if( result == aTabs.end() )
-+ {
-+ aTabs.push_back( pTrack->aPos.Tab() );
-+ }
- pTrack = pTrack->GetNextTrack();
- } while ( pTrack );
- pTrack = pFormulaTrack;
-@@ -480,6 +495,18 @@ void ScDocument::TrackFormulas( ULONG nH
- else
- SetForcedFormulaPending( TRUE );
- }
-+
-+ ::std::vector<SCTAB>::iterator iter;
-+ for( iter = aTabs.begin(); iter != aTabs.end(); iter++ )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= *iter;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CALCULATE, aArgs );
-+ }
-+ }
- }
- DBG_ASSERT( nFormulaTrackCount==0, "TrackFormulas: nFormulaTrackCount!=0" );
- }
-
--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/docshell/docsh.cxx 2008-06-16 21:30:17.000000000 +0800
+++ sc/source/ui/docshell/docsh.cxx 2008-06-16 17:15:54.000000000 +0800
@@ -126,6 +126,13 @@
@@ -1693,42 +1634,6 @@
USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
if (nRet == TRUE) // TRUE = schliessen
aDocument.DisableIdle(TRUE); // nicht mehr drin rumpfuschen !!!
-@@ -2485,6 +2564,34 @@ void ScDocShell::SetModified( BOOL bModi
- }
- }
-
-+void ScDocShell::PostContentChanged( const ScRange& rRange )
-+{
-+ ScRangeList aList;
-+ aList.Append(rRange);
-+ PostContentChanged(aList);
-+}
-+
-+void ScDocShell::PostContentChanged( const ScRangeList& rList )
-+{
-+ ScCellRangesBase* pObj = NULL;
-+ const ScRange& rRange = *(rList.GetObject(0));
-+ if( rList.Count() == 1 )
-+ {
-+ if (rRange.aStart == rRange.aEnd)
-+ pObj = new ScCellObj( this, rRange.aStart );
-+ else
-+ pObj = new ScCellRangeObj( this, rRange );
-+ }
-+ else
-+ pObj = new ScCellRangesObj( this, rList );
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
-+
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( aDocument.GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if ( xVbaEventsHelper.is() )
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CHANGE, aArgs );
-+}
-
- void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
- {
-
--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/inc/docsh.hxx 2008-06-16 21:30:17.000000000 +0800
+++ sc/source/ui/inc/docsh.hxx 2008-06-05 18:11:39.000000000 +0800
@@ -47,6 +47,7 @@
@@ -1739,236 +1644,6 @@
class ScEditEngineDefaulter;
class FontList;
-@@ -325,6 +326,8 @@ public:
- void PostPaintExtras();
-
- void PostDataChanged();
-+ void PostContentChanged( const ScRange& rRange ); // for worsheet/workbook changed event
-+ void PostContentChanged( const ScRangeList& rList );
-
- void UpdatePaintExt( USHORT& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
- SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
-
---- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/undo/undoblk3.cxx 2008-06-16 21:30:17.000000000 +0800
-+++ sc/source/ui/undo/undoblk3.cxx 2008-06-05 18:11:39.000000000 +0800
-@@ -79,7 +79,17 @@ TYPEINIT1(ScUndoInsertAreaLink, SfxUndo
- TYPEINIT1(ScUndoRemoveAreaLink, SfxUndoAction);
- TYPEINIT1(ScUndoUpdateAreaLink, SfxUndoAction);
-
--
-+void lcl_PostContentChanged( ScDocShell* pDocShell, const ScMarkData& rMark, const ScRange& rRange )
-+{
-+ if (rMark.IsMarked() || rMark.IsMultiMarked())
-+ {
-+ ScRangeList aList;
-+ rMark.FillRangeListWithMarks(&aList, false);
-+ pDocShell->PostContentChanged(aList);
-+ }
-+ else
-+ pDocShell->PostContentChanged( rRange );
-+}
- // To Do:
- /*A*/ // SetOptimalHeight auf Dokument, wenn keine View
-
-@@ -113,6 +123,8 @@ ScUndoDeleteContents::ScUndoDeleteConten
- aMarkData.SetMarkArea( aRange ); // Zelle unter Cursor markieren
-
- SetChangeTrack();
-+
-+ lcl_PostContentChanged( pDocShell, aMarkData, aRange );
- }
-
-
-@@ -213,6 +225,7 @@ void __EXPORT ScUndoDeleteContents::Undo
- BeginUndo();
- DoChange( TRUE );
- EndUndo();
-+ lcl_PostContentChanged( pDocShell, aMarkData, aRange );
- }
-
-
-@@ -223,6 +236,7 @@ void __EXPORT ScUndoDeleteContents::Redo
- BeginRedo();
- DoChange( FALSE );
- EndRedo();
-+ lcl_PostContentChanged( pDocShell, aMarkData, aRange );
- }
-
-
---- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/undo/undoblk.cxx 2008-06-16 21:30:17.000000000 +0800
-+++ sc/source/ui/undo/undoblk.cxx 2008-06-05 18:11:39.000000000 +0800
-@@ -125,6 +125,7 @@ ScUndoInsertCells::ScUndoInsertCells( Sc
- }
-
- SetChangeTrack();
-+ pDocShell->PostContentChanged( aEffRange );
- }
-
- __EXPORT ScUndoInsertCells::~ScUndoInsertCells()
-@@ -271,6 +272,7 @@ void __EXPORT ScUndoInsertCells::Undo()
- BeginUndo();
- DoChange( TRUE );
- EndUndo();
-+ pDocShell->PostContentChanged( aEffRange );
- }
-
- void __EXPORT ScUndoInsertCells::Redo()
-@@ -279,6 +281,7 @@ void __EXPORT ScUndoInsertCells::Redo()
- BeginRedo();
- DoChange( FALSE );
- EndRedo();
-+ pDocShell->PostContentChanged( aEffRange );
-
- if ( pPasteUndo )
- pPasteUndo->Redo(); // redo paste last
-@@ -333,6 +336,7 @@ ScUndoDeleteCells::ScUndoDeleteCells( Sc
- }
-
- SetChangeTrack();
-+ pDocShell->PostContentChanged( aEffRange );
- }
-
- __EXPORT ScUndoDeleteCells::~ScUndoDeleteCells()
-@@ -474,6 +478,7 @@ void __EXPORT ScUndoDeleteCells::Undo()
- BeginUndo();
- DoChange( TRUE );
- EndUndo();
-+ pDocShell->PostContentChanged( aEffRange );
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
-
- // Markierung erst nach EndUndo
-@@ -488,6 +493,7 @@ void __EXPORT ScUndoDeleteCells::Redo()
- BeginRedo();
- DoChange( FALSE);
- EndRedo();
-+ pDocShell->PostContentChanged( aEffRange );
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
-
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-@@ -714,6 +720,7 @@ ScUndoCut::ScUndoCut( ScDocShell* pNewDo
- aExtendedRange( aRange )
- {
- SetChangeTrack();
-+ pDocShell->PostContentChanged( aExtendedRange );
- }
-
- __EXPORT ScUndoCut::~ScUndoCut()
-@@ -778,6 +785,7 @@ void __EXPORT ScUndoCut::Undo()
- BeginUndo();
- DoChange( TRUE );
- EndUndo();
-+ pDocShell->PostContentChanged( aExtendedRange );
- }
-
- void __EXPORT ScUndoCut::Redo()
-@@ -788,6 +796,7 @@ void __EXPORT ScUndoCut::Redo()
- DoChange( FALSE );
- EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
- EndRedo();
-+ pDocShell->PostContentChanged( aExtendedRange );
- }
-
- void __EXPORT ScUndoCut::Repeat(SfxRepeatTarget& rTarget)
-@@ -839,6 +848,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pN
- aPasteOptions = *pOptions; // used only for Repeat
-
- SetChangeTrack();
-+ pDocShell->PostContentChanged( aBlockRange );
- }
-
- __EXPORT ScUndoPaste::~ScUndoPaste()
-@@ -1020,6 +1030,7 @@ void __EXPORT ScUndoPaste::Undo()
- DoChange( TRUE );
- ShowTable( aBlockRange );
- EndUndo();
-+ pDocShell->PostContentChanged( aBlockRange );
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
- }
-
-@@ -1031,6 +1042,7 @@ void __EXPORT ScUndoPaste::Redo()
- DoChange( FALSE );
- EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
- EndRedo();
-+ pDocShell->PostContentChanged( aBlockRange );
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
- }
-
-
---- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/undo/undocell.cxx 2008-06-16 21:30:17.000000000 +0800
-+++ sc/source/ui/undo/undocell.cxx 2008-06-05 18:11:39.000000000 +0800
-@@ -214,6 +214,7 @@ ScUndoEnterData::ScUndoEnterData( ScDocS
- nCount( nNewCount )
- {
- SetChangeTrack();
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
- }
-
- __EXPORT ScUndoEnterData::~ScUndoEnterData()
-@@ -319,6 +320,7 @@ void __EXPORT ScUndoEnterData::Undo()
-
- DoChange();
- EndUndo();
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
-
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
-@@ -340,6 +342,7 @@ void __EXPORT ScUndoEnterData::Redo()
-
- DoChange();
- EndRedo();
-+ pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
-
- // #i97876# Spreadsheet data changes are not notified
- ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
-@@ -371,6 +374,7 @@ ScUndoEnterValue::ScUndoEnterValue( ScDo
- bNeedHeight ( bHeight )
- {
- SetChangeTrack();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- __EXPORT ScUndoEnterValue::~ScUndoEnterValue()
-@@ -425,6 +429,7 @@ void __EXPORT ScUndoEnterValue::Undo()
- pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
-
- EndUndo();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- void __EXPORT ScUndoEnterValue::Redo()
-@@ -438,6 +443,7 @@ void __EXPORT ScUndoEnterValue::Redo()
- SetChangeTrack();
-
- EndRedo();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- void __EXPORT ScUndoEnterValue::Repeat(SfxRepeatTarget& /* rTarget */)
-@@ -465,6 +471,7 @@ ScUndoPutCell::ScUndoPutCell( ScDocShell
- bNeedHeight ( bHeight )
- {
- SetChangeTrack();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- __EXPORT ScUndoPutCell::~ScUndoPutCell()
-@@ -521,6 +528,7 @@ void __EXPORT ScUndoPutCell::Undo()
- pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
-
- EndUndo();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- void __EXPORT ScUndoPutCell::Redo()
-@@ -549,6 +557,7 @@ void __EXPORT ScUndoPutCell::Redo()
- SetChangeTrack();
-
- EndRedo();
-+ pDocShell->PostContentChanged( ScRange( aPos ) );
- }
-
- void __EXPORT ScUndoPutCell::Repeat(SfxRepeatTarget& /* rTarget */)
-
--- /home/feng/work/ooo-build/build/dev300-m14/sc/source/ui/unoobj/viewuno.cxx 2008-06-16 21:30:17.000000000 +0800
+++ sc/source/ui/unoobj/viewuno.cxx 2008-06-16 21:21:54.000000000 +0800
@@ -71,8 +71,12 @@
Modified: trunk/patches/vba/vba-worksheet-calculate-event-fix.diff
==============================================================================
--- trunk/patches/vba/vba-worksheet-calculate-event-fix.diff (original)
+++ trunk/patches/vba/vba-worksheet-calculate-event-fix.diff Tue Mar 17 08:51:03 2009
@@ -23,46 +23,22 @@
USHORT GetErrCode( const ScAddress& ) const;
--- backup/sc/source/core/data/documen7.cxx 2008-08-27 16:40:23.000000000 +0800
+++ sc/source/core/data/documen7.cxx 2008-08-27 21:43:54.000000000 +0800
-@@ -457,7 +457,6 @@ void ScDocument::TrackFormulas( ULONG nH
- ScFormulaCell* pTrack;
- ScFormulaCell* pNext;
- pTrack = pFormulaTrack;
-- ::std::vector<SCTAB> aTabs;
- do
- {
- ScHint aHint( nHintId, pTrack->aPos, pTrack );
-@@ -467,12 +466,6 @@ void ScDocument::TrackFormulas( ULONG nH
- // Repaint fuer bedingte Formate mit relativen Referenzen:
- if ( pCondFormList )
- pCondFormList->SourceChanged( pTrack->aPos );
-- ::std::vector<SCTAB>::iterator result;
-- result = ::std::find( aTabs.begin(), aTabs.end(), pTrack->aPos.Tab() );
-- if( result == aTabs.end() )
-- {
-- aTabs.push_back( pTrack->aPos.Tab() );
-- }
- pTrack = pTrack->GetNextTrack();
- } while ( pTrack );
- pTrack = pFormulaTrack;
-@@ -495,18 +488,6 @@ void ScDocument::TrackFormulas( ULONG nH
- else
- SetForcedFormulaPending( TRUE );
- }
--
-- ::std::vector<SCTAB>::iterator iter;
-- for( iter = aTabs.begin(); iter != aTabs.end(); iter++ )
-- {
-- uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( GetVbaEventsHelper(), uno::UNO_QUERY );
-- if( xVbaEventsHelper.is() )
-- {
-- uno::Sequence< uno::Any > aArgs(1);
-- aArgs[0] <<= *iter;
-- xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CALCULATE, aArgs );
-- }
-- }
- }
- DBG_ASSERT( nFormulaTrackCount==0, "TrackFormulas: nFormulaTrackCount!=0" );
- }
+@@ -59,7 +59,15 @@
+
+
+ #include "globstr.hrc"
++#include <algorithm>
++#include <vector>
+
++
++#include <com/sun/star/document/XVbaEventsHelper.hpp>
++#include <com/sun/star/document/VbaEventId.hpp>
++
++using namespace com::sun::star;
++using namespace com::sun::star::document::VbaEventId;
+ extern const ScFormulaCell* pLastFormulaTreeTop; // cellform.cxx Err527 WorkAround
+
+ // STATIC DATA -----------------------------------------------------------
@@ -544,5 +525,35 @@ void ScDocument::SetAutoCalc( BOOL bNewA
}
}
Added: trunk/patches/vba/vba-worksheet-change-event-fix.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-worksheet-change-event-fix.diff Tue Mar 17 08:51:03 2009
@@ -0,0 +1,148 @@
+diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
+index 8248d48..794cb84 100644
+--- sc/source/ui/vba/vbaeventshelper.cxx
++++ sc/source/ui/vba/vbaeventshelper.cxx
+@@ -56,8 +56,12 @@
+ #include <com/sun/star/util/XCloseBroadcaster.hpp>
+ #include <com/sun/star/frame/XControllerBorder.hpp>
+ #include <com/sun/star/frame/XBorderResizeListener.hpp>
+-#include "cellsuno.hxx"
+-
++#include <com/sun/star/util/XChangesListener.hpp>
++#include <com/sun/star/util/ElementChange.hpp>
++#include <com/sun/star/util/XChangesNotifier.hpp>
++#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
++#include <cellsuno.hxx>
++#include <convuno.hxx>
+ #include <map>
+
+ using namespace std;
+@@ -69,6 +73,70 @@ const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.
+ const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
+ const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
+
++typedef ::cppu::WeakImplHelper1< util::XChangesListener > WorksheetChangeListener_BASE;
++
++class WorksheetChangeListener : public WorksheetChangeListener_BASE
++{
++private:
++ ScVbaEventsHelper* pVbaEventsHelper;
++public:
++ WorksheetChangeListener(ScVbaEventsHelper* pHelper ) : pVbaEventsHelper( pHelper ){}
++ virtual void SAL_CALL changesOccurred(const util::ChangesEvent& aEvent) throw (uno::RuntimeException);
++ virtual void SAL_CALL disposing(const lang::EventObject& aSource) throw(uno::RuntimeException){}
++};
++
++void WorksheetChangeListener::changesOccurred(const util::ChangesEvent& aEvent) throw (uno::RuntimeException)
++{
++ sal_Int32 nCount = aEvent.Changes.getLength();
++ if( nCount == 0 )
++ return;
++
++ util::ElementChange aChange = aEvent.Changes[ 0 ];
++ rtl::OUString sOperation;
++ aChange.Accessor >>= sOperation;
++ if( !sOperation.equalsIgnoreAsciiCaseAscii("cell-change") )
++ return;
++
++ if( nCount == 1 )
++ {
++ uno::Reference< table::XCellRange > xRangeObj;
++ aChange.ReplacedElement >>= xRangeObj;
++ if( xRangeObj.is() )
++ {
++ uno::Sequence< uno::Any > aArgs(1);
++ aArgs[0] <<= xRangeObj;
++ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CHANGE, aArgs );
++ }
++ return;
++ }
++
++ ScRangeList aRangeList;
++ for( sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex )
++ {
++ aChange = aEvent.Changes[ nIndex ];
++ aChange.Accessor >>= sOperation;
++ uno::Reference< table::XCellRange > xRangeObj;
++ aChange.ReplacedElement >>= xRangeObj;
++ if( xRangeObj.is() && sOperation.equalsIgnoreAsciiCaseAscii("cell-change") )
++ {
++ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable( xRangeObj, uno::UNO_QUERY );
++ if( xCellRangeAddressable.is() )
++ {
++ ScRange aRange;
++ ScUnoConversion::FillScRange( aRange, xCellRangeAddressable->getRangeAddress() );
++ aRangeList.Append( aRange );
++ }
++ }
++ }
++
++ if( aRangeList.Count() > 0 )
++ {
++ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pVbaEventsHelper->getDocumentShell(), aRangeList ) );
++ uno::Sequence< uno::Any > aArgs(1);
++ aArgs[0] <<= xRanges;
++ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CHANGE, aArgs );
++ }
++}
+
+ typedef ::cppu::WeakImplHelper3< awt::XWindowListener, util::XCloseListener, frame::XBorderResizeListener > WindowListener_BASE;
+
+@@ -394,8 +462,12 @@ ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArg
+ : m_xContext( xContext ), mpVbaEventsListener( NULL ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
+ {
+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
+- ScDocShell* pDocShell = excel::getDocShell( xModel );
++ pDocShell = excel::getDocShell( xModel );
+ pDoc = pDocShell->GetDocument();
++ // Add worksheet change listener
++ uno::Reference< util::XChangesNotifier > xChangesNotifier( xModel, uno::UNO_QUERY );
++ if( xChangesNotifier.is() )
++ xChangesNotifier->addChangesListener( uno::Reference< util::XChangesListener >( new WorksheetChangeListener( this ) ) );
+ }
+
+ ScVbaEventsHelper::~ScVbaEventsHelper()
+@@ -782,6 +854,18 @@ SCTAB ScVbaEventsHelper::getTabFromArgs( const uno::Sequence< uno::Any > aArgs,
+ table::CellRangeAddress aAddress = xCellRangeAddressable->getRangeAddress();
+ nTab = aAddress.Sheet;
+ }
++ else
++ {
++ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( getXSomethingFromArgs< sheet::XSheetCellRangeContainer >( aArgs, nPos ), uno::UNO_QUERY );
++ if( xRanges.is() )
++ {
++ uno::Sequence< table::CellRangeAddress > aRangeAddresses = xRanges->getRangeAddresses();
++ if( aRangeAddresses.getLength() > 0 )
++ {
++ nTab = aRangeAddresses[ 0 ].Sheet;
++ }
++ }
++ }
+ return nTab;
+ }
+
+diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx
+index e8c41d3..e812aa0 100644
+--- sc/source/ui/vba/vbaeventshelper.hxx
++++ sc/source/ui/vba/vbaeventshelper.hxx
+@@ -47,10 +47,12 @@
+ typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBAWorkbookEvent_BASE;
+
+ class VbaEventsListener;
++class ScDocShell;
+ class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
+ {
+ private:
+ ScDocument* pDoc;
++ ScDocShell* pDocShell;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ VbaEventsListener* mpVbaEventsListener;
+ sal_Bool mbOpened;
+@@ -72,6 +74,7 @@ public:
+ ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
+ ~ScVbaEventsHelper();
+ ScDocument* getDocument() { return pDoc; };
++ ScDocShell* getDocumentShell() { return pDocShell; };
+ // XVBAWorkbookEventHelper
+ virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]