Kaydet (Commit) 96328945 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Ivan Timofeev

Convert tools/table.hxx to std::map in ScEEParser class in SC module

üst a13a9a04
......@@ -58,6 +58,7 @@
#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
#include <tools/tenccvt.hxx>
#include <tools/table.hxx>
#include "htmlpars.hxx"
#include "global.hxx"
......@@ -331,7 +332,7 @@ sal_uLong ScHTMLLayoutParser::Read( SvStream& rStream, const String& rBaseURL )
{
aSize.Width() = *pOff - nOff;
aSize = pDefaultDev->PixelToLogic( aSize, MapMode( MAP_TWIP ) );
pColWidths->Insert( j-1, (void*)aSize.Width() );
maColWidths[ j-1 ] = aSize.Width();
nOff = *pOff;
}
return nErr;
......
......@@ -32,7 +32,6 @@
#include <tools/string.hxx>
#include <tools/gen.hxx>
#include <vcl/graph.hxx>
#include <tools/table.hxx>
#include <svl/itemset.hxx>
#include <editeng/editdata.hxx>
#include <address.hxx>
......@@ -108,6 +107,8 @@ struct ScEEParseEntry
class EditEngine;
typedef std::map<SCCOL, sal_uInt16> ColWidthsMap;
class ScEEParser
{
protected:
......@@ -116,7 +117,7 @@ protected:
SfxItemPool* pDocPool;
::std::vector< ScEEParseEntry* > maList;
ScEEParseEntry* pActEntry;
Table* pColWidths;
ColWidthsMap maColWidths;
int nLastToken;
SCCOL nColCnt;
SCROW nRowCnt;
......@@ -131,7 +132,8 @@ public:
virtual sal_uLong Read( SvStream&, const String& rBaseURL ) = 0;
Table* GetColWidths() const { return pColWidths; }
const ColWidthsMap& GetColWidths() const { return maColWidths; }
ColWidthsMap& GetColWidths() { return maColWidths; }
void GetDimensions( SCCOL& nCols, SCROW& nRows ) const
{ nCols = nColMax; nRows = nRowMax; }
......
......@@ -52,6 +52,7 @@
#include <unotools/syslocale.hxx>
#include <unotools/charclass.hxx>
#include <comphelper/string.hxx>
#include <tools/table.hxx>
#include "eeimport.hxx"
#include "global.hxx"
......@@ -431,14 +432,17 @@ void ScEEImport::WriteToDocument( sal_Bool bSizeColsRows, double nOutputFactor,
if ( bSizeColsRows )
{
// Spaltenbreiten
Table* pColWidths = mpParser->GetColWidths();
if ( pColWidths->Count() )
ColWidthsMap& rColWidths = mpParser->GetColWidths();
if ( !rColWidths.empty() )
{
nProgress = 0;
pProgress->SetState( nProgress, nEndCol - nStartCol + 1 );
for ( SCCOL nCol = nStartCol; nCol <= nEndCol; nCol++ )
{
sal_uInt16 nWidth = (sal_uInt16)(sal_uLong) pColWidths->Get( nCol );
sal_uInt16 nWidth = 0;
ColWidthsMap::const_iterator it = rColWidths.find( nCol );
if ( it != rColWidths.end() )
nWidth = it->second;
if ( nWidth )
mpDoc->SetColWidth( nCol, nTab, nWidth );
pProgress->SetState( ++nProgress );
......@@ -513,20 +517,22 @@ sal_Bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/, ScEEPa
nDir = pI->nDir;
}
// Spaltenbreiten
Table* pColWidths = mpParser->GetColWidths();
long nThisWidth = (long) pColWidths->Get( nCol );
ColWidthsMap& rColWidths = mpParser->GetColWidths();
long nThisWidth = 0;
ColWidthsMap::const_iterator it = rColWidths.find( nCol );
if ( it != rColWidths.end() )
nThisWidth = it->second;
long nColWidths = nThisWidth;
SCCOL nColSpanCol = nCol + pE->nColOverlap;
for ( SCCOL nC = nCol + 1; nC < nColSpanCol; nC++ )
{
nColWidths += (long) pColWidths->Get( nC );
ColWidthsMap::const_iterator it2 = rColWidths.find( nC );
if ( it2 != rColWidths.end() )
nColWidths += it2->second;
}
if ( nWidth > nColWidths )
{ // Differenz nur in der ersten Spalte eintragen
if ( nThisWidth )
pColWidths->Replace( nCol, (void*)(nWidth - nColWidths + nThisWidth) );
else
pColWidths->Insert( nCol, (void*)(nWidth - nColWidths) );
rColWidths[ nCol ] = nWidth - nColWidths + nThisWidth;
}
// Zeilenhoehen, Differenz auf alle betroffenen Zeilen verteilen
SCROW nRowSpan = pE->nRowOverlap;
......@@ -619,7 +625,6 @@ ScEEParser::ScEEParser( EditEngine* pEditP ) :
pEdit( pEditP ),
pPool( EditEngine::CreatePool() ),
pDocPool( new ScDocumentPool ),
pColWidths( new Table ),
nLastToken(0),
nColCnt(0),
nRowCnt(0),
......@@ -636,7 +641,6 @@ ScEEParser::ScEEParser( EditEngine* pEditP ) :
ScEEParser::~ScEEParser()
{
delete pActEntry;
delete pColWidths;
if ( !maList.empty() ) maList.clear();
// Pool erst loeschen nachdem die Listen geloescht wurden
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment