1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_xmloff.hxx" 26 #include "ControlOOoTContext.hxx" 27 #include "IgnoreTContext.hxx" 28 #include "MutableAttrList.hxx" 29 #include "xmloff/xmlnmspe.hxx" 30 #include "ActionMapTypesOOo.hxx" 31 #include "ElemTransformerAction.hxx" 32 #include "TransformerActions.hxx" 33 #ifndef _XMLOFF_TRANSFORMERBASE_HXX 34 #include "TransformerBase.hxx" 35 #endif 36 37 using ::rtl::OUString; 38 39 using namespace ::com::sun::star::uno; 40 using namespace ::com::sun::star::xml::sax; 41 using namespace ::xmloff::token; 42 43 TYPEINIT1( XMLControlOOoTransformerContext, XMLTransformerContext ); 44 45 XMLControlOOoTransformerContext::XMLControlOOoTransformerContext( 46 XMLTransformerBase& rImp, 47 const OUString& rQName ) : 48 XMLTransformerContext( rImp, rQName ) 49 { 50 } 51 52 XMLControlOOoTransformerContext::~XMLControlOOoTransformerContext() 53 { 54 } 55 56 void XMLControlOOoTransformerContext::StartElement( 57 const Reference< XAttributeList >& rAttrList ) 58 { 59 m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True ); 60 } 61 62 XMLTransformerContext *XMLControlOOoTransformerContext::CreateChildContext( 63 sal_uInt16 /*nPrefix*/, 64 const OUString& /*rLocalName*/, 65 const OUString& rQName, 66 const Reference< XAttributeList >& rAttrList ) 67 { 68 XMLTransformerContext *pContext = 0; 69 70 if( !m_aElemQName.getLength() ) 71 { 72 pContext = new XMLIgnoreTransformerContext( GetTransformer(), 73 rQName, 74 sal_False, sal_False ); 75 m_aElemQName = rQName; 76 static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) 77 ->AppendAttributeList( rAttrList ); 78 GetTransformer().ProcessAttrList( m_xAttrList, 79 OOO_FORM_CONTROL_ACTIONS, 80 sal_False ); 81 GetTransformer().GetDocHandler()->startElement( m_aElemQName, 82 m_xAttrList ); 83 } 84 else 85 { 86 pContext = new XMLIgnoreTransformerContext( GetTransformer(), 87 rQName, 88 sal_True, sal_True ); 89 } 90 return pContext; 91 } 92 93 void XMLControlOOoTransformerContext::EndElement() 94 { 95 GetTransformer().GetDocHandler()->endElement( m_aElemQName ); 96 } 97 98 void XMLControlOOoTransformerContext::Characters( const OUString& rChars ) 99 { 100 // ignore 101 if( m_aElemQName.getLength() ) 102 XMLTransformerContext::Characters( rChars ); 103 } 104