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 : namespace sd { namespace sidebar {
23 :
24 0 : PanelBase::PanelBase (
25 : vcl::Window* pParentWindow,
26 : ViewShellBase& rViewShellBase)
27 : : Control(pParentWindow),
28 : mpWrappedControl(NULL),
29 : mxSidebar(),
30 0 : mrViewShellBase(rViewShellBase)
31 : {
32 : OSL_TRACE("created PanelBase at %p for parent %p", this, pParentWindow);
33 :
34 : #ifdef DEBUG
35 : SetText(OUString("sd:PanelBase"));
36 : #endif
37 0 : }
38 :
39 0 : PanelBase::~PanelBase()
40 : {
41 0 : disposeOnce();
42 0 : }
43 :
44 0 : void PanelBase::dispose()
45 : {
46 0 : mpWrappedControl.disposeAndClear();
47 0 : Control::dispose();
48 0 : }
49 :
50 0 : void PanelBase::Dispose()
51 : {
52 : OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %p", mpWrappedControl.get());
53 0 : mpWrappedControl.disposeAndClear();
54 0 : }
55 :
56 0 : css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 /*nWidth*/)
57 : {
58 0 : sal_Int32 nHeight (0);
59 0 : if (ProvideWrappedControl())
60 0 : nHeight = mpWrappedControl->GetSizePixel().Height();
61 0 : return css::ui::LayoutSize(nHeight,nHeight,nHeight);
62 : }
63 :
64 0 : void PanelBase::Resize()
65 : {
66 0 : if (ProvideWrappedControl())
67 : {
68 0 : Size aNewSize (GetSizePixel());
69 0 : mpWrappedControl->SetOutputSizePixel(aNewSize);
70 : }
71 0 : }
72 :
73 0 : void PanelBase::SetSidebar (const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
74 : {
75 0 : mxSidebar = rxSidebar;
76 0 : if (mxSidebar.is() && mpWrappedControl!=nullptr)
77 0 : mxSidebar->requestLayout();
78 0 : }
79 :
80 0 : bool PanelBase::ProvideWrappedControl()
81 : {
82 0 : if ( ! mpWrappedControl)
83 : {
84 0 : mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase));
85 : OSL_TRACE("created wrapped control at %p for parent PanelBase at %p", mpWrappedControl.get(), this);
86 0 : if (mpWrappedControl)
87 0 : mpWrappedControl->Show();
88 0 : if (mxSidebar.is())
89 0 : mxSidebar->requestLayout();
90 : }
91 0 : return mpWrappedControl.get() != NULL;
92 : }
93 :
94 0 : ISidebarReceiver::~ISidebarReceiver()
95 : {
96 0 : }
97 :
98 0 : IDisposable::~IDisposable()
99 : {
100 0 : }
101 :
102 : } } // end of namespace sd::sidebar
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|