lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / writerfilter / source / ooxml / factoryinc.py
blobe4300b2b3159b23e8996d0e6b65980d9a6dc98cd
1 #!/usr/bin/env python
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from __future__ import print_function
11 from xml.dom import minidom
12 import sys
15 def createInclude(model):
16 print("""
17 #ifndef INCLUDED_OOXML_FACTORY_GENERATED_HXX
18 #define INCLUDED_OOXML_FACTORY_GENERATED_HXX
20 namespace writerfilter {
21 namespace ooxml {
23 /// @cond GENERATED
24 """)
26 # Create namespaces.
27 counter = 1
28 for namespace in sorted([ns.getAttribute("name") for ns in model.getElementsByTagName("namespace")]):
29 print("const Id NN_%s = %s << 16;" % (namespace.replace('-', '_'), counter))
30 counter += 1
32 # Create defines.
33 counter = 1
34 defines = []
35 for define in sorted([ns.getAttribute("name") for ns in model.getElementsByTagName("define")]):
36 if define not in defines:
37 print("const Id DEFINE_%s = %s;" % (define, counter))
38 defines.append(define)
39 counter += 1
40 print("""/// @endcond
43 #endif // INCLUDED_OOXML_FACTORY_GENERATED_HXX""")
46 modelPath = sys.argv[1]
47 model = minidom.parse(modelPath)
48 createInclude(model)
50 # vim:set shiftwidth=4 softtabstop=4 expandtab: