diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-10-09 17:27:52 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-10-09 18:00:36 +0200 |
commit | ecd70a727d7f559ebda1dd726cea1be472948270 (patch) | |
tree | a7ffb138a80b3aa88600a57cd58f0e3f39b2967c /editeng | |
parent | c1d2eed375293d7c27bb885f344cc24ec0cd40ca (diff) |
add editeng::ConvertBorderWidthFromWord:
Replace the 2 duplicate implementations of this in ww8 and writerfilter
with a common one. Differences were:
2) ww8 doubles the with, writerfilter does not
13) unsupported, mapped to THINTHICK_SMALLGAP vs. THICKTHIN_SMALLGAP
22) unsupported, mapped to DASHED vs. SOLID
26) INSET not supported in writerfilter
27) OUTSET not supported in writerfilter
Change-Id: I533b77394388e736f38d70284a6a11061d81e813
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/borderline.hxx | 5 | ||||
-rw-r--r-- | editeng/source/items/borderline.cxx | 77 |
2 files changed, 79 insertions, 3 deletions
diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx index 7d18587e78fb..4bb4388243ea 100644 --- a/editeng/inc/editeng/borderline.hxx +++ b/editeng/inc/editeng/borderline.hxx @@ -52,9 +52,12 @@ namespace editeng { // values from ::com::sun::star::table::BorderLineStyle typedef sal_Int16 SvxBorderStyle; + // convert border style between Word formats and LO + SvxBorderStyle EDITENG_DLLPUBLIC ConvertBorderStyleFromWord(int); /// convert border width in twips between Word formats and LO double EDITENG_DLLPUBLIC ConvertBorderWidthToWord(SvxBorderStyle, double); - double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderStyle, double); + double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderStyle, + double, int); class EDITENG_DLLPUBLIC SvxBorderLine { diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 704bbfa8d12e..f81493a4a0c4 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -117,6 +117,78 @@ SvxBorderLine::SvxBorderLine( const Color *pCol, long nWidth, aColor = *pCol; } + +SvxBorderStyle +ConvertBorderStyleFromWord(int const nWordLineStyle) +{ + switch (nWordLineStyle) + { + // First the single lines + case 1: + case 2: // thick line + case 5: + // and the unsupported special cases which we map to a single line + case 8: + case 9: + case 20: + return SOLID; + break; + case 6: + return DOTTED; + break; + case 7: + case 22: + return DASHED; + break; + // then the shading beams which we represent by a double line + case 23: + return DOUBLE; + break; + // then the double lines, for which we have good matches + case 3: + case 10: // Don't have triple so use double + case 21: // Don't have double wave: use double instead + return DOUBLE; + break; + case 11: + return THINTHICK_SMALLGAP; + break; + case 12: + case 13: // Don't have thin thick thin, so use thick thin + return THICKTHIN_SMALLGAP; + break; + case 14: + return THINTHICK_MEDIUMGAP; + break; + case 15: + case 16: // Don't have thin thick thin, so use thick thin + return THICKTHIN_MEDIUMGAP; + break; + case 17: + return THINTHICK_LARGEGAP; + break; + case 18: + case 19: // Don't have thin thick thin, so use thick thin + return THICKTHIN_LARGEGAP; + break; + case 24: + return EMBOSSED; + break; + case 25: + return ENGRAVED; + break; + case 26: + return OUTSET; + break; + case 27: + return INSET; + break; + default: + return NONE; + break; + } +} + static const double THINTHICK_SMALLGAP_line2 = 15.0; static const double THINTHICK_SMALLGAP_gap = 15.0; static const double THINTHICK_LARGEGAP_line1 = 30.0; @@ -129,7 +201,8 @@ static const double OUTSET_line1 = 15.0; static const double INSET_line2 = 15.0; double -ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth) +ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth, + int const nWordLineStyle) { switch (eStyle) { @@ -137,7 +210,7 @@ ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth) case SOLID: case DOTTED: case DASHED: - return fWidth; + return (2 == nWordLineStyle) ? (fWidth * 2.0) : fWidth; break; // Double lines |