[Libreoffice-commits] core.git: chart2/source dbaccess/source reportdesign/source svx/source
Maxim Monastirsky (via logerrit)
logerrit at kemper.freedesktop.org
Sun Feb 9 17:11:44 UTC 2020
chart2/source/controller/main/CommandDispatchContainer.cxx | 5 +
chart2/source/controller/main/UndoCommandDispatch.cxx | 26 ++++++--
dbaccess/source/ui/misc/singledoccontroller.cxx | 42 +++++++++++--
dbaccess/source/ui/querydesign/JoinController.cxx | 2
dbaccess/source/ui/tabledesign/TableController.cxx | 2
reportdesign/source/ui/report/ReportController.cxx | 28 ++++++++
svx/source/tbxctrls/lboxctrl.cxx | 2
7 files changed, 91 insertions(+), 16 deletions(-)
New commits:
commit c4818b1caff43e64f657666ec85d289f196cf2e0
Author: Maxim Monastirsky <momonasmon at gmail.com>
AuthorDate: Sun Feb 9 13:13:34 2020 +0200
Commit: Maxim Monastirsky <momonasmon at gmail.com>
CommitDate: Sun Feb 9 18:11:04 2020 +0100
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 at gmail.com>
diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx
index 8056dfccecb9..b007ebe5c652 100644
--- a/chart2/source/controller/main/CommandDispatchContainer.cxx
+++ b/chart2/source/controller/main/CommandDispatchContainer.cxx
@@ -84,13 +84,16 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL(
{
uno::Reference< frame::XModel > xModel( m_xModel );
- if( xModel.is() && ( rURL.Path == "Undo" || rURL.Path == "Redo" ) )
+ if( xModel.is() && ( rURL.Path == "Undo" || rURL.Path == "Redo" ||
+ rURL.Path == "GetUndoStrings" || rURL.Path == "GetRedoStrings" ) )
{
CommandDispatch * pDispatch = new UndoCommandDispatch( m_xContext, xModel );
xResult.set( pDispatch );
pDispatch->initialize();
m_aCachedDispatches[ ".uno:Undo" ].set( xResult );
m_aCachedDispatches[ ".uno:Redo" ].set( xResult );
+ m_aCachedDispatches[ ".uno:GetUndoStrings" ].set( xResult );
+ m_aCachedDispatches[ ".uno:GetRedoStrings" ].set( xResult );
m_aToBeDisposedDispatches.push_back( xResult );
}
else if( xModel.is() && ( rURL.Path == "Context" || rURL.Path == "ModifiedStatus" ) )
diff --git a/chart2/source/controller/main/UndoCommandDispatch.cxx b/chart2/source/controller/main/UndoCommandDispatch.cxx
index 677ab8fb77ad..afa76424abd8 100644
--- a/chart2/source/controller/main/UndoCommandDispatch.cxx
+++ b/chart2/source/controller/main/UndoCommandDispatch.cxx
@@ -64,23 +64,30 @@ void UndoCommandDispatch::fireStatusEvent(
if( m_xUndoManager.is() )
{
const bool bFireAll = rURL.isEmpty();
- uno::Any aUndoState, aRedoState;
+ uno::Any aUndoState, aRedoState, aUndoStrings, aRedoStrings;
if( m_xUndoManager->isUndoPossible())
aUndoState <<= SvtResId( STR_UNDO ) + m_xUndoManager->getCurrentUndoActionTitle();
if( m_xUndoManager->isRedoPossible())
aRedoState <<= SvtResId( STR_REDO ) + m_xUndoManager->getCurrentRedoActionTitle();
+ aUndoStrings <<= m_xUndoManager->getAllUndoActionTitles();
+ aRedoStrings <<= m_xUndoManager->getAllRedoActionTitles();
+
if( bFireAll || rURL == ".uno:Undo" )
fireStatusEventForURL( ".uno:Undo", aUndoState, m_xUndoManager->isUndoPossible(), xSingleListener );
if( bFireAll || rURL == ".uno:Redo" )
fireStatusEventForURL( ".uno:Redo", aRedoState, m_xUndoManager->isRedoPossible(), xSingleListener );
+ if( bFireAll || rURL == ".uno:GetUndoStrings" )
+ fireStatusEventForURL( ".uno:GetUndoStrings", aUndoStrings, true, xSingleListener );
+ if( bFireAll || rURL == ".uno:GetRedoStrings" )
+ fireStatusEventForURL( ".uno:GetRedoStrings", aRedoStrings, true, xSingleListener );
}
}
// ____ XDispatch ____
void SAL_CALL UndoCommandDispatch::dispatch(
const util::URL& URL,
- const Sequence< beans::PropertyValue >& /* Arguments */ )
+ const Sequence< beans::PropertyValue >& Arguments )
{
if( m_xUndoManager.is() )
{
@@ -88,10 +95,17 @@ void SAL_CALL UndoCommandDispatch::dispatch(
SolarMutexGuard aSolarGuard;
try
{
- if ( URL.Path == "Undo" )
- m_xUndoManager->undo();
- else
- m_xUndoManager->redo();
+ sal_Int16 nCount( 1 );
+ if ( Arguments.hasElements() && Arguments[0].Name == URL.Path )
+ Arguments[0].Value >>= nCount;
+
+ while ( nCount-- )
+ {
+ if ( URL.Path == "Undo" )
+ m_xUndoManager->undo();
+ else
+ m_xUndoManager->redo();
+ }
}
catch( const document::UndoFailedException& )
{
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()
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 21f1a1021a9f..faeed5df7f21 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -453,6 +453,24 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
}
}
break;
+ case SID_GETUNDOSTRINGS:
+ case SID_GETREDOSTRINGS:
+ {
+ size_t ( SfxUndoManager::*retrieveCount )( bool const ) const =
+ ( _nId == SID_GETUNDOSTRINGS ) ? &SfxUndoManager::GetUndoActionCount : &SfxUndoManager::GetRedoActionCount;
+
+ OUString ( SfxUndoManager::*retrieveComment )( size_t, bool const ) const =
+ ( _nId == SID_GETUNDOSTRINGS ) ? &SfxUndoManager::GetUndoActionComment : &SfxUndoManager::GetRedoActionComment;
+
+ SfxUndoManager& rUndoManager( getUndoManager() );
+ size_t nCount(( rUndoManager.*retrieveCount )( SfxUndoManager::TopLevel ));
+ Sequence<OUString> aSeq(nCount);
+ for (size_t n = 0; n < nCount; ++n)
+ aSeq[n] = (rUndoManager.*retrieveComment)( n, SfxUndoManager::TopLevel );
+ aReturn.aValue <<= aSeq;
+ aReturn.bEnabled = true;
+ }
+ break;
case SID_OBJECT_RESIZING:
case SID_OBJECT_SMALLESTWIDTH:
case SID_OBJECT_SMALLESTHEIGHT:
@@ -1016,9 +1034,13 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
const OXUndoEnvironment::OUndoMode aLock( m_aReportModel->GetUndoEnv() );
bool ( SfxUndoManager::*doXDo )() =
( _nId == SID_UNDO ) ? &SfxUndoManager::Undo : &SfxUndoManager::Redo;
-
SfxUndoManager& rUndoManager( getUndoManager() );
- (rUndoManager.*doXDo)();
+
+ sal_Int16 nCount(1);
+ if (aArgs.hasElements() && aArgs[0].Name != "KeyModifier")
+ aArgs[0].Value >>= nCount;
+ while (nCount--)
+ (rUndoManager.*doXDo)();
InvalidateAll();
if (m_xGroupsFloater && m_xGroupsFloater->getDialog()->get_visible())
m_xGroupsFloater->UpdateData();
@@ -2022,6 +2044,8 @@ void OReportController::describeSupportedFeatures()
implDescribeSupportedFeature( ".uno:SelectAllEdits", SID_SELECT_ALL_EDITS);
implDescribeSupportedFeature( ".uno:CollapseSection", SID_COLLAPSE_SECTION);
implDescribeSupportedFeature( ".uno:ExpandSection", SID_EXPAND_SECTION);
+ implDescribeSupportedFeature( ".uno:GetUndoStrings", SID_GETUNDOSTRINGS);
+ implDescribeSupportedFeature( ".uno:GetRedoStrings", SID_GETREDOSTRINGS);
}
void OReportController::impl_onModifyChanged()
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index 43bd5d419f5d..0f8b12019263 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -154,7 +154,7 @@ void SvxUndoRedoControl::initialize( const css::uno::Sequence< css::uno::Any >&
ToolBox* pToolBox = nullptr;
sal_uInt16 nId = 0;
- if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL)
+ if (getToolboxId(nId, &pToolBox))
{
pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWN | pToolBox->GetItemBits(nId));
aDefaultTooltip = pToolBox->GetQuickHelpText(nId);
More information about the Libreoffice-commits
mailing list