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