styleIds and other attributes sent again

changed writerfilter/source/ooxml/OOXMLFactory.cxx:

Get Id to sent to property from token-to-id map and sent it.
Handle attributes with type String.
Some debugging code.

changed writerfilter/source/ooxml/model.xml:

sent style sheet with tokenid rtf:STYLESHEET

changed writerfilter/source/ooxml/modelpreprocess.xsl:

Provide <resource><element/></resource> and <resource><attribute/></resource> with the wright @prefix

changed writerfilter/source/ooxml/resourcestools.xsl

Consider attributes in token-to-id map.
This commit is contained in:
hb 2009-09-23 17:29:47 +02:00
parent a15e91af2f
commit e9d2c81b67
4 changed files with 37 additions and 15 deletions

View file

@ -114,37 +114,59 @@ OOXMLFactory::Pointer_t OOXMLFactory::getInstance()
void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
{
Id nId = pHandler->getId();
OOXMLFactory_ns::Pointer_t pFactory = getFactoryForNamespace(nId);
Id nDefine = pHandler->getDefine();
OOXMLFactory_ns::Pointer_t pFactory = getFactoryForNamespace(nDefine);
if (pFactory.get() != NULL)
{
#ifdef DEBUG_ATTRIBUTES
debug_logger->startElement("attributes");
debug_logger->attribute("define", pFactory->getDefineName(nId));
debug_logger->attribute("define", pFactory->getDefineName(nDefine));
char sBuffer[256];
snprintf(sBuffer, sizeof(sBuffer), "%08" SAL_PRIxUINT32, nDefine);
debug_logger->attribute("define-num", sBuffer);
#endif
AttributeToResourceMapPointer pMap = pFactory->getAttributeToResourceMap(nId);
TokenToIdMapPointer pTokenToIdMap = pFactory->getTokenToIdMap(nDefine);
AttributeToResourceMapPointer pMap = pFactory->getAttributeToResourceMap(nDefine);
AttributeToResourceMap::const_iterator aIt;
AttributeToResourceMap::const_iterator aEndIt = pMap->end();
for (aIt = pMap->begin(); aIt != aEndIt; aIt++)
{
Id nId = (*pTokenToIdMap)[aIt->first];
#ifdef DEBUG_ATTRIBUTES
debug_logger->startElement("attribute");
debug_logger->attribute("name", fastTokenToId(aIt->first));
debug_logger->attribute("tokenid", (*QNameToString::Instance())(nId));
snprintf(sBuffer, sizeof(sBuffer), "%08" SAL_PRIxUINT32, nId);
debug_logger->attribute("tokenid-num", sBuffer);
#endif
if (Attribs->hasAttribute(aIt->first))
{
switch (aIt->second)
{
case RT_Boolean:
{
::rtl::OUString aValue(Attribs->getValue(aIt->first));
OOXMLFastHelper<OOXMLBooleanValue>::newProperty(pHandler, aIt->first, aValue);
}
break;
default:
break;
case RT_Boolean:
{
::rtl::OUString aValue(Attribs->getValue(aIt->first));
OOXMLFastHelper<OOXMLBooleanValue>::newProperty(pHandler, nId, aValue);
}
break;
case RT_String:
{
::rtl::OUString aValue(Attribs->getValue(aIt->first));
OOXMLFastHelper<OOXMLStringValue>::newProperty(pHandler, nId, aValue);
}
break;
default:
break;
}
}
#ifdef DEBUG_ATTRIBUTES
debug_logger->endElement("attribute");
#endif
}
#ifdef DEBUG_ATTRIBUTES

View file

@ -23095,7 +23095,7 @@
<element name="numbering" tokenid="ooxml:NUMBERING"/>
</resource>
<resource name="styles" resource="Stream">
<element name="styles" tokenid="ooxml:STYLES"/>
<element name="styles" tokenid="rtf:STYLESHEET"/>
</resource>
<resource name="ST_CaptionPos" resource="List" generated="yes">
<value name="above" tokenid="ooxml:Value_wordprocessingml_ST_CaptionPos_above">above</value>

View file

@ -114,7 +114,7 @@
</xsl:call-template>
</xsl:when>
<xsl:when test="name(.)='attribute'">
<xsl:if test="ancestor::rng:grammar/@attributeFormDefault='qualified'">
<xsl:if test="ancestor::namespace/rng:grammar/@attributeFormDefault='qualified'">
<xsl:call-template name="prefixforgrammar"/>
</xsl:if>
</xsl:when>

View file

@ -2460,7 +2460,7 @@ CreateElementMapPointer </xsl:text>
<xsl:variable name="name" select="@name"/>
<xsl:variable name="body">
<xsl:for-each select="ancestor::namespace/resource[@name=$name]">
<xsl:for-each select="element[@tokenid]">
<xsl:for-each select="element[@tokenid]|attribute[@tokenid]">
<xsl:text>
(*pMap)[</xsl:text>
<xsl:call-template name="fasttoken"/>