From 06babca3447ae03e87b8cd25e38abf8db3baeb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= Date: Fri, 11 May 2007 13:52:46 +0000 Subject: [PATCH] my today's work towards the correct parsing of styles and document-wide defaults --- writerfilter/source/dmapper/DomainMapper.cxx | 21 +++--- writerfilter/source/dmapper/FontTable.cxx | 30 +++++++-- .../source/dmapper/StyleSheetTable.cxx | 16 ++--- writerfilter/source/ooxml/model.xml | 65 +++++++++++++++++-- 4 files changed, 105 insertions(+), 27 deletions(-) diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 38f30cd42833..5fa1f5b4e49b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -4,9 +4,9 @@ * * $RCSfile: DomainMapper.cxx,v $ * - * $Revision: 1.46 $ + * $Revision: 1.47 $ * - * last change: $Author: fridrich_strba $ $Date: 2007-05-10 13:10:30 $ + * last change: $Author: fridrich_strba $ $Date: 2007-05-11 14:52:44 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -168,7 +168,7 @@ void DomainMapper::attribute(doctok::Id nName, doctok::Value & val) sal_Int32 nIntValue = val.getInt(); rtl::OUString sStringValue = val.getString(); - // printf("*** attribute *** 0x%.8x *** 0x%.8x *** %s *** attribute ***\n", (unsigned int)nName, (unsigned int)nIntValue, OUStringToOString(sStringValue, RTL_TEXTENCODING_UTF8).getStr()); + printf ( "DomainMapper::attribute(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)nName, (unsigned int)nIntValue, ::rtl::OUStringToOString(sStringValue, RTL_TEXTENCODING_DONTKNOW).getStr()); if( nName >= NS_rtf::LN_WIDENT && nName <= NS_rtf::LN_LCBSTTBFUSSR ) m_pImpl->GetFIB().SetData( nName, nIntValue ); else @@ -1727,7 +1727,7 @@ void DomainMapper::sprm( doctok::Sprm& sprm_, PropertyMapPtr rContext, SprmType doctok::Value::Pointer_t pValue = sprm_.getValue(); sal_Int32 nIntValue = pValue->getInt(); rtl::OUString sStringValue = pValue->getString(); - // printf("*** sprm *** 0x%.8x *** sprm *** 0x%.8x *** %s *** sprm ***\n", (unsigned int)nId, (unsigned int)nIntValue, OUStringToOString(sStringValue, RTL_TEXTENCODING_UTF8).getStr()); + printf ( "DomainMapper::sprm(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)nId, (unsigned int)nIntValue, ::rtl::OUStringToOString(sStringValue, RTL_TEXTENCODING_DONTKNOW).getStr()); /* WRITERFILTERSTATUS: table: sprmdata */ switch(nId) @@ -3150,6 +3150,10 @@ void DomainMapper::sprm( doctok::Sprm& sprm_, PropertyMapPtr rContext, SprmType case NS_ooxml::LN_CT_PPrBase_tabs: case NS_ooxml::LN_EG_SectPrContents_footnotePr: case NS_ooxml::LN_EG_SectPrContents_endnotePr: + case NS_ooxml::LN_CT_RPrDefault_rPr: + case NS_ooxml::LN_CT_PPrDefault_pPr: + case NS_ooxml::LN_CT_DocDefaults_pPrDefault: + case NS_ooxml::LN_CT_DocDefaults_rPrDefault: // case NS_ooxml::LN_CT_PPr_rPr: resolveSprmProps(sprm_); break; @@ -3413,15 +3417,12 @@ void DomainMapper::table(doctok::Id name, doctok::Reference::Pointer_t re case NS_rtf::LN_FONTTABLE: /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */ - { - // create a font table object that listens to the attributes - // each entry call inserts a new font entry - ref->resolve( *m_pImpl->GetFontTable() ); - } + // create a font table object that listens to the attributes + // each entry call inserts a new font entry + ref->resolve( *m_pImpl->GetFontTable() ); break; case NS_rtf::LN_STYLESHEET: /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */ - //same as above to import style sheets m_pImpl->SetStyleSheetImport( true ); ref->resolve( *m_pImpl->GetStyleSheetTable() ); diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx index 9b469d28d95a..36a4b8736fb7 100644 --- a/writerfilter/source/dmapper/FontTable.cxx +++ b/writerfilter/source/dmapper/FontTable.cxx @@ -4,9 +4,9 @@ * * $RCSfile: FontTable.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: fridrich_strba $ $Date: 2007-04-25 09:06:53 $ + * last change: $Author: fridrich_strba $ $Date: 2007-05-11 14:52:44 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -38,6 +38,7 @@ #endif #ifndef INCLUDED_RESOURCESIDS #include +#include #endif #include #include @@ -77,7 +78,7 @@ void FontTable::attribute(doctok::Id Name, doctok::Value & val) return ; int nIntValue = val.getInt(); ::rtl::OUString sValue = val.getString(); - // printf ( "FontTable::attribute(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)Name, (unsigned int)nIntValue, ::rtl::OUStringToOString(sValue, RTL_TEXTENCODING_DONTKNOW).getStr()); + printf ( "FontTable::attribute(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)Name, (unsigned int)nIntValue, ::rtl::OUStringToOString(sValue, RTL_TEXTENCODING_DONTKNOW).getStr()); switch(Name) { // case NS_rtf::LN_ISTD: break; @@ -495,6 +496,7 @@ void FontTable::attribute(doctok::Id Name, doctok::Value & val) m_pImpl->pCurrentEntry->sAlternativeFont = sValue; break; case NS_rtf::LN_XSZFFN: + case NS_ooxml::LN_CT_Font_name: m_pImpl->pCurrentEntry->sFontName = sValue; break; // case NS_rtf::LN_XSTZNAME: break; @@ -527,9 +529,29 @@ void FontTable::attribute(doctok::Id Name, doctok::Value & val) /*-- 19.06.2006 12:04:33--------------------------------------------------- -----------------------------------------------------------------------*/ -void FontTable::sprm(doctok::Sprm&) +void FontTable::sprm(doctok::Sprm& sprm_) { + OSL_ENSURE( m_pImpl->pCurrentEntry, "current entry has to be set here"); + if(!m_pImpl->pCurrentEntry) + return ; + sal_uInt32 nId = sprm_.getId(); + + doctok::Value::Pointer_t pValue = sprm_.getValue(); + sal_Int32 nIntValue = pValue->getInt(); + rtl::OUString sStringValue = pValue->getString(); + + printf ( "FontTable::sprm(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)nId, (unsigned int)nIntValue, ::rtl::OUStringToOString(sStringValue, RTL_TEXTENCODING_DONTKNOW).getStr()); + + switch(nId) + { + default: + { + OSL_ASSERT("FontTable::sprm()"); // + //doctok::Value::Pointer_t pValue_ = sprm_.getValue(); + } + } } + /*-- 19.06.2006 12:04:33--------------------------------------------------- -----------------------------------------------------------------------*/ diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 1d46d15d74ba..44df29fc4efb 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -4,9 +4,9 @@ * * $RCSfile: StyleSheetTable.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: fridrich_strba $ $Date: 2007-04-25 09:06:53 $ + * last change: $Author: fridrich_strba $ $Date: 2007-05-11 14:52:44 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,6 +40,7 @@ #endif #ifndef INCLUDED_RESOURCESIDS #include +#include #endif #include #ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_ @@ -145,7 +146,7 @@ void StyleSheetTable::attribute(doctok::Id Name, doctok::Value & val) return ; int nIntValue = val.getInt(); ::rtl::OUString sValue = val.getString(); - // printf ( "StyleSheetTable::attribute(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)Name, (unsigned int)nIntValue, ::rtl::OUStringToOString(sValue, RTL_TEXTENCODING_DONTKNOW).getStr()); + printf ( "StyleSheetTable::attribute(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)Name, (unsigned int)nIntValue, ::rtl::OUStringToOString(sValue, RTL_TEXTENCODING_DONTKNOW).getStr()); switch(Name) { case NS_rtf::LN_ISTD: @@ -599,12 +600,11 @@ void StyleSheetTable::attribute(doctok::Id Name, doctok::Value & val) -----------------------------------------------------------------------*/ void StyleSheetTable::sprm(doctok::Sprm & sprm_) { - //fill the attributes of the style sheet - if(m_pImpl->m_pCurrentEntry) - { - m_pImpl->m_rDMapper.sprm( sprm_, m_pImpl->m_pCurrentEntry->pProperties ); - } + if(!m_pImpl->m_pCurrentEntry) + return; + //fill the attributes of the style sheet + m_pImpl->m_rDMapper.sprm( sprm_, m_pImpl->m_pCurrentEntry->pProperties ); } /*-- 19.06.2006 12:04:33--------------------------------------------------- diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 7c6dd496be06..8612f507cbcd 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -4338,7 +4338,7 @@ - + Value @@ -5360,7 +5360,13 @@ - + + b + bi + i + p + + @@ -13248,7 +13254,7 @@ - + Value @@ -14109,7 +14115,10 @@ - + + + + single words @@ -14906,7 +14915,9 @@ - + + + @@ -15079,6 +15090,16 @@ + + + + + + + + + + @@ -15145,6 +15166,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + decorative @@ -15169,6 +15220,10 @@ + + + +