Reworked the html filter
This commit is contained in:
parent
8b2c2ca258
commit
0f5f87f9b6
5 changed files with 27 additions and 124 deletions
|
@ -488,21 +488,8 @@ IMAGE_SETEVENT:
|
|||
nVBorderWidth = (long)nBorder;
|
||||
SvxCSS1Parser::PixelToTwip( nVBorderWidth, nHBorderWidth );
|
||||
|
||||
SvxBorderLine aHBorderLine;
|
||||
SvxBorderLine aVBorderLine;
|
||||
|
||||
SvxCSS1Parser::SetBorderWidth( aHBorderLine,
|
||||
(sal_uInt16)nHBorderWidth, sal_False );
|
||||
if( nHBorderWidth == nVBorderWidth )
|
||||
aVBorderLine.SetOutWidth( aHBorderLine.GetOutWidth() );
|
||||
else
|
||||
SvxCSS1Parser::SetBorderWidth( aVBorderLine,
|
||||
(sal_uInt16)nVBorderWidth, sal_False );
|
||||
|
||||
// die tatsaechlich gesetzter Rahmenbreite benutzen und nicht die
|
||||
// Wunschbreite!
|
||||
nHBorderWidth = aHBorderLine.GetOutWidth();
|
||||
nVBorderWidth = aVBorderLine.GetOutWidth();
|
||||
SvxBorderLine aHBorderLine( NULL, nHBorderWidth );
|
||||
SvxBorderLine aVBorderLine( NULL, nVBorderWidth );
|
||||
|
||||
if( aAttrTab.pINetFmt )
|
||||
{
|
||||
|
|
|
@ -1051,8 +1051,9 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions )
|
|||
nPHeight = 1;
|
||||
}
|
||||
|
||||
SvxCSS1Parser::SetBorderWidth( aTopBorderLine, (sal_uInt16)nPHeight,
|
||||
pOptions->nCellSpacing!=0, sal_True );
|
||||
if ( pOptions->nCellSpacing != 0 )
|
||||
aTopBorderLine.SetStyle( DOUBLE );
|
||||
aTopBorderLine.SetWidth( nPHeight );
|
||||
aTopBorderLine.SetColor( rBorderColor );
|
||||
aBottomBorderLine = aTopBorderLine;
|
||||
|
||||
|
@ -1062,21 +1063,21 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions )
|
|||
}
|
||||
else
|
||||
{
|
||||
SvxCSS1Parser::SetBorderWidth( aLeftBorderLine, (sal_uInt16)nPWidth,
|
||||
pOptions->nCellSpacing!=0, sal_True );
|
||||
if ( pOptions->nCellSpacing != 0 )
|
||||
aLeftBorderLine.SetStyle( DOUBLE );
|
||||
aLeftBorderLine.SetWidth( nPWidth );
|
||||
aLeftBorderLine.SetColor( rBorderColor );
|
||||
}
|
||||
aRightBorderLine = aLeftBorderLine;
|
||||
|
||||
if( pOptions->nCellSpacing != 0 )
|
||||
{
|
||||
aBorderLine.SetOutWidth( DEF_DOUBLE_LINE7_OUT );
|
||||
aBorderLine.SetInWidth( DEF_DOUBLE_LINE7_IN );
|
||||
aBorderLine.SetDistance( DEF_DOUBLE_LINE7_DIST );
|
||||
aBorderLine.SetStyle( DOUBLE );
|
||||
aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
aBorderLine.SetOutWidth( DEF_LINE_WIDTH_1 );
|
||||
aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
|
||||
}
|
||||
aBorderLine.SetColor( rBorderColor );
|
||||
|
||||
|
@ -1515,8 +1516,8 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox,
|
|||
|
||||
sal_uInt16 nBorderWidth = aBorderLine.GetOutWidth();
|
||||
nBorderWidth *= (nEmptyRows + 1);
|
||||
SvxCSS1Parser::SetBorderWidth( aThickBorderLine,
|
||||
nBorderWidth, sal_False );
|
||||
aThickBorderLine.SetStyle( SOLID );
|
||||
aThickBorderLine.SetWidth( nBorderWidth );
|
||||
aBoxItem.SetLine( &aThickBorderLine, BOX_LINE_BOTTOM );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -239,50 +239,11 @@ static CSS1PropertyEnum const aPageBreakTable[] =
|
|||
|
||||
/* */
|
||||
|
||||
// Ein Eintrag besteht aus vier USHORTs. Der erste ist die Gesamtbreite,
|
||||
// die anderen sind die 3 Einzelbreiten
|
||||
|
||||
#define SBORDER_ENTRY( n ) \
|
||||
DEF_LINE_WIDTH_##n, DEF_LINE_WIDTH_##n, 0, 0
|
||||
|
||||
#define DBORDER_ENTRY( n ) \
|
||||
DEF_DOUBLE_LINE##n##_OUT + DEF_DOUBLE_LINE##n##_IN + \
|
||||
DEF_DOUBLE_LINE##n##_DIST, \
|
||||
DEF_DOUBLE_LINE##n##_OUT, \
|
||||
DEF_DOUBLE_LINE##n##_IN, \
|
||||
DEF_DOUBLE_LINE##n##_DIST
|
||||
|
||||
#define TDBORDER_ENTRY( n ) \
|
||||
DEF_DOUBLE_LINE##n##_OUT, \
|
||||
DEF_DOUBLE_LINE##n##_OUT, \
|
||||
DEF_DOUBLE_LINE##n##_IN, \
|
||||
DEF_DOUBLE_LINE##n##_DIST
|
||||
|
||||
|
||||
static sal_uInt16 aSBorderWidths[] =
|
||||
static sal_uInt16 const aBorderWidths[] =
|
||||
{
|
||||
SBORDER_ENTRY( 0 ), SBORDER_ENTRY( 1 ), SBORDER_ENTRY( 2 ),
|
||||
SBORDER_ENTRY( 3 ), SBORDER_ENTRY( 4 )
|
||||
};
|
||||
|
||||
static sal_uInt16 aDBorderWidths[] =
|
||||
{
|
||||
DBORDER_ENTRY( 0 ),
|
||||
DBORDER_ENTRY( 7 ),
|
||||
DBORDER_ENTRY( 1 ),
|
||||
DBORDER_ENTRY( 8 ),
|
||||
DBORDER_ENTRY( 4 ),
|
||||
DBORDER_ENTRY( 9 ),
|
||||
DBORDER_ENTRY( 3 ),
|
||||
DBORDER_ENTRY( 10 ),
|
||||
DBORDER_ENTRY( 2 ),
|
||||
DBORDER_ENTRY( 5 )
|
||||
};
|
||||
|
||||
static sal_uInt16 aTDBorderWidths[] =
|
||||
{
|
||||
TDBORDER_ENTRY( 7 ), TDBORDER_ENTRY( 8 ), TDBORDER_ENTRY( 9 ),
|
||||
TDBORDER_ENTRY( 10 )
|
||||
DEF_LINE_WIDTH_0,
|
||||
DEF_LINE_WIDTH_1,
|
||||
DEF_LINE_WIDTH_2
|
||||
};
|
||||
|
||||
#undef SBORDER_ENTRY
|
||||
|
@ -367,27 +328,20 @@ void SvxCSS1BorderInfo::SetBorderLine( sal_uInt16 nLine, SvxBoxItem &rBoxItem )
|
|||
SvxBorderLine aBorderLine( &aColor );
|
||||
|
||||
// Linien-Stil doppelt oder einfach?
|
||||
sal_Bool bDouble = eStyle == CSS1_BS_DOUBLE;
|
||||
if ( eStyle == CSS1_BS_DOTTED )
|
||||
aBorderLine.SetStyle( DOTTED );
|
||||
else if ( eStyle == CSS1_BS_DASHED )
|
||||
aBorderLine.SetStyle( DASHED );
|
||||
else if ( eStyle == CSS1_BS_DOUBLE )
|
||||
aBorderLine.SetStyle( DOUBLE );
|
||||
else
|
||||
aBorderLine.SetStyle( SOLID );
|
||||
|
||||
// benannte Breite umrechnenen, wenn keine absolute gegeben ist
|
||||
if( nAbsWidth==USHRT_MAX )
|
||||
{
|
||||
const sal_uInt16 *aWidths = bDouble ? aDBorderWidths : aSBorderWidths;
|
||||
sal_uInt16 nNWidth = nNamedWidth * 4;
|
||||
aBorderLine.SetOutWidth( aWidths[nNWidth+1] );
|
||||
aBorderLine.SetInWidth( aWidths[nNWidth+2] );
|
||||
aBorderLine.SetDistance( aWidths[nNWidth+3] );
|
||||
}
|
||||
aBorderLine.SetWidth( aBorderWidths[ nNamedWidth ] );
|
||||
else
|
||||
{
|
||||
SvxCSS1Parser::SetBorderWidth( aBorderLine, nAbsWidth, bDouble );
|
||||
}
|
||||
aBorderLine.SetWidth( nAbsWidth );
|
||||
|
||||
rBoxItem.SetLine( &aBorderLine, nLine );
|
||||
}
|
||||
|
@ -923,41 +877,6 @@ void SvxCSS1Parser::PixelToTwip( long &rWidth, long &rHeight )
|
|||
}
|
||||
}
|
||||
|
||||
void SvxCSS1Parser::SetBorderWidth( SvxBorderLine& aBorderLine, sal_uInt16 nWidth,
|
||||
sal_Bool bDouble, sal_Bool bTable )
|
||||
{
|
||||
const sal_uInt16 *aWidths;
|
||||
sal_uInt16 nSize;
|
||||
if( !bDouble )
|
||||
{
|
||||
aWidths = aSBorderWidths;
|
||||
nSize = sizeof( aSBorderWidths );
|
||||
}
|
||||
else if( bTable )
|
||||
{
|
||||
aWidths = aTDBorderWidths;
|
||||
nSize = sizeof( aTDBorderWidths );
|
||||
}
|
||||
else
|
||||
{
|
||||
aWidths = aDBorderWidths;
|
||||
nSize = sizeof( aDBorderWidths );
|
||||
}
|
||||
|
||||
sal_uInt16 i = (nSize / sizeof(sal_uInt16)) - 4;
|
||||
while( i>0 &&
|
||||
nWidth <= ((aWidths[i] + aWidths[i-4]) / 2) )
|
||||
{
|
||||
DBG_ASSERT( aWidths[i] > aWidths[i-4],
|
||||
"line widths are not sorted!" );
|
||||
i -= 4;
|
||||
}
|
||||
|
||||
aBorderLine.SetOutWidth( aWidths[i+1] );
|
||||
aBorderLine.SetInWidth( aWidths[i+2] );
|
||||
aBorderLine.SetDistance( aWidths[i+3] );
|
||||
}
|
||||
|
||||
sal_uInt32 SvxCSS1Parser::GetFontHeight( sal_uInt16 nSize ) const
|
||||
{
|
||||
sal_uInt16 nHeight;
|
||||
|
|
|
@ -314,10 +314,6 @@ public:
|
|||
// Pixel in Twips wandeln
|
||||
static void PixelToTwip( long &nWidth, long &nHeight );
|
||||
|
||||
// Die Breite einer Umrandung einstellen
|
||||
static void SetBorderWidth( SvxBorderLine& aBorderLine, sal_uInt16 nWidth,
|
||||
sal_Bool bDouble, sal_Bool bTable=sal_False );
|
||||
|
||||
// Die Font-Hoehe fuer eine bestimmte Font-Groesse (0-6) ermitteln
|
||||
virtual sal_uInt32 GetFontHeight( sal_uInt16 nSize ) const;
|
||||
|
||||
|
|
|
@ -5246,18 +5246,18 @@ void SwHTMLParser::InsertHorzRule()
|
|||
long nPWidth = 0;
|
||||
long nPHeight = (long)nSize;
|
||||
SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
|
||||
SvxCSS1Parser::SetBorderWidth( aBorderLine, (sal_uInt16)nPHeight,
|
||||
!bNoShade );
|
||||
if ( !bNoShade )
|
||||
aBorderLine.SetStyle( DOUBLE );
|
||||
aBorderLine.SetWidth( nPHeight );
|
||||
}
|
||||
else if( bNoShade )
|
||||
{
|
||||
aBorderLine.SetOutWidth( DEF_LINE_WIDTH_2 );
|
||||
aBorderLine.SetWidth( DEF_LINE_WIDTH_2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
aBorderLine.SetOutWidth( DEF_DOUBLE_LINE0_OUT );
|
||||
aBorderLine.SetInWidth( DEF_DOUBLE_LINE0_IN );
|
||||
aBorderLine.SetDistance( DEF_DOUBLE_LINE0_DIST );
|
||||
aBorderLine.SetStyle( DOUBLE );
|
||||
aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
|
||||
}
|
||||
|
||||
SvxBoxItem aBoxItem(RES_BOX);
|
||||
|
|
Loading…
Reference in a new issue