1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TransformerActions.hxx,v $
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 #ifndef _XMLOFF_TRANSFORMERACTIONS_HXX
32 #define _XMLOFF_TRANSFORMERACTIONS_HXX
34 #include <rtl/ustring.hxx>
35 #include <xmloff/nmspmap.hxx>
38 #include "TransformerActionInit.hxx"
39 #include "TransformerAction.hxx"
44 ::rtl::OUString m_aLocalName
;
46 inline NameKey_Impl( sal_uInt16 nPrfx
,
47 ::xmloff::token::XMLTokenEnum eLclNm
) :
49 m_aLocalName( ::xmloff::token::GetXMLToken( eLclNm
) )
53 inline NameKey_Impl( sal_uInt16 nPrfx
, const ::rtl::OUString
& rLclNm
) :
55 m_aLocalName( rLclNm
)
59 inline NameKey_Impl() :
60 m_nPrefix( XML_NAMESPACE_UNKNOWN
)
64 inline void SetLocalName( ::xmloff::token::XMLTokenEnum eLclNm
)
66 m_aLocalName
= ::xmloff::token::GetXMLToken( eLclNm
);
70 // -----------------------------------------------------------------------------
74 inline size_t operator()( const NameKey_Impl
& r
) const;
75 inline bool operator()( const NameKey_Impl
& r1
,
76 const NameKey_Impl
& r2
) const;
79 inline size_t NameHash_Impl::operator()( const NameKey_Impl
& r
) const
81 return static_cast< size_t >( r
.m_nPrefix
) +
82 static_cast< size_t >( r
.m_aLocalName
.hashCode() );
85 inline bool NameHash_Impl::operator()(
86 const NameKey_Impl
& r1
,
87 const NameKey_Impl
& r2
) const
89 return r1
.m_nPrefix
== r2
.m_nPrefix
&& r1
.m_aLocalName
== r2
.m_aLocalName
;
92 // -----------------------------------------------------------------------------
94 struct TransformerAction_Impl
96 sal_uInt32 m_nActionType
;
101 inline TransformerAction_Impl( sal_uInt32 nActnTp
, sal_uInt32 nPrm1
,
102 sal_uInt32 nPrm2
, sal_uInt32 nPrm3
) :
103 m_nActionType( nActnTp
),
110 inline TransformerAction_Impl() :
111 m_nActionType( XML_TACTION_EOT
),
118 sal_uInt16
GetQNamePrefixFromParam1() const
120 return static_cast< sal_uInt16
>( m_nParam1
>> 16 );
123 sal_uInt16
GetQNamePrefixFromParam2() const
125 return static_cast< sal_uInt16
>( m_nParam2
>> 16 );
128 sal_uInt16
GetQNamePrefixFromParam3() const
130 return static_cast< sal_uInt16
>( m_nParam3
>> 16 );
133 ::xmloff::token::XMLTokenEnum
GetQNameTokenFromParam1() const
135 return static_cast< ::xmloff::token::XMLTokenEnum
>( m_nParam1
& 0xffff );
138 ::xmloff::token::XMLTokenEnum
GetQNameTokenFromParam2() const
140 return static_cast< ::xmloff::token::XMLTokenEnum
>( m_nParam2
& 0xffff );
143 ::xmloff::token::XMLTokenEnum
GetQNameTokenFromParam3() const
145 return static_cast< ::xmloff::token::XMLTokenEnum
>( m_nParam3
& 0xffff );
151 // -----------------------------------------------------------------------------
153 class XMLTransformerActions
:
154 public ::std::hash_map
< NameKey_Impl
, TransformerAction_Impl
,
155 NameHash_Impl
, NameHash_Impl
>
158 XMLTransformerActions( XMLTransformerActionInit
*pInit
);
159 ~XMLTransformerActions();
161 void Add( XMLTransformerActionInit
*pInit
);
164 #endif // _XMLOFF_TRANSFORMERACTIONS_HXX