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_sd.hxx"
23
24 #include "TableDesignPanel.hxx"
25
26
27
28 namespace sd { namespace sidebar {
29
30
PanelBase(::Window * pParentWindow,ViewShellBase & rViewShellBase)31 PanelBase::PanelBase (
32 ::Window* pParentWindow,
33 ViewShellBase& rViewShellBase)
34 : Control(pParentWindow),
35 mpWrappedControl(NULL),
36 mxSidebar(),
37 mrViewShellBase(rViewShellBase)
38 {
39 OSL_TRACE("created PanelBase at %x for parent %x", this, pParentWindow);
40
41 #ifdef DEBUG
42 SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:PanelBase")));
43 #endif
44 }
45
46
47
48
~PanelBase(void)49 PanelBase::~PanelBase (void)
50 {
51 OSL_TRACE("deleting wrapped control at %x", mpWrappedControl.get());
52 mpWrappedControl.reset();
53 OSL_TRACE("deleting PanelBase at %x from parent %x", this, GetParent());
54 }
55
56
57
58
59
Dispose(void)60 void PanelBase::Dispose (void)
61 {
62 OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %x", mpWrappedControl.get());
63 mpWrappedControl.reset();
64 }
65
66
67
68
GetHeightForWidth(const sal_Int32 nWidth)69 css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 nWidth)
70 {
71 sal_Int32 nHeight (0);
72 if (ProvideWrappedControl())
73 nHeight = mpWrappedControl->GetSizePixel().Height();
74 return css::ui::LayoutSize(nHeight,nHeight,nHeight);
75 }
76
77
78
79
Resize(void)80 void PanelBase::Resize (void)
81 {
82 if (ProvideWrappedControl())
83 {
84 Size aNewSize (GetSizePixel());
85 mpWrappedControl->SetOutputSizePixel(aNewSize);
86 }
87 }
88
89
90
91
92 ::com::sun::star::uno::Reference<
CreateAccessibleObject(const::com::sun::star::uno::Reference<::com::sun::star::accessibility::XAccessible> &)93 ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject (
94 const ::com::sun::star::uno::Reference<
95 ::com::sun::star::accessibility::XAccessible>& )
96 {
97 if (ProvideWrappedControl())
98 return mpWrappedControl->GetAccessible();
99 else
100 return NULL;
101 }
102
103
104
105
SetSidebar(const cssu::Reference<css::ui::XSidebar> & rxSidebar)106 void PanelBase::SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar)
107 {
108 mxSidebar = rxSidebar;
109 if (mxSidebar.is() && bool(mpWrappedControl))
110 mxSidebar->requestLayout();
111 }
112
113
114
115
ProvideWrappedControl(void)116 bool PanelBase::ProvideWrappedControl (void)
117 {
118 if ( ! mpWrappedControl)
119 {
120 mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase));
121 OSL_TRACE("created wrapped control at %x for parent PanelBase at %x", mpWrappedControl.get(), this);
122 if (mpWrappedControl)
123 mpWrappedControl->Show();
124 if (mxSidebar.is())
125 mxSidebar->requestLayout();
126 }
127 return mpWrappedControl.get() != NULL;
128 }
129
130 } } // end of namespace sd::sidebar
131