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 #ifndef OOX_CORE_FASTTOKENHANDLER_HXX
25 #define OOX_CORE_FASTTOKENHANDLER_HXX
26 
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
29 #include <cppuhelper/implbase2.hxx>
30 
31 namespace oox { class TokenMap; }
32 
33 namespace oox {
34 namespace core {
35 
36 // ============================================================================
37 
38 typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandler_BASE;
39 
40 /** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface
41     that provides access to the tokens generated from the internal token name list.
42  */
43 class FastTokenHandler : public FastTokenHandler_BASE
44 {
45 public:
46     explicit            FastTokenHandler();
47     virtual             ~FastTokenHandler();
48 
49     // XServiceInfo
50     virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
51     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
52     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
53 
54     // XFastTokenHandler
55     virtual sal_Int32 SAL_CALL getToken( const ::rtl::OUString& rIdentifier ) throw (::com::sun::star::uno::RuntimeException);
56     virtual ::rtl::OUString SAL_CALL getIdentifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
57     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
58     virtual sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
59 
60 private:
61     const TokenMap&     mrTokenMap;     /// Reference to global token map singleton.
62 };
63 
64 // ============================================================================
65 
66 } // namespace core
67 } // namespace oox
68 
69 #endif
70