[Libreoffice-commits] .: sc/source
Joseph Powers
jpowers at kemper.freedesktop.org
Wed Dec 1 22:46:23 PST 2010
sc/source/filter/html/htmlpars.cxx | 24 +++++++++++-------------
sc/source/filter/inc/eeparser.hxx | 31 ++++++++++++-------------------
sc/source/filter/rtf/eeimpars.cxx | 21 ++++++++++-----------
3 files changed, 33 insertions(+), 43 deletions(-)
New commits:
commit 8984dcc9a6cf0cb2fb97f70826d2fcf8ff94968a
Author: Joseph Powers <jpowers27 at cox.net>
Date: Wed Dec 1 22:46:11 2010 -0800
Remove DECLARE_LIST( ScHTMLImageList, ScHTMLImage* ) from eeparser.hxx
This is the 1st of 2 DECLARE_LIST()s in the file.
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index cddc2de..5769454 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -1316,11 +1316,8 @@ void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
{
- if ( !pActEntry->pImageList )
- pActEntry->pImageList = new ScHTMLImageList;
- ScHTMLImageList* pIL = pActEntry->pImageList;
ScHTMLImage* pImage = new ScHTMLImage;
- pIL->Insert( pImage, LIST_APPEND );
+ pActEntry->maImageList.push_back( pImage );
const HTMLOptions* pOptions = ((HTMLParser*)pInfo->pParser)->GetOptions();
USHORT nArrLen = pOptions->Count();
for ( USHORT i = 0; i < nArrLen; i++ )
@@ -1393,11 +1390,12 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
pImage->aSize = pDefaultDev->LogicToPixel( pGraphic->GetPrefSize(),
pGraphic->GetPrefMapMode() );
}
- if ( pIL->Count() > 0 )
+ if ( pActEntry->maImageList.size() > 0 )
{
long nWidth = 0;
- for ( ScHTMLImage* pI = pIL->First(); pI; pI = pIL->Next() )
+ for ( sal_uInt32 i=0; i < pActEntry->maImageList.size(); ++i )
{
+ ScHTMLImage* pI = &pActEntry->maImageList[ i ];
if ( pI->nDir & nHorizontal )
nWidth += pI->aSize.Width() + 2 * pI->aSpace.X();
else
@@ -1406,7 +1404,7 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
if ( pActEntry->nWidth
&& (nWidth + pImage->aSize.Width() + 2 * pImage->aSpace.X()
>= pActEntry->nWidth) )
- pIL->Last()->nDir = nVertical;
+ pActEntry->maImageList.back().nDir = nVertical;
}
}
@@ -1444,7 +1442,7 @@ USHORT ScHTMLLayoutParser::GetWidthPixel( const HTMLOption* pOption )
{
if ( rOptVal.Search('*') != STRING_NOTFOUND )
{ // relativ zu was?!?
-//2do: ColArray aller relativen Werte sammeln und dann MakeCol
+ //todo: ColArray aller relativen Werte sammeln und dann MakeCol
return 0;
}
else
@@ -1622,8 +1620,8 @@ void ScHTMLLayoutParser::ProcToken( ImportInfo* pInfo )
break;
case HTML_PARABREAK_OFF:
{ // nach einem Image geht es vertikal weiter
- if ( pActEntry->pImageList && pActEntry->pImageList->Count() > 0 )
- pActEntry->pImageList->Last()->nDir = nVertical;
+ if ( pActEntry->maImageList.size() > 0 )
+ pActEntry->maImageList.back().nDir = nVertical;
}
break;
case HTML_ANCHOR_ON:
@@ -1638,7 +1636,7 @@ void ScHTMLLayoutParser::ProcToken( ImportInfo* pInfo )
break;
case HTML_BIGPRINT_ON :
{
-//2do: aktuelle Fontgroesse merken und einen groesser
+ //tpdo: aktuelle Fontgroesse merken und einen groesser
if ( IsAtBeginningOfText( pInfo ) )
pActEntry->aItemSet.Put( SvxFontHeightItem(
maFontHeights[3], 100, ATTR_FONT_HEIGHT ) );
@@ -1646,7 +1644,7 @@ void ScHTMLLayoutParser::ProcToken( ImportInfo* pInfo )
break;
case HTML_SMALLPRINT_ON :
{
-//2do: aktuelle Fontgroesse merken und einen kleiner
+ //todo: aktuelle Fontgroesse merken und einen kleiner
if ( IsAtBeginningOfText( pInfo ) )
pActEntry->aItemSet.Put( SvxFontHeightItem(
maFontHeights[0], 100, ATTR_FONT_HEIGHT ) );
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index 11937d0..d65a4d2 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -36,6 +36,7 @@
#include <svl/itemset.hxx>
#include <editeng/editdata.hxx>
#include <address.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
const sal_Char nHorizontal = 1;
const sal_Char nVertical = 2;
@@ -57,7 +58,6 @@ struct ScHTMLImage
~ScHTMLImage()
{ if ( pGraphic ) delete pGraphic; }
};
-DECLARE_LIST( ScHTMLImageList, ScHTMLImage* )
struct ScEEParseEntry
{
@@ -67,28 +67,28 @@ struct ScEEParseEntry
String* pNumStr; // HTML evtl. SDNUM String
String* pName; // HTML evtl. Anchor/RangeName
String aAltText; // HTML IMG ALT Text
- ScHTMLImageList* pImageList; // Grafiken in dieser Zelle
+ boost::ptr_vector< ScHTMLImage > maImageList; // Grafiken in dieser Zelle
SCCOL nCol; // relativ zum Beginn des Parse
SCROW nRow;
- USHORT nTab; // HTML TableInTable
- USHORT nTwips; // RTF ColAdjust etc.
+ sal_uInt16 nTab; // HTML TableInTable
+ sal_uInt16 nTwips; // RTF ColAdjust etc.
SCCOL nColOverlap; // merged cells wenn >1
SCROW nRowOverlap; // merged cells wenn >1
- USHORT nOffset; // HTML PixelOffset
- USHORT nWidth; // HTML PixelWidth
- BOOL bHasGraphic; // HTML any image loaded
+ sal_uInt16 nOffset; // HTML PixelOffset
+ sal_uInt16 nWidth; // HTML PixelWidth
+ bool bHasGraphic; // HTML any image loaded
bool bEntirePara; // TRUE = use entire paragraph, false = use selection
ScEEParseEntry( SfxItemPool* pPool ) :
aItemSet( *pPool ), pValStr( NULL ),
- pNumStr( NULL ), pName( NULL ), pImageList( NULL ),
+ pNumStr( NULL ), pName( NULL ),
nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
nColOverlap(1), nRowOverlap(1),
nOffset(0), nWidth(0), bHasGraphic(FALSE), bEntirePara(true)
{}
ScEEParseEntry( const SfxItemSet& rItemSet ) :
aItemSet( rItemSet ), pValStr( NULL ),
- pNumStr( NULL ), pName( NULL ), pImageList( NULL ),
+ pNumStr( NULL ), pName( NULL ),
nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
nColOverlap(1), nRowOverlap(1),
nOffset(0), nWidth(0), bHasGraphic(FALSE), bEntirePara(true)
@@ -101,15 +101,8 @@ struct ScEEParseEntry
delete pNumStr;
if ( pName )
delete pName;
- if ( pImageList )
- {
- for ( ScHTMLImage* pI = pImageList->First();
- pI; pI = pImageList->Next() )
- {
- delete pI;
- }
- delete pImageList;
- }
+ if ( maImageList.size() )
+ maImageList.clear();
}
};
DECLARE_LIST( ScEEParseList, ScEEParseEntry* )
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 2526e11..b4e9653 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -399,7 +399,7 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor, SvNu
mpDoc, mpEngine->GetEditTextObjectPool() ) );
delete pObject;
}
- if ( pE->pImageList )
+ if ( pE->maImageList.size() )
bHasGraphics |= GraphicSize( nCol, nRow, nTab, pE );
if ( pE->pName )
{ // Anchor Name => RangeName
@@ -454,7 +454,7 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor, SvNu
{ // Grafiken einfuegen
for ( pE = mpParser->First(); pE; pE = mpParser->Next() )
{
- if ( pE->pImageList )
+ if ( pE->maImageList.size() )
{
SCCOL nCol = pE->nCol;
SCROW nRow = pE->nRow;
@@ -468,19 +468,18 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor, SvNu
}
-BOOL ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/,
- ScEEParseEntry* pE )
+BOOL ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/, ScEEParseEntry* pE )
{
- ScHTMLImageList* pIL = pE->pImageList;
- if ( !pIL || !pIL->Count() )
+ if ( !pE->maImageList.size() )
return FALSE;
BOOL bHasGraphics = FALSE;
OutputDevice* pDefaultDev = Application::GetDefaultDevice();
long nWidth, nHeight;
nWidth = nHeight = 0;
sal_Char nDir = nHorizontal;
- for ( ScHTMLImage* pI = pIL->First(); pI; pI = pIL->Next() )
+ for ( sal_uInt32 i = 0; i < pE->maImageList.size() ; ++i )
{
+ ScHTMLImage* pI = &pE->maImageList[ i ];
if ( pI->pGraphic )
bHasGraphics = TRUE;
Size aSizePix = pI->aSize;
@@ -536,8 +535,7 @@ BOOL ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/,
void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab,
ScEEParseEntry* pE )
{
- ScHTMLImageList* pIL = pE->pImageList;
- if ( !pIL || !pIL->Count() )
+ if ( !pE->maImageList.size() )
return ;
ScDrawLayer* pModel = mpDoc->GetDrawLayer();
if (!pModel)
@@ -556,8 +554,9 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab,
Point aSpace;
Size aLogicSize;
sal_Char nDir = nHorizontal;
- for ( ScHTMLImage* pI = pIL->First(); pI; pI = pIL->Next() )
+ for ( sal_uInt32 i = 0; i < pE->maImageList.size(); ++i )
{
+ ScHTMLImage* pI = &pE->maImageList[ i ];
if ( nDir & nHorizontal )
{ // horizontal
aInsertPos.X() += aLogicSize.Width();
More information about the Libreoffice-commits
mailing list