summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-09-23 20:18:49 -0400
committerKohei Yoshida <kyoshida@novell.com>2010-09-23 20:23:00 -0400
commit21620bc0b1f69a1386f2c0cbd4910cd8b5ff8d4f (patch)
treea038abdd10ccdb3d88df95efaf199574e20331c0
parentc7a8d6b0c31efa35d5b439e0483240d32cb36e36 (diff)
Better mapping of Excel's cell border thickness & inner cell padding.
Excel's three border types, thin, medium and thick, are mapped to Calc's equivalents in a very coarse fashion. This patch improves that mapping somewhat. The patch also tweaks inner cell padding for Excel documents as Excel's cell padding is larger than Calc's default padding, and is not tweakable. (n#636691) * patches/dev300/apply: * patches/dev300/calc-xls-import-cell-border.diff:
-rw-r--r--patches/dev300/apply3
-rw-r--r--patches/dev300/calc-xls-import-cell-border.diff64
2 files changed, 67 insertions, 0 deletions
diff --git a/patches/dev300/apply b/patches/dev300/apply
index e84f1431e..f1b2b3767 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -4132,6 +4132,9 @@ calc-extref-interpreter-rework.diff, n#628876, kohei
# Reduce memory footprint per sheet during import of xls document.
calc-xls-import-mem-footprint.diff, n#637925, kohei
+# Better mapping of cell border thickness & inner padding.
+calc-xls-import-cell-border.diff, n#636691, kohei
+
[ Netbook ]
netbook-window-decoration-update.diff, n#621116, rodo
diff --git a/patches/dev300/calc-xls-import-cell-border.diff b/patches/dev300/calc-xls-import-cell-border.diff
new file mode 100644
index 000000000..f60317bef
--- /dev/null
+++ b/patches/dev300/calc-xls-import-cell-border.diff
@@ -0,0 +1,64 @@
+diff --git sc/source/filter/excel/xistyle.cxx sc/source/filter/excel/xistyle.cxx
+index f40ee7f..5f30ae3 100644
+--- sc/source/filter/excel/xistyle.cxx
++++ sc/source/filter/excel/xistyle.cxx
+@@ -878,26 +878,33 @@ bool XclImpCellBorder::HasAnyOuterBorder() const
+
+ namespace {
+
++// TODO: These values are approximate; we should probably tweak these values
++// further to better match Excel's border thickness.
++#define XLS_LINE_WIDTH_HAIR 1
++#define XLS_LINE_WIDTH_THIN 6
++#define XLS_LINE_WIDTH_MEDIUM 18
++#define XLS_LINE_WIDTH_THICK 24
++
+ /** Converts the passed line style to a SvxBorderLine, or returns false, if style is "no line". */
+ bool lclConvertBorderLine( SvxBorderLine& rLine, const XclImpPalette& rPalette, sal_uInt8 nXclLine, sal_uInt16 nXclColor )
+ {
+ static const sal_uInt16 ppnLineParam[][ 4 ] =
+ {
+- // outer width, inner width, distance type
+- { 0, 0, 0, SOLID }, // 0 = none
+- { DEF_LINE_WIDTH_1, 0, 0, SOLID }, // 1 = thin
+- { DEF_LINE_WIDTH_2, 0, 0, SOLID }, // 2 = medium
+- { DEF_LINE_WIDTH_1, 0, 0, DASHED }, // 3 = dashed
+- { DEF_LINE_WIDTH_1, 0, 0, DOTTED }, // 4 = dotted
+- { DEF_LINE_WIDTH_3, 0, 0, SOLID }, // 5 = thick
+- { DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1 }, // 6 = double
+- { DEF_LINE_WIDTH_0, 0, 0, SOLID }, // 7 = hair
+- { DEF_LINE_WIDTH_2, 0, 0, DASHED }, // 8 = med dash
+- { DEF_LINE_WIDTH_1, 0, 0, SOLID }, // 9 = thin dashdot
+- { DEF_LINE_WIDTH_2, 0, 0, SOLID }, // A = med dashdot
+- { DEF_LINE_WIDTH_1, 0, 0, SOLID }, // B = thin dashdotdot
+- { DEF_LINE_WIDTH_2, 0, 0, SOLID }, // C = med dashdotdot
+- { DEF_LINE_WIDTH_2, 0, 0, SOLID } // D = med slant dashdot
++ // outer width, inner width, distance type
++ { 0, 0, 0, SOLID }, // 0 = none
++ { XLS_LINE_WIDTH_THIN, 0, 0, SOLID }, // 1 = thin
++ { XLS_LINE_WIDTH_MEDIUM, 0, 0, SOLID }, // 2 = medium
++ { XLS_LINE_WIDTH_THIN, 0, 0, DASHED }, // 3 = dashed
++ { XLS_LINE_WIDTH_THIN, 0, 0, DOTTED }, // 4 = dotted
++ { XLS_LINE_WIDTH_THICK, 0, 0, SOLID }, // 5 = thick
++ { XLS_LINE_WIDTH_THIN, XLS_LINE_WIDTH_THIN, XLS_LINE_WIDTH_THIN, SOLID }, // 6 = double
++ { XLS_LINE_WIDTH_HAIR, 0, 0, SOLID }, // 7 = hair
++ { XLS_LINE_WIDTH_MEDIUM, 0, 0, DASHED }, // 8 = med dash
++ { XLS_LINE_WIDTH_THIN, 0, 0, SOLID }, // 9 = thin dashdot
++ { XLS_LINE_WIDTH_MEDIUM, 0, 0, SOLID }, // A = med dashdot
++ { XLS_LINE_WIDTH_THIN, 0, 0, SOLID }, // B = thin dashdotdot
++ { XLS_LINE_WIDTH_MEDIUM, 0, 0, SOLID }, // C = med dashdotdot
++ { XLS_LINE_WIDTH_MEDIUM, 0, 0, SOLID } // D = med slant dashdot
+ };
+
+ if( nXclLine == EXC_LINE_NONE )
+@@ -1230,6 +1237,10 @@ const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs )
+ ScfTools::PutItem( rItemSet, SvxRotateModeItem( eRotateMode, ATTR_ROTATE_MODE ), bSkipPoolDefs );
+ }
+
++ // Excel's cell margins are different from Calc's default margins.
++ SvxMarginItem aItem(40, 40, 40, 40, ATTR_MARGIN);
++ ScfTools::PutItem(rItemSet, aItem, bSkipPoolDefs);
++
+ return *mpPattern;
+ }
+