summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorHenning Brinkmann <hbrinkm@openoffice.org>2009-07-22 12:51:29 +0200
committerHenning Brinkmann <hbrinkm@openoffice.org>2009-07-22 12:51:29 +0200
commit47018dc78834a7fb98a6b10d657bb680b56fa828 (patch)
tree1b91bb8862fff9f38e87a064c651c0fadb2b1d90 /writerfilter
parent235cea0dd1033f42933efcb494510a58606b7a6c (diff)
merging changes form writerfilter07
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx2
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.cxx62
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.hxx24
-rw-r--r--writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx5
-rw-r--r--writerfilter/source/ooxml/OOXMLFastHelper.hxx37
-rw-r--r--writerfilter/source/ooxml/makefile.mk3
-rw-r--r--writerfilter/source/ooxml/resourcestools.xsl185
-rw-r--r--writerfilter/source/resourcemodel/TagLogger.cxx2
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx12
10 files changed, 290 insertions, 44 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index d61cf5024b99..e8b7edd13395 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -4401,7 +4401,7 @@ void DomainMapper::utext(const sal_uInt8 * data_, size_t len)
//otherwise ignore sText
}
else */
- if( pContext->GetFootnote().is() )
+ if( pContext && pContext->GetFootnote().is() )
{
if( !pContext->GetFootnoteSymbol() )
pContext->GetFootnote()->setLabel( sText );
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 4ae6af8c4e67..8910d6ea85e4 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -140,7 +140,7 @@ void DomainMapperTableHandler::endTable()
if( nTblPropSize )
{
const beans::PropertyValues aDebugTbl = m_aTableProperties->GetPropertyValues();
- for( sal_Int32 nDebug = 0; nDebug < nTblPropSize; ++nDebug)
+ for( sal_uInt32 nDebug = 0; nDebug < nTblPropSize; ++nDebug)
{
const ::rtl::OUString sName = aDebugTbl[nDebug].Name;
sNames += sName;
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index c9c6d6379989..99a263031549 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -38,6 +38,7 @@
#include <ooxml/resourceids.hxx>
#include <ooxml/OOXMLnamespaceids.hxx>
#include "OOXMLFastContextHandler.hxx"
+#include "OOXMLFactory.hxx"
#include "Handler.hxx"
#include "ooxmlLoggers.hxx"
@@ -110,10 +111,12 @@ public:
virtual string toString(const Id & rId) const
{
- string s(fastTokenToId(rId));
+ string s((*QNameToString::Instance())(rId));
if (s.size() == 0)
- s = (*QNameToString::Instance())(rId);
+ s = "(fasttoken)" + fastTokenToId(rId);
+ else
+ s = "(qname)" + s;
return s;
}
@@ -297,7 +300,7 @@ void OOXMLFastContextHandler::lcl_startFastElement
const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
throw (uno::RuntimeException, xml::sax::SAXException)
{
- startAction(Element);
+ OOXMLFactory::getInstance()->startAction(this, Element);
}
void OOXMLFastContextHandler::lcl_endFastElement
@@ -312,7 +315,7 @@ void OOXMLFastContextHandler::lcl_endFastElement
debug_logger->endElement("token");
#endif
- endAction(Element);
+ OOXMLFactory::getInstance()->endAction(this, Element);
}
void SAL_CALL OOXMLFastContextHandler::endUnknownElement
@@ -349,14 +352,11 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
uno::Reference< xml::sax::XFastContextHandler >
OOXMLFastContextHandler::lcl_createFastChildContext
-(Token_t /*Element*/,
+(Token_t Element,
const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
throw (uno::RuntimeException, xml::sax::SAXException)
{
- OOXMLFastContextHandler * pResult = new OOXMLFastContextHandler(this);
- pResult->setFallback(true);
-
- return uno::Reference< xml::sax::XFastContextHandler > (pResult);
+ return OOXMLFactory::getInstance()->createFastChildContext(this, Element);
}
uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
@@ -388,9 +388,10 @@ void SAL_CALL OOXMLFastContextHandler::characters
}
void OOXMLFastContextHandler::lcl_characters
-(const ::rtl::OUString & /*aChars*/)
+(const ::rtl::OUString & rString)
throw (uno::RuntimeException, xml::sax::SAXException)
{
+ OOXMLFactory::getInstance()->characters(this, rString);
}
const uno::Sequence< sal_Int8 > & OOXMLFastContextHandler::getUnoTunnelId()
@@ -424,9 +425,10 @@ OOXMLValue::Pointer_t OOXMLFastContextHandler::getValue() const
}
void OOXMLFastContextHandler::attributes
-(const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
+(const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
throw (uno::RuntimeException, xml::sax::SAXException)
{
+ OOXMLFactory::getInstance()->attributes(this, Attribs);
}
void OOXMLFastContextHandler::startAction(Token_t Element)
@@ -440,8 +442,9 @@ void OOXMLFastContextHandler::startAction(Token_t Element)
#endif
}
-void OOXMLFastContextHandler::lcl_startAction(Token_t /* Element */)
+void OOXMLFastContextHandler::lcl_startAction(Token_t Element)
{
+ OOXMLFactory::getInstance()->startAction(this, Element);
}
void OOXMLFastContextHandler::endAction(Token_t Element)
@@ -455,8 +458,9 @@ void OOXMLFastContextHandler::endAction(Token_t Element)
#endif
}
-void OOXMLFastContextHandler::lcl_endAction(Token_t /* Element */)
+void OOXMLFastContextHandler::lcl_endAction(Token_t Element)
{
+ OOXMLFactory::getInstance()->endAction(this, Element);
}
XMLTag::Pointer_t OOXMLFastContextHandler::toPropertiesTag
@@ -535,6 +539,16 @@ Id OOXMLFastContextHandler::getId() const
return mId;
}
+void OOXMLFastContextHandler::setDefine(Id nDefine)
+{
+ mnDefine = nDefine;
+}
+
+Id OOXMLFastContextHandler::getDefine() const
+{
+ return mnDefine;
+}
+
void OOXMLFastContextHandler::setFallback(bool bFallback)
{
mbFallback = bFallback;
@@ -622,10 +636,10 @@ void OOXMLFastContextHandler::sendTableDepth() const
debug_logger->endElement("props");
#endif
mpStream->props(writerfilter::Reference<Properties>::Pointer_t(pProps));
-#ifdef DEBUG_PROPERTIES
- debug_logger->endElement("sendTableDepth");
-#endif
}
+#ifdef DEBUG_ELEMENT
+ debug_logger->endElement("sendTableDepth");
+#endif
}
void OOXMLFastContextHandler::setHandle()
@@ -1090,6 +1104,10 @@ void OOXMLFastContextHandler::resolvePropertySetAttrs()
void OOXMLFastContextHandler::sendPropertyToParent()
{
+#ifdef DEBUG_ELEMENT
+ debug_logger->startElement("sendPropertyToParent");
+#endif
+
if (mpParent != NULL)
{
OOXMLPropertySet::Pointer_t pProps(mpParent->getPropertySet());
@@ -1100,8 +1118,16 @@ void OOXMLFastContextHandler::sendPropertyToParent()
pProp(new OOXMLPropertyImpl(mId, getValue(),
OOXMLPropertyImpl::SPRM));
pProps->add(pProp);
+
+#ifdef DEBUG_ELEMENT
+ debug_logger->chars(pProp->toString());
+#endif
}
}
+
+#ifdef DEBUG_ELEMENT
+ debug_logger->endElement("sendPropertyToParent");
+#endif
}
uno::Reference< uno::XComponentContext >
@@ -2086,7 +2112,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
case NS_wordprocessingml:
case NS_vml_wordprocessingDrawing:
case NS_office:
- xContextHandler.set(createFromStart(Element, Attribs));
+ xContextHandler.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
break;
default:
if (mrShapeContext.is())
@@ -2261,7 +2287,7 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
#endif
if (mMyNamespaces.find(nNameSpace) != mMyNamespaces.end())
- xResult.set(createFromStart(Element, Attribs));
+ xResult.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
else if (mxContext.is())
{
OOXMLFastContextHandlerWrapper * pWrapper =
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 7a31d044e2ff..8eeb285f4eaf 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -179,6 +179,8 @@ public:
virtual void setId(Id nId);
virtual Id getId() const;
+ void setDefine(Id nDefine);
+ Id getDefine() const;
void setFallback(bool bFallbac);
bool isFallback() const;
@@ -231,6 +233,7 @@ public:
protected:
OOXMLFastContextHandler * mpParent;
Id mId;
+ Id mnDefine;
Token_t mnToken;
#ifdef DEBUG_CONTEXT_STACK
@@ -380,6 +383,8 @@ public:
(OOXMLFastContextHandler * pContext);
virtual ~OOXMLFastContextHandlerBooleanValue();
+ virtual string getType() const { return "BooleanValue"; }
+
protected:
bool mbValue;
@@ -401,6 +406,8 @@ public:
(OOXMLFastContextHandler * pContext);
virtual ~OOXMLFastContextHandlerIntegerValue();
+ virtual string getType() const { return "IntegerValue"; }
+
protected:
sal_Int32 mnValue;
@@ -421,6 +428,8 @@ public:
(OOXMLFastContextHandler * pContext);
virtual ~OOXMLFastContextHandlerStringValue();
+ virtual string getType() const { return "StringValue"; }
+
protected:
::rtl::OUString msValue;
@@ -441,6 +450,8 @@ public:
(OOXMLFastContextHandler * pContext);
virtual ~OOXMLFastContextHandlerHexValue();
+ virtual string getType() const { return "HexValue"; }
+
protected:
sal_Int32 mnValue;
@@ -492,6 +503,8 @@ protected:
virtual ResourceEnum_t getResource() const { return TABLE; }
+ virtual string getType() const { return "Table"; }
+
void addCurrentChild();
};
@@ -502,6 +515,9 @@ public:
virtual ~OOXMLFastContextHandlerXNote();
void checkId(const rtl::OUString & rId);
+
+ virtual string getType() const { return "XNote"; }
+
private:
bool mbForwardEventsSaved;
::rtl::OUString msMyXNoteId;
@@ -524,6 +540,8 @@ public:
(OOXMLFastContextHandler * pContext);
virtual ~OOXMLFastContextHandlerTextTableCell();
+ virtual string getType() const { return "TextTableCell"; }
+
void startCell();
void endCell();
};
@@ -535,6 +553,8 @@ public:
(OOXMLFastContextHandler * pContext);
virtual ~OOXMLFastContextHandlerTextTableRow();
+ virtual string getType() const { return "TextTableRow"; }
+
void startRow();
void endRow();
};
@@ -547,6 +567,8 @@ public:
virtual ~OOXMLFastContextHandlerTextTable();
+ virtual string getType() const { return "TextTable"; }
+
protected:
virtual void lcl_startFastElement
(Token_t Element,
@@ -564,6 +586,8 @@ public:
(OOXMLFastContextHandler * pContext);
virtual ~OOXMLFastContextHandlerShape();
+ virtual string getType() const { return "Shape"; }
+
// ::com::sun::star::xml::sax::XFastContextHandler:
virtual void SAL_CALL startUnknownElement
(const ::rtl::OUString & Namespace,
diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
index aee2be60ad47..d9d2d19d120c 100644
--- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
@@ -33,6 +33,7 @@
#include "OOXMLFastDocumentHandler.hxx"
#include "OOXMLFastContextHandler.hxx"
#include "OOXMLFastTokens.hxx"
+#include "OOXMLFactory.hxx"
namespace writerfilter {
namespace ooxml
@@ -138,7 +139,7 @@ OOXMLFastDocumentHandler::getContextHandler() const
uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
OOXMLFastDocumentHandler::createFastChildContext
(::sal_Int32 Element,
- const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
+ const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
throw (uno::RuntimeException, xml::sax::SAXException)
{
#ifdef DEBUG_CONTEXT_STACK
@@ -147,7 +148,7 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
<< endl;
#endif
- return getContextHandler()->createFromStart(Element, Attribs);
+ return OOXMLFactory::getInstance()->createFastChildContextFromStart(getContextHandler().get(), Element);
}
OOXMLParserState::Pointer_t OOXMLFastDocumentHandler::getParserState() const
diff --git a/writerfilter/source/ooxml/OOXMLFastHelper.hxx b/writerfilter/source/ooxml/OOXMLFastHelper.hxx
index 964876f5a35a..bede73deca1d 100644
--- a/writerfilter/source/ooxml/OOXMLFastHelper.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastHelper.hxx
@@ -49,6 +49,9 @@ public:
static uno::Reference<XFastContextHandler> createAndSetParent
(OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId);
+ static uno::Reference<XFastContextHandler> createAndSetParentAndDefine
+ (OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId, Id nDefine);
+
static uno::Reference<XFastContextHandler> createAndSetParentRef
(OOXMLFastContextHandler * pHandler, sal_uInt32 nToken,
const uno::Reference < xml::sax::XFastAttributeList > & Attribs);
@@ -99,6 +102,40 @@ OOXMLFastHelper<T>::createAndSetParent
template <class T>
uno::Reference<XFastContextHandler>
+OOXMLFastHelper<T>::createAndSetParentAndDefine
+(OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId, Id nDefine)
+{
+ OOXMLFastContextHandler * pTmp = new T(pHandler);
+ OOXMLFastContextHandler::RefAndPointer_t aResult(pTmp);
+
+ pTmp->setToken(nToken);
+ pTmp->setId(nId);
+ pTmp->setDefine(nDefine);
+
+#ifdef DEBUG_CREATE
+ debug_logger->startElement("createAndSetParentAndDefine");
+ debug_logger->attribute("context", pHandler->getType());
+ debug_logger->attribute("token", fastTokenToId(pTmp->getToken()));
+ debug_logger->attribute("id", (*QNameToString::Instance())(nId));
+
+ static char buffer[16];
+ snprintf(buffer, sizeof(buffer), "0x%08" SAL_PRIxUINT32, nId);
+
+ debug_logger->attribute("idnum", buffer);
+ if (pTmp->isFallback())
+ debug_logger->attribute("fallback", "yes");
+
+ debug_logger->startElement("created");
+ debug_logger->addTag(pTmp->toTag());
+ debug_logger->endElement("created");
+ debug_logger->endElement("createAndSetParentAndDefine");
+#endif
+
+ return aResult;
+}
+
+template <class T>
+uno::Reference<XFastContextHandler>
OOXMLFastHelper<T>::createAndSetParentRef
(OOXMLFastContextHandler * pHandler, sal_uInt32 nToken,
const uno::Reference < xml::sax::XFastAttributeList > & Attribs)
diff --git a/writerfilter/source/ooxml/makefile.mk b/writerfilter/source/ooxml/makefile.mk
index 07720da4fb49..5913b3365663 100644
--- a/writerfilter/source/ooxml/makefile.mk
+++ b/writerfilter/source/ooxml/makefile.mk
@@ -81,6 +81,7 @@ SLOFACTORIESNAMESPACES= \
SLOFILES= \
$(SLOFACTORIESNAMESPACES) \
$(SLOFASTNAMESPACES) \
+ $(SLO)$/OOXMLFactory_generated.obj \
$(SLO)$/OOXMLFactory.obj \
$(SLO)$/OOXMLBinaryObjectReference.obj\
$(SLO)$/OOXMLfastresources.obj \
@@ -279,6 +280,8 @@ $(SLO)/OOXMLfastresources.obj: $(OOXMLFASTRESOURCESCXX) $(OOXMLGENHEADERS)
$(SLO)/OOXMLvalues.obj: $(OOXMLVALUESCXX) $(OOXMLVALUESHXX)
+$(SLO)$/OOXMLFactory_generated.obj: $(OOXMLFACTORYGENERATEDCXX) $(OOXMLGENHEADERS)
+
$(SLOFASTNAMESPACES): OOXMLFastHelper.hxx
.PHONY: genclean genmake genheaders
diff --git a/writerfilter/source/ooxml/resourcestools.xsl b/writerfilter/source/ooxml/resourcestools.xsl
index 2c2f7d73ff1f..5956e724088f 100644
--- a/writerfilter/source/ooxml/resourcestools.xsl
+++ b/writerfilter/source/ooxml/resourcestools.xsl
@@ -2457,6 +2457,68 @@ CreateElementMapPointer </xsl:text>
}</xsl:text>
</xsl:template>
+<xsl:template name="factorytokentoidmapinner">
+ <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:text>
+ (*pMap)[</xsl:text>
+ <xsl:call-template name="fasttoken"/>
+ <xsl:text>] = </xsl:text>
+ <xsl:call-template name="idtoqname">
+ <xsl:with-param name="id" select="@tokenid"/>
+ </xsl:call-template>
+ <xsl:text>;</xsl:text>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:if test="string-length($body) > 0">
+ <xsl:text>
+ // </xsl:text>
+ <xsl:value-of select="$name"/>
+ <xsl:value-of select="$body"/>
+ </xsl:if>
+ <xsl:for-each select=".//rng:ref[not(ancestor::rng:element or ancestor::rng:attribute)]">
+ <xsl:variable name="refname" select="@name"/>
+ <xsl:for-each select="ancestor::rng:grammar/rng:define[@name=$refname]">
+ <xsl:call-template name="factorytokentoidmapinner"/>
+ </xsl:for-each>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="factorytokentoidmap">
+ <xsl:text>
+TokenToIdMapPointer </xsl:text>
+ <xsl:call-template name="factoryclassname"/>
+ <xsl:text>::createTokenToIdMap(Id nId)
+{
+ TokenToIdMapPointer pMap(new TokenToIdMap());
+
+ switch (nId)
+ {</xsl:text>
+ <xsl:for-each select="rng:grammar/rng:define">
+ <xsl:variable name="inner">
+ <xsl:call-template name="factorytokentoidmapinner"/>
+ </xsl:variable>
+ <xsl:if test="string-length($inner) > 0">
+ <xsl:text>
+ </xsl:text>
+ <xsl:call-template name="caselabeldefine"/>
+ <xsl:value-of select="$inner"/>
+ <xsl:text>
+ break;</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text>
+ default:
+ break;
+ }
+
+ return pMap;
+}</xsl:text>
+</xsl:template>
+
<!--
Chooses the action for the current <action> element.
-->
@@ -2610,7 +2672,7 @@ void </xsl:text>
</xsl:if>
<xsl:text>)
{
- switch (pHandler->getId())
+ switch (pHandler->getDefine())
{</xsl:text>
<xsl:for-each select="resource[action/@name=$action]">
<xsl:text>
@@ -2689,7 +2751,9 @@ public:
virtual AttributeToResourceMapPointer createAttributeToResourceMap(Id nId);
virtual ListValueMapPointer createListValueMap(Id nId);
- virtual CreateElementMapPointer createCreateElementMap(Id nId);</xsl:text>
+ virtual CreateElementMapPointer createCreateElementMap(Id nId);
+ virtual TokenToIdMapPointer createTokenToIdMap(Id nId);
+ virtual string getDefineName(Id nId) const;</xsl:text>
<xsl:call-template name="factoryactiondecls"/>
<xsl:text>
@@ -2710,13 +2774,13 @@ protected:
<xsl:template name="factoryincludes">
<xsl:for-each select="/model/namespace">
<xsl:text>
-#include "</xsl:text>
- <xsl:call-template name="factoryclassname"/>
+#include "OOXMLFactory_</xsl:text>
+ <xsl:value-of select="@name"/>
<xsl:text>.hxx"</xsl:text>
</xsl:for-each>
</xsl:template>
-<xsl:template name="getfactoryfornamespace">
+<xsl:template name="factoryfornamespace">
<xsl:text>
OOXMLFactory_ns::Pointer_t OOXMLFactory::getFactoryForNamespace(Id nId)
{
@@ -2729,9 +2793,9 @@ OOXMLFactory_ns::Pointer_t OOXMLFactory::getFactoryForNamespace(Id nId)
case </xsl:text>
<xsl:call-template name="idfornamespace"/>
<xsl:text>:
- pResult.reset(</xsl:text>
+ pResult = </xsl:text>
<xsl:call-template name="factoryclassname"/>
- <xsl:text>::getInstance());
+ <xsl:text>::getInstance();
break;</xsl:text>
</xsl:for-each>
<xsl:text>
@@ -2739,7 +2803,7 @@ OOXMLFactory_ns::Pointer_t OOXMLFactory::getFactoryForNamespace(Id nId)
break;
}
- return aResult;
+ return pResult;
}
</xsl:text>
</xsl:template>
@@ -2882,42 +2946,67 @@ OOXMLFactory_ns::Pointer_t </xsl:text>
</xsl:for-each>
</xsl:template>
-<xsl:template name="factorycreatecontext">
+<xsl:template name="factorycreatecontextfromfactory">
<xsl:text>
-uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastChildContext
-(OOXMLFastContextHandler * pHandler, Token_t Element)
+uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastChildContextFromFactory
+(OOXMLFastContextHandler * pHandler, OOXMLFactory_ns::Pointer_t pFactory, Token_t Element)
{
- uno::Reference &gt; xml::sax::XFastContextHandler &lt; aResult;
- Id nId = pHandler-&gt;getId();
-
- OOXMLFactory_ns::Pointer_t pFactory = getFactoryForNamespace(nId);
+ uno::Reference &lt; xml::sax::XFastContextHandler &gt; aResult;
+ Id nDefine = pHandler->getDefine();
if (pFactory.get() != NULL)
{
- CreateElementMapPointer pMap = pFactory-&gt;getCreateElementMap(nId);
+ CreateElementMapPointer pMap = pFactory-&gt;getCreateElementMap(nDefine);
+ TokenToIdMapPointer pTokenMap = pFactory-&gt;getTokenToIdMap(nDefine);
if (pMap.get() != NULL)
{
+ Id nId = (*pTokenMap)[Element];
+#ifdef DEBUG_CREATE
+ string sDefine(pFactory->getDefineName(nDefine));
+ string sElement(fastTokenToId(Element));
+ string sQName((*QNameToString::Instance())(nId));
+
+ debug_logger->startElement("createFastChildContextFromFactory");
+ debug_logger->attribute("define", sDefine);
+ debug_logger->attribute("element", sElement);
+ debug_logger->attribute("qname", sQName);
+
+ static char buffer[16];
+ snprintf(buffer, sizeof(buffer), "0x%08" SAL_PRIuUINT32, nId);
+ debug_logger->attribute("idnum", buffer);
+#endif
+
CreateElement aCreateElement = (*pMap)[Element];
switch (aCreateElement.m_nResource)
{</xsl:text>
<xsl:for-each select="/model/namespace/resource">
<xsl:if test="generate-id(key('resources', @resource)) = generate-id(.)">
- <xsl:text>
+ <xsl:if test="not(@resource = 'Hex' or
+ @resource = 'Integer' or
+ @resource = 'Boolean' or
+ @resource = 'List' or
+ @resource = 'String')">
+ <xsl:text>
case RT_</xsl:text>
- <xsl:value-of select="@resource"/>
- <xsl:text>:
+ <xsl:value-of select="@resource"/>
+ <xsl:text>:
aResult.set(OOXMLFastHelper&lt;OOXMLFastContextHandler</xsl:text>
- <xsl:value-of select="@resource"/>
- <xsl:text>::createAndSetParent(pHandler, Element, aCreateElement.m_nId));
+ <xsl:value-of select="@resource"/>
+ <xsl:text>&gt;::createAndSetParentAndDefine(pHandler, Element, (*pTokenMap)[Element], aCreateElement.m_nId));
break;</xsl:text>
+ </xsl:if>
</xsl:if>
</xsl:for-each>
<xsl:text>
default:
break;
}
+
+#ifdef DEBUG_CREATE
+ debug_logger->endElement("createFastChildContextFromFactory");
+#endif
}
}
@@ -2926,4 +3015,58 @@ uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastCh
</xsl:text>
</xsl:template>
+<xsl:template name="factorycreatefromstart">
+ <xsl:text>
+uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastChildContextFromStart
+(OOXMLFastContextHandler * pHandler, Token_t Element)
+{
+ uno::Reference &lt; xml::sax::XFastContextHandler &gt; aResult;
+ OOXMLFactory_ns::Pointer_t pFactory;
+
+</xsl:text>
+ <xsl:for-each select="/model/namespace">
+ <xsl:text>
+ if (! aResult.is())
+ {
+ pFactory = getFactoryForNamespace(</xsl:text>
+ <xsl:call-template name="idfornamespace"/>
+ <xsl:text>);
+ aResult.set(createFastChildContextFromFactory(pHandler, pFactory, Element));
+ }</xsl:text>
+ </xsl:for-each>
+ <xsl:text>
+
+ return aResult;
+}
+</xsl:text>
+</xsl:template>
+
+<xsl:template name="factorygetdefinename">
+ <xsl:text>
+string </xsl:text>
+ <xsl:call-template name="factoryclassname"/>
+ <xsl:text>::getDefineName(Id nId) const
+{
+ static IdToStringMapPointer pMap;
+
+ if (pMap.get() == NULL)
+ {
+ pMap = IdToStringMapPointer(new IdToStringMap());
+
+</xsl:text>
+ <xsl:for-each select="rng:grammar/rng:define">
+ <xsl:text>
+ (*pMap)[</xsl:text>
+ <xsl:call-template name="idfordefine"/>
+ <xsl:text>] = "</xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>";</xsl:text>
+ </xsl:for-each>
+ }
+
+ return (*pMap)[nId];
+}
+
+</xsl:template>
+
</xsl:stylesheet>
diff --git a/writerfilter/source/resourcemodel/TagLogger.cxx b/writerfilter/source/resourcemodel/TagLogger.cxx
index 0afbc1986cff..09f134b8e3c7 100644
--- a/writerfilter/source/resourcemodel/TagLogger.cxx
+++ b/writerfilter/source/resourcemodel/TagLogger.cxx
@@ -273,7 +273,7 @@ namespace writerfilter
fileName += "/writerfilter.";
fileName += name;
- fileName += ".tmp";
+ fileName += ".xml";
ofstream dumpStream(fileName.c_str());
aIt->second->output(dumpStream);
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
index efe03491db7d..410d2d2fcae6 100644
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
+++ b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
@@ -71,6 +71,7 @@
#include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <ooxml/OOXMLDocument.hxx>
+#include <resourcemodel/TagLogger.hxx>
#include <ctype.h>
@@ -98,6 +99,12 @@ sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< rtl::OUString >
uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW );
if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence))
{
+#ifdef DEBUG_ELEMENT
+ writerfilter::TagLogger::Pointer_t debugLogger
+ (writerfilter::TagLogger::getInstance("DEBUG"));
+ debugLogger->startDocument();
+#endif
+
rtl::OUString arg=aArguments[0];
::comphelper::setProcessServiceFactory(xServiceFactory);
@@ -143,6 +150,11 @@ sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< rtl::OUString >
Stream::Pointer_t pStream = createStreamHandler();
pDocument->resolve(*pStream);
+#ifdef DEBUG_ELEMENT
+ writerfilter::TagLogger::dump("DEBUG");
+ debugLogger->endDocument();
+#endif
+
::ucbhelper::ContentBroker::deinitialize();
}
else