diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-02-28 16:06:09 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-03-01 10:48:13 +0100 |
commit | 0156eba76667fe1b0ed4355272fa77f98f9f63a4 (patch) | |
tree | e46f27cc49542c0b26253c2918b4790a9989a74e | |
parent | da77aec27e3121c895a6c6c287225216489cc8bc (diff) |
make Calc jumbo sheets an explicit build feature
On 32bit platforms tools::Long is 32bit, which is not enough
for pixel coordinates with 1m+ Calc rows+. So do not allow jumbo
sheets for such platforms.
Change-Id: I2ebd56a051470d33fca967918af3e7d2b0172dc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130713
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | config_host.mk.in | 1 | ||||
-rw-r--r-- | config_host/config_features.h.in | 6 | ||||
-rw-r--r-- | configure.ac | 22 | ||||
-rw-r--r-- | include/tools/long.hxx | 1 | ||||
-rw-r--r-- | sc/Module_sc.mk | 7 | ||||
-rw-r--r-- | sc/inc/defaultsoptions.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/jumbosheets-test.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/defaultsoptions.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/optdlg/tpdefaults.cxx | 6 |
10 files changed, 51 insertions, 7 deletions
diff --git a/config_host.mk.in b/config_host.mk.in index 0cb682c4862c..ee5d0326c981 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -171,6 +171,7 @@ export DISABLE_GUI=@DISABLE_GUI@ export ENABLE_HEADLESS=@ENABLE_HEADLESS@ export ENABLE_HTMLHELP=@ENABLE_HTMLHELP@ export ENABLE_JAVA=@ENABLE_JAVA@ +export ENABLE_JUMBO_SHEETS=@ENABLE_JUMBO_SHEETS@ export ENABLE_LDAP=@ENABLE_LDAP@ export ENABLE_LIBEOT=@ENABLE_LIBEOT@ export ENABLE_LPSOLVE=@ENABLE_LPSOLVE@ diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in index 3cc5109ca25a..de3e9d58f7d2 100644 --- a/config_host/config_features.h.in +++ b/config_host/config_features.h.in @@ -151,4 +151,10 @@ */ #define HAVE_FEATURE_PAGEIN 0 +/* + * Whether Calc supports jumbo sheets (more than 1m rows), which can overflow + * 32bit drawing coordinates (see tools::Long definition). + */ +#define HAVE_FEATURE_JUMBO_SHEETS 0 + #endif diff --git a/configure.ac b/configure.ac index accb60493657..3e65a8298aff 100644 --- a/configure.ac +++ b/configure.ac @@ -7135,6 +7135,28 @@ AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2) AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4) AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8) +dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long . +AC_MSG_CHECKING([whether jumbo sheets are supported]) +if test "$_os" != "WINNT"; then + if test $SAL_TYPES_SIZEOFLONG -gt 4; then + AC_MSG_RESULT([yes]) + ENABLE_JUMBO_SHEETS=TRUE + AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS) + else + AC_MSG_RESULT([no]) + fi +else + if test $WIN_HOST_BITS -gt 32; then + # 64bit windows is special-cased for tools::Long because long is 32bit + AC_MSG_RESULT([yes]) + ENABLE_JUMBO_SHEETS=TRUE + AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS) + else + AC_MSG_RESULT([no]) + fi +fi +AC_SUBST(ENABLE_JUMBO_SHEETS) + dnl =================================================================== dnl Check whether to enable runtime optimizations dnl =================================================================== diff --git a/include/tools/long.hxx b/include/tools/long.hxx index 5e0800f2c274..2388565df077 100644 --- a/include/tools/long.hxx +++ b/include/tools/long.hxx @@ -23,6 +23,7 @@ * of tools::Long in the codebase as meaning "we're not sure what the ideal size of the datatype is", * and where possible, replace it with a better datatype like sal_Int32/sal_Int64/etc. * + * NOTE: If you change this, make sure HAVE_FEATURE_JUMBO_SHEETS matches this, as it requires at least 64bit tools::Long. */ namespace tools { diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index c37b37dd2a14..5179c5fdb292 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -73,7 +73,6 @@ $(eval $(call gb_Module_add_slowcheck_targets,sc, \ CppunitTest_sc_cond_format_merge \ CppunitTest_sc_copypaste \ CppunitTest_sc_html_export_test \ - CppunitTest_sc_jumbosheets_test \ CppunitTest_sc_macros_test \ CppunitTest_sc_new_cond_format_api \ CppunitTest_sc_pdf_export \ @@ -85,6 +84,12 @@ $(eval $(call gb_Module_add_slowcheck_targets,sc, \ CppunitTest_sc_uicalc \ )) +ifneq ($(ENABLE_JUMBO_SHEETS),) +$(eval $(call gb_Module_add_slowcheck_targets,sc, \ + CppunitTest_sc_jumbosheets_test \ +)) +endif + # Various function tests fail in 32-bit linux_x86 build due to dreaded floating # point weirdness (x87, registers, compiler optimization, ... whatever), # disable them until someone finds a real cure. diff --git a/sc/inc/defaultsoptions.hxx b/sc/inc/defaultsoptions.hxx index 3deefb8fc150..21e3cc0f2ed3 100644 --- a/sc/inc/defaultsoptions.hxx +++ b/sc/inc/defaultsoptions.hxx @@ -11,6 +11,7 @@ #include <svl/poolitem.hxx> #include <unotools/configitem.hxx> +#include <config_features.h> #include "scdllapi.h" #include "types.hxx" @@ -31,8 +32,9 @@ public: void SetInitTabPrefix(const OUString& aPrefix) { aInitTabPrefix = aPrefix; } const OUString& GetInitTabPrefix() const { return aInitTabPrefix; } bool GetInitJumboSheets() const { return bJumboSheets; } +#if HAVE_FEATURE_JUMBO_SHEETS void SetInitJumboSheets( bool b) { bJumboSheets = b; } - +#endif bool operator== ( const ScDefaultsOptions& rOpt ) const; }; diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index e0dd7e87c98b..76f223564b9a 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -261,13 +261,10 @@ void ScJumboSheetsTest::testTdf134553() CPPUNIT_ASSERT_EQUAL(tools::Long(12741), pOleObj->GetLogicRect().getWidth()); CPPUNIT_ASSERT_EQUAL(tools::Long(7620), pOleObj->GetLogicRect().getHeight()); CPPUNIT_ASSERT_EQUAL(tools::Long(5097), pOleObj->GetLogicRect().getX()); - -#if !defined(_WIN32) //FIXME // tdf#147458: Without the fix in place, this test would have failed with // - Expected: 1058 // - Actual : -7421 CPPUNIT_ASSERT_EQUAL(tools::Long(1058), pOleObj->GetLogicRect().getY()); -#endif xDocSh->DoClose(); } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index da55ebfa85be..34e137dd576e 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -96,10 +96,12 @@ const sal_uInt16 ScDocument::nSrcVer = SC_CURRENT_VERSION; static ScSheetLimits* CreateSheetLimits() { +#if HAVE_FEATURE_JUMBO_SHEETS const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions(); if (rOpt.GetInitJumboSheets()) return new ScSheetLimits(MAXCOL_JUMBO, MAXROW_JUMBO); else +#endif return new ScSheetLimits(MAXCOL, MAXROW); } diff --git a/sc/source/core/tool/defaultsoptions.cxx b/sc/source/core/tool/defaultsoptions.cxx index df75dcb2dab4..3f18da0937e1 100644 --- a/sc/source/core/tool/defaultsoptions.cxx +++ b/sc/source/core/tool/defaultsoptions.cxx @@ -79,7 +79,6 @@ ScDefaultsCfg::ScDefaultsCfg() : ConfigItem( CFGPATH_FORMULA ) { OUString aPrefix; - bool bValue; Sequence<OUString> aNames = GetPropertyNames(); Sequence<Any> aValues = GetProperties(aNames); @@ -104,8 +103,13 @@ ScDefaultsCfg::ScDefaultsCfg() : SetInitTabPrefix(aPrefix); break; case SCDEFAULTSOPT_JUMBO_SHEETS: +#if HAVE_FEATURE_JUMBO_SHEETS + { + bool bValue; if (pValues[nProp] >>= bValue) SetInitJumboSheets(bValue); + } +#endif break; } } diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx index d1aaacf85ba0..7aad4501b254 100644 --- a/sc/source/ui/optdlg/tpdefaults.cxx +++ b/sc/source/ui/optdlg/tpdefaults.cxx @@ -14,6 +14,7 @@ #include <defaultsoptions.hxx> #include <document.hxx> #include <officecfg/Office/Common.hxx> +#include <config_features.h> ScTpDefaultsOptions::ScTpDefaultsOptions(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rCoreSet) : SfxTabPage(pPage, pController, "modules/scalc/ui/optdefaultpage.ui", "OptDefaultPage", &rCoreSet) @@ -24,7 +25,9 @@ ScTpDefaultsOptions::ScTpDefaultsOptions(weld::Container* pPage, weld::DialogCon 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 HAVE_FEATURE_JUMBO_SHEETS if (!officecfg::Office::Common::Misc::ExperimentalMode::get()) +#endif m_xEdJumboSheets->hide(); } @@ -52,8 +55,9 @@ bool ScTpDefaultsOptions::FillItemSet(SfxItemSet *rCoreSet) { aOpt.SetInitTabCount( nTabCount ); aOpt.SetInitTabPrefix( aSheetPrefix ); +#if HAVE_FEATURE_JUMBO_SHEETS aOpt.SetInitJumboSheets( bJumboSheets ); - +#endif rCoreSet->Put( ScTpDefaultsItem( aOpt ) ); bRet = true; } |