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 23 : XMLControlOOoTransformerContext::XMLControlOOoTransformerContext(
37 : XMLTransformerBase& rImp,
38 : const OUString& rQName ) :
39 23 : XMLTransformerContext( rImp, rQName )
40 : {
41 23 : }
42 :
43 46 : XMLControlOOoTransformerContext::~XMLControlOOoTransformerContext()
44 : {
45 46 : }
46 :
47 23 : void XMLControlOOoTransformerContext::StartElement(
48 : const Reference< XAttributeList >& rAttrList )
49 : {
50 23 : m_xAttrList = new XMLMutableAttributeList( rAttrList, true );
51 23 : }
52 :
53 23 : XMLTransformerContext *XMLControlOOoTransformerContext::CreateChildContext(
54 : sal_uInt16 /*nPrefix*/,
55 : const OUString& /*rLocalName*/,
56 : const OUString& rQName,
57 : const Reference< XAttributeList >& rAttrList )
58 : {
59 23 : XMLTransformerContext *pContext = 0;
60 :
61 23 : if( m_aElemQName.isEmpty() )
62 : {
63 23 : pContext = new XMLIgnoreTransformerContext( GetTransformer(),
64 : rQName,
65 23 : false, false );
66 23 : m_aElemQName = rQName;
67 23 : static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
68 23 : ->AppendAttributeList( rAttrList );
69 23 : GetTransformer().ProcessAttrList( m_xAttrList,
70 : OOO_FORM_CONTROL_ACTIONS,
71 46 : false );
72 23 : GetTransformer().GetDocHandler()->startElement( m_aElemQName,
73 23 : m_xAttrList );
74 : }
75 : else
76 : {
77 0 : pContext = new XMLIgnoreTransformerContext( GetTransformer(),
78 : rQName,
79 0 : true, true );
80 : }
81 23 : return pContext;
82 : }
83 :
84 23 : void XMLControlOOoTransformerContext::EndElement()
85 : {
86 23 : GetTransformer().GetDocHandler()->endElement( m_aElemQName );
87 23 : }
88 :
89 12 : void XMLControlOOoTransformerContext::Characters( const OUString& rChars )
90 : {
91 : // ignore
92 12 : if( !m_aElemQName.isEmpty() )
93 6 : XMLTransformerContext::Characters( rChars );
94 12 : }
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|