[ooo-build-commit] .: patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Sep 23 18:41:51 PDT 2010


 patches/dev300/apply                            |    4 +
 patches/dev300/calc-xls-import-cell-border.diff |   64 ++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

New commits:
commit 4ae86193d28126483ea33aa590f306754d47e1b6
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Sep 23 20:18:49 2010 -0400

    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:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index c2ef11b..610333c 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2905,6 +2905,10 @@ border-types-dotted-dashed.diff, fate#307731, fate 307730
 #FIXME: Incomplete, not to be included in 3.2.1
 #border-types-more.diff, fate#309127
 
+[ CalcFixes ]
+# Better mapping of cell border thickness & inner padding.
+calc-xls-import-cell-border.diff, n#636691, kohei
+
 [ FSFhuOnly ]
 SectionOwner => timar
 
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 0000000..f60317b
--- /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;
+ }
+ 


More information about the ooo-build-commit mailing list