summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-03-14 14:00:35 +0200
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-03-15 20:11:35 +0400
commit96328945afe8f920df41741931163ba56b7b2820 (patch)
treec219f5f090e244c4d73af31427dc8db8befeb348
parenta13a9a048a5c76e874073f6738a248286b5171fa (diff)
Convert tools/table.hxx to std::map in ScEEParser class in SC module
-rw-r--r--sc/source/filter/html/htmlpars.cxx3
-rw-r--r--sc/source/filter/inc/eeparser.hxx8
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx28
3 files changed, 23 insertions, 16 deletions
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 323e1a2034b7..b9f9fb81ace9 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -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;
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index dc1daf1c77f3..9c272d026a6f 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -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; }
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 2fb048431c06..d34e135ef0b6 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -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