fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / core / inc / cellkeytranslator.hxx
blob75b62ecb871435af559b0eb9b0eb847d34951fdd
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 #ifndef INCLUDED_SC_SOURCE_CORE_INC_CELLKEYTRANSLATOR_HXX
21 #define INCLUDED_SC_SOURCE_CORE_INC_CELLKEYTRANSLATOR_HXX
23 #include "global.hxx"
24 #include <formula/opcode.hxx>
25 #include <unotools/transliterationwrapper.hxx>
26 #include <list>
27 #include <memory>
28 #include <unordered_map>
30 #include <com/sun/star/lang/Locale.hpp>
32 struct TransItem;
34 struct ScCellKeyword
36 const sal_Char* mpName;
37 OpCode meOpCode;
38 const ::com::sun::star::lang::Locale& mrLocale;
40 ScCellKeyword(const sal_Char* pName, OpCode eOpCode, const ::com::sun::star::lang::Locale& rLocale);
43 typedef std::unordered_map< OUString, ::std::list<ScCellKeyword>, OUStringHash > ScCellKeywordHashMap;
45 /** Translate cell function keywords.
47 This class provides a convenient way to translate a string keyword used as
48 a cell function argument. Since Calc's built-in cell functions don't
49 localize string keywords, this class is used mainly to deal with an Excel
50 document where string names may be localized.
52 To use, simply call the
54 ScCellKeywordTranslator::transKeyword(...)
56 function.
58 Note that when the locale and/or the opcode is specified, the function
59 tries to find a string with matching locale and/or opcode. But when it
60 fails to find one that satisfies the specified locale and/or opcode, it
61 returns a translated string with non-matching locale and/or opcode if
62 available. */
63 class ScCellKeywordTranslator
65 public:
66 static void transKeyword(OUString& rName, const ::com::sun::star::lang::Locale* pLocale = NULL, OpCode eOpCode = ocNone);
67 ~ScCellKeywordTranslator();
69 private:
70 ScCellKeywordTranslator();
72 void init();
73 void addToMap(const OUString& rKey, const sal_Char* pName,
74 const ::com::sun::star::lang::Locale& rLocale,
75 OpCode eOpCode = ocNone);
76 void addToMap(const TransItem* pItems, const ::com::sun::star::lang::Locale& rLocale);
78 static ::std::unique_ptr<ScCellKeywordTranslator> spInstance;
79 ScCellKeywordHashMap maStringNameMap;
80 ::utl::TransliterationWrapper maTransWrapper;
83 #endif
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */