summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-08-16 17:15:34 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-08-16 17:47:01 +0200
commit462b28770e4fa3dfa6fe4af71a6776cceb4c4640 (patch)
tree8c3207c9846da33c2157606d9ac15abba6387343
parent0f7de1dce1b8b6ce4ecb8cb9f70cb6f8bc9051a5 (diff)
fdo#37230 Add legacy cell selection behavior and config. option
When selecting cells with ctrl+shift, the legacy behaviour was to take in account to which cell the cursor moved. This allowed the user to make some convenient selections. This behaviour can now be turned on with a switch in the configuration (Tools > Options > Calc > General > Input Settings > "Use legacy cursor movement behavior when selecting"). Change-Id: I00ae7b4ee001b416cc680c7a650631daec71e51b
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Calc.xcs8
-rw-r--r--sc/inc/inputopt.hxx3
-rw-r--r--sc/inc/sc.hrc3
-rw-r--r--sc/source/core/tool/inputopt.cxx34
-rw-r--r--sc/source/ui/app/scmod.cxx10
-rw-r--r--sc/source/ui/inc/tpview.hxx1
-rw-r--r--sc/source/ui/optdlg/tpview.cxx14
-rw-r--r--sc/source/ui/view/tabview2.cxx14
-rw-r--r--sc/uiconfig/scalc/ui/scgeneralpage.ui20
9 files changed, 91 insertions, 16 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index b3964387a490..ada44161f99f 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -714,6 +714,14 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="LegacyCellSelection" oor:type="xs:boolean" oor:nillable="false">
+ <!-- UIHints: Tools - Options - Spreadsheet - General - [Section] Input settings -->
+ <info>
+ <desc>Use legacy behaviour when selecting cells</desc>
+ <label>Use legacy behaviour when selecting cells</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 be5095a9a2a5..33e282a4cf8b 100644
--- a/sc/inc/inputopt.hxx
+++ b/sc/inc/inputopt.hxx
@@ -38,6 +38,7 @@ private:
sal_Bool bUseTabCol;
sal_Bool bTextWysiwyg;
sal_Bool bReplCellsWarn;
+ sal_Bool bLegacyCellSelection;
public:
ScInputOptions();
@@ -66,6 +67,8 @@ public:
sal_Bool GetTextWysiwyg() const { return bTextWysiwyg; }
void SetReplaceCellsWarn(sal_Bool bSet) { bReplCellsWarn = bSet; }
sal_Bool GetReplaceCellsWarn() const { return bReplCellsWarn; }
+ void SetLegacyCellSelection(sal_Bool bSet) { bLegacyCellSelection = bSet; }
+ sal_Bool GetLegacyCellSelection() const { return bLegacyCellSelection; }
const ScInputOptions& operator= ( const ScInputOptions& rOpt );
};
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 8611337444bc..ca208ea9fcfb 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -84,6 +84,9 @@
#define FID_SCALESTATUS (SC_VIEW_START + 10)
#define SID_UPDATECHART (SC_VIEW_START + 13)
+// TabPage entry - Legacy selection
+#define SID_SC_INPUT_LEGACY_CELL_SELECTION (SC_VIEW_START + 15)
+
// Format options
#define SID_SCFORMULAOPTIONS (SC_VIEW_START + 20)
#define SID_SCDEFAULTSOPTIONS (SC_VIEW_START + 21)
diff --git a/sc/source/core/tool/inputopt.cxx b/sc/source/core/tool/inputopt.cxx
index 6f056d6036fe..da7205728bdd 100644
--- a/sc/source/core/tool/inputopt.cxx
+++ b/sc/source/core/tool/inputopt.cxx
@@ -68,6 +68,7 @@ void ScInputOptions::SetDefaults()
bUseTabCol = false;
bTextWysiwyg = false;
bReplCellsWarn = sal_True;
+ bLegacyCellSelection = false;
}
//------------------------------------------------------------------------
@@ -84,6 +85,7 @@ const ScInputOptions& ScInputOptions::operator=( const ScInputOptions& rCpy )
bUseTabCol = rCpy.bUseTabCol;
bTextWysiwyg = rCpy.bTextWysiwyg;
bReplCellsWarn = rCpy.bReplCellsWarn;
+ bLegacyCellSelection = rCpy.bLegacyCellSelection;
return *this;
}
@@ -95,17 +97,18 @@ const ScInputOptions& ScInputOptions::operator=( const ScInputOptions& rCpy )
#define CFGPATH_INPUT "Office.Calc/Input"
-#define SCINPUTOPT_MOVEDIR 0
-#define SCINPUTOPT_MOVESEL 1
-#define SCINPUTOPT_EDTEREDIT 2
-#define SCINPUTOPT_EXTENDFMT 3
-#define SCINPUTOPT_RANGEFIND 4
-#define SCINPUTOPT_EXPANDREFS 5
-#define SCINPUTOPT_MARKHEADER 6
-#define SCINPUTOPT_USETABCOL 7
-#define SCINPUTOPT_TEXTWYSIWYG 8
-#define SCINPUTOPT_REPLCELLSWARN 9
-#define SCINPUTOPT_COUNT 10
+#define SCINPUTOPT_MOVEDIR 0
+#define SCINPUTOPT_MOVESEL 1
+#define SCINPUTOPT_EDTEREDIT 2
+#define SCINPUTOPT_EXTENDFMT 3
+#define SCINPUTOPT_RANGEFIND 4
+#define SCINPUTOPT_EXPANDREFS 5
+#define SCINPUTOPT_MARKHEADER 6
+#define SCINPUTOPT_USETABCOL 7
+#define SCINPUTOPT_TEXTWYSIWYG 8
+#define SCINPUTOPT_REPLCELLSWARN 9
+#define SCINPUTOPT_LEGACY_CELL_SELECTION 10
+#define SCINPUTOPT_COUNT 11
Sequence<OUString> ScInputCfg::GetPropertyNames()
{
@@ -120,7 +123,8 @@ Sequence<OUString> ScInputCfg::GetPropertyNames()
"HighlightSelection", // SCINPUTOPT_MARKHEADER
"UseTabCol", // SCINPUTOPT_USETABCOL
"UsePrinterMetrics", // SCINPUTOPT_TEXTWYSIWYG
- "ReplaceCellsWarning" // SCINPUTOPT_REPLCELLSWARN
+ "ReplaceCellsWarning", // SCINPUTOPT_REPLCELLSWARN
+ "LegacyCellSelection" // SCINPUTOPT_LEGACY_CELL_SELECTION
};
Sequence<OUString> aNames(SCINPUTOPT_COUNT);
OUString* pNames = aNames.getArray();
@@ -179,6 +183,9 @@ ScInputCfg::ScInputCfg() :
case SCINPUTOPT_REPLCELLSWARN:
SetReplaceCellsWarn( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
break;
+ case SCINPUTOPT_LEGACY_CELL_SELECTION:
+ SetLegacyCellSelection( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
+ break;
}
}
}
@@ -226,6 +233,9 @@ void ScInputCfg::Commit()
case SCINPUTOPT_REPLCELLSWARN:
ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetReplaceCellsWarn() );
break;
+ case SCINPUTOPT_LEGACY_CELL_SELECTION:
+ ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetLegacyCellSelection() );
+ break;
}
}
PutProperties(aNames, aValues);
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index d9b5d021f97e..cad7a5df842a 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1304,6 +1304,12 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
bSaveInputOptions = sal_True;
}
+ if( rOptSet.HasItem( SID_SC_INPUT_LEGACY_CELL_SELECTION, &pItem ) )
+ {
+ pInputCfg->SetLegacyCellSelection( ((const SfxBoolItem*)pItem)->GetValue() );
+ bSaveInputOptions = sal_True;
+ }
+
//============================================
// PrintOptions
//============================================
@@ -2016,6 +2022,7 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId )
SID_SC_INPUT_SELECTION,SID_SC_INPUT_MARK_HEADER,
SID_SC_INPUT_TEXTWYSIWYG,SID_SC_INPUT_TEXTWYSIWYG,
SID_SC_INPUT_REPLCELLSWARN,SID_SC_INPUT_REPLCELLSWARN,
+ SID_SC_INPUT_LEGACY_CELL_SELECTION,SID_SC_INPUT_LEGACY_CELL_SELECTION,
// TP_USERLISTS:
SCITEM_USERLIST, SCITEM_USERLIST,
// TP_PRINT:
@@ -2084,6 +2091,9 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId )
rInpOpt.GetTextWysiwyg() ) );
pRet->Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN,
rInpOpt.GetReplaceCellsWarn() ) );
+ pRet->Put( SfxBoolItem( SID_SC_INPUT_LEGACY_CELL_SELECTION,
+ rInpOpt.GetLegacyCellSelection() ) );
+
// RID_SC_TP_PRINT
pRet->Put( ScTpPrintItem( SID_SCPRINTOPTIONS, GetPrintOptions() ) );
diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx
index 53fba0f7b7c0..2b99c09d6637 100644
--- a/sc/source/ui/inc/tpview.hxx
+++ b/sc/source/ui/inc/tpview.hxx
@@ -105,6 +105,7 @@ class ScTpLayoutOptions : public SfxTabPage
CheckBox* m_pMarkHdrCB;
CheckBox* m_pTextFmtCB;
CheckBox* m_pReplWarnCB;
+ CheckBox* m_pLegacyCellSelectionCB;
SvxStringArray aUnitArr;
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index 2b6741e99e5b..e6486f9bf5d0 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -381,6 +381,7 @@ ScTpLayoutOptions::ScTpLayoutOptions( Window* pParent,
get( m_pMarkHdrCB, "markhdrcb");
get( m_pTextFmtCB, "textfmtcb");
get( m_pReplWarnCB, "replwarncb");
+ get( m_pLegacyCellSelectionCB, "legacy_cell_selection_cb");
SetExchangeSupport();
@@ -520,6 +521,12 @@ sal_Bool ScTpLayoutOptions::FillItemSet( SfxItemSet& rCoreSet )
bRet = sal_True;
}
+ if( m_pLegacyCellSelectionCB->GetSavedValue() != m_pLegacyCellSelectionCB->IsChecked() )
+ {
+ rCoreSet.Put( SfxBoolItem( SID_SC_INPUT_LEGACY_CELL_SELECTION, m_pLegacyCellSelectionCB->IsChecked() ) );
+ bRet = sal_True;
+ }
+
return bRet;
}
@@ -599,6 +606,10 @@ void ScTpLayoutOptions::Reset( const SfxItemSet& rCoreSet )
if( SFX_ITEM_SET == rCoreSet.GetItemState( SID_SC_INPUT_REPLCELLSWARN, false, &pItem ) )
m_pReplWarnCB->Check( ( (const SfxBoolItem*)pItem)->GetValue() );
+ if( SFX_ITEM_SET == rCoreSet.GetItemState( SID_SC_INPUT_LEGACY_CELL_SELECTION, false, &pItem ) )
+ m_pLegacyCellSelectionCB->Check( ( (const SfxBoolItem*)pItem)->GetValue() );
+
+
m_pAlignCB ->SaveValue();
m_pAlignLB ->SaveValue();
m_pEditModeCB ->SaveValue();
@@ -608,6 +619,9 @@ void ScTpLayoutOptions::Reset( const SfxItemSet& rCoreSet )
m_pMarkHdrCB ->SaveValue();
m_pTextFmtCB ->SaveValue();
m_pReplWarnCB ->SaveValue();
+
+ m_pLegacyCellSelectionCB->SaveValue();
+
AlignHdl(m_pAlignCB);
m_pAlwaysRB->SaveValue();
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 888e27c4cef6..4566805ed4b2 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -45,6 +45,7 @@
#include "scmod.hxx"
#include "tabprotection.hxx"
#include "markdata.hxx"
+#include "inputopt.hxx"
namespace {
@@ -610,6 +611,7 @@ void ScTabView::GetAreaMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, ScFollowMode
{
SCCOL nNewX = -1;
SCROW nNewY = -1;
+
// current cursor position.
SCCOL nCurX = aViewData.GetCurX();
SCROW nCurY = aViewData.GetCurY();
@@ -637,20 +639,24 @@ void ScTabView::GetAreaMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, ScFollowMode
SCTAB nTab = aViewData.GetTabNo();
// FindAreaPos kennt nur -1 oder 1 als Richtung
+ ScModule* pScModule = SC_MOD();
+ bool bLegacyCellSelection = pScModule->GetInputOptions().GetLegacyCellSelection();
+ SCCOL nVirtualX = bLegacyCellSelection ? nNewX : nCurX;
+ SCROW nVirtualY = bLegacyCellSelection ? nNewY : nCurY;
SCsCOLROW i;
if ( nMovX > 0 )
for ( i=0; i<nMovX; i++ )
- pDoc->FindAreaPos( nNewX, nCurY, nTab, SC_MOVE_RIGHT );
+ pDoc->FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_RIGHT );
if ( nMovX < 0 )
for ( i=0; i<-nMovX; i++ )
- pDoc->FindAreaPos( nNewX, nCurY, nTab, SC_MOVE_LEFT );
+ pDoc->FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_LEFT );
if ( nMovY > 0 )
for ( i=0; i<nMovY; i++ )
- pDoc->FindAreaPos( nCurX, nNewY, nTab, SC_MOVE_DOWN );
+ pDoc->FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_DOWN );
if ( nMovY < 0 )
for ( i=0; i<-nMovY; i++ )
- pDoc->FindAreaPos( nCurX, nNewY, nTab, SC_MOVE_UP );
+ pDoc->FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_UP );
if (eMode==SC_FOLLOW_JUMP) // unten/rechts nicht zuviel grau anzeigen
{
diff --git a/sc/uiconfig/scalc/ui/scgeneralpage.ui b/sc/uiconfig/scalc/ui/scgeneralpage.ui
index 09e999a49285..675d6d9f282b 100644
--- a/sc/uiconfig/scalc/ui/scgeneralpage.ui
+++ b/sc/uiconfig/scalc/ui/scgeneralpage.ui
@@ -416,6 +416,26 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="legacy_cell_selection_cb">
+ <property name="label" translatable="yes">Use legacy cursor movement behavior when selecting</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">7</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
<child>