Line data Source code
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 <xmloff/xmlnmspe.hxx>
24 : #include "ActionMapTypesOOo.hxx"
25 : #include "ElemTransformerAction.hxx"
26 : #include "TransformerActions.hxx"
27 : #include "TransformerBase.hxx"
28 :
29 :
30 : using namespace ::com::sun::star::uno;
31 : using namespace ::com::sun::star::xml::sax;
32 : using namespace ::xmloff::token;
33 :
34 0 : TYPEINIT1( XMLControlOOoTransformerContext, XMLTransformerContext );
35 :
36 46 : XMLControlOOoTransformerContext::XMLControlOOoTransformerContext(
37 : XMLTransformerBase& rImp,
38 : const OUString& rQName ) :
39 46 : XMLTransformerContext( rImp, rQName )
40 : {
41 46 : }
42 :
43 92 : XMLControlOOoTransformerContext::~XMLControlOOoTransformerContext()
44 : {
45 92 : }
46 :
47 46 : void XMLControlOOoTransformerContext::StartElement(
48 : const Reference< XAttributeList >& rAttrList )
49 : {
50 46 : m_xAttrList = new XMLMutableAttributeList( rAttrList, true );
51 46 : }
52 :
53 46 : XMLTransformerContext *XMLControlOOoTransformerContext::CreateChildContext(
54 : sal_uInt16 /*nPrefix*/,
55 : const OUString& /*rLocalName*/,
56 : const OUString& rQName,
57 : const Reference< XAttributeList >& rAttrList )
58 : {
59 46 : XMLTransformerContext *pContext = 0;
60 :
61 46 : if( m_aElemQName.isEmpty() )
62 : {
63 46 : pContext = new XMLIgnoreTransformerContext( GetTransformer(),
64 : rQName,
65 46 : false, false );
66 46 : m_aElemQName = rQName;
67 46 : static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
68 46 : ->AppendAttributeList( rAttrList );
69 46 : GetTransformer().ProcessAttrList( m_xAttrList,
70 : OOO_FORM_CONTROL_ACTIONS,
71 92 : false );
72 46 : GetTransformer().GetDocHandler()->startElement( m_aElemQName,
73 46 : m_xAttrList );
74 : }
75 : else
76 : {
77 0 : pContext = new XMLIgnoreTransformerContext( GetTransformer(),
78 : rQName,
79 0 : true, true );
80 : }
81 46 : return pContext;
82 : }
83 :
84 46 : void XMLControlOOoTransformerContext::EndElement()
85 : {
86 46 : GetTransformer().GetDocHandler()->endElement( m_aElemQName );
87 46 : }
88 :
89 24 : void XMLControlOOoTransformerContext::Characters( const OUString& rChars )
90 : {
91 : // ignore
92 24 : if( !m_aElemQName.isEmpty() )
93 12 : XMLTransformerContext::Characters( rChars );
94 24 : }
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|