Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "TransformerActions.hxx"
21 :
22 : #include <osl/diagnose.h>
23 :
24 :
25 : using namespace ::osl;
26 : using namespace ::xmloff::token;
27 : using namespace ::com::sun::star::uno;
28 :
29 499 : XMLTransformerActions::XMLTransformerActions( XMLTransformerActionInit *pInit )
30 : {
31 499 : if( pInit )
32 : {
33 499 : XMLTransformerActions::key_type aKey;
34 499 : XMLTransformerActions::mapped_type aData;
35 44001 : while( pInit->m_nActionType != XML_TACTION_EOT )
36 : {
37 43003 : aKey.m_nPrefix = pInit->m_nPrefix;
38 43003 : aKey.SetLocalName( pInit->m_eLocalName );
39 :
40 : OSL_ENSURE( find( aKey ) == end(), "duplicate action map entry" );
41 :
42 43003 : aData.m_nActionType = pInit->m_nActionType;
43 43003 : aData.m_nParam1 = pInit->m_nParam1;
44 43003 : aData.m_nParam2 = pInit->m_nParam2;
45 43003 : aData.m_nParam3 = pInit->m_nParam3;
46 43003 : XMLTransformerActions::value_type aVal( aKey, aData );
47 :
48 43003 : insert( aVal );
49 43003 : ++pInit;
50 43502 : }
51 : }
52 499 : }
53 :
54 499 : XMLTransformerActions::~XMLTransformerActions()
55 : {
56 499 : }
57 :
58 0 : void XMLTransformerActions::Add( XMLTransformerActionInit *pInit )
59 : {
60 0 : if( pInit )
61 : {
62 0 : XMLTransformerActions::key_type aKey;
63 0 : XMLTransformerActions::mapped_type aData;
64 0 : while( pInit->m_nActionType != XML_TACTION_EOT )
65 : {
66 0 : aKey.m_nPrefix = pInit->m_nPrefix;
67 0 : aKey.SetLocalName( pInit->m_eLocalName );
68 0 : XMLTransformerActions::iterator aIter = find( aKey );
69 0 : if( aIter == end() )
70 : {
71 0 : aData.m_nActionType = pInit->m_nActionType;
72 0 : aData.m_nParam1 = pInit->m_nParam1;
73 0 : aData.m_nParam2 = pInit->m_nParam2;
74 0 : aData.m_nParam3 = pInit->m_nParam3;
75 0 : XMLTransformerActions::value_type aVal( aKey, aData );
76 0 : insert( aVal );
77 : }
78 :
79 0 : ++pInit;
80 0 : }
81 : }
82 0 : }
83 :
84 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|