merge the formfield patch from ooo-build
[ooovba.git] / xmloff / source / transform / ControlOOoTContext.cxx
blob783b3125658187ab202ae27412e804f6811d1d54
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ControlOOoTContext.cxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include "ControlOOoTContext.hxx"
34 #include "IgnoreTContext.hxx"
35 #include "MutableAttrList.hxx"
36 #include "xmlnmspe.hxx"
37 #include "ActionMapTypesOOo.hxx"
38 #include "ElemTransformerAction.hxx"
39 #include "TransformerActions.hxx"
40 #ifndef _XMLOFF_TRANSFORMERBASE_HXX
41 #include "TransformerBase.hxx"
42 #endif
44 using ::rtl::OUString;
46 using namespace ::com::sun::star::uno;
47 using namespace ::com::sun::star::xml::sax;
48 using namespace ::xmloff::token;
50 TYPEINIT1( XMLControlOOoTransformerContext, XMLTransformerContext );
52 XMLControlOOoTransformerContext::XMLControlOOoTransformerContext(
53 XMLTransformerBase& rImp,
54 const OUString& rQName ) :
55 XMLTransformerContext( rImp, rQName )
59 XMLControlOOoTransformerContext::~XMLControlOOoTransformerContext()
63 void XMLControlOOoTransformerContext::StartElement(
64 const Reference< XAttributeList >& rAttrList )
66 m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True );
69 XMLTransformerContext *XMLControlOOoTransformerContext::CreateChildContext(
70 sal_uInt16 /*nPrefix*/,
71 const OUString& /*rLocalName*/,
72 const OUString& rQName,
73 const Reference< XAttributeList >& rAttrList )
75 XMLTransformerContext *pContext = 0;
77 if( !m_aElemQName.getLength() )
79 pContext = new XMLIgnoreTransformerContext( GetTransformer(),
80 rQName,
81 sal_False, sal_False );
82 m_aElemQName = rQName;
83 static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
84 ->AppendAttributeList( rAttrList );
85 GetTransformer().ProcessAttrList( m_xAttrList,
86 OOO_FORM_CONTROL_ACTIONS,
87 sal_False );
88 GetTransformer().GetDocHandler()->startElement( m_aElemQName,
89 m_xAttrList );
91 else
93 pContext = new XMLIgnoreTransformerContext( GetTransformer(),
94 rQName,
95 sal_True, sal_True );
97 return pContext;
100 void XMLControlOOoTransformerContext::EndElement()
102 GetTransformer().GetDocHandler()->endElement( m_aElemQName );
105 void XMLControlOOoTransformerContext::Characters( const OUString& rChars )
107 // ignore
108 if( m_aElemQName.getLength() )
109 XMLTransformerContext::Characters( rChars );