summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/cellsh2.cxx
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2024-01-24 01:17:28 +0100
committerHossein <hossein@libreoffice.org>2024-01-29 13:19:40 +0100
commit07203b8ed8cc7a392c196b695c9a5c60955b732b (patch)
treed5bcbab959283ec4e511220134263881a30427f6 /sc/source/ui/view/cellsh2.cxx
parent1e49f469afcbf3d1abec25451117f5f10d3ba825 (diff)
tdf#158426 Limit field columns for data form to 32
Previously, maximum number of field columns for data form was 256, which was too much. But, even with that value, nothing was happening when exceeding that threshold. With this patch, the limit is decreased to 32, and if the user goes beyond this limit by selecting more columns, an error message is displayed. This change is done to prevent LibreOffice hang when excessive number of filed columns are selected and using data form is requested. Change-Id: Ib6189b5b3beffb26a3fd8ba8cd06e4ae213f77da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162488 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'sc/source/ui/view/cellsh2.cxx')
-rw-r--r--sc/source/ui/view/cellsh2.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 8911cb33fbc1..5fbde9ca526f 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -53,6 +53,7 @@
#include <validat.hxx>
#include <validate.hxx>
#include <datamapper.hxx>
+#include <datafdlg.hxx>
#include <scui_def.hxx>
#include <scabstdlg.hxx>
@@ -353,6 +354,18 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
case SID_DATA_FORM:
{
+ ScViewData& rData = GetViewData();
+ ScRange aRange;
+ rData.GetSimpleArea( aRange );
+ ScAddress aStart = aRange.aStart;
+ ScAddress aEnd = aRange.aEnd;
+
+ if((aEnd.Col() - aStart.Col()) >= MAX_DATAFORM_COLS)
+ {
+ rData.GetDocShell()->ErrorMessage(STR_TOO_MANY_COLUMNS_DATA_FORM);
+ break;
+ }
+
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
VclPtr<AbstractScDataFormDlg> pDlg(pFact->CreateScDataFormDlg(