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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 27 12:12:19 UTC 2019


 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |   10 +++++++-
 sc/inc/defaultsoptions.hxx                               |    3 ++
 sc/source/core/data/documen2.cxx                         |   11 +++++++++
 sc/source/core/tool/defaultsoptions.cxx                  |   17 +++++++++++++--
 sc/source/ui/inc/tpdefaults.hxx                          |    1 
 sc/source/ui/optdlg/tpdefaults.cxx                       |   11 ++++++++-
 sc/uiconfig/scalc/ui/optdefaultpage.ui                   |   14 ++++++++++++
 7 files changed, 63 insertions(+), 4 deletions(-)

New commits:
commit 1c8b8e97eb6127e430c1dc0fc3578cec94371fd7
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Nov 25 13:03:42 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 27 13:10:45 2019 +0100

    sc: rowcol: tdf#50916 add UI to turn jumbo sheets on
    
    Change-Id: I9e50c38f38acdf5a275b125e9e421a6c6af6d590
    Reviewed-on: https://gerrit.libreoffice.org/83661
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index 1517514c903d..a7f683a4fec5 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1974,7 +1974,15 @@
             <desc>Option to set the prefix name for new sheet tabs</desc>
           </info>
         </prop>
-      </group>
+        <prop oor:name="JumboSheets" oor:type="xs:boolean" oor:nillable="false">
+          <!-- UIHints: Tools - Options - Spreadsheet - Defaults -->
+          <info>
+            <desc>Enable very large spreadsheets (16m rows, 16384 cols)</desc>
+            <label>Jumbo sheets</label>
+          </info>
+          <value>false</value>
+        </prop>
+    </group>
     </group>
     <group oor:name="DataStream">
         <info>
diff --git a/sc/inc/defaultsoptions.hxx b/sc/inc/defaultsoptions.hxx
index dd48dd83d4f9..1afef1a58b34 100644
--- a/sc/inc/defaultsoptions.hxx
+++ b/sc/inc/defaultsoptions.hxx
@@ -20,6 +20,7 @@ class SC_DLLPUBLIC ScDefaultsOptions
 private:
     SCTAB nInitTabCount;             // number of Tabs for new Spreadsheet doc
     OUString aInitTabPrefix;  // The Tab prefix name in new Spreadsheet doc
+    bool     bJumboSheets;
 
 public:
     ScDefaultsOptions();
@@ -30,6 +31,8 @@ public:
     void   SetInitTabCount( SCTAB nTabs) { nInitTabCount = nTabs; }
     void   SetInitTabPrefix(const OUString& aPrefix) { aInitTabPrefix = aPrefix; }
     const OUString& GetInitTabPrefix() const { return aInitTabPrefix; }
+    bool   GetInitJumboSheets() const           { return bJumboSheets; }
+    void   SetInitJumboSheets( bool b) { bJumboSheets = b; }
 
     bool                operator== ( const ScDefaultsOptions& rOpt ) const;
 
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 7271fdef0d43..a779371f83b7 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -35,6 +35,7 @@
 #include <comphelper/threadpool.hxx>
 #include <sal/log.hxx>
 
+#include <scmod.hxx>
 #include <document.hxx>
 #include <table.hxx>
 #include <patattr.hxx>
@@ -50,6 +51,7 @@
 #include <markdata.hxx>
 #include <validat.hxx>
 #include <detdata.hxx>
+#include <defaultsoptions.hxx>
 #include <sc.hrc>
 #include <ddelink.hxx>
 #include <chgtrack.hxx>
@@ -168,6 +170,15 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
         mbDocShellRecalc(false),
         mnMutationGuardFlags(0)
 {
+    const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
+    if (rOpt.GetInitJumboSheets())
+    {
+        mnMaxCol = 16384;
+        mnMaxRow = 16 * 1000 * 1000;
+    }
+    maPreviewSelection = { mnMaxRow, mnMaxCol };
+    aCurTextWidthCalcPos = { MaxCol(), 0, 0 };
+
     SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT);
 
     eSrcSet = osl_getThreadTextEncoding();
diff --git a/sc/source/core/tool/defaultsoptions.cxx b/sc/source/core/tool/defaultsoptions.cxx
index 2270c61351e7..af8b5fc7b60b 100644
--- a/sc/source/core/tool/defaultsoptions.cxx
+++ b/sc/source/core/tool/defaultsoptions.cxx
@@ -32,12 +32,14 @@ void ScDefaultsOptions::SetDefaults()
 {
     nInitTabCount  = 1;
     aInitTabPrefix = ScResId(STR_TABLE_DEF); // Default Prefix "Sheet"
+    bJumboSheets = false;
 }
 
 bool ScDefaultsOptions::operator==( const ScDefaultsOptions& rOpt ) const
 {
     return rOpt.nInitTabCount  == nInitTabCount
-        && rOpt.aInitTabPrefix == aInitTabPrefix;
+        && rOpt.aInitTabPrefix == aInitTabPrefix
+        && rOpt.bJumboSheets == bJumboSheets;
 }
 
 ScTpDefaultsItem::ScTpDefaultsItem( const ScDefaultsOptions& rOpt ) :
@@ -67,17 +69,21 @@ SfxPoolItem* ScTpDefaultsItem::Clone( SfxItemPool * ) const
 
 #define SCDEFAULTSOPT_TAB_COUNT  0
 #define SCDEFAULTSOPT_TAB_PREFIX 1
+#define SCDEFAULTSOPT_JUMBO_SHEETS 2
 
 Sequence<OUString> ScDefaultsCfg::GetPropertyNames()
 {
     return {"Sheet/SheetCount",   // SCDEFAULTSOPT_TAB_COUNT
-            "Sheet/SheetPrefix"}; // SCDEFAULTSOPT_TAB_PREFIX
+            "Sheet/SheetPrefix",  // SCDEFAULTSOPT_TAB_PREFIX
+            "Sheet/JumboSheets"};  // SCDEFAULTSOPT_JUMBO_SHEETS
+
 }
 
 ScDefaultsCfg::ScDefaultsCfg() :
     ConfigItem( CFGPATH_FORMULA )
 {
     OUString aPrefix;
+    bool bValue;
 
     Sequence<OUString> aNames = GetPropertyNames();
     Sequence<Any> aValues = GetProperties(aNames);
@@ -100,6 +106,10 @@ ScDefaultsCfg::ScDefaultsCfg() :
                     if (pValues[nProp] >>= aPrefix)
                         SetInitTabPrefix(aPrefix);
                     break;
+                case SCDEFAULTSOPT_JUMBO_SHEETS:
+                    if (pValues[nProp] >>= bValue)
+                        SetInitJumboSheets(bValue);
+                    break;
                 }
             }
         }
@@ -122,6 +132,9 @@ void ScDefaultsCfg::ImplCommit()
         case SCDEFAULTSOPT_TAB_PREFIX:
             pValues[nProp] <<= GetInitTabPrefix();
         break;
+        case SCDEFAULTSOPT_JUMBO_SHEETS:
+            pValues[nProp] <<= GetInitJumboSheets();
+        break;
         }
     }
     PutProperties(aNames, aValues);
diff --git a/sc/source/ui/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx
index 44eea6e872a0..ecbedc188c90 100644
--- a/sc/source/ui/inc/tpdefaults.hxx
+++ b/sc/source/ui/inc/tpdefaults.hxx
@@ -39,6 +39,7 @@ private:
 
     std::unique_ptr<weld::SpinButton> m_xEdNSheets;
     std::unique_ptr<weld::Entry> m_xEdSheetPrefix;
+    std::unique_ptr<weld::CheckButton> m_xEdJumboSheets;
 };
 
 #endif
diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx
index a0c8234eefc9..fce701996f73 100644
--- a/sc/source/ui/optdlg/tpdefaults.cxx
+++ b/sc/source/ui/optdlg/tpdefaults.cxx
@@ -13,15 +13,19 @@
 #include <sc.hrc>
 #include <defaultsoptions.hxx>
 #include <document.hxx>
+#include <svtools/miscopt.hxx>
 
 ScTpDefaultsOptions::ScTpDefaultsOptions(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rCoreSet)
     : SfxTabPage(pPage, pController, "modules/scalc/ui/optdefaultpage.ui", "OptDefaultPage", &rCoreSet)
     , m_xEdNSheets(m_xBuilder->weld_spin_button("sheetsnumber"))
     , m_xEdSheetPrefix(m_xBuilder->weld_entry("sheetprefix"))
+    , m_xEdJumboSheets(m_xBuilder->weld_check_button("jumbo_sheets"))
 {
     m_xEdNSheets->connect_changed( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) );
     m_xEdSheetPrefix->connect_changed( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) );
     m_xEdSheetPrefix->connect_focus_in( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) );
+    if (!SvtMiscOptions().IsExperimentalMode())
+        m_xEdJumboSheets->hide();
 }
 
 ScTpDefaultsOptions::~ScTpDefaultsOptions()
@@ -40,12 +44,15 @@ bool ScTpDefaultsOptions::FillItemSet(SfxItemSet *rCoreSet)
 
     SCTAB nTabCount = static_cast<SCTAB>(m_xEdNSheets->get_value());
     OUString aSheetPrefix = m_xEdSheetPrefix->get_text();
+    bool bJumboSheets = m_xEdJumboSheets->get_state();
 
     if ( m_xEdNSheets->get_value_changed_from_saved()
-         || m_xEdSheetPrefix->get_saved_value() != aSheetPrefix )
+         || m_xEdSheetPrefix->get_saved_value() != aSheetPrefix
+         || m_xEdJumboSheets->get_saved_state() != (bJumboSheets ? TRISTATE_TRUE : TRISTATE_FALSE) )
     {
         aOpt.SetInitTabCount( nTabCount );
         aOpt.SetInitTabPrefix( aSheetPrefix );
+        aOpt.SetInitJumboSheets( bJumboSheets );
 
         rCoreSet->Put( ScTpDefaultsItem( aOpt ) );
         bRet = true;
@@ -63,8 +70,10 @@ void ScTpDefaultsOptions::Reset(const SfxItemSet* rCoreSet)
 
     m_xEdNSheets->set_value(aOpt.GetInitTabCount());
     m_xEdSheetPrefix->set_text( aOpt.GetInitTabPrefix() );
+    m_xEdJumboSheets->set_state( aOpt.GetInitJumboSheets() ? TRISTATE_TRUE : TRISTATE_FALSE );
     m_xEdNSheets->save_value();
     m_xEdSheetPrefix->save_value();
+    m_xEdJumboSheets->save_state();
 }
 
 DeactivateRC ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/)
diff --git a/sc/uiconfig/scalc/ui/optdefaultpage.ui b/sc/uiconfig/scalc/ui/optdefaultpage.ui
index 93852f9b4d6f..22c62224da61 100644
--- a/sc/uiconfig/scalc/ui/optdefaultpage.ui
+++ b/sc/uiconfig/scalc/ui/optdefaultpage.ui
@@ -85,6 +85,20 @@
                     <property name="top_attach">0</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkCheckButton" id="jumbo_sheets">
+                    <property name="label" translatable="yes" context="optdefaultpage|jumbo_sheets">_Enable very large spreadsheets (16m rows, 16384 cols)</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</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>
               </object>
             </child>
           </object>


More information about the Libreoffice-commits mailing list