xref: /AOO41X/main/sfx2/source/sidebar/ContextList.hxx (revision 3ce09a58b0d6873449cda31e55c66dba2dbc8f7f)
15d39f272SZheng Fan /**************************************************************
25d39f272SZheng Fan  *
35d39f272SZheng Fan  * Licensed to the Apache Software Foundation (ASF) under one
45d39f272SZheng Fan  * or more contributor license agreements.  See the NOTICE file
55d39f272SZheng Fan  * distributed with this work for additional information
65d39f272SZheng Fan  * regarding copyright ownership.  The ASF licenses this file
75d39f272SZheng Fan  * to you under the Apache License, Version 2.0 (the
85d39f272SZheng Fan  * "License"); you may not use this file except in compliance
95d39f272SZheng Fan  * with the License.  You may obtain a copy of the License at
105d39f272SZheng Fan  *
115d39f272SZheng Fan  *   http://www.apache.org/licenses/LICENSE-2.0
125d39f272SZheng Fan  *
135d39f272SZheng Fan  * Unless required by applicable law or agreed to in writing,
145d39f272SZheng Fan  * software distributed under the License is distributed on an
155d39f272SZheng Fan  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165d39f272SZheng Fan  * KIND, either express or implied.  See the License for the
175d39f272SZheng Fan  * specific language governing permissions and limitations
185d39f272SZheng Fan  * under the License.
195d39f272SZheng Fan  *
205d39f272SZheng Fan  *************************************************************/
215d39f272SZheng Fan 
225d39f272SZheng Fan #ifndef SFX_SIDEBAR_CONTEXT_LIST_HXX
235d39f272SZheng Fan #define SFX_SIDEBAR_CONTEXT_LIST_HXX
245d39f272SZheng Fan 
255d39f272SZheng Fan #include "Context.hxx"
265d39f272SZheng Fan #include <sal/types.h>
275d39f272SZheng Fan #include <rtl/ustring.hxx>
285d39f272SZheng Fan 
295d39f272SZheng Fan #include <vector>
305d39f272SZheng Fan 
315d39f272SZheng Fan 
325d39f272SZheng Fan namespace sfx2 { namespace sidebar {
335d39f272SZheng Fan 
34*7e429a12SAndre Fischer /** Per context data for deck and panel descriptors.
35*7e429a12SAndre Fischer */
365d39f272SZheng Fan class ContextList
375d39f272SZheng Fan {
385d39f272SZheng Fan public:
395d39f272SZheng Fan     ContextList (void);
405d39f272SZheng Fan     ~ContextList (void);
415d39f272SZheng Fan 
425d39f272SZheng Fan     class Entry
435d39f272SZheng Fan     {
445d39f272SZheng Fan     public:
455d39f272SZheng Fan         Context maContext;
465d39f272SZheng Fan         bool mbIsInitiallyVisible;
475d39f272SZheng Fan         ::rtl::OUString msMenuCommand;
485d39f272SZheng Fan     };
495d39f272SZheng Fan 
505d39f272SZheng Fan     /** Return <TRUE/> when the given context matches any of the stored contexts.
515d39f272SZheng Fan     */
525d39f272SZheng Fan     const Entry* GetMatch (
535d39f272SZheng Fan         const Context& rContext) const;
54*7e429a12SAndre Fischer     Entry* GetMatch (
55*7e429a12SAndre Fischer         const Context& rContext);
565d39f272SZheng Fan 
575d39f272SZheng Fan     void AddContextDescription (
585d39f272SZheng Fan         const Context& rContext,
595d39f272SZheng Fan         const bool bIsInitiallyVisible,
605d39f272SZheng Fan         const ::rtl::OUString& rsMenuCommand);
615d39f272SZheng Fan 
625d39f272SZheng Fan     /** Returns <TRUE/> when no call to AddContextDescription() was made before.
635d39f272SZheng Fan     */
645d39f272SZheng Fan     bool IsEmpty (void);
655d39f272SZheng Fan 
665d39f272SZheng Fan 
675d39f272SZheng Fan private:
685d39f272SZheng Fan     ::std::vector<Entry> maEntries;
695d39f272SZheng Fan 
705d39f272SZheng Fan     ::std::vector<Entry>::const_iterator FindBestMatch (const Context& rContext) const;
715d39f272SZheng Fan };
725d39f272SZheng Fan 
735d39f272SZheng Fan 
745d39f272SZheng Fan } } // end of namespace sfx2::sidebar
755d39f272SZheng Fan 
765d39f272SZheng Fan #endif
77