ooo-build r12390 - in trunk: . patches/test



Author: kyoshida
Date: Tue Apr 29 22:00:07 2008
New Revision: 12390
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12390&view=rev

Log:
2008-04-29  Kohei Yoshida  <kyoshida novell com>

	* patches/test/sc-vba-worksheet-changed.diff: improved upon Fong's nice
	VBA Worksheet_Change patch to handle deletions on multi-ranges.


Modified:
   trunk/ChangeLog
   trunk/patches/test/sc-vba-worksheet-changed.diff

Modified: trunk/patches/test/sc-vba-worksheet-changed.diff
==============================================================================
--- trunk/patches/test/sc-vba-worksheet-changed.diff	(original)
+++ trunk/patches/test/sc-vba-worksheet-changed.diff	Tue Apr 29 22:00:07 2008
@@ -1,166 +1,246 @@
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/data/documen7.cxx sc/source/core/data/documen7.cxx
---- sc.clean/source/core/data/documen7.cxx	2008-04-01 18:26:36.000000000 +0200
-+++ sc/source/core/data/documen7.cxx	2008-04-13 00:11:00.000000000 +0200
-@@ -35,7 +35,7 @@
- 
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
--
-+#include <stdio.h>
- // INCLUDE ---------------------------------------------------------------
- 
- #include <vcl/svapp.hxx>
-@@ -110,6 +110,16 @@ void ScDocument::Broadcast( ULONG nHint,
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
+--- sc.clean/source/ui/docshell/docsh.cxx	2008-04-29 13:02:31.000000000 -0400
++++ sc/source/ui/docshell/docsh.cxx	2008-04-29 17:55:02.000000000 -0400
+@@ -140,6 +140,7 @@
+ #include "compiler.hxx"
+ #include "cfgids.hxx"
+ #include "warnpassword.hxx"
++#include "cellsuno.hxx"
+ 
+ #include "docsh.hxx"
+ #include "docshimp.hxx"
+@@ -2490,6 +2491,48 @@ void ScDocShell::SetModified( BOOL bModi
+ 	}
+ }
  
- void ScDocument::Broadcast( const ScHint& rHint )
- {
-+    const ScAddress& rAddr = rHint.GetAddress();
-+    if (rAddr != BCA_BRDCST_ALWAYS)
++void ScDocShell::PostContentChanged( const ScRange& rRange )
++{
++//  OSL_TRACE("ScDocShell::PostContentChanged. Changed Range Address: nTab1 = %d, nCol1 = %d, nRow1 = %d; nTab2 = %d, nCol2 = %d, nRow2 = %d;", rRange.aStart.Tab(), rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Tab(), rRange.aEnd.Col(), rRange.aEnd.Row() );
++
++    ScRangeList aList;
++    aList.Append(rRange);
++    PostContentChanged(aList);
++}
++
++void ScDocShell::PostContentChanged( const ScRangeList& rList )
++{
++    String aStr;
++    rList.Format(aStr, SCR_ABS, &aDocument, ScAddress::CONV_XL_A1);
++    fprintf(stdout, "ScDocShell::PostContentChanged:   range = '%s'\n",
++            rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
++
++    // do your VBA stuff...
++
++#if 0 // disabled since this part didn't work in my build. (kohei)
++    ScCellRangesBase* pObj = NULL;
++
++    if (rRange.aStart == rRange.aEnd)
++    {
++        pObj = new ScCellObj( this, rRange.aStart );
++    } else
 +    {
-+        String aStr;
-+        rAddr.Format(aStr, SCA_ABS, this);
-+        fprintf(stdout, "ScDocument::Broadcast:   address = '%s'; col = %d; row = %ld\n",
-+                rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr(),
-+                rAddr.Col(), rAddr.Row());
++        pObj = new ScCellRangeObj( this, rRange );
 +    }
 +
- 	if ( !pBASM )
- 		return ;	// Clipboard or Undo
- 	if ( !nHardRecalcState )
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
---- sc.clean/source/ui/docshell/docsh.cxx	2008-04-01 18:26:34.000000000 +0200
-+++ sc/source/ui/docshell/docsh.cxx	2008-04-13 00:15:17.000000000 +0200
-@@ -37,7 +37,7 @@
- #include "precompiled_sc.hxx"
- // System - Includes -----------------------------------------------------
- 
--
-+#include <stdio.h>
- 
- #include "scitems.hxx"
- #include <svx/eeitem.hxx>
-@@ -2629,7 +2629,49 @@ ScDocShellModificator::~ScDocShellModifi
++    uno::Sequence< uno::Any > aArgs(1);
++    aArgs[0] = uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
++
++    SCTAB nTab1 = rRange.aStart.Tab();
++    aDocument.GetVbaEventsHelper()->executeSheetMacro( SC_VBAEVENT_SHEET_CHANGE, nTab1, aArgs );
++
++    SCTAB nTab2 = rRange.aEnd.Tab();
++    if ( nTab1 != nTab2 )
++    {
++        aDocument.GetVbaEventsHelper()->executeSheetMacro( SC_VBAEVENT_SHEET_CHANGE, nTab2, aArgs );
++    }
++#endif    
++}
  
- void ScDocShellModificator::SetDocumentModified()
+ void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
  {
-+    static long callCount = 0;
-+    fprintf(stdout, "ScDocShellModificator::SetDocumentModified: --begin (%ld)\n", callCount++);
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
+--- sc.clean/source/ui/inc/docsh.hxx	2008-04-29 13:02:28.000000000 -0400
++++ sc/source/ui/inc/docsh.hxx	2008-04-29 16:31:03.000000000 -0400
+@@ -343,6 +343,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 );
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undoblk3.cxx sc/source/ui/undo/undoblk3.cxx
+--- sc.clean/source/ui/undo/undoblk3.cxx	2008-04-29 13:02:30.000000000 -0400
++++ sc/source/ui/undo/undoblk3.cxx	2008-04-29 17:38:27.000000000 -0400
+@@ -117,6 +117,15 @@ ScUndoDeleteContents::ScUndoDeleteConten
+ 	if ( !(aMarkData.IsMarked() || aMarkData.IsMultiMarked()) )		// keine Zelle markiert:
+ 		aMarkData.SetMarkArea( aRange );							// Zelle unter Cursor markieren
+ 
++    if (aMarkData.IsMarked() || aMarkData.IsMultiMarked())
++    {
++        ScRangeList aList;
++        aMarkData.FillRangeListWithMarks(&aList, false);
++        pDocShell->PostContentChanged(aList);
++    }
++    else
++        pDocShell->PostContentChanged( aRange );
 +
- 	ScDocument* pDoc = rDocShell.GetDocument();
+ 	SetChangeTrack();
+ }
+ 
+@@ -211,6 +220,15 @@ void ScUndoDeleteContents::DoChange( con
+ 	if (pViewShell)
+ 		pViewShell->CellContentChanged();
+ 
++    if (aMarkData.IsMarked() || aMarkData.IsMultiMarked())
 +    {
-+        // Kohei's experimental code
-+        ScViewData* pViewData = ScDocShell::GetViewData();
-+        ScMarkData aMarkData( pViewData->GetMarkData() );
-+        aMarkData.SetMarking(false);
-+
-+        if (aMarkData.IsMarked())
-+        {
-+            if (aMarkData.IsMultiMarked())
-+            {
-+                ScRangeList aList;
-+                aMarkData.FillRangeListWithMarks(&aList, false);
-+                String aStr;
-+                aList.Format(aStr, SCR_ABS_3D, pDoc, ScAddress::CONV_XL_A1);
-+                fprintf(stdout, "ScDocShellModificator::SetDocumentModified:   format = '%s' (multimark list)\n",
-+                        rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
-+            }
-+            else
-+            {
-+                ScRange aRange;
-+                aMarkData.GetMarkArea(aRange);
-+                String aStr;
-+                aRange.Format(aStr, SCR_ABS_3D, pDoc, ScAddress::CONV_XL_A1);
-+                fprintf(stdout, "ScDocShellModificator::SetDocumentModified:   format = '%s'\n",
-+                        rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
-+            }
-+        }
-+        else
-+        {
-+            ScAddress aAddr(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
-+            String aStr;
-+            aAddr.Format(aStr, SCA_ABS_3D, pDoc, ScAddress::CONV_XL_A1);
-+            fprintf(stdout, "ScDocShellModificator::SetDocumentModified:   format = '%s' (not marked)\n",
-+                    rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
-+            fprintf(stdout, "ScDocShellModificator::SetDocumentModified: tab=%d; col=%d; row=%ld\n",
-+                    pViewData->GetTabNo(), pViewData->GetCurX(), pViewData->GetCurY());
-+        }
++        ScRangeList aList;
++        aMarkData.FillRangeListWithMarks(&aList, false);
++        pDocShell->PostContentChanged(aList);
 +    }
++    else
++        pDocShell->PostContentChanged( aRange );
 +
- 	if ( !pDoc->IsImportingXML() )
- 	{
- 		// AutoCalcShellDisabled temporaer restaurieren
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/gridwin.cxx sc/source/ui/view/gridwin.cxx
---- sc.clean/source/ui/view/gridwin.cxx	2008-04-01 18:26:33.000000000 +0200
-+++ sc/source/ui/view/gridwin.cxx	2008-04-12 10:58:05.000000000 +0200
-@@ -36,7 +36,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
+ 	ShowTable( aRange );
+ }
+ 
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undoblk.cxx sc/source/ui/undo/undoblk.cxx
+--- sc.clean/source/ui/undo/undoblk.cxx	2008-04-29 13:02:30.000000000 -0400
++++ sc/source/ui/undo/undoblk.cxx	2008-04-29 17:13:01.000000000 -0400
+@@ -129,6 +129,7 @@ ScUndoInsertCells::ScUndoInsertCells( Sc
+ 		aEffRange.aEnd.SetRow(MAXROW);
+ 	}
  
--
-+#include <stdio.h>
++	pDocShell->PostContentChanged( aEffRange );
+ 	SetChangeTrack();
+ }
  
- //------------------------------------------------------------------
+@@ -264,6 +265,7 @@ void ScUndoInsertCells::DoChange( const 
+ 	if (pViewShell)
+ 		pViewShell->CellContentChanged();
  
-@@ -5175,6 +5175,7 @@ void ScGridWindow::DeleteSelectionOverla
++	pDocShell->PostContentChanged( aEffRange );
+ 	ShowTable( aEffRange.aStart.Tab() );
+ }
  
- void ScGridWindow::UpdateSelectionOverlay()
- {
-+//  fprintf(stdout, "ScGridWindow::UpdateSelectionOverlay: --begin\n");
-     MapMode aDrawMode = GetDrawMapMode();
-     MapMode aOldMode = GetMapMode();
-     if ( aOldMode != aDrawMode )
-@@ -5185,8 +5186,10 @@ void ScGridWindow::UpdateSelectionOverla
-     std::vector<Rectangle> aPixelRects;
-     GetSelectionRects( aPixelRects );
- 
-+
-     if ( aPixelRects.size() && pViewData->IsActive() )
-     {
-+//      fprintf(stdout, "ScGridWindow::UpdateSelectionOverlay:   rect count = %d\n", aPixelRects.size());
-         SCTAB nTab = pViewData->GetTabNo();
-         BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( nTab );
-         BOOL bOld = pViewData->GetView()->IsOldSelection();
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/tabview3.cxx sc/source/ui/view/tabview3.cxx
---- sc.clean/source/ui/view/tabview3.cxx	2008-04-01 18:26:33.000000000 +0200
-+++ sc/source/ui/view/tabview3.cxx	2008-04-13 10:25:27.000000000 +0200
-@@ -1570,11 +1570,13 @@ void ScTabView::Unmark()
+@@ -337,6 +339,8 @@ ScUndoDeleteCells::ScUndoDeleteCells( Sc
+ 		aEffRange.aEnd.SetRow(MAXROW);
+ 	}
+ 
++	pDocShell->PostContentChanged( aEffRange );
++
+ 	SetChangeTrack();
+ }
+ 
+@@ -469,6 +473,7 @@ void ScUndoDeleteCells::DoChange( const 
  
- void ScTabView::SetMarkData( const ScMarkData& rNew )
+ 	pDocShell->PostDataChanged();
+ 	//	CellContentChanged kommt mit der Markierung
++	pDocShell->PostContentChanged( aWorkRange );
+ 
+ 	ShowTable( aEffRange.aStart.Tab() );
+ }
+@@ -718,6 +723,7 @@ ScUndoCut::ScUndoCut( ScDocShell* pNewDo
+ 	pUndoDoc( pNewUndoDoc ),
+ 	aExtendedRange( aRange )
  {
-+    fprintf(stdout, "ScTabView::SetMarkData: --begin\n");
-     DoneBlockMode();
-     InitOwnBlockMode();
-     aViewData.GetMarkData() = rNew;
- 
-     MarkDataChanged();
-+    fprintf(stdout, "ScTabView::SetMarkData: --end\n");
- }
- 
- void ScTabView::MarkDataChanged()
-diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/viewfun3.cxx sc/source/ui/view/viewfun3.cxx
---- sc.clean/source/ui/view/viewfun3.cxx	2008-04-01 18:26:33.000000000 +0200
-+++ sc/source/ui/view/viewfun3.cxx	2008-04-13 10:35:05.000000000 +0200
-@@ -752,6 +752,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT n
- 									InsCellCmd eMoveMode, USHORT nUndoExtraFlags,
- 									BOOL bAllowDialogs )
++	pDocShell->PostContentChanged( aExtendedRange );
+ 	SetChangeTrack();
+ }
+ 
+@@ -776,6 +782,7 @@ void ScUndoCut::DoChange( const BOOL bUn
+ 	pDocShell->PostDataChanged();
+ 	if (pViewShell)
+ 		pViewShell->CellContentChanged();
++	pDocShell->PostContentChanged( aExtendedRange );
+ }
+ 
+ void __EXPORT ScUndoCut::Undo()
+@@ -842,6 +849,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pN
+ 
+ 	if ( pOptions )
+ 		aPasteOptions = *pOptions;		// used only for Repeat
++	pDocShell->PostContentChanged( aBlockRange );
+ 
+ 	SetChangeTrack();
+ }
+@@ -1017,6 +1025,7 @@ void ScUndoPaste::DoChange( const BOOL b
+ 	pDocShell->PostDataChanged();
+ 	if (pViewShell)
+ 		pViewShell->CellContentChanged();
++	pDocShell->PostContentChanged( aDrawRange );
+ }
+ 
+ void __EXPORT ScUndoPaste::Undo()
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/undo/undocell.cxx sc/source/ui/undo/undocell.cxx
+--- sc.clean/source/ui/undo/undocell.cxx	2008-04-29 13:02:30.000000000 -0400
++++ sc/source/ui/undo/undocell.cxx	2008-04-29 13:07:44.000000000 -0400
+@@ -218,6 +218,7 @@ ScUndoEnterData::ScUndoEnterData( ScDocS
+ 	nTab( nNewTab ),
+ 	nCount( nNewCount )
  {
-+    fprintf(stdout, "ScViewFunc::PasteFromClip: --begin\n");
- 	if (!pClipDoc)
- 	{
- 		DBG_ERROR("PasteFromClip: pClipDoc=0 not allowed");
-@@ -1049,6 +1050,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT n
- 		DoneBlockMode();
- 		InitOwnBlockMode();
++	pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
+ 	SetChangeTrack();
+ }
+ 
+@@ -254,6 +255,7 @@ void ScUndoEnterData::DoChange() const
+ 		pViewShell->MoveCursorAbs( nCol, nRow, SC_FOLLOW_JUMP, FALSE, FALSE );
  	}
-+    rMark.SetMarking(true);
- 	rMark.SetMarkArea( aUserRange );
-     MarkDataChanged();
- 
-@@ -1217,6 +1219,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT n
- 	SelectionChanged();
- 
- 	delete pTransClip;
-+    fprintf(stdout, "ScViewFunc::PasteFromClip: --end\n");
- 	return TRUE;
+ 
++	pDocShell->PostContentChanged( ScRange( ScAddress( nCol, nRow, nTab ) ) );
+ 	pDocShell->PostDataChanged();
+ }
+ 
+@@ -375,6 +377,7 @@ ScUndoEnterValue::ScUndoEnterValue( ScDo
+ 	nValue		( nVal ),
+ 	bNeedHeight	( bHeight )
+ {
++	pDocShell->PostContentChanged( ScRange( aPos ) );
+ 	SetChangeTrack();
  }
  
+@@ -425,6 +428,8 @@ void __EXPORT ScUndoEnterValue::Undo()
+ 
+ 	pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
+ 
++	pDocShell->PostContentChanged( ScRange( aPos ) );
++
+ 	ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ 	if ( pChangeTrack )
+ 		pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
+@@ -440,6 +445,8 @@ void __EXPORT ScUndoEnterValue::Redo()
+ 	pDoc->SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
+ 	pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
+ 
++	pDocShell->PostContentChanged( ScRange( aPos ) );
++
+ 	SetChangeTrack();
+ 
+ 	EndRedo();
+@@ -469,6 +476,7 @@ ScUndoPutCell::ScUndoPutCell( ScDocShell
+ 	pEnteredCell( pRedoCell ),
+ 	bNeedHeight	( bHeight )
+ {
++	pDocShell->PostContentChanged( ScRange( aPos ) );
+ 	SetChangeTrack();
+ }
+ 
+@@ -521,6 +529,8 @@ void __EXPORT ScUndoPutCell::Undo()
+ 
+ 	pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
+ 
++	pDocShell->PostContentChanged( ScRange( aPos ) );
++
+ 	ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ 	if ( pChangeTrack )
+ 		pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
+@@ -551,6 +561,8 @@ void __EXPORT ScUndoPutCell::Redo()
+ 
+ 	pDocShell->PostPaintCell( aPos.Col(), aPos.Row(), aPos.Tab() );
+ 
++	pDocShell->PostContentChanged( ScRange( aPos ) );
++
+ 	SetChangeTrack();
+ 
+ 	EndRedo();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]