From 0fa60a7f5c1d3510c4fe1ea3d2a51527baf102bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= Date: Fri, 29 Nov 2013 10:11:25 +0100 Subject: [PATCH] fdo#64232: Add font theme info to CharInteropGrabBag The attributes w:*Theme in the rFonts tag are saved to the character InteropGrabBag so they can be saved back to the document on export. Font attributes are also pushed into the grab bag because they will be needed to check if the user has modified the fonts while editing the document. Change-Id: Ib247845a2d5543823798e1bbd8ed1958a5d9e884 --- writerfilter/source/dmapper/DomainMapper.cxx | 16 ++++++++++++++-- writerfilter/source/dmapper/PropertyIds.cxx | 6 ++++++ writerfilter/source/dmapper/PropertyIds.hxx | 6 ++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index c63429b594bd..7b9cdbb194ec 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -951,12 +951,19 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_Fonts_asciiTheme: m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "asciiTheme", ThemeTable::getStringForTheme(nIntValue)); if (m_pImpl->GetTopContext()) - m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme(nIntValue) )); + { + uno::Any aPropValue = uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme( nIntValue ) ); + m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, aPropValue ); + m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_FONT_NAME_ASCII, aPropValue, true, CHAR_GRAB_BAG ); + m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_NAME_ASCII, uno::makeAny( ThemeTable::getStringForTheme(nIntValue) ), true, CHAR_GRAB_BAG); + } break; case NS_ooxml::LN_CT_Fonts_hAnsi: break;//unsupported case NS_ooxml::LN_CT_Fonts_hAnsiTheme: m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "hAnsiTheme", ThemeTable::getStringForTheme(nIntValue)); + if (m_pImpl->GetTopContext()) + m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_NAME_H_ANSI, uno::makeAny( ThemeTable::getStringForTheme(nIntValue) ), true, CHAR_GRAB_BAG); break; case NS_ooxml::LN_CT_Fonts_eastAsia: if (m_pImpl->GetTopContext()) @@ -974,7 +981,12 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_Fonts_cstheme: m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "cstheme", ThemeTable::getStringForTheme(nIntValue)); if (m_pImpl->GetTopContext()) - m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX, uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme(nIntValue) )); + { + uno::Any aPropValue = uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme( nIntValue ) ); + m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX, aPropValue ); + m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_FONT_NAME_CS, aPropValue, true, CHAR_GRAB_BAG ); + m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_NAME_CS, uno::makeAny( ThemeTable::getStringForTheme(nIntValue) ), true, CHAR_GRAB_BAG); + } break; case NS_ooxml::LN_CT_Spacing_before: m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "before", OUString::number(nIntValue)); diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 4b05efae8419..3e07b7033392 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -345,6 +345,12 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_PARA_SHADOW_FORMAT: sName = "ParaShadowFormat"; break; case PROP_FOOTNOTE_LINE_RELATIVE_WIDTH: sName = "FootnoteLineRelativeWidth"; break; case PROP_TBL_HEADER: sName = "TblHeader"; break; + case PROP_CHAR_THEME_NAME_ASCII : sName = "CharThemeNameAscii"; break; + case PROP_CHAR_THEME_NAME_CS : sName = "CharThemeNameCs"; break; + case PROP_CHAR_THEME_NAME_H_ANSI : sName = "CharThemeNameHAnsi"; break; + case PROP_CHAR_THEME_FONT_NAME_ASCII : sName = "CharThemeFontNameAscii"; break; + case PROP_CHAR_THEME_FONT_NAME_CS : sName = "CharThemeFontNameCs"; break; + case PROP_CHAR_THEME_FONT_NAME_H_ANSI : sName = "CharThemeFontNameHAnsi"; break; } ::std::pair aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 0de35ceea569..9d6a7ffacc86 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -316,6 +316,12 @@ enum PropertyIds ,PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING ,PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING ,PROP_TBL_HEADER + ,PROP_CHAR_THEME_NAME_ASCII + ,PROP_CHAR_THEME_NAME_CS + ,PROP_CHAR_THEME_NAME_H_ANSI + ,PROP_CHAR_THEME_FONT_NAME_ASCII + ,PROP_CHAR_THEME_FONT_NAME_CS + ,PROP_CHAR_THEME_FONT_NAME_H_ANSI }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier