Kaydet (Commit) 77bc1a81 authored tarafından Jian Fang Zhang's avatar Jian Fang Zhang

#i120576#, the background color from table style are lost for table in the docx file

Refer to wiki document http://wiki.openoffice.org/wiki/Table_Style_in_Writerfilter

The change is composed of below parts:
1. For the w:tcPr under w:style, it's used for whole table. It should be sprmed.
2. On how to apply different kinds of table styles, it follows the sequence from wiki as below. That means ne/nw/se/sw table style can overwrite all other types if existing.

wholeTable
band1Horz band2Horz
band1Vert band2Vert
firstCol lastCol
firstRow lastRow
neCell nwCell seCell swCell

3. Fix a typo for resetRowProp. It's related to all row properties.

Found by: bjcheny
Patch by: bjcheny
Review by: zhangjf
üst fdebe419
......@@ -218,7 +218,7 @@ class TableManager
void resetRowProps()
{
mpCellProps.reset();
mpRowProps.reset();
}
void setRowProps(PropertiesPointer pProps)
......
......@@ -221,7 +221,19 @@ void lcl_mergeProps( PropertyMapPtr pToFill, PropertyMapPtr pToAdd, TblStyleTyp
pToFill->insert( pToAdd );
}
PropertyMapPtr TableStyleSheetEntry::GetLocalPropertiesFromMask( sal_Int32 nMask )
void TableStyleSheetEntry::MergePropertiesFromMask(const short nBit, const sal_Int32 nMask,
const TblStyleType nStyleId,
PropertyMapPtr pToFill)
{
TblStylePrs::iterator pIt = m_aStyles.find( nStyleId );
short nTestBit = 1 << nBit;
sal_Int32 nBitMask = sal_Int32( nTestBit );
if ( ( nMask & nBitMask ) && ( pIt != m_aStyles.end( ) ) )
lcl_mergeProps( pToFill, pIt->second, nStyleId );
}
PropertyMapPtr TableStyleSheetEntry::GetLocalPropertiesFromMask( const sal_Int32 nMask )
{
// Order from right to left
static TblStyleType aBitsOrder[] =
......@@ -243,21 +255,22 @@ PropertyMapPtr TableStyleSheetEntry::GetLocalPropertiesFromMask( sal_Int32 nMask
// Get the properties applying according to the mask
PropertyMapPtr pProps( new PropertyMap( ) );
short nBit = 0;
short nBit = 4;
do
{
TblStyleType nStyleId = aBitsOrder[nBit];
TblStylePrs::iterator pIt = m_aStyles.find( nStyleId );
short nTestBit = 1 << nBit;
sal_Int32 nBitMask = sal_Int32( nTestBit );
if ( ( nMask & nBitMask ) && ( pIt != m_aStyles.end( ) ) )
lcl_mergeProps( pProps, pIt->second, nStyleId );
MergePropertiesFromMask(nBit, nMask, aBitsOrder[nBit], pProps);
nBit++;
}
while ( nBit < 13 );
nBit = 0;
do
{
MergePropertiesFromMask(nBit, nMask, aBitsOrder[nBit], pProps);
nBit++;
}
while ( nBit < 4 ); // nw/ne/sw/se overwrite others
return pProps;
}
......@@ -543,9 +556,13 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
case NS_ooxml::LN_CT_Style_personalReply:
case NS_ooxml::LN_CT_Style_rsid:
case NS_ooxml::LN_CT_Style_trPr:
case NS_ooxml::LN_CT_Style_tcPr:
/* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
break;
case NS_ooxml::LN_CT_Style_tcPr:
{
resolveSprmProps(rSprm);
}
break;
case NS_ooxml::LN_CT_Style_tblPr: //contains table properties
case NS_ooxml::LN_CT_Style_tblStylePr: //contains to table properties
......
......@@ -145,7 +145,9 @@ public:
virtual ~TableStyleSheetEntry( );
protected:
PropertyMapPtr GetLocalPropertiesFromMask( sal_Int32 nMask );
PropertyMapPtr GetLocalPropertiesFromMask( const sal_Int32 nMask );
void MergePropertiesFromMask(const short nBit, const sal_Int32 nMask,
const TblStyleType nStyleId, PropertyMapPtr pToFill);
};
typedef boost::shared_ptr<TableStyleSheetEntry> TableStyleSheetEntryPtr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment