summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-04-30 14:24:12 +0200
committerCaolán McNamara <caolanm@redhat.com>2012-04-30 15:25:37 +0100
commitb363a1aac10fad09d62d3c4aece5b2de5589947a (patch)
tree69935990c001f7f3088eeae0c0145d42c673607f /sw
parentbf277a00e352733bf52720fe4f9a1a91dcfb2e93 (diff)
fdo#41796: sw: HTML: import CSS STYLE border on TD:
For TD elements, the SYLE attribute containing "border" properties is read, but the borders end up not at the table cell, but on some span or paragraph inside the cell. So insert a special case that re-routes the SvxBoxItems containing the borders to FixFrameFmt, where the properties set at the TD element directly now override the SvxBoxItem that is derived from BORDER etc. attributes of the table. (regression from d18feffd49f4481626417daac7984b2a7e70c3bf, which changed the way the border attributes are written) (cherry picked from commit 9a482b4ea49c3ce964de4c0f81d8d3206ac75dc8) Signed-off-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/html/htmltab.cxx30
1 files changed, 26 insertions, 4 deletions
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 06aa3bfd2957..c6a3c0914c35 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -220,6 +220,7 @@ class HTMLTableCell
HTMLTableCnts *pContents; // cell content
SvxBrushItem *pBGBrush; // cell background
// !!!ATTENTION!!!!!
+ ::boost::shared_ptr<SvxBoxItem> m_pBoxItem;
sal_uInt32 nNumFmt;
sal_uInt16 nRowSpan; // cell ROWSPAN
@@ -243,6 +244,7 @@ public:
// Fill a not empty cell
void Set( HTMLTableCnts *pCnts, sal_uInt16 nRSpan, sal_uInt16 nCSpan,
sal_Int16 eVertOri, SvxBrushItem *pBGBrush,
+ ::boost::shared_ptr<SvxBoxItem> const pBoxItem,
sal_Bool bHasNumFmt, sal_uInt32 nNumFmt,
sal_Bool bHasValue, double nValue, sal_Bool bNoWrap, sal_Bool bCovered );
@@ -264,6 +266,7 @@ public:
inline void SetWidth( sal_uInt16 nWidth, sal_Bool bRelWidth );
const SvxBrushItem *GetBGBrush() const { return pBGBrush; }
+ ::boost::shared_ptr<SvxBoxItem> GetBoxItem() const { return m_pBoxItem; }
inline sal_Bool GetNumFmt( sal_uInt32& rNumFmt ) const;
inline sal_Bool GetValue( double& rValue ) const;
@@ -592,6 +595,7 @@ public:
void InsertCell( HTMLTableCnts *pCnts, sal_uInt16 nRowSpan, sal_uInt16 nColSpan,
sal_uInt16 nWidth, sal_Bool bRelWidth, sal_uInt16 nHeight,
sal_Int16 eVertOri, SvxBrushItem *pBGBrush,
+ boost::shared_ptr<SvxBoxItem> const pBoxItem,
sal_Bool bHasNumFmt, sal_uInt32 nNumFmt,
sal_Bool bHasValue, double nValue, sal_Bool bNoWrap );
@@ -756,6 +760,7 @@ HTMLTableCell::~HTMLTableCell()
void HTMLTableCell::Set( HTMLTableCnts *pCnts, sal_uInt16 nRSpan, sal_uInt16 nCSpan,
sal_Int16 eVert, SvxBrushItem *pBrush,
+ ::boost::shared_ptr<SvxBoxItem> const pBoxItem,
sal_Bool bHasNF, sal_uInt32 nNF, sal_Bool bHasV, double nVal,
sal_Bool bNWrap, sal_Bool bCovered )
{
@@ -765,6 +770,7 @@ void HTMLTableCell::Set( HTMLTableCnts *pCnts, sal_uInt16 nRSpan, sal_uInt16 nCS
bProtected = sal_False;
eVertOri = eVert;
pBGBrush = pBrush;
+ m_pBoxItem = pBoxItem;
bHasNumFmt = bHasNF;
bHasValue = bHasV;
@@ -1388,6 +1394,7 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox,
SwFrmFmt *pFrmFmt = 0; // frame::Frame-Format
sal_Int16 eVOri = text::VertOrientation::NONE;
const SvxBrushItem *pBGBrushItem = 0; // Hintergrund
+ boost::shared_ptr<SvxBoxItem> pBoxItem;
sal_Bool bTopLine = sal_False, bBottomLine = sal_False, bLastBottomLine = sal_False;
sal_Bool bReUsable = sal_False; // Format nochmals verwendbar?
sal_uInt16 nEmptyRows = 0;
@@ -1402,6 +1409,7 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox,
{
// die Hintergrundfarbe/-grafik bestimmen
const HTMLTableCell *pCell = GetCell( nRow, nCol );
+ pBoxItem = pCell->GetBoxItem();
pBGBrushItem = pCell->GetBGBrush();
if( !pBGBrushItem )
{
@@ -1444,7 +1452,7 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox,
bHasValue = pCell->GetValue( nValue );
if( nColSpan==1 && !bTopLine && !bLastBottomLine && !nEmptyRows &&
- !pBGBrushItem && !bHasNumFmt )
+ !pBGBrushItem && !bHasNumFmt && !pBoxItem)
{
pFrmFmt = pColumn->GetFrmFmt( bBottomLine, eVOri );
bReUsable = !pFrmFmt;
@@ -1518,7 +1526,11 @@ void HTMLTable::FixFrameFmt( SwTableBox *pBox,
bSet = sal_True;
}
- if( bSet )
+ if (pBoxItem)
+ {
+ pFrmFmt->SetFmtAttr( *pBoxItem );
+ }
+ else if (bSet)
{
// BorderDist nicht mehr Bestandteil einer Zelle mit fixer Breite
sal_uInt16 nBDist = static_cast< sal_uInt16 >(
@@ -2124,6 +2136,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
sal_uInt16 nRowSpan, sal_uInt16 nColSpan,
sal_uInt16 nCellWidth, sal_Bool bRelWidth, sal_uInt16 nCellHeight,
sal_Int16 eVertOrient, SvxBrushItem *pBGBrushItem,
+ boost::shared_ptr<SvxBoxItem> const pBoxItem,
sal_Bool bHasNumFmt, sal_uInt32 nNumFmt,
sal_Bool bHasValue, double nValue, sal_Bool bNoWrap )
{
@@ -2202,7 +2215,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
{
const bool bCovered = i != nColSpan || j != nRowSpan;
GetCell( nRowsReq-j, nColsReq-i )
- ->Set( pCnts, j, i, eVertOrient, pBGBrushItem,
+ ->Set( pCnts, j, i, eVertOrient, pBGBrushItem, pBoxItem,
bHasNumFmt, nNumFmt, bHasValue, nValue, bNoWrap, bCovered );
}
}
@@ -3135,6 +3148,7 @@ class _CellSaveStruct : public _SectionSaveStruct
String aStyle, aId, aClass, aLang, aDir;
String aBGImage;
Color aBGColor;
+ boost::shared_ptr<SvxBoxItem> m_pBoxItem;
HTMLTableCnts* pCnts; // Liste aller Inhalte
HTMLTableCnts* pCurrCnts; // der aktuelle Inhalt oder 0
@@ -3320,7 +3334,15 @@ _CellSaveStruct::_CellSaveStruct( SwHTMLParser& rParser, HTMLTable *pCurTable,
if( rParser.ParseStyleOptions( aStyle, aId, aClass, aItemSet,
aPropInfo, &aLang, &aDir ) )
+ {
+ SfxPoolItem const* pItem;
+ if (SFX_ITEM_SET == aItemSet.GetItemState(RES_BOX, false, &pItem))
+ { // fdo#41796: steal box item to set it in FixFrameFmt later!
+ m_pBoxItem.reset(dynamic_cast<SvxBoxItem *>(pItem->Clone()));
+ aItemSet.ClearItem(RES_BOX);
+ }
rParser.InsertAttrs( aItemSet, aPropInfo, pCntxt );
+ }
}
rParser.SplitPREListingXMP( pCntxt );
@@ -3379,7 +3401,7 @@ void _CellSaveStruct::InsertCell( SwHTMLParser& rParser,
rParser.CreateBrushItem( bBGColor ? &aBGColor : 0, aBGImage,
aStyle, aId, aClass );
pCurTable->InsertCell( pCnts, nRowSpan, nColSpan, nWidth,
- bPrcWidth, nHeight, eVertOri, pBrushItem,
+ bPrcWidth, nHeight, eVertOri, pBrushItem, m_pBoxItem,
bHasNumFmt, nNumFmt, bHasValue, nValue,
bNoWrap );
Restore( rParser );