[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source writerfilter/source
Jacobo Aragunde Pérez
jaragunde at igalia.com
Mon Feb 10 12:06:42 PST 2014
sw/qa/extras/ooxmlexport/data/theme-preservation.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 6 +++++
sw/source/filter/ww8/docxattributeoutput.cxx | 6 +++++
writerfilter/source/dmapper/DomainMapper.cxx | 19 ++++++++++--------
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 ++++++++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 5 ++++
writerfilter/source/dmapper/PropertyIds.cxx | 1
writerfilter/source/dmapper/PropertyIds.hxx | 1
8 files changed, 47 insertions(+), 8 deletions(-)
New commits:
commit 32210fc19324c659603e1dfed1ed006072ccf22f
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date: Mon Feb 10 20:55:53 2014 +0100
writerfilter: legibility improvement regarding grabbag use
Change-Id: I01b99887dc1e94616633ae6509e13ec951fd5485
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 2c96ada..bdf3565 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1911,11 +1911,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
case NS_ooxml::LN_CT_Style_rPr:
case NS_ooxml::LN_CT_PPr_rPr:
case NS_ooxml::LN_CT_PPrBase_numPr:
+ {
+ bool bTempGrabBag = !m_pImpl->isInteropGrabBagEnabled();
if (nSprmId == NS_ooxml::LN_CT_PPr_sectPr)
m_pImpl->SetParaSectpr(true);
- else if (nSprmId == NS_ooxml::LN_EG_RPrBase_color && m_pImpl->m_aInteropGrabBagName.isEmpty())
- // if DomainMapper grab bag is not enabled, enable it temporarilly
- m_pImpl->m_aInteropGrabBagName = OUString ("TempColorPropsGrabBag");
+ else if (nSprmId == NS_ooxml::LN_EG_RPrBase_color && bTempGrabBag)
+ // if DomainMapper grab bag is not enabled, enable it temporarily
+ m_pImpl->enableInteropGrabBag("TempColorPropsGrabBag");
resolveSprmProps(*this, rSprm);
if (nSprmId == NS_ooxml::LN_CT_PPrBase_spacing)
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "spacing", m_pImpl->m_aSubInteropGrabBag);
@@ -1937,16 +1939,15 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
else if (aIter->Name == "themeTint")
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_TINT, aIter->Value, true, CHAR_GRAB_BAG);
}
- if (m_pImpl->m_aInteropGrabBagName == "TempColorPropsGrabBag")
- {
+ if (bTempGrabBag)
//disable and clear DomainMapper grab bag if it wasn't enabled before
- m_pImpl->m_aInteropGrabBagName = OUString();
- m_pImpl->m_aSubInteropGrabBag.clear();
- }
+ m_pImpl->disableInteropGrabBag();
+
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "color", m_pImpl->m_aSubInteropGrabBag);
}
else if (nSprmId == NS_ooxml::LN_CT_PPrBase_ind)
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ind", m_pImpl->m_aSubInteropGrabBag);
+ }
break;
case NS_ooxml::LN_CT_PPrBase_wordWrap:
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "wordWrap", "");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8b7dc2d..12855fe 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4194,6 +4194,23 @@ bool DomainMapper_Impl::IsNewDoc()
return m_bIsNewDoc;
}
+void DomainMapper_Impl::enableInteropGrabBag(OUString aName)
+{
+ m_aInteropGrabBagName = aName;
+}
+
+void DomainMapper_Impl::disableInteropGrabBag()
+{
+ m_aInteropGrabBagName = "";
+ m_aInteropGrabBag.clear();
+ m_aSubInteropGrabBag.clear();
+}
+
+bool DomainMapper_Impl::isInteropGrabBagEnabled()
+{
+ return !(m_aInteropGrabBagName.isEmpty());
+}
+
void DomainMapper_Impl::appendGrabBag(std::vector<beans::PropertyValue>& rInteropGrabBag, OUString aKey, OUString aValue)
{
if (m_aInteropGrabBagName.isEmpty())
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 0a14054..e08fa97 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -731,6 +731,11 @@ public:
void appendGrabBag(std::vector<beans::PropertyValue>& rInteropGrabBag, OUString aKey, OUString aValue);
void appendGrabBag(std::vector<beans::PropertyValue>& rInteropGrabBag, OUString aKey, std::vector<beans::PropertyValue>& rValue);
+ /// Enable, disable an check status of grabbags
+ void enableInteropGrabBag(OUString aName);
+ void disableInteropGrabBag();
+ bool isInteropGrabBagEnabled();
+
/// Name of m_aInteropGrabBag.
OUString m_aInteropGrabBagName;
commit 05506b377a81bcbdd0191aa592f17987f2ddcd34
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date: Mon Feb 10 20:33:11 2014 +0100
ooxml: preserve font theme color tint property
Change-Id: I5cbc8fda63a9fd2999555d5a46ea3a063685ffc7
diff --git a/sw/qa/extras/ooxmlexport/data/theme-preservation.docx b/sw/qa/extras/ooxmlexport/data/theme-preservation.docx
index 778e106..1c94b47 100644
Binary files a/sw/qa/extras/ooxmlexport/data/theme-preservation.docx and b/sw/qa/extras/ooxmlexport/data/theme-preservation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ce4ff79..f6e168b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2098,6 +2098,10 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx")
// check the font theme values in style definitions
assertXPath(pXmlStyles, "/w:styles/w:style[1]/w:rPr/w:rFonts", "eastAsiaTheme", "minorEastAsia");
+ // check the color theme values in style definitions
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Custom1']/w:rPr/w:color", "themeColor", "accent1");
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Custom1']/w:rPr/w:color", "themeTint", "99");
+
// check direct format font theme values have been preserved
xmlDocPtr pXmlDocument = parseExport("word/document.xml");
if (!pXmlDocument)
@@ -2109,6 +2113,8 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx")
assertXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color", "themeColor", "accent3");
OUString sThemeShade = getXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:r[1]/w:rPr/w:color", "themeShade");
CPPUNIT_ASSERT_EQUAL(sThemeShade.toInt32(16), sal_Int32(0xbf));
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p[7]/w:r[1]/w:rPr/w:color", "themeColor", "accent1");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p[7]/w:r[1]/w:rPr/w:color", "themeTint", "99");
// check the themeFontLang values in settings file
xmlDocPtr pXmlSettings = parseExport("word/settings.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3733c7c..6e57286 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6196,6 +6196,12 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
AddToAttrList( m_pColorAttrList, FSNS( XML_w, XML_themeShade ),
OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr() );
}
+ else if ( i->first == "CharThemeColorTint" )
+ {
+ i->second >>= str;
+ AddToAttrList( m_pColorAttrList, FSNS( XML_w, XML_themeTint ),
+ OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
else if( i->first == "CharThemeFontNameCs" ||
i->first == "CharThemeFontNameAscii" ||
i->first == "CharThemeFontNameEastAsia" ||
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index bade872..2c96ada 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1934,6 +1934,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR, aIter->Value, true, CHAR_GRAB_BAG);
else if (aIter->Name == "themeShade")
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_SHADE, aIter->Value, true, CHAR_GRAB_BAG);
+ else if (aIter->Name == "themeTint")
+ m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_TINT, aIter->Value, true, CHAR_GRAB_BAG);
}
if (m_pImpl->m_aInteropGrabBagName == "TempColorPropsGrabBag")
{
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 38c834b..004ff56 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -365,6 +365,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_TOC_BOOKMARK: sName = "TOCBookmark"; break;
case PROP_TOC_NEW_LINE: sName = "TOCNewLine"; break;
case PROP_TOC_PARAGRAPH_OUTLINE_LEVEL : sName = "TOCParagraphOutlineLevel"; break;
+ case PROP_CHAR_THEME_COLOR_TINT : sName = "CharThemeColorTint"; break;
}
::std::pair<PropertyNameMap_t::iterator,bool> 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 75db43e..f90f7df 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -336,6 +336,7 @@ enum PropertyIds
,PROP_TOC_BOOKMARK
,PROP_TOC_NEW_LINE
,PROP_TOC_PARAGRAPH_OUTLINE_LEVEL
+ ,PROP_CHAR_THEME_COLOR_TINT
};
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier
More information about the Libreoffice-commits
mailing list