summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-09-28 09:51:42 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-09-28 10:52:51 +0200
commit0c8017a364efb0e8a1cab57b22257e9b319fa0a1 (patch)
tree87926e9aa6e7425bf30a15ce331adbf4f7711f70 /writerfilter/source/dmapper
parent2f31023abd7786746ebb59cdc4e73e86af4de8cb (diff)
n#782061 DOCX import: w:position should respect w:sz in w:rPrDefault
Subscript relative font size (w:position) is in percents in Writer, but is in half points in Word. When checking for the default font size to count the percent value, the mapper should search font size (w:sz) not only in direct character properties, but also in default character properties (w:rPrDefault). Change-Id: I9286d44c6498c765ddfee795d50921ef58b80071
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx14
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.cxx4
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.hxx3
3 files changed, 20 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 52d8c1ac504c..cfd8dad70163 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2132,7 +2132,9 @@ 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 ));
+ // Make sure char sizes defined in the stylesheets don't affect char props from direct formatting.
+ if (!m_pImpl->IsStyleSheetImport())
+ m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
}
break;
case NS_sprm::LN_CHpsInc:
@@ -3300,12 +3302,22 @@ void DomainMapper::processDeferredCharacterProperties( const std::map< sal_Int32
else
{
std::map< sal_Int32, uno::Any >::const_iterator font = deferredCharacterProperties.find( NS_sprm::LN_CHps );
+ PropertyMapPtr pDefaultCharProps = m_pImpl->GetStyleSheetTable()->GetDefaultCharProps();
+ PropertyMap::iterator aDefaultFont = pDefaultCharProps->find(PropertyDefinition( PROP_CHAR_HEIGHT, false ));
if( font != deferredCharacterProperties.end())
{
double fontSize = 0;
font->second >>= fontSize;
nEscapement = nIntValue * 100 / fontSize;
}
+ // TODO if not direct formatting, check the style first, not directly the default char props.
+ else if (aDefaultFont != pDefaultCharProps->end())
+ {
+ double fHeight = 0;
+ aDefaultFont->second >>= fHeight;
+ // fHeight is in points, nIntValue is in half points, nEscapement is in percents.
+ nEscapement = nIntValue * 100 / fHeight / 2;
+ }
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
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index be06d59c368a..044b53c54423 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -360,6 +360,10 @@ StyleSheetTable::~StyleSheetTable()
delete m_pImpl;
}
+PropertyMapPtr StyleSheetTable::GetDefaultCharProps()
+{
+ return m_pImpl->m_pDefaultCharProps;
+}
void StyleSheetTable::lcl_attribute(Id Name, Value & val)
{
diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx
index c0ee6defc392..d6689897d1eb 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.hxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.hxx
@@ -96,6 +96,9 @@ public:
OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties );
+ /// Returns the default character properties.
+ PropertyMapPtr GetDefaultCharProps();
+
private:
// Properties
virtual void lcl_attribute(Id Name, Value & val);