n#766487 dmapper: FirstLineIndent should be always inherited from numbering

Change-Id: I1eb5946d23cd3ff635d436adbd59bf007333aa60
This commit is contained in:
Miklos Vajna
2012-06-26 12:36:32 +02:00
parent 6f93ad70a8
commit 89f208c0f6

View File

@@ -1043,8 +1043,44 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Ind_start:
case NS_ooxml::LN_CT_Ind_left:
if (m_pImpl->GetTopContext())
{
// Word inherits FirstLineIndent property of the numbering, even if ParaLeftMargin is set, Writer does not.
// So copy it explicitly, if necessary.
PropertyMapPtr pContext = m_pImpl->GetTopContext();
sal_Int32 nFirstLineIndent = 0;
// See if we have a FirstLineIndent
PropertyMap::iterator it = pContext->find(PropertyDefinition( PROP_NUMBERING_RULES, true ) );
uno::Reference<container::XIndexAccess> xNumberingRules;
if (it != pContext->end())
xNumberingRules.set(it->second, uno::UNO_QUERY);
it = pContext->find(PropertyDefinition( PROP_NUMBERING_LEVEL, true ) );
sal_Int32 nNumberingLevel = -1;
if (it != pContext->end())
it->second >>= nNumberingLevel;
if (xNumberingRules.is() && nNumberingLevel != -1)
{
uno::Sequence<beans::PropertyValue> aProps;
xNumberingRules->getByIndex(nNumberingLevel) >>= aProps;
for (int i = 0; i < aProps.getLength(); ++i)
{
const beans::PropertyValue& rProp = aProps[i];
if (rProp.Name == "FirstLineIndent")
{
rProp.Value >>= nFirstLineIndent;
break;
}
}
}
// Then copy it over.
if (nFirstLineIndent != 0)
m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, true, uno::makeAny(nFirstLineIndent));
m_pImpl->GetTopContext()->Insert(
PROP_PARA_LEFT_MARGIN, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
}
break;
case NS_ooxml::LN_CT_Ind_end:
case NS_ooxml::LN_CT_Ind_right: