xref: /trunk/main/xmloff/source/transform/TransformerActions.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmloff.hxx"
30 #include "TransformerActions.hxx"
31 
32 
33 using ::rtl::OUString;
34 
35 using namespace ::osl;
36 using namespace ::xmloff::token;
37 using namespace ::com::sun::star::uno;
38 
39 XMLTransformerActions::XMLTransformerActions( XMLTransformerActionInit *pInit )
40 {
41     if( pInit )
42     {
43         XMLTransformerActions::key_type aKey;
44         XMLTransformerActions::data_type aData;
45         while( pInit->m_nActionType != XML_TACTION_EOT )
46         {
47             aKey.m_nPrefix = pInit->m_nPrefix;
48             aKey.SetLocalName( pInit->m_eLocalName );
49 
50             OSL_ENSURE( find( aKey ) == end(), "duplicate action map entry" );
51 
52             aData.m_nActionType  = pInit->m_nActionType;
53             aData.m_nParam1 = pInit->m_nParam1;
54             aData.m_nParam2 = pInit->m_nParam2;
55             aData.m_nParam3 = pInit->m_nParam3;
56             XMLTransformerActions::value_type aVal( aKey, aData );
57 
58             insert( aVal );
59             ++pInit;
60         }
61     }
62 }
63 
64 XMLTransformerActions::~XMLTransformerActions()
65 {
66 }
67 
68 void XMLTransformerActions::Add( XMLTransformerActionInit *pInit )
69 {
70     if( pInit )
71     {
72         XMLTransformerActions::key_type aKey;
73         XMLTransformerActions::data_type aData;
74         while( pInit->m_nActionType != XML_TACTION_EOT )
75         {
76             aKey.m_nPrefix = pInit->m_nPrefix;
77             aKey.SetLocalName( pInit->m_eLocalName );
78             XMLTransformerActions::iterator aIter = find( aKey );
79             if( aIter == end() )
80             {
81                 aData.m_nActionType  = pInit->m_nActionType;
82                 aData.m_nParam1 = pInit->m_nParam1;
83                 aData.m_nParam2 = pInit->m_nParam2;
84                 aData.m_nParam3 = pInit->m_nParam3;
85                 XMLTransformerActions::value_type aVal( aKey, aData );
86                 insert( aVal );
87             }
88 
89             ++pInit;
90         }
91     }
92 }
93