diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2011-01-28 11:59:17 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2011-01-28 11:59:17 +0100 |
commit | e4324cb9bdde38e2d4c96795b9953532dc2e6e6c (patch) | |
tree | 97130fc8e16702215f5368b700539055f116f3d8 /sc | |
parent | b3542de32f60a2ea892dfb45ef76165b1d7c3c6a (diff) | |
parent | f8046cd3eb89264245d20dccdade3b1367f788b3 (diff) |
CWS-TOOLING: integrate CWS undoapi
Diffstat (limited to 'sc')
32 files changed, 169 insertions, 181 deletions
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 020ad95e4..e1c6a5634 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -288,8 +288,6 @@ BOOL ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, BOOL bDone = FALSE; BOOL bRet = FALSE; // Standard: kein Abbruch - SfxApplication* pSfxApp = SFX_APP(); - pSfxApp->EnterBasicCall(); // Dok-Basic anlegen etc. // Wenn das Dok waehrend eines Basic-Calls geladen wurde, // ist das Sbx-Objekt evtl. nicht angelegt (?) @@ -368,7 +366,7 @@ BOOL ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, if ( pCell ) pDocument->LockTable( rPos.Tab() ); SbxVariableRef refRes = new SbxVariable; - ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, NULL, refPar, refRes ); + ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, refPar, refRes ); if ( pCell ) pDocument->UnlockTable( rPos.Tab() ); @@ -380,7 +378,6 @@ BOOL ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, bRet = TRUE; bDone = TRUE; } - pSfxApp->LeaveBasicCall(); if ( !bDone && !pCell ) // Makro nicht gefunden (nur bei Eingabe) { diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index f2d5b99c2..2e97aac60 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2925,7 +2925,6 @@ BOOL ScCompiler::IsMacro( const String& rName ) SfxObjectShell* pDocSh = pDoc->GetDocumentShell(); SfxApplication* pSfxApp = SFX_APP(); - pSfxApp->EnterBasicCall(); // initialize document's BASIC if( pDocSh )//XXX pObj = pDocSh->GetBasic(); @@ -2942,7 +2941,6 @@ BOOL ScCompiler::IsMacro( const String& rName ) SbxMethod* pMeth = (SbxMethod*) pObj->Find( aName, SbxCLASS_METHOD ); if( !pMeth ) { - pSfxApp->LeaveBasicCall(); return FALSE; } // It really should be a BASIC function! @@ -2950,14 +2948,12 @@ BOOL ScCompiler::IsMacro( const String& rName ) || ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY ) || !pMeth->ISA(SbMethod) ) { - pSfxApp->LeaveBasicCall(); return FALSE; } ScRawToken aToken; aToken.SetExternal( aName.GetBuffer() ); aToken.eOp = ocMacro; pRawToken = aToken.Clone(); - pSfxApp->LeaveBasicCall(); return TRUE; } diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index d248211fa..0a07a5197 100755 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2707,9 +2707,6 @@ void ScInterpreter::ScMacro() // keine Sicherheitsabfrage mehr vorneweg (nur CheckMacroWarn), das passiert im CallBasic - SfxApplication* pSfxApp = SFX_APP(); - pSfxApp->EnterBasicCall(); // Dok-Basic anlegen etc. - // Wenn das Dok waehrend eines Basic-Calls geladen wurde, // ist das Sbx-Objekt evtl. nicht angelegt (?) // pDocSh->GetSbxObject(); @@ -2722,7 +2719,6 @@ void ScInterpreter::ScMacro() if( !pVar || pVar->GetType() == SbxVOID || !pVar->ISA(SbMethod) ) { PushError( errNoMacro ); - pSfxApp->LeaveBasicCall(); return; } @@ -2841,7 +2837,7 @@ void ScInterpreter::ScMacro() pDok->LockTable( aPos.Tab() ); SbxVariableRef refRes = new SbxVariable; pDok->IncMacroInterpretLevel(); - ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, NULL, refPar, refRes ); + ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, refPar, refRes ); pDok->DecMacroInterpretLevel(); pDok->UnlockTable( aPos.Tab() ); @@ -2914,8 +2910,6 @@ void ScInterpreter::ScMacro() else PushString( refRes->GetString() ); } - - pSfxApp->LeaveBasicCall(); } diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 65ebb1ea1..f23bb4d72 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -58,7 +58,6 @@ #include <vcl/status.hxx> #include <sfx2/bindings.hxx> #include <sfx2/request.hxx> -#include <sfx2/macrconf.hxx> #include <sfx2/printer.hxx> #include <editeng/langitem.hxx> #include <svtools/colorcfg.hxx> @@ -391,20 +390,14 @@ void ScModule::Execute( SfxRequest& rReq ) { String aMacroName = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Template.Samples.ShowStyles")); - SfxApplication* pApp = SFX_APP(); - pApp->EnterBasicCall(); - pApp->GetMacroConfig()->Call( NULL, aMacroName, pApp->GetBasicManager() ); - pApp->LeaveBasicCall(); + SfxApplication::CallAppBasic( aMacroName ); } break; case SID_EURO_CONVERTER: { String aMacroName = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Euro.ConvertRun.Main")); - SfxApplication* pApp = SFX_APP(); - pApp->EnterBasicCall(); - pApp->GetMacroConfig()->Call( NULL, aMacroName, pApp->GetBasicManager() ); - pApp->LeaveBasicCall(); + SfxApplication::CallAppBasic( aMacroName ); } break; case SID_AUTOSPELL_CHECK: diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 6e7c3fa2f..363befdf2 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1137,7 +1137,7 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con if (aTester.IsEditable()) { ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); - SfxUndoManager* pUndoMgr = (pDrawLayer && rDoc.IsUndoEnabled()) ? rDocShell.GetUndoManager() : 0; + ::svl::IUndoManager* pUndoMgr = (pDrawLayer && rDoc.IsUndoEnabled()) ? rDocShell.GetUndoManager() : 0; ScNoteData aOldData; ScPostIt* pOldNote = rDoc.ReleaseNote( rPos ); @@ -1741,8 +1741,7 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, } rDocShell.GetUndoManager()->LeaveListAction(); - SfxUndoManager* pMgr = rDocShell.GetUndoManager(); - pMgr->RemoveLastUndoAction(); + rDocShell.GetUndoManager()->RemoveLastUndoAction(); delete pRefUndoDoc; delete pUndoData; @@ -2618,7 +2617,6 @@ script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule ) void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String& sSource ) { - SFX_APP()->EnterBasicCall(); SfxObjectShell& rDocSh = *rDoc.GetDocumentShell(); uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer(); DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" ); @@ -2662,12 +2660,10 @@ void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String } } - SFX_APP()->LeaveBasicCall(); } void VBA_DeleteModule( ScDocShell& rDocSh, String& sModuleName ) { - SFX_APP()->EnterBasicCall(); uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer(); DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" ); @@ -2689,7 +2685,6 @@ void VBA_DeleteModule( ScDocShell& rDocSh, String& sModuleName ) xVBAModuleInfo->removeModuleInfo( sModuleName ); } - SFX_APP()->LeaveBasicCall(); } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index eb4714080..74f0e00cc 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2581,7 +2581,7 @@ __EXPORT ScDocShell::~ScDocShell() //------------------------------------------------------------------ -SfxUndoManager* __EXPORT ScDocShell::GetUndoManager() +::svl::IUndoManager* __EXPORT ScDocShell::GetUndoManager() { return aDocument.GetUndoManager(); } diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index 7d1392ba0..dca826a7c 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -68,7 +68,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) : pViewData( pData ) { SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() ); - SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); if ( !pViewData->GetDocument()->IsUndoEnabled() ) { diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 7373142a9..085b97922 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -127,7 +127,7 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) : SetPool( pViewData->GetScDrawView()->GetDefaultAttr().GetPool() ); // UndoManager wird beim Umschalten in den Edit-Modus umgesetzt... - SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); if ( !pViewData->GetDocument()->IsUndoEnabled() ) { diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx index dd6c80f17..23a20f9cd 100644 --- a/sc/source/ui/drawfunc/futext3.cxx +++ b/sc/source/ui/drawfunc/futext3.cxx @@ -85,7 +85,7 @@ void FuText::StopEditMode(BOOL /*bTextDirection*/) } ScDocShell* pDocShell = rViewData.GetDocShell(); - SfxUndoManager* pUndoMgr = rDoc.IsUndoEnabled() ? pDocShell->GetUndoManager() : 0; + ::svl::IUndoManager* pUndoMgr = rDoc.IsUndoEnabled() ? pDocShell->GetUndoManager() : 0; bool bNewNote = false; if( pNote && pUndoMgr ) { diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 44e11718e..773cce6b1 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -187,7 +187,8 @@ public: virtual void Activate(); virtual void Deactivate(); - virtual SfxUndoManager* GetUndoManager(); + virtual ::svl::IUndoManager* + GetUndoManager(); virtual void FillClass( SvGlobalName * pClassName, sal_uInt32 * pFormat, @@ -325,6 +326,8 @@ public: void PostPaintGridAll(); void PostPaintExtras(); + bool IsPaintLocked() const { return pPaintLockData != NULL; } + void PostDataChanged(); void UpdatePaintExt( USHORT& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 621e9a167..9fb067800 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -346,7 +346,7 @@ public: BOOL IsDrawTextShell() const; BOOL IsAuditShell() const; - void SetDrawTextUndo( SfxUndoManager* pUndoMgr ); + void SetDrawTextUndo( ::svl::IUndoManager* pUndoMgr ); void FillFieldData( ScHeaderFieldData& rData ); diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx index 4bb22d42f..3424865f0 100644 --- a/sc/source/ui/inc/undobase.hxx +++ b/sc/source/ui/inc/undobase.hxx @@ -31,6 +31,7 @@ #include <svl/undo.hxx> #include "global.hxx" #include "address.hxx" +#include "docsh.hxx" class ScDocument; class ScDocShell; @@ -53,6 +54,10 @@ protected: ScDocShell* pDocShell; SfxUndoAction* pDetectiveUndo; + bool IsPaintLocked() const { return pDocShell->IsPaintLocked(); } + + bool SetViewMarkData( const ScMarkData& rMarkData ); + void BeginUndo(); void EndUndo(); void BeginRedo(); diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index 3798d7f76..7d108f37d 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -66,6 +66,19 @@ __EXPORT ScSimpleUndo::~ScSimpleUndo() delete pDetectiveUndo; } +bool ScSimpleUndo::SetViewMarkData( const ScMarkData& rMarkData ) +{ + if ( IsPaintLocked() ) + return false; + + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); + if ( !pViewShell ) + return false; + + pViewShell->SetMarkData( rMarkData ); + return true; +} + BOOL __EXPORT ScSimpleUndo::Merge( SfxUndoAction *pNextAction ) { // Zu jeder Undo-Action kann eine SdrUndoGroup fuer das Aktualisieren @@ -253,6 +266,9 @@ BOOL ScBlockUndo::AdjustHeight() void ScBlockUndo::ShowBlock() { + if ( IsPaintLocked() ) + return; + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 6c096c99f..5e38fcbff 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1600,10 +1600,8 @@ String __EXPORT ScUndoSelectionStyle::GetComment() const void ScUndoSelectionStyle::DoChange( const BOOL bUndo ) { ScDocument* pDoc = pDocShell->GetDocument(); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); ScRange aWorkRange( aRange ); if ( pDoc->HasAttrib( aWorkRange, HASATTR_MERGED ) ) // zusammengefasste Zellen? @@ -1635,6 +1633,7 @@ void ScUndoSelectionStyle::DoChange( const BOOL bUndo ) pDocShell->UpdatePaintExt( nExtFlags, aWorkRange ); + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) ) /*A*/ pDocShell->PostPaint( aWorkRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags ); diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx index bf9540ce7..e6e5cc108 100644 --- a/sc/source/ui/undo/undoblk2.cxx +++ b/sc/source/ui/undo/undoblk2.cxx @@ -113,18 +113,13 @@ void __EXPORT ScUndoWidthOrHeight::Undo() BeginUndo(); ScDocument* pDoc = pDocShell->GetDocument(); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); SCCOLROW nPaintStart = nStart > 0 ? nStart-1 : static_cast<SCCOLROW>(0); if (eMode==SC_SIZE_OPTIMAL) { - if (pViewShell) - { - pViewShell->SetMarkData( aMarkData ); - + if ( SetViewMarkData( aMarkData ) ) nPaintStart = 0; // paint all, because of changed selection - } } //! outlines from all tables? @@ -155,6 +150,7 @@ void __EXPORT ScUndoWidthOrHeight::Undo() DoSdrUndoAction( pDrawUndo, pDoc ); + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { pViewShell->UpdateScrollBars(); @@ -171,19 +167,14 @@ void __EXPORT ScUndoWidthOrHeight::Redo() { BeginRedo(); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - BOOL bPaintAll = FALSE; if (eMode==SC_SIZE_OPTIMAL) { - if (pViewShell) - { - pViewShell->SetMarkData( aMarkData ); - + if ( SetViewMarkData( aMarkData ) ) bPaintAll = TRUE; // paint all, because of changed selection - } } + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { SCTAB nTab = pViewShell->GetViewData()->GetTabNo(); @@ -192,7 +183,8 @@ void __EXPORT ScUndoWidthOrHeight::Redo() } // SetWidthOrHeight aendert aktuelle Tabelle ! - pViewShell->SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nNewSize, FALSE, TRUE, &aMarkData ); + if ( pViewShell ) + pViewShell->SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nNewSize, FALSE, TRUE, &aMarkData ); // paint grid if selection was changed directly at the MarkData if (bPaintAll) diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 0a6325198..1b2d3c431 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -147,10 +147,8 @@ void ScUndoDeleteContents::SetChangeTrack() void ScUndoDeleteContents::DoChange( const BOOL bUndo ) { ScDocument* pDoc = pDocShell->GetDocument(); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); USHORT nExtFlags = 0; @@ -195,6 +193,7 @@ void ScUndoDeleteContents::DoChange( const BOOL bUndo ) SetChangeTrack(); } + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if ( !( (pViewShell) && pViewShell->AdjustRowHeight( aRange.aStart.Row(), aRange.aEnd.Row() ) ) ) /*A*/ pDocShell->PostPaint( aRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags ); @@ -341,10 +340,8 @@ void ScUndoFillTable::SetChangeTrack() void ScUndoFillTable::DoChange( const BOOL bUndo ) { ScDocument* pDoc = pDocShell->GetDocument(); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); if (bUndo) // nur Undo { @@ -379,6 +376,7 @@ void ScUndoFillTable::DoChange( const BOOL bUndo ) // CellContentChanged kommt mit der Markierung + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { SCTAB nTab = pViewShell->GetViewData()->GetTabNo(); @@ -485,10 +483,8 @@ String __EXPORT ScUndoSelectionAttr::GetComment() const void ScUndoSelectionAttr::DoChange( const BOOL bUndo ) { ScDocument* pDoc = pDocShell->GetDocument(); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); ScRange aEffRange( aRange ); if ( pDoc->HasAttrib( aEffRange, HASATTR_MERGED ) ) // zusammengefasste Zellen? @@ -515,6 +511,7 @@ void ScUndoSelectionAttr::DoChange( const BOOL bUndo ) pDoc->ApplySelectionFrame( aMarkData, pLineOuter, pLineInner ); } + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) ) /*A*/ pDocShell->PostPaint( aEffRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags ); @@ -1165,8 +1162,7 @@ void __EXPORT ScUndoReplace::Undo() DBG_ASSERT(pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL, "ScUndoReplace:: Falscher Modus"); - if (pViewShell) - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); //! markierte Tabellen //! Bereich merken ? @@ -1243,7 +1239,7 @@ void __EXPORT ScUndoReplace::Redo() { if (pViewShell) { - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); pViewShell->SearchAndReplace( pSearchItem, FALSE, TRUE ); } @@ -1466,9 +1462,7 @@ void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPo ScDocument* pDoc = pDocShell->GetDocument(); ShowTable( rCursorPos.Tab() ); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); SCTAB nTabCount = pDoc->GetTableCount(); // Undo/Redo-doc has only selected tables @@ -1575,9 +1569,7 @@ void ScUndoRefConversion::DoChange( ScDocument* pRefDoc) ShowTable(aRange); - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); ScRange aCopyRange = aRange; SCTAB nTabCount = pDoc->GetTableCount(); @@ -1586,6 +1578,7 @@ void ScUndoRefConversion::DoChange( ScDocument* pRefDoc) pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, pDoc, &aMarkData ); pDocShell->PostPaint( aRange, PAINT_GRID); pDocShell->PostDataChanged(); + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) pViewShell->CellContentChanged(); } diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 595be642a..d9f7efffe 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -891,9 +891,7 @@ void ScUndoMakeScenario::Undo() void ScUndoMakeScenario::Redo() { - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if (pViewShell) - pViewShell->SetMarkData( aMarkData ); + SetViewMarkData( aMarkData ); RedoSdrUndoAction( pDrawUndo ); // Draw Redo first @@ -905,6 +903,7 @@ void ScUndoMakeScenario::Redo() bDrawIsInUndo = FALSE; pDocShell->SetInUndo( FALSE ); + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) pViewShell->SetTabNo( nDestTab, TRUE ); diff --git a/sc/source/ui/undo/undoutil.cxx b/sc/source/ui/undo/undoutil.cxx index c87fd8a54..47a4c4af0 100644 --- a/sc/source/ui/undo/undoutil.cxx +++ b/sc/source/ui/undo/undoutil.cxx @@ -43,10 +43,13 @@ #include "globstr.hrc" #include "global.hxx" -void ScUndoUtil::MarkSimpleBlock( ScDocShell* /* pDocShell */, +void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell, SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, SCCOL nEndX, SCROW nEndY, SCTAB nEndZ ) { + if ( pDocShell->IsPaintLocked() ) + return; + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index a0683a815..c87aee064 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -481,7 +481,6 @@ void SAL_CALL ScVbaApplication::wait( double time ) throw (uno::RuntimeException) { StarBASIC* pBasic = SFX_APP()->GetBasic(); - SFX_APP()->EnterBasicCall(); SbxArrayRef aArgs = new SbxArray; SbxVariableRef aRef = new SbxVariable; aRef->PutDouble( time ); @@ -495,8 +494,6 @@ ScVbaApplication::wait( double time ) throw (uno::RuntimeException) // forces a broadcast SbxVariableRef pNew = new SbxMethod( *((SbxMethod*)pMeth)); } - SFX_APP()->LeaveBasicCall(); - } uno::Any SAL_CALL @@ -1164,7 +1161,6 @@ uno::Any SAL_CALL ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeException ) { StarBASIC* pBasic = SFX_APP()->GetBasic(); - SFX_APP()->EnterBasicCall(); SbMethod* pMeth = (SbMethod*)pBasic->GetRtl()->Find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FuncCaller") ), SbxCLASS_METHOD ); uno::Any aRet; if ( pMeth ) @@ -1175,7 +1171,6 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep OSL_TRACE("pNew has type %d and string value %s", pNew->GetType(), rtl::OUStringToOString( pNew->GetString(), RTL_TEXTENCODING_UTF8 ).getStr() ); aRet = sbxToUnoValue( pNew ); } - SFX_APP()->LeaveBasicCall(); return aRet; } diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx index ab2159b50..afe57e6e6 100644 --- a/sc/source/ui/view/auditsh.cxx +++ b/sc/source/ui/view/auditsh.cxx @@ -68,7 +68,7 @@ ScAuditingShell::ScAuditingShell(ScViewData* pData) : nFunction( SID_FILL_ADD_PRED ) { SetPool( &pViewData->GetViewShell()->GetPool() ); - SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); if ( !pViewData->GetDocument()->IsUndoEnabled() ) { diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 7e9518f97..b9c50707d 100755..100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -2187,7 +2187,7 @@ void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet pInsDoc->GetCellArea( nNewTab, nEndCol, nEndRow ); pInsDoc->SetClipArea( ScRange( 0, 0, nNewTab, nEndCol, nEndRow, nNewTab ) ); - SfxUndoManager* pMgr = GetViewData()->GetDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = GetViewData()->GetDocShell()->GetUndoManager(); String aUndo = ScGlobal::GetRscString( STR_UNDO_DOOUTLINE ); pMgr->EnterListAction( aUndo, aUndo ); diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 51f293c56..383d9db0d 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -763,7 +763,7 @@ void ScDrawView::DeleteMarked() (void)pCaptObj; // prevent 'unused variable' compiler warning in pro builds ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : 0; - SfxUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : 0; + ::svl::IUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : 0; bool bUndo = pDrawLayer && pDocShell && pUndoMgr && pDoc->IsUndoEnabled(); // remove the cell note from document, we are its owner now diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 3ca671d93..914c2157a 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -1174,7 +1174,7 @@ void ScEditShell::GetUndoState(SfxItemSet &rSet) EditView* pTopView = pHdl->GetTopView(); if (pTopView) { - SfxUndoManager& rTopMgr = pTopView->GetEditEngine()->GetUndoManager(); + ::svl::IUndoManager& rTopMgr = pTopView->GetEditEngine()->GetUndoManager(); if ( rTopMgr.GetUndoActionCount() == 0 ) rSet.DisableItem( SID_UNDO ); if ( rTopMgr.GetRedoActionCount() == 0 ) diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index d7d401aef..ba876261a 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -161,7 +161,7 @@ ScFormatShell::ScFormatShell(ScViewData* pData) : ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); SetPool( &pTabViewShell->GetPool() ); - SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); if ( !pViewData->GetDocument()->IsUndoEnabled() ) { diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 64df802e8..cccd511b1 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1884,7 +1884,7 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) if (nMouseStatus == SC_GM_WATERUNDO) // Undo im Giesskannenmodus { - SfxUndoManager* pMgr = pViewData->GetDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = pViewData->GetDocShell()->GetUndoManager(); if ( pMgr->GetUndoActionCount() && pMgr->GetUndoActionId() == STR_UNDO_APPLYCELLSTYLE ) pMgr->Undo(); else diff --git a/sc/source/ui/view/pgbrksh.cxx b/sc/source/ui/view/pgbrksh.cxx index 472d3457d..179f4958c 100644 --- a/sc/source/ui/view/pgbrksh.cxx +++ b/sc/source/ui/view/pgbrksh.cxx @@ -67,7 +67,7 @@ ScPageBreakShell::ScPageBreakShell( ScTabViewShell* pViewSh ) : { SetPool( &pViewSh->GetPool() ); ScViewData* pViewData = pViewSh->GetViewData(); - SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); if ( !pViewData->GetDocument()->IsUndoEnabled() ) { diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx index 82f0c62da..42eb44a52 100644 --- a/sc/source/ui/view/pivotsh.cxx +++ b/sc/source/ui/view/pivotsh.cxx @@ -76,7 +76,7 @@ ScPivotShell::ScPivotShell( ScTabViewShell* pViewSh ) : { SetPool( &pViewSh->GetPool() ); ScViewData* pViewData = pViewSh->GetViewData(); - SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); + ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); if ( !pViewData->GetDocument()->IsUndoEnabled() ) { diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 367ea1449..13afc193e 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1116,7 +1116,7 @@ BOOL ScTabViewShell::IsAuditShell() const return ( pAuditingShell && ( GetMySubShell() == pAuditingShell ) ); } -void ScTabViewShell::SetDrawTextUndo( SfxUndoManager* pNewUndoMgr ) +void ScTabViewShell::SetDrawTextUndo( ::svl::IUndoManager* pNewUndoMgr ) { // Default: Undo-Manager der DocShell if (!pNewUndoMgr) @@ -1640,7 +1640,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode ) MakeDrawView( nForceDesignMode ); ViewOptionsHasChanged(FALSE); // legt auch evtl. DrawView an - SfxUndoManager* pMgr = pDocSh->GetUndoManager(); + ::svl::IUndoManager* pMgr = pDocSh->GetUndoManager(); SetUndoManager( pMgr ); pFormShell->SetUndoManager( pMgr ); if ( !pDoc->IsUndoEnabled() ) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 436fe7eab..bd98aaf4c 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -34,7 +34,6 @@ #define _ZFORLIST_DECLARE_TABLE #include "scitems.hxx" -#include <svl/slstitm.hxx> #include <svl/stritem.hxx> #include <svl/whiter.hxx> #include <svl/zformat.hxx> @@ -738,92 +737,6 @@ void __EXPORT ScTabViewShell::GetSaveState( SfxItemSet& rSet ) //------------------------------------------------------------------ -void ScTabViewShell::ExecuteUndo(SfxRequest& rReq) -{ - SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0); - SfxUndoManager* pUndoManager = pSh->GetUndoManager(); - - const SfxItemSet* pReqArgs = rReq.GetArgs(); - ScDocShell* pDocSh = GetViewData()->GetDocShell(); - - USHORT nSlot = rReq.GetSlot(); - switch ( nSlot ) - { - case SID_UNDO: - case SID_REDO: - if ( pUndoManager ) - { - BOOL bIsUndo = ( nSlot == SID_UNDO ); - - USHORT nCount = 1; - const SfxPoolItem* pItem; - if ( pReqArgs && pReqArgs->GetItemState( nSlot, TRUE, &pItem ) == SFX_ITEM_SET ) - nCount = ((const SfxUInt16Item*)pItem)->GetValue(); - - // lock paint for more than one cell undo action (not for editing within a cell) - BOOL bLockPaint = ( nCount > 1 && pUndoManager == GetUndoManager() ); - if ( bLockPaint ) - pDocSh->LockPaint(); - - for (USHORT i=0; i<nCount; i++) - { - if ( bIsUndo ) - pUndoManager->Undo(0); - else - pUndoManager->Redo(0); - } - - if ( bLockPaint ) - pDocSh->UnlockPaint(); - - GetViewFrame()->GetBindings().InvalidateAll(sal_False); - } - break; -// default: -// GetViewFrame()->ExecuteSlot( rReq ); - } -} - -void ScTabViewShell::GetUndoState(SfxItemSet &rSet) -{ - SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0); - SfxUndoManager* pUndoManager = pSh->GetUndoManager(); - - SfxWhichIter aIter(rSet); - USHORT nWhich = aIter.FirstWhich(); - while ( nWhich ) - { - switch (nWhich) - { - case SID_GETUNDOSTRINGS: - case SID_GETREDOSTRINGS: - { - SfxStringListItem aStrLst( nWhich ); - if ( pUndoManager ) - { - List* pList = aStrLst.GetList(); - BOOL bIsUndo = ( nWhich == SID_GETUNDOSTRINGS ); - USHORT nCount = bIsUndo ? pUndoManager->GetUndoActionCount() : pUndoManager->GetRedoActionCount(); - for (USHORT i=0; i<nCount; i++) - pList->Insert( new String( bIsUndo ? pUndoManager->GetUndoActionComment(i) : - pUndoManager->GetRedoActionComment(i) ), - LIST_APPEND ); - } - rSet.Put( aStrLst ); - } - break; - default: - // get state from sfx view frame - GetViewFrame()->GetSlotState( nWhich, NULL, &rSet ); - } - - nWhich = aIter.NextWhich(); - } -} - - -//------------------------------------------------------------------ - void ScTabViewShell::ExecDrawOpt( SfxRequest& rReq ) { ScViewOptions aViewOptions = GetViewData()->GetOptions(); diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index cd61a6c23..420a270d6 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -61,9 +61,11 @@ #include <sfx2/viewfrm.hxx> #include <svtools/soerr.hxx> #include <svl/rectitem.hxx> +#include <svl/slstitm.hxx> #include <svl/whiter.hxx> #include <unotools/moduleoptions.hxx> #include <sot/exchange.hxx> +#include <tools/diagnose_ex.h> #include "tabvwsh.hxx" #include "globstr.hrc" @@ -487,5 +489,98 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) } +//------------------------------------------------------------------ + +void ScTabViewShell::ExecuteUndo(SfxRequest& rReq) +{ + SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0); + ::svl::IUndoManager* pUndoManager = pSh->GetUndoManager(); + + const SfxItemSet* pReqArgs = rReq.GetArgs(); + ScDocShell* pDocSh = GetViewData()->GetDocShell(); + + USHORT nSlot = rReq.GetSlot(); + switch ( nSlot ) + { + case SID_UNDO: + case SID_REDO: + if ( pUndoManager ) + { + BOOL bIsUndo = ( nSlot == SID_UNDO ); + + USHORT nCount = 1; + const SfxPoolItem* pItem; + if ( pReqArgs && pReqArgs->GetItemState( nSlot, TRUE, &pItem ) == SFX_ITEM_SET ) + nCount = ((const SfxUInt16Item*)pItem)->GetValue(); + + // lock paint for more than one cell undo action (not for editing within a cell) + BOOL bLockPaint = ( nCount > 1 && pUndoManager == GetUndoManager() ); + if ( bLockPaint ) + pDocSh->LockPaint(); + + try + { + for (USHORT i=0; i<nCount; i++) + { + if ( bIsUndo ) + pUndoManager->Undo(); + else + pUndoManager->Redo(); + } + } + catch ( const uno::Exception& ) + { + // no need to handle. By definition, the UndoManager handled this by clearing the + // Undo/Redo stacks + } + + if ( bLockPaint ) + pDocSh->UnlockPaint(); + + GetViewFrame()->GetBindings().InvalidateAll(sal_False); + } + break; +// default: +// GetViewFrame()->ExecuteSlot( rReq ); + } +} + +void ScTabViewShell::GetUndoState(SfxItemSet &rSet) +{ + SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0); + ::svl::IUndoManager* pUndoManager = pSh->GetUndoManager(); + + SfxWhichIter aIter(rSet); + USHORT nWhich = aIter.FirstWhich(); + while ( nWhich ) + { + switch (nWhich) + { + case SID_GETUNDOSTRINGS: + case SID_GETREDOSTRINGS: + { + SfxStringListItem aStrLst( nWhich ); + if ( pUndoManager ) + { + List* pList = aStrLst.GetList(); + BOOL bIsUndo = ( nWhich == SID_GETUNDOSTRINGS ); + size_t nCount = bIsUndo ? pUndoManager->GetUndoActionCount() : pUndoManager->GetRedoActionCount(); + for (size_t i=0; i<nCount; i++) + pList->Insert( new String( bIsUndo ? pUndoManager->GetUndoActionComment(i) : + pUndoManager->GetRedoActionComment(i) ), + LIST_APPEND ); + } + rSet.Put( aStrLst ); + } + break; + default: + // get state from sfx view frame + GetViewFrame()->GetSlotState( nWhich, NULL, &rSet ); + } + + nWhich = aIter.NextWhich(); + } +} + diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index e7116c83b..af4b614f9 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -675,7 +675,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { // handle several sheets - SfxUndoManager* pUndoManager = pDocSh->GetUndoManager(); + ::svl::IUndoManager* pUndoManager = pDocSh->GetUndoManager(); String aUndo = ScGlobal::GetRscString( STR_UNDO_TAB_RTL ); pUndoManager->EnterListAction( aUndo, aUndo ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 4e0c01b20..90a1804bf 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1009,7 +1009,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, ScDocument* pDoc = GetViewData()->GetDocument(); ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScMarkData& rMark = GetViewData()->GetMarkData(); - SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager(); + ::svl::IUndoManager* pUndoMgr = pDocSh->GetUndoManager(); const BOOL bRecord(pDoc->IsUndoEnabled()); ScDocShellModificator aModificator( *pDocSh ); @@ -1635,7 +1635,7 @@ bool ScViewFunc::PasteMultiRangesFromClip( if (pDoc->IsUndoEnabled()) { - SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager(); + ::svl::IUndoManager* pUndoMgr = pDocSh->GetUndoManager(); String aUndo = ScGlobal::GetRscString( pClipDoc->IsCutMode() ? STR_UNDO_CUT : STR_UNDO_COPY); pUndoMgr->EnterListAction(aUndo, aUndo); |