Kaydet (Commit) 4216adcf authored tarafından Kohei Yoshida's avatar Kohei Yoshida Kaydeden (comit) Katarina Machalkova

fdo#37622: Fix incorrect font attribute lookup during XLS import.

Font IDs in XF records are

* 0-based when it's less than 4, but
* 1-based when it's greater than 4.

That's what the spec says.  And apparently the font ID of 4 is still
used in BIFF5 format, but not in BIFF8.
üst 82978dba
...@@ -549,10 +549,14 @@ const XclImpFont* XclImpFontBuffer::GetFont( sal_uInt16 nFontIndex ) const ...@@ -549,10 +549,14 @@ const XclImpFont* XclImpFontBuffer::GetFont( sal_uInt16 nFontIndex ) const
if (nFontIndex == 4) if (nFontIndex == 4)
return &maFont4; return &maFont4;
if (nFontIndex >= maFontList.size()) if (nFontIndex < 4)
return NULL; {
// Font ID is zero-based when it's less than 4.
return nFontIndex >= maFontList.size() ? NULL : &maFontList[nFontIndex];
}
return (nFontIndex < 4) ? &(maFontList[nFontIndex]) : &(maFontList[nFontIndex - 1]); // Font ID is greater than 4. It is now 1-based.
return nFontIndex > maFontList.size() ? NULL : &maFontList[nFontIndex-1];
} }
void XclImpFontBuffer::ReadFont( XclImpStream& rStrm ) void XclImpFontBuffer::ReadFont( XclImpStream& rStrm )
......
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