summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2017-05-25 21:07:25 -0400
committerJan Holesovsky <kendy@collabora.com>2017-05-29 17:41:26 +0200
commit3ad60c39a266b54a0dd94ac8bd15a88d64c9dd5f (patch)
treed109c0d93e05b27ea693aa46af7e3d9741ad8779 /sfx2
parent9f8a05069770d7293d7491a426fca9c4342aa63b (diff)
sw lok: disable undo state if conflict with other views
Change-Id: I5497c9b1f236bc803529825ba8b423d55fffa93e Reviewed-on: https://gerrit.libreoffice.org/38049 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/38108 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/unoctitm.cxx21
1 files changed, 16 insertions, 5 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index af13d3d33698..68a1cff0dd83 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -111,7 +111,7 @@ const char* URLTypeNames[URLType_COUNT] =
"double"
};
-static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent);
+static void InterceptLOKStateChangeEvent( const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent, const SfxPoolItem* pState );
void SfxStatusDispatcher::ReleaseAll()
{
@@ -954,7 +954,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt
if (pDispatcher && pDispatcher->GetFrame())
{
- InterceptLOKStateChangeEvent(pDispatcher->GetFrame(), aEvent);
+ InterceptLOKStateChangeEvent(pDispatcher->GetFrame(), aEvent, pState);
}
Sequence< OUString > seqNames = pDispatch->GetListeners().getContainedTypes();
@@ -972,7 +972,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt
StateChanged( nSID, eState, pState, nullptr );
}
-static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent)
+static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent, const SfxPoolItem* pState)
{
if (!comphelper::LibreOfficeKit::isActive())
return;
@@ -1039,8 +1039,19 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
aBuffer.append(nColor);
}
else if (aEvent.FeatureURL.Path == "Undo" ||
- aEvent.FeatureURL.Path == "Redo" ||
- aEvent.FeatureURL.Path == "Cut" ||
+ aEvent.FeatureURL.Path == "Redo")
+ {
+ const SfxUInt32Item* pUndoConflict = dynamic_cast< const SfxUInt32Item * >( pState );
+ if ( pUndoConflict && pUndoConflict->GetValue() > 0 )
+ {
+ aBuffer.append(OUString("disabled"));
+ }
+ else
+ {
+ aBuffer.append(aEvent.IsEnabled ? OUString("enabled") : OUString("disabled"));
+ }
+ }
+ else if (aEvent.FeatureURL.Path == "Cut" ||
aEvent.FeatureURL.Path == "Copy" ||
aEvent.FeatureURL.Path == "Paste" ||
aEvent.FeatureURL.Path == "SelectAll" ||