Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / oox / source / core / fasttokenhandler.cxx
blob7709c6c5a25a83ccf7322f926097911b3c52e9ab
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <oox/core/fasttokenhandler.hxx>
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>
27 #include <services.hxx>
29 namespace oox {
30 namespace core {
32 using namespace ::com::sun::star::uno;
34 OUString FastTokenHandler_getImplementationName()
36 return OUString( "com.sun.star.comp.oox.core.FastTokenHandler" );
39 Sequence< OUString > FastTokenHandler_getSupportedServiceNames()
41 Sequence<OUString> aServiceNames { "com.sun.star.xml.sax.FastTokenHandler" };
42 return aServiceNames;
45 Reference< XInterface > FastTokenHandler_createInstance( const Reference< XComponentContext >& /*rxContext*/ )
47 return static_cast< ::cppu::OWeakObject* >( new FastTokenHandler );
50 FastTokenHandler::FastTokenHandler() :
51 mrTokenMap( StaticTokenMap::get() )
55 FastTokenHandler::~FastTokenHandler()
59 // XServiceInfo
60 OUString SAL_CALL FastTokenHandler::getImplementationName()
62 return FastTokenHandler_getImplementationName();
65 sal_Bool SAL_CALL FastTokenHandler::supportsService( const OUString& rServiceName )
67 return cppu::supportsService(this, rServiceName);
70 Sequence< OUString > SAL_CALL FastTokenHandler::getSupportedServiceNames()
72 return FastTokenHandler_getSupportedServiceNames();
75 Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken )
77 return mrTokenMap.getUtf8TokenName( nToken );
80 sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier )
82 return mrTokenMap.getTokenFromUtf8( rIdentifier );
85 sal_Int32 FastTokenHandler::getTokenDirect( const char *pToken, sal_Int32 nLength ) const
87 return mrTokenMap.getTokenFromUTF8( pToken, nLength );
90 } // namespace core
91 } // namespace oox
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */