diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 4b425372dff3..57fab72a762b 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1411,97 +1411,6 @@ void SwWW8ImplReader::ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp ) } } -const WW8_BordersSO &WW8_BordersSO::Get0x01LineMatch(eBorderCode eCode) -{ - /* - // Linien-Defaults in Twips: fruehere Writer-Defaults, - // siehe auch - #define DEF_LINE_WIDTH_0 1 - #define DEF_LINE_WIDTH_1 20 - #define DEF_LINE_WIDTH_2 50 - #define DEF_LINE_WIDTH_3 80 - #define DEF_LINE_WIDTH_4 100 - #define DEF_LINE_WIDTH_5 10 - - #define DEF_MAX_LINE_WIDHT DEF_LINE_WIDTH_4 - #define DEF_MAX_LINE_DIST DEF_LINE_WIDTH_2 - - #define DEF_DOUBLE_LINE0_OUT DEF_LINE_WIDTH_0 - #define DEF_DOUBLE_LINE0_IN DEF_LINE_WIDTH_0 - #define DEF_DOUBLE_LINE0_DIST DEF_LINE_WIDTH_1 - - #define DEF_DOUBLE_LINE1_OUT DEF_LINE_WIDTH_1 - #define DEF_DOUBLE_LINE1_IN DEF_LINE_WIDTH_1 - #define DEF_DOUBLE_LINE1_DIST DEF_LINE_WIDTH_1 - - #define DEF_DOUBLE_LINE2_OUT DEF_LINE_WIDTH_2 - #define DEF_DOUBLE_LINE2_IN DEF_LINE_WIDTH_2 - #define DEF_DOUBLE_LINE2_DIST DEF_LINE_WIDTH_2 - - #define DEF_DOUBLE_LINE3_OUT DEF_LINE_WIDTH_2 - #define DEF_DOUBLE_LINE3_IN DEF_LINE_WIDTH_1 - #define DEF_DOUBLE_LINE3_DIST DEF_LINE_WIDTH_2 - - #define DEF_DOUBLE_LINE4_OUT DEF_LINE_WIDTH_1 - #define DEF_DOUBLE_LINE4_IN DEF_LINE_WIDTH_2 - #define DEF_DOUBLE_LINE4_DIST DEF_LINE_WIDTH_1 - - #define DEF_DOUBLE_LINE5_OUT DEF_LINE_WIDTH_3 - #define DEF_DOUBLE_LINE5_IN DEF_LINE_WIDTH_2 - #define DEF_DOUBLE_LINE5_DIST DEF_LINE_WIDTH_2 - - #define DEF_DOUBLE_LINE6_OUT DEF_LINE_WIDTH_2 - #define DEF_DOUBLE_LINE6_IN DEF_LINE_WIDTH_3 - #define DEF_DOUBLE_LINE6_DIST DEF_LINE_WIDTH_2 - - #define DEF_DOUBLE_LINE7_OUT DEF_LINE_WIDTH_0 - #define DEF_DOUBLE_LINE7_IN DEF_LINE_WIDTH_0 - #define DEF_DOUBLE_LINE7_DIST DEF_LINE_WIDTH_2 - - #define DEF_DOUBLE_LINE8_OUT DEF_LINE_WIDTH_1 - #define DEF_DOUBLE_LINE8_IN DEF_LINE_WIDTH_0 - #define DEF_DOUBLE_LINE8_DIST DEF_LINE_WIDTH_2 - - #define DEF_DOUBLE_LINE9_OUT DEF_LINE_WIDTH_2 - #define DEF_DOUBLE_LINE9_IN DEF_LINE_WIDTH_0 - #define DEF_DOUBLE_LINE9_DIST DEF_LINE_WIDTH_2 - - #define DEF_DOUBLE_LINE10_OUT DEF_LINE_WIDTH_3 - #define DEF_DOUBLE_LINE10_IN DEF_LINE_WIDTH_0 - #define DEF_DOUBLE_LINE10_DIST DEF_LINE_WIDTH_2 - */ - // Deklarationen gemaess BOXITEM.HXX - static const WW8_BordersSO aLineTabVer8[] = - { -/* 0*/ { DEF_LINE_WIDTH_0, 0, 0, SOLID }, -/* 1*/ { DEF_LINE_WIDTH_1, 0, 0, SOLID }, -/* 2*/ { DEF_LINE_WIDTH_2, 0, 0, SOLID }, -/* 3*/ { DEF_LINE_WIDTH_3, 0, 0, SOLID }, -/* 4*/ { DEF_LINE_WIDTH_4, 0, 0, SOLID }, -/* 5*/ { DEF_LINE_WIDTH_5, 0, 0, SOLID }, -/* 6*/ { DEF_DOUBLE_LINE0_OUT, DEF_DOUBLE_LINE0_IN, DEF_DOUBLE_LINE0_DIST, SOLID }, -/* 7*/ { DEF_DOUBLE_LINE1_OUT, DEF_DOUBLE_LINE1_IN, DEF_DOUBLE_LINE1_DIST, SOLID }, -/* 8*/ { DEF_DOUBLE_LINE2_OUT, DEF_DOUBLE_LINE2_IN, DEF_DOUBLE_LINE2_DIST, SOLID }, -/* 9*/ { DEF_DOUBLE_LINE3_OUT, DEF_DOUBLE_LINE3_IN, DEF_DOUBLE_LINE3_DIST, SOLID }, -/*10*/ { DEF_DOUBLE_LINE4_OUT, DEF_DOUBLE_LINE4_IN, DEF_DOUBLE_LINE4_DIST, SOLID }, -/*11*/ { DEF_DOUBLE_LINE5_OUT, DEF_DOUBLE_LINE5_IN, DEF_DOUBLE_LINE5_DIST, SOLID }, -/*12*/ { DEF_DOUBLE_LINE6_OUT, DEF_DOUBLE_LINE6_IN, DEF_DOUBLE_LINE6_DIST, SOLID }, -/*13*/ { DEF_DOUBLE_LINE7_OUT, DEF_DOUBLE_LINE7_IN, DEF_DOUBLE_LINE7_DIST, SOLID }, -/*14*/ { DEF_DOUBLE_LINE8_OUT, DEF_DOUBLE_LINE8_IN, DEF_DOUBLE_LINE8_DIST, SOLID }, -/*15*/ { DEF_DOUBLE_LINE9_OUT, DEF_DOUBLE_LINE9_IN, DEF_DOUBLE_LINE9_DIST, SOLID }, -/*16*/ { DEF_DOUBLE_LINE10_OUT,DEF_DOUBLE_LINE10_IN,DEF_DOUBLE_LINE10_DIST, SOLID}, -/*17*/ { DEF_LINE_WIDTH_5, 0, 0, DASHED }, -/*18*/ { DEF_LINE_WIDTH_5, 0, 0, DOTTED }, -/*19*/ { DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1, EMBOSSED }, -/*20*/ { DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1, ENGRAVED } - }; - size_t nPos = static_cast(eCode); - OSL_ENSURE(nPos < sizeof(aLineTabVer8), "Impossible"); - if (nPos >= sizeof(aLineTabVer8)) - eCode = single0; - return aLineTabVer8[eCode]; -} - sal_Int32 SwMSDffManager::GetEscherLineMatch(MSO_LineStyle eStyle, MSO_SPT eShapeType, sal_Int32 &rThick) { @@ -1569,7 +1478,7 @@ sal_Int32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor, if( !rLineThick ) return nOutsideThick; - WW8_BordersSO::eBorderCode nIdx = WW8_BordersSO::none; + SvxBorderStyle nIdx = SOLID; sal_Int32 nLineThick=rLineThick; nOutsideThick = SwMSDffManager::GetEscherLineMatch(eLineStyle, @@ -1590,63 +1499,21 @@ sal_Int32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor, { // zuerst die Einzel-Linien case mso_lineSimple: - if (nLineThick < 10) - nIdx = WW8_BordersSO::single0;// 1 Twip bei uns - else if (nLineThick < 20) - nIdx = WW8_BordersSO::single5;// 10 Twips bei uns - else if (nLineThick < 50) - nIdx = WW8_BordersSO::single1;// 20 Twips - else if (nLineThick < 80) - nIdx = WW8_BordersSO::single2;// 50 - else if (nLineThick < 100) - nIdx = WW8_BordersSO::single3;// 80 - else if (nLineThick <150) - nIdx = WW8_BordersSO::single4;// 100 - // Pfusch: fuer die ganz dicken Linien muessen wir doppelte Linien - // malen, weil unsere Einfach-Linie nicht dicker als 5 Punkt wird - else if (nLineThick <180) - nIdx = WW8_BordersSO::double2;// 150 - else - nIdx = WW8_BordersSO::double5;// 180 + nIdx = SOLID; break; // dann die Doppel-Linien, fuer die wir feine Entsprechungen haben :-))) case mso_lineDouble: - if (nLineThick < 60) - nIdx = WW8_BordersSO::double0;// 22 Twips bei uns - else if (nLineThick < 135) - nIdx = WW8_BordersSO::double7;// some more space - else if (nLineThick < 180) - nIdx = WW8_BordersSO::double1;// 60 - else - nIdx = WW8_BordersSO::double2;// 150 + nIdx = DOUBLE; break; case mso_lineThickThin: - if (nLineThick < 87) - nIdx = WW8_BordersSO::double8;// 71 Twips bei uns - else if (nLineThick < 117) - nIdx = WW8_BordersSO::double9;// 101 - else if (nLineThick < 166) - nIdx = WW8_BordersSO::double10;// 131 - else - nIdx = WW8_BordersSO::double5;// 180 + nIdx = THICKTHIN_SMALLGAP; break; case mso_lineThinThick: - if (nLineThick < 137) - nIdx = WW8_BordersSO::double4;// 90 Twips bei uns - else - nIdx = WW8_BordersSO::double6;// 180 + nIdx = THINTHICK_SMALLGAP; break; - // zu guter Letzt die Dreifach-Linien, an deren Stelle wir eine - // Doppel-Linie setzen + // We have no triple border, use double instead. case mso_lineTriple: - if (nLineThick < 46) - nIdx = WW8_BordersSO::double0;// 22 Twips bei uns - else if (nLineThick < 106) - nIdx = WW8_BordersSO::double1;// 60 - else if (nLineThick < 166) - nIdx = WW8_BordersSO::double2;// 150 - else - nIdx = WW8_BordersSO::double5;// 180 + nIdx = DOUBLE; break; // no line style is set case (MSO_LineStyle)USHRT_MAX: @@ -1660,26 +1527,22 @@ sal_Int32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor, switch( eDashing ) { case mso_lineDashGEL: - nIdx = WW8_BordersSO::dashed; + nIdx = DASHED; break; case mso_lineDotGEL: - nIdx = WW8_BordersSO::dotted; + nIdx = DOTTED; break; default: break; } - if (WW8_BordersSO::none != nIdx) + if (NONE != nIdx) { SvxBorderLine aLine; aLine.SetColor( rLineColor ); - const WW8_BordersSO& rBorders = WW8_BordersSO::Get0x01LineMatch(nIdx); - - aLine.SetOutWidth(rBorders.mnOut); - aLine.SetInWidth (rBorders.mnIn); - aLine.SetDistance(rBorders.mnDist); - aLine.SetStyle( rBorders.mnType ); + aLine.SetWidth( long ( nLineThick / 65 ) ); // Convert EMUs to Twips + aLine.SetStyle( nIdx ); 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 1fd0289f0cfe..4caeadea530c 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -1276,8 +1276,6 @@ sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRC* brc, WW8PLCFx_Cp_FKP* pPap, void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt8 nCol, short nIdx, sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, short *pSize=0) { - WW8_BordersSO::eBorderCode eCodeIdx; - //Word mirrors some indexes inside outside depending on its position, we //don't do that, so flip them here if (nWWIndex == WW8_TOP || nWWIndex == WW8_LEFT) @@ -1303,18 +1301,9 @@ void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt } } - // 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 - // object size + SvxBorderStyle eStyle = SOLID; switch (nIdx) { - case 6: - eCodeIdx = WW8_BordersSO::dotted; - break; - case 7: - eCodeIdx = WW8_BordersSO::dashed; - break; // First the single lines case 1: case 2: @@ -1322,113 +1311,61 @@ void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt // and the unsupported special cases which we map to a single line case 8: case 9: + case 20: case 22: - // or if in necessary by a double line - case 24: - eCodeIdx = WW8_BordersSO::emboss; - case 25: - eCodeIdx = WW8_BordersSO::engrave; - break; + eStyle = SOLID; + break; + case 6: + eStyle = DOTTED; + break; + case 7: + eStyle = DASHED; + break; // then the shading beams which we represent by a double line case 23: - eCodeIdx = WW8_BordersSO::double1; - break; + eStyle = DOUBLE; + break; // then the double lines, for which we have good matches case 3: case 10: //Don't have tripple so use double - if (nLineThickness < 60) - eCodeIdx = WW8_BordersSO::double0;// 22 Twips for us - else if (nLineThickness < 135) - eCodeIdx = WW8_BordersSO::double7;// some more space - else if (nLineThickness < 180) - eCodeIdx = WW8_BordersSO::double1;// 60 - else - eCodeIdx = WW8_BordersSO::double2;// 150 + case 21: //Don't have double wave: use double instead + eStyle = DOUBLE; break; case 11: - eCodeIdx = WW8_BordersSO::double4;// 90 Twips for us + eStyle = THINTHICK_SMALLGAP; break; case 12: case 13: //Don't have thin thick thin, so use thick thin - if (nLineThickness < 87) - eCodeIdx = WW8_BordersSO::double8;// 71 Twips for us - else if (nLineThickness < 117) - eCodeIdx = WW8_BordersSO::double9;// 101 - else if (nLineThickness < 166) - eCodeIdx = WW8_BordersSO::double10;// 131 - else - eCodeIdx = WW8_BordersSO::double5;// 180 + eStyle = THICKTHIN_SMALLGAP; break; case 14: - if (nLineThickness < 46) - eCodeIdx = WW8_BordersSO::double0;// 22 Twips for us - else if (nLineThickness < 76) - eCodeIdx = WW8_BordersSO::double1;// 60 - else if (nLineThickness < 121) - eCodeIdx = WW8_BordersSO::double4;// 90 - else if (nLineThickness < 166) - eCodeIdx = WW8_BordersSO::double2;// 150 - else - eCodeIdx = WW8_BordersSO::double6;// 180 + eStyle = THINTHICK_MEDIUMGAP; break; case 15: case 16: //Don't have thin thick thin, so use thick thin - if (nLineThickness < 46) - eCodeIdx = WW8_BordersSO::double0;// 22 Twips for us - else if (nLineThickness < 76) - eCodeIdx = WW8_BordersSO::double1;// 60 - else if (nLineThickness < 121) - eCodeIdx = WW8_BordersSO::double3;// 90 - else if (nLineThickness < 166) - eCodeIdx = WW8_BordersSO::double2;// 150 - else - eCodeIdx = WW8_BordersSO::double5;// 180 + eStyle = THICKTHIN_MEDIUMGAP; break; case 17: - if (nLineThickness < 46) - eCodeIdx = WW8_BordersSO::double0;// 22 Twips for us - else if (nLineThickness < 72) - eCodeIdx = WW8_BordersSO::double7;// 52 - else if (nLineThickness < 137) - eCodeIdx = WW8_BordersSO::double4;// 90 - else - eCodeIdx = WW8_BordersSO::double6;// 180 - break; + eStyle = THINTHICK_LARGEGAP; + break; case 18: case 19: //Don't have thin thick thin, so use thick thin - if (nLineThickness < 46) - eCodeIdx = WW8_BordersSO::double0;// 22 Twips for us - else if (nLineThickness < 62) - eCodeIdx = WW8_BordersSO::double7;// 52 - else if (nLineThickness < 87) - eCodeIdx = WW8_BordersSO::double8;// 71 - else if (nLineThickness < 117) - eCodeIdx = WW8_BordersSO::double9;// 101 - else if (nLineThickness < 156) - eCodeIdx = WW8_BordersSO::double10;// 131 - else - eCodeIdx = WW8_BordersSO::double5;// 180 + eStyle = THICKTHIN_LARGEGAP; break; - case 20: - if (nLineThickness < 46) - eCodeIdx = WW8_BordersSO::single1; // 20 Twips for us - else - eCodeIdx = WW8_BordersSO::double1;// 60 + case 24: + eStyle = EMBOSSED; break; - case 21: - eCodeIdx = WW8_BordersSO::double1;// 60 Twips for us + case 25: + eStyle = ENGRAVED; break; default: - eCodeIdx = WW8_BordersSO::single0; + eStyle = SOLID; break; } - const WW8_BordersSO& rBorders = WW8_BordersSO::Get0x01LineMatch(eCodeIdx); SvxBorderLine aLine; - aLine.SetOutWidth(rBorders.mnOut); - aLine.SetInWidth(rBorders.mnIn); - aLine.SetDistance(rBorders.mnDist); - aLine.SetStyle( rBorders.mnType ); + aLine.SetStyle( eStyle ); + aLine.SetWidth( long( nLineThickness * 2.5 ) ); // Convert 1/8th pt into twips //No AUTO for borders as yet, so if AUTO, use BLACK if (nCol == 0) diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index b785333a72dd..6ac5461c9c56 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -284,25 +284,6 @@ enum BRC_Sides WW8_TOP = 0, WW8_LEFT = 1, WW8_BOT = 2, WW8_RIGHT = 3, WW8_BETW = 4 }; -class WW8_BordersSO // for StarOffice-Border Code -{ -public: - sal_uInt16 mnOut; - sal_uInt16 mnIn; - sal_uInt16 mnDist; - SvxBorderStyle mnType; -public: - enum eBorderCode - { - single0, single1, single2, single3, single4, single5, - double0, double1, double2, double3, double4, double5, double6, - double7, double8, double9, double10, - dashed, dotted, emboss, engrave, - none - }; - static const WW8_BordersSO &Get0x01LineMatch(eBorderCode nIdx); -}; - /* Document Typography Info (DOPTYPOGRAPHY) These options are Far East only, and are accessible through the Typography tab of the Tools/Options dialog.