102c50d82SAndre Fischer /**************************************************************
202c50d82SAndre Fischer *
302c50d82SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one
402c50d82SAndre Fischer * or more contributor license agreements. See the NOTICE file
502c50d82SAndre Fischer * distributed with this work for additional information
602c50d82SAndre Fischer * regarding copyright ownership. The ASF licenses this file
702c50d82SAndre Fischer * to you under the Apache License, Version 2.0 (the
802c50d82SAndre Fischer * "License"); you may not use this file except in compliance
902c50d82SAndre Fischer * with the License. You may obtain a copy of the License at
1002c50d82SAndre Fischer *
1102c50d82SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0
1202c50d82SAndre Fischer *
1302c50d82SAndre Fischer * Unless required by applicable law or agreed to in writing,
1402c50d82SAndre Fischer * software distributed under the License is distributed on an
1502c50d82SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1602c50d82SAndre Fischer * KIND, either express or implied. See the License for the
1702c50d82SAndre Fischer * specific language governing permissions and limitations
1802c50d82SAndre Fischer * under the License.
1902c50d82SAndre Fischer *
2002c50d82SAndre Fischer *************************************************************/
2102c50d82SAndre Fischer
2202c50d82SAndre Fischer #include "precompiled_sd.hxx"
2302c50d82SAndre Fischer
2402c50d82SAndre Fischer #include "TableDesignPanel.hxx"
2502c50d82SAndre Fischer
2602c50d82SAndre Fischer
2702c50d82SAndre Fischer
2802c50d82SAndre Fischer namespace sd { namespace sidebar {
2902c50d82SAndre Fischer
3002c50d82SAndre Fischer
PanelBase(::Window * pParentWindow,ViewShellBase & rViewShellBase)3102c50d82SAndre Fischer PanelBase::PanelBase (
3202c50d82SAndre Fischer ::Window* pParentWindow,
3302c50d82SAndre Fischer ViewShellBase& rViewShellBase)
3402c50d82SAndre Fischer : Control(pParentWindow),
3502c50d82SAndre Fischer mpWrappedControl(NULL),
3602c50d82SAndre Fischer mxSidebar(),
3702c50d82SAndre Fischer mrViewShellBase(rViewShellBase)
3802c50d82SAndre Fischer {
3902c50d82SAndre Fischer OSL_TRACE("created PanelBase at %x for parent %x", this, pParentWindow);
4002c50d82SAndre Fischer
4102c50d82SAndre Fischer #ifdef DEBUG
4202c50d82SAndre Fischer SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:PanelBase")));
4302c50d82SAndre Fischer #endif
4402c50d82SAndre Fischer }
4502c50d82SAndre Fischer
4602c50d82SAndre Fischer
4702c50d82SAndre Fischer
4802c50d82SAndre Fischer
~PanelBase(void)4902c50d82SAndre Fischer PanelBase::~PanelBase (void)
5002c50d82SAndre Fischer {
5102c50d82SAndre Fischer OSL_TRACE("deleting wrapped control at %x", mpWrappedControl.get());
5202c50d82SAndre Fischer mpWrappedControl.reset();
5302c50d82SAndre Fischer OSL_TRACE("deleting PanelBase at %x from parent %x", this, GetParent());
5402c50d82SAndre Fischer }
5502c50d82SAndre Fischer
5602c50d82SAndre Fischer
5702c50d82SAndre Fischer
5802c50d82SAndre Fischer
5902c50d82SAndre Fischer
Dispose(void)6002c50d82SAndre Fischer void PanelBase::Dispose (void)
6102c50d82SAndre Fischer {
6202c50d82SAndre Fischer OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %x", mpWrappedControl.get());
6302c50d82SAndre Fischer mpWrappedControl.reset();
6402c50d82SAndre Fischer }
6502c50d82SAndre Fischer
6602c50d82SAndre Fischer
6702c50d82SAndre Fischer
6802c50d82SAndre Fischer
GetHeightForWidth(const sal_Int32 nWidth)6902c50d82SAndre Fischer css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 nWidth)
7002c50d82SAndre Fischer {
7102c50d82SAndre Fischer sal_Int32 nHeight (0);
7202c50d82SAndre Fischer if (ProvideWrappedControl())
7302c50d82SAndre Fischer nHeight = mpWrappedControl->GetSizePixel().Height();
7402c50d82SAndre Fischer return css::ui::LayoutSize(nHeight,nHeight,nHeight);
7502c50d82SAndre Fischer }
7602c50d82SAndre Fischer
7702c50d82SAndre Fischer
7802c50d82SAndre Fischer
7902c50d82SAndre Fischer
Resize(void)8002c50d82SAndre Fischer void PanelBase::Resize (void)
8102c50d82SAndre Fischer {
8202c50d82SAndre Fischer if (ProvideWrappedControl())
8302c50d82SAndre Fischer {
8402c50d82SAndre Fischer Size aNewSize (GetSizePixel());
8502c50d82SAndre Fischer mpWrappedControl->SetOutputSizePixel(aNewSize);
8602c50d82SAndre Fischer }
8702c50d82SAndre Fischer }
8802c50d82SAndre Fischer
8902c50d82SAndre Fischer
9002c50d82SAndre Fischer
9102c50d82SAndre Fischer
9202c50d82SAndre Fischer ::com::sun::star::uno::Reference<
CreateAccessibleObject(const::com::sun::star::uno::Reference<::com::sun::star::accessibility::XAccessible> &)9302c50d82SAndre Fischer ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject (
9402c50d82SAndre Fischer const ::com::sun::star::uno::Reference<
9502c50d82SAndre Fischer ::com::sun::star::accessibility::XAccessible>& )
9602c50d82SAndre Fischer {
9702c50d82SAndre Fischer if (ProvideWrappedControl())
9802c50d82SAndre Fischer return mpWrappedControl->GetAccessible();
9902c50d82SAndre Fischer else
10002c50d82SAndre Fischer return NULL;
10102c50d82SAndre Fischer }
10202c50d82SAndre Fischer
10302c50d82SAndre Fischer
10402c50d82SAndre Fischer
10502c50d82SAndre Fischer
SetSidebar(const cssu::Reference<css::ui::XSidebar> & rxSidebar)10602c50d82SAndre Fischer void PanelBase::SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar)
10702c50d82SAndre Fischer {
10802c50d82SAndre Fischer mxSidebar = rxSidebar;
109*b862c97cSHerbert Dürr if (mxSidebar.is() && bool(mpWrappedControl))
11002c50d82SAndre Fischer mxSidebar->requestLayout();
11102c50d82SAndre Fischer }
11202c50d82SAndre Fischer
11302c50d82SAndre Fischer
11402c50d82SAndre Fischer
11502c50d82SAndre Fischer
ProvideWrappedControl(void)11602c50d82SAndre Fischer bool PanelBase::ProvideWrappedControl (void)
11702c50d82SAndre Fischer {
11802c50d82SAndre Fischer if ( ! mpWrappedControl)
11902c50d82SAndre Fischer {
12002c50d82SAndre Fischer mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase));
12102c50d82SAndre Fischer OSL_TRACE("created wrapped control at %x for parent PanelBase at %x", mpWrappedControl.get(), this);
12202c50d82SAndre Fischer if (mpWrappedControl)
12302c50d82SAndre Fischer mpWrappedControl->Show();
12402c50d82SAndre Fischer if (mxSidebar.is())
12502c50d82SAndre Fischer mxSidebar->requestLayout();
12602c50d82SAndre Fischer }
12702c50d82SAndre Fischer return mpWrappedControl.get() != NULL;
12802c50d82SAndre Fischer }
12902c50d82SAndre Fischer
13002c50d82SAndre Fischer } } // end of namespace sd::sidebar
131