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 "oox/core/fasttokenhandler.hxx"
21 :
22 : #include <com/sun/star/uno/XComponentContext.hpp>
23 : #include "oox/helper/helper.hxx"
24 : #include "oox/token/tokenmap.hxx"
25 : #include <cppuhelper/supportsservice.hxx>
26 :
27 : namespace oox {
28 : namespace core {
29 :
30 : using namespace ::com::sun::star::uno;
31 :
32 0 : OUString SAL_CALL FastTokenHandler_getImplementationName()
33 : {
34 0 : return OUString( "com.sun.star.comp.oox.core.FastTokenHandler" );
35 : }
36 :
37 0 : Sequence< OUString > SAL_CALL FastTokenHandler_getSupportedServiceNames()
38 : {
39 0 : Sequence< OUString > aServiceNames( 1 );
40 0 : aServiceNames[ 0 ] = "com.sun.star.xml.sax.FastTokenHandler";
41 0 : return aServiceNames;
42 : }
43 :
44 0 : Reference< XInterface > SAL_CALL FastTokenHandler_createInstance( const Reference< XComponentContext >& /*rxContext*/ ) throw (Exception)
45 : {
46 0 : return static_cast< ::cppu::OWeakObject* >( new FastTokenHandler );
47 : }
48 :
49 0 : FastTokenHandler::FastTokenHandler() :
50 0 : mrTokenMap( StaticTokenMap::get() )
51 : {
52 0 : }
53 :
54 0 : FastTokenHandler::~FastTokenHandler()
55 : {
56 0 : }
57 :
58 : // XServiceInfo
59 0 : OUString SAL_CALL FastTokenHandler::getImplementationName() throw (RuntimeException, std::exception)
60 : {
61 0 : return FastTokenHandler_getImplementationName();
62 : }
63 :
64 0 : sal_Bool SAL_CALL FastTokenHandler::supportsService( const OUString& rServiceName ) throw (RuntimeException, std::exception)
65 : {
66 0 : return cppu::supportsService(this, rServiceName);
67 : }
68 :
69 0 : Sequence< OUString > SAL_CALL FastTokenHandler::getSupportedServiceNames() throw (RuntimeException, std::exception)
70 : {
71 0 : return FastTokenHandler_getSupportedServiceNames();
72 : }
73 :
74 : // XFastTokenHandler
75 0 : sal_Int32 FastTokenHandler::getToken( const OUString& rIdentifier ) throw( RuntimeException, std::exception )
76 : {
77 0 : return mrTokenMap.getTokenFromUnicode( rIdentifier );
78 : }
79 :
80 0 : OUString FastTokenHandler::getIdentifier( sal_Int32 nToken ) throw( RuntimeException, std::exception )
81 : {
82 0 : return mrTokenMap.getUnicodeTokenName( nToken );
83 : }
84 :
85 0 : Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken ) throw( RuntimeException, std::exception )
86 : {
87 0 : return mrTokenMap.getUtf8TokenName( nToken );
88 : }
89 :
90 0 : sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier ) throw( RuntimeException, std::exception )
91 : {
92 0 : return mrTokenMap.getTokenFromUtf8( rIdentifier );
93 : }
94 :
95 0 : sal_Int32 FastTokenHandler::getTokenDirect( const char *pToken, sal_Int32 nLength ) const
96 : {
97 0 : return mrTokenMap.getTokenFromUTF8( pToken, nLength );
98 : }
99 :
100 :
101 :
102 : } // namespace core
103 : } // namespace oox
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|