[Libreoffice-commits] core.git: 4 commits - writerfilter/CustomTarget_source.mk writerfilter/inc writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Sun Aug 17 08:15:41 PDT 2014


 writerfilter/CustomTarget_source.mk                   |    6 --
 writerfilter/inc/pch/precompiled_writerfilter.hxx     |    1 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   15 ++---
 writerfilter/source/ooxml/factory_ns.py               |    2 
 writerfilter/source/ooxml/factoryimpl.py              |    8 +--
 writerfilter/source/ooxml/factoryimpl_ns.py           |    2 
 writerfilter/source/ooxml/model.xml                   |   34 ++++++-------
 writerfilter/source/ooxml/namespaceids.py             |   47 ------------------
 8 files changed, 30 insertions(+), 85 deletions(-)

New commits:
commit 33959c71772bc943c25ac1137aa4e8f79f20077b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Aug 17 15:53:02 2014 +0200

    fix dbglevel=2 build
    
    Change-Id: Ie570a84bfca530c6763c6aa7b0ca12ae1a16f0f3

diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py
index 1860742..33c7623 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -117,10 +117,10 @@ public:
 }
 
 #ifdef DEBUG_DOMAINMAPPER
-string fastTokenToId(sal_uInt32 nToken)
+std::string fastTokenToId(sal_uInt32 nToken)
 {
 
-    string sResult;
+    std::string sResult;
 
     switch (nToken & 0xffff0000)
     {""")
@@ -129,7 +129,7 @@ string fastTokenToId(sal_uInt32 nToken)
     for alias in [a.getAttribute("alias") for a in model.getElementsByTagName("namespace-alias")]:
         if not alias in aliases:
             aliases.append(alias)
-            print("""    case NMSP_%s:
+            print("""    case oox::NMSP_%s:
         sResult += "%s:";
         break;""" % (alias, alias))
     print("""    }
commit bb19f58ed0c7625da7381882ae2f4296a05144a5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Aug 17 15:45:02 2014 +0200

    writerfilter: remove now not necessary namespaceids.py
    
    Change-Id: Ic15362b9a7687c7cba2e3b1554f2eac593afab3b

diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk
index 6e751c0..b3bc00c 100644
--- a/writerfilter/CustomTarget_source.mk
+++ b/writerfilter/CustomTarget_source.mk
@@ -49,7 +49,6 @@ writerfilter_ALL = \
 	$(writerfilter_GEN_ooxml_Factory_cxx) \
 	$(writerfilter_GEN_ooxml_Factory_hxx) \
 	$(writerfilter_GEN_ooxml_FactoryValues_hxx) \
-	$(writerfilter_GEN_ooxml_NamespaceIds_hxx) \
 	$(writerfilter_GEN_ooxml_QNameToStr_cxx) \
 	$(writerfilter_GEN_ooxml_ResourceIds_hxx) \
 	$(writerfilter_GEN_ooxml_Model_validated) \
@@ -63,7 +62,6 @@ writerfilter_GEN_ooxml_Factory_cxx=$(writerfilter_WORK)/ooxml/OOXMLFactory_gener
 writerfilter_GEN_ooxml_Factory_hxx=$(writerfilter_WORK)/ooxml/OOXMLFactory_generated.hxx
 writerfilter_GEN_ooxml_Model_validated=$(writerfilter_WORK)/ooxml/model.validated
 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_SRC_ooxml_Model=$(writerfilter_SRC)/ooxml/model.xml
@@ -89,10 +87,6 @@ $(writerfilter_GEN_ooxml_Model_processed) : $(writerfilter_SRC_ooxml_Preprocess_
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1)
 	$(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $(writerfilter_SRC_ooxml_Preprocess_py) $(writerfilter_DEP_ooxml_Namespaces_txt) $(writerfilter_SRC_ooxml_Model)) > $@
 
-$(writerfilter_GEN_ooxml_NamespaceIds_hxx) : $(writerfilter_SRC)/ooxml/namespaceids.py $(writerfilter_GEN_ooxml_Model_processed) | $(writerfilter_WORK)/ooxml/.dir
-	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1)
-	$(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $< $(writerfilter_GEN_ooxml_Model_processed)) > $@
-
 $(writerfilter_GEN_ooxml_QNameToStr_cxx): $(writerfilter_SRC_ooxml_QNameToStr_py) $(writerfilter_GEN_ooxml_Model_processed)
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1)
 	$(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $(writerfilter_SRC_ooxml_QNameToStr_py) $(writerfilter_GEN_ooxml_Model_processed)) > $@
diff --git a/writerfilter/inc/pch/precompiled_writerfilter.hxx b/writerfilter/inc/pch/precompiled_writerfilter.hxx
index 2273cec..46727f5 100644
--- a/writerfilter/inc/pch/precompiled_writerfilter.hxx
+++ b/writerfilter/inc/pch/precompiled_writerfilter.hxx
@@ -196,7 +196,6 @@
 #include <oox/token/namespaces.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/vml/vmlformatting.hxx>
-#include <ooxml/OOXMLnamespaceids.hxx>
 #include <ooxml/resourceids.hxx>
 #include <osl/diagnose.h>
 #include <osl/file.hxx>
diff --git a/writerfilter/source/ooxml/namespaceids.py b/writerfilter/source/ooxml/namespaceids.py
deleted file mode 100644
index c201e7a..0000000
--- a/writerfilter/source/ooxml/namespaceids.py
+++ /dev/null
@@ -1,47 +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.tokens = {}
-
-    def startDocument(self):
-        print("""
-#ifndef INCLUDED_OOXML_NAMESPACESIDS_HXX
-#define INCLUDED_OOXML_NAMESPACESIDS_HXX
-
-#include <sal/types.h>
-
-namespace writerfilter {
-namespace ooxml {
-""")
-
-    def endDocument(self):
-        for alias in sorted(self.tokens.keys()):
-            print(self.tokens[alias])
-        print("""
-}}
-#endif //INCLUDED_OOXML_NAMESPACESIDS_HXX""")
-
-    def startElement(self, name, attrs):
-        if name == "namespace-alias":
-            token = """const sal_Int32 NMSP_%s = %s;""" % (attrs["alias"], attrs["id"])
-            if token not in self.tokens:
-                self.tokens[attrs["alias"]] = token
-
-parser = xml.sax.make_parser()
-parser.setContentHandler(ContentHandler())
-parser.parse(sys.argv[1])
-
-# vim:set shiftwidth=4 softtabstop=4 expandtab:
commit 8b0e5be91b86c6b54256ce8c353d66657be78f21
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Aug 17 15:43:04 2014 +0200

    writerfilter: OOXMLnamespaceids.hxx -> namespaces.hxx
    
    Change-Id: Icfb104b0f77d5303751a30f9188319bca7a14e6b

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index c982d54..ce4ec43 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -27,7 +27,6 @@
 #include <resourcemodel/util.hxx>
 #include <ooxml/resourceids.hxx>
 #include <oox/token/namespaces.hxx>
-#include <ooxml/OOXMLnamespaceids.hxx>
 #include <dmapper/DomainMapper.hxx>
 #include <dmapper/GraphicHelpers.hxx>
 #include <comphelper/embeddedobjectcontainer.hxx>
diff --git a/writerfilter/source/ooxml/factory_ns.py b/writerfilter/source/ooxml/factory_ns.py
index 38be6d2..99784ed 100644
--- a/writerfilter/source/ooxml/factory_ns.py
+++ b/writerfilter/source/ooxml/factory_ns.py
@@ -19,7 +19,7 @@ def createHeader(model, ns):
 #define INCLUDED_OOXML_FACTORY_%s_HXX
 #include "ooxml/OOXMLFactory.hxx"
 #include "OOXMLFactory_generated.hxx"
-#include "ooxml/OOXMLnamespaceids.hxx"
+#include "oox/token/namespaces.hxx"
 #include "ooxml/resourceids.hxx"
 
 namespace writerfilter {
diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py
index 3b1ae00..1860742 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -161,7 +161,7 @@ def getFastParser(model):
         mxFastParser = css::xml::sax::FastParser::create(mxContext);
 """)
     for alias in model.getElementsByTagName("namespace-alias"):
-        print("""        mxFastParser->registerNamespace("%s", NMSP_%s);""" % (alias.getAttribute("name"), alias.getAttribute("alias")))
+        print("""        mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (alias.getAttribute("name"), alias.getAttribute("alias")))
     print("""    }
 
     return mxFastParser;
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py b/writerfilter/source/ooxml/factoryimpl_ns.py
index bbcbc59..b05fb94 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -110,7 +110,7 @@ def idForDefine(nsNode, defineNode):
 
 
 def fastNamespace(attrNode):
-    return "NMSP_%s" % attrNode.getAttribute("prefix")
+    return "oox::NMSP_%s" % attrNode.getAttribute("prefix")
 
 
 def fastLocalName(attrNode):
commit 54ac480baf09987b85d7bcde5191e36739e06af7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Aug 17 15:30:33 2014 +0200

    Sync oox -> writerfilter alias for remaining namespaces
    
    Change-Id: I47bb934102dd18695b3e4647c0f6216ee98f059c

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 158c614..c982d54 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -256,9 +256,9 @@ void OOXMLFastContextHandler::lcl_startFastElement
     throw (uno::RuntimeException, xml::sax::SAXException)
 {
     OOXMLFactory::getInstance()->startAction(this, Element);
-    if( Element == (NMSP_wordprocessingDrawing|XML_positionV) )
+    if( Element == (NMSP_dmlWordDr|XML_positionV) )
         inPositionV = true;
-    else if( Element == (NMSP_wordprocessingDrawing|XML_positionH) )
+    else if( Element == (NMSP_dmlWordDr|XML_positionH) )
         inPositionV = false;
 
 }
@@ -1748,7 +1748,7 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
             newProperty(NS_ooxml::LN_shape, pValue);
             m_bShapeSent = true;
 
-            bool bIsPicture = Element == ( NMSP_picture | XML_pic );
+            bool bIsPicture = Element == ( NMSP_dmlPicture | XML_pic );
 
             // Notify the dmapper that the shape is ready to use
             if ( !bIsPicture )
@@ -1773,7 +1773,7 @@ void OOXMLFastContextHandlerShape::lcl_endFastElement
     OOXMLFastContextHandlerProperties::lcl_endFastElement(Element);
 
     // Ending the shape should be the last thing to do
-    bool bIsPicture = Element == ( NMSP_picture | XML_pic );
+    bool bIsPicture = Element == ( NMSP_dmlPicture | XML_pic );
     if ( !bIsPicture && m_bShapeStarted)
         mpStream->endShape( );
 }
@@ -1803,7 +1803,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
     switch (nNamespace)
     {
         case NMSP_doc:
-        case NMSP_vml_wordprocessingDrawing:
+        case NMSP_vmlWord:
         case NMSP_vmlOffice:
             if (!bGroupShape)
                 xContextHandler.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
@@ -1822,7 +1822,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
                     if (!bGroupShape)
                     {
                         pWrapper->addNamespace(NMSP_doc);
-                        pWrapper->addNamespace(NMSP_vml_wordprocessingDrawing);
+                        pWrapper->addNamespace(NMSP_vmlWord);
                         pWrapper->addNamespace(NMSP_vmlOffice);
                         pWrapper->addToken( NMSP_vml|XML_textbox );
                     }
@@ -1989,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>(NMSP_vml_wordprocessingDrawing | XML_wrap);
+    bool bIsWrap = Element == static_cast<sal_Int32>(NMSP_vmlWord | 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/model.xml b/writerfilter/source/ooxml/model.xml
index 35fb03e..964a1fa3 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -21,28 +21,28 @@
   <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships" alias="officeRel"/>
   <namespace-alias name="http://purl.oclc.org/ooxml/officeDocument/relationships" alias="officeRel"/>
   <namespace-alias name="urn:schemas-microsoft-com:office:office" alias="vmlOffice"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="theme"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="wordprocessingDrawing"/>
-  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing" alias="wordprocessingDrawing"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/main" alias="drawingml"/>
-  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/main" alias="drawingml"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="officeRelTheme"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="dmlWordDr"/>
+  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing" alias="dmlWordDr"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/main" alias="dml"/>
+  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/main" alias="dml"/>
   <namespace-alias name="urn:schemas-microsoft-com:vml" alias="vml"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/picture" alias="picture"/>
-  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/picture" alias="picture"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/diagram" alias="diagram"/>
-  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/diagram" alias="diagram"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas" alias="lockedCanvas"/>
-  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/lockedCanvas" alias="lockedCanvas"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/picture" alias="dmlPicture"/>
+  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/picture" alias="dmlPicture"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/diagram" alias="dmlDiagram"/>
+  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/diagram" alias="dmlDiagram"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas" alias="dmlLockedCanvas"/>
+  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/lockedCanvas" alias="dmlLockedCanvas"/>
   <namespace-alias name="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" alias="wps"/>
   <namespace-alias name="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" alias="wpg"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/chart" alias="chart"/>
-  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/chart" alias="chart"/>
-  <namespace-alias name="urn:schemas-microsoft-com:office:word" alias="vml_wordprocessingDrawing"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/chart" alias="dmlChart"/>
+  <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/chart" alias="dmlChart"/>
+  <namespace-alias name="urn:schemas-microsoft-com:office:word" alias="vmlWord"/>
   <namespace-alias name="http://schemas.openxmlformats.org/wordprocessingml/2006/main" alias="doc"/>
   <namespace-alias name="http://purl.oclc.org/ooxml/wordprocessingml/main" alias="doc"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/math" alias="math"/>
-  <namespace-alias name="http://purl.oclc.org/ooxml/officeDocument/math" alias="math"/>
-  <namespace-alias name="http://schemas.openxmlformats.org/schemaLibrary/2006/main" alias="schemaLibrary"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/math" alias="officeMath"/>
+  <namespace-alias name="http://purl.oclc.org/ooxml/officeDocument/math" alias="officeMath"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/schemaLibrary/2006/main" alias="schema"/>
   <namespace-alias name="http://schemas.openxmlformats.org/markup-compatibility/2006" alias="mce"/>
   <namespace-alias name="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" alias="wp14"/>
   <namespace-alias name="http://schemas.microsoft.com/office/word/2010/wordml" alias="w14"/>


More information about the Libreoffice-commits mailing list