summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2020-02-09 13:13:34 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2020-02-09 18:11:04 +0100
commitc4818b1caff43e64f657666ec85d289f196cf2e0 (patch)
treee74280b8bc9637a3fb5d98c875d682c50928307f /chart2
parent0f1bd7f0f79a054f1af1c5aadd81f586f2e4f879 (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 'chart2')
-rw-r--r--chart2/source/controller/main/CommandDispatchContainer.cxx5
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.cxx26
2 files changed, 24 insertions, 7 deletions
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& )
{