include/sfx2/dispatch.hxx | 1 sc/source/ui/miscdlgs/dataproviderdlg.cxx | 2 - sc/uiconfig/scalc/ui/dataproviderdlg.ui | 17 +++++++++++++-- sfx2/source/control/dispatch.cxx | 32 ++++++++++++++++++++++++++++-- 4 files changed, 46 insertions(+), 6 deletions(-)
New commits: commit a7e883f6fc8665f9d0fb522e1c2be41734ff8542 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Apr 6 14:15:28 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat Apr 6 22:11:08 2024 +0200 use "ok" id like the other 446 dialogs instead of "okay" and similar standardizations of stock labels and allow mnemonics Change-Id: I75c06f5a8ab961cf3b5427c33c801ae0f5ea5a78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165854 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx index 16a6c446647b..82f5163e289b 100644 --- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx +++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx @@ -777,7 +777,7 @@ ScDataProviderDlg::ScDataProviderDlg(weld::Window* pParent, std::shared_ptr<ScDo , m_xTableParent(mxBox->CreateChildFrame()) , mxTable(VclPtr<ScDataTableView>::Create(m_xTableParent, mxDoc)) , mxDBRanges(m_xBuilder->weld_combo_box("select_db_range")) - , mxOKBtn(m_xBuilder->weld_button("okay")) + , mxOKBtn(m_xBuilder->weld_button("ok")) , mxCancelBtn(m_xBuilder->weld_button("cancel")) , mxAddTransformationBtn(m_xBuilder->weld_button("add_transformation")) , mxScroll(m_xBuilder->weld_scrolled_window("scroll")) diff --git a/sc/uiconfig/scalc/ui/dataproviderdlg.ui b/sc/uiconfig/scalc/ui/dataproviderdlg.ui index a2fa7978cb20..23eb805a6066 100644 --- a/sc/uiconfig/scalc/ui/dataproviderdlg.ui +++ b/sc/uiconfig/scalc/ui/dataproviderdlg.ui @@ -19,11 +19,14 @@ <property name="margin-bottom">6</property> <property name="layout-style">end</property> <child> - <object class="GtkButton" id="okay"> - <property name="label" translatable="yes" context="dataproviderdlg/okbtn">OK</property> + <object class="GtkButton" id="ok"> + <property name="label" translatable="yes" context="stock">_OK</property> <property name="visible">True</property> <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> <property name="receives-default">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">True</property> @@ -33,10 +36,11 @@ </child> <child> <object class="GtkButton" id="cancel"> - <property name="label" translatable="yes" context="dataproviderdlg/cancelbtn">Cancel</property> + <property name="label" translatable="yes" context="stock">_Cancel</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">True</property> @@ -161,6 +165,7 @@ <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="left-attach">2</property> @@ -241,6 +246,7 @@ <property name="tooltip-text" translatable="yes" context="dataproviderdlg/AddTransformation_tooltip">Add Transformations</property> <property name="halign">end</property> <property name="margin-end">12</property> + <property name="use-underline">True</property> </object> <packing> <property name="left-attach">1</property> @@ -357,6 +363,7 @@ <property name="tooltip-text" translatable="yes" context="dataproviderdlg/apply_tooltiptext">Apply Changes</property> <property name="halign">end</property> <property name="margin-end">6</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -397,5 +404,9 @@ </child> </object> </child> + <action-widgets> + <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> + </action-widgets> </object> </interface> commit 1a6457e4b4d6fbea92fae1fe1b5c27a566dc54c0 Author: Gökay Şatır <gokaysa...@gmail.com> AuthorDate: Tue Mar 26 18:41:34 2024 +0300 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat Apr 6 22:10:57 2024 +0200 Enable allowing comment editing in readOnly view mode. Signed-off-by: Gökay Şatır <gokaysa...@gmail.com> Change-Id: I536448da395568cd43af6f4d1d36ef09f3c6a6b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165349 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Gökay ŞATIR <gokaysa...@collabora.com> (cherry picked from commit 226e2263468da403d1f9db504115830f5a030229) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165834 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx index eea69d2a5abc..48cb3605a8c0 100644 --- a/include/sfx2/dispatch.hxx +++ b/include/sfx2/dispatch.hxx @@ -90,6 +90,7 @@ friend class SfxHintPoster; bool FindServer_( sal_uInt16 nId, SfxSlotServer &rServer ); + static bool IsCommandAllowedInLokReadOnlyViewMode (OUString commandName); bool FillState_( const SfxSlotServer &rServer, SfxItemSet &rState, const SfxSlot *pRealSlot ); void Execute_( SfxShell &rShell, const SfxSlot &rSlot, diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 6ae4d71a6db9..300f0179b064 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1520,6 +1520,23 @@ SfxSlotFilterState SfxDispatcher::IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) return bFound ? SfxSlotFilterState::DISABLED : SfxSlotFilterState::ENABLED; } +bool SfxDispatcher::IsCommandAllowedInLokReadOnlyViewMode (OUString commandName) { + constexpr OUString allowedList[] = { + u".uno:InsertAnnotation"_ustr, + u".uno:ReplyComment"_ustr, + u".uno:ResolveComment"_ustr, + u".uno:ResolveCommentThread"_ustr, + u".uno:DeleteComment"_ustr, + u".uno:DeleteAnnotation"_ustr, + u".uno:EditAnnotation"_ustr, + }; + + if (std::find(std::begin(allowedList), std::end(allowedList), commandName) != std::end(allowedList)) + return true; + else + return false; +} + /** This helper method searches for the <Slot-Server> which currently serves the nSlot. As the result, rServe is filled accordingly. @@ -1589,9 +1606,16 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer) } bool bReadOnly = ( SfxSlotFilterState::ENABLED_READONLY != nSlotEnableMode && xImp->bReadOnly ); + bool bCheckForCommentCommands = false; - if (!bReadOnly && comphelper::LibreOfficeKit::isActive()) - bReadOnly = xImp->pFrame && xImp->pFrame->GetViewShell() && xImp->pFrame->GetViewShell()->IsLokReadOnlyView(); + if (!bReadOnly && comphelper::LibreOfficeKit::isActive() && xImp->pFrame && xImp->pFrame->GetViewShell()) + { + SfxViewShell *pViewSh = xImp->pFrame->GetViewShell(); + bReadOnly = pViewSh->IsLokReadOnlyView(); + + if (bReadOnly && pViewSh->IsAllowChangeComments()) + bCheckForCommentCommands = true; + } // search through all the shells of the chained dispatchers // from top to bottom @@ -1605,6 +1629,10 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer) SfxInterface *pIFace = pObjShell->GetInterface(); const SfxSlot *pSlot = pIFace->GetSlot(nSlot); + // This check can be true only if Lokit is active and view is readonly. + if (pSlot && bCheckForCommentCommands) + bReadOnly = IsCommandAllowedInLokReadOnlyViewMode(pSlot->GetCommand()); + if ( pSlot && pSlot->nDisableFlags != SfxDisableFlags::NONE && ( static_cast<int>(pSlot->nDisableFlags) & static_cast<int>(pObjShell->GetDisableFlags()) ) != 0 ) return false;