summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-08-23 17:10:41 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-09-28 14:15:41 +0200
commitf91d0026c903e911c82b6acd7eed475a9a85deaf (patch)
tree9233d2ef611d7384febe57b78616b7a2640b9963 /writerfilter/source/dmapper/DomainMapper.cxx
parentdfaa2a0274c301bdc658c08caac8234549428a77 (diff)
n#775906 dmapper: fix inherited first/left margin vs w:ind/w:right
This is similar to 89f208c, but here the direct right margin reset the left/first margin, inherited from the numbering style. Change-Id: I2d238740c24db7607719dcefb17565656592be44 (cherry picked from commit 9133794932fc2ba221f1167fd539479951ed6a6c)
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8634644e6aae..71cc0106aa32 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1085,8 +1085,50 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Ind_end:
case NS_ooxml::LN_CT_Ind_right:
if (m_pImpl->GetTopContext())
+ {
+ // Word inherits FirstLineIndent/ParaLeftMargin property of the numbering, even if ParaRightMargin is set, Writer does not.
+ // So copy it explicitly, if necessary.
+ PropertyMapPtr pContext = m_pImpl->GetTopContext();
+ sal_Int32 nFirstLineIndent = 0;
+ sal_Int32 nParaLeftMargin = 0;
+
+ // See if we have a FirstLineIndent / ParaLeftMargin
+ 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;
+ }
+ else if (rProp.Name == "IndentAt")
+ {
+ rProp.Value >>= nParaLeftMargin;
+ }
+ }
+ }
+
+ // Then copy it over.
+ if (nFirstLineIndent != 0)
+ m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, true, uno::makeAny(nFirstLineIndent));
+ if (nParaLeftMargin != 0)
+ m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN, true, uno::makeAny(nParaLeftMargin));
+
m_pImpl->GetTopContext()->Insert(
PROP_PARA_RIGHT_MARGIN, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
+ }
break;
case NS_ooxml::LN_CT_Ind_hanging:
if (m_pImpl->GetTopContext())