Update ooo320-m1
[ooovba.git] / xmloff / source / transform / ProcAddAttrTContext.cxx
blob8fc0695ae0f6f5e90a94bb3018c6bc141f72b770
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: ProcAddAttrTContext.cxx,v $
10 * $Revision: 1.7.56.1 $
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 "ProcAddAttrTContext.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;
44 using namespace ::xmloff::token;
46 TYPEINIT1( XMLProcAddAttrTransformerContext, XMLProcAttrTransformerContext);
48 XMLProcAddAttrTransformerContext::XMLProcAddAttrTransformerContext(
49 XMLTransformerBase& rImp,
50 const OUString& rQName,
51 sal_uInt16 nPrefix,
52 ::xmloff::token::XMLTokenEnum eToken,
53 sal_uInt16 nActionMap,
54 sal_uInt16 nAPrefix,
55 ::xmloff::token::XMLTokenEnum eAToken,
56 ::xmloff::token::XMLTokenEnum eVToken ) :
57 XMLProcAttrTransformerContext( rImp, rQName, nPrefix, eToken, nActionMap ),
58 m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nAPrefix,
59 ::xmloff::token::GetXMLToken( eAToken ) ) ),
60 m_aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) )
64 XMLProcAddAttrTransformerContext::~XMLProcAddAttrTransformerContext()
68 void XMLProcAddAttrTransformerContext::StartElement(
69 const Reference< XAttributeList >& rAttrList )
71 Reference< XAttributeList > xAttrList( rAttrList );
72 XMLMutableAttributeList *pMutableAttrList =
73 GetTransformer().ProcessAttrList( xAttrList, GetActionMap(),
74 sal_False );
75 if( !pMutableAttrList )
77 pMutableAttrList = new XMLMutableAttributeList;
78 xAttrList = pMutableAttrList;
80 pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue );
81 GetTransformer().GetDocHandler()->startElement( GetElemQName(), xAttrList );