xref: /aoo41x/main/sfx2/source/sidebar/Context.hxx (revision 7a32b0c8)
122de8995SAndre Fischer /**************************************************************
222de8995SAndre Fischer  *
322de8995SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
422de8995SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
522de8995SAndre Fischer  * distributed with this work for additional information
622de8995SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
722de8995SAndre Fischer  * to you under the Apache License, Version 2.0 (the
822de8995SAndre Fischer  * "License"); you may not use this file except in compliance
922de8995SAndre Fischer  * with the License.  You may obtain a copy of the License at
1022de8995SAndre Fischer  *
1122de8995SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
1222de8995SAndre Fischer  *
1322de8995SAndre Fischer  * Unless required by applicable law or agreed to in writing,
1422de8995SAndre Fischer  * software distributed under the License is distributed on an
1522de8995SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1622de8995SAndre Fischer  * KIND, either express or implied.  See the License for the
1722de8995SAndre Fischer  * specific language governing permissions and limitations
1822de8995SAndre Fischer  * under the License.
1922de8995SAndre Fischer  *
2022de8995SAndre Fischer  *************************************************************/
2122de8995SAndre Fischer 
2222de8995SAndre Fischer #ifndef SFX_SIDEBAR_CONTEXT_HXX
2322de8995SAndre Fischer #define SFX_SIDEBAR_CONTEXT_HXX
2422de8995SAndre Fischer 
2522de8995SAndre Fischer #include "rtl/ustring.hxx"
2622de8995SAndre Fischer 
2795a18594SAndre Fischer #include <vector>
2822de8995SAndre Fischer 
29*7a32b0c8SAndre Fischer namespace sfx2 { namespace sidebar {
3022de8995SAndre Fischer 
3122de8995SAndre Fischer class Context
3222de8995SAndre Fischer {
3322de8995SAndre Fischer public:
3422de8995SAndre Fischer     ::rtl::OUString msApplication;
3522de8995SAndre Fischer     ::rtl::OUString msContext;
3622de8995SAndre Fischer 
3722de8995SAndre Fischer     Context (void);
3822de8995SAndre Fischer     Context (
3922de8995SAndre Fischer         const ::rtl::OUString& rsApplication,
4022de8995SAndre Fischer         const ::rtl::OUString& rsContext);
4122de8995SAndre Fischer 
4222de8995SAndre Fischer     /** When two contexts are matched against each other then
4322de8995SAndre Fischer         application or context name may have the wildcard value 'any'.
4422de8995SAndre Fischer         In order to prefer matches without wildcards over matches with
4522de8995SAndre Fischer         wildcards we introduce a integer evaluation for matches.
4622de8995SAndre Fischer     */
4722de8995SAndre Fischer     const static sal_Int32 NoMatch;
4822de8995SAndre Fischer     const static sal_Int32 OptimalMatch;
49*7a32b0c8SAndre Fischer     const static sal_Int32 ApplicationWildcardMatch;
50*7a32b0c8SAndre Fischer     const static sal_Int32 ContextWildcardMatch;
5122de8995SAndre Fischer 
5222de8995SAndre Fischer     /** Return the numeric value that describes how good the match
5322de8995SAndre Fischer         between two contexts is.
5422de8995SAndre Fischer         Smaller values represent better matches.
5522de8995SAndre Fischer     */
5622de8995SAndre Fischer     sal_Int32 EvaluateMatch (const Context& rOther) const;
5722de8995SAndre Fischer 
5822de8995SAndre Fischer     /** Return the best match against the given list of contexts.
5922de8995SAndre Fischer     */
6022de8995SAndre Fischer     sal_Int32 EvaluateMatch (const ::std::vector<Context>& rOthers) const;
61*7a32b0c8SAndre Fischer 
62*7a32b0c8SAndre Fischer     bool operator== (const Context& rOther) const;
63*7a32b0c8SAndre Fischer     bool operator!= (const Context& rOther) const;
6422de8995SAndre Fischer };
6522de8995SAndre Fischer 
6622de8995SAndre Fischer 
67*7a32b0c8SAndre Fischer } } // end of namespace sfx2::sidebar
6822de8995SAndre Fischer 
6922de8995SAndre Fischer #endif
70