Update ooo320-m1
[ooovba.git] / xmloff / inc / StyleMap.hxx
blob79acc3d44082c8512ec4924363192ac95af9cf9c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: StyleMap.hxx,v $
10 * $Revision: 1.4 $
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_STYLEMAP_HXX
32 #define _XMLOFF_STYLEMAP_HXX
34 #include <com/sun/star/lang/XUnoTunnel.hpp>
35 #include <cppuhelper/implbase1.hxx>
36 #include <hash_map>
38 struct StyleNameKey_Impl
40 sal_uInt16 m_nFamily;
41 ::rtl::OUString m_aName;
43 inline StyleNameKey_Impl( sal_uInt16 nFamily,
44 const ::rtl::OUString& rName ) :
45 m_nFamily( nFamily ),
46 m_aName( rName )
50 inline StyleNameKey_Impl() :
51 m_nFamily( 0 )
56 struct StyleNameHash_Impl
58 inline size_t operator()( const StyleNameKey_Impl& r ) const;
59 inline bool operator()( const StyleNameKey_Impl& r1,
60 const StyleNameKey_Impl& r2 ) const;
63 inline size_t StyleNameHash_Impl::operator()( const StyleNameKey_Impl& r ) const
65 return static_cast< size_t >( r.m_nFamily ) +
66 static_cast< size_t >( r.m_aName.hashCode() );
69 inline bool StyleNameHash_Impl::operator()(
70 const StyleNameKey_Impl& r1,
71 const StyleNameKey_Impl& r2 ) const
73 return r1.m_nFamily == r2.m_nFamily && r1.m_aName == r2.m_aName;
76 class StyleMap :
77 public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XUnoTunnel>,
78 public ::std::hash_map< StyleNameKey_Impl, ::rtl::OUString,
79 StyleNameHash_Impl, StyleNameHash_Impl >
82 public:
84 StyleMap();
85 virtual ~StyleMap();
87 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
88 static StyleMap* getImplementation(
89 ::com::sun::star::uno::Reference<
90 ::com::sun::star::uno::XInterface > ) throw();
92 // XUnoTunnel
93 virtual sal_Int64 SAL_CALL getSomething(
94 const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
97 #endif // _XMLOFF_STYLEMAP_HXX