xref: /trunk/main/sc/inc/formulaparserpool.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_FORMULAPARSERPOOL_HXX
25 #define SC_FORMULAPARSERPOOL_HXX
26 
27 #include <hash_map>
28 #include <com/sun/star/sheet/XFormulaParser.hpp>
29 
30 class ScDocument;
31 
32 // ============================================================================
33 
34 /** Stores the used instances of the FilterFormulaParser service
35     implementations, mapped by the formula namespace they support. */
36 class ScFormulaParserPool
37 {
38 public:
39     explicit            ScFormulaParserPool( const ScDocument& rDoc );
40                         ~ScFormulaParserPool();
41 
42     /** Returns true, if a formula parser is registered for the passed namespace. */
43     bool                hasFormulaParser( const ::rtl::OUString& rNamespace );
44 
45     /** Returns the formula parser that is registered for the passed namespace. */
46     ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser >
47                         getFormulaParser( const ::rtl::OUString& rNamespace );
48 
49 private:
50     typedef ::std::hash_map<
51         ::rtl::OUString,
52         ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser >,
53         ::rtl::OUStringHash,
54         ::std::equal_to< ::rtl::OUString > > ParserMap;
55 
56     const ScDocument&   mrDoc;
57     ParserMap           maParsers;
58 };
59 
60 // ============================================================================
61 
62 #endif
63 
64