/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include ScSubTotalParam::ScSubTotalParam() { for ( sal_uInt16 i=0; i 0) && r.pSubTotals[i] && r.pFunctions[i] ) { nSubTotals[i] = r.nSubTotals[i]; pSubTotals[i] = new SCCOL [r.nSubTotals[i]]; pFunctions[i] = new ScSubTotalFunc [r.nSubTotals[i]]; for (SCCOL j=0; j 0) && pSubTotals[i] && pFunctions[i] ) { for ( SCCOL j=0; j 0 ) { pSubTotals[i] = new SCCOL [r.nSubTotals[i]]; pFunctions[i] = new ScSubTotalFunc [r.nSubTotals[i]]; for (SCCOL j=0; j 0) ) { for (SCCOL j=0; (j MAXSUBTOTAL!" ); OSL_ENSURE( ptrSubTotals, "ScSubTotalParam::SetSubTotals(): ptrSubTotals == NULL!" ); OSL_ENSURE( ptrFunctions, "ScSubTotalParam::SetSubTotals(): ptrFunctions == NULL!" ); OSL_ENSURE( (nCount > 0), "ScSubTotalParam::SetSubTotals(): nCount <= 0!" ); if ( !(ptrSubTotals && ptrFunctions && (nCount > 0) && (nGroup <= MAXSUBTOTAL)) ) return; // 0 is interpreted as 1, otherwise decrementing the array index if (nGroup != 0) nGroup--; delete [] pSubTotals[nGroup]; delete [] pFunctions[nGroup]; pSubTotals[nGroup] = new SCCOL [nCount]; pFunctions[nGroup] = new ScSubTotalFunc [nCount]; nSubTotals[nGroup] = static_cast(nCount); for ( sal_uInt16 i=0; i