1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "TableDesignPanel.hxx"
22 namespace sd
{ namespace sidebar
{
24 PanelBase::PanelBase (
25 vcl::Window
* pParentWindow
,
26 ViewShellBase
& rViewShellBase
)
27 : Control(pParentWindow
),
28 mpWrappedControl(NULL
),
30 mrViewShellBase(rViewShellBase
)
32 OSL_TRACE("created PanelBase at %p for parent %p", this, pParentWindow
);
35 SetText(OUString("sd:PanelBase"));
39 PanelBase::~PanelBase()
44 void PanelBase::dispose()
46 mpWrappedControl
.disposeAndClear();
50 void PanelBase::Dispose()
52 OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %p", mpWrappedControl
.get());
53 mpWrappedControl
.disposeAndClear();
56 css::ui::LayoutSize
PanelBase::GetHeightForWidth (const sal_Int32
/*nWidth*/)
58 sal_Int32
nHeight (0);
59 if (ProvideWrappedControl())
60 nHeight
= mpWrappedControl
->GetSizePixel().Height();
61 return css::ui::LayoutSize(nHeight
,nHeight
,nHeight
);
64 void PanelBase::Resize()
66 if (ProvideWrappedControl())
68 Size
aNewSize (GetSizePixel());
69 mpWrappedControl
->SetOutputSizePixel(aNewSize
);
73 void PanelBase::SetSidebar (const css::uno::Reference
<css::ui::XSidebar
>& rxSidebar
)
75 mxSidebar
= rxSidebar
;
76 if (mxSidebar
.is() && mpWrappedControl
!=nullptr)
77 mxSidebar
->requestLayout();
80 bool PanelBase::ProvideWrappedControl()
82 if ( ! mpWrappedControl
)
84 mpWrappedControl
.reset(CreateWrappedControl(this, mrViewShellBase
));
85 OSL_TRACE("created wrapped control at %p for parent PanelBase at %p", mpWrappedControl
.get(), this);
87 mpWrappedControl
->Show();
89 mxSidebar
->requestLayout();
91 return mpWrappedControl
.get() != NULL
;
94 ISidebarReceiver::~ISidebarReceiver()
98 IDisposable::~IDisposable()
102 } } // end of namespace sd::sidebar
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */