Combined two html option loops.
This commit is contained in:
parent
24d8e4eaf4
commit
0a99c69971
1 changed files with 33 additions and 36 deletions
|
@ -2225,35 +2225,29 @@ 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 )
|
||||
{
|
||||
switch( aIter->GetToken() )
|
||||
{
|
||||
case HTML_O_COLSPAN:
|
||||
aSpanSize.mnCols = static_cast< SCCOL >( getLimitedValue< sal_Int32 >( aIter->GetString().ToInt32(), 1, 256 ) );
|
||||
break;
|
||||
case HTML_O_ROWSPAN:
|
||||
aSpanSize.mnRows = static_cast< SCROW >( getLimitedValue< sal_Int32 >( aIter->GetString().ToInt32(), 1, 256 ) );
|
||||
break;
|
||||
case HTML_O_SDVAL:
|
||||
pValStr.reset( new String( aIter->GetString() ) );
|
||||
break;
|
||||
case HTML_O_SDNUM:
|
||||
pNumStr.reset( new String( aIter->GetString() ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ImplDataOn( aSpanSize );
|
||||
|
||||
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)
|
||||
{
|
||||
if (itr->GetToken() == HTML_O_CLASS)
|
||||
switch (itr->GetToken())
|
||||
{
|
||||
// This <td> has class property. Pick up the number format
|
||||
// associated with this class (if any).
|
||||
case HTML_O_COLSPAN:
|
||||
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>( itr->GetString().ToInt32(), 1, 256 ) );
|
||||
break;
|
||||
case HTML_O_SDVAL:
|
||||
pValStr.reset( new String( itr->GetString() ) );
|
||||
break;
|
||||
case HTML_O_SDNUM:
|
||||
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"));
|
||||
|
@ -2261,21 +2255,24 @@ void ScHTMLTable::DataOn( const ImportInfo& rInfo )
|
|||
const rtl::OUString& rVal = rStyles.getPropertyValue(aElem, aClass, aProp);
|
||||
rtl::OUString aNumFmt = decodeNumberFormat(rVal);
|
||||
|
||||
sal_uInt32 nNumberFormat = GetFormatTable()->GetEntryKey(aNumFmt);
|
||||
bool bValidFmt = false;
|
||||
nNumberFormat = GetFormatTable()->GetEntryKey(aNumFmt);
|
||||
if (nNumberFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
|
||||
{
|
||||
xub_StrLen nErrPos = 0;
|
||||
short nDummy;
|
||||
bValidFmt = GetFormatTable()->PutEntry(aNumFmt, nErrPos, nDummy, nNumberFormat);
|
||||
bool bValidFmt = GetFormatTable()->PutEntry(aNumFmt, nErrPos, nDummy, nNumberFormat);
|
||||
if (!bValidFmt)
|
||||
nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
bValidFmt = true;
|
||||
|
||||
if (bValidFmt)
|
||||
ImplDataOn( aSpanSize );
|
||||
|
||||
if (nNumberFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
|
||||
mxDataItemSet->Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNumberFormat) );
|
||||
}
|
||||
}
|
||||
|
||||
ProcessFormatOptions( *mxDataItemSet, rInfo );
|
||||
CreateNewEntry( rInfo );
|
||||
|
|
Loading…
Reference in a new issue