summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-08-07 11:37:19 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-08-08 16:32:56 +0200
commite70df84352d3670508a4666c97df44f82c1ce934 (patch)
tree80c03487de046dde3bf6eddea99f1b936cc5c299 /writerfilter
parent5c20cc0202170508176da577662fb6daead312b0 (diff)
try somewhat harder to read w:position (bnc#773061)
SvxEscapementItem stores the vertical offset as percentage, so it depends on the font size. Change-Id: I1b2d5b2c230b6243a6c1a4580147c4e0c4ae94cc
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx48
1 files changed, 33 insertions, 15 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 686c10feaf22..c4c03faea56f 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2109,26 +2109,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
if (xCharStyle.is())
xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_HEIGHT), aVal);
}
+ m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
}
break;
case NS_sprm::LN_CHpsInc:
break; // sprmCHpsInc
case NS_sprm::LN_CHpsPos:
- {
- // FIXME: ww8 filter in ww8par6.cxx has a Read_SubSuperProp function
- // that counts the escapement from this value and font size. So it will be
- // on our TODO list
- sal_Int16 nEscapement = 0;
- sal_Int8 nProp = 100;
- if (nIntValue < 0)
- nEscapement = -58;
- else if (nIntValue > 0)
- nEscapement = 58;
- else /* (nIntValue == 0) */
- nProp = 0;
- rContext->Insert(PROP_CHAR_ESCAPEMENT, true, uno::makeAny( nEscapement ) );
- rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT, true, uno::makeAny( nProp ) );
- }
+ m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
break; // sprmCHpsPos
case NS_sprm::LN_CHpsPosAdj:
break; // sprmCHpsPosAdj
@@ -3239,6 +3226,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
void DomainMapper::processDeferredCharacterProperties( const std::map< sal_Int32, uno::Any >& deferredCharacterProperties )
{
+ assert( m_pImpl->GetTopContextType() == CONTEXT_CHARACTER );
+ PropertyMapPtr rContext = m_pImpl->GetTopContext();
for( std::map< sal_Int32, uno::Any >::const_iterator it = deferredCharacterProperties.begin();
it != deferredCharacterProperties.end();
++it )
@@ -3250,6 +3239,35 @@ void DomainMapper::processDeferredCharacterProperties( const std::map< sal_Int32
it->second >>= sStringValue;
switch( Id )
{
+ case NS_sprm::LN_CHps:
+ case NS_sprm::LN_CHpsBi:
+ break; // only for use by other properties, ignore here
+ case NS_sprm::LN_CHpsPos:
+ {
+ sal_Int16 nEscapement = 0;
+ sal_Int8 nProp = 100;
+ if(nIntValue == 0)
+ nProp = 0;
+ else
+ {
+ std::map< sal_Int32, uno::Any >::const_iterator font = deferredCharacterProperties.find( NS_sprm::LN_CHps );
+ if( font != deferredCharacterProperties.end())
+ {
+ double fontSize = 0;
+ font->second >>= fontSize;
+ nEscapement = nIntValue * 100 / fontSize;
+ }
+ else
+ { // TODO: Find out the font size. The 58/-58 values were here previous, but I have
+ // no idea what they are (they are probably some random guess that did fit whatever
+ // specific case somebody was trying to fix).
+ nEscapement = ( nIntValue > 0 ) ? 58: -58;
+ }
+ }
+ rContext->Insert(PROP_CHAR_ESCAPEMENT, true, uno::makeAny( nEscapement ) );
+ rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT, true, uno::makeAny( nProp ) );
+ }
+ break; // sprmCHpsPos
default:
SAL_WARN( "writerfilter", "Unhandled property in processDeferredCharacterProperty()" );
break;