summaryrefslogtreecommitdiff
path: root/oox/source/core/fasttokenhandler.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/core/fasttokenhandler.cxx')
-rw-r--r--oox/source/core/fasttokenhandler.cxx61
1 files changed, 44 insertions, 17 deletions
diff --git a/oox/source/core/fasttokenhandler.cxx b/oox/source/core/fasttokenhandler.cxx
index c662828bc583..e09687cc5470 100644
--- a/oox/source/core/fasttokenhandler.cxx
+++ b/oox/source/core/fasttokenhandler.cxx
@@ -26,29 +26,38 @@
************************************************************************/
#include "oox/core/fasttokenhandler.hxx"
-#include <osl/mutex.hxx>
-#include "oox/token/tokenmap.hxx"
-using ::rtl::OUString;
-using ::osl::Mutex;
-using ::osl::MutexGuard;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::RuntimeException;
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/token/tokenmap.hxx"
namespace oox {
namespace core {
// ============================================================================
-namespace {
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+OUString SAL_CALL FastTokenHandler_getImplementationName()
+{
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.core.FastTokenHandler" );
+}
-Mutex& lclGetTokenMutex()
+Sequence< OUString > SAL_CALL FastTokenHandler_getSupportedServiceNames()
{
- static Mutex aMutex;
- return aMutex;
+ Sequence< OUString > aServiceNames( 1 );
+ aServiceNames[ 0 ] = CREATE_OUSTRING( "com.sun.star.xml.sax.FastTokenHandler" );
+ return aServiceNames;
}
-} // namespace
+Reference< XInterface > SAL_CALL FastTokenHandler_createInstance( const Reference< XComponentContext >& /*rxContext*/ ) throw (Exception)
+{
+ return static_cast< ::cppu::OWeakObject* >( new FastTokenHandler );
+}
// ============================================================================
@@ -61,27 +70,46 @@ FastTokenHandler::~FastTokenHandler()
{
}
+// XServiceInfo
+
+OUString SAL_CALL FastTokenHandler::getImplementationName() throw (RuntimeException)
+{
+ return FastTokenHandler_getImplementationName();
+}
+
+sal_Bool SAL_CALL FastTokenHandler::supportsService( const OUString& rServiceName ) throw (RuntimeException)
+{
+ Sequence< OUString > aServiceNames = FastTokenHandler_getSupportedServiceNames();
+ for( sal_Int32 nIndex = 0, nLength = aServiceNames.getLength(); nIndex < nLength; ++nIndex )
+ if( aServiceNames[ nIndex ] == rServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL FastTokenHandler::getSupportedServiceNames() throw (RuntimeException)
+{
+ return FastTokenHandler_getSupportedServiceNames();
+}
+
+// XFastTokenHandler
+
sal_Int32 FastTokenHandler::getToken( const OUString& rIdentifier ) throw( RuntimeException )
{
- MutexGuard aGuard( lclGetTokenMutex() );
return mrTokenMap.getTokenFromUnicode( rIdentifier );
}
OUString FastTokenHandler::getIdentifier( sal_Int32 nToken ) throw( RuntimeException )
{
- MutexGuard aGuard( lclGetTokenMutex() );
return mrTokenMap.getUnicodeTokenName( nToken );
}
Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken ) throw( RuntimeException )
{
- MutexGuard aGuard( lclGetTokenMutex() );
return mrTokenMap.getUtf8TokenName( nToken );
}
sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier ) throw( RuntimeException )
{
- MutexGuard aGuard( lclGetTokenMutex() );
return mrTokenMap.getTokenFromUtf8( rIdentifier );
}
@@ -89,4 +117,3 @@ sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdent
} // namespace core
} // namespace oox
-