diff options
author | Eilidh McAdam <eilidh@lanedo.com> | 2012-11-15 00:29:58 +0000 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-05-30 16:51:53 +0200 |
commit | 487e34c741231b939b314442b091edb6ab7216a8 (patch) | |
tree | 4b91e0ac0ee72d9fcc73fa29ae77a1ea4989a0b3 | |
parent | c2bd5aab1ccd7c58b59b3fc8d29a0f055bb466e7 (diff) |
Support added for fine dashing on table borders.
When reading in docx documents, fine dashing provides a better visual
match for some border types.
Added in this patch:
- FINE_DASHED in BorderLineStyle UNO enum and in internals
- Import of docx table borders using this border style
Change-Id: I39cfa18c915ec94d8e4ecfc6a2ca637076d1e468
Reviewed-on: https://gerrit.libreoffice.org/1123
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
(cherry picked from commit 7d632ff29e601c2e680c4a689997fbf552592a4b)
-rw-r--r-- | editeng/source/items/borderline.cxx | 11 | ||||
-rw-r--r-- | editeng/source/items/frmitems.cxx | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/table/BorderLineStyle.idl | 8 | ||||
-rw-r--r-- | svtools/inc/svtools/ctrlbox.hxx | 1 | ||||
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 7 |
5 files changed, 27 insertions, 2 deletions
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 6fdefe2f8e47..0ce62a7d4c62 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -140,9 +140,11 @@ ConvertBorderStyleFromWord(int const nWordLineStyle) return DOTTED; break; case 7: - case 22: return DASHED; break; + case 22: + return FINE_DASHED; + break; // then the shading beams which we represent by a double line case 23: return DOUBLE; @@ -228,6 +230,10 @@ ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth, case DOTTED: case DASHED: return fWidth; + + // Display a minimum effective border width of 1pt + case FINE_DASHED: + return (fWidth > 0 && fWidth < 20) ? 20 : fWidth; break; // Double lines @@ -282,6 +288,7 @@ ConvertBorderWidthToWord(SvxBorderStyle const eStyle, double const fWidth) case SOLID: case DOTTED: case DASHED: + case FINE_DASHED: return fWidth; break; @@ -347,6 +354,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) case SOLID: case DOTTED: case DASHED: + case FINE_DASHED: aImpl = BorderWidthImpl( CHANGE_LINE1, 1.0 ); break; @@ -526,6 +534,7 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sa case SOLID: case DOTTED: case DASHED: + case FINE_DASHED: ::std::swap( nOut, nIn); break; default: diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index dbcde63d82a9..c1953dff4dd0 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1808,7 +1808,7 @@ sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) { SvxBorderStyle const nStyle = - (rLine.LineStyle < 0 || INSET < rLine.LineStyle) + (rLine.LineStyle < 0 || BORDER_LINE_STYLE_MAX < rLine.LineStyle) ? SOLID // default : rLine.LineStyle; diff --git a/offapi/com/sun/star/table/BorderLineStyle.idl b/offapi/com/sun/star/table/BorderLineStyle.idl index 29cfe0d6b5d1..781473e366d6 100644 --- a/offapi/com/sun/star/table/BorderLineStyle.idl +++ b/offapi/com/sun/star/table/BorderLineStyle.idl @@ -101,6 +101,14 @@ constants BorderLineStyle /** Inset border line. */ const short INSET = 13; + + /** Finely dashed border line. + */ + const short FINE_DASHED = 14; + + /** Maximum valid border line style value. + */ + const short BORDER_LINE_STYLE_MAX = 14; }; //============================================================================= diff --git a/svtools/inc/svtools/ctrlbox.hxx b/svtools/inc/svtools/ctrlbox.hxx index 5cb20efb26f5..dac419d0265a 100644 --- a/svtools/inc/svtools/ctrlbox.hxx +++ b/svtools/inc/svtools/ctrlbox.hxx @@ -54,6 +54,7 @@ typedef ::std::vector< ImplFontNameListData* > ImplFontList; #define STYLE_SOLID ( ( sal_uInt16 ) 0 ) #define STYLE_DOTTED ( ( sal_uInt16 ) 1 ) #define STYLE_DASHED ( ( sal_uInt16 ) 2 ) +#define STYLE_FINE_DASHED ( ( sal_uInt16 ) 14 ) #define STYLE_NONE ( ( sal_uInt16 ) -1) #define CHANGE_LINE1 ( ( sal_uInt16 ) 1 ) diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 4a44d0314c8e..554cbf30c372 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -596,6 +596,13 @@ namespace svtools aPattern.push_back( 20 ); } break; + case STYLE_FINE_DASHED: + if ( eUnit == MAP_PIXEL ) + { + aPattern.push_back( 4 ); + aPattern.push_back( 1 ); + } + break; default: break; } |