diff options
author | Henry Castro <hcastro@collabora.com> | 2017-05-25 21:07:25 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2017-05-27 06:20:51 +0200 |
commit | 0582bd49b385ebcebf93fe87d0161ed4846c8805 (patch) | |
tree | 2fbad7faf409b16e6dac21a96405711c9288be8b /sfx2/source/control | |
parent | 95b9b46cca1da5f452af5e322af447fd27f82ea5 (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>
Diffstat (limited to 'sfx2/source/control')
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 30399c2c3cbe..3294bc0e9913 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -113,7 +113,7 @@ const char* const 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() { @@ -964,7 +964,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(); @@ -982,7 +982,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; @@ -1048,8 +1048,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" || |