xref: /aoo41x/main/sfx2/source/sidebar/Deck.hxx (revision 52d13b84)
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 #ifndef SFX_SIDEBAR_DECK_HXX
23 #define SFX_SIDEBAR_DECK_HXX
24 
25 #include "Panel.hxx"
26 
27 #include <vcl/window.hxx>
28 #include <vcl/image.hxx>
29 #include <com/sun/star/ui/LayoutSize.hpp>
30 
31 #include <boost/function.hpp>
32 #include <boost/scoped_ptr.hpp>
33 
34 class ScrollBar;
35 
36 namespace css = ::com::sun::star;
37 
38 namespace sfx2 { namespace sidebar {
39 
40 class DeckDescriptor;
41 class DeckTitleBar;
42 
43 
44 /** This is the parent window of the panels.
45     It displays the deck title.
46 */
47 class Deck
48     : public Window
49 {
50 public:
51     Deck (
52         const DeckDescriptor& rDeckDescriptor,
53         Window* pParentWindow,
54         const ::boost::function<void(void)>& rCloserAction);
55     virtual ~Deck (void);
56 
57     void Dispose (void);
58 
59     const ::rtl::OUString& GetId (void) const;
60     DeckTitleBar* GetTitleBar (void) const;
61     Rectangle GetContentArea (void) const;
62     ::rtl::OUString GetIconURL (const bool bIsHighContrastModeActive) const;
63     void SetPanels (const SharedPanelContainer& rPanels);
64     const SharedPanelContainer& GetPanels (void) const;
65     void RequestLayout (void);
66     ::Window* GetPanelParentWindow (void);
67 
68     /** Try to make the panel completely visible.
69         When the whole panel does not fit then make its top visible
70         and it off at the bottom.
71     */
72     void ShowPanel (const Panel& rPanel);
73 
74     virtual void Paint (const Rectangle& rUpdateArea);
75     virtual void DataChanged (const DataChangedEvent& rEvent);
76 
77     void PrintWindowTree (void);
78     void PrintWindowTree (const ::std::vector<Panel*>& rPanels);
79     static void PrintWindowSubTree (Window* pRoot, int nIndentation);
80 
81     class ScrollContainerWindow : public Window
82     {
83     public:
84         ScrollContainerWindow (Window* pParentWindow);
85         virtual ~ScrollContainerWindow (void);
86         virtual void Paint (const Rectangle& rUpdateArea);
87         void SetSeparators (const ::std::vector<sal_Int32>& rSeparators);
88     private:
89         ::std::vector<sal_Int32> maSeparators;
90     };
91 
92 private:
93     const ::rtl::OUString msTitle;
94     const ::rtl::OUString msId;
95     Image maIcon;
96     const ::rtl::OUString msIconURL;
97     const ::rtl::OUString msHighContrastIconURL;
98     SharedPanelContainer maPanels;
99     ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
100     ::boost::scoped_ptr<Window> mpScrollClipWindow;
101     ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer;
102     ::boost::scoped_ptr<Window> mpFiller;
103     ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar;
104 
105     DECL_LINK(HandleVerticalScrollBarChange,void*);
106 
107 
108 };
109 
110 
111 } } // end of namespace sfx2::sidebar
112 
113 #endif
114