View | Details | Raw Unified | Return to issue 123909
Collapse All | Expand All

(-)inc/attarray.hxx (+5 lines)
Lines 188-193 Link Here
188
	void	DeleteHardAttr( SCROW nStartRow, SCROW nEndRow );
188
	void	DeleteHardAttr( SCROW nStartRow, SCROW nEndRow );
189
189
190
//UNUSED2008-05  void    ConvertFontsAfterLoad();     // old binary file format
190
//UNUSED2008-05  void    ConvertFontsAfterLoad();     // old binary file format
191
192
    /* i123909: Pre-calculate needed memory, and pre-reserve enough memory */
193
    bool    Reserve( SCSIZE nCount );
194
    SCSIZE  Count() const{ return nCount; }
195
    SCSIZE  Count( SCROW nRw1, SCROW nRw2 );
191
};
196
};
192
197
193
198
(-)inc/column.hxx (+3 lines)
Lines 404-409 Link Here
404
    xub_StrLen  GetMaxNumberStringLen( sal_uInt16& nPrecision,
404
    xub_StrLen  GetMaxNumberStringLen( sal_uInt16& nPrecision,
405
                                       SCROW nRowStart, SCROW nRowEnd ) const;
405
                                       SCROW nRowStart, SCROW nRowEnd ) const;
406
406
407
    SCSIZE      GetPatternCount( );
408
    SCSIZE      GetPatternCount( SCROW nRw1, SCROW nRw2 );
409
    bool        ReservedPatternCount( SCSIZE nReserved );
407
private:
410
private:
408
	ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos);
411
	ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos);
409
//UNUSED2008-05  void		CorrectSymbolCells( CharSet eStreamCharSet );
412
//UNUSED2008-05  void		CorrectSymbolCells( CharSet eStreamCharSet );
(-)inc/document.hxx (+4 lines)
Lines 1908-1913 Link Here
1908
1908
1909
public:
1909
public:
1910
    void    FillDPCache( ScDPTableDataCache * pCache, SCTAB nDocTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
1910
    void    FillDPCache( ScDPTableDataCache * pCache, SCTAB nDocTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
1911
private:
1912
    SCSIZE GetPatternCount( SCTAB nTab, SCCOL nCol );
1913
    SCSIZE GetPatternCount( SCTAB nTab, SCCOL nCol, SCROW nRw1, SCROW nRw2 );
1914
    bool   ReservedPatternCount( SCTAB nTab, SCCOL nCol, SCSIZE nReserved );
1911
};
1915
};
1912
inline void ScDocument::GetSortParam( ScSortParam& rParam, SCTAB nTab )
1916
inline void ScDocument::GetSortParam( ScSortParam& rParam, SCTAB nTab )
1913
{
1917
{
(-)inc/table.hxx (+3 lines)
Lines 311-316 Link Here
311
                           SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
311
                           SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
312
	void		SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
312
	void		SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
313
	void 		SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
313
	void 		SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
314
	SCSIZE		GetPatternCount( SCCOL nCol );
315
	SCSIZE 		GetPatternCount( SCCOL nCol, SCROW nRw1, SCROW nRw2 );
316
	bool		ReservedPatternCount( SCCOL nCol, SCSIZE nReserved );
314
317
315
	void		GetString( SCCOL nCol, SCROW nRow, String& rString );
318
	void		GetString( SCCOL nCol, SCROW nRow, String& rString );
316
    void    FillDPCache( ScDPTableDataCache * pCache, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
319
    void    FillDPCache( ScDPTableDataCache * pCache, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
(-)source/core/data/attarray.cxx (-4 / +30 lines)
Lines 19-31 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
// MARKER(update_precomp.py): autogen include statement, do not remove
22
// MARKER(update_precomp.py): autogen include statement, do not remove
25
#include "precompiled_sc.hxx"
23
#include "precompiled_sc.hxx"
26
24
27
28
29
//------------------------------------------------------------------------
25
//------------------------------------------------------------------------
30
26
31
#include "scitems.hxx"
27
#include "scitems.hxx"
Lines 295-300 Link Here
295
	SetPatternArea( nRow, nRow, pPattern, bPutToPool );
291
	SetPatternArea( nRow, nRow, pPattern, bPutToPool );
296
}
292
}
297
293
294
bool ScAttrArray::Reserve( SCSIZE nReserve )
295
{
296
    if ( nCount <= nReserve )
297
    {
298
        if( ScAttrEntry* pNewData = new (std::nothrow) ScAttrEntry[nReserve] )
299
        {
300
            nLimit = nReserve;
301
            memcpy( pNewData, pData, nCount*sizeof(ScAttrEntry) );
302
            delete[] pData;
303
            pData = pNewData;
304
            return true;
305
        }
306
        else
307
            return false;
308
    }
309
    else
310
        return false;
311
}
298
312
299
void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern, sal_Bool bPutToPool )
313
void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern, sal_Bool bPutToPool )
300
{
314
{
Lines 2647-2649 Link Here
2647
//UNUSED2008-05      }
2661
//UNUSED2008-05      }
2648
//UNUSED2008-05  }
2662
//UNUSED2008-05  }
2649
2663
2664
SCSIZE ScAttrArray::Count( SCROW nStartRow, SCROW nEndRow )
2665
{
2666
    SCSIZE	nIndex1, nIndex2;
2667
    
2668
    if( !Search( nStartRow, nIndex1 ) )
2669
        return 0;
2670
2671
    if( !Search( nEndRow, nIndex2 ) )
2672
        nIndex2 = this->nCount - 1;
2673
2674
    return nIndex2 - nIndex1 + 1;
2675
}
(-)source/core/data/column2.cxx (-6 / +12 lines)
Lines 19-31 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
// MARKER(update_precomp.py): autogen include statement, do not remove
22
// MARKER(update_precomp.py): autogen include statement, do not remove
25
#include "precompiled_sc.hxx"
23
#include "precompiled_sc.hxx"
26
24
27
28
29
// INCLUDE ---------------------------------------------------------------
25
// INCLUDE ---------------------------------------------------------------
30
26
31
#include "scitems.hxx"
27
#include "scitems.hxx"
Lines 1885-1891 Link Here
1885
	return nCodeCount;
1881
	return nCodeCount;
1886
}
1882
}
1887
1883
1884
SCSIZE ScColumn::GetPatternCount()
1885
{
1886
    return this->pAttrArray ? this->pAttrArray->Count() : 0;
1887
}
1888
1888
1889
SCSIZE ScColumn::GetPatternCount( SCROW nRw1, SCROW nRw2 )
1890
{
1891
    return this->pAttrArray ? this->pAttrArray->Count( nRw1, nRw2 ) : 0;
1892
}
1889
1893
1890
1894
bool ScColumn::ReservedPatternCount( SCSIZE nReserved )
1891
1895
{
1896
    return this->pAttrArray ? this->pAttrArray->Reserve( nReserved ) : false;
1897
}
(-)source/core/data/documen3.cxx (-2 / +24 lines)
Lines 19-26 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
// MARKER(update_precomp.py): autogen include statement, do not remove
22
// MARKER(update_precomp.py): autogen include statement, do not remove
25
#include "precompiled_sc.hxx"
23
#include "precompiled_sc.hxx"
26
24
Lines 2149-2151 Link Here
2149
    }
2147
    }
2150
}
2148
}
2151
// End Comments
2149
// End Comments
2150
2151
SCSIZE ScDocument::GetPatternCount( SCTAB nTab, SCCOL nCol )
2152
{
2153
    if( ValidTab(nTab) && pTab[nTab] )
2154
        return pTab[nTab]->GetPatternCount( nCol );
2155
    else
2156
        return 0;
2157
}
2158
2159
SCSIZE ScDocument::GetPatternCount( SCTAB nTab, SCCOL nCol, SCROW nRw1, SCROW nRw2 )
2160
{
2161
    if( ValidTab(nTab) && pTab[nTab] )
2162
        return pTab[nTab]->GetPatternCount( nCol, nRw1, nRw2 );
2163
    else
2164
        return 0;
2165
}
2166
2167
bool ScDocument::ReservedPatternCount( SCTAB nTab, SCCOL nCol, SCSIZE nReserved )
2168
{
2169
    if( ValidTab(nTab) && pTab[nTab] )
2170
        return pTab[nTab]->ReservedPatternCount( nCol, nReserved );
2171
    else
2172
        return false;
2173
}
(-)source/core/data/document.cxx (+35 lines)
Lines 2187-2192 Link Here
2187
                if (nR2 > nRow2)
2187
                if (nR2 > nRow2)
2188
                    nR2 = nRow2;
2188
                    nR2 = nRow2;
2189
2189
2190
                const unsigned PERFORMANCEOPTIMIZATION4PATTERNTHRESHOLD = 8192;
2191
                bool bNeedPerformanceOptimization4Pattern = nRow2 - nRow1 > PERFORMANCEOPTIMIZATION4PATTERNTHRESHOLD;
2192
                std::vector< std::vector< SCSIZE > > vvPatternCount( bNeedPerformanceOptimization4Pattern ? nCol2 - nCol1 + 1 : 0 );
2193
                std::vector< SCTAB > vTables;
2194
2195
                if( bNeedPerformanceOptimization4Pattern )
2196
                {
2197
                    for (SCTAB i = aCBFCP.nTabStart; i <= aCBFCP.nTabEnd; i++)
2198
                        if (pTab[i] && rMark.GetTableSelect( i ) )
2199
                            vTables.push_back( i );
2200
2201
                    for( SCSIZE i = 0; i < vvPatternCount.size(); i++ )
2202
                    {
2203
                        vvPatternCount[i].resize( vTables.size() );
2204
2205
                        for( std::vector< SCTAB >::size_type j = 0; j<vTables.size(); j++ )
2206
                            vvPatternCount[i][j] = this->GetPatternCount( vTables[j], nCol1+i );
2207
                    }
2208
                }
2209
2190
                do
2210
                do
2191
                {
2211
                {
2192
                    // Pasting is done column-wise, when pasting to a filtered
2212
                    // Pasting is done column-wise, when pasting to a filtered
Lines 2223-2228 Link Here
2223
                    nC2 = nC1 + nXw;
2243
                    nC2 = nC1 + nXw;
2224
                    if (nC2 > nCol2)
2244
                    if (nC2 > nCol2)
2225
                        nC2 = nCol2;
2245
                        nC2 = nCol2;
2246
2247
                    if( bNeedPerformanceOptimization4Pattern && vvPatternCount.size() )
2248
                    {
2249
                        for( SCSIZE i = 0; i < vvPatternCount.size(); i++ )
2250
                        {
2251
                            vvPatternCount[i].resize( vTables.size() );
2252
2253
                            for( std::vector< SCTAB >::size_type j = 0; j<vTables.size(); j++ )
2254
                                this->ReservedPatternCount( vTables[j], nCol1+i, vvPatternCount[i][j] + ( this->GetPatternCount( vTables[j], nCol1+i, nR1, nR2 ) ) * ( ( nRow2 - nRow1 + 1 ) / ( nYw + 1 ) ) );
2255
                        }
2256
2257
                        bNeedPerformanceOptimization4Pattern = false;
2258
                        vvPatternCount.clear();
2259
                    }
2260
2226
                    nR1 = nR2 + 1;
2261
                    nR1 = nR2 + 1;
2227
                    nR2 = Min((SCROW)(nR1 + nYw), nRow2);
2262
                    nR2 = Min((SCROW)(nR1 + nYw), nRow2);
2228
                } while (nR1 <= nRow2);
2263
                } while (nR1 <= nRow2);
(-)source/core/data/table4.cxx (-7 / +21 lines)
Lines 19-33 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
// MARKER(update_precomp.py): autogen include statement, do not remove
22
// MARKER(update_precomp.py): autogen include statement, do not remove
25
#include "precompiled_sc.hxx"
23
#include "precompiled_sc.hxx"
26
24
27
// System - Includes -----------------------------------------------------
25
// System - Includes -----------------------------------------------------
28
26
29
30
31
#ifdef _MSC_VER
27
#ifdef _MSC_VER
32
#pragma optimize("",off)
28
#pragma optimize("",off)
33
										// sonst Absturz Win beim Fuellen
29
										// sonst Absturz Win beim Fuellen
Lines 2024-2031 Link Here
2024
	for (SCCOL i=0; i<=MAXCOL; i++) aCol[i].CompileColRowNameFormula();
2020
	for (SCCOL i=0; i<=MAXCOL; i++) aCol[i].CompileColRowNameFormula();
2025
}
2021
}
2026
2022
2023
SCSIZE ScTable::GetPatternCount( SCCOL nCol )
2024
{
2025
    if( ValidCol( nCol ) )
2026
        return aCol[nCol].GetPatternCount();
2027
    else
2028
        return 0;
2029
}
2027
2030
2031
SCSIZE ScTable::GetPatternCount( SCCOL nCol, SCROW nRw1, SCROW nRw2 )
2032
{
2033
    if( ValidCol( nCol ) && ValidRow( nRw1 ) && ValidRow( nRw2 ) )
2034
        return aCol[nCol].GetPatternCount( nRw1, nRw2 );
2035
    else
2036
        return 0;
2037
}
2028
2038
2029
2039
bool ScTable::ReservedPatternCount( SCCOL nCol, SCSIZE nReserved )
2030
2040
{
2031
2041
    if( ValidCol( nCol ) )
2042
        return aCol[nCol].ReservedPatternCount( nReserved );
2043
    else
2044
        return false;
2045
}

Return to issue 123909