[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source
Katarina Machalkova
bubli at kemper.freedesktop.org
Fri Jun 10 03:00:40 PDT 2011
sc/source/filter/excel/xistyle.cxx | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit cb0fa8f3a5889c05b40a337aaa0f17c93468ff8a
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Jun 10 01:07:24 2011 -0400
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.
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 11381e5..1f6e680 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -549,10 +549,14 @@ const XclImpFont* XclImpFontBuffer::GetFont( sal_uInt16 nFontIndex ) const
if (nFontIndex == 4)
return &maFont4;
- if (nFontIndex >= maFontList.size())
- return NULL;
+ if (nFontIndex < 4)
+ {
+ // 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 )
More information about the Libreoffice-commits
mailing list