Kaydet (Commit) 74bf915f authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX import: tblHeader implies firstRow

If a table row is marked as tblHeader, then the firstRow section of the
table style should be applied, even if that row is in fact not the first
row.

Change-Id: I10605f404160e72c620e9204503203fea1c6d6d8
üst 1581b1fc
......@@ -1395,6 +1395,9 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar2, "calendar2.docx")
uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharCaseMap"));
// Font size in the second row was 11.
xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight"));
// This paragraph property was missing in table style.
xmlDocPtr pXmlStyles = parseExport("word/styles.xml");
......
......@@ -562,6 +562,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
//it's a uno::Sequence< beans::PropertyValues >*
RowPropertyValuesSeq_t* pCellProperties = aCellProperties.getArray();
PropertyMapVector1::const_iterator aRowIter = m_aRowProperties.begin();
while( aRowOfCellsIterator != aRowOfCellsIteratorEnd )
{
//aRowOfCellsIterator points to a vector of PropertyMapPtr
......@@ -580,6 +581,8 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
if(rInfo.nTblLook&0x40)
nRowStyleMask |= CNF_LAST_ROW; // last row style used
}
else if (aRowIter->get() && aRowIter->get()->find(PROP_TBL_HEADER) != aRowIter->get()->end())
nRowStyleMask |= CNF_FIRST_ROW; // table header implies first row
if(!nRowStyleMask) // if no row style used yet
{
// banding used only if not first and or last row style used
......@@ -729,6 +732,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
#endif
++nRow;
++aRowOfCellsIterator;
++aRowIter;
}
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
......@@ -758,6 +762,10 @@ RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties()
//set default to 'break across pages"
if( aRowIter->get()->find(PROP_IS_SPLIT_ALLOWED) == aRowIter->get()->end())
aRowIter->get()->Insert( PROP_IS_SPLIT_ALLOWED, uno::makeAny(sal_True ) );
// tblHeader is only our property, remove before the property map hits UNO
PropertyMap::const_iterator aIter = aRowIter->get()->find(PROP_TBL_HEADER);
if (aIter != aRowIter->get()->end())
aRowIter->get()->erase(aIter);
aRowProperties[nRow] = (*aRowIter)->GetPropertyValues();
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
......
......@@ -201,6 +201,13 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
}
else
m_nHeaderRepeat = -1;
if (nIntValue)
{
// Store the info that this is a header, we'll need that when we apply table styles.
TablePropertyMapPtr pPropMap( new TablePropertyMap );
pPropMap->Insert( PROP_TBL_HEADER, uno::makeAny(nIntValue));
insertRowProps(pPropMap);
}
break;
case 0xd608: // TDefTable
{
......
......@@ -344,6 +344,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_SURROUND_TEXT_WRAP_SMALL: sName = "SurroundTextWrapSmall"; break;
case PROP_PARA_SHADOW_FORMAT: sName = "ParaShadowFormat"; break;
case PROP_FOOTNOTE_LINE_RELATIVE_WIDTH: sName = "FootnoteLineRelativeWidth"; break;
case PROP_TBL_HEADER: sName = "TblHeader"; break;
}
::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
......
......@@ -315,6 +315,7 @@ enum PropertyIds
,PROP_FOOTNOTE_LINE_RELATIVE_WIDTH
,PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING
,PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING
,PROP_TBL_HEADER
};
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier
......
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