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
This commit is contained in:
committed by
Eike Rathke
parent
87946f2cfb
commit
a6e1647612
@@ -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 -->
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
|
@@ -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() ) );
|
||||
|
@@ -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 );
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user