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 "TransformerActions.hxx"
27 
28 
29 using ::rtl::OUString;
30 
31 using namespace ::osl;
32 using namespace ::xmloff::token;
33 using namespace ::com::sun::star::uno;
34 
XMLTransformerActions(XMLTransformerActionInit * pInit)35 XMLTransformerActions::XMLTransformerActions( XMLTransformerActionInit *pInit )
36 {
37 	if( pInit )
38 	{
39 		XMLTransformerActions::key_type aKey;
40 		XMLTransformerActions::mapped_type aData;
41 		while( pInit->m_nActionType != XML_TACTION_EOT )
42 		{
43 			aKey.m_nPrefix = pInit->m_nPrefix;
44 			aKey.SetLocalName( pInit->m_eLocalName );
45 
46 			OSL_ENSURE( find( aKey ) == end(), "duplicate action map entry" );
47 
48 			aData.m_nActionType  = pInit->m_nActionType;
49 			aData.m_nParam1 = pInit->m_nParam1;
50 			aData.m_nParam2 = pInit->m_nParam2;
51 			aData.m_nParam3 = pInit->m_nParam3;
52 			XMLTransformerActions::value_type aVal( aKey, aData );
53 
54 			insert( aVal );
55 			++pInit;
56 		}
57 	}
58 }
59 
~XMLTransformerActions()60 XMLTransformerActions::~XMLTransformerActions()
61 {
62 }
63 
Add(XMLTransformerActionInit * pInit)64 void XMLTransformerActions::Add( XMLTransformerActionInit *pInit )
65 {
66 	if( pInit )
67 	{
68 		XMLTransformerActions::key_type aKey;
69 		XMLTransformerActions::mapped_type aData;
70 		while( pInit->m_nActionType != XML_TACTION_EOT )
71 		{
72 			aKey.m_nPrefix = pInit->m_nPrefix;
73 			aKey.SetLocalName( pInit->m_eLocalName );
74 			XMLTransformerActions::iterator aIter = find( aKey );
75 			if( aIter == end() )
76 			{
77 				aData.m_nActionType  = pInit->m_nActionType;
78 				aData.m_nParam1 = pInit->m_nParam1;
79 				aData.m_nParam2 = pInit->m_nParam2;
80 				aData.m_nParam3 = pInit->m_nParam3;
81 				XMLTransformerActions::value_type aVal( aKey, aData );
82 				insert( aVal );
83 			}
84 
85 			++pInit;
86 		}
87 	}
88 }
89