[Libreoffice-commits] core.git: officecfg/registry sc/inc sc/source sc/uiconfig

Tomaž Vajngerl quikee at gmail.com
Fri Aug 16 08:49:40 PDT 2013


 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |    8 +++
 sc/inc/inputopt.hxx                                      |    3 +
 sc/inc/sc.hrc                                            |    3 +
 sc/source/core/tool/inputopt.cxx                         |   34 +++++++++------
 sc/source/ui/app/scmod.cxx                               |   10 ++++
 sc/source/ui/inc/tpview.hxx                              |    1 
 sc/source/ui/optdlg/tpview.cxx                           |   14 ++++++
 sc/source/ui/view/tabview2.cxx                           |   14 ++++--
 sc/uiconfig/scalc/ui/scgeneralpage.ui                    |   20 ++++++++
 9 files changed, 91 insertions(+), 16 deletions(-)

New commits:
commit 462b28770e4fa3dfa6fe4af71a6776cceb4c4640
Author: Tomaž Vajngerl <quikee at gmail.com>
Date:   Fri Aug 16 17:15:34 2013 +0200

    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

diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index b396438..ada4416 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 be5095a..33e282a 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 8611337..ca208ea 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 6f056d6..da72057 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 d9b5d02..cad7a5d 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 53fba0f..2b99c09 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 2b6741e..e6486f9 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 888e27c..4566805 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 09e999a..675d6d9 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>


More information about the Libreoffice-commits mailing list