[Libreoffice-commits] .: sc/source

Joseph Powers jpowers at kemper.freedesktop.org
Sat Dec 4 20:19:05 PST 2010


 sc/source/filter/html/htmlexp.cxx  |   47 +++++++++----------------------------
 sc/source/filter/html/htmlexp2.cxx |   12 ++++-----
 sc/source/filter/inc/htmlexp.hxx   |    6 ++--
 3 files changed, 21 insertions(+), 44 deletions(-)

New commits:
commit 1a0e4b8dc79e349ef3d5c7bfbcad26b262885b95
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat Dec 4 20:18:57 2010 -0800

    Remove DECLARE_LIST( ScHTMLGraphList, ScHTMLGraphEntry* )

diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index bf12e7b..7b13e23 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.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
@@ -214,26 +214,6 @@ void lcl_AppendHTMLColorTripel( ByteString& rStr, const Color& rColor )
     rStr += '\"';
 }
 
-
-/*void lcl_TagOn( String& rResult, const String& rTag, const String* pStrOpt )
-{
-    rResult  = '<';
-    rResult += rTag;
-    if ( pStrOpt )
-    {
-        rResult += ' ';
-        rResult += *pStrOpt;
-    }
-    rResult += '>';
-}
-*/
-
-/*void lcl_TagOff( String& rResult, const String& rTag )
-{
-    rResult = '<'; rResult += rTag; rResult += '>';
-}
-*/
-
 //////////////////////////////////////////////////////////////////////////////
 
 ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument* pDocP,
@@ -293,8 +273,7 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument
 
 ScHTMLExport::~ScHTMLExport()
 {
-    for ( ScHTMLGraphEntry* pE = aGraphList.First(); pE; pE = aGraphList.Next() )
-        delete pE;
+    aGraphList.clear();
     delete pSrcArr;
     delete pDestArr;
 }
@@ -705,7 +684,6 @@ void ScHTMLExport::WriteTables()
 
         // <TABLE ...>
         ByteString	aByteStrOut = OOO_STRING_SVTOOLS_HTML_table;
-//		aStrOut  = OOO_STRING_SVTOOLS_HTML_table;
 
         // FRAME=VOID, we do the styling of the cells in <TD>
         (((aByteStrOut += ' ') += OOO_STRING_SVTOOLS_HTML_frame) += '=') += OOO_STRING_SVTOOLS_HTML_TF_void;
@@ -798,13 +776,14 @@ void ScHTMLExport::WriteTables()
         if ( bTabHasGraphics )
         {
             // the rest that is not in a cell
-            for ( ScHTMLGraphEntry* pE = aGraphList.First(); pE; pE = aGraphList.Next() )
+            size_t ListSize = aGraphList.size();
+            for ( size_t i = 0; i < ListSize; ++i )
             {
+                ScHTMLGraphEntry* pE = &aGraphList[ i ];
                 if ( !pE->bWritten )
                     WriteGraphEntry( pE );
-                delete pE;
             }
-            aGraphList.Clear();
+            aGraphList.clear();
             if ( bTabAlignedLeft )
             {	// clear <TABLE ALIGN=LEFT> with <BR CLEAR=LEFT>
                 aByteStrOut = OOO_STRING_SVTOOLS_HTML_linebreak;
@@ -832,9 +811,10 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
     ScHTMLGraphEntry* pGraphEntry = NULL;
     if ( bTabHasGraphics )
     {
-        for ( pGraphEntry = aGraphList.First();	pGraphEntry;
-              pGraphEntry = aGraphList.Next() )
+        size_t ListSize = aGraphList.size();
+        for ( size_t i = 0; i < ListSize; ++i )
         {
+            pGraphEntry = &aGraphList[ i ];
             if ( pGraphEntry->bInCell && pGraphEntry->aRange.In( aPos ) )
             {
                 if ( pGraphEntry->aRange.aStart == aPos )
@@ -996,10 +976,10 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
             break;
         case SVX_HOR_JUSTIFY_CENTER:	pChar = OOO_STRING_SVTOOLS_HTML_AL_center;	break;
         case SVX_HOR_JUSTIFY_BLOCK:		pChar = OOO_STRING_SVTOOLS_HTML_AL_justify;	break;
-        case SVX_HOR_JUSTIFY_RIGHT:		pChar = OOO_STRING_SVTOOLS_HTML_AL_right;		break;
+        case SVX_HOR_JUSTIFY_RIGHT:		pChar = OOO_STRING_SVTOOLS_HTML_AL_right;   break;
         case SVX_HOR_JUSTIFY_LEFT:
         case SVX_HOR_JUSTIFY_REPEAT:
-        default:						pChar = OOO_STRING_SVTOOLS_HTML_AL_left;		break;
+        default:						pChar = OOO_STRING_SVTOOLS_HTML_AL_left;    break;
     }
 
     (((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '=') += pChar;
@@ -1144,7 +1124,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
                     OUT_STR( aSingleLine );
                     TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak );
                     nStartPos = nPos + 1;
-                } 
+                }
                 while( ( nPos = aStrOut.Search( _LF, nStartPos ) ) != STRING_NOTFOUND );
                 String aSingleLine( aStrOut, nStartPos, aStrOut.Len() - nStartPos );
                 OUT_STR( aSingleLine );
@@ -1278,9 +1258,6 @@ BOOL ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
             SfxMedium aMedium( *pDest, STREAM_WRITE | STREAM_SHARE_DENYNONE,
                                 FALSE );
 
-            // temp. File anlegen
-    //		aMedium.DownLoad();
-
             {
                 SvFileStream aCpy( aMedium.GetPhysicalName(), STREAM_WRITE );
                 aCpy << aTmp;
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index 6b21a40..50f8eaa 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.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
@@ -66,11 +66,11 @@ void ScHTMLExport::PrepareGraphics( ScDrawLayer* pDrawLayer, SCTAB nTab,
         if ( pDrawPage )
         {
             bTabHasGraphics = TRUE;
-            FillGraphList( pDrawPage, nTab,
-                nStartCol, nStartRow, nEndCol, nEndRow );
-            for ( ScHTMLGraphEntry* pE = aGraphList.First(); pE;
-                    pE = aGraphList.Next() )
+            FillGraphList( pDrawPage, nTab, nStartCol, nStartRow, nEndCol, nEndRow );
+            size_t ListSize = aGraphList.size();
+            for ( size_t i = 0; i < ListSize; ++i )
             {
+                ScHTMLGraphEntry* pE = &aGraphList[ i ];
                 if ( !pE->bInCell )
                 {	// nicht alle in Zellen: einige neben Tabelle
                     bTabAlignedLeft = TRUE;
@@ -127,7 +127,7 @@ void ScHTMLExport::FillGraphList( const SdrPage* pPage, SCTAB nTab,
                 }
                 ScHTMLGraphEntry* pE = new ScHTMLGraphEntry( pObject,
                     aR, aSize, bInCell, aSpace );
-                aGraphList.Insert( pE, LIST_APPEND );
+                aGraphList.push_back( pE );
             }
             pObject = aIter.Next();
         }
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index 3cc00e3..00f7301 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.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
@@ -33,6 +33,7 @@
 #include <rtl/textenc.h>
 #include <tools/gen.hxx>
 #include <tools/color.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
 
 #include "expbase.hxx"
 
@@ -87,7 +88,6 @@ struct ScHTMLGraphEntry
         pObject( pObj ), bInCell( bIn ), bWritten( FALSE ) {}
 };
 
-DECLARE_LIST( ScHTMLGraphList, ScHTMLGraphEntry* )
 
 #define SC_HTML_FONTSIZES 7
 const short nIndentMax = 23;
@@ -102,7 +102,7 @@ class ScHTMLExport : public ScExportBase
     static const USHORT	nCellSpacing;
     static const sal_Char __FAR_DATA sIndentSource[];
 
-    ScHTMLGraphList		aGraphList;
+    boost::ptr_vector< ScHTMLGraphEntry > aGraphList;
     ScHTMLStyle			aHTMLStyle;
     String              aBaseURL;
     String				aStreamPath;


More information about the Libreoffice-commits mailing list