summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/inc/editeng/borderline.hxx4
-rw-r--r--editeng/qa/items/borderline_test.cxx35
-rw-r--r--editeng/source/items/borderline.cxx147
-rw-r--r--editeng/source/items/frmitems.cxx7
-rw-r--r--svtools/source/control/ctrlbox.cxx31
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx4
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx10
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx3
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx6
-rw-r--r--sw/source/filter/xml/xmlithlp.cxx4
-rw-r--r--writerfilter/Library_writerfilter.mk1
-rw-r--r--writerfilter/source/dmapper/BorderHandler.cxx4
-rw-r--r--writerfilter/source/dmapper/ConversionHelper.cxx8
-rw-r--r--writerfilter/source/dmapper/MeasureHandler.cxx2
-rw-r--r--writerfilter/source/dmapper/TDefTableHandler.cxx2
16 files changed, 225 insertions, 47 deletions
diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx
index e026fc208410..7d18587e78fb 100644
--- a/editeng/inc/editeng/borderline.hxx
+++ b/editeng/inc/editeng/borderline.hxx
@@ -52,6 +52,10 @@ namespace editeng {
// values from ::com::sun::star::table::BorderLineStyle
typedef sal_Int16 SvxBorderStyle;
+ /// convert border width in twips between Word formats and LO
+ double EDITENG_DLLPUBLIC ConvertBorderWidthToWord(SvxBorderStyle, double);
+ double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderStyle, double);
+
class EDITENG_DLLPUBLIC SvxBorderLine
{
protected:
diff --git a/editeng/qa/items/borderline_test.cxx b/editeng/qa/items/borderline_test.cxx
index 8a1de32f3ed4..f330451cce13 100644
--- a/editeng/qa/items/borderline_test.cxx
+++ b/editeng/qa/items/borderline_test.cxx
@@ -99,7 +99,10 @@ void BorderLineTest::testGuessWidthDouble()
SvxBorderLine line;
line.GuessLinesWidths( DOUBLE, TEST_WIDTH, TEST_WIDTH, TEST_WIDTH );
CPPUNIT_ASSERT_EQUAL( DOUBLE, line.GetBorderLineStyle() );
- CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() );
+ CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, static_cast<long>(line.GetOutWidth()) );
+ CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, static_cast<long>(line.GetInWidth()) );
+ CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, static_cast<long>(line.GetDistance()) );
+ CPPUNIT_ASSERT_EQUAL( 3*TEST_WIDTH, line.GetWidth() );
}
void BorderLineTest::testGuessWidthNoMatch()
@@ -108,6 +111,9 @@ void BorderLineTest::testGuessWidthNoMatch()
line.GuessLinesWidths( DOUBLE,
TEST_WIDTH + 1, TEST_WIDTH + 2, TEST_WIDTH + 3 );
CPPUNIT_ASSERT_EQUAL( DOUBLE, line.GetBorderLineStyle() );
+ CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+1, static_cast<long>(line.GetOutWidth()) );
+ CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+2, static_cast<long>(line.GetInWidth()) );
+ CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+3, static_cast<long>(line.GetDistance()));
CPPUNIT_ASSERT_EQUAL( long( (3 * TEST_WIDTH) + 6 ), line.GetWidth() );
}
@@ -119,7 +125,14 @@ void BorderLineTest::testGuessWidthThinthickSmallgap()
THINTHICKSG_IN_WIDTH,
THINTHICKSG_DIST_WIDTH );
CPPUNIT_ASSERT_EQUAL( THINTHICK_SMALLGAP, line.GetBorderLineStyle() );
- CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKSG_OUT_WIDTH,
+ static_cast<long>(line.GetOutWidth()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKSG_IN_WIDTH,
+ static_cast<long>(line.GetInWidth()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKSG_DIST_WIDTH,
+ static_cast<long>(line.GetDistance()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKSG_OUT_WIDTH + THINTHICKSG_IN_WIDTH
+ + THINTHICKSG_DIST_WIDTH, line.GetWidth() );
}
void BorderLineTest::testGuessWidthThinthickLargegap()
@@ -130,7 +143,14 @@ void BorderLineTest::testGuessWidthThinthickLargegap()
THINTHICKLG_IN_WIDTH,
THINTHICKLG_DIST_WIDTH );
CPPUNIT_ASSERT_EQUAL( THINTHICK_LARGEGAP, line.GetBorderLineStyle() );
- CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKLG_OUT_WIDTH,
+ static_cast<long>(line.GetOutWidth()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKLG_IN_WIDTH,
+ static_cast<long>(line.GetInWidth()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKLG_DIST_WIDTH,
+ static_cast<long>(line.GetDistance()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKLG_OUT_WIDTH + THINTHICKLG_IN_WIDTH
+ + THINTHICKLG_DIST_WIDTH, line.GetWidth() );
}
void BorderLineTest::testGuessWidthNostyleDouble()
@@ -141,7 +161,14 @@ void BorderLineTest::testGuessWidthNostyleDouble()
THINTHICKLG_IN_WIDTH,
THINTHICKLG_DIST_WIDTH );
CPPUNIT_ASSERT_EQUAL( THINTHICK_LARGEGAP, line.GetBorderLineStyle() );
- CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, line.GetWidth() );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKLG_OUT_WIDTH,
+ static_cast<long>(line.GetOutWidth()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKLG_IN_WIDTH,
+ static_cast<long>(line.GetInWidth()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKLG_DIST_WIDTH,
+ static_cast<long>(line.GetDistance()) );
+ CPPUNIT_ASSERT_EQUAL( THINTHICKLG_OUT_WIDTH + THINTHICKLG_IN_WIDTH
+ + THINTHICKLG_DIST_WIDTH, line.GetWidth() );
}
void BorderLineTest::testGuessWidthNostyleSingle()
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 7470f5a9b0b6..f6e184fd1814 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -120,6 +120,127 @@ SvxBorderLine::SvxBorderLine( const Color *pCol, long nWidth,
aColor = *pCol;
}
+static const double THINTHICK_SMALLGAP_line2 = 15.0;
+static const double THINTHICK_SMALLGAP_gap = 15.0;
+static const double THINTHICK_LARGEGAP_line1 = 30.0;
+static const double THINTHICK_LARGEGAP_line2 = 15.0;
+static const double THICKTHIN_SMALLGAP_line1 = 15.0;
+static const double THICKTHIN_SMALLGAP_gap = 15.0;
+static const double THICKTHIN_LARGEGAP_line1 = 15.0;
+static const double THICKTHIN_LARGEGAP_line2 = 30.0;
+static const double OUTSET_line1 = 15.0;
+static const double INSET_line2 = 15.0;
+
+double
+ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth)
+{
+ switch (eStyle)
+ {
+ // Single lines
+ case SOLID:
+ case DOTTED:
+ case DASHED:
+ return fWidth;
+ break;
+
+ // Double lines
+ case DOUBLE:
+ return fWidth * 3.0;
+ break;
+
+ case THINTHICK_MEDIUMGAP:
+ case THICKTHIN_MEDIUMGAP:
+ case EMBOSSED:
+ case ENGRAVED:
+ return fWidth * 2.0;
+ break;
+
+ case THINTHICK_SMALLGAP:
+ return fWidth + THINTHICK_SMALLGAP_line2 + THINTHICK_SMALLGAP_gap;
+ break;
+
+ case THINTHICK_LARGEGAP:
+ return fWidth + THINTHICK_LARGEGAP_line1 + THINTHICK_LARGEGAP_line2;
+ break;
+
+ case THICKTHIN_SMALLGAP:
+ return fWidth + THICKTHIN_SMALLGAP_line1 + THICKTHIN_SMALLGAP_gap;
+ break;
+
+ case THICKTHIN_LARGEGAP:
+ return fWidth + THICKTHIN_LARGEGAP_line1 + THICKTHIN_LARGEGAP_line2;
+ break;
+
+ case OUTSET:
+ return (fWidth * 2.0) + OUTSET_line1;
+ break;
+
+ case INSET:
+ return (fWidth * 2.0) + INSET_line2;
+ break;
+
+ default:
+ assert(false); // should only be called for known border style
+ return 0;
+ break;
+ }
+}
+
+double
+ConvertBorderWidthToWord(SvxBorderStyle const eStyle, double const fWidth)
+{
+ switch (eStyle)
+ {
+ // Single lines
+ case SOLID:
+ case DOTTED:
+ case DASHED:
+ return fWidth;
+ break;
+
+ // Double lines
+ case DOUBLE:
+ return fWidth / 3.0;
+ break;
+
+ case THINTHICK_MEDIUMGAP:
+ case THICKTHIN_MEDIUMGAP:
+ case EMBOSSED:
+ case ENGRAVED:
+ return fWidth / 2.0;
+ break;
+
+ case THINTHICK_SMALLGAP:
+ return fWidth - THINTHICK_SMALLGAP_line2 - THINTHICK_SMALLGAP_gap;
+ break;
+
+ case THINTHICK_LARGEGAP:
+ return fWidth - THINTHICK_LARGEGAP_line1 - THINTHICK_LARGEGAP_line2;
+ break;
+
+ case THICKTHIN_SMALLGAP:
+ return fWidth - THICKTHIN_SMALLGAP_line1 - THICKTHIN_SMALLGAP_gap;
+ break;
+
+ case THICKTHIN_LARGEGAP:
+ return fWidth - THICKTHIN_LARGEGAP_line1 - THICKTHIN_LARGEGAP_line2;
+ break;
+
+ case OUTSET:
+ return (fWidth / 2.0) - OUTSET_line1;
+ break;
+
+ case INSET:
+ return (fWidth / 2.0) - INSET_line2;
+ break;
+
+ default:
+ assert(false); // should only be called for known border style
+ return 0;
+ break;
+ }
+}
+
/** Get the BorderWithImpl object corresponding to the given #nStyle, all the
units handled by the resulting object are Twips and the
BorderWidthImpl::GetLine1() corresponds to the Outer Line.
@@ -147,35 +268,41 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
case DOUBLE:
aImpl = BorderWidthImpl(
CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST,
- 1.0, 1.0, 1.0 );
+ // fdo#46112 fdo#38542 fdo#43249:
+ // non-constant witdths must sum to 1
+ 1.0/3.0, 1.0/3.0, 1.0/3.0 );
break;
case THINTHICK_SMALLGAP:
- aImpl = BorderWidthImpl( CHANGE_LINE1, 1.0, 15.0, 15.0 );
+ aImpl = BorderWidthImpl( CHANGE_LINE1, 1.0,
+ THINTHICK_SMALLGAP_line2, THINTHICK_SMALLGAP_gap );
break;
case THINTHICK_MEDIUMGAP:
aImpl = BorderWidthImpl(
CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST,
- 1.0, 0.5, 0.5 );
+ 0.5, 0.25, 0.25 );
break;
case THINTHICK_LARGEGAP:
- aImpl = BorderWidthImpl( CHANGE_DIST, 30.0, 15.0, 1.0 );
+ aImpl = BorderWidthImpl( CHANGE_DIST,
+ THINTHICK_LARGEGAP_line1, THINTHICK_LARGEGAP_line2, 1.0 );
break;
case THICKTHIN_SMALLGAP:
- aImpl = BorderWidthImpl( CHANGE_LINE2, 15.0, 1.0, 15.0 );
+ aImpl = BorderWidthImpl( CHANGE_LINE2, THICKTHIN_SMALLGAP_line1,
+ 1.0, THICKTHIN_SMALLGAP_gap );
break;
case THICKTHIN_MEDIUMGAP:
aImpl = BorderWidthImpl(
CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST,
- 0.5, 1.0, 0.5 );
+ 0.25, 0.5, 0.25 );
break;
case THICKTHIN_LARGEGAP:
- aImpl = BorderWidthImpl( CHANGE_DIST, 15.0, 30.0, 1.0 );
+ aImpl = BorderWidthImpl( CHANGE_DIST, THICKTHIN_LARGEGAP_line1,
+ THICKTHIN_LARGEGAP_line2, 1.0 );
break;
// Engraved / Embossed
@@ -188,7 +315,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
case ENGRAVED:
aImpl = BorderWidthImpl(
CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST,
- 0.5, 0.5, 1.0 );
+ 0.25, 0.25, 0.5 );
break;
// Inset / Outset
@@ -199,13 +326,13 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
case OUTSET:
aImpl = BorderWidthImpl(
CHANGE_LINE2 | CHANGE_DIST,
- 15.0, 1.0, 1.0 );
+ OUTSET_line1, 0.5, 0.5 );
break;
case INSET:
aImpl = BorderWidthImpl(
CHANGE_LINE1 | CHANGE_DIST,
- 1.0, 15.0, 1.0 );
+ 0.5, INSET_line2, 0.5 );
break;
}
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index fb46de9f783d..da4ca7dba164 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -1791,13 +1791,6 @@ lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_B
sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth ),
sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance ));
}
- else
- {
- if (DOUBLE == rSvxLine.GetBorderLineStyle())
- { // fdo#46112: divide width by 3 for outer line, gap, inner line
- rSvxLine.ScaleMetrics(1, 3);
- }
- }
sal_Bool bRet = !rSvxLine.isEmpty();
return bRet;
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 15eae11b366e..a1d8906c0919 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -321,7 +321,12 @@ long BorderWidthImpl::GetLine1( long nWidth ) const
{
long result = static_cast<long>(m_nRate1);
if ( ( m_nFlags & CHANGE_LINE1 ) > 0 )
- result = static_cast<long>(m_nRate1 * nWidth);
+ {
+ long const nConstant2 = (m_nFlags & CHANGE_LINE2) ? 0 : m_nRate2;
+ long const nConstantD = (m_nFlags & CHANGE_DIST ) ? 0 : m_nRateGap;
+ result = std::max<long>(0,
+ static_cast<long>(m_nRate1 * nWidth) - (nConstant2 + nConstantD));
+ }
return result;
}
@@ -329,7 +334,12 @@ long BorderWidthImpl::GetLine2( long nWidth ) const
{
long result = static_cast<long>(m_nRate2);
if ( ( m_nFlags & CHANGE_LINE2 ) > 0 )
- result = static_cast<long>(m_nRate2 * nWidth);
+ {
+ long const nConstant1 = (m_nFlags & CHANGE_LINE1) ? 0 : m_nRate1;
+ long const nConstantD = (m_nFlags & CHANGE_DIST ) ? 0 : m_nRateGap;
+ result = std::max<long>(0,
+ static_cast<long>(m_nRate2 * nWidth) - (nConstant1 + nConstantD));
+ }
return result;
}
@@ -337,7 +347,12 @@ long BorderWidthImpl::GetGap( long nWidth ) const
{
long result = static_cast<long>(m_nRateGap);
if ( ( m_nFlags & CHANGE_DIST ) > 0 )
- result = static_cast<long>(m_nRateGap * nWidth);
+ {
+ long const nConstant1 = (m_nFlags & CHANGE_LINE1) ? 0 : m_nRate1;
+ long const nConstant2 = (m_nFlags & CHANGE_LINE2) ? 0 : m_nRate2;
+ result = std::max<long>(0,
+ static_cast<long>(m_nRateGap * nWidth) - (nConstant1 + nConstant2));
+ }
// Avoid having too small distances (less than 0.1pt)
if ( result < MINGAPWIDTH && m_nRate1 > 0 && m_nRate2 > 0 )
@@ -386,6 +401,11 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap )
else if ( !bGapChange && nWidthGap < 0 )
bInvalid = true;
+ // non-constant line width factors must sum to 1
+ assert((((bLine1Change) ? m_nRate1 : 0) +
+ ((bLine2Change) ? m_nRate2 : 0) +
+ ((bGapChange) ? m_nRateGap : 0)) - 1.0 < 0.00001 );
+
double nWidth = 0.0;
if ( (!bInvalid) && (!aToCompare.empty()) )
{
@@ -396,11 +416,10 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap )
bInvalid = ( nWidth != *pIt );
pIt++;
}
- if ( bInvalid )
- nWidth = 0.0;
+ nWidth = (bInvalid) ? 0.0 : nLine1 + nLine2 + nGap;
}
- return long( nWidth );
+ return nWidth;
}
/** Utility class storing the border line width, style and colors. The widths
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 26c0bea2a5e1..2d1bb23366a9 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1468,8 +1468,10 @@ static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, co
{
// Compute the sz attribute
+ double const fConverted( ::editeng::ConvertBorderWidthToWord(
+ pBorderLine->GetBorderLineStyle(), pBorderLine->GetWidth()));
// The unit is the 8th of point
- sal_Int32 nWidth = sal_Int32( pBorderLine->GetWidth() / 2.5 );
+ sal_Int32 nWidth = sal_Int32( fConverted / 2.5 );
sal_uInt16 nMinWidth = 2;
sal_uInt16 nMaxWidth = 96;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 3ef3aff38a9c..622426553c67 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -179,12 +179,18 @@ static OString OutTBLBorderLine(RtfExport &rExport, const SvxBorderLine* pLine,
break;
}
+ double const fConverted( ::editeng::ConvertBorderWidthToWord(
+ pLine->GetBorderLineStyle(), pLine->GetWidth()) );
if ( 255 >= pLine->GetWidth() ) // That value comes from RTF specs
{
- aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRW).append((sal_Int32)pLine->GetWidth());
+ aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRW).append(
+ static_cast<sal_Int32>(fConverted));
}
else
- aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTH OOO_STRING_SVTOOLS_RTF_BRDRW).append((sal_Int32)pLine->GetWidth() / 2);
+ { // use \brdrth to double the value range...
+ aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTH OOO_STRING_SVTOOLS_RTF_BRDRW);
+ aRet.append(static_cast<sal_Int32>(fConverted) / 2);
+ }
aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRCF);
aRet.append((sal_Int32)rExport.GetColor(pLine->GetColor()));
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 3f2c0c02a641..26db61bedc57 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4057,7 +4057,8 @@ WW8_BRC WW8Export::TranslateBorderLine(const SvxBorderLine& rLine,
// what SwRTFWriter::OutRTFBorder does in the RTF filter Eventually it
// would be nice if all this functionality was in the one place
WW8_BRC aBrc;
- sal_uInt16 nWidth = rLine.GetWidth();
+ sal_uInt16 nWidth = ::editeng::ConvertBorderWidthToWord(
+ rLine.GetBorderLineStyle(), rLine.GetWidth());
sal_uInt8 brcType = 0, nColCode = 0;
if( nWidth ) // Linie ?
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 49fb0b216817..9cde7c4f7656 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1570,10 +1570,6 @@ sal_Int32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor,
aLine.SetWidth( nLineThick ); // No conversion here, nLineThick is already in twips
aLine.SetBorderLineStyle(nIdx);
- if (table::BorderLineStyle::DOUBLE == nIdx)
- { // fdo#43249: divide width by 3 for outer line, gap, inner line
- aLine.ScaleMetrics(1, 3);
- }
for(sal_uInt16 nLine = 0; nLine < 4; ++nLine)
rBox.SetLine(new SvxBorderLine( aLine ), nLine);
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 1ed025035f0f..5010d4b2055c 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -1354,7 +1354,9 @@ void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt
::editeng::SvxBorderLine aLine;
aLine.SetBorderLineStyle( eStyle );
- aLine.SetWidth( nLineThickness );
+ double const fConverted( (table::BorderLineStyle::NONE == eStyle) ? 0.0 :
+ ::editeng::ConvertBorderWidthFromWord(eStyle, nLineThickness));
+ aLine.SetWidth(fConverted);
//No AUTO for borders as yet, so if AUTO, use BLACK
if (nCol == 0)
@@ -1363,7 +1365,7 @@ void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt
aLine.SetColor(SwWW8ImplReader::GetCol(nCol));
if (pSize)
- pSize[nWWIndex] = nLineThickness+nSpace;
+ pSize[nWWIndex] = fConverted + nSpace;
rBox.SetLine(&aLine, nOOIndex);
rBox.SetDistance(nSpace, nOOIndex);
diff --git a/sw/source/filter/xml/xmlithlp.cxx b/sw/source/filter/xml/xmlithlp.cxx
index 0902899899e6..d29853e2af17 100644
--- a/sw/source/filter/xml/xmlithlp.cxx
+++ b/sw/source/filter/xml/xmlithlp.cxx
@@ -218,10 +218,6 @@ sal_Bool lcl_frmitems_setXMLBorder( SvxBorderLine*& rpLine,
rpLine->GetOutWidth();
rpLine->SetWidth( nWidth );
- if (bDouble)
- { // fdo#38542: divide width by 3 for outer line, gap, inner line
- rpLine->ScaleMetrics(1, 3);
- }
}
}
lcl_frmitems_setXMLBorderStyle( *rpLine, nStyle );
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk
index 3644c427f260..5a34f94ae12c 100644
--- a/writerfilter/Library_writerfilter.mk
+++ b/writerfilter/Library_writerfilter.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,writerfilter,\
comphelper \
cppu \
cppuhelper \
+ editeng \
i18nisolang1 \
i18nutil \
msfilter \
diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx
index f4858f572c12..5bb53fd2e06d 100644
--- a/writerfilter/source/dmapper/BorderHandler.cxx
+++ b/writerfilter/source/dmapper/BorderHandler.cxx
@@ -44,7 +44,7 @@ using namespace ::com::sun::star;
BorderHandler::BorderHandler( bool bOOXML ) :
LoggedProperties(dmapper_logger, "BorderHandler"),
m_nCurrentBorderPosition( BORDER_TOP ),
-m_nLineWidth(26), // Word default
+m_nLineWidth(15), // Word default, in twips
m_nLineType(0),
m_nLineColor(0),
m_nLineDistance(0),
@@ -79,7 +79,7 @@ void BorderHandler::lcl_attribute(Id rName, Value & rVal)
break;
case NS_rtf::LN_DPTLINEWIDTH: // 0x2871
// width of a single line in 1/8 pt, max of 32 pt -> twip * 5 / 2.
- m_nLineWidth = ConversionHelper::convertTwipToMM100( nIntValue * 5 / 2 );
+ m_nLineWidth = nIntValue * 5 / 2;
break;
case NS_rtf::LN_BRCTYPE: // 0x2872
m_nLineType = nIntValue;
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index cc6a88a1c294..bb060eb559cd 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/style/NumberingType.hpp>
+#include <editeng/borderline.hxx>
#include <ooxml/resourceids.hxx>
#include <rtl/ustrbuf.hxx>
#include <tools/color.hxx>
@@ -121,8 +122,7 @@ sal_Int32 MakeBorderLine( sal_Int32 nSprmValue, table::BorderLine2& rToFill )
sal_Int32 nLineType = ((nSprmValue & 0xff00) >> 8);
sal_Int32 nLineColor = (nSprmValue & 0xff0000)>>16;
sal_Int32 nLineDistance = (((nSprmValue & 0x3f000000)>>24) * 2540 + 36)/72L;
- sal_Int32 nLineThickness = TWIP_TO_MM100(nLineThicknessTwip);
- MakeBorderLine( nLineThickness, nLineType, nLineColor, rToFill, false);
+ MakeBorderLine( nLineThicknessTwip, nLineType, nLineColor, rToFill, false);
return nLineDistance;
}
void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineType,
@@ -213,7 +213,9 @@ void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineType,
}
rToFill.LineStyle = nLineStyle;
- rToFill.LineWidth = sal_uInt32( nLineThickness );
+ double const fConverted( (NONE == nLineStyle) ? 0.0 :
+ ::editeng::ConvertBorderWidthFromWord(nLineStyle, nLineThickness));
+ rToFill.LineWidth = convertTwipToMM100(fConverted);
rToFill.Color = nLineColor;
}
diff --git a/writerfilter/source/dmapper/MeasureHandler.cxx b/writerfilter/source/dmapper/MeasureHandler.cxx
index 1da16246254f..cbb4f081cb45 100644
--- a/writerfilter/source/dmapper/MeasureHandler.cxx
+++ b/writerfilter/source/dmapper/MeasureHandler.cxx
@@ -104,7 +104,9 @@ sal_Int32 MeasureHandler::getMeasureValue() const
{
// TODO m_nUnit 3 - twip, other values unknown :-(
if( m_nUnit == 3 || sal::static_int_cast<Id>(m_nUnit) == NS_ooxml::LN_Value_ST_TblWidth_dxa)
+ {
nRet = ConversionHelper::convertTwipToMM100( m_nMeasureValue );
+ }
//todo: handle additional width types:
//NS_ooxml::LN_Value_ST_TblWidth_nil, NS_ooxml::LN_Value_ST_TblWidth_pct,
//NS_ooxml::LN_Value_ST_TblWidth_dxa, NS_ooxml::LN_Value_ST_TblWidth_auto;
diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx b/writerfilter/source/dmapper/TDefTableHandler.cxx
index 9a45bec0d506..ca5947ded052 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -110,7 +110,7 @@ void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
//from LN_BRCXXXX - handled within the BorderHandler
case NS_rtf::LN_DPTLINEWIDTH: // 0x2871
// width of a single line in 1/8 pt, max of 32 pt -> twip * 5 / 2.
- m_nLineWidth = ConversionHelper::convertTwipToMM100( nIntValue * 5 / 2 );
+ m_nLineWidth = nIntValue * 5 / 2;
break;
case NS_rtf::LN_BRCTYPE: // 0x2872
m_nLineType = nIntValue;