Kaydet (Commit) 157b2fa6 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Fridrich Štrba

Convert tools/table.hxx usage to std::map in ScEEImport class

üst 000bb6af
...@@ -32,15 +32,17 @@ ...@@ -32,15 +32,17 @@
#include "address.hxx" #include "address.hxx"
#include "filter.hxx" #include "filter.hxx"
#include "scdllapi.h" #include "scdllapi.h"
#include <map>
class ScDocument; class ScDocument;
class ScEEParser; class ScEEParser;
class ScTabEditEngine; class ScTabEditEngine;
class SvStream; class SvStream;
class Table;
struct ScEEParseEntry; struct ScEEParseEntry;
typedef std::map<SCROW, long> RowHeightMap;
class ScEEImport : public ScEEAbsImport class ScEEImport : public ScEEAbsImport
{ {
protected: protected:
...@@ -48,7 +50,7 @@ protected: ...@@ -48,7 +50,7 @@ protected:
ScDocument* mpDoc; ScDocument* mpDoc;
ScEEParser* mpParser; ScEEParser* mpParser;
ScTabEditEngine* mpEngine; ScTabEditEngine* mpEngine;
Table* mpRowHeights; RowHeightMap maRowHeights;
sal_Bool GraphicSize( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool GraphicSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
ScEEParseEntry* ); ScEEParseEntry* );
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "rangelst.hxx" #include "rangelst.hxx"
#include "eeparser.hxx" #include "eeparser.hxx"
#include "tools/table.hxx"
const sal_uInt32 SC_HTML_FONTSIZES = 7; // wie Export, HTML-Options const sal_uInt32 SC_HTML_FONTSIZES = 7; // wie Export, HTML-Options
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include <unotools/syslocale.hxx> #include <unotools/syslocale.hxx>
#include <unotools/charclass.hxx> #include <unotools/charclass.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <tools/table.hxx>
#include "eeimport.hxx" #include "eeimport.hxx"
#include "global.hxx" #include "global.hxx"
...@@ -79,8 +78,7 @@ extern void ScLimitSizeOnDrawPage( Size& rSize, Point& rPos, const Size& rPage ) ...@@ -79,8 +78,7 @@ extern void ScLimitSizeOnDrawPage( Size& rSize, Point& rPos, const Size& rPage )
ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) : ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) :
maRange( rRange ), maRange( rRange ),
mpDoc( pDocP ), mpDoc( pDocP ),
mpParser( NULL ), mpParser( NULL )
mpRowHeights( new Table )
{ {
const ScPatternAttr* pPattern = mpDoc->GetPattern( const ScPatternAttr* pPattern = mpDoc->GetPattern(
maRange.aStart.Col(), maRange.aStart.Row(), maRange.aStart.Tab() ); maRange.aStart.Col(), maRange.aStart.Row(), maRange.aStart.Tab() );
...@@ -95,7 +93,6 @@ ScEEImport::~ScEEImport() ...@@ -95,7 +93,6 @@ ScEEImport::~ScEEImport()
// Reihenfolge wichtig, sonst knallt's irgendwann irgendwo in irgendeinem Dtor! // Reihenfolge wichtig, sonst knallt's irgendwann irgendwo in irgendeinem Dtor!
// Ist gewaehrleistet, da ScEEImport Basisklasse ist // Ist gewaehrleistet, da ScEEImport Basisklasse ist
delete mpEngine; // nach Parser! delete mpEngine; // nach Parser!
delete mpRowHeights;
} }
...@@ -458,11 +455,12 @@ void ScEEImport::WriteToDocument( sal_Bool bSizeColsRows, double nOutputFactor, ...@@ -458,11 +455,12 @@ void ScEEImport::WriteToDocument( sal_Bool bSizeColsRows, double nOutputFactor,
mpDoc->SetOptimalHeight( 0, nEndRow, 0, mpDoc->SetOptimalHeight( 0, nEndRow, 0,
static_cast< sal_uInt16 >( ScGlobal::nLastRowHeightExtra ), &aVirtDev, static_cast< sal_uInt16 >( ScGlobal::nLastRowHeightExtra ), &aVirtDev,
nPPTX, nPPTY, aZoom, aZoom, false ); nPPTX, nPPTY, aZoom, aZoom, false );
if ( mpRowHeights->Count() ) if ( !maRowHeights.empty() )
{ {
for ( SCROW nRow = nStartRow; nRow <= nEndRow; nRow++ ) for ( SCROW nRow = nStartRow; nRow <= nEndRow; nRow++ )
{ {
sal_uInt16 nHeight = (sal_uInt16)(sal_uLong) mpRowHeights->Get( nRow ); RowHeightMap::const_iterator it = maRowHeights.find( nRow );
sal_uInt16 nHeight = it == maRowHeights.end() ? 0 : it->second;
if ( nHeight > mpDoc->GetRowHeight( nRow, nTab ) ) if ( nHeight > mpDoc->GetRowHeight( nRow, nTab ) )
mpDoc->SetRowHeight( nRow, nTab, nHeight ); mpDoc->SetRowHeight( nRow, nTab, nHeight );
} }
...@@ -541,13 +539,11 @@ sal_Bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/, ScEEPa ...@@ -541,13 +539,11 @@ sal_Bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/, ScEEPa
nHeight = 1; // fuer eindeutigen Vergleich nHeight = 1; // fuer eindeutigen Vergleich
for ( SCROW nR = nRow; nR < nRow + nRowSpan; nR++ ) for ( SCROW nR = nRow; nR < nRow + nRowSpan; nR++ )
{ {
long nRowHeight = (long) mpRowHeights->Get( nR ); RowHeightMap::const_iterator it2 = maRowHeights.find( nR );
long nRowHeight = it2 == maRowHeights.end() ? 0 : it2->second;
if ( nHeight > nRowHeight ) if ( nHeight > nRowHeight )
{ {
if ( nRowHeight ) maRowHeights[ nR ] = nHeight;
mpRowHeights->Replace( nR, (void*)nHeight );
else
mpRowHeights->Insert( nR, (void*)nHeight );
} }
} }
return bHasGraphics; return bHasGraphics;
......
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