summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.cz>2012-11-05 14:34:27 +0100
committerPetr Mladek <pmladek@suse.cz>2012-11-05 14:34:27 +0100
commitef15a5a4acd3174752484c6aeb570d4d6444b645 (patch)
tree3d1d5b58f85737aa46241aea4c4dabea520cecc2 /editeng
parenta1b0ce05e851e9724c046888a01869eddf9e9db2 (diff)
parentc309ce0227a14330094191c1ef15fa00899defcb (diff)
Merge remote-tracking branch 'origin/libreoffice-3-6-3' into suse-3.6
Conflicts: desktop/source/app/sofficemain.cxx instsetoo_native/util/openoffice.lst solenv/inc/minor.mk Change-Id: I3e9510067c7173f6c71368e70ba6dfe168c5318e
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editeng/borderline.hxx5
-rw-r--r--editeng/source/editeng/editdoc.hxx2
-rw-r--r--editeng/source/editeng/impedit3.cxx17
-rw-r--r--editeng/source/items/borderline.cxx89
4 files changed, 98 insertions, 15 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/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index a97fcecd8538..d952e6a5f6d2 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -535,7 +535,7 @@ public:
sal_uInt16 GetLen() const { return nEnd - nStart; }
sal_uInt16 GetStartPosX() const { return nStartPosX; }
- void SetStartPosX( sal_uInt16 start ) { nStartPosX = start; }
+ void SetStartPosX( long start ) { if (start > 0) nStartPosX = start; else nStartPosX = 0; }
Size CalcTextSize( ParaPortion& rParaPortion );
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index a4441c47b210..59c70bfc73b9 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1414,11 +1414,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
{
long n = ( nMaxLineWidth - aTextSize.Width() ) / 2;
n += nStartX; // Indentation is kept.
- if ( n > 0 )
- pLine->SetStartPosX( (sal_uInt16)n );
- else
- pLine->SetStartPosX( 0 );
-
+ pLine->SetStartPosX( n );
}
break;
case SVX_ADJUST_RIGHT:
@@ -1427,24 +1423,21 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
// the blank must not be displayed!
long n = nMaxLineWidth - aTextSize.Width();
n += nStartX; // Indentation is kept.
- if ( n > 0 )
- pLine->SetStartPosX( (sal_uInt16)n );
- else
- pLine->SetStartPosX( 0 );
+ pLine->SetStartPosX( n );
}
break;
case SVX_ADJUST_BLOCK:
{
bool bDistLastLine = (GetJustifyMethod(nPara) == SVX_JUSTIFY_METHOD_DISTRIBUTE);
long nRemainingSpace = nMaxLineWidth - aTextSize.Width();
- pLine->SetStartPosX( (sal_uInt16)nStartX );
+ pLine->SetStartPosX( nStartX );
if ( nRemainingSpace > 0 && (!bEOC || bDistLastLine) )
ImpAdjustBlocks( pParaPortion, pLine, nRemainingSpace );
}
break;
default:
{
- pLine->SetStartPosX( (sal_uInt16)nStartX ); // FI, LI
+ pLine->SetStartPosX( nStartX ); // FI, LI
}
break;
}
@@ -1467,7 +1460,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( GetTextRanger() )
{
if ( nTextXOffset )
- pLine->SetStartPosX( (sal_uInt16) ( pLine->GetStartPosX() + nTextXOffset ) );
+ pLine->SetStartPosX( pLine->GetStartPosX() + nTextXOffset );
if ( nTextExtraYOffset )
{
pLine->SetHeight( (sal_uInt16) ( pLine->GetHeight() + nTextExtraYOffset ), 0, pLine->GetHeight() );
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 9f538c2a5bd4..6fdefe2f8e47 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -120,6 +120,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: // hairline
+ // 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;
@@ -132,12 +204,27 @@ 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)
{
// Single lines
case SOLID:
+ switch (nWordLineStyle)
+ {
+ case 2:
+ return (fWidth * 2.0); // thick
+ break;
+ case 5: // fdo#55526: map 0 hairline width to > 0
+ return (fWidth > 1.0) ? fWidth : 1.0;
+ break;
+ default:
+ return fWidth;
+ break;
+ }
+ break;
+
case DOTTED:
case DASHED:
return fWidth;