2010-10-12 15:56:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2009-09-17 11:09:25 +00:00
|
|
|
|
|
|
|
#include "oox/core/fasttokenhandler.hxx"
|
|
|
|
|
2010-11-08 13:47:01 +01:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
|
|
|
#include "oox/helper/helper.hxx"
|
2009-09-17 11:09:25 +00:00
|
|
|
#include "oox/token/tokenmap.hxx"
|
2013-10-16 19:25:05 -03:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2009-09-17 11:09:25 +00:00
|
|
|
|
2014-04-14 14:15:12 +02:00
|
|
|
#include <services.hxx>
|
|
|
|
|
2009-09-17 11:09:25 +00:00
|
|
|
namespace oox {
|
|
|
|
namespace core {
|
|
|
|
|
2010-08-26 18:37:44 +02:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
2010-11-08 13:47:01 +01:00
|
|
|
OUString SAL_CALL FastTokenHandler_getImplementationName()
|
|
|
|
{
|
2013-01-04 15:39:44 +01:00
|
|
|
return OUString( "com.sun.star.comp.oox.core.FastTokenHandler" );
|
2010-11-08 13:47:01 +01:00
|
|
|
}
|
2009-09-17 11:09:25 +00:00
|
|
|
|
2010-11-08 13:47:01 +01:00
|
|
|
Sequence< OUString > SAL_CALL FastTokenHandler_getSupportedServiceNames()
|
2009-09-17 11:09:25 +00:00
|
|
|
{
|
2010-11-08 13:47:01 +01:00
|
|
|
Sequence< OUString > aServiceNames( 1 );
|
2013-01-04 15:39:44 +01:00
|
|
|
aServiceNames[ 0 ] = "com.sun.star.xml.sax.FastTokenHandler";
|
2010-11-08 13:47:01 +01:00
|
|
|
return aServiceNames;
|
2009-09-17 11:09:25 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 13:47:01 +01:00
|
|
|
Reference< XInterface > SAL_CALL FastTokenHandler_createInstance( const Reference< XComponentContext >& /*rxContext*/ ) throw (Exception)
|
|
|
|
{
|
|
|
|
return static_cast< ::cppu::OWeakObject* >( new FastTokenHandler );
|
|
|
|
}
|
2009-09-17 11:09:25 +00:00
|
|
|
|
|
|
|
FastTokenHandler::FastTokenHandler() :
|
|
|
|
mrTokenMap( StaticTokenMap::get() )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FastTokenHandler::~FastTokenHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-08 13:47:01 +01:00
|
|
|
// XServiceInfo
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString SAL_CALL FastTokenHandler::getImplementationName() throw (RuntimeException, std::exception)
|
2010-11-08 13:47:01 +01:00
|
|
|
{
|
|
|
|
return FastTokenHandler_getImplementationName();
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL FastTokenHandler::supportsService( const OUString& rServiceName ) throw (RuntimeException, std::exception)
|
2010-11-08 13:47:01 +01:00
|
|
|
{
|
2013-10-16 19:25:05 -03:00
|
|
|
return cppu::supportsService(this, rServiceName);
|
2010-11-08 13:47:01 +01:00
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL FastTokenHandler::getSupportedServiceNames() throw (RuntimeException, std::exception)
|
2010-11-08 13:47:01 +01:00
|
|
|
{
|
|
|
|
return FastTokenHandler_getSupportedServiceNames();
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken ) throw( RuntimeException, std::exception )
|
2009-09-17 11:09:25 +00:00
|
|
|
{
|
|
|
|
return mrTokenMap.getUtf8TokenName( nToken );
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier ) throw( RuntimeException, std::exception )
|
2009-09-17 11:09:25 +00:00
|
|
|
{
|
|
|
|
return mrTokenMap.getTokenFromUtf8( rIdentifier );
|
|
|
|
}
|
|
|
|
|
2013-11-26 16:26:12 +00:00
|
|
|
sal_Int32 FastTokenHandler::getTokenDirect( const char *pToken, sal_Int32 nLength ) const
|
|
|
|
{
|
|
|
|
return mrTokenMap.getTokenFromUTF8( pToken, nLength );
|
|
|
|
}
|
|
|
|
|
2009-09-17 11:09:25 +00:00
|
|
|
} // namespace core
|
|
|
|
} // namespace oox
|
|
|
|
|
2011-05-16 22:22:59 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|