my today's work towards the correct parsing of styles and document-wide defaults

This commit is contained in:
Fridrich Štrba 2007-05-11 13:52:46 +00:00
parent d02bdcce76
commit 06babca344
4 changed files with 105 additions and 27 deletions

View file

@ -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<Table>::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() );

View file

@ -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 <doctok/resourceids.hxx>
#include <ooxml/resourceids.hxx>
#endif
#include <vector>
#include <stdio.h>
@ -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---------------------------------------------------
-----------------------------------------------------------------------*/

View file

@ -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 <doctok/resourceids.hxx>
#include <ooxml/resourceids.hxx>
#endif
#include <vector>
#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---------------------------------------------------

View file

@ -4338,7 +4338,7 @@
</define>
<define name="CT_Style">
<attribute name="val">
<text/>
<ref name="ST_Style"/>
<xs:documentation>Value</xs:documentation>
</attribute>
</define>
@ -5360,7 +5360,13 @@
<resource name="CT_LimLoc" resource="StringValue" generated="yes"/>
<resource name="CT_TopBot" resource="StringValue" generated="yes"/>
<resource name="CT_Script" resource="StringValue" generated="yes"/>
<resource name="CT_Style" resource="StringValue" generated="yes"/>
<resource name="ST_Style" resource="List">
<value tokenid="ooxml:Value_ST_Style_b">b</value>
<value tokenid="ooxml:Value_ST_Style_bi">bi</value>
<value tokenid="ooxml:Value_ST_Style_i">i</value>
<value tokenid="ooxml:Value_ST_Style_p">p</value>
</resource>
<resource name="CT_Style" resource="ListValue"/>
<resource name="CT_OMathJc" resource="StringValue" generated="yes"/>
<resource name="CT_TwipsMeasure" resource="StringValue" generated="yes"/>
<resource name="CT_BreakBin" resource="StringValue" generated="yes"/>
@ -13248,7 +13254,7 @@
</define>
<define name="CT_Panose">
<attribute name="val">
<text/>
<ref name="ST_Panose"/>
<xs:documentation>Value</xs:documentation>
</attribute>
</define>
@ -14109,7 +14115,10 @@
<resource name="CT_Lang" resource="StringValue">
<attribute name="val" tokenid="ooxml:CT_Lang_val"/>
</resource>
<resource name="CT_Guid" resource="StringValue" generated="yes"/>
<resource name="ST_Guid" resource="String"/>
<resource name="CT_Guid" resource="StringValue">
<attribute name="val" tokenid="ooxml:CT_Guid_val"/>
</resource>
<resource name="ST_Underline" resource="List">
<value tokenid="1">single</value>
<value tokenid="2">words</value>
@ -14906,7 +14915,9 @@
<sprm name="specVanish" tokenid="0x818"/>
<sprm name="oMath" tokenid="ooxml:EG_RPrBase_oMath"/>
</resource>
<resource name="CT_RPr" resource="Properties"/>
<resource name="EG_RPrContent" resource="Properties"/>
<resource name="CT_RPr" resource="Properties">
</resource>
<resource name="CT_ParaRPr" resource="Properties">
<attribute name="rPrChange" tokenid="ooxml:CT_ParaRPr_rPrChange"/>
</resource>
@ -15079,6 +15090,16 @@
<resource name="CT_TargetScreenSz" resource="StringValue" generated="yes"/>
<resource name="CT_DocVar" resource="StringValue" generated="yes"/>
<resource name="CT_CharacterSpacing" resource="StringValue" generated="yes"/>
<resource name="CT_RPrDefault" resource="Properties">
<attribute name="rPr" tokenid="ooxml:CT_RPrDefault_rPr"/>
</resource>
<resource name="CT_PPrDefault" resource="Properties">
<attribute name="pPr" tokenid="ooxml:CT_PPrDefault_pPr"/>
</resource>
<resource name="CT_DocDefaults" resource="Properties">
<attribute name="pPrDefault" tokenid="ooxml:CT_DocDefaults_pPrDefault"/>
<attribute name="rPrDefault" tokenid="ooxml:CT_DocDefaults_rPrDefault"/>
</resource>
<resource name="CT_FrameScrollbar" resource="StringValue" generated="yes"/>
<resource name="CT_FrameLayout" resource="StringValue" generated="yes"/>
<resource name="CT_LevelSuffix" resource="StringValue" generated="yes"/>
@ -15145,6 +15166,36 @@
<sprm name="num" tokenid="ooxml:CT_Numbering_num"/>
<sprm name="numIdMacAtCleanup" tokenid="ooxml:CT_Numbering_numIdMacAtCleanup"/>
</resource>
<resource name="CT_Style" resource="Properties">
<sprm name="name" tokenid="ooxml:CT_Style_name"/>
<sprm name="aliases" tokenid="ooxml:CT_Style_aliases"/>
<sprm name="basedOn" tokenid="ooxml:CT_Style_basedOn"/>
<sprm name="next" tokenid="ooxml:CT_Style_next"/>
<sprm name="link" tokenid="ooxml:CT_Style_link"/>
<sprm name="autoRedefine" tokenid="ooxml:CT_Style_"/>
<sprm name="hidden" tokenid="ooxml:CT_Style_hidden"/>
<sprm name="uiPriority" tokenid="ooxml:CT_Style_uiPriority"/>
<sprm name="semiHidden" tokenid="ooxml:CT_Style_semiHidden"/>
<sprm name="unhideWhenUsed" tokenid="ooxml:CT_Style_unhideWhenUsed"/>
<sprm name="qFormat" tokenid="ooxml:CT_Style_qFormat"/>
<sprm name="locked" tokenid="ooxml:CT_Style_locked"/>
<sprm name="personal" tokenid="ooxml:CT_Style_personal"/>
<sprm name="personalCompose" tokenid="ooxml:CT_Style_personalCompose"/>
<sprm name="personalReply" tokenid="ooxml:CT_Style_personalReply"/>
<sprm name="rsid" tokenid="ooxml:CT_Style_rsid"/>
<sprm name="pPr" tokenid="ooxml:CT_Style_pPr"/>
<sprm name="rPr" tokenid="ooxml:CT_Style_rPr"/>
<sprm name="tblPr" tokenid="ooxml:CT_Style_tblPr"/>
<sprm name="trPr" tokenid="ooxml:CT_Style_trPr"/>
<sprm name="tcPr" tokenid="ooxml:CT_Style_tcPr"/>
<sprm name="tblStylePr" tokenid="ooxml:CT_Style_tblStylePr"/>
<attribute name="type" tokenid="ooxml:CT_Style_type"/>
<attribute name="styleId" tokenid="ooxml:CT_Style_styleId"/>
<attribute name="default" tokenid="ooxml:CT_Style_default"/>
<attribute name="customStyle" tokenid="ooxml:CT_Style_customStyle"/>
</resource>
<resource name="CT_Styles" resource="Table" tokenid="rtf:STYLESHEET"/>
<resource name="ST_Panose" resource="Hex"/>
<resource name="CT_Panose" resource="HexValue"/>
<resource name="ST_FontFamily" resource="List">
<value tokenid="ooxml:Value_ST_FontFamily_decorative">decorative</value>
@ -15169,6 +15220,10 @@
<attribute name="csb0" tokenid="ooxml:CT_FontSig_csb0"/>
<attribute name="csb1" tokenid="ooxml:CT_FontSig_csb1"/>
</resource>
<resource name="CT_FontRel" resource="Properties">
<attribute name="fontKey" tokenid="ooxml:CT_FontRel_fontKey"/>
<attribute name="subsetted" tokenid="ooxml:CT_FontRel_subsetted"/>
</resource>
<resource name="CT_Font" resource="Properties">
<kind name="character"/>
<sprm name="altName" tokenid="ooxml:CT_Font_altName"/>