diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2013-08-16 17:15:34 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2013-08-16 17:47:01 +0200 |
commit | 462b28770e4fa3dfa6fe4af71a6776cceb4c4640 (patch) | |
tree | 8c3207c9846da33c2157606d9ac15abba6387343 /sc/source | |
parent | 0f7de1dce1b8b6ce4ecb8cb9f70cb6f8bc9051a5 (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
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/inputopt.cxx | 34 | ||||
-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 | 14 | ||||
-rw-r--r-- | sc/source/ui/view/tabview2.cxx | 14 |
5 files changed, 57 insertions, 16 deletions
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 { |