writerfilter: bin OOXML_something duplication of oox::XML_something constants

workdir/CustomTarget/writerfilter/source/ooxml/OOXMLFastTokens.hxx was a
duplication of workdir/CustomTarget/oox/generated/oox/token/tokens.hxx,
except when the oox generator changed, the writerfilter copy was not
adjusted and Bad Things happened. We don't need this.

Change-Id: Id92481f110b04ec24cb424421aa0ec029b7896f3
diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk
index 10d74a7..922e5a1 100644
--- a/writerfilter/CustomTarget_source.mk
+++ b/writerfilter/CustomTarget_source.mk
@@ -48,7 +48,6 @@ writerfilter_ALL = \
	$(writerfilter_GEN_ooxml_Factory_cxx) \
	$(writerfilter_GEN_ooxml_Factory_hxx) \
	$(writerfilter_GEN_ooxml_FactoryValues_hxx) \
	$(writerfilter_GEN_ooxml_FastTokens_hxx) \
	$(writerfilter_GEN_ooxml_GperfFastToken_hxx) \
	$(writerfilter_GEN_ooxml_NamespaceIds_hxx) \
	$(writerfilter_GEN_ooxml_QNameToStr_cxx) \
@@ -61,14 +60,12 @@ writerfilter_DEP_ooxml_Namespaces_txt=$(call gb_CustomTarget_get_workdir,oox/gen
writerfilter_GEN_ooxml_FactoryValues_hxx=$(writerfilter_WORK)/ooxml/OOXMLFactory_values.hxx
writerfilter_GEN_ooxml_Factory_cxx=$(writerfilter_WORK)/ooxml/OOXMLFactory_generated.cxx
writerfilter_GEN_ooxml_Factory_hxx=$(writerfilter_WORK)/ooxml/OOXMLFactory_generated.hxx
writerfilter_GEN_ooxml_FastTokens_hxx=$(writerfilter_WORK)/ooxml/OOXMLFastTokens.hxx
writerfilter_GEN_ooxml_GperfFastToken_hxx=$(writerfilter_WORK)/ooxml/gperffasttoken.hxx
writerfilter_GEN_ooxml_Model_processed=$(writerfilter_WORK)/ooxml/model_preprocessed.xml
writerfilter_GEN_ooxml_NamespaceIds_hxx=$(writerfilter_WORK)/ooxml/OOXMLnamespaceids.hxx
writerfilter_GEN_ooxml_QNameToStr_cxx=$(writerfilter_WORK)/ooxml/qnametostr.cxx
writerfilter_GEN_ooxml_ResourceIds_hxx=$(writerfilter_WORK)/ooxml/resourceids.hxx
writerfilter_GEN_ooxml_Token_xml=$(writerfilter_WORK)/ooxml/token.xml
writerfilter_SRC_ooxml_FastTokens_py=$(writerfilter_SRC)/ooxml/fasttokens.py
writerfilter_SRC_ooxml_GperfFastTokenHandler_py=$(writerfilter_SRC)/ooxml/gperffasttokenhandler.py
writerfilter_SRC_ooxml_Model=$(writerfilter_SRC)/ooxml/model.xml
writerfilter_SRC_ooxml_Preprocess_py=$(writerfilter_SRC)/ooxml/modelpreprocess.py
@@ -83,10 +80,6 @@ $(writerfilter_GEN_ooxml_Factory_hxx) : $(writerfilter_SRC)/ooxml/factoryinc.py 
	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1)
	$(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $< $(writerfilter_GEN_ooxml_Model_processed)) > $@

$(writerfilter_GEN_ooxml_FastTokens_hxx) : $(writerfilter_SRC_ooxml_FastTokens_py) $(writerfilter_GEN_ooxml_Token_xml) | $(writerfilter_WORK)/ooxml/.dir
	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1)
	$(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $(writerfilter_SRC_ooxml_FastTokens_py) $(writerfilter_GEN_ooxml_Token_xml)) > $@

$(writerfilter_GEN_ooxml_GperfFastToken_hxx) : $(writerfilter_SRC_ooxml_GperfFastTokenHandler_py) $(writerfilter_GEN_ooxml_Token_xml)
	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,GPF,1)
	$(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $(writerfilter_SRC_ooxml_GperfFastTokenHandler_py) $(writerfilter_GEN_ooxml_Token_xml)) \
diff --git a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
index b061713..63fe0a5 100644
--- a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
+++ b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
@@ -396,6 +396,8 @@ protected:
    ~Sprm() {}
};

typedef sal_Int32 Token_t;

}

#endif // INCLUDED_WRITERFILTER_INC_RESOURCEMODEL_WW8RESOURCEMODEL_HXX
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 3f6c798..90dbf141 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -28,7 +28,7 @@
#include <MeasureHandler.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nutil/paper.hxx>
#include <ooxml/OOXMLFastTokens.hxx>
#include <oox/token/tokens.hxx>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
#include <com/sun/star/table/ShadowFormat.hpp>
@@ -70,6 +70,7 @@
#include <GraphicHelpers.hxx>

using namespace ::com::sun::star;
using namespace oox;

namespace writerfilter {

@@ -3388,23 +3389,23 @@ void DomainMapper::HandleRedline( Sprm& rSprm )

    if (nSprmId == NS_ooxml::LN_CT_PPr_pPrChange)
    {
        m_pImpl->SetCurrentRedlineToken(OOXML_ParagraphFormat);
        m_pImpl->SetCurrentRedlineToken(XML_ParagraphFormat);
    }
    else if (nSprmId == NS_ooxml::LN_CT_TrPr_ins)
    {
        m_pImpl->SetCurrentRedlineToken(OOXML_tableRowInsert);
        m_pImpl->SetCurrentRedlineToken(XML_tableRowInsert);
    }
    else if (nSprmId == NS_ooxml::LN_CT_TrPr_del)
    {
        m_pImpl->SetCurrentRedlineToken(OOXML_tableRowDelete);
        m_pImpl->SetCurrentRedlineToken(XML_tableRowDelete);
    }
    else if (nSprmId == NS_ooxml::LN_CT_TcPrBase_cellIns)
    {
        m_pImpl->SetCurrentRedlineToken(OOXML_tableCellInsert);
        m_pImpl->SetCurrentRedlineToken(XML_tableCellInsert);
    }
    else if (nSprmId == NS_ooxml::LN_CT_TcPrBase_cellDel)
    {
        m_pImpl->SetCurrentRedlineToken(OOXML_tableCellDelete);
        m_pImpl->SetCurrentRedlineToken(XML_tableCellDelete);
    }

    resolveSprmProps(*this, rSprm );
@@ -3412,14 +3413,14 @@ void DomainMapper::HandleRedline( Sprm& rSprm )
    sal_Int32 nToken = m_pImpl->GetCurrentRedlineToken();
    switch( nToken & 0xffff )
    {
        case OOXML_mod:
        case OOXML_ins:
        case OOXML_del:
        case OOXML_ParagraphFormat:
        case OOXML_tableRowInsert:
        case OOXML_tableRowDelete:
        case OOXML_tableCellInsert:
        case OOXML_tableCellDelete:
        case XML_mod:
        case XML_ins:
        case XML_del:
        case XML_ParagraphFormat:
        case XML_tableRowInsert:
        case XML_tableRowDelete:
        case XML_tableCellInsert:
        case XML_tableCellDelete:
            break;
        default: OSL_FAIL( "redline token other than mod, ins, del or table row" ); break;
    }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1cb3354..2283d46 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -73,7 +73,7 @@
#include <resourcemodel/util.hxx>
#include <dmapperLoggers.hxx>
#endif
#include <ooxml/OOXMLFastTokens.hxx>
#include <oox/token/tokens.hxx>

#include <map>
#include <boost/tuple/tuple.hpp>
@@ -85,6 +85,7 @@
#include <comphelper/sequenceashashmap.hxx>

using namespace ::com::sun::star;
using namespace oox;
namespace writerfilter {
namespace dmapper{

@@ -1592,16 +1593,16 @@ void DomainMapper_Impl::CreateRedline(uno::Reference<text::XTextRange> const& xR
            PropertyNameSupplier & rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(  );
            switch ( pRedline->m_nToken & 0xffff )
            {
            case OOXML_mod:
            case XML_mod:
                sType = rPropNameSupplier.GetName( PROP_FORMAT );
                break;
            case OOXML_ins:
            case XML_ins:
                sType = rPropNameSupplier.GetName( PROP_INSERT );
                break;
            case OOXML_del:
            case XML_del:
                sType = rPropNameSupplier.GetName( PROP_DELETE );
                break;
            case OOXML_ParagraphFormat:
            case XML_ParagraphFormat:
                sType = rPropNameSupplier.GetName( PROP_PARAGRAPH_FORMAT );
                break;
            default:
@@ -1645,7 +1646,7 @@ void DomainMapper_Impl::CheckRedline( uno::Reference< text::XTextRange > const& 
        // Adding the non-mod redlines to the temporary vector
        if ( pIt->get( ) )
        {
            if (((*pIt)->m_nToken & 0xffff) != OOXML_mod && ((*pIt)->m_nToken & 0xffff) != OOXML_ParagraphFormat)
            if (((*pIt)->m_nToken & 0xffff) != XML_mod && ((*pIt)->m_nToken & 0xffff) != XML_ParagraphFormat)
                aCleaned.push_back(*pIt);
        }
    }
@@ -4508,7 +4509,7 @@ bool DomainMapper_Impl::ExecuteFrameConversion()
void DomainMapper_Impl::AddNewRedline(  )
{
    RedlineParamsPtr pNew( new RedlineParams );
    pNew->m_nToken = OOXML_mod;
    pNew->m_nToken = XML_mod;
    if ( !m_bIsParaMarkerChange )
    {
        m_aRedlines.top().push_back( pNew );
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index 0832ec2..de66b33 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -32,9 +32,10 @@
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <dmapperLoggers.hxx>
#include <ooxml/OOXMLFastTokens.hxx>
#include <oox/token/tokens.hxx>

using namespace com::sun::star;
using namespace oox;

namespace writerfilter {
namespace dmapper {
@@ -124,10 +125,10 @@ namespace dmapper {
                    switch( nSprmId )
                    {
                        case NS_ooxml::LN_CT_TrPr_ins:
                            nToken = OOXML_tableRowInsert;
                            nToken = XML_tableRowInsert;
                            break;
                        case NS_ooxml::LN_CT_TrPr_del:
                            nToken = OOXML_tableRowDelete;
                            nToken = XML_tableRowDelete;
                            break;
                    };
                    TrackChangesHandlerPtr pTrackChangesHandler( new TrackChangesHandler( nToken ) );
@@ -152,10 +153,10 @@ namespace dmapper {
                    switch( nSprmId )
                    {
                        case NS_ooxml::LN_CT_TcPrBase_cellIns:
                            nToken = OOXML_tableCellInsert;
                            nToken = XML_tableCellInsert;
                            break;
                        case NS_ooxml::LN_CT_TcPrBase_cellDel:
                            nToken = OOXML_tableCellDelete;
                            nToken = XML_tableCellDelete;
                            break;
                        default:
                            throw ::com::sun::star::lang::IllegalArgumentException("illegal redline token type", NULL, 0);
diff --git a/writerfilter/source/dmapper/TrackChangesHandler.cxx b/writerfilter/source/dmapper/TrackChangesHandler.cxx
index 383ce14..3801c28 100644
--- a/writerfilter/source/dmapper/TrackChangesHandler.cxx
+++ b/writerfilter/source/dmapper/TrackChangesHandler.cxx
@@ -10,13 +10,14 @@
#include <PropertyMap.hxx>
#include <ConversionHelper.hxx>
#include <ooxml/resourceids.hxx>
#include <ooxml/OOXMLFastTokens.hxx>
#include <oox/token/tokens.hxx>
#include "dmapperLoggers.hxx"

namespace writerfilter {
namespace dmapper {

using namespace ::com::sun::star;
using namespace oox;


TrackChangesHandler::TrackChangesHandler( sal_Int32 nToken ) :
@@ -69,16 +70,16 @@ uno::Sequence<beans::PropertyValue> TrackChangesHandler::getRedlineProperties() 
    OUString sType;
    switch ( m_pRedlineParams->m_nToken & 0xffff )
    {
        case OOXML_tableRowInsert:
        case XML_tableRowInsert:
            sType = rPropNameSupplier.GetName( PROP_TABLE_ROW_INSERT );
            break;
        case OOXML_tableRowDelete:
        case XML_tableRowDelete:
            sType = rPropNameSupplier.GetName( PROP_TABLE_ROW_DELETE );
            break;
        case OOXML_tableCellInsert:
        case XML_tableCellInsert:
            sType = rPropNameSupplier.GetName( PROP_TABLE_CELL_INSERT );
            break;
        case OOXML_tableCellDelete:
        case XML_tableCellDelete:
            sType = rPropNameSupplier.GetName( PROP_TABLE_CELL_DELETE );
            break;
    }
diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx b/writerfilter/source/ooxml/OOXMLFactory.cxx
index e40096a..651cd6f 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.cxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.cxx
@@ -213,7 +213,7 @@ OOXMLFactory::createFastChildContext(OOXMLFastContextHandler * pHandler,
    uno::Reference< xml::sax::XFastContextHandler> ret;

    //Avoid handling unknown tokens and recursing to death
    if ((Element & 0xffff) < OOXML_FAST_TOKENS_END)
    if ((Element & 0xffff) < oox::XML_TOKEN_COUNT)
        ret = createFastChildContextFromFactory(pHandler, pFactory, Element);

    return ret;
diff --git a/writerfilter/source/ooxml/OOXMLFactory.hxx b/writerfilter/source/ooxml/OOXMLFactory.hxx
index 6b7eb30..567a392 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.hxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.hxx
@@ -25,7 +25,7 @@

#include <resourcemodel/WW8ResourceModel.hxx>

#include <ooxml/OOXMLFastTokens.hxx>
#include <oox/token/tokens.hxx>

#include "OOXMLFastContextHandler.hxx"
#include <boost/intrusive_ptr.hpp>
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 09af955..9907e05 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -55,6 +55,7 @@ namespace writerfilter {
namespace ooxml
{
using namespace ::com::sun::star;
using namespace oox;
using namespace ::std;

#if OSL_DEBUG_LEVEL > 1
@@ -119,7 +120,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
: mpParent(NULL),
  mId(0),
  mnDefine(0),
  mnToken(OOXML_FAST_TOKENS_END),
  mnToken(oox::XML_TOKEN_COUNT),
  mpStream(NULL),
  mnTableDepth(0),
  mnInstanceNumber(mnInstanceCount),
@@ -143,7 +144,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
  mpParent(pContext),
  mId(0),
  mnDefine(0),
  mnToken(OOXML_FAST_TOKENS_END),
  mnToken(oox::XML_TOKEN_COUNT),
  mpStream(pContext->mpStream),
  mnTableDepth(pContext->mnTableDepth),
  mnInstanceNumber(mnInstanceCount),
@@ -171,7 +172,7 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t nElement, const uno::Ref
{
    switch (oox::getBaseToken(nElement))
    {
        case OOXML_AlternateContent:
        case XML_AlternateContent:
            {
                SavedAlternateState aState;
                aState.m_bDiscardChildren = m_bDiscardChildren;
@@ -181,9 +182,9 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t nElement, const uno::Ref
                mpParserState->getSavedAlternateStates().push_back(aState);
            }
            break;
        case OOXML_Choice:
        case XML_Choice:
        {
            OUString aRequires = rAttribs->getOptionalValue(OOXML_Requires);
            OUString aRequires = rAttribs->getOptionalValue(XML_Requires);
            static const char* aFeatures[] = {
                "wps",
                "wpg",
@@ -199,7 +200,7 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t nElement, const uno::Ref
            return true;
        }
            break;
        case OOXML_Fallback:
        case XML_Fallback:
            // If Choice is already taken, then let's ignore the Fallback.
            return m_bTookChoice;
            break;
@@ -236,9 +237,9 @@ throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
void SAL_CALL OOXMLFastContextHandler::endFastElement(Token_t Element)
throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
{
    if (Element == (NS_mce | OOXML_Choice) || Element == (NS_mce | OOXML_Fallback))
    if (Element == (NS_mce | XML_Choice) || Element == (NS_mce | XML_Fallback))
        m_bDiscardChildren = false;
    else if (Element == (NS_mce | OOXML_AlternateContent))
    else if (Element == (NS_mce | XML_AlternateContent))
    {
        SavedAlternateState aState(mpParserState->getSavedAlternateStates().back());
        mpParserState->getSavedAlternateStates().pop_back();
@@ -255,9 +256,9 @@ void OOXMLFastContextHandler::lcl_startFastElement
    throw (uno::RuntimeException, xml::sax::SAXException)
{
    OOXMLFactory::getInstance()->startAction(this, Element);
    if( Element == (NS_wordprocessingDrawing|OOXML_positionV) )
    if( Element == (NS_wordprocessingDrawing|XML_positionV) )
        inPositionV = true;
    else if( Element == (NS_wordprocessingDrawing|OOXML_positionH) )
    else if( Element == (NS_wordprocessingDrawing|XML_positionH) )
        inPositionV = false;

}
@@ -1142,13 +1143,13 @@ void OOXMLFastContextHandlerProperties::handleXNotes()
{
    switch (mnToken)
    {
    case NS_wordprocessingml|OOXML_footnoteReference:
    case NS_wordprocessingml|XML_footnoteReference:
        {
            OOXMLFootnoteHandler aFootnoteHandler(this);
            mpPropertySet->resolve(aFootnoteHandler);
        }
        break;
    case NS_wordprocessingml|OOXML_endnoteReference:
    case NS_wordprocessingml|XML_endnoteReference:
        {
            OOXMLEndnoteHandler aEndnoteHandler(this);
            mpPropertySet->resolve(aEndnoteHandler);
@@ -1163,13 +1164,13 @@ void OOXMLFastContextHandlerProperties::handleHdrFtr()
{
    switch (mnToken)
    {
    case NS_wordprocessingml|OOXML_footerReference:
    case NS_wordprocessingml|XML_footerReference:
        {
            OOXMLFooterHandler aFooterHandler(this);
            mpPropertySet->resolve(aFooterHandler);
        }
        break;
    case NS_wordprocessingml|OOXML_headerReference:
    case NS_wordprocessingml|XML_headerReference:
        {
            OOXMLHeaderHandler aHeaderHandler(this);
            mpPropertySet->resolve(aHeaderHandler);
@@ -1747,7 +1748,7 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
            newProperty(NS_ooxml::LN_shape, pValue);
            m_bShapeSent = true;

            bool bIsPicture = Element == ( NS_picture | OOXML_pic );
            bool bIsPicture = Element == ( NS_picture | XML_pic );

            // Notify the dmapper that the shape is ready to use
            if ( !bIsPicture )
@@ -1772,7 +1773,7 @@ void OOXMLFastContextHandlerShape::lcl_endFastElement
    OOXMLFastContextHandlerProperties::lcl_endFastElement(Element);

    // Ending the shape should be the last thing to do
    bool bIsPicture = Element == ( NS_picture | OOXML_pic );
    bool bIsPicture = Element == ( NS_picture | XML_pic );
    if ( !bIsPicture && m_bShapeStarted)
        mpStream->endShape( );
}
@@ -1794,9 +1795,9 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
{
    uno::Reference< xml::sax::XFastContextHandler > xContextHandler;

    bool bGroupShape = Element == Token_t(NS_vml | OOXML_group);
    bool bGroupShape = Element == Token_t(NS_vml | XML_group);
    // drawingML version also counts as a group shape.
    bGroupShape |= mrShapeContext->getStartToken() == Token_t(NS_wpg | OOXML_wgp);
    bGroupShape |= mrShapeContext->getStartToken() == Token_t(NS_wpg | XML_wgp);
    sal_uInt32 nNamespace = Element & 0xffff0000;

    switch (nNamespace)
@@ -1823,7 +1824,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
                        pWrapper->addNamespace(NS_wordprocessingml);
                        pWrapper->addNamespace(NS_vml_wordprocessingDrawing);
                        pWrapper->addNamespace(NS_office);
                        pWrapper->addToken( NS_vml|OOXML_textbox );
                        pWrapper->addToken( NS_vml|XML_textbox );
                    }

                    xContextHandler.set(pWrapper);
@@ -1838,8 +1839,8 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
    // OOXMLFastContextHandlerWrapper::lcl_createFastChildContext(), here we
    // handle the WPS import of shape text, as there the parent context is a
    // Shape one, so a different situation.
    if (Element == static_cast<sal_Int32>(NS_wps | OOXML_txbx) ||
        Element == static_cast<sal_Int32>(NS_wps | OOXML_linkedTxbx) )
    if (Element == static_cast<sal_Int32>(NS_wps | XML_txbx) ||
        Element == static_cast<sal_Int32>(NS_wps | XML_linkedTxbx) )
        sendShape(Element);

    return xContextHandler;
@@ -1988,7 +1989,7 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
    // processed by writerfilter (instead of oox), but we have no method to
    // filter out a single token. Just hardwire the wrap token here till we
    // need a more generic solution.
    bool bIsWrap = Element == static_cast<sal_Int32>(NS_vml_wordprocessingDrawing | OOXML_wrap);
    bool bIsWrap = Element == static_cast<sal_Int32>(NS_vml_wordprocessingDrawing | XML_wrap);
    if ( bInNamespaces && ((pShapeCtx->isShapeSent() && bIsWrap) || !bIsWrap) )
        xResult.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
    else if (mxContext.is())
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 0719a56..ae21ac3 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -31,7 +31,7 @@
#include "OOXMLParserState.hxx"
#include "OOXMLPropertySetImpl.hxx"
#include "OOXMLDocumentImpl.hxx"
#include <ooxml/OOXMLFastTokens.hxx>
#include <oox/token/tokens.hxx>
#include <svtools/embedhlp.hxx>

#include <oox/mathml/import.hxx>
diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
index 14b1e33..22ee5672 100644
--- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
@@ -21,7 +21,7 @@
#include <boost/shared_ptr.hpp>
#include "OOXMLFastDocumentHandler.hxx"
#include "OOXMLFastContextHandler.hxx"
#include "ooxml/OOXMLFastTokens.hxx"
#include "oox/token/tokens.hxx"
#include "OOXMLFactory.hxx"

namespace writerfilter {
diff --git a/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx b/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx
index 4776f40..b90b1e3 100644
--- a/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx
@@ -50,7 +50,7 @@ OOXMLFastTokenHandler::OOXMLFastTokenHandler
::sal_Int32 SAL_CALL OOXMLFastTokenHandler::getToken(const OUString & Identifier)
    throw (css::uno::RuntimeException, std::exception)
{
    ::sal_Int32 nResult = OOXML_FAST_TOKENS_END;
    ::sal_Int32 nResult = oox::XML_TOKEN_COUNT;

    struct tokenmap::token * pToken =
        tokenmap::Perfect_Hash::in_word_set
@@ -89,7 +89,7 @@ sal_Int32 OOXMLFastTokenHandler::getTokenDirect( const char *pStr, sal_Int32 nLe
    struct tokenmap::token * pToken =
        tokenmap::Perfect_Hash::in_word_set( pStr, nLength );

    sal_Int32 nResult = pToken != NULL ? pToken->nToken : OOXML_FAST_TOKENS_END;
    sal_Int32 nResult = pToken != NULL ? pToken->nToken : oox::XML_TOKEN_COUNT;

#ifdef DEBUG_TOKEN
    clog << "getTokenFromUTF8: "
diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
index cca0e66..902d5a7 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
@@ -22,7 +22,7 @@
#include <iostream>
#include <resourcemodel/QNameToString.hxx>
#include <com/sun/star/drawing/XShape.hpp>
#include <ooxml/OOXMLFastTokens.hxx>
#include <oox/token/tokens.hxx>
#include <ooxml/resourceids.hxx>

namespace writerfilter {
diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py
index 0fb91445..1f6e251 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -143,7 +143,7 @@ string fastTokenToId(sal_uInt32 nToken)
    for token in [t.getAttribute("localname") for t in getElementsByTagNamesNS(model, "http://relaxng.org/ns/structure/1.0", ["element", "attribute"])]:
        if not token in tokens:
            tokens.append(token)
            print("""    case OOXML_%s:
            print("""    case oox::XML_%s:
        sResult += "%s";
        break;""" % (token, token))

diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py b/writerfilter/source/ooxml/factoryimpl_ns.py
index cfcd30f..d6457ee 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -114,7 +114,7 @@ def fastNamespace(attrNode):


def fastLocalName(attrNode):
    return "OOXML_%s" % attrNode.getAttribute("localname")
    return "oox::XML_%s" % attrNode.getAttribute("localname")


def fastToken(attrNode):
@@ -668,6 +668,7 @@ def createImpl(modelNode, nsName):
#include "ooxml/resourceids.hxx"
#include "OOXMLFactory_%s.hxx"
#include "ooxml/OOXMLFastHelper.hxx"
#include "oox/token/tokens.hxx"

#ifdef _MSC_VER
#pragma warning(disable:4065) // switch statement contains 'default' but no 'case' labels
diff --git a/writerfilter/source/ooxml/fasttokens.py b/writerfilter/source/ooxml/fasttokens.py
deleted file mode 100644
index 307237c..0000000
--- a/writerfilter/source/ooxml/fasttokens.py
+++ /dev/null
@@ -1,79 +0,0 @@
#!/usr/bin/env python
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

from __future__ import print_function
import xml.sax
import sys


class ContentHandler(xml.sax.handler.ContentHandler):
    def __init__(self):
        self.inFasttoken = False
        self.counter = 0
        self.chars = []

    def startElement(self, name, attrs):
        if name == "fasttoken":
            self.inFasttoken = True

    def endElement(self, name):
        if name == "fasttoken":
            chars = "".join(self.chars)
            print("const Token_t OOXML_%s = %s;" % (chars.replace('-', '_'), self.counter))
            self.chars = []
            self.counter += 1
            self.inFasttoken = False

    def characters(self, characters):
        if self.inFasttoken:
            self.chars.append(characters)

    def endDocument(self):
        print("const Token_t OOXML_FAST_TOKENS_END = %s;" % self.counter)


print("""
/*

    THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT!

*/


#ifndef INCLUDED_OOXML_FAST_TOKENS_HXX
#define INCLUDED_OOXML_FAST_TOKENS_HXX

#include <map>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <string>

#include <resourcemodel/WW8ResourceModel.hxx>

typedef sal_Int32 Token_t;
    """)

parser = xml.sax.make_parser()
parser.setContentHandler(ContentHandler())
parser.parse(sys.argv[1])

print("""namespace writerfilter {
namespace ooxml {

#ifdef DEBUG_DOMAINMAPPER
string fastTokenToId(sal_uInt32 nToken);
#endif

}}

static const sal_uInt32 F_Attribute = 1U << 31;

#endif //INCLUDED_OOXML_FAST_TOKENS_HXX""")

# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/writerfilter/source/ooxml/gperffasttokenhandler.py b/writerfilter/source/ooxml/gperffasttokenhandler.py
index 4fa34e7..4da3418 100644
--- a/writerfilter/source/ooxml/gperffasttokenhandler.py
+++ b/writerfilter/source/ooxml/gperffasttokenhandler.py
@@ -25,7 +25,7 @@ class ContentHandler(xml.sax.handler.ContentHandler):
        if name == "fasttoken":
            chars = "".join(self.chars)
            token = chars.replace('-', '_')
            print("%s, OOXML_%s" % (token, token))
            print("%s, oox::XML_%s" % (token, token))
            self.chars = []
            self.inFasttoken = False

@@ -35,7 +35,7 @@ class ContentHandler(xml.sax.handler.ContentHandler):

print("""
%{
#include "ooxml/OOXMLFastTokens.hxx"
#include "oox/token/tokens.hxx"

namespace writerfilter { namespace ooxml { namespace tokenmap {
%}
@@ -46,7 +46,7 @@ parser = xml.sax.make_parser()
parser.setContentHandler(ContentHandler())
parser.parse(sys.argv[1])

print("""FAST_TOKENS_END, OOXML_FAST_TOKENS_END
print("""FAST_TOKENS_END, oox::XML_TOKEN_COUNT
%%

}}}""")
diff --git a/writerfilter/source/ooxml/modelpreprocess.py b/writerfilter/source/ooxml/modelpreprocess.py
index 100056d..3cf71ca 100644
--- a/writerfilter/source/ooxml/modelpreprocess.py
+++ b/writerfilter/source/ooxml/modelpreprocess.py
@@ -138,7 +138,7 @@ def preprocess(model):
            if ":" in j.getAttribute("name"):
                localname = j.getAttribute("name").split(':')[1]
            elif len(j.getElementsByTagName("anyName")):
                localname = "FAST_TOKENS_END"
                localname = "TOKEN_COUNT"
            else:
                localname = j.getAttribute("name")

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 6407a27..1003601 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -45,7 +45,7 @@

#include <oox/mathml/import.hxx>
#include <ooxml/resourceids.hxx>
#include <ooxml/OOXMLFastTokens.hxx>
#include <oox/token/tokens.hxx>
#include <oox/token/namespaces.hxx>
#include <oox/token/tokens.hxx>
#include <dmapper/GraphicHelpers.hxx>
@@ -4684,7 +4684,7 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
    case RTF_DELETED:
    case RTF_REVISED:
    {
        RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_DELETED ? OOXML_del : OOXML_ins));
        RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_DELETED ? oox::XML_del : oox::XML_ins));
        lcl_putNestedAttribute(m_aStates.top().aCharacterSprms,
                               NS_ooxml::LN_trackchange, NS_ooxml::LN_token, pValue);
    }