1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
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 libreoffice
.util
import printing
12 class OOXMLPropertySetPrinter(object):
13 '''Prints writerfilter::ooxml::OOXMLPropertySet'''
15 def __init__(self
, typename
, value
):
16 self
.typename
= typename
20 return "%s" % (self
.typename
)
23 children
= [ ( 'properties', self
.value
['mProperties'] ) ]
24 return children
.__iter
__()
26 class OOXMLPropertyPrinter(object):
27 '''Prints writerfilter::ooxml::OOXMLProperty'''
29 def __init__(self
, typename
, value
):
30 self
.typename
= typename
34 return "%s" % (self
.typename
)
37 children
= [ ( 'id', self
.value
['mId'] ),
38 ( 'type', self
.value
['meType'] ),
39 ( 'value', self
.value
['mpValue'] ) ]
40 return children
.__iter
__()
42 class OOXMLPropertySetValuePrinter(object):
43 '''Prints writerfilter::ooxml::OOXMLPropertySetValue'''
45 def __init__(self
, typename
, value
):
46 self
.typename
= typename
50 return "%s" % (self
.typename
)
52 class OOXMLStringValuePrinter(object):
53 '''Prints writerfilter::ooxml::OOXMLStringValue'''
55 def __init__(self
, typename
, value
):
59 return "%s" % (self
.value
['mStr'])
61 class OOXMLIntegerValuePrinter(object):
62 '''Prints writerfilter::ooxml::OOXMLIntegerValue'''
64 def __init__(self
, typename
, value
):
68 return "%d" % (self
.value
['mnValue'])
72 def build_pretty_printers():
75 printer
= printing
.Printer("libreoffice/sw_writerfilter")
76 printer
.add('writerfilter::ooxml::OOXMLProperty', OOXMLPropertyPrinter
)
77 printer
.add('writerfilter::ooxml::OOXMLPropertySet', OOXMLPropertySetPrinter
)
78 printer
.add('writerfilter::ooxml::OOXMLPropertySetValue', OOXMLPropertySetValuePrinter
)
79 printer
.add('writerfilter::ooxml::OOXMLStringValue', OOXMLStringValuePrinter
)
80 printer
.add('writerfilter::ooxml::OOXMLIntegerValue', OOXMLIntegerValuePrinter
)
81 printer
.add('writerfilter::ooxml::OOXMLHexValue', OOXMLIntegerValuePrinter
)
83 def register_pretty_printers(obj
):
84 printing
.register_pretty_printer(printer
, obj
)
86 build_pretty_printers()
88 # vim:set shiftwidth=4 softtabstop=4 expandtab: