Kaydet (Commit) 1c06dc14 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: stop reading namespace-alias elements in factoryimpl

Change-Id: I52c2298c9583617481069040e118520cf8935c6d
üst 69d673b1
......@@ -69,9 +69,9 @@ writerfilter_SRC_ooxml_Preprocess_py=$(writerfilter_SRC)/ooxml/modelpreprocess.p
writerfilter_SRC_ooxml_QNameToStr_py=$(writerfilter_SRC)/ooxml/qnametostr.py
writerfilter_SRC_ooxml_ResourceIds_py=$(writerfilter_SRC)/ooxml/resourceids.py
$(writerfilter_GEN_ooxml_Factory_cxx) : $(writerfilter_SRC)/ooxml/factoryimpl.py $(writerfilter_GEN_ooxml_Model_processed)
$(writerfilter_GEN_ooxml_Factory_cxx) : $(writerfilter_SRC)/ooxml/factoryimpl.py $(writerfilter_DEP_ooxml_Namespaces_txt) $(writerfilter_GEN_ooxml_Model_processed)
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1)
$(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $< $(writerfilter_GEN_ooxml_Model_processed)) > $@
$(call gb_Helper_abbreviate_dirs, $(writerfilter_PYTHONCOMMAND) $< $(writerfilter_DEP_ooxml_Namespaces_txt) $(writerfilter_GEN_ooxml_Model_processed)) > $@
$(writerfilter_GEN_ooxml_Factory_hxx) : $(writerfilter_SRC)/ooxml/factoryinc.py $(writerfilter_GEN_ooxml_Model_processed)
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PY ,1)
......
......@@ -126,7 +126,7 @@ std::string fastTokenToId(sal_uInt32 nToken)
{""")
aliases = []
for alias in sorted([a.getAttribute("alias") for a in model.getElementsByTagName("namespace-alias")]):
for alias in sorted(ooxUrlAliases.values()):
if not alias in aliases:
aliases.append(alias)
print(""" case oox::NMSP_%s:
......@@ -160,11 +160,8 @@ def getFastParser(model):
{
mxFastParser = css::xml::sax::FastParser::create(mxContext);
""")
aliases = {}
for alias in model.getElementsByTagName("namespace-alias"):
aliases[alias.getAttribute("name")] = alias.getAttribute("alias")
for name in sorted(aliases.keys()):
print(""" mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (name, aliases[name]))
for url in sorted(ooxUrlAliases.keys()):
print(""" mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (url, ooxUrlAliases[url]))
print(""" }
return mxFastParser;
......@@ -200,7 +197,19 @@ using namespace com::sun::star;
getFastParser(model)
modelPath = sys.argv[1]
def parseNamespaces(fro):
sock = open(fro)
for i in sock.readlines():
line = i.strip()
id, alias, url = line.split(' ')
ooxUrlAliases[url] = alias
sock.close()
namespacesPath = sys.argv[1]
ooxUrlAliases = {}
parseNamespaces(namespacesPath)
modelPath = sys.argv[2]
model = minidom.parse(modelPath)
createImpl(model)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment