Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sd / source / ui / sidebar / PanelBase.cxx
blob0a6e0fbb77709f6532d167bd7a087df6cbd08cc0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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(nullptr),
29 mrViewShellBase(rViewShellBase)
31 #ifdef DEBUG
32 SetText(OUString("sd:PanelBase"));
33 #endif
36 PanelBase::~PanelBase()
38 disposeOnce();
41 void PanelBase::dispose()
43 mpWrappedControl.disposeAndClear();
44 Control::dispose();
47 css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 /*nWidth*/)
49 sal_Int32 nHeight (0);
50 if (ProvideWrappedControl())
51 nHeight = mpWrappedControl->GetSizePixel().Height();
52 return css::ui::LayoutSize(nHeight,nHeight,nHeight);
55 void PanelBase::Resize()
57 if (ProvideWrappedControl())
59 Size aNewSize (GetSizePixel());
60 mpWrappedControl->SetOutputSizePixel(aNewSize);
64 bool PanelBase::ProvideWrappedControl()
66 if ( ! mpWrappedControl)
68 mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase));
69 if (mpWrappedControl)
70 mpWrappedControl->Show();
72 return mpWrappedControl.get() != nullptr;
75 ISidebarReceiver::~ISidebarReceiver()
79 IDisposable::~IDisposable()
83 } } // end of namespace sd::sidebar
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */