Kaydet (Commit) 4ab9719f authored tarafından Markus Mohrhard's avatar Markus Mohrhard

use same border width information for xls import and export, fdo#44742

üst 535ee445
...@@ -1547,15 +1547,15 @@ void lclGetBorderLine( ...@@ -1547,15 +1547,15 @@ void lclGetBorderLine(
sal_uInt16 nDistance = pLine->GetDistance(); sal_uInt16 nDistance = pLine->GetDistance();
if( nDistance > 0 ) if( nDistance > 0 )
rnXclLine = EXC_LINE_DOUBLE; rnXclLine = EXC_LINE_DOUBLE;
else if( nOuterWidth > DEF_LINE_WIDTH_2 ) else if( nOuterWidth >= EXC_BORDER_THICK )
rnXclLine = EXC_LINE_THICK; rnXclLine = EXC_LINE_THICK;
else if( nOuterWidth > DEF_LINE_WIDTH_1 ) else if( nOuterWidth >= EXC_BORDER_MEDIUM )
{ {
rnXclLine = EXC_LINE_MEDIUM; rnXclLine = EXC_LINE_MEDIUM;
if ( pLine->GetStyle( ) == ::editeng::DASHED ) if ( pLine->GetStyle( ) == ::editeng::DASHED )
rnXclLine = EXC_LINE_MEDIUMDASHED; rnXclLine = EXC_LINE_MEDIUMDASHED;
} }
else if( nOuterWidth > DEF_LINE_WIDTH_0 ) else if( nOuterWidth >= EXC_BORDER_THIN )
{ {
rnXclLine = EXC_LINE_THIN; rnXclLine = EXC_LINE_THIN;
switch ( pLine->GetStyle( ) ) switch ( pLine->GetStyle( ) )
...@@ -1570,7 +1570,7 @@ void lclGetBorderLine( ...@@ -1570,7 +1570,7 @@ void lclGetBorderLine(
break; break;
} }
} }
else if( nOuterWidth > 0 ) else if( nOuterWidth >= EXC_BORDER_HAIR )
rnXclLine = EXC_LINE_HAIR; rnXclLine = EXC_LINE_HAIR;
else else
rnXclLine = EXC_LINE_NONE; rnXclLine = EXC_LINE_NONE;
......
...@@ -890,33 +890,26 @@ bool XclImpCellBorder::HasAnyOuterBorder() const ...@@ -890,33 +890,26 @@ bool XclImpCellBorder::HasAnyOuterBorder() const
namespace { 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". */ /** 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 ) bool lclConvertBorderLine( ::editeng::SvxBorderLine& rLine, const XclImpPalette& rPalette, sal_uInt8 nXclLine, sal_uInt16 nXclColor )
{ {
static const sal_uInt16 ppnLineParam[][ 4 ] = static const sal_uInt16 ppnLineParam[][ 4 ] =
{ {
// outer width, type // outer width, type
{ 0, ::editeng::SOLID }, // 0 = none { 0, ::editeng::SOLID }, // 0 = none
{ XLS_LINE_WIDTH_THIN, ::editeng::SOLID }, // 1 = thin { EXC_BORDER_THIN, ::editeng::SOLID }, // 1 = thin
{ XLS_LINE_WIDTH_MEDIUM, ::editeng::SOLID }, // 2 = medium { EXC_BORDER_MEDIUM, ::editeng::SOLID }, // 2 = medium
{ XLS_LINE_WIDTH_THIN, ::editeng::DASHED }, // 3 = dashed { EXC_BORDER_THIN, ::editeng::DASHED }, // 3 = dashed
{ XLS_LINE_WIDTH_THIN, ::editeng::DOTTED }, // 4 = dotted { EXC_BORDER_THIN, ::editeng::DOTTED }, // 4 = dotted
{ XLS_LINE_WIDTH_THICK, ::editeng::SOLID }, // 5 = thick { EXC_BORDER_THICK, ::editeng::SOLID }, // 5 = thick
{ XLS_LINE_WIDTH_THIN, ::editeng::DOUBLE }, // 6 = double { EXC_BORDER_THIN, ::editeng::DOUBLE }, // 6 = double
{ XLS_LINE_WIDTH_HAIR, ::editeng::SOLID }, // 7 = hair { EXC_BORDER_HAIR, ::editeng::SOLID }, // 7 = hair
{ XLS_LINE_WIDTH_MEDIUM, ::editeng::DASHED }, // 8 = med dash { EXC_BORDER_MEDIUM, ::editeng::DASHED }, // 8 = med dash
{ XLS_LINE_WIDTH_THIN, ::editeng::SOLID }, // 9 = thin dashdot { EXC_BORDER_THIN, ::editeng::SOLID }, // 9 = thin dashdot
{ XLS_LINE_WIDTH_MEDIUM, ::editeng::SOLID }, // A = med dashdot { EXC_BORDER_MEDIUM, ::editeng::SOLID }, // A = med dashdot
{ XLS_LINE_WIDTH_THIN, ::editeng::SOLID }, // B = thin dashdotdot { EXC_BORDER_THIN, ::editeng::SOLID }, // B = thin dashdotdot
{ XLS_LINE_WIDTH_MEDIUM, ::editeng::SOLID }, // C = med dashdotdot { EXC_BORDER_MEDIUM, ::editeng::SOLID }, // C = med dashdotdot
{ XLS_LINE_WIDTH_MEDIUM, ::editeng::SOLID } // D = med slant dashdot { EXC_BORDER_MEDIUM, ::editeng::SOLID } // D = med slant dashdot
}; };
if( nXclLine == EXC_LINE_NONE ) if( nXclLine == EXC_LINE_NONE )
......
...@@ -259,6 +259,16 @@ const sal_uInt16 EXC_FUTUREREC_EMPTYFLAGS = 0x0000; ...@@ -259,6 +259,16 @@ const sal_uInt16 EXC_FUTUREREC_EMPTYFLAGS = 0x0000;
const sal_uInt16 EXC_FUTUREREC_HASREF = 0x0001; const sal_uInt16 EXC_FUTUREREC_HASREF = 0x0001;
const sal_uInt16 EXC_FUTUREREC_ALERT = 0x0002; 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 #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment