[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Apr 2 13:37:53 PDT 2012


 sc/source/filter/excel/xestyle.cxx |    8 ++++----
 sc/source/filter/excel/xistyle.cxx |   37 +++++++++++++++----------------------
 sc/source/filter/inc/xlconst.hxx   |   10 ++++++++++
 3 files changed, 29 insertions(+), 26 deletions(-)

New commits:
commit 487139d681fbf38a52cf5ea91d7e38f7eba290a0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Apr 1 23:57:46 2012 +0200

    use same border width information for xls import and export, fdo#44742
    
    Signed-off-by: Kohei Yoshida <kohei.yoshida at gmail.com>

diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 11757bb..39ecfcf 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1553,15 +1553,15 @@ void lclGetBorderLine(
         sal_uInt16 nDistance = pLine->GetDistance();
         if( nDistance > 0 )
             rnXclLine = EXC_LINE_DOUBLE;
-        else if( nOuterWidth > DEF_LINE_WIDTH_2 )
+        else if( nOuterWidth >= EXC_BORDER_THICK )
             rnXclLine = EXC_LINE_THICK;
-        else if( nOuterWidth > DEF_LINE_WIDTH_1 )
+        else if( nOuterWidth >= EXC_BORDER_MEDIUM )
         {
             rnXclLine = EXC_LINE_MEDIUM;
             if ( pLine->GetStyle( ) == ::editeng::DASHED )
                 rnXclLine = EXC_LINE_MEDIUMDASHED;
         }
-        else if( nOuterWidth > DEF_LINE_WIDTH_0 )
+        else if( nOuterWidth >= EXC_BORDER_THIN )
         {
             rnXclLine = EXC_LINE_THIN;
             switch ( pLine->GetStyle( ) )
@@ -1576,7 +1576,7 @@ void lclGetBorderLine(
                     break;
             }
         }
-        else if( nOuterWidth > 0 )
+        else if( nOuterWidth >= EXC_BORDER_HAIR )
             rnXclLine = EXC_LINE_HAIR;
         else
             rnXclLine = EXC_LINE_NONE;
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 2131095..1f55f2d 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -890,33 +890,26 @@ 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 ::editeng::SvxBorderLine, or returns false, if style is "no line". */
 bool lclConvertBorderLine( ::editeng::SvxBorderLine& rLine, const XclImpPalette& rPalette, sal_uInt8 nXclLine, sal_uInt16 nXclColor )
 {
     static const sal_uInt16 ppnLineParam[][ 4 ] =
     {
-        //  outer width,           type
-        {   0,                     ::editeng::SOLID },                // 0 = none
-        {   XLS_LINE_WIDTH_THIN,   ::editeng::SOLID },                // 1 = thin
-        {   XLS_LINE_WIDTH_MEDIUM, ::editeng::SOLID },                // 2 = medium
-        {   XLS_LINE_WIDTH_THIN,   ::editeng::DASHED },               // 3 = dashed
-        {   XLS_LINE_WIDTH_THIN,   ::editeng::DOTTED },               // 4 = dotted
-        {   XLS_LINE_WIDTH_THICK,  ::editeng::SOLID },                // 5 = thick
-        {   XLS_LINE_WIDTH_THIN,   ::editeng::DOUBLE },                 // 6 = double
-        {   XLS_LINE_WIDTH_HAIR,   ::editeng::SOLID },                // 7 = hair
-        {   XLS_LINE_WIDTH_MEDIUM, ::editeng::DASHED },               // 8 = med dash
-        {   XLS_LINE_WIDTH_THIN,   ::editeng::SOLID },                // 9 = thin dashdot
-        {   XLS_LINE_WIDTH_MEDIUM, ::editeng::SOLID },                // A = med dashdot
-        {   XLS_LINE_WIDTH_THIN,   ::editeng::SOLID },                // B = thin dashdotdot
-        {   XLS_LINE_WIDTH_MEDIUM, ::editeng::SOLID },                // C = med dashdotdot
-        {   XLS_LINE_WIDTH_MEDIUM, ::editeng::SOLID }                 // D = med slant dashdot
+        //  outer width,        type
+        {   0,                  ::editeng::SOLID },                // 0 = none
+        {   EXC_BORDER_THIN,    ::editeng::SOLID },                // 1 = thin
+        {   EXC_BORDER_MEDIUM,  ::editeng::SOLID },                // 2 = medium
+        {   EXC_BORDER_THIN,    ::editeng::DASHED },               // 3 = dashed
+        {   EXC_BORDER_THIN,    ::editeng::DOTTED },               // 4 = dotted
+        {   EXC_BORDER_THICK,   ::editeng::SOLID },                // 5 = thick
+        {   EXC_BORDER_THIN,    ::editeng::DOUBLE },                 // 6 = double
+        {   EXC_BORDER_HAIR,    ::editeng::SOLID },                // 7 = hair
+        {   EXC_BORDER_MEDIUM,  ::editeng::DASHED },               // 8 = med dash
+        {   EXC_BORDER_THIN,    ::editeng::SOLID },                // 9 = thin dashdot
+        {   EXC_BORDER_MEDIUM,  ::editeng::SOLID },                // A = med dashdot
+        {   EXC_BORDER_THIN,    ::editeng::SOLID },                // B = thin dashdotdot
+        {   EXC_BORDER_MEDIUM,  ::editeng::SOLID },                // C = med dashdotdot
+        {   EXC_BORDER_MEDIUM,  ::editeng::SOLID }                 // D = med slant dashdot
     };
 
     if( nXclLine == EXC_LINE_NONE )
diff --git a/sc/source/filter/inc/xlconst.hxx b/sc/source/filter/inc/xlconst.hxx
index c86f157..552c2d6 100644
--- a/sc/source/filter/inc/xlconst.hxx
+++ b/sc/source/filter/inc/xlconst.hxx
@@ -259,6 +259,16 @@ const sal_uInt16 EXC_FUTUREREC_EMPTYFLAGS   = 0x0000;
 const sal_uInt16 EXC_FUTUREREC_HASREF       = 0x0001;
 const sal_uInt16 EXC_FUTUREREC_ALERT        = 0x0002;
 
+// Border import/export
+
+// TODO: These values are approximate; we should probably tweak these values
+// further to better match Excel's border thickness.
+
+const sal_uInt16 EXC_BORDER_THICK = 24;
+const sal_uInt16 EXC_BORDER_MEDIUM = 18;
+const sal_uInt16 EXC_BORDER_THIN = 6;
+const sal_uInt16 EXC_BORDER_HAIR = 1;
+
 // ============================================================================
 
 #endif


More information about the Libreoffice-commits mailing list