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 (void)
40 : {
41 : OSL_TRACE("deleting wrapped control at %p", mpWrappedControl.get());
42 0 : mpWrappedControl.reset();
43 : OSL_TRACE("deleting PanelBase at %p from parent %p", this, GetParent());
44 0 : }
45 :
46 0 : void PanelBase::Dispose (void)
47 : {
48 : OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %p", mpWrappedControl.get());
49 0 : mpWrappedControl.reset();
50 0 : }
51 :
52 0 : css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 /*nWidth*/)
53 : {
54 0 : sal_Int32 nHeight (0);
55 0 : if (ProvideWrappedControl())
56 0 : nHeight = mpWrappedControl->GetSizePixel().Height();
57 0 : return css::ui::LayoutSize(nHeight,nHeight,nHeight);
58 : }
59 :
60 0 : void PanelBase::Resize (void)
61 : {
62 0 : if (ProvideWrappedControl())
63 : {
64 0 : Size aNewSize (GetSizePixel());
65 0 : mpWrappedControl->SetOutputSizePixel(aNewSize);
66 : }
67 0 : }
68 :
69 : ::com::sun::star::uno::Reference<
70 0 : ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject (
71 : const ::com::sun::star::uno::Reference<
72 : ::com::sun::star::accessibility::XAccessible>& )
73 : {
74 0 : if (ProvideWrappedControl())
75 0 : return mpWrappedControl->GetAccessible();
76 : else
77 0 : return NULL;
78 : }
79 :
80 0 : void PanelBase::SetSidebar (const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
81 : {
82 0 : mxSidebar = rxSidebar;
83 0 : if (mxSidebar.is() && mpWrappedControl!=0)
84 0 : mxSidebar->requestLayout();
85 0 : }
86 :
87 0 : bool PanelBase::ProvideWrappedControl (void)
88 : {
89 0 : if ( ! mpWrappedControl)
90 : {
91 0 : mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase));
92 : OSL_TRACE("created wrapped control at %p for parent PanelBase at %p", mpWrappedControl.get(), this);
93 0 : if (mpWrappedControl)
94 0 : mpWrappedControl->Show();
95 0 : if (mxSidebar.is())
96 0 : mxSidebar->requestLayout();
97 : }
98 0 : return mpWrappedControl.get() != NULL;
99 : }
100 :
101 0 : ISidebarReceiver::~ISidebarReceiver()
102 : {
103 0 : }
104 :
105 0 : IDisposable::~IDisposable()
106 : {
107 0 : }
108 :
109 114 : } } // end of namespace sd::sidebar
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|