xref: /AOO41X/main/sfx2/source/sidebar/ContextList.hxx (revision 5d39f272d9084beebffa455156ddd8913c39a8d6)
1*5d39f272SZheng Fan /**************************************************************
2*5d39f272SZheng Fan  *
3*5d39f272SZheng Fan  * Licensed to the Apache Software Foundation (ASF) under one
4*5d39f272SZheng Fan  * or more contributor license agreements.  See the NOTICE file
5*5d39f272SZheng Fan  * distributed with this work for additional information
6*5d39f272SZheng Fan  * regarding copyright ownership.  The ASF licenses this file
7*5d39f272SZheng Fan  * to you under the Apache License, Version 2.0 (the
8*5d39f272SZheng Fan  * "License"); you may not use this file except in compliance
9*5d39f272SZheng Fan  * with the License.  You may obtain a copy of the License at
10*5d39f272SZheng Fan  *
11*5d39f272SZheng Fan  *   http://www.apache.org/licenses/LICENSE-2.0
12*5d39f272SZheng Fan  *
13*5d39f272SZheng Fan  * Unless required by applicable law or agreed to in writing,
14*5d39f272SZheng Fan  * software distributed under the License is distributed on an
15*5d39f272SZheng Fan  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5d39f272SZheng Fan  * KIND, either express or implied.  See the License for the
17*5d39f272SZheng Fan  * specific language governing permissions and limitations
18*5d39f272SZheng Fan  * under the License.
19*5d39f272SZheng Fan  *
20*5d39f272SZheng Fan  *************************************************************/
21*5d39f272SZheng Fan 
22*5d39f272SZheng Fan #ifndef SFX_SIDEBAR_CONTEXT_LIST_HXX
23*5d39f272SZheng Fan #define SFX_SIDEBAR_CONTEXT_LIST_HXX
24*5d39f272SZheng Fan 
25*5d39f272SZheng Fan #include "Context.hxx"
26*5d39f272SZheng Fan #include <sal/types.h>
27*5d39f272SZheng Fan #include <rtl/ustring.hxx>
28*5d39f272SZheng Fan 
29*5d39f272SZheng Fan #include <vector>
30*5d39f272SZheng Fan 
31*5d39f272SZheng Fan 
32*5d39f272SZheng Fan namespace sfx2 { namespace sidebar {
33*5d39f272SZheng Fan 
34*5d39f272SZheng Fan 
35*5d39f272SZheng Fan class ContextList
36*5d39f272SZheng Fan {
37*5d39f272SZheng Fan public:
38*5d39f272SZheng Fan     ContextList (void);
39*5d39f272SZheng Fan     ~ContextList (void);
40*5d39f272SZheng Fan 
41*5d39f272SZheng Fan     class Entry
42*5d39f272SZheng Fan     {
43*5d39f272SZheng Fan     public:
44*5d39f272SZheng Fan         Context maContext;
45*5d39f272SZheng Fan         bool mbIsInitiallyVisible;
46*5d39f272SZheng Fan         ::rtl::OUString msMenuCommand;
47*5d39f272SZheng Fan     };
48*5d39f272SZheng Fan 
49*5d39f272SZheng Fan     /** Return <TRUE/> when the given context matches any of the stored contexts.
50*5d39f272SZheng Fan     */
51*5d39f272SZheng Fan     const Entry* GetMatch (
52*5d39f272SZheng Fan         const Context& rContext) const;
53*5d39f272SZheng Fan 
54*5d39f272SZheng Fan     void AddContextDescription (
55*5d39f272SZheng Fan         const Context& rContext,
56*5d39f272SZheng Fan         const bool bIsInitiallyVisible,
57*5d39f272SZheng Fan         const ::rtl::OUString& rsMenuCommand);
58*5d39f272SZheng Fan 
59*5d39f272SZheng Fan     /** Returns <TRUE/> when no call to AddContextDescription() was made before.
60*5d39f272SZheng Fan     */
61*5d39f272SZheng Fan     bool IsEmpty (void);
62*5d39f272SZheng Fan 
63*5d39f272SZheng Fan 
64*5d39f272SZheng Fan private:
65*5d39f272SZheng Fan     ::std::vector<Entry> maEntries;
66*5d39f272SZheng Fan 
67*5d39f272SZheng Fan     ::std::vector<Entry>::const_iterator FindBestMatch (const Context& rContext) const;
68*5d39f272SZheng Fan };
69*5d39f272SZheng Fan 
70*5d39f272SZheng Fan 
71*5d39f272SZheng Fan } } // end of namespace sfx2::sidebar
72*5d39f272SZheng Fan 
73*5d39f272SZheng Fan #endif
74