diff options
author | Eike Rathke <erack@redhat.com> | 2016-07-29 18:18:01 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-08-02 15:15:02 +0000 |
commit | 7dda28234cc516e864aff9a6c97b7c539a063c4e (patch) | |
tree | bcbafa58d49fb9069f8b7a7d02f89f47640a37f8 | |
parent | d013a5a38c6460a22434c6ba637c63d2118f12dc (diff) |
Change-Id: Idabf5e51b7f423d7d58094ad1caef166728c3bed
(cherry picked from commit 5cf5975cef114870268bee792e44570ddfdaafe8)
Reviewed-on: https://gerrit.libreoffice.org/27776
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 236439303e99..a13583067ee5 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -859,11 +859,16 @@ bool ScViewData::SelectionForbidsPaste() // static bool ScViewData::SelectionFillDOOM( const ScRange& rRange ) { - /* TODO: it is still possible to select one row less than the entire sheet - * and fool around. We could narrow this down to some "sane" value, just - * what would be sane? At least this helps against the Ctrl+A cases. */ - return rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL && - rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW; + // Assume that more than 23 full columns (23M cells) will not be + // successful.. Even with only 10 bytes per cell that would already be + // 230MB, formula cells would be 100 bytes and more per cell. + // rows * columns > 23m => rows > 23m / columns + // to not overflow in case number of available columns or rows would be + // arbitrarily increased. + // We could refine this and take some actual cell size into account, + // evaluate available memory and what not, but.. + const sal_Int32 kMax = 23 * 1024 * 1024; // current MAXROWCOUNT is 1024*1024=1048576 + return (rRange.aEnd.Row() - rRange.aStart.Row() + 1) > (kMax / (rRange.aEnd.Col() - rRange.aStart.Col() + 1)); } void ScViewData::SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) |