diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-03-10 16:55:21 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-03-10 20:21:13 -0500 |
commit | 12343c15568dcc2c9209d8ca41fda2263122448f (patch) | |
tree | 3212a89c6cd8ea2e0aee7103aa9669bbb8a6f307 /sc/source/ui/view/tabvwshb.cxx | |
parent | 99745dbcbb25b61437914c9782475d0b67a4b0bd (diff) | |
parent | ce6308e4fad2281241bf4ca78280eba29f744d43 (diff) |
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
Diffstat (limited to 'sc/source/ui/view/tabvwshb.cxx')
-rw-r--r-- | sc/source/ui/view/tabvwshb.cxx | 122 |
1 files changed, 104 insertions, 18 deletions
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 10cd0d543c15..b744053a5c84 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -62,9 +62,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" @@ -115,7 +117,7 @@ void ScTabViewShell::ConnectObject( SdrOle2Obj* pObj ) } } -BOOL ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) +sal_Bool ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) { // Gueltigkeits-Hinweisfenster nicht ueber dem Objekt stehenlassen RemoveHintWindow(); @@ -123,7 +125,7 @@ BOOL ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef(); Window* pWin = GetActiveWin(); ErrCode nErr = ERRCODE_NONE; - BOOL bErrorShown = FALSE; + sal_Bool bErrorShown = false; { SfxInPlaceClient* pClient = FindIPClient( xObj, pWin ); @@ -173,7 +175,7 @@ BOOL ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) ((ScClient*)pClient)->SetGrafEdit( NULL ); nErr = pClient->DoVerb( nVerb ); - bErrorShown = TRUE; + bErrorShown = sal_True; // SfxViewShell::DoVerb zeigt seine Fehlermeldungen selber an // attach listener to selection changes in chart that affect cell @@ -260,7 +262,7 @@ void ScTabViewShell::DeactivateOle() void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) { - USHORT nSlot = rReq.GetSlot(); + sal_uInt16 nSlot = rReq.GetSlot(); if (nSlot != SID_OBJECTRESIZE ) { SC_MOD()->InputEnterHandler(); @@ -302,7 +304,6 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) case SID_INSERT_PLUGIN: case SID_INSERT_SOUND: case SID_INSERT_VIDEO: - case SID_INSERT_APPLET: case SID_INSERT_SMATH: case SID_INSERT_FLOATINGFRAME: FuInsertOLE(this, pWin, pView, pDrModel, rReq); @@ -329,7 +330,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) SdrMark* pMark = rMarkList.GetMark(0); SdrObject* pObj = pMark->GetMarkedSdrObj(); - UINT16 nSdrObjKind = pObj->GetObjIdentifier(); + sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); if (nSdrObjKind == OBJ_OLE2) { @@ -361,7 +362,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) // #98721# case SID_FM_CREATE_FIELDCONTROL: { - SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, sal_False ); + SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, false ); DBG_ASSERT( pDescriptorItem, "SID_FM_CREATE_FIELDCONTROL: invalid request args!" ); if(pDescriptorItem) @@ -422,13 +423,13 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) { - BOOL bOle = GetViewFrame()->GetFrame().IsInPlace(); - BOOL bTabProt = GetViewData()->GetDocument()->IsTabProtected(GetViewData()->GetTabNo()); + sal_Bool bOle = GetViewFrame()->GetFrame().IsInPlace(); + sal_Bool bTabProt = GetViewData()->GetDocument()->IsTabProtected(GetViewData()->GetTabNo()); ScDocShell* pDocShell = ( GetViewData() ? GetViewData()->GetDocShell() : NULL ); bool bShared = ( pDocShell ? pDocShell->IsDocShared() : false ); SfxWhichIter aIter(rSet); - USHORT nWhich = aIter.FirstWhich(); + sal_uInt16 nWhich = aIter.FirstWhich(); while ( nWhich ) { switch ( nWhich ) @@ -459,14 +460,6 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) rSet.DisableItem( nWhich ); break; - case SID_INSERT_APPLET: - // wenn SOLAR_JAVA nicht definiert ist, immer disablen -#ifdef SOLAR_JAVA - if (bOle || bTabProt) -#endif - rSet.DisableItem( nWhich ); - break; - case SID_INSERT_GRAPHIC: case SID_INSERT_AVMEDIA: case SID_FONTWORK_GALLERY_FLOATER: @@ -486,6 +479,99 @@ 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(); + + sal_uInt16 nSlot = rReq.GetSlot(); + switch ( nSlot ) + { + case SID_UNDO: + case SID_REDO: + if ( pUndoManager ) + { + sal_Bool bIsUndo = ( nSlot == SID_UNDO ); + + sal_uInt16 nCount = 1; + const SfxPoolItem* pItem; + if ( pReqArgs && pReqArgs->GetItemState( nSlot, sal_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) + sal_Bool bLockPaint = ( nCount > 1 && pUndoManager == GetUndoManager() ); + if ( bLockPaint ) + pDocSh->LockPaint(); + + try + { + for (sal_uInt16 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(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); + sal_uInt16 nWhich = aIter.FirstWhich(); + while ( nWhich ) + { + switch (nWhich) + { + case SID_GETUNDOSTRINGS: + case SID_GETREDOSTRINGS: + { + SfxStringListItem aStrLst( nWhich ); + if ( pUndoManager ) + { + List* pList = aStrLst.GetList(); + sal_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(); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |