diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2020-02-09 13:13:34 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2020-02-09 18:11:04 +0100 |
commit | c4818b1caff43e64f657666ec85d289f196cf2e0 (patch) | |
tree | e74280b8bc9637a3fb5d98c875d682c50928307f /dbaccess | |
parent | 0f1bd7f0f79a054f1af1c5aadd81f586f2e4f879 (diff) |
Fix undo and redo dropdowns in non-sfx2 modules
after commit c34edadf5bd3d1d9f3c9c056af28b8964d8f1ca0
("rework SvxUndoRedoControl to be a PopupWindowController")
accidentally enabled them there, instead of the simple
buttons those modules used to have. Just implement the
necessary stuff, instead of hiding the dropdown again.
Change-Id: Ic93114f7f3cec8e96f3389ceb0d52552cde02a83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88333
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/misc/singledoccontroller.cxx | 42 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinController.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableController.cxx | 2 |
3 files changed, 40 insertions, 6 deletions
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx index bd915b0a5547..fdad96749447 100644 --- a/dbaccess/source/ui/misc/singledoccontroller.cxx +++ b/dbaccess/source/ui/misc/singledoccontroller.cxx @@ -120,6 +120,28 @@ namespace dbaui } break; + case SID_GETUNDOSTRINGS: + { + size_t nCount(GetUndoManager().GetUndoActionCount()); + Sequence<OUString> aSeq(nCount); + for (size_t n = 0; n < nCount; ++n) + aSeq[n] = GetUndoManager().GetUndoActionComment(n); + aReturn.aValue <<= aSeq; + aReturn.bEnabled = true; + break; + } + + case SID_GETREDOSTRINGS: + { + size_t nCount(GetUndoManager().GetRedoActionCount()); + Sequence<OUString> aSeq(nCount); + for (size_t n = 0; n < nCount; ++n) + aSeq[n] = GetUndoManager().GetRedoActionComment(n); + aReturn.aValue <<= aSeq; + aReturn.bEnabled = true; + break; + } + default: aReturn = OSingleDocumentController_Base::GetState(_nId); } @@ -130,16 +152,24 @@ namespace dbaui switch ( _nId ) { case ID_BROWSER_UNDO: - GetUndoManager().Undo(); - InvalidateFeature( ID_BROWSER_UNDO ); - InvalidateFeature( ID_BROWSER_REDO ); - break; - case ID_BROWSER_REDO: - GetUndoManager().Redo(); + { + sal_Int16 nCount(1); + if (_rArgs.hasElements() && _rArgs[0].Name != "KeyModifier") + _rArgs[0].Value >>= nCount; + + while (nCount--) + { + if (_nId == ID_BROWSER_UNDO) + GetUndoManager().Undo(); + else + GetUndoManager().Redo(); + } + InvalidateFeature( ID_BROWSER_UNDO ); InvalidateFeature( ID_BROWSER_REDO ); break; + } default: OSingleDocumentController_Base::Execute( _nId, _rArgs ); diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx index 37560014c4c7..4ad6b6c23337 100644 --- a/dbaccess/source/ui/querydesign/JoinController.cxx +++ b/dbaccess/source/ui/querydesign/JoinController.cxx @@ -307,6 +307,8 @@ void OJoinController::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:Undo", ID_BROWSER_UNDO, CommandGroup::EDIT ); implDescribeSupportedFeature( ".uno:AddTable", ID_BROWSER_ADDTABLE,CommandGroup::EDIT ); implDescribeSupportedFeature( ".uno:EditDoc", ID_BROWSER_EDITDOC, CommandGroup::EDIT ); + implDescribeSupportedFeature( ".uno:GetUndoStrings", SID_GETUNDOSTRINGS ); + implDescribeSupportedFeature( ".uno:GetRedoStrings", SID_GETREDOSTRINGS ); } sal_Bool SAL_CALL OJoinController::suspend(sal_Bool _bSuspend) diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 4d0cb028b148..c32cce6c97ce 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -606,6 +606,8 @@ void OTableController::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:SaveAs", ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT ); implDescribeSupportedFeature( ".uno:DBIndexDesign", SID_INDEXDESIGN, CommandGroup::APPLICATION ); implDescribeSupportedFeature( ".uno:EditDoc", ID_BROWSER_EDITDOC, CommandGroup::EDIT ); + implDescribeSupportedFeature( ".uno:GetUndoStrings", SID_GETUNDOSTRINGS ); + implDescribeSupportedFeature( ".uno:GetRedoStrings", SID_GETREDOSTRINGS ); } void OTableController::impl_onModifyChanged() |