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>
This commit is contained in:
Luboš Luňák 2022-02-28 16:06:09 +01:00
parent da77aec27e
commit 0156eba766
10 changed files with 51 additions and 7 deletions

View file

@ -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@

View file

@ -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

View file

@ -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 ===================================================================

View file

@ -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
{

View file

@ -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.

View file

@ -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;
};

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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;
}
}

View file

@ -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;
}