2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 package org
.libreoffice
.report
.pentaho
.styles
;
20 import org
.pentaho
.reporting
.libraries
.xmlns
.parser
.AbstractXmlReadHandler
;
21 import org
.pentaho
.reporting
.libraries
.xmlns
.parser
.ParseException
;
23 import org
.xml
.sax
.Attributes
;
24 import org
.xml
.sax
.SAXException
;
31 public class StyleMappingReadHandler
extends AbstractXmlReadHandler
34 private StyleMappingRule rule
;
39 * @param attrs the attributes.
40 * @throws org.xml.sax.SAXException if there is a parsing error.
43 protected void startParsing(final Attributes attrs
)
46 final String elementNamespace
= attrs
.getValue(getUri(),
48 if (elementNamespace
== null)
50 throw new ParseException("Required attribute 'element-namespace' is missing", getLocator());
53 final String elementName
= attrs
.getValue(getUri(), "element-name");
55 if (elementName
== null)
57 throw new ParseException("Required attribute 'element-name' is missing", getLocator());
60 final String attributeNamespace
= attrs
.getValue(getUri(),
61 "attribute-namespace");
62 final String attributeName
= attrs
.getValue(getUri(), "attribute-name");
64 final boolean listOfValues
=
65 "styleNameRefs".equals(attrs
.getValue(getUri(), "type"));
67 final String family
= attrs
.getValue(getUri(), "style-family");
68 final StyleMapperKey key
= new StyleMapperKey(elementNamespace
, elementName
, attributeNamespace
, attributeName
);
69 rule
= new StyleMappingRule(key
, family
, listOfValues
);
72 public StyleMappingRule
getRule()
78 * Returns the object for this element or null, if this element does not
83 public Object
getObject()