Line data Source code
1 : /*
2 : * This file is part of the LibreOffice project.
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 : *
8 : * This file incorporates work covered by the following license notice:
9 : *
10 : * Licensed to the Apache Software Foundation (ASF) under one or more
11 : * contributor license agreements. See the NOTICE file distributed
12 : * with this work for additional information regarding copyright
13 : * ownership. The ASF licenses this file to you under the Apache
14 : * License, Version 2.0 (the "License"); you may not use this file
15 : * except in compliance with the License. You may obtain a copy of
16 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 : */
18 :
19 : #include "TableDesignPanel.hxx"
20 :
21 :
22 :
23 : namespace sd { namespace sidebar {
24 :
25 :
26 0 : PanelBase::PanelBase (
27 : ::Window* pParentWindow,
28 : ViewShellBase& rViewShellBase)
29 : : Control(pParentWindow),
30 : mpWrappedControl(NULL),
31 : mxSidebar(),
32 0 : mrViewShellBase(rViewShellBase)
33 : {
34 : OSL_TRACE("created PanelBase at %x for parent %x", this, pParentWindow);
35 :
36 : #ifdef DEBUG
37 : SetText(OUString("sd:PanelBase"));
38 : #endif
39 0 : }
40 :
41 :
42 :
43 :
44 0 : PanelBase::~PanelBase (void)
45 : {
46 : OSL_TRACE("deleting wrapped control at %x", mpWrappedControl.get());
47 0 : mpWrappedControl.reset();
48 : OSL_TRACE("deleting PanelBase at %x from parent %x", this, GetParent());
49 0 : }
50 :
51 :
52 :
53 :
54 :
55 0 : void PanelBase::Dispose (void)
56 : {
57 : OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %x", mpWrappedControl.get());
58 0 : mpWrappedControl.reset();
59 0 : }
60 :
61 :
62 :
63 :
64 0 : css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 /*nWidth*/)
65 : {
66 0 : sal_Int32 nHeight (0);
67 0 : if (ProvideWrappedControl())
68 0 : nHeight = mpWrappedControl->GetSizePixel().Height();
69 0 : return css::ui::LayoutSize(nHeight,nHeight,nHeight);
70 : }
71 :
72 :
73 :
74 :
75 0 : void PanelBase::Resize (void)
76 : {
77 0 : if (ProvideWrappedControl())
78 : {
79 0 : Size aNewSize (GetSizePixel());
80 0 : mpWrappedControl->SetOutputSizePixel(aNewSize);
81 : }
82 0 : }
83 :
84 :
85 :
86 :
87 : ::com::sun::star::uno::Reference<
88 0 : ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject (
89 : const ::com::sun::star::uno::Reference<
90 : ::com::sun::star::accessibility::XAccessible>& )
91 : {
92 0 : if (ProvideWrappedControl())
93 0 : return mpWrappedControl->GetAccessible();
94 : else
95 0 : return NULL;
96 : }
97 :
98 :
99 :
100 :
101 0 : void PanelBase::SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar)
102 : {
103 0 : mxSidebar = rxSidebar;
104 0 : if (mxSidebar.is() && mpWrappedControl!=0)
105 0 : mxSidebar->requestLayout();
106 0 : }
107 :
108 :
109 :
110 :
111 0 : bool PanelBase::ProvideWrappedControl (void)
112 : {
113 0 : if ( ! mpWrappedControl)
114 : {
115 0 : mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase));
116 : OSL_TRACE("created wrapped control at %x for parent PanelBase at %x", mpWrappedControl.get(), this);
117 0 : if (mpWrappedControl)
118 0 : mpWrappedControl->Show();
119 0 : if (mxSidebar.is())
120 0 : mxSidebar->requestLayout();
121 : }
122 0 : return mpWrappedControl.get() != NULL;
123 : }
124 :
125 0 : ISidebarReceiver::~ISidebarReceiver()
126 : {
127 0 : }
128 :
129 0 : IDisposable::~IDisposable()
130 : {
131 0 : }
132 :
133 33 : } } // end of namespace sd::sidebar
|