[Libreoffice-commits] .: 6 commits - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Aug 3 21:25:42 PDT 2011


 sc/source/filter/html/htmlpars.cxx |  168 +++++++++++++------------------------
 sc/source/filter/inc/eeparser.hxx  |   78 ++++++++---------
 sc/source/filter/rtf/eeimpars.cxx  |    6 -
 3 files changed, 104 insertions(+), 148 deletions(-)

New commits:
commit 2fe8d81ba4326c7f71e2099b70db95fc9a4f471f
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 4 00:25:48 2011 -0400

    More String removal etc.

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 3c8d661..9b1a3ba 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1401,7 +1401,7 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
             break;
         }
     }
-    if ( !pImage->aURL.Len() )
+    if (pImage->aURL.isEmpty())
     {
         OSL_FAIL( "Image: Grafik ohne URL ?!?" );
         return ;
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index a5a80e1..c90813b 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -45,19 +45,19 @@ const sal_Char nHoriVerti = nHorizontal | nVertical;
 
 struct ScHTMLImage
 {
-    String				aURL;
+    rtl::OUString       aURL;
     Size				aSize;
     Point				aSpace;
-    String				aFilterName;
+    rtl::OUString       aFilterName;
     Graphic*			pGraphic;	    // wird von WriteToDocument uebernommen
     sal_Char			nDir;			// 1==hori, 2==verti, 3==beides
 
-                        ScHTMLImage() :
-                            aSize( 0, 0 ), aSpace( 0, 0 ), pGraphic( NULL ),
-                            nDir( nHorizontal )
-                            {}
-                        ~ScHTMLImage()
-                            { if ( pGraphic ) delete pGraphic; }
+    ScHTMLImage() :
+        aSize( 0, 0 ), aSpace( 0, 0 ), pGraphic( NULL ),
+        nDir( nHorizontal )
+        {}
+
+    ~ScHTMLImage() { delete pGraphic; }
 };
 
 struct ScEEParseEntry
commit 7cf28a714e23df14654548c1d82d62515ee1a116
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 4 00:20:56 2011 -0400

    Indentation "fix".

diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index 7c444f0..a5a80e1 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -80,27 +80,29 @@ struct ScEEParseEntry
     bool                bHasGraphic:1;	// HTML any image loaded
     bool                bEntirePara:1;  // true = use entire paragraph, false = use selection
 
-                        ScEEParseEntry( SfxItemPool* pPool ) :
-                            aItemSet( *pPool ), pValStr( 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 ),
-                            nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
-                            nColOverlap(1), nRowOverlap(1),
-                            nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
-                            {}
-                        ~ScEEParseEntry()
-                            {
-                                delete pValStr;
-                                delete pNumStr;
-                                delete pName;
-                                maImageList.clear();
-                            }
+    ScEEParseEntry( SfxItemPool* pPool ) :
+        aItemSet( *pPool ), pValStr( 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 ),
+        nCol(SCCOL_MAX), nRow(SCROW_MAX), nTab(0),
+        nColOverlap(1), nRowOverlap(1),
+        nOffset(0), nWidth(0), bHasGraphic(false), bEntirePara(true)
+        {}
+
+    ~ScEEParseEntry()
+    {
+        delete pValStr;
+        delete pNumStr;
+        delete pName;
+        maImageList.clear();
+    }
 };
 
 
commit 941640dc5a6813819ba69704e609f6c3ab0a64e4
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 4 00:20:06 2011 -0400

    Removed unnecessary condition checks.

diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index 6e73bfc..7c444f0 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -96,14 +96,10 @@ struct ScEEParseEntry
                             {}
                         ~ScEEParseEntry()
                             {
-                                if ( pValStr )
-                                    delete pValStr;
-                                if ( pNumStr )
-                                    delete pNumStr;
-                                if ( pName )
-                                    delete pName;
-                                if ( maImageList.size() )
-                                    maImageList.clear();
+                                delete pValStr;
+                                delete pNumStr;
+                                delete pName;
+                                maImageList.clear();
                             }
 };
 
commit 46536c6c30f2d69df69ebcc92b7d2837c99c3371
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 4 00:19:19 2011 -0400

    String to rtl::OUString.

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index b41dbaa..3c8d661 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1038,12 +1038,12 @@ void ScHTMLLayoutParser::TableDataOn( ImportInfo* pInfo )
             break;
             case HTML_O_SDVAL:
             {
-                pActEntry->pValStr = new String( rOption.GetString() );
+                pActEntry->pValStr = new rtl::OUString( rOption.GetString() );
             }
             break;
             case HTML_O_SDNUM:
             {
-                pActEntry->pNumStr = new String( rOption.GetString() );
+                pActEntry->pNumStr = new rtl::OUString( rOption.GetString() );
             }
             break;
         }
@@ -1372,8 +1372,9 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
             {
                 if ( !pActEntry->bHasGraphic )
                 {   // ALT text only if not any image loaded
-                    if ( pActEntry->aAltText.Len() )
-                        pActEntry->aAltText.AppendAscii( "; " );
+                    if (!pActEntry->aAltText.isEmpty())
+                        pActEntry->aAltText += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("; "));
+
                     pActEntry->aAltText += rOption.GetString();
                 }
             }
@@ -1418,7 +1419,7 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
     if ( !pActEntry->bHasGraphic )
     {   // discard any ALT text in this cell if we have any image
         pActEntry->bHasGraphic = sal_True;
-        pActEntry->aAltText.Erase();
+        pActEntry->aAltText = rtl::OUString();
     }
     pImage->aFilterName = rFilter.GetImportFormatName( nFormat );
     pImage->pGraphic = pGraphic;
@@ -1498,7 +1499,7 @@ void ScHTMLLayoutParser::AnchorOn( ImportInfo* pInfo )
         {
             case HTML_O_NAME:
             {
-                pActEntry->pName = new String( rOption.GetString() );
+                pActEntry->pName = new rtl::OUString(rOption.GetString());
             }
             break;
         }
@@ -1759,7 +1760,7 @@ ScHTMLEntry::ScHTMLEntry( const SfxItemSet& rItemSet, ScHTMLTableId nTableId ) :
 
 bool ScHTMLEntry::HasContents() const
 {
-     return mbImportAlways || aSel.HasRange() || aAltText.Len() || IsTable();
+     return mbImportAlways || aSel.HasRange() || !aAltText.isEmpty() || IsTable();
 }
 
 void ScHTMLEntry::AdjustStart( const ImportInfo& rInfo )
@@ -2180,7 +2181,7 @@ void ScHTMLTable::DataOn( const ImportInfo& rInfo )
     {
         // read needed options from the <td> tag
         ScHTMLSize aSpanSize( 1, 1 );
-        ::std::auto_ptr< String > pValStr, pNumStr;
+        ::std::auto_ptr<rtl::OUString> pValStr, pNumStr;
         const HTMLOptions& rOptions = static_cast<HTMLParser*>(rInfo.pParser)->GetOptions();
         HTMLOptions::const_iterator itr = rOptions.begin(), itrEnd = rOptions.end();
         sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
@@ -2195,10 +2196,10 @@ void ScHTMLTable::DataOn( const ImportInfo& rInfo )
                     aSpanSize.mnRows = static_cast<SCROW>( getLimitedValue<sal_Int32>( itr->GetString().ToInt32(), 1, 256 ) );
                 break;
                 case HTML_O_SDVAL:
-                    pValStr.reset( new String( itr->GetString() ) );
+                    pValStr.reset(new rtl::OUString(itr->GetString()));
                 break;
                 case HTML_O_SDNUM:
-                    pNumStr.reset( new String( itr->GetString() ) );
+                    pNumStr.reset(new rtl::OUString(itr->GetString()));
                 break;
                 case HTML_O_CLASS:
                 {
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index ee814c5..6e73bfc 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -64,10 +64,10 @@ struct ScEEParseEntry
 {
     SfxItemSet			aItemSet;
     ESelection			aSel;			// Selection in EditEngine
-    String*				pValStr;		// HTML evtl. SDVAL String
-    String*				pNumStr;		// HTML evtl. SDNUM String
-    String*				pName;			// HTML evtl. Anchor/RangeName
-    String				aAltText;		// HTML IMG ALT Text
+    rtl::OUString*      pValStr;        // HTML evtl. SDVAL String
+    rtl::OUString*      pNumStr;        // HTML evtl. SDNUM String
+    rtl::OUString*      pName;          // HTML evtl. Anchor/RangeName
+    rtl::OUString       aAltText;       // HTML IMG ALT Text
     boost::ptr_vector< ScHTMLImage > maImageList;		// Grafiken in dieser Zelle
     SCCOL				nCol;			// relativ zum Beginn des Parse
     SCROW				nRow;
@@ -77,8 +77,8 @@ struct ScEEParseEntry
     SCROW				nRowOverlap;	// merged cells wenn >1
     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
+    bool                bHasGraphic:1;	// HTML any image loaded
+    bool                bEntirePara:1;  // true = use entire paragraph, false = use selection
 
                         ScEEParseEntry( SfxItemPool* pPool ) :
                             aItemSet( *pPool ), pValStr( NULL ),
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 933e54c..a0da351 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -218,7 +218,7 @@ void ScEEImport::WriteToDocument( sal_Bool bSizeColsRows, double nOutputFactor,
             }
 
             // HTML
-            String aValStr, aNumStr;
+            rtl::OUString aValStr, aNumStr;
             double fVal;
             sal_uInt32 nNumForm = 0;
             LanguageType eNumLang = LANGUAGE_NONE;
@@ -235,7 +235,7 @@ void ScEEImport::WriteToDocument( sal_Bool bSizeColsRows, double nOutputFactor,
             ScPatternAttr aAttr( pDocPool );
             aAttr.GetFromEditItemSet( &aSet );
             SfxItemSet& rSet = aAttr.GetItemSet();
-            if ( aNumStr.Len() )
+            if (!aNumStr.isEmpty())
             {
                 rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumForm ) );
                 rSet.Put( SvxLanguageItem( eNumLang, ATTR_LANGUAGE_FORMAT ) );
@@ -341,7 +341,7 @@ void ScEEImport::WriteToDocument( sal_Bool bSizeColsRows, double nOutputFactor,
                 aParam.mbDetectNumberFormat = true;
                 aParam.mbSetTextCellFormat = true;
 
-                if ( aValStr.Len() )
+                if (!aValStr.isEmpty())
                     mpDoc->SetValue( nCol, nRow, nTab, fVal );
                 else if ( !pE->aSel.HasRange() )
                 {
commit 0c9ccfc5f805fc896ef7bf6c7eeb53d296299f85
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 4 00:10:02 2011 -0400

    Removed custom html options iterator class; use the real iterators.

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 33fc92b..b41dbaa 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1749,52 +1749,6 @@ template< typename Type >
 inline Type getLimitedValue( const Type& rValue, const Type& rMin, const Type& rMax )
 { return ::std::max( ::std::min( rValue, rMax ), rMin ); }
 
-// ============================================================================
-
-/** Iterates through all HTML tag options of the passed ImportInfo struct. */
-class ScHTMLOptionIterator
-{
-private:
-    const HTMLOptions*  mpOptions;      /// The options array.
-    const HTMLOption*   mpCurrOption;   /// Current option.
-    size_t              mnCount;        /// Size of the options array.
-    size_t              mnIndex;        /// Next option to return.
-
-public:
-    explicit            ScHTMLOptionIterator( const ImportInfo& rInfo );
-
-    inline bool         is() const { return mnIndex < mnCount; }
-    inline const HTMLOption* operator->() const { return mpCurrOption; }
-    inline const HTMLOption& operator*() const { return *mpCurrOption; }
-    ScHTMLOptionIterator& operator++();
-};
-
-// ----------------------------------------------------------------------------
-
-ScHTMLOptionIterator::ScHTMLOptionIterator( const ImportInfo& rInfo ) :
-    mpOptions( 0 ),
-    mpCurrOption( 0 ),
-    mnCount( 0 ),
-    mnIndex( 0 )
-{
-    const HTMLParser* pParser = static_cast< const HTMLParser* >( rInfo.pParser );
-    if( pParser )
-        mpOptions = &pParser->GetOptions();
-    if( mpOptions )
-        mnCount = mpOptions->size();
-    if( mnCount )
-        mpCurrOption = &mpOptions->front();
-}
-
-ScHTMLOptionIterator& ScHTMLOptionIterator::operator++()
-{
-    if( mnIndex < mnCount ) ++mnIndex;
-    mpCurrOption = (mnIndex < mnCount) ? &(*mpOptions)[mnIndex] : 0;
-    return *this;
-}
-
-// ============================================================================
-
 ScHTMLEntry::ScHTMLEntry( const SfxItemSet& rItemSet, ScHTMLTableId nTableId ) :
     ScEEParseEntry( rItemSet ),
     mbImportAlways( false )
@@ -2007,15 +1961,17 @@ ScHTMLTable::ScHTMLTable( ScHTMLTable& rParentTable, const ImportInfo& rInfo, bo
     else
     {
         ProcessFormatOptions( maTableItemSet, rInfo );
-        for( ScHTMLOptionIterator aIter( rInfo ); aIter.is(); ++aIter )
+        const HTMLOptions& rOptions = static_cast<HTMLParser*>(rInfo.pParser)->GetOptions();
+        HTMLOptions::const_iterator itr = rOptions.begin(), itrEnd = rOptions.end();
+        for (; itr != itrEnd; ++itr)
         {
-            switch( aIter->GetToken() )
+            switch( itr->GetToken() )
             {
                 case HTML_O_BORDER:
-                    mbBorderOn = ((aIter->GetString().Len() == 0) || (aIter->GetNumber() != 0));
+                    mbBorderOn = ((itr->GetString().Len() == 0) || (itr->GetNumber() != 0));
                 break;
                 case HTML_O_ID:
-                    maTableName = aIter->GetString();
+                    maTableName = itr->GetString();
                 break;
             }
         }
@@ -2640,14 +2596,16 @@ void ScHTMLTable::ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo&
         rItemSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
     }
 
-    for( ScHTMLOptionIterator aIter( rInfo ); aIter.is(); ++aIter )
+    const HTMLOptions& rOptions = static_cast<HTMLParser*>(rInfo.pParser)->GetOptions();
+    HTMLOptions::const_iterator itr = rOptions.begin(), itrEnd = rOptions.end();
+    for (; itr != itrEnd; ++itr)
     {
-        switch( aIter->GetToken() )
+        switch( itr->GetToken() )
         {
             case HTML_O_ALIGN:
             {
                 SvxCellHorJustify eVal = SVX_HOR_JUSTIFY_STANDARD;
-                const String& rOptVal = aIter->GetString();
+                const String& rOptVal = itr->GetString();
                 if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_right ) )
                     eVal = SVX_HOR_JUSTIFY_RIGHT;
                 else if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_center ) )
@@ -2662,7 +2620,7 @@ void ScHTMLTable::ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo&
             case HTML_O_VALIGN:
             {
                 SvxCellVerJustify eVal = SVX_VER_JUSTIFY_STANDARD;
-                const String& rOptVal = aIter->GetString();
+                const String& rOptVal = itr->GetString();
                 if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_VA_top ) )
                     eVal = SVX_VER_JUSTIFY_TOP;
                 else if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_VA_middle ) )
@@ -2677,7 +2635,7 @@ void ScHTMLTable::ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo&
             case HTML_O_BGCOLOR:
             {
                 Color aColor;
-                aIter->GetColor( aColor );
+                itr->GetColor( aColor );
                 rItemSet.Put( SvxBrushItem( aColor, ATTR_BACKGROUND ) );
             }
             break;
@@ -3068,13 +3026,15 @@ void ScHTMLQueryParser::InsertText( const ImportInfo& rInfo )
 
 void ScHTMLQueryParser::FontOn( const ImportInfo& rInfo )
 {
-    for( ScHTMLOptionIterator aIter( rInfo ); aIter.is(); ++aIter )
+    const HTMLOptions& rOptions = static_cast<HTMLParser*>(rInfo.pParser)->GetOptions();
+    HTMLOptions::const_iterator itr = rOptions.begin(), itrEnd = rOptions.end();
+    for (; itr != itrEnd; ++itr)
     {
-        switch( aIter->GetToken() )
+        switch( itr->GetToken() )
         {
             case HTML_O_FACE :
             {
-                const String& rFace = aIter->GetString();
+                const String& rFace = itr->GetString();
                 String aFontName;
                 xub_StrLen nPos = 0;
                 while( nPos != STRING_NOTFOUND )
@@ -3092,14 +3052,14 @@ void ScHTMLQueryParser::FontOn( const ImportInfo& rInfo )
             break;
             case HTML_O_SIZE :
             {
-                sal_uInt32 nSize = getLimitedValue< sal_uInt32 >( aIter->GetNumber(), 1, SC_HTML_FONTSIZES );
+                sal_uInt32 nSize = getLimitedValue< sal_uInt32 >( itr->GetNumber(), 1, SC_HTML_FONTSIZES );
                 mpCurrTable->PutItem( SvxFontHeightItem( maFontHeights[ nSize - 1 ], 100, ATTR_FONT_HEIGHT ) );
             }
             break;
             case HTML_O_COLOR :
             {
                 Color aColor;
-                aIter->GetColor( aColor );
+                itr->GetColor( aColor );
                 mpCurrTable->PutItem( SvxColorItem( aColor, ATTR_FONT_COLOR ) );
             }
             break;
commit ad335d40b8c19f22a5d6795d9dc68bb6bbd128f7
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 4 00:05:26 2011 -0400

    Combined two html option loops.

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 18bf94a..33fc92b 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2225,57 +2225,54 @@ void ScHTMLTable::DataOn( const ImportInfo& rInfo )
         // read needed options from the <td> tag
         ScHTMLSize aSpanSize( 1, 1 );
         ::std::auto_ptr< String > pValStr, pNumStr;
-        for( ScHTMLOptionIterator aIter( rInfo ); aIter.is(); ++aIter )
+        const HTMLOptions& rOptions = static_cast<HTMLParser*>(rInfo.pParser)->GetOptions();
+        HTMLOptions::const_iterator itr = rOptions.begin(), itrEnd = rOptions.end();
+        sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
+        for (; itr != itrEnd; ++itr)
         {
-            switch( aIter->GetToken() )
+            switch (itr->GetToken())
             {
                 case HTML_O_COLSPAN:
-                    aSpanSize.mnCols = static_cast< SCCOL >( getLimitedValue< sal_Int32 >( aIter->GetString().ToInt32(), 1, 256 ) );
+                    aSpanSize.mnCols = static_cast<SCCOL>( getLimitedValue<sal_Int32>( itr->GetString().ToInt32(), 1, 256 ) );
                 break;
                 case HTML_O_ROWSPAN:
-                    aSpanSize.mnRows = static_cast< SCROW >( getLimitedValue< sal_Int32 >( aIter->GetString().ToInt32(), 1, 256 ) );
+                    aSpanSize.mnRows = static_cast<SCROW>( getLimitedValue<sal_Int32>( itr->GetString().ToInt32(), 1, 256 ) );
                 break;
                 case HTML_O_SDVAL:
-                    pValStr.reset( new String( aIter->GetString() ) );
+                    pValStr.reset( new String( itr->GetString() ) );
                 break;
                 case HTML_O_SDNUM:
-                    pNumStr.reset( new String( aIter->GetString() ) );
+                    pNumStr.reset( new String( itr->GetString() ) );
+                break;
+                case HTML_O_CLASS:
+                {
+                    // Pick up the number format associated with this class (if
+                    // any).
+                    rtl::OUString aElem(RTL_CONSTASCII_USTRINGPARAM("td"));
+                    rtl::OUString aClass = itr->GetString();
+                    rtl::OUString aProp(RTL_CONSTASCII_USTRINGPARAM("mso-number-format"));
+                    const ScHTMLStyles& rStyles = mpParser->GetStyles();
+                    const rtl::OUString& rVal = rStyles.getPropertyValue(aElem, aClass, aProp);
+                    rtl::OUString aNumFmt = decodeNumberFormat(rVal);
+
+                    nNumberFormat = GetFormatTable()->GetEntryKey(aNumFmt);
+                    if (nNumberFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+                    {
+                        xub_StrLen nErrPos  = 0;
+                        short nDummy;
+                        bool bValidFmt = GetFormatTable()->PutEntry(aNumFmt, nErrPos, nDummy, nNumberFormat);
+                        if (!bValidFmt)
+                            nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
+                    }
+                }
                 break;
             }
         }
 
         ImplDataOn( aSpanSize );
 
-        const HTMLOptions& rOptions = static_cast<HTMLParser*>(rInfo.pParser)->GetOptions();
-        HTMLOptions::const_iterator itr = rOptions.begin(), itrEnd = rOptions.end();
-        for (; itr != itrEnd; ++itr)
-        {
-            if (itr->GetToken() == HTML_O_CLASS)
-            {
-                // This <td> has class property.  Pick up the number format
-                // associated with this class (if any).
-                rtl::OUString aElem(RTL_CONSTASCII_USTRINGPARAM("td"));
-                rtl::OUString aClass = itr->GetString();
-                rtl::OUString aProp(RTL_CONSTASCII_USTRINGPARAM("mso-number-format"));
-                const ScHTMLStyles& rStyles = mpParser->GetStyles();
-                const rtl::OUString& rVal = rStyles.getPropertyValue(aElem, aClass, aProp);
-                rtl::OUString aNumFmt = decodeNumberFormat(rVal);
-
-                sal_uInt32 nNumberFormat = GetFormatTable()->GetEntryKey(aNumFmt);
-                bool bValidFmt = false;
-                if ( nNumberFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
-                {
-                    xub_StrLen nErrPos  = 0;
-                    short nDummy;
-                    bValidFmt = GetFormatTable()->PutEntry(aNumFmt, nErrPos, nDummy, nNumberFormat);
-                }
-                else
-                    bValidFmt = true;
-
-                if (bValidFmt)
-                    mxDataItemSet->Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNumberFormat) );
-            }
-        }
+        if (nNumberFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
+            mxDataItemSet->Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNumberFormat) );
 
         ProcessFormatOptions( *mxDataItemSet, rInfo );
         CreateNewEntry( rInfo );


More information about the Libreoffice-commits mailing list