diff options
author | Martin van Zijl <martin.vanzijl@gmail.com> | 2020-06-06 15:57:54 +1200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2020-11-18 13:55:59 +0100 |
commit | a6e1647612cc3d39e8a6e44c9365ccecb1da2fe6 (patch) | |
tree | f829fd2cba346dc8f0c01b90ced05da884d6accf | |
parent | 87946f2cfb2626d648ca4df2b0a5d026626e24f5 (diff) |
tdf#34686 calc: add option to disable paste with enter key
Change-Id: Ie20a8931a16f6609ac5be23032a0b2e3a7ad1784
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95627
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Calc.xcs | 8 | ||||
-rw-r--r-- | sc/inc/inputopt.hxx | 3 | ||||
-rw-r--r-- | sc/inc/sc.hrc | 2 | ||||
-rw-r--r-- | sc/source/core/tool/inputopt.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/inc/tpview.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/optdlg/tpview.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 6 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/scgeneralpage.ui | 30 |
9 files changed, 72 insertions, 9 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index 0762279bf3db..5b3a2043e63b 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -754,6 +754,14 @@ </info> <value>false</value> </prop> + <prop oor:name="EnterPasteMode" oor:type="xs:boolean" oor:nillable="false"> + <!-- UIHints: Tools - Options - Spreadsheet - General - [Section] Input settings --> + <info> + <desc>Press Enter to paste and clear clipboard</desc> + <label>Press Enter to paste and clear clipboard</label> + </info> + <value>true</value> + </prop> <prop oor:name="LastFunctions" oor:type="oor:int-list" oor:nillable="false"> <!-- OldPath: Calc/Input --> <!-- OldLocation: Soffice.cfg --> diff --git a/sc/inc/inputopt.hxx b/sc/inc/inputopt.hxx index 4cff5d14cf48..52811ee93c5c 100644 --- a/sc/inc/inputopt.hxx +++ b/sc/inc/inputopt.hxx @@ -38,6 +38,7 @@ private: bool bTextWysiwyg; bool bReplCellsWarn; bool bLegacyCellSelection; + bool bEnterPasteMode; public: ScInputOptions(); @@ -68,6 +69,8 @@ public: bool GetReplaceCellsWarn() const { return bReplCellsWarn; } void SetLegacyCellSelection(bool bSet) { bLegacyCellSelection = bSet; } bool GetLegacyCellSelection() const { return bLegacyCellSelection; } + void SetEnterPasteMode(bool bSet) { bEnterPasteMode = bSet; } + bool GetEnterPasteMode() const { return bEnterPasteMode; } }; // CfgItem for input options diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index b493545ec810..e80825624dea 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -113,6 +113,8 @@ // misc: #define SID_LINKS (SC_VIEW_START + 60) #define SID_INSERT_SMATH (SC_VIEW_START + 63) +// Put this here since all available slots for "SC_INPUT" are taken +#define SID_SC_INPUT_ENTER_PASTE_MODE (SC_VIEW_START + 64) #define SID_MIRROR_VERTICAL (SC_VIEW_START + 65) #define SID_MIRROR_HORIZONTAL (SC_VIEW_START + 66) #define SID_CELL_FORMAT_RESET (SC_VIEW_START + 67) diff --git a/sc/source/core/tool/inputopt.cxx b/sc/source/core/tool/inputopt.cxx index 0ceefd1fa9f1..380c4391f307 100644 --- a/sc/source/core/tool/inputopt.cxx +++ b/sc/source/core/tool/inputopt.cxx @@ -69,6 +69,7 @@ void ScInputOptions::SetDefaults() #define SCINPUTOPT_TEXTWYSIWYG 9 #define SCINPUTOPT_REPLCELLSWARN 10 #define SCINPUTOPT_LEGACY_CELL_SELECTION 11 +#define SCINPUTOPT_ENTER_PASTE_MODE 12 Sequence<OUString> ScInputCfg::GetPropertyNames() { @@ -83,7 +84,8 @@ Sequence<OUString> ScInputCfg::GetPropertyNames() "UseTabCol", // SCINPUTOPT_USETABCOL "UsePrinterMetrics", // SCINPUTOPT_TEXTWYSIWYG "ReplaceCellsWarning", // SCINPUTOPT_REPLCELLSWARN - "LegacyCellSelection"}; // SCINPUTOPT_LEGACY_CELL_SELECTION + "LegacyCellSelection", // SCINPUTOPT_LEGACY_CELL_SELECTION + "EnterPasteMode"}; // SCINPUTOPT_ENTER_PASTE_MODE } ScInputCfg::ScInputCfg() : @@ -142,6 +144,9 @@ ScInputCfg::ScInputCfg() : case SCINPUTOPT_LEGACY_CELL_SELECTION: SetLegacyCellSelection( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); break; + case SCINPUTOPT_ENTER_PASTE_MODE: + SetEnterPasteMode( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; } } } @@ -193,6 +198,9 @@ void ScInputCfg::ImplCommit() case SCINPUTOPT_LEGACY_CELL_SELECTION: pValues[nProp] <<= GetLegacyCellSelection(); break; + case SCINPUTOPT_ENTER_PASTE_MODE: + pValues[nProp] <<= GetEnterPasteMode(); + break; } } PutProperties(aNames, aValues); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index d39c9df9a683..f0a992e774bf 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1194,6 +1194,12 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) bSaveInputOptions = true; } + if( rOptSet.HasItem( SID_SC_INPUT_ENTER_PASTE_MODE, &pItem ) ) + { + m_pInputCfg->SetEnterPasteMode( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); + bSaveInputOptions = true; + } + // PrintOptions if ( rOptSet.HasItem(SID_SCPRINTOPTIONS,&pItem) ) { @@ -1879,6 +1885,8 @@ std::unique_ptr<SfxItemSet> ScModule::CreateItemSet( sal_uInt16 nId ) SID_SCFORMULAOPTIONS, SID_SCDEFAULTSOPTIONS, // TP_VIEW, TP_CALC: SID_SCVIEWOPTIONS, SID_SCDOCOPTIONS, + // TP_INPUT: + SID_SC_INPUT_ENTER_PASTE_MODE, SID_SC_INPUT_ENTER_PASTE_MODE, // TP_PRINT: SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS, // TP_INPUT: @@ -1940,6 +1948,8 @@ std::unique_ptr<SfxItemSet> ScModule::CreateItemSet( sal_uInt16 nId ) rInpOpt.GetReplaceCellsWarn() ) ); pRet->Put( SfxBoolItem( SID_SC_INPUT_LEGACY_CELL_SELECTION, rInpOpt.GetLegacyCellSelection() ) ); + pRet->Put( SfxBoolItem( SID_SC_INPUT_ENTER_PASTE_MODE, + rInpOpt.GetEnterPasteMode() ) ); // RID_SC_TP_PRINT pRet->Put( ScTpPrintItem( GetPrintOptions() ) ); diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx index bed1e1325e69..eed889eda4e5 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -94,6 +94,7 @@ class ScTpLayoutOptions : public SfxTabPage std::unique_ptr<weld::CheckButton> m_xTextFmtCB; std::unique_ptr<weld::CheckButton> m_xReplWarnCB; std::unique_ptr<weld::CheckButton> m_xLegacyCellSelectionCB; + std::unique_ptr<weld::CheckButton> m_xEnterPasteModeCB; DECL_LINK(MetricHdl, weld::ComboBox&, void ); DECL_LINK( AlignHdl, weld::ToggleButton&, void ); diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 3e544ebaaa92..bf1db08d8cb3 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -318,6 +318,7 @@ ScTpLayoutOptions::ScTpLayoutOptions(weld::Container* pPage, weld::DialogControl , m_xTextFmtCB(m_xBuilder->weld_check_button("textfmtcb")) , m_xReplWarnCB(m_xBuilder->weld_check_button("replwarncb")) , m_xLegacyCellSelectionCB(m_xBuilder->weld_check_button("legacy_cell_selection_cb")) + , m_xEnterPasteModeCB(m_xBuilder->weld_check_button("enter_paste_mode_cb")) { SetExchangeSupport(); @@ -463,6 +464,12 @@ bool ScTpLayoutOptions::FillItemSet( SfxItemSet* rCoreSet ) bRet = true; } + if (m_xEnterPasteModeCB->get_state_changed_from_saved()) + { + rCoreSet->Put( SfxBoolItem( SID_SC_INPUT_ENTER_PASTE_MODE, m_xEnterPasteModeCB->get_active() ) ); + bRet = true; + } + return bRet; } @@ -547,6 +554,9 @@ void ScTpLayoutOptions::Reset( const SfxItemSet* rCoreSet ) if( SfxItemState::SET == rCoreSet->GetItemState( SID_SC_INPUT_LEGACY_CELL_SELECTION, false, &pItem ) ) m_xLegacyCellSelectionCB->set_active( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); + if( SfxItemState::SET == rCoreSet->GetItemState( SID_SC_INPUT_ENTER_PASTE_MODE, false, &pItem ) ) + m_xEnterPasteModeCB->set_active( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); + m_xAlignCB->save_state(); m_xAlignLB->save_value(); m_xEditModeCB->save_state(); @@ -559,6 +569,7 @@ void ScTpLayoutOptions::Reset( const SfxItemSet* rCoreSet ) m_xReplWarnCB->save_state(); m_xLegacyCellSelectionCB->save_state(); + m_xEnterPasteModeCB->save_state(); AlignHdl(*m_xAlignCB); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index f15418a4e998..34d3ed07be21 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -123,6 +123,7 @@ #include <uiobject.hxx> #include <undoblk.hxx> #include <datamapper.hxx> +#include <inputopt.hxx> #include <svx/sdrpagewindow.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> @@ -3250,7 +3251,8 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) mrViewData.GetViewShell()->SelectionChanged(); return ; } - else if( rKeyCode.GetCode() == KEY_RETURN && mrViewData.IsPasteMode() ) + else if( rKeyCode.GetCode() == KEY_RETURN && mrViewData.IsPasteMode() + && SC_MOD()->GetInputOptions().GetEnterPasteMode() ) { ScTabViewShell* pTabViewShell = mrViewData.GetViewShell(); ScClipUtil::PasteFromClipboard( &mrViewData, pTabViewShell, true ); @@ -5781,6 +5783,8 @@ void ScGridWindow::UpdateCopySourceOverlay() return; if (!mrViewData.ShowPasteSource()) return; + if (!SC_MOD()->GetInputOptions().GetEnterPasteMode()) + return; rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager(); if (!xOverlayManager.is()) return; diff --git a/sc/uiconfig/scalc/ui/scgeneralpage.ui b/sc/uiconfig/scalc/ui/scgeneralpage.ui index d815895cc037..4d9a80a40c75 100644 --- a/sc/uiconfig/scalc/ui/scgeneralpage.ui +++ b/sc/uiconfig/scalc/ui/scgeneralpage.ui @@ -265,7 +265,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="top_attach">3</property> <property name="width">2</property> </packing> </child> @@ -286,7 +286,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="top_attach">4</property> <property name="width">2</property> </packing> </child> @@ -345,7 +345,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">8</property> + <property name="top_attach">9</property> <property name="width">2</property> </packing> </child> @@ -366,7 +366,23 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">7</property> + <property name="top_attach">8</property> + <property name="width">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="enter_paste_mode_cb"> + <property name="label" translatable="yes" context="scgeneralpage|enter_paste_mode_cb">Press Enter to paste and clear clipboard</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> <property name="width">2</property> </packing> </child> @@ -386,7 +402,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">6</property> + <property name="top_attach">7</property> <property name="width">2</property> </packing> </child> @@ -407,7 +423,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="top_attach">6</property> <property name="width">2</property> </packing> </child> @@ -422,7 +438,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="top_attach">5</property> <property name="width">2</property> </packing> </child> |