xref: /aoo42x/main/sfx2/source/sidebar/Deck.hxx (revision a1fa6b52)
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     virtual long Notify (NotifyEvent& rEvent);
77 
78     void PrintWindowTree (void);
79     void PrintWindowTree (const ::std::vector<Panel*>& rPanels);
80     static void PrintWindowSubTree (Window* pRoot, int nIndentation);
81 
82     class ScrollContainerWindow : public Window
83     {
84     public:
85         ScrollContainerWindow (Window* pParentWindow);
86         virtual ~ScrollContainerWindow (void);
87         virtual void Paint (const Rectangle& rUpdateArea);
88         void SetSeparators (const ::std::vector<sal_Int32>& rSeparators);
89     private:
90         ::std::vector<sal_Int32> maSeparators;
91     };
92 
93 private:
94     const ::rtl::OUString msTitle;
95     const ::rtl::OUString msId;
96     Image maIcon;
97     const ::rtl::OUString msIconURL;
98     const ::rtl::OUString msHighContrastIconURL;
99     SharedPanelContainer maPanels;
100     ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
101     ::boost::scoped_ptr<Window> mpScrollClipWindow;
102     ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer;
103     ::boost::scoped_ptr<Window> mpFiller;
104     ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar;
105 
106     DECL_LINK(HandleVerticalScrollBarChange,void*);
107     bool ProcessWheelEvent (
108         CommandEvent* pCommandEvent,
109         NotifyEvent& rEvent);
110 };
111 
112 
113 } } // end of namespace sfx2::sidebar
114 
115 #endif
116