2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-11 09:51:50 +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 .
|
|
|
|
*/
|
2013-10-23 19:16:30 +02:00
|
|
|
#ifndef INCLUDED_UNOTOOLS_ATOM_HXX
|
|
|
|
#define INCLUDED_UNOTOOLS_ATOM_HXX
|
2000-10-27 14:18:39 +00:00
|
|
|
|
2013-11-09 15:34:19 -06:00
|
|
|
#include <unotools/unotoolsdllapi.h>
|
2001-05-10 10:34:11 +00:00
|
|
|
#include <rtl/ustring.hxx>
|
2000-10-27 14:18:39 +00:00
|
|
|
#include <osl/mutex.hxx>
|
2015-01-01 19:58:59 +00:00
|
|
|
#include <com/sun/star/util/XAtomServer.hpp>
|
2000-10-27 14:18:39 +00:00
|
|
|
#include <cppuhelper/implbase1.hxx>
|
|
|
|
#include <list>
|
2015-01-01 19:58:59 +00:00
|
|
|
#include <unordered_map>
|
2000-10-27 14:18:39 +00:00
|
|
|
|
|
|
|
#define INVALID_ATOM 0
|
|
|
|
|
|
|
|
namespace utl {
|
|
|
|
|
|
|
|
struct AtomDescription
|
|
|
|
{
|
|
|
|
int atom;
|
2012-09-21 22:16:42 -03:00
|
|
|
OUString description;
|
2000-10-27 14:18:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class AtomProvider
|
|
|
|
{
|
2015-02-15 20:41:33 +00:00
|
|
|
int m_nAtoms;
|
|
|
|
std::unordered_map<int, OUString> m_aStringMap;
|
|
|
|
std::unordered_map<OUString, int, OUStringHash> m_aAtomMap;
|
2000-10-27 14:18:39 +00:00
|
|
|
public:
|
|
|
|
AtomProvider();
|
|
|
|
~AtomProvider();
|
|
|
|
|
2014-02-19 12:30:34 +01:00
|
|
|
int getAtom( const OUString&, bool bCreate = false );
|
2012-09-21 22:16:42 -03:00
|
|
|
const OUString& getString( int ) const;
|
2000-10-27 14:18:39 +00:00
|
|
|
};
|
|
|
|
|
2005-04-13 11:22:44 +00:00
|
|
|
class UNOTOOLS_DLLPUBLIC MultiAtomProvider
|
2000-10-27 14:18:39 +00:00
|
|
|
{
|
2015-02-15 20:41:33 +00:00
|
|
|
std::unordered_map<int, AtomProvider*> m_aAtomLists;
|
2000-10-27 14:18:39 +00:00
|
|
|
public:
|
|
|
|
MultiAtomProvider();
|
|
|
|
~MultiAtomProvider();
|
|
|
|
|
2014-02-19 12:30:34 +01:00
|
|
|
int getAtom( int atomClass, const OUString& rString, bool bCreate = false );
|
2000-10-27 14:18:39 +00:00
|
|
|
|
2012-09-21 22:16:42 -03:00
|
|
|
const OUString& getString( int atomClass, int atom ) const;
|
2000-10-27 14:18:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|