[Libreoffice-commits] .: sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Oct 25 12:13:54 PDT 2011
sc/source/filter/excel/xistyle.cxx | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
New commits:
commit abb13e9c635aac37b56f294110b966be44120f1c
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Tue Oct 25 15:10:53 2011 -0400
fdo#41369: Use the 'Default' style as the parent style.
Some buggy XLS documents such as those generated by 1C (app used in
Russia) don't include built-in style definitions, and the cell formats
in those docs are not associated with any style at all. Let's
associate them with the 'Default' style in such cases.
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 9262940..f49b469 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -69,6 +69,7 @@
#include "root.hxx"
#include "colrowst.hxx"
#include "svl/poolcach.hxx"
+#include "rsc/rscsfx.hxx"
#include <list>
@@ -1297,10 +1298,31 @@ void XclImpXF::ApplyPatternToAttrList(
// insert into document
ScDocument& rDoc = GetDoc();
- if (IsCellXF() && mpStyleSheet)
+ if (IsCellXF())
{
- // Apply style sheet. Don't clear the direct formats.
- rPat.SetStyleSheet(mpStyleSheet, false);
+ if (mpStyleSheet)
+ {
+ // Apply style sheet. Don't clear the direct formats.
+ rPat.SetStyleSheet(mpStyleSheet, false);
+ }
+ else
+ {
+ // When the cell format is not associated with any style, use the
+ // 'Default' style. Some buggy XLS docs generated by apps other
+ // than Excel (such as 1C) may not have any built-in styles at
+ // all.
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
+ if (pStylePool)
+ {
+ ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>(
+ pStylePool->Find(
+ ScGlobal::GetRscString(STR_STYLENAME_STANDARD), SFX_STYLE_FAMILY_PARA));
+
+ if (pStyleSheet)
+ rPat.SetStyleSheet(pStyleSheet, false);
+ }
+
+ }
}
if (nForceScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND)
More information about the Libreoffice-commits
mailing list