Update ooo320-m1
[ooovba.git] / xmloff / source / transform / RenameElemTContext.cxx
blob7f28fd1cd065edba023b25e427779b7c9324bad4
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: RenameElemTContext.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 "RenameElemTContext.hxx"
34 #include "MutableAttrList.hxx"
35 #ifndef _XMLOFF_TRANSFORMERBASE_HXX
36 #include "TransformerBase.hxx"
37 #endif
38 #include <xmloff/nmspmap.hxx>
40 using ::rtl::OUString;
42 using namespace ::com::sun::star::uno;
43 using namespace ::com::sun::star::xml::sax;
45 TYPEINIT1( XMLRenameElemTransformerContext, XMLTransformerContext );
47 XMLRenameElemTransformerContext::XMLRenameElemTransformerContext(
48 XMLTransformerBase& rImp,
49 const OUString& rQName,
50 sal_uInt16 nPrefix,
51 ::xmloff::token::XMLTokenEnum eToken ) :
52 XMLTransformerContext( rImp, rQName ),
53 m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
54 ::xmloff::token::GetXMLToken( eToken ) ) )
58 XMLRenameElemTransformerContext::XMLRenameElemTransformerContext(
59 XMLTransformerBase& rImp,
60 const OUString& rQName,
61 sal_uInt16 nPrefix,
62 ::xmloff::token::XMLTokenEnum eToken,
63 sal_uInt16 nAPrefix,
64 ::xmloff::token::XMLTokenEnum eAToken,
65 ::xmloff::token::XMLTokenEnum eVToken ) :
66 XMLTransformerContext( rImp, rQName ),
67 m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
68 ::xmloff::token::GetXMLToken( eToken ) ) ),
69 m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nAPrefix,
70 ::xmloff::token::GetXMLToken( eAToken ) ) ),
71 m_aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) )
75 XMLRenameElemTransformerContext::~XMLRenameElemTransformerContext()
79 void XMLRenameElemTransformerContext::StartElement(
80 const Reference< XAttributeList >& rAttrList )
82 Reference< XAttributeList > xAttrList( rAttrList );
83 if( m_aAttrQName.getLength() )
85 XMLMutableAttributeList *pMutableAttrList =
86 new XMLMutableAttributeList( xAttrList );
87 xAttrList = pMutableAttrList;
88 pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue );
90 GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
93 void XMLRenameElemTransformerContext::EndElement()
95 GetTransformer().GetDocHandler()->endElement( m_aElemQName );