/src/libreoffice/xmloff/source/transform/ControlOOoTContext.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #include "ControlOOoTContext.hxx" |
21 | | #include "IgnoreTContext.hxx" |
22 | | #include "MutableAttrList.hxx" |
23 | | #include "ActionMapTypesOOo.hxx" |
24 | | #include "TransformerBase.hxx" |
25 | | |
26 | | |
27 | | using namespace ::com::sun::star::uno; |
28 | | using namespace ::com::sun::star::xml::sax; |
29 | | |
30 | | XMLControlOOoTransformerContext::XMLControlOOoTransformerContext( |
31 | | XMLTransformerBase& rImp, |
32 | | const OUString& rQName ) : |
33 | 0 | XMLTransformerContext( rImp, rQName ) |
34 | 0 | { |
35 | 0 | } |
36 | | |
37 | | void XMLControlOOoTransformerContext::StartElement( |
38 | | const Reference< XAttributeList >& rAttrList ) |
39 | 0 | { |
40 | 0 | m_xAttrList = new XMLMutableAttributeList( rAttrList, true ); |
41 | 0 | } |
42 | | |
43 | | rtl::Reference<XMLTransformerContext> XMLControlOOoTransformerContext::CreateChildContext( |
44 | | sal_uInt16 /*nPrefix*/, |
45 | | const OUString& /*rLocalName*/, |
46 | | const OUString& rQName, |
47 | | const Reference< XAttributeList >& rAttrList ) |
48 | 0 | { |
49 | 0 | rtl::Reference<XMLTransformerContext> pContext; |
50 | |
|
51 | 0 | if( m_aElemQName.isEmpty() ) |
52 | 0 | { |
53 | 0 | pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), |
54 | 0 | rQName, |
55 | 0 | false, false )); |
56 | 0 | m_aElemQName = rQName; |
57 | 0 | static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) |
58 | 0 | ->AppendAttributeList( rAttrList ); |
59 | 0 | GetTransformer().ProcessAttrList( m_xAttrList, |
60 | 0 | OOO_FORM_CONTROL_ACTIONS, |
61 | 0 | false ); |
62 | 0 | GetTransformer().GetDocHandler()->startElement( m_aElemQName, |
63 | 0 | m_xAttrList ); |
64 | 0 | } |
65 | 0 | else |
66 | 0 | { |
67 | 0 | pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), |
68 | 0 | rQName, |
69 | 0 | true, true )); |
70 | 0 | } |
71 | 0 | return pContext; |
72 | 0 | } |
73 | | |
74 | | void XMLControlOOoTransformerContext::EndElement() |
75 | 0 | { |
76 | 0 | GetTransformer().GetDocHandler()->endElement( m_aElemQName ); |
77 | 0 | } |
78 | | |
79 | | void XMLControlOOoTransformerContext::Characters( const OUString& rChars ) |
80 | 0 | { |
81 | | // ignore |
82 | 0 | if( !m_aElemQName.isEmpty() ) |
83 | 0 | XMLTransformerContext::Characters( rChars ); |
84 | 0 | } |
85 | | |
86 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |