1*02c50d82SAndre Fischer /************************************************************** 2*02c50d82SAndre Fischer * 3*02c50d82SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 4*02c50d82SAndre Fischer * or more contributor license agreements. See the NOTICE file 5*02c50d82SAndre Fischer * distributed with this work for additional information 6*02c50d82SAndre Fischer * regarding copyright ownership. The ASF licenses this file 7*02c50d82SAndre Fischer * to you under the Apache License, Version 2.0 (the 8*02c50d82SAndre Fischer * "License"); you may not use this file except in compliance 9*02c50d82SAndre Fischer * with the License. You may obtain a copy of the License at 10*02c50d82SAndre Fischer * 11*02c50d82SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 12*02c50d82SAndre Fischer * 13*02c50d82SAndre Fischer * Unless required by applicable law or agreed to in writing, 14*02c50d82SAndre Fischer * software distributed under the License is distributed on an 15*02c50d82SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*02c50d82SAndre Fischer * KIND, either express or implied. See the License for the 17*02c50d82SAndre Fischer * specific language governing permissions and limitations 18*02c50d82SAndre Fischer * under the License. 19*02c50d82SAndre Fischer * 20*02c50d82SAndre Fischer *************************************************************/ 21*02c50d82SAndre Fischer 22*02c50d82SAndre Fischer #include "precompiled_sd.hxx" 23*02c50d82SAndre Fischer 24*02c50d82SAndre Fischer #include "TableDesignPanel.hxx" 25*02c50d82SAndre Fischer 26*02c50d82SAndre Fischer 27*02c50d82SAndre Fischer 28*02c50d82SAndre Fischer namespace sd { namespace sidebar { 29*02c50d82SAndre Fischer 30*02c50d82SAndre Fischer 31*02c50d82SAndre Fischer PanelBase::PanelBase ( 32*02c50d82SAndre Fischer ::Window* pParentWindow, 33*02c50d82SAndre Fischer ViewShellBase& rViewShellBase) 34*02c50d82SAndre Fischer : Control(pParentWindow), 35*02c50d82SAndre Fischer mpWrappedControl(NULL), 36*02c50d82SAndre Fischer mxSidebar(), 37*02c50d82SAndre Fischer mrViewShellBase(rViewShellBase) 38*02c50d82SAndre Fischer { 39*02c50d82SAndre Fischer OSL_TRACE("created PanelBase at %x for parent %x", this, pParentWindow); 40*02c50d82SAndre Fischer 41*02c50d82SAndre Fischer #ifdef DEBUG 42*02c50d82SAndre Fischer SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:PanelBase"))); 43*02c50d82SAndre Fischer #endif 44*02c50d82SAndre Fischer } 45*02c50d82SAndre Fischer 46*02c50d82SAndre Fischer 47*02c50d82SAndre Fischer 48*02c50d82SAndre Fischer 49*02c50d82SAndre Fischer PanelBase::~PanelBase (void) 50*02c50d82SAndre Fischer { 51*02c50d82SAndre Fischer OSL_TRACE("deleting wrapped control at %x", mpWrappedControl.get()); 52*02c50d82SAndre Fischer mpWrappedControl.reset(); 53*02c50d82SAndre Fischer OSL_TRACE("deleting PanelBase at %x from parent %x", this, GetParent()); 54*02c50d82SAndre Fischer } 55*02c50d82SAndre Fischer 56*02c50d82SAndre Fischer 57*02c50d82SAndre Fischer 58*02c50d82SAndre Fischer 59*02c50d82SAndre Fischer 60*02c50d82SAndre Fischer void PanelBase::Dispose (void) 61*02c50d82SAndre Fischer { 62*02c50d82SAndre Fischer OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %x", mpWrappedControl.get()); 63*02c50d82SAndre Fischer mpWrappedControl.reset(); 64*02c50d82SAndre Fischer } 65*02c50d82SAndre Fischer 66*02c50d82SAndre Fischer 67*02c50d82SAndre Fischer 68*02c50d82SAndre Fischer 69*02c50d82SAndre Fischer css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 nWidth) 70*02c50d82SAndre Fischer { 71*02c50d82SAndre Fischer sal_Int32 nHeight (0); 72*02c50d82SAndre Fischer if (ProvideWrappedControl()) 73*02c50d82SAndre Fischer nHeight = mpWrappedControl->GetSizePixel().Height(); 74*02c50d82SAndre Fischer return css::ui::LayoutSize(nHeight,nHeight,nHeight); 75*02c50d82SAndre Fischer } 76*02c50d82SAndre Fischer 77*02c50d82SAndre Fischer 78*02c50d82SAndre Fischer 79*02c50d82SAndre Fischer 80*02c50d82SAndre Fischer void PanelBase::Resize (void) 81*02c50d82SAndre Fischer { 82*02c50d82SAndre Fischer if (ProvideWrappedControl()) 83*02c50d82SAndre Fischer { 84*02c50d82SAndre Fischer Size aNewSize (GetSizePixel()); 85*02c50d82SAndre Fischer mpWrappedControl->SetOutputSizePixel(aNewSize); 86*02c50d82SAndre Fischer } 87*02c50d82SAndre Fischer } 88*02c50d82SAndre Fischer 89*02c50d82SAndre Fischer 90*02c50d82SAndre Fischer 91*02c50d82SAndre Fischer 92*02c50d82SAndre Fischer ::com::sun::star::uno::Reference< 93*02c50d82SAndre Fischer ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject ( 94*02c50d82SAndre Fischer const ::com::sun::star::uno::Reference< 95*02c50d82SAndre Fischer ::com::sun::star::accessibility::XAccessible>& ) 96*02c50d82SAndre Fischer { 97*02c50d82SAndre Fischer if (ProvideWrappedControl()) 98*02c50d82SAndre Fischer return mpWrappedControl->GetAccessible(); 99*02c50d82SAndre Fischer else 100*02c50d82SAndre Fischer return NULL; 101*02c50d82SAndre Fischer } 102*02c50d82SAndre Fischer 103*02c50d82SAndre Fischer 104*02c50d82SAndre Fischer 105*02c50d82SAndre Fischer 106*02c50d82SAndre Fischer void PanelBase::SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar) 107*02c50d82SAndre Fischer { 108*02c50d82SAndre Fischer mxSidebar = rxSidebar; 109*02c50d82SAndre Fischer if (mxSidebar.is() && mpWrappedControl!=NULL) 110*02c50d82SAndre Fischer mxSidebar->requestLayout(); 111*02c50d82SAndre Fischer } 112*02c50d82SAndre Fischer 113*02c50d82SAndre Fischer 114*02c50d82SAndre Fischer 115*02c50d82SAndre Fischer 116*02c50d82SAndre Fischer bool PanelBase::ProvideWrappedControl (void) 117*02c50d82SAndre Fischer { 118*02c50d82SAndre Fischer if ( ! mpWrappedControl) 119*02c50d82SAndre Fischer { 120*02c50d82SAndre Fischer mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase)); 121*02c50d82SAndre Fischer OSL_TRACE("created wrapped control at %x for parent PanelBase at %x", mpWrappedControl.get(), this); 122*02c50d82SAndre Fischer if (mpWrappedControl) 123*02c50d82SAndre Fischer mpWrappedControl->Show(); 124*02c50d82SAndre Fischer if (mxSidebar.is()) 125*02c50d82SAndre Fischer mxSidebar->requestLayout(); 126*02c50d82SAndre Fischer } 127*02c50d82SAndre Fischer return mpWrappedControl.get() != NULL; 128*02c50d82SAndre Fischer } 129*02c50d82SAndre Fischer 130*02c50d82SAndre Fischer } } // end of namespace sd::sidebar 131