xref: /aoo41x/main/sfx2/source/sidebar/Panel.cxx (revision 22de8995)
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 #include "precompiled_sfx2.hxx"
23 
24 #include "Panel.hxx"
25 #include "TitleBar.hxx"
26 #include "ContentPanelDescriptor.hxx"
27 
28 #include <tools/svborder.hxx>
29 
30 
31 using namespace css;
32 using namespace cssu;
33 
34 namespace {
35     static const char* VerticalStackLayouterName("vertical-stack");
36 }
37 
38 
39 namespace sfx2 {
40 
41 Panel::Panel (
42     const ContentPanelDescriptor& rPanelDescriptor,
43     Window* pParentWindow)
44     : Window(pParentWindow),
45       msLayoutHint(rPanelDescriptor.msLayout),
46       mpTitleBar(new TitleBar(rPanelDescriptor.msTitle, false, pParentWindow)),
47       mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional),
48       mxElement(),
49       mxVerticalStackLayoutElement()
50 {
51     SetBackground(Wallpaper(Color(0xff4500)));
52 
53 }
54 
55 
56 
57 
58 Panel::~Panel (void)
59 {
60 }
61 
62 
63 
64 
65 const ::rtl::OUString& Panel::GetLayoutHint (void) const
66 {
67     return msLayoutHint;
68 }
69 
70 
71 
72 
73 TitleBar* Panel::GetTitleBar (void) const
74 {
75     return mpTitleBar;
76 }
77 
78 
79 
80 
81 bool Panel::IsTitleBarOptional (void) const
82 {
83     return mbIsTitleBarOptional;
84 }
85 
86 
87 
88 
89 void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement)
90 {
91     mxElement = rxElement;
92     if (mxElement.is())
93     {
94         SetBackground(Wallpaper());
95 
96         if (msLayoutHint.equalsAscii(VerticalStackLayouterName))
97             mxVerticalStackLayoutElement.set(mxElement->getRealInterface(), UNO_QUERY);
98     }
99 }
100 
101 
102 
103 
104 void Panel::Paint (const Rectangle& rUpdateArea)
105 {
106     Window::Paint(rUpdateArea);
107 }
108 
109 
110 
111 
112 Reference<ui::XVerticalStackLayoutElement> Panel::GetVerticalStackElement (void) const
113 {
114     return mxVerticalStackLayoutElement;
115 }
116 
117 
118 } // end of namespace sfx2
119