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 #ifndef _XMLOFF_RENAMEELEMTCONTEXT_HXX
25 #define _XMLOFF_RENAMEELEMTCONTEXT_HXX
26 
27 #include <xmloff/xmltoken.hxx>
28 #include "TransformerContext.hxx"
29 
30 
31 class XMLRenameElemTransformerContext : public XMLTransformerContext
32 {
33 	::rtl::OUString m_aElemQName;
34 	::rtl::OUString m_aAttrQName;
35 	::rtl::OUString m_aAttrValue;
36 
37 public:
38 	TYPEINFO();
39 
40 	// The following consutructor renames the element names "rQName"
41 	// to bPrefix/eToken
42 	XMLRenameElemTransformerContext( XMLTransformerBase& rTransformer,
43 						   const ::rtl::OUString& rQName,
44 		   				   sal_uInt16 nPrefix,
45 		   				   ::xmloff::token::XMLTokenEnum eToken	);
46 
47 	// The following consutructor renames the element names "rQName"
48 	// to bPrefix/eToken and adds an attribute nAPrefix/eAToken that has
49 	// the value eVToken.
50 	XMLRenameElemTransformerContext( XMLTransformerBase& rTransformer,
51 						   const ::rtl::OUString& rQName,
52 		   				   sal_uInt16 nPrefix,
53 		   				   ::xmloff::token::XMLTokenEnum eToken,
54 		   				   sal_uInt16 nAPrefix,
55 		   				   ::xmloff::token::XMLTokenEnum eAToken,
56 		   				   ::xmloff::token::XMLTokenEnum eVToken );
57 
58 	// A contexts destructor does anything that is required if an element
59 	// ends. By default, nothing is done.
60 	// Note that virtual methods cannot be used inside destructors. Use
61 	// EndElement instead if this is required.
62 	virtual ~XMLRenameElemTransformerContext();
63 
64 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
65 	virtual void EndElement();
66 };
67 
68 #endif	//  _XMLOFF_RENAMEELEMCONTEXT_HXX
69 
70