[Libreoffice-commits] .: 9 commits - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Oct 13 21:40:32 PDT 2010


 sc/inc/docoptio.hxx                     |    9 ++
 sc/inc/optutil.hxx                      |    3 
 sc/inc/sc.hrc                           |    4 +
 sc/source/core/tool/docoptio.cxx        |   63 ++++++++++++++++++
 sc/source/ui/app/scmod.cxx              |   11 +++
 sc/source/ui/attrdlg/scdlgfact.cxx      |    4 -
 sc/source/ui/docshell/docsh.cxx         |  110 ++++++++++++++++++++++++++++++++
 sc/source/ui/inc/docsh.hxx              |    3 
 sc/source/ui/inc/optdlg.hrc             |   20 +----
 sc/source/ui/inc/tpcompatibility.hxx    |   61 +++++++++++++++++
 sc/source/ui/optdlg/makefile.mk         |    1 
 sc/source/ui/optdlg/tpcompatibility.cxx |  105 ++++++++++++++++++++++++++++++
 sc/source/ui/src/optdlg.src             |   37 ++++++++++
 13 files changed, 414 insertions(+), 17 deletions(-)

New commits:
commit c0aac7c892688678544a2dd339064f081cc7fbfa
Merge: 764e33d... e6df329...
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Oct 13 23:21:02 2010 -0400

    Merge branch 'master' into feature/calc-key-binding-compat
    
    Conflicts:
    	sc/source/ui/attrdlg/scdlgfact.cxx

diff --cc sc/inc/sc.hrc
index 157ecf9,23ea60e..dc90cb2
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@@ -1672,11 -1670,11 +1670,15 @@@
  // Insert current date and time to cell via command
  #define SID_INSERT_CURRENT_DATE     (SC_OOO_BUILD_START + 4)
  #define SID_INSERT_CURRENT_TIME     (SC_OOO_BUILD_START + 5)
+ // Data Form
+ #define SID_DATAFORM_NEW            (SC_OOO_BUILD_START + 6) // message
+ #define SID_DATA_FORM               (SC_OOO_BUILD_START + 7) // menu (in Data menu)
+ #define RID_SCDLG_DATAFORM          (SC_OOO_BUILD_START + 8) // dialog
  
 +// Compatibility options page
 +#define RID_SCPAGE_COMPATIBILITY    (SC_OOO_BUILD_START + 6)
 +#define HID_SCPAGE_COMPATIBILITY    (SC_OOO_BUILD_START + 7)
 +
  #endif
  
  
diff --cc sc/source/ui/attrdlg/scdlgfact.cxx
index 19e7a2e,02cd919..fa14720
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@@ -80,7 -81,8 +81,8 @@@
  #include "tpusrlst.hxx" //add for ScTpUserLists
  #include "tpview.hxx" //add for ScTpContentOptions
  #include "tpformula.hxx"
 -//for dataform
+ #include "datafdlg.hxx" //add for ScDataFormDlg
 +#include "tpcompatibility.hxx"
  
  // ause
  #include "editutil.hxx"
diff --cc sc/source/ui/inc/docsh.hxx
index e8e8563,1ea3118..fff44a1
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@@ -40,9 -40,9 +40,10 @@@
  #include "document.hxx"
  #include "shellids.hxx"
  #include "refreshtimer.hxx"
 +#include "optutil.hxx"
  
  #include <hash_map>
+ #include <cppuhelper/implbase1.hxx>
  
  class ScEditEngineDefaulter;
  class FontList;
commit 764e33d386f7e881e1563c009f5069e33a0ee5f4
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Oct 13 21:37:08 2010 -0400

    Let's use Ctrl-Shift-D to launch selection list in LibreOffice.
    
    The legacy OOo used Ctrl-D for launching selection list, but we
    use Ctrl-D for "fill down".  Luckily Ctrl-Shift-D is not taken.

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 9a43e32..a51b13d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2854,7 +2854,7 @@ void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType )
         return;
 
     vector<const awt::KeyEvent*> aKeys;
-    aKeys.reserve(3);
+    aKeys.reserve(4);
 
     // Backsapce key
     awt::KeyEvent aBackspace;
@@ -2874,8 +2874,14 @@ void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType )
     aCtrlD.Modifiers = awt::KeyModifier::MOD1;
     aKeys.push_back(&aCtrlD);
 
-    // Remove all involved keys first, as swapping of commands don't work well
-    // without this.
+    // Ctrl-Shift-D
+    awt::KeyEvent aCtrlShiftD;
+    aCtrlShiftD.KeyCode = awt::Key::D;
+    aCtrlShiftD.Modifiers = awt::KeyModifier::MOD1 | awt::KeyModifier::SHIFT;
+    aKeys.push_back(&aCtrlShiftD);
+
+    // Remove all involved keys first, because swapping commands don't work
+    // well without doing this.
     removeKeysIfExists(xScAccel, aKeys);
     xScAccel->store();
 
@@ -2885,6 +2891,7 @@ void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType )
             xScAccel->setKeyEvent(aDelete, OUString::createFromAscii(".uno:ClearContents"));
             xScAccel->setKeyEvent(aBackspace, OUString::createFromAscii(".uno:Delete"));
             xScAccel->setKeyEvent(aCtrlD, OUString::createFromAscii(".uno:FillDown"));
+            xScAccel->setKeyEvent(aCtrlShiftD, OUString::createFromAscii(".uno:DataSelect"));
         break;
         case ScOptionsUtil::KEY_OOO_LEGACY:
             xScAccel->setKeyEvent(aDelete, OUString::createFromAscii(".uno:Delete"));
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index ac85805..f1dc874 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -299,7 +299,7 @@ TabPage RID_SCPAGE_COMPATIBILITY
         Pos = MAP_APPFONT ( 12, 16 ) ;
         Size = MAP_APPFONT ( 165, 24 ) ;
         Wordbreak = TRUE;
-        Text [ en-US ] = "Select desired ~key binding type. This may overwrite the existing key bindings if any." ;
+        Text [ en-US ] = "Select desired ~key binding type. Changing the key binding type may overwrite some of the existing key bindings." ;
     };
 
     ListBox LB_KEY_BINDINGS
commit 7b289bde77fcf33ffe2114828c969401d5bda7a0
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Oct 13 17:28:39 2010 -0400

    Slightly reworked the Compatibility option page.
    
    This looks better than the old one.  I took the design from the
    Security option page.

diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index 82b489e..ac85805 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -296,15 +296,16 @@ TabPage RID_SCPAGE_COMPATIBILITY
 
     FixedText FT_KEY_BINDINGS
     {
-        Pos = MAP_APPFONT ( 21, 16 ) ;
-        Size = MAP_APPFONT ( 80, 8 ) ;
-        Text [ en-US ] = "~Key bindings" ;
+        Pos = MAP_APPFONT ( 12, 16 ) ;
+        Size = MAP_APPFONT ( 165, 24 ) ;
+        Wordbreak = TRUE;
+        Text [ en-US ] = "Select desired ~key binding type. This may overwrite the existing key bindings if any." ;
     };
 
     ListBox LB_KEY_BINDINGS
     {
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 85, 14 ) ;
+        Pos = MAP_APPFONT ( 179, 20 ) ;
         Size = MAP_APPFONT ( 75, 46 ) ;
         DropDown = TRUE ;
         StringList [ en-US ] =
commit bc6e1f649f9e86daaaba8c22155de6cb7c342c76
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Oct 13 16:17:04 2010 -0400

    Cleaned up my debug statements.

diff --git a/sc/source/core/tool/docoptio.cxx b/sc/source/core/tool/docoptio.cxx
index ecc2669..cee1d7c 100644
--- a/sc/source/core/tool/docoptio.cxx
+++ b/sc/source/core/tool/docoptio.cxx
@@ -546,13 +546,8 @@ ScDocCfg::ScDocCfg() :
             {
                 case SCCOMPATOPT_KEY_BINDING:
                 {
-                    fprintf(stdout, "ScDocCfg::ScDocCfg:   SCCOMPATOPT_KEY_BINDING\n");
-                    nIntVal = 0;
-                    if (pValues[nProp] >>= nIntVal)
-                        fprintf(stdout, "ScDocCfg::ScDocCfg:   key binding = %ld\n", nIntVal);
-                    else
-                        fprintf(stdout, "ScDocCfg::ScDocCfg:   key binding failed to load\n");
-
+                    nIntVal = 0; // 0 = 'Default'
+                    pValues[nProp] >>= nIntVal;
                     SetKeyBindingType(static_cast<ScOptionsUtil::KeyBindingType>(nIntVal));
                 }
                 break;
@@ -695,10 +690,7 @@ IMPL_LINK( ScDocCfg, CompatCommitHdl, void *, EMPTYARG )
         switch(nProp)
         {
             case SCCOMPATOPT_KEY_BINDING:
-            {
-                fprintf(stdout, "IMPL_LINK:   pushing key binding type (%d)\n", GetKeyBindingType());
                 pValues[nProp] <<= static_cast<sal_Int32>(GetKeyBindingType());
-            }
             break;
         }
     }
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 0af48a4..e1734be 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -118,49 +118,6 @@
 #define SC_IDLE_STEP	75
 #define SC_IDLE_COUNT	50
 
-
-#include <stdio.h>
-#include <string>
-#include <sys/time.h>
-
-namespace {
-
-class StackPrinter
-{
-public:
-    explicit StackPrinter(const char* msg) :
-        msMsg(msg)
-    {
-        fprintf(stdout, "%s: --begin\n", msMsg.c_str());
-        mfStartTime = getTime();
-    }
-
-    ~StackPrinter()
-    {
-        double fEndTime = getTime();
-        fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
-    }
-
-    void printTime(int line) const
-    {
-        double fEndTime = getTime();
-        fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime-mfStartTime));
-    }
-
-private:
-    double getTime() const
-    {
-        timeval tv;
-        gettimeofday(&tv, NULL);
-        return tv.tv_sec + tv.tv_usec / 1000000.0;
-    }
-
-    ::std::string msMsg;
-    double mfStartTime;
-};
-
-}
-
 static USHORT nIdleCount = 0;
 
 //------------------------------------------------------------------
@@ -1064,7 +1021,6 @@ USHORT ScModule::GetOptDigitLanguage()
 
 void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 {
-    StackPrinter __stack_printer__("ScModule::ModifyOptions");
     USHORT nOldSpellLang, nOldCjkLang, nOldCtlLang;
     BOOL bOldAutoSpell;
     GetSpellSettings( nOldSpellLang, nOldCjkLang, nOldCtlLang, bOldAutoSpell );
@@ -1198,12 +1154,8 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
             const ScDocOptions& rOldOpt = pDoc->GetDocOptions();
             ScOptionsUtil::KeyBindingType eKeyOld = rOldOpt.GetKeyBindingType();
             ScOptionsUtil::KeyBindingType eKeyNew = rNewOpt.GetKeyBindingType();
-            fprintf(stdout, "ScModule::ModifyOptions:   key (old: %d  new: %d)\n", eKeyOld, eKeyNew);
             if (eKeyOld != eKeyNew)
-            {
-                fprintf(stdout, "ScModule::ModifyOptions:   key binding base changed.  Reset the key bindings.\n");
                 pDocSh->ResetKeyBindings(eKeyNew);
-            }
 
             bRepaint = ( bRepaint || ( rOldOpt != rNewOpt )   );
             bCalcAll =   bRepaint &&
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 7a2a0d2..9a43e32 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -150,49 +150,6 @@ using ::rtl::OUStringBuffer;
 using ::boost::shared_ptr;
 using ::std::vector;
 
-
-#include <stdio.h>
-#include <string>
-#include <sys/time.h>
-
-namespace {
-
-class StackPrinter
-{
-public:
-    explicit StackPrinter(const char* msg) :
-        msMsg(msg)
-    {
-        fprintf(stdout, "%s: --begin\n", msMsg.c_str());
-        mfStartTime = getTime();
-    }
-
-    ~StackPrinter()
-    {
-        double fEndTime = getTime();
-        fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
-    }
-
-    void printTime(int line) const
-    {
-        double fEndTime = getTime();
-        fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime-mfStartTime));
-    }
-
-private:
-    double getTime() const
-    {
-        timeval tv;
-        gettimeofday(&tv, NULL);
-        return tv.tv_sec + tv.tv_usec / 1000000.0;
-    }
-
-    ::std::string msMsg;
-    double mfStartTime;
-};
-
-}
-
 // STATIC DATA -----------------------------------------------------------
 
 //	Stream-Namen im Storage
@@ -2870,7 +2827,6 @@ void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType )
 {
     using namespace ::com::sun::star::ui;
 
-    StackPrinter __stack_printer__("ScDocShell::ResetKeyBindings");
     Reference<XMultiServiceFactory> xServiceManager = ::comphelper::getProcessServiceFactory();
     if (!xServiceManager.is())
         return;
commit 916f7a73cd2372e4ba6ee31d574c741ff6398c2f
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Oct 13 16:01:16 2010 -0400

    Resolved the issue of swapping .uno:Delete and .uno:ClearConents not working.
    
    Removing key events first then setting new key events solved this.
    This is one of those quirks of this accelerator configuration UNO
    service...

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 420982a..7a2a0d2 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2845,6 +2845,27 @@ ScSheetSaveData* ScDocShell::GetSheetSaveData()
     return pSheetSaveData;
 }
 
+namespace {
+
+void removeKeysIfExists(Reference<ui::XAcceleratorConfiguration>& xScAccel, const vector<const awt::KeyEvent*>& rKeys)
+{
+    vector<const awt::KeyEvent*>::const_iterator itr = rKeys.begin(), itrEnd = rKeys.end();
+    for (; itr != itrEnd; ++itr)
+    {
+        const awt::KeyEvent* p = *itr;
+        if (!p)
+            continue;
+
+        try
+        {
+            xScAccel->removeKeyEvent(*p);
+        }
+        catch (const container::NoSuchElementException&) {}
+    }
+}
+
+}
+
 void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType )
 {
     using namespace ::com::sun::star::ui;
@@ -2876,39 +2897,49 @@ void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType )
     if (!xScAccel.is())
         return;
 
+    vector<const awt::KeyEvent*> aKeys;
+    aKeys.reserve(3);
+
     // Backsapce key
-    awt::KeyEvent aBackEv;
-    aBackEv.KeyCode = awt::Key::BACKSPACE;
-    aBackEv.Modifiers = 0;
+    awt::KeyEvent aBackspace;
+    aBackspace.KeyCode = awt::Key::BACKSPACE;
+    aBackspace.Modifiers = 0;
+    aKeys.push_back(&aBackspace);
 
     // Delete key
-    awt::KeyEvent aDeleteEv;
-    aDeleteEv.KeyCode = awt::Key::DELETE;
-    aDeleteEv.Modifiers = 0;
+    awt::KeyEvent aDelete;
+    aDelete.KeyCode = awt::Key::DELETE;
+    aDelete.Modifiers = 0;
+    aKeys.push_back(&aDelete);
 
     // Ctrl-D
     awt::KeyEvent aCtrlD;
     aCtrlD.KeyCode = awt::Key::D;
     aCtrlD.Modifiers = awt::KeyModifier::MOD1;
+    aKeys.push_back(&aCtrlD);
+
+    // Remove all involved keys first, as swapping of commands don't work well
+    // without this.
+    removeKeysIfExists(xScAccel, aKeys);
+    xScAccel->store();
 
     switch (eType)
     {
         case ScOptionsUtil::KEY_DEFAULT:
-            fprintf(stdout, "ScDocShell::ResetKeyBindings:   default\n");
-            xScAccel->setKeyEvent(aDeleteEv, OUString::createFromAscii(".uno:ClearContents"));
-            xScAccel->setKeyEvent(aBackEv, OUString::createFromAscii(".uno:Delete"));
+            xScAccel->setKeyEvent(aDelete, OUString::createFromAscii(".uno:ClearContents"));
+            xScAccel->setKeyEvent(aBackspace, OUString::createFromAscii(".uno:Delete"));
+            xScAccel->setKeyEvent(aCtrlD, OUString::createFromAscii(".uno:FillDown"));
         break;
         case ScOptionsUtil::KEY_OOO_LEGACY:
-            fprintf(stdout, "ScDocShell::ResetKeyBindings:   ooo legacy\n");
-            xScAccel->setKeyEvent(aDeleteEv, OUString::createFromAscii(".uno:Delete"));
-            xScAccel->setKeyEvent(aBackEv, OUString::createFromAscii(".uno:ClearContents"));
+            xScAccel->setKeyEvent(aDelete, OUString::createFromAscii(".uno:Delete"));
+            xScAccel->setKeyEvent(aBackspace, OUString::createFromAscii(".uno:ClearContents"));
+            xScAccel->setKeyEvent(aCtrlD, OUString::createFromAscii(".uno:DataSelect"));
         break;
         default:
             ;
     }
 
     xScAccel->store();
-    fprintf(stdout, "ScDocShell::ResetKeyBindings:   stored\n");
 }
 
 void ScDocShell::UseSheetSaveEntries()
commit 220a15591a371989e9fccf40c14a86a6dfc82e1a
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Oct 13 12:58:52 2010 -0400

    Initial attempt to reset key bindings.
    
    This is not working yet.  For some reason only the last key binding
    gets set, while all the others get ignored...

diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx
index 94d2787..19e3222 100644
--- a/sc/inc/docoptio.hxx
+++ b/sc/inc/docoptio.hxx
@@ -38,15 +38,10 @@
 
 class SC_DLLPUBLIC ScDocOptions
 {
-public:
-    // values must correspond with integer values stored in the configuration
-    enum KeyBindingType { KEY_DEFAULT = 0, KEY_OOO_LEGACY = 1 };
-
-private:
     double fIterEps;				// Epsilon-Wert dazu
     USHORT nIterCount;				// Anzahl
     sal_uInt16 nPrecStandardFormat; // precision for standard format
-    KeyBindingType eKeyBindingType; // key binding type: Default (0), OOo legacy (1)
+    ScOptionsUtil::KeyBindingType eKeyBindingType;
     USHORT nDay;					// Nulldatum:
     USHORT nMonth;
     USHORT nYear;
@@ -102,8 +97,8 @@ public:
     sal_uInt16  GetStdPrecision() const { return nPrecStandardFormat; }
     void        SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
 
-    KeyBindingType GetKeyBindingType() const { return eKeyBindingType; }
-    void        SetKeyBindingType( KeyBindingType e ) { eKeyBindingType = e; }
+    ScOptionsUtil::KeyBindingType GetKeyBindingType() const { return eKeyBindingType; }
+    void        SetKeyBindingType( ScOptionsUtil::KeyBindingType e ) { eKeyBindingType = e; }
 
     BOOL	IsCalcAsShown() const		{ return bCalcAsShown; }
     void	SetCalcAsShown( BOOL bVal )	{ bCalcAsShown = bVal; }
diff --git a/sc/inc/optutil.hxx b/sc/inc/optutil.hxx
index 708db82..b8addf3 100644
--- a/sc/inc/optutil.hxx
+++ b/sc/inc/optutil.hxx
@@ -36,6 +36,9 @@
 class ScOptionsUtil
 {
 public:
+    // values must correspond with integer values stored in the configuration
+    enum KeyBindingType { KEY_DEFAULT = 0, KEY_OOO_LEGACY = 1 };
+
     static BOOL		IsMetricSystem();
 };
 
diff --git a/sc/source/core/tool/docoptio.cxx b/sc/source/core/tool/docoptio.cxx
index 06ef113..ecc2669 100644
--- a/sc/source/core/tool/docoptio.cxx
+++ b/sc/source/core/tool/docoptio.cxx
@@ -127,7 +127,7 @@ void ScDocOptions::ResetDocOptions()
     nIterCount			= 100;
     fIterEps			= 1.0E-3;
     nPrecStandardFormat = SvNumberFormatter::UNLIMITED_PRECISION;
-    eKeyBindingType     = KEY_DEFAULT;
+    eKeyBindingType     = ScOptionsUtil::KEY_DEFAULT;
     nDay				= 30;
     nMonth				= 12;
     nYear				= 1899;
@@ -553,7 +553,7 @@ ScDocCfg::ScDocCfg() :
                     else
                         fprintf(stdout, "ScDocCfg::ScDocCfg:   key binding failed to load\n");
 
-                    SetKeyBindingType(static_cast<ScDocOptions::KeyBindingType>(nIntVal));
+                    SetKeyBindingType(static_cast<ScOptionsUtil::KeyBindingType>(nIntVal));
                 }
                 break;
             }
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 93573c6..0af48a4 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -118,6 +118,49 @@
 #define SC_IDLE_STEP	75
 #define SC_IDLE_COUNT	50
 
+
+#include <stdio.h>
+#include <string>
+#include <sys/time.h>
+
+namespace {
+
+class StackPrinter
+{
+public:
+    explicit StackPrinter(const char* msg) :
+        msMsg(msg)
+    {
+        fprintf(stdout, "%s: --begin\n", msMsg.c_str());
+        mfStartTime = getTime();
+    }
+
+    ~StackPrinter()
+    {
+        double fEndTime = getTime();
+        fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
+    }
+
+    void printTime(int line) const
+    {
+        double fEndTime = getTime();
+        fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime-mfStartTime));
+    }
+
+private:
+    double getTime() const
+    {
+        timeval tv;
+        gettimeofday(&tv, NULL);
+        return tv.tv_sec + tv.tv_usec / 1000000.0;
+    }
+
+    ::std::string msMsg;
+    double mfStartTime;
+};
+
+}
+
 static USHORT nIdleCount = 0;
 
 //------------------------------------------------------------------
@@ -1021,6 +1064,7 @@ USHORT ScModule::GetOptDigitLanguage()
 
 void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
 {
+    StackPrinter __stack_printer__("ScModule::ModifyOptions");
     USHORT nOldSpellLang, nOldCjkLang, nOldCtlLang;
     BOOL bOldAutoSpell;
     GetSpellSettings( nOldSpellLang, nOldCjkLang, nOldCtlLang, bOldAutoSpell );
@@ -1152,6 +1196,14 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
         if ( pDoc )
         {
             const ScDocOptions& rOldOpt = pDoc->GetDocOptions();
+            ScOptionsUtil::KeyBindingType eKeyOld = rOldOpt.GetKeyBindingType();
+            ScOptionsUtil::KeyBindingType eKeyNew = rNewOpt.GetKeyBindingType();
+            fprintf(stdout, "ScModule::ModifyOptions:   key (old: %d  new: %d)\n", eKeyOld, eKeyNew);
+            if (eKeyOld != eKeyNew)
+            {
+                fprintf(stdout, "ScModule::ModifyOptions:   key binding base changed.  Reset the key bindings.\n");
+                pDocSh->ResetKeyBindings(eKeyNew);
+            }
 
             bRepaint = ( bRepaint || ( rOldOpt != rNewOpt )   );
             bCalcAll =   bRepaint &&
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 4426f7a..420982a 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -65,12 +65,16 @@
 #include "chgtrack.hxx"
 #include "chgviset.hxx"
 #include <sfx2/request.hxx>
+#include <com/sun/star/awt/Key.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
 #include <com/sun/star/document/UpdateDocMode.hpp>
 #include <com/sun/star/script/vba/VBAEventId.hpp>
 #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
 #include <com/sun/star/sheet/XSpreadsheetView.hpp>
 #include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
 #include <basic/sbstar.hxx>
 #include <basic/basmgr.hxx>
 #include <vbahelper/vbaaccesshelper.hxx>
@@ -138,11 +142,57 @@
 #include <boost/shared_ptr.hpp>
 
 using namespace com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::lang::XMultiServiceFactory;
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 using ::boost::shared_ptr;
 using ::std::vector;
 
+
+#include <stdio.h>
+#include <string>
+#include <sys/time.h>
+
+namespace {
+
+class StackPrinter
+{
+public:
+    explicit StackPrinter(const char* msg) :
+        msMsg(msg)
+    {
+        fprintf(stdout, "%s: --begin\n", msMsg.c_str());
+        mfStartTime = getTime();
+    }
+
+    ~StackPrinter()
+    {
+        double fEndTime = getTime();
+        fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
+    }
+
+    void printTime(int line) const
+    {
+        double fEndTime = getTime();
+        fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime-mfStartTime));
+    }
+
+private:
+    double getTime() const
+    {
+        timeval tv;
+        gettimeofday(&tv, NULL);
+        return tv.tv_sec + tv.tv_usec / 1000000.0;
+    }
+
+    ::std::string msMsg;
+    double mfStartTime;
+};
+
+}
+
 // STATIC DATA -----------------------------------------------------------
 
 //	Stream-Namen im Storage
@@ -2795,6 +2845,72 @@ ScSheetSaveData* ScDocShell::GetSheetSaveData()
     return pSheetSaveData;
 }
 
+void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType )
+{
+    using namespace ::com::sun::star::ui;
+
+    StackPrinter __stack_printer__("ScDocShell::ResetKeyBindings");
+    Reference<XMultiServiceFactory> xServiceManager = ::comphelper::getProcessServiceFactory();
+    if (!xServiceManager.is())
+        return;
+
+    Reference<XModuleUIConfigurationManagerSupplier> xModuleCfgSupplier(
+        xServiceManager->createInstance(
+            OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")), UNO_QUERY);
+
+    if (!xModuleCfgSupplier.is())
+        return;
+
+    // Grab the Calc configuration.
+    Reference<XUIConfigurationManager> xConfigMgr =
+        xModuleCfgSupplier->getUIConfigurationManager(
+            OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument"));
+
+    if (!xConfigMgr.is())
+        return;
+
+    // shortcut manager
+    Reference<XAcceleratorConfiguration> xScAccel(
+        xConfigMgr->getShortCutManager(), UNO_QUERY);
+
+    if (!xScAccel.is())
+        return;
+
+    // Backsapce key
+    awt::KeyEvent aBackEv;
+    aBackEv.KeyCode = awt::Key::BACKSPACE;
+    aBackEv.Modifiers = 0;
+
+    // Delete key
+    awt::KeyEvent aDeleteEv;
+    aDeleteEv.KeyCode = awt::Key::DELETE;
+    aDeleteEv.Modifiers = 0;
+
+    // Ctrl-D
+    awt::KeyEvent aCtrlD;
+    aCtrlD.KeyCode = awt::Key::D;
+    aCtrlD.Modifiers = awt::KeyModifier::MOD1;
+
+    switch (eType)
+    {
+        case ScOptionsUtil::KEY_DEFAULT:
+            fprintf(stdout, "ScDocShell::ResetKeyBindings:   default\n");
+            xScAccel->setKeyEvent(aDeleteEv, OUString::createFromAscii(".uno:ClearContents"));
+            xScAccel->setKeyEvent(aBackEv, OUString::createFromAscii(".uno:Delete"));
+        break;
+        case ScOptionsUtil::KEY_OOO_LEGACY:
+            fprintf(stdout, "ScDocShell::ResetKeyBindings:   ooo legacy\n");
+            xScAccel->setKeyEvent(aDeleteEv, OUString::createFromAscii(".uno:Delete"));
+            xScAccel->setKeyEvent(aBackEv, OUString::createFromAscii(".uno:ClearContents"));
+        break;
+        default:
+            ;
+    }
+
+    xScAccel->store();
+    fprintf(stdout, "ScDocShell::ResetKeyBindings:   stored\n");
+}
+
 void ScDocShell::UseSheetSaveEntries()
 {
     if (pSheetSaveData)
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index e021e9a..e8e8563 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -40,6 +40,7 @@
 #include "document.hxx"
 #include "shellids.hxx"
 #include "refreshtimer.hxx"
+#include "optutil.hxx"
 
 #include <hash_map>
 
@@ -425,6 +426,8 @@ public:
     //-->Added by PengYunQuan for Validity Cell Range Picker
     ScSheetSaveData* GetSheetSaveData();
 
+    void ResetKeyBindings( ScOptionsUtil::KeyBindingType eType );
+
     // passwword protection for Calc (derived from SfxObjectShell)
     // see also:    FID_CHG_RECORD, SID_CHG_PROTECT
     virtual bool    IsChangeRecording() const;
diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx
index c9853f3..1dfcafb 100644
--- a/sc/source/ui/optdlg/tpcompatibility.cxx
+++ b/sc/source/ui/optdlg/tpcompatibility.cxx
@@ -60,14 +60,14 @@ SfxTabPage* ScTpCompatOptions::Create(Window *pParent, const SfxItemSet &rCoreAt
 
 BOOL ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs)
 {
-    ScDocOptions::KeyBindingType eKeyB = ScDocOptions::KEY_DEFAULT;
+    ScOptionsUtil::KeyBindingType eKeyB = ScOptionsUtil::KEY_DEFAULT;
     switch (maLbKeyBindings.GetSelectEntryPos())
     {
         case 0:
-            eKeyB = ScDocOptions::KEY_DEFAULT;
+            eKeyB = ScOptionsUtil::KEY_DEFAULT;
         break;
         case 1:
-            eKeyB = ScDocOptions::KEY_OOO_LEGACY;
+            eKeyB = ScOptionsUtil::KEY_OOO_LEGACY;
         break;
         default:
             ;
@@ -85,13 +85,13 @@ BOOL ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs)
 
 void ScTpCompatOptions::Reset(const SfxItemSet &rCoreAttrs)
 {
-    ScDocOptions::KeyBindingType eKeyB = mpOldOptions->GetKeyBindingType();
+    ScOptionsUtil::KeyBindingType eKeyB = mpOldOptions->GetKeyBindingType();
     switch (eKeyB)
     {
-        case ScDocOptions::KEY_DEFAULT:
+        case ScOptionsUtil::KEY_DEFAULT:
             maLbKeyBindings.SelectEntryPos(0);
         break;
-        case ScDocOptions::KEY_OOO_LEGACY:
+        case ScOptionsUtil::KEY_OOO_LEGACY:
             maLbKeyBindings.SelectEntryPos(1);
         break;
         default:
commit 0d82cea0ed9b9e80d04d61cc2b5e4a50e10e2d4c
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Oct 12 15:44:56 2010 -0400

    Took care of loading and saving of the new option value.
    
    The new option value is now persistent with the Options dialog, but
    key bindings don't get reset yet.

diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx
index 3609eb4..94d2787 100644
--- a/sc/inc/docoptio.hxx
+++ b/sc/inc/docoptio.hxx
@@ -38,9 +38,15 @@
 
 class SC_DLLPUBLIC ScDocOptions
 {
+public:
+    // values must correspond with integer values stored in the configuration
+    enum KeyBindingType { KEY_DEFAULT = 0, KEY_OOO_LEGACY = 1 };
+
+private:
     double fIterEps;				// Epsilon-Wert dazu
     USHORT nIterCount;				// Anzahl
     sal_uInt16 nPrecStandardFormat; // precision for standard format
+    KeyBindingType eKeyBindingType; // key binding type: Default (0), OOo legacy (1)
     USHORT nDay;					// Nulldatum:
     USHORT nMonth;
     USHORT nYear;
@@ -88,7 +94,6 @@ public:
     void   SetTabDistance( USHORT nTabDist ) {nTabDistance = nTabDist;}
 
     void		ResetDocOptions();
-    inline void		CopyTo(ScDocOptions& rOpt);
 
     inline const ScDocOptions&	operator=( const ScDocOptions& rOpt );
     inline int					operator==( const ScDocOptions& rOpt ) const;
@@ -97,6 +102,9 @@ public:
     sal_uInt16  GetStdPrecision() const { return nPrecStandardFormat; }
     void        SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
 
+    KeyBindingType GetKeyBindingType() const { return eKeyBindingType; }
+    void        SetKeyBindingType( KeyBindingType e ) { eKeyBindingType = e; }
+
     BOOL	IsCalcAsShown() const		{ return bCalcAsShown; }
     void	SetCalcAsShown( BOOL bVal )	{ bCalcAsShown = bVal; }
 
@@ -125,31 +133,6 @@ public:
     static const LocaleDataWrapper& GetLocaleDataWrapper();
 };
 
-
-inline void ScDocOptions::CopyTo(ScDocOptions& rOpt)
-{
-    rOpt.bIsIgnoreCase			= bIsIgnoreCase;
-    rOpt.bIsIter 				= bIsIter;
-    rOpt.nIterCount 			= nIterCount;
-    rOpt.fIterEps 				= fIterEps;
-    rOpt.nPrecStandardFormat 	= nPrecStandardFormat;
-    rOpt.nDay 					= nDay;
-    rOpt.nMonth 				= nMonth;
-    rOpt.nYear2000				= nYear2000;
-    rOpt.nYear 					= nYear;
-    rOpt.nTabDistance			= nTabDistance;
-    rOpt.bCalcAsShown			= bCalcAsShown;
-    rOpt.bMatchWholeCell		= bMatchWholeCell;
-    rOpt.bDoAutoSpell			= bDoAutoSpell;
-    rOpt.bLookUpColRowNames		= bLookUpColRowNames;
-    rOpt.bFormulaRegexEnabled   = bFormulaRegexEnabled;
-    rOpt.bUseEnglishFuncName    = bUseEnglishFuncName;
-    rOpt.eFormulaGrammar        = eFormulaGrammar;
-    rOpt.aFormulaSepArg         = aFormulaSepArg;
-    rOpt.aFormulaSepArrayRow    = aFormulaSepArrayRow;
-    rOpt.aFormulaSepArrayCol    = aFormulaSepArrayCol;
-}
-
 inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
 {
     bIsIgnoreCase		= rCpy.bIsIgnoreCase;
@@ -157,6 +140,7 @@ inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
     nIterCount			= rCpy.nIterCount;
     fIterEps			= rCpy.fIterEps;
     nPrecStandardFormat = rCpy.nPrecStandardFormat;
+    eKeyBindingType     = rCpy.eKeyBindingType;
     nDay				= rCpy.nDay;
     nMonth				= rCpy.nMonth;
     nYear				= rCpy.nYear;
@@ -184,6 +168,7 @@ inline int ScDocOptions::operator==( const ScDocOptions& rOpt ) const
             &&	rOpt.nIterCount 			== nIterCount
             &&	rOpt.fIterEps 				== fIterEps
             &&	rOpt.nPrecStandardFormat 	== nPrecStandardFormat
+            &&  rOpt.eKeyBindingType        == eKeyBindingType
             &&	rOpt.nDay 					== nDay
             &&	rOpt.nMonth 				== nMonth
             &&	rOpt.nYear 					== nYear
@@ -239,14 +224,17 @@ class ScDocCfg : public ScDocOptions
     ScLinkConfigItem	aCalcItem;
     ScLinkConfigItem    aFormulaItem;
     ScLinkConfigItem	aLayoutItem;
+    ScLinkConfigItem    aCompatItem;
 
     DECL_LINK( CalcCommitHdl, void* );
     DECL_LINK( FormulaCommitHdl, void* );
     DECL_LINK( LayoutCommitHdl, void* );
+    DECL_LINK( CompatCommitHdl, void* );
 
     com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames();
     com::sun::star::uno::Sequence<rtl::OUString> GetFormulaPropertyNames();
     com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames();
+    com::sun::star::uno::Sequence<rtl::OUString> GetCompatPropertyNames();
 
 public:
             ScDocCfg();
diff --git a/sc/source/core/tool/docoptio.cxx b/sc/source/core/tool/docoptio.cxx
index 83c204c..06ef113 100644
--- a/sc/source/core/tool/docoptio.cxx
+++ b/sc/source/core/tool/docoptio.cxx
@@ -91,6 +91,7 @@ ScDocOptions::ScDocOptions( const ScDocOptions& rCpy )
         :   fIterEps( rCpy.fIterEps ),
             nIterCount( rCpy.nIterCount ),
             nPrecStandardFormat( rCpy.nPrecStandardFormat ),
+            eKeyBindingType( rCpy.eKeyBindingType ),
             nDay( rCpy.nDay ),
             nMonth( rCpy.nMonth ),
             nYear( rCpy.nYear ),
@@ -126,6 +127,7 @@ void ScDocOptions::ResetDocOptions()
     nIterCount			= 100;
     fIterEps			= 1.0E-3;
     nPrecStandardFormat = SvNumberFormatter::UNLIMITED_PRECISION;
+    eKeyBindingType     = KEY_DEFAULT;
     nDay				= 30;
     nMonth				= 12;
     nYear				= 1899;
@@ -283,6 +285,9 @@ SfxPoolItem* __EXPORT ScTpCalcItem::Clone( SfxItemPool * ) const
 #define SCDOCLAYOUTOPT_TABSTOP		0
 #define SCDOCLAYOUTOPT_COUNT		1
 
+#define CFGPATH_COMPAT      "Office.Calc/Compatibility"
+#define SCCOMPATOPT_KEY_BINDING     0
+#define SCCOMPATOPT_COUNT           1
 
 Sequence<OUString> ScDocCfg::GetCalcPropertyNames()
 {
@@ -345,10 +350,25 @@ Sequence<OUString> ScDocCfg::GetLayoutPropertyNames()
     return aNames;
 }
 
+Sequence<OUString> ScDocCfg::GetCompatPropertyNames()
+{
+    static const char* aPropNames[] =
+    {
+        "KeyBindings/BaseGroup"             // SCCOMPATOPT_KEY_BINDING
+    };
+    Sequence<OUString> aNames(SCCOMPATOPT_COUNT);
+    OUString* pNames = aNames.getArray();
+    for (int i = 0; i < SCCOMPATOPT_COUNT; ++i)
+        pNames[i] = OUString::createFromAscii(aPropNames[i]);
+
+    return aNames;
+}
+
 ScDocCfg::ScDocCfg() :
     aCalcItem( OUString::createFromAscii( CFGPATH_CALC ) ),
     aFormulaItem(OUString::createFromAscii(CFGPATH_FORMULA)),
-    aLayoutItem( OUString::createFromAscii( CFGPATH_DOCLAYOUT ) )
+    aLayoutItem(OUString::createFromAscii(CFGPATH_DOCLAYOUT)),
+    aCompatItem(OUString::createFromAscii(CFGPATH_COMPAT))
 {
     sal_Int32 nIntVal = 0;
     double fDoubleVal = 0;
@@ -513,6 +533,33 @@ ScDocCfg::ScDocCfg() :
         }
     }
     aLayoutItem.SetCommitLink( LINK( this, ScDocCfg, LayoutCommitHdl ) );
+
+    aNames = GetCompatPropertyNames();
+    aValues = aCompatItem.GetProperties(aNames);
+    aCompatItem.EnableNotification(aNames);
+    pValues = aValues.getConstArray();
+    if (aValues.getLength() == aNames.getLength())
+    {
+        for (int nProp = 0; nProp < aNames.getLength(); ++nProp)
+        {
+            switch (nProp)
+            {
+                case SCCOMPATOPT_KEY_BINDING:
+                {
+                    fprintf(stdout, "ScDocCfg::ScDocCfg:   SCCOMPATOPT_KEY_BINDING\n");
+                    nIntVal = 0;
+                    if (pValues[nProp] >>= nIntVal)
+                        fprintf(stdout, "ScDocCfg::ScDocCfg:   key binding = %ld\n", nIntVal);
+                    else
+                        fprintf(stdout, "ScDocCfg::ScDocCfg:   key binding failed to load\n");
+
+                    SetKeyBindingType(static_cast<ScDocOptions::KeyBindingType>(nIntVal));
+                }
+                break;
+            }
+        }
+    }
+    aCompatItem.SetCommitLink( LINK(this, ScDocCfg, CompatCommitHdl) );
 }
 
 IMPL_LINK( ScDocCfg, CalcCommitHdl, void *, EMPTYARG )
@@ -637,6 +684,27 @@ IMPL_LINK( ScDocCfg, LayoutCommitHdl, void *, EMPTYARG )
     return 0;
 }
 
+IMPL_LINK( ScDocCfg, CompatCommitHdl, void *, EMPTYARG )
+{
+    Sequence<OUString> aNames = GetCompatPropertyNames();
+    Sequence<Any> aValues(aNames.getLength());
+    Any* pValues = aValues.getArray();
+
+    for (int nProp = 0; nProp < aNames.getLength(); ++nProp)
+    {
+        switch(nProp)
+        {
+            case SCCOMPATOPT_KEY_BINDING:
+            {
+                fprintf(stdout, "IMPL_LINK:   pushing key binding type (%d)\n", GetKeyBindingType());
+                pValues[nProp] <<= static_cast<sal_Int32>(GetKeyBindingType());
+            }
+            break;
+        }
+    }
+    aCompatItem.PutProperties(aNames, aValues);
+    return 0;
+}
 
 void ScDocCfg::SetOptions( const ScDocOptions& rNew )
 {
@@ -645,6 +713,7 @@ void ScDocCfg::SetOptions( const ScDocOptions& rNew )
     aCalcItem.SetModified();
     aFormulaItem.SetModified();
     aLayoutItem.SetModified();
+    aCompatItem.SetModified();
 }
 
 
diff --git a/sc/source/ui/inc/tpcompatibility.hxx b/sc/source/ui/inc/tpcompatibility.hxx
index 75942c7..423ac2e 100644
--- a/sc/source/ui/inc/tpcompatibility.hxx
+++ b/sc/source/ui/inc/tpcompatibility.hxx
@@ -32,6 +32,10 @@
 #include <vcl/fixed.hxx>
 #include <vcl/lstbox.hxx>
 
+#include <boost/shared_ptr.hpp>
+
+class ScDocOptions;
+
 class ScTpCompatOptions : public SfxTabPage
 {
 public:
@@ -50,6 +54,8 @@ private:
     FixedText maFtKeyBindings;
     ListBox   maLbKeyBindings;
 
+    ::boost::shared_ptr<ScDocOptions> mpOldOptions;
+    ::boost::shared_ptr<ScDocOptions> mpNewOptions;
 };
 
 #endif
diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx
index 7820dc4..c9853f3 100644
--- a/sc/source/ui/optdlg/tpcompatibility.cxx
+++ b/sc/source/ui/optdlg/tpcompatibility.cxx
@@ -33,6 +33,7 @@
 #include "tpcompatibility.hxx"
 #include "optdlg.hrc"
 #include "scresid.hxx"
+#include "docoptio.hxx"
 
 ScTpCompatOptions::ScTpCompatOptions(Window *pParent, const SfxItemSet &rCoreAttrs) :
     SfxTabPage(pParent, ScResId(RID_SCPAGE_COMPATIBILITY), rCoreAttrs),
@@ -41,6 +42,11 @@ ScTpCompatOptions::ScTpCompatOptions(Window *pParent, const SfxItemSet &rCoreAtt
     maLbKeyBindings(this, ScResId(LB_KEY_BINDINGS))
 {
     FreeResource();
+
+    const ScTpCalcItem& rItem = static_cast<const ScTpCalcItem&>(
+        rCoreAttrs.Get(GetWhich(SID_SCDOCOPTIONS)));
+    mpOldOptions.reset(new ScDocOptions(rItem.GetDocOptions()));
+    mpNewOptions.reset(new ScDocOptions(rItem.GetDocOptions()));
 }
 
 ScTpCompatOptions::~ScTpCompatOptions()
@@ -54,11 +60,43 @@ SfxTabPage* ScTpCompatOptions::Create(Window *pParent, const SfxItemSet &rCoreAt
 
 BOOL ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs)
 {
-    return false;
+    ScDocOptions::KeyBindingType eKeyB = ScDocOptions::KEY_DEFAULT;
+    switch (maLbKeyBindings.GetSelectEntryPos())
+    {
+        case 0:
+            eKeyB = ScDocOptions::KEY_DEFAULT;
+        break;
+        case 1:
+            eKeyB = ScDocOptions::KEY_OOO_LEGACY;
+        break;
+        default:
+            ;
+    }
+    mpNewOptions->SetKeyBindingType(eKeyB);
+
+    if (*mpNewOptions != *mpOldOptions)
+    {
+        rCoreAttrs.Put(ScTpCalcItem(GetWhich(SID_SCDOCOPTIONS), *mpNewOptions));
+        return true;
+    }
+    else
+        return false;
 }
 
 void ScTpCompatOptions::Reset(const SfxItemSet &rCoreAttrs)
 {
+    ScDocOptions::KeyBindingType eKeyB = mpOldOptions->GetKeyBindingType();
+    switch (eKeyB)
+    {
+        case ScDocOptions::KEY_DEFAULT:
+            maLbKeyBindings.SelectEntryPos(0);
+        break;
+        case ScDocOptions::KEY_OOO_LEGACY:
+            maLbKeyBindings.SelectEntryPos(1);
+        break;
+        default:
+            ;
+    }
 }
 
 int ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/)
commit a7637019cf4702dde00f24152222f8bd2dcb53f1
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Oct 11 21:30:04 2010 -0400

    Made the list box a little wider.

diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index a66e64c..82b489e 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -305,7 +305,7 @@ TabPage RID_SCPAGE_COMPATIBILITY
     {
         Border = TRUE ;
         Pos = MAP_APPFONT ( 85, 14 ) ;
-        Size = MAP_APPFONT ( 60, 46 ) ;
+        Size = MAP_APPFONT ( 75, 46 ) ;
         DropDown = TRUE ;
         StringList [ en-US ] =
         {
commit 49475215c5b14c0cace46fc153d8eb4546e47001
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Oct 11 18:13:35 2010 -0400

    fdo#30559: Added new tab page 'Compatibility' in the Options dialog.
    
    This is the first cut: more changes to come.

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 3eabf42..157ecf9 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1673,6 +1673,10 @@
 #define SID_INSERT_CURRENT_DATE     (SC_OOO_BUILD_START + 4)
 #define SID_INSERT_CURRENT_TIME     (SC_OOO_BUILD_START + 5)
 
+// Compatibility options page
+#define RID_SCPAGE_COMPATIBILITY    (SC_OOO_BUILD_START + 6)
+#define HID_SCPAGE_COMPATIBILITY    (SC_OOO_BUILD_START + 7)
+
 #endif
 
 
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index ac81824..93573c6 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2109,6 +2109,13 @@ SfxTabPage*	 ScModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItem
                 pRet = (*ScTpFormulaOptionsCreate)(pParent, rSet);
         }
         break;
+        case SID_SC_TP_COMPATIBILITY:
+        {
+            ::CreateTabPage ScTpCompatOptionsCreate = pFact->GetTabPageCreatorFunc (RID_SCPAGE_COMPATIBILITY);
+            if (ScTpCompatOptionsCreate)
+                pRet = (*ScTpCompatOptionsCreate)(pParent, rSet);
+        }
+        break;
         case SID_SC_TP_CHANGES:
                                 {
                                             ::CreateTabPage ScRedlineOptionsTabPageCreate =	pFact->GetTabPageCreatorFunc( RID_SCPAGE_OPREDLINE );
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index d456b87..19e7a2e 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -80,6 +80,7 @@
 #include "tpusrlst.hxx" //add for ScTpUserLists
 #include "tpview.hxx" //add for ScTpContentOptions
 #include "tpformula.hxx"
+#include "tpcompatibility.hxx"
 
 // ause
 #include "editutil.hxx"
@@ -1557,6 +1558,8 @@ CreateTabPage ScAbstractDialogFactory_Impl::GetTabPageCreatorFunc( USHORT nId )
             //break;
         case RID_SCPAGE_FORMULA:
             return ScTpFormulaOptions::Create;
+        case RID_SCPAGE_COMPATIBILITY:
+            return ScTpCompatOptions::Create;
         case	RID_SCPAGE_PRINT :
             return ScTpPrintOptions::Create;
             //break;
diff --git a/sc/source/ui/inc/optdlg.hrc b/sc/source/ui/inc/optdlg.hrc
index 821e71e..d409ad3 100644
--- a/sc/source/ui/inc/optdlg.hrc
+++ b/sc/source/ui/inc/optdlg.hrc
@@ -27,13 +27,6 @@
 
 #include "sc.hrc"
 
-/*
-#define RID_SCDLG_OPTIONS       256
-#define RID_SCPAGE_VIEW			256
-#define RID_SCPAGE_USERLISTS    257
-#define RID_SCPAGE_CALC 		258
-#define RID_SCPAGE_PRINT 		259
-*/
 
 #define TP_GENERAL			1
 #define TP_SAVE             2
@@ -90,14 +83,6 @@
 #define BTN_NOTES           22
 #define GB_CONTENTS			23
 
-//#define FT_OLE			31
-//#define FT_CHARTS			32
-//#define FT_DRAWINGS		33
-//#define LB_OLE			34
-//#define LB_CHARTS			35
-//#define LB_DRAWINGS		36
-//#define GB_OBJECTS		37
-
 
 // TP_USERLISTS:
 #define FT_LISTS			1
@@ -205,3 +190,8 @@
 #define FT_FORMULA_SEP_ARRAY_C    89
 #define ED_FORMULA_SEP_ARRAY_C    90
 #define BTN_FORMULA_SEP_RESET     91
+
+// TP_COMPATIBILITY
+#define FL_KEY_BINDINGS       1
+#define FT_KEY_BINDINGS       2
+#define LB_KEY_BINDINGS       3
diff --git a/sc/source/ui/inc/tpcompatibility.hxx b/sc/source/ui/inc/tpcompatibility.hxx
new file mode 100644
index 0000000..75942c7
--- /dev/null
+++ b/sc/source/ui/inc/tpcompatibility.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyrigt 2010 Novell, Inc.
+ *
+ * LibreOffice - a multi-platform office productivity suite
+ *
+ * This file is part of LibreOffice.
+ *
+ * LibreOffice is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * LibreOffice is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with LibreOffice.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __SC_TPCOMPATIBILITY_HXX__
+#define __SC_TPCOMPATIBILITY_HXX__
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+
+class ScTpCompatOptions : public SfxTabPage
+{
+public:
+    static  SfxTabPage* Create (Window* pParent, const SfxItemSet& rCoreAttrs);
+
+    virtual BOOL FillItemSet(SfxItemSet& rCoreAttrs);
+    virtual void Reset(const SfxItemSet& rCoreAttrs);
+    virtual int DeactivatePage(SfxItemSet* pSet = NULL);
+
+private:
+    explicit ScTpCompatOptions(Window* pParent, const SfxItemSet& rCoreAttrs);
+    virtual ~ScTpCompatOptions();
+
+private:
+    FixedLine maFlKeyBindings;
+    FixedText maFtKeyBindings;
+    ListBox   maLbKeyBindings;
+
+};
+
+#endif
diff --git a/sc/source/ui/optdlg/makefile.mk b/sc/source/ui/optdlg/makefile.mk
index f09eb92..90e4c9c 100644
--- a/sc/source/ui/optdlg/makefile.mk
+++ b/sc/source/ui/optdlg/makefile.mk
@@ -52,6 +52,7 @@ SLOFILES =  \
         $(SLO)$/tpview.obj   \
         $(SLO)$/tpcalc.obj	\
         $(SLO)$/tpformula.obj	\
+        $(SLO)$/tpcompatibility.obj	\
         $(SLO)$/tpprint.obj	\
         $(SLO)$/opredlin.obj
 
diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx
new file mode 100644
index 0000000..7820dc4
--- /dev/null
+++ b/sc/source/ui/optdlg/tpcompatibility.cxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyrigt 2010 Novell, Inc.
+ *
+ * LibreOffice - a multi-platform office productivity suite
+ *
+ * This file is part of LibreOffice.
+ *
+ * LibreOffice is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * LibreOffice is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with LibreOffice.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#undef SC_DLLIMPLEMENTATION
+
+#include "tpcompatibility.hxx"
+#include "optdlg.hrc"
+#include "scresid.hxx"
+
+ScTpCompatOptions::ScTpCompatOptions(Window *pParent, const SfxItemSet &rCoreAttrs) :
+    SfxTabPage(pParent, ScResId(RID_SCPAGE_COMPATIBILITY), rCoreAttrs),
+    maFlKeyBindings(this, ScResId(FL_KEY_BINDINGS)),
+    maFtKeyBindings(this, ScResId(FT_KEY_BINDINGS)),
+    maLbKeyBindings(this, ScResId(LB_KEY_BINDINGS))
+{
+    FreeResource();
+}
+
+ScTpCompatOptions::~ScTpCompatOptions()
+{
+}
+
+SfxTabPage* ScTpCompatOptions::Create(Window *pParent, const SfxItemSet &rCoreAttrs)
+{
+    return new ScTpCompatOptions(pParent, rCoreAttrs);
+}
+
+BOOL ScTpCompatOptions::FillItemSet(SfxItemSet &rCoreAttrs)
+{
+    return false;
+}
+
+void ScTpCompatOptions::Reset(const SfxItemSet &rCoreAttrs)
+{
+}
+
+int ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/)
+{
+    return KEEP_PAGE;
+}
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index 3b07ff8..a66e64c 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -279,6 +279,42 @@ TabPage RID_SCPAGE_FORMULA
     };
 };
 
+TabPage RID_SCPAGE_COMPATIBILITY
+{
+    HelpId = HID_SCPAGE_COMPATIBILITY ;
+    SVLook = TRUE ;
+    Hide = TRUE ;
+    Pos = MAP_APPFONT ( 0 , 0 ) ;
+    Size = MAP_APPFONT ( 260 , 185 ) ;
+
+    FixedLine FL_KEY_BINDINGS
+    {
+        Pos = MAP_APPFONT ( 6 , 3 ) ;
+        Size = MAP_APPFONT ( 248 , 8 ) ;
+        Text [ en-US ] = "Key bindings";
+    };
+
+    FixedText FT_KEY_BINDINGS
+    {
+        Pos = MAP_APPFONT ( 21, 16 ) ;
+        Size = MAP_APPFONT ( 80, 8 ) ;
+        Text [ en-US ] = "~Key bindings" ;
+    };
+
+    ListBox LB_KEY_BINDINGS
+    {
+        Border = TRUE ;
+        Pos = MAP_APPFONT ( 85, 14 ) ;
+        Size = MAP_APPFONT ( 60, 46 ) ;
+        DropDown = TRUE ;
+        StringList [ en-US ] =
+        {
+            < "Default" ; Default ; > ;
+            < "OpenOffice.org legacy" ; Default ; > ;
+        };
+    };
+};
+
 /**************************************************************************/
 /*                                                                        */
 /*                                                                        */


More information about the Libreoffice-commits mailing list