[Libreoffice-commits] .: 2 commits - oox/source writerfilter/source
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Sat Mar 19 10:17:30 PDT 2011
oox/source/drawingml/table/tablecell.cxx | 2
writerfilter/source/dmapper/ConversionHelper.cxx | 191 ++++-------------------
2 files changed, 35 insertions(+), 158 deletions(-)
New commits:
commit fd5a4ee884716e8d50fe031d3f571210d3723fed
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Fri Feb 18 10:47:20 2011 +0100
Docx import filter now working with new borders and width
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index 57bee7d..f596739 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -27,6 +27,7 @@
************************************************************************/
#include <ConversionHelper.hxx>
#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/BorderLineStyle.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/style/NumberingType.hpp>
@@ -37,6 +38,7 @@
#include <functional>
using namespace com::sun::star;
+using namespace com::sun::star::table::BorderLineStyle;
namespace writerfilter {
namespace dmapper{
@@ -140,14 +142,7 @@ void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineType,
if(!bIsOOXML && sal::static_int_cast<sal_uInt32>(nLineColor) < SAL_N_ELEMENTS(aBorderDefColor))
nLineColor = aBorderDefColor[nLineColor];
- enum eBorderCode
- {
- single0, single1, single2, single3, single4, single5,
- double0, double1, double2, double3, double4, double5, double6,
- double7, double8, double9, double10,
- none, dashed, dotted
- } eCodeIdx = none;
-
+ sal_Int16 nLineStyle = NONE;
// Map to our border types, we should use of one equal line
// thickness, or one of smaller thickness. If too small we
// can make the defecit up in additional white space or
@@ -155,187 +150,69 @@ void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineType,
switch(nLineType)
{
// First the single lines
- case 1: break;
+ case 1:
case 2:
case 5:
+ nLineStyle = SOLID;
+ break;
// Dotted and dashed lines
case 6:
- eCodeIdx = dotted;
- break;
+ nLineStyle = DOTTED;
+ break;
case 7:
- eCodeIdx = dashed;
- break;
+ case 22:
+ nLineStyle = DASHED;
+ break;
// and the unsupported special cases which we map to a single line
case 8:
case 9:
- case 22:
- // or if in necessary by a double line
- case 24:
- case 25:
- if( nLineThickness < 10)
- eCodeIdx = single0;// 1 Twip for us
- else if( nLineThickness < 20)
- eCodeIdx = single5;// 10 Twips for us
- else if (nLineThickness < 50)
- eCodeIdx = single1;// 20 Twips
- else if (nLineThickness < 80)
- eCodeIdx = single2;// 50
- else if (nLineThickness < 100)
- eCodeIdx = single3;// 80
- else if (nLineThickness < 150)
- eCodeIdx = single4;// 100
- // Hack: for the quite thick lines we must paint double lines,
- // because our singles lines don't come thicker than 5 points.
- else if (nLineThickness < 180)
- eCodeIdx = double2;// 150
- else
- eCodeIdx = double5;// 180
- break;
- // then the shading beams which we represent by a double line
- case 23:
- eCodeIdx = double1;
- break;
- // then the double lines, for which we have good matches
- case 3:
+ case 20:
+ nLineStyle = SOLID;
+ break;
+ // Double line
+ case 3:
case 10: //Don't have tripple so use double
- if (nLineThickness < 60)
- eCodeIdx = double0;// 22 Twips for us
- else if (nLineThickness < 135)
- eCodeIdx = double7;// some more space
- else if (nLineThickness < 180)
- eCodeIdx = double1;// 60
- else
- eCodeIdx = double2;// 150
+ case 21:
+ case 23:
+ nLineStyle = DOUBLE;
break;
case 11:
- eCodeIdx = double4;// 90 Twips for us
+ case 13: //Don't have thin thick thin, so use thick thin
+ nLineStyle = THINTHICK_SMALLGAP;
break;
case 12:
- case 13: //Don't have thin thick thin, so use thick thin
- if (nLineThickness < 87)
- eCodeIdx = double8;// 71 Twips for us
- else if (nLineThickness < 117)
- eCodeIdx = double9;// 101
- else if (nLineThickness < 166)
- eCodeIdx = double10;// 131
- else
- eCodeIdx = double5;// 180
+ nLineStyle = THICKTHIN_SMALLGAP;
break;
case 14:
- if (nLineThickness < 46)
- eCodeIdx = double0;// 22 Twips for us
- else if (nLineThickness < 76)
- eCodeIdx = double1;// 60
- else if (nLineThickness < 121)
- eCodeIdx = double4;// 90
- else if (nLineThickness < 166)
- eCodeIdx = double2;// 150
- else
- eCodeIdx = double6;// 180
+ nLineStyle = THINTHICK_MEDIUMGAP;
break;
case 15:
case 16: //Don't have thin thick thin, so use thick thin
- if (nLineThickness < 46)
- eCodeIdx = double0;// 22 Twips for us
- else if (nLineThickness < 76)
- eCodeIdx = double1;// 60
- else if (nLineThickness < 121)
- eCodeIdx = double3;// 90
- else if (nLineThickness < 166)
- eCodeIdx = double2;// 150
- else
- eCodeIdx = double5;// 180
+ nLineStyle = THICKTHIN_MEDIUMGAP;
break;
case 17:
- if (nLineThickness < 46)
- eCodeIdx = double0;// 22 Twips for us
- else if (nLineThickness < 72)
- eCodeIdx = double7;// 52
- else if (nLineThickness < 137)
- eCodeIdx = double4;// 90
- else
- eCodeIdx = double6;// 180
- break;
+ nLineStyle = THINTHICK_LARGEGAP;
+ break;
case 18:
case 19: //Don't have thin thick thin, so use thick thin
- if (nLineThickness < 46)
- eCodeIdx = double0;// 22 Twips for us
- else if (nLineThickness < 62)
- eCodeIdx = double7;// 52
- else if (nLineThickness < 87)
- eCodeIdx = double8;// 71
- else if (nLineThickness < 117)
- eCodeIdx = double9;// 101
- else if (nLineThickness < 156)
- eCodeIdx = double10;// 131
- else
- eCodeIdx = double5;// 180
+ nLineStyle = THICKTHIN_LARGEGAP;
break;
- case 20:
- if (nLineThickness < 46)
- eCodeIdx = single1; // 20 Twips for us
- else
- eCodeIdx = double1;// 60
+ // Embossed and engraved lines
+ case 24:
+ nLineStyle = EMBOSSED;
break;
- case 21:
- eCodeIdx = double1;// 60 Twips for us
+ case 25:
+ nLineStyle = ENGRAVED;
break;
case 0:
case 255:
- eCodeIdx = none;
- break;
default:
- eCodeIdx = single0;
break;
}
- struct BorderDefinition
- {
- sal_Int16 nOut;
- sal_Int16 nIn;
- sal_Int16 nDist;
- sal_Int16 eStyle;
- };
-
-
- static const BorderDefinition aLineTab[] =
- {
- /* 0*/ { LINE_WIDTH_0, 0, 0, API_LINE_SOLID },
- /* 1*/ { LINE_WIDTH_1, 0, 0, API_LINE_SOLID },
- /* 2*/ { LINE_WIDTH_2, 0, 0, API_LINE_SOLID },
- /* 3*/ { LINE_WIDTH_3, 0, 0, API_LINE_SOLID },
- /* 4*/ { LINE_WIDTH_4, 0, 0, API_LINE_SOLID },
- /* 5*/ { LINE_WIDTH_5, 0, 0, API_LINE_SOLID },
- /* 6*/ { DOUBLE_LINE0_OUT, DOUBLE_LINE0_IN, DOUBLE_LINE0_DIST, API_LINE_SOLID },
- /* 7*/ { DOUBLE_LINE1_OUT, DOUBLE_LINE1_IN, DOUBLE_LINE1_DIST, API_LINE_SOLID },
- /* 8*/ { DOUBLE_LINE2_OUT, DOUBLE_LINE2_IN, DOUBLE_LINE2_DIST, API_LINE_SOLID },
- /* 9*/ { DOUBLE_LINE3_OUT, DOUBLE_LINE3_IN, DOUBLE_LINE3_DIST, API_LINE_SOLID },
- /*10*/ { DOUBLE_LINE4_OUT, DOUBLE_LINE4_IN, DOUBLE_LINE4_DIST, API_LINE_SOLID },
- /*11*/ { DOUBLE_LINE5_OUT, DOUBLE_LINE5_IN, DOUBLE_LINE5_DIST, API_LINE_SOLID },
- /*12*/ { DOUBLE_LINE6_OUT, DOUBLE_LINE6_IN, DOUBLE_LINE6_DIST, API_LINE_SOLID },
- /*13*/ { DOUBLE_LINE7_OUT, DOUBLE_LINE7_IN, DOUBLE_LINE7_DIST, API_LINE_SOLID },
- /*14*/ { DOUBLE_LINE8_OUT, DOUBLE_LINE8_IN, DOUBLE_LINE8_DIST, API_LINE_SOLID },
- /*15*/ { DOUBLE_LINE9_OUT, DOUBLE_LINE9_IN, DOUBLE_LINE9_DIST, API_LINE_SOLID },
- /*16*/ { DOUBLE_LINE10_OUT,DOUBLE_LINE10_IN,DOUBLE_LINE10_DIST, API_LINE_SOLID},
- /*17*/ { 0, 0, 0, API_LINE_SOLID },
- /*18*/ { LINE_WIDTH_5, 0, 0, API_LINE_DASHED },
- /*19*/ { LINE_WIDTH_5, 0, 0, API_LINE_DOTTED }
- };
+ rToFill.LineStyle = nLineStyle;
+ rToFill.LineWidth = sal_uInt32( nLineThickness );
rToFill.Color = nLineColor;
- if( nLineType == 1)
- {
- rToFill.InnerLineWidth = 0;
- rToFill.OuterLineWidth = sal_Int16(nLineThickness);
- rToFill.LineDistance = 0;
- rToFill.LineStyle = API_LINE_SOLID;
- }
- else
- {
- rToFill.InnerLineWidth = aLineTab[eCodeIdx].nIn;
- rToFill.OuterLineWidth = aLineTab[eCodeIdx].nOut;
- rToFill.LineDistance = aLineTab[eCodeIdx].nDist;
- rToFill.LineStyle = aLineTab[eCodeIdx].eStyle;
- }
}
void lcl_SwapQuotesInField(::rtl::OUString &rFmt)
commit 75a47a5d2c39886805b95538c1f81d570412947d
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Tue Jan 11 12:08:14 2011 +0100
Using BorderLine2 constructor w/o argument
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 95ed630..3d875a0 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -74,7 +74,7 @@ void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
Reference< XPropertySet >& rxPropSet, oox::drawingml::LineProperties& rLineProperties,
sal_Int32 nPropId )
{
- BorderLine2 aBorderLine( 0, 0, 0, 0, API_LINE_SOLID );
+ BorderLine2 aBorderLine;
if( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ) )
{
Color aColor = rLineProperties.maLineFill.getBestSolidColor();
More information about the Libreoffice-commits
mailing list