Kaydet (Commit) 3c01c88a authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX import: handle <w:cnfStyle> row property

Change-Id: I178cb5591c95cc5587ac56662abf808bfca7a336
üst 3067d228
...@@ -2504,6 +2504,18 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) ...@@ -2504,6 +2504,18 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
} }
} }
break; break;
case NS_ooxml::LN_CT_TrPrBase_cnfStyle:
{
m_pImpl->enableInteropGrabBag("cnfStyle");
resourcemodel::resolveSprmProps(*this, rSprm);
TablePropertyMapPtr pPropMap(new TablePropertyMap());
pPropMap->Insert(PROP_ROW_CNF_STYLE, uno::makeAny(uno::makeAny(m_pImpl->m_aInteropGrabBag.getAsConstList())), true, ROW_GRAB_BAG);
m_pImpl->getTableManager().insertRowProps(pPropMap);
m_pImpl->disableInteropGrabBag();
}
break;
case NS_ooxml::LN_CT_TcPrBase_cnfStyle: case NS_ooxml::LN_CT_TcPrBase_cnfStyle:
{ {
m_pImpl->enableInteropGrabBag("cnfStyle"); m_pImpl->enableInteropGrabBag("cnfStyle");
......
...@@ -398,6 +398,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const ...@@ -398,6 +398,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
case META_PROP_TABLE_LOOK: sName = "TableStyleLook"; break; case META_PROP_TABLE_LOOK: sName = "TableStyleLook"; break;
case PROP_PARA_CNF_STYLE: sName = "ParaCnfStyle"; break; case PROP_PARA_CNF_STYLE: sName = "ParaCnfStyle"; break;
case PROP_CELL_CNF_STYLE: sName = "CellCnfStyle"; break; case PROP_CELL_CNF_STYLE: sName = "CellCnfStyle"; break;
case PROP_ROW_CNF_STYLE: sName = "RowCnfStyle"; break;
} }
::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
......
...@@ -370,6 +370,7 @@ enum PropertyIds ...@@ -370,6 +370,7 @@ enum PropertyIds
,META_PROP_TABLE_LOOK ,META_PROP_TABLE_LOOK
,PROP_PARA_CNF_STYLE ,PROP_PARA_CNF_STYLE
,PROP_CELL_CNF_STYLE ,PROP_CELL_CNF_STYLE
,PROP_ROW_CNF_STYLE
}; };
struct PropertyNameSupplier_Impl; struct PropertyNameSupplier_Impl;
class PropertyNameSupplier class PropertyNameSupplier
......
...@@ -68,6 +68,7 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG ...@@ -68,6 +68,7 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
size_t nParaGrabBag = 0; size_t nParaGrabBag = 0;
size_t nCellGrabBag = 0; size_t nCellGrabBag = 0;
size_t nCellGrabBagSaved = 0; // How many entries do we save from the returned sequence. size_t nCellGrabBagSaved = 0; // How many entries do we save from the returned sequence.
size_t nRowGrabBag = 0;
for (MapIterator i = m_vMap.begin(); i != m_vMap.end(); ++i) for (MapIterator i = m_vMap.begin(); i != m_vMap.end(); ++i)
{ {
if ( i->second.getGrabBagType() == CHAR_GRAB_BAG ) if ( i->second.getGrabBagType() == CHAR_GRAB_BAG )
...@@ -86,6 +87,8 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG ...@@ -86,6 +87,8 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
nCellGrabBag += aSeq.getLength(); nCellGrabBag += aSeq.getLength();
nCellGrabBagSaved++; nCellGrabBagSaved++;
} }
else if ( i->second.getGrabBagType() == ROW_GRAB_BAG )
nRowGrabBag++;
} }
// In case there are properties to be grab-bagged and we can have a char grab-bag, allocate one slot for it. // In case there are properties to be grab-bagged and we can have a char grab-bag, allocate one slot for it.
...@@ -94,21 +97,26 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG ...@@ -94,21 +97,26 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
nCharGrabBagSize = nCharGrabBag ? 1 : 0; nCharGrabBagSize = nCharGrabBag ? 1 : 0;
size_t nParaGrabBagSize = nParaGrabBag ? 1 : 0; size_t nParaGrabBagSize = nParaGrabBag ? 1 : 0;
size_t nCellGrabBagSize = nCellGrabBag ? 1 : 0; size_t nCellGrabBagSize = nCellGrabBag ? 1 : 0;
size_t nRowGrabBagSize = nRowGrabBag ? 1 : 0;
// If there are any grab bag properties, we need one slot for them. // If there are any grab bag properties, we need one slot for them.
m_aValues.realloc( m_vMap.size() - nCharGrabBag + nCharGrabBagSize m_aValues.realloc( m_vMap.size() - nCharGrabBag + nCharGrabBagSize
- nParaGrabBag + nParaGrabBagSize - nParaGrabBag + nParaGrabBagSize
- nCellGrabBagSaved + nCellGrabBagSize); - nCellGrabBagSaved + nCellGrabBagSize
- nRowGrabBag + nRowGrabBagSize);
::com::sun::star::beans::PropertyValue* pValues = m_aValues.getArray(); ::com::sun::star::beans::PropertyValue* pValues = m_aValues.getArray();
uno::Sequence<beans::PropertyValue> aCharGrabBagValues(nCharGrabBag); uno::Sequence<beans::PropertyValue> aCharGrabBagValues(nCharGrabBag);
uno::Sequence<beans::PropertyValue> aParaGrabBagValues(nParaGrabBag); uno::Sequence<beans::PropertyValue> aParaGrabBagValues(nParaGrabBag);
uno::Sequence<beans::PropertyValue> aCellGrabBagValues(nCellGrabBag); uno::Sequence<beans::PropertyValue> aCellGrabBagValues(nCellGrabBag);
uno::Sequence<beans::PropertyValue> aRowGrabBagValues(nRowGrabBag);
beans::PropertyValue* pCharGrabBagValues = aCharGrabBagValues.getArray(); beans::PropertyValue* pCharGrabBagValues = aCharGrabBagValues.getArray();
beans::PropertyValue* pParaGrabBagValues = aParaGrabBagValues.getArray(); beans::PropertyValue* pParaGrabBagValues = aParaGrabBagValues.getArray();
beans::PropertyValue* pCellGrabBagValues = aCellGrabBagValues.getArray(); beans::PropertyValue* pCellGrabBagValues = aCellGrabBagValues.getArray();
beans::PropertyValue* pRowGrabBagValues = aRowGrabBagValues.getArray();
//style names have to be the first elements within the property sequence //style names have to be the first elements within the property sequence
//otherwise they will overwrite 'hard' attributes //otherwise they will overwrite 'hard' attributes
sal_Int32 nValue = 0; sal_Int32 nValue = 0;
sal_Int32 nRowGrabBagValue = 0;
sal_Int32 nCellGrabBagValue = 0; sal_Int32 nCellGrabBagValue = 0;
sal_Int32 nParaGrabBagValue = 0; sal_Int32 nParaGrabBagValue = 0;
sal_Int32 nCharGrabBagValue = 0; sal_Int32 nCharGrabBagValue = 0;
...@@ -161,6 +169,12 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG ...@@ -161,6 +169,12 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
pCellGrabBagValues[nCellGrabBagValue].Value = aMapIter->second.getValue(); pCellGrabBagValues[nCellGrabBagValue].Value = aMapIter->second.getValue();
++nCellGrabBagValue; ++nCellGrabBagValue;
} }
else if ( aMapIter->second.getGrabBagType() == ROW_GRAB_BAG )
{
pRowGrabBagValues[nRowGrabBagValue].Name = rPropNameSupplier.GetName( aMapIter->first );
pRowGrabBagValues[nRowGrabBagValue].Value = aMapIter->second.getValue();
++nRowGrabBagValue;
}
else else
{ {
if (aMapIter->first == PROP_CELL_INTEROP_GRAB_BAG) if (aMapIter->first == PROP_CELL_INTEROP_GRAB_BAG)
...@@ -200,6 +214,12 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG ...@@ -200,6 +214,12 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
pValues[nValue].Value = uno::makeAny(aCellGrabBagValues); pValues[nValue].Value = uno::makeAny(aCellGrabBagValues);
++nValue; ++nValue;
} }
if (nRowGrabBag)
{
pValues[nValue].Name = "RowInteropGrabBag";
pValues[nValue].Value = uno::makeAny(aRowGrabBagValues);
++nValue;
}
} }
return m_aValues; return m_aValues;
} }
......
...@@ -68,6 +68,7 @@ enum BorderPosition ...@@ -68,6 +68,7 @@ enum BorderPosition
enum GrabBagType enum GrabBagType
{ {
NO_GRAB_BAG, NO_GRAB_BAG,
ROW_GRAB_BAG,
CELL_GRAB_BAG, CELL_GRAB_BAG,
PARA_GRAB_BAG, PARA_GRAB_BAG,
CHAR_GRAB_BAG CHAR_GRAB_BAG
......
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