17a32b0c8SAndre Fischer /**************************************************************
27a32b0c8SAndre Fischer *
37a32b0c8SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one
47a32b0c8SAndre Fischer * or more contributor license agreements. See the NOTICE file
57a32b0c8SAndre Fischer * distributed with this work for additional information
67a32b0c8SAndre Fischer * regarding copyright ownership. The ASF licenses this file
77a32b0c8SAndre Fischer * to you under the Apache License, Version 2.0 (the
87a32b0c8SAndre Fischer * "License"); you may not use this file except in compliance
97a32b0c8SAndre Fischer * with the License. You may obtain a copy of the License at
107a32b0c8SAndre Fischer *
117a32b0c8SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0
127a32b0c8SAndre Fischer *
137a32b0c8SAndre Fischer * Unless required by applicable law or agreed to in writing,
147a32b0c8SAndre Fischer * software distributed under the License is distributed on an
157a32b0c8SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167a32b0c8SAndre Fischer * KIND, either express or implied. See the License for the
177a32b0c8SAndre Fischer * specific language governing permissions and limitations
187a32b0c8SAndre Fischer * under the License.
197a32b0c8SAndre Fischer *
207a32b0c8SAndre Fischer *************************************************************/
217a32b0c8SAndre Fischer
227a32b0c8SAndre Fischer #include "precompiled_sd.hxx"
237a32b0c8SAndre Fischer
247a32b0c8SAndre Fischer #include "TableDesignPanel.hxx"
257a32b0c8SAndre Fischer
267a32b0c8SAndre Fischer
277a32b0c8SAndre Fischer
287a32b0c8SAndre Fischer namespace sd { namespace sidebar {
297a32b0c8SAndre Fischer
307a32b0c8SAndre Fischer
PanelBase(::Window * pParentWindow,ViewShellBase & rViewShellBase)317a32b0c8SAndre Fischer PanelBase::PanelBase (
327a32b0c8SAndre Fischer ::Window* pParentWindow,
337a32b0c8SAndre Fischer ViewShellBase& rViewShellBase)
347a32b0c8SAndre Fischer : Control(pParentWindow),
357a32b0c8SAndre Fischer mpWrappedControl(NULL),
367a32b0c8SAndre Fischer mxSidebar(),
377a32b0c8SAndre Fischer mrViewShellBase(rViewShellBase)
387a32b0c8SAndre Fischer {
397a32b0c8SAndre Fischer OSL_TRACE("created PanelBase at %x for parent %x", this, pParentWindow);
407a32b0c8SAndre Fischer
417a32b0c8SAndre Fischer #ifdef DEBUG
427a32b0c8SAndre Fischer SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:PanelBase")));
437a32b0c8SAndre Fischer #endif
447a32b0c8SAndre Fischer }
457a32b0c8SAndre Fischer
467a32b0c8SAndre Fischer
477a32b0c8SAndre Fischer
487a32b0c8SAndre Fischer
~PanelBase(void)497a32b0c8SAndre Fischer PanelBase::~PanelBase (void)
507a32b0c8SAndre Fischer {
517a32b0c8SAndre Fischer OSL_TRACE("deleting wrapped control at %x", mpWrappedControl.get());
527a32b0c8SAndre Fischer mpWrappedControl.reset();
537a32b0c8SAndre Fischer OSL_TRACE("deleting PanelBase at %x from parent %x", this, GetParent());
547a32b0c8SAndre Fischer }
557a32b0c8SAndre Fischer
567a32b0c8SAndre Fischer
577a32b0c8SAndre Fischer
587a32b0c8SAndre Fischer
597a32b0c8SAndre Fischer
Dispose(void)607a32b0c8SAndre Fischer void PanelBase::Dispose (void)
617a32b0c8SAndre Fischer {
627a32b0c8SAndre Fischer OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %x", mpWrappedControl.get());
637a32b0c8SAndre Fischer mpWrappedControl.reset();
647a32b0c8SAndre Fischer }
657a32b0c8SAndre Fischer
667a32b0c8SAndre Fischer
677a32b0c8SAndre Fischer
687a32b0c8SAndre Fischer
GetHeightForWidth(const sal_Int32 nWidth)697a32b0c8SAndre Fischer css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 nWidth)
707a32b0c8SAndre Fischer {
717a32b0c8SAndre Fischer sal_Int32 nHeight (0);
727a32b0c8SAndre Fischer if (ProvideWrappedControl())
737a32b0c8SAndre Fischer nHeight = mpWrappedControl->GetSizePixel().Height();
747a32b0c8SAndre Fischer return css::ui::LayoutSize(nHeight,nHeight,nHeight);
757a32b0c8SAndre Fischer }
767a32b0c8SAndre Fischer
777a32b0c8SAndre Fischer
787a32b0c8SAndre Fischer
797a32b0c8SAndre Fischer
Resize(void)807a32b0c8SAndre Fischer void PanelBase::Resize (void)
817a32b0c8SAndre Fischer {
827a32b0c8SAndre Fischer if (ProvideWrappedControl())
837a32b0c8SAndre Fischer {
847a32b0c8SAndre Fischer Size aNewSize (GetSizePixel());
857a32b0c8SAndre Fischer mpWrappedControl->SetOutputSizePixel(aNewSize);
867a32b0c8SAndre Fischer }
877a32b0c8SAndre Fischer }
887a32b0c8SAndre Fischer
897a32b0c8SAndre Fischer
907a32b0c8SAndre Fischer
917a32b0c8SAndre Fischer
927a32b0c8SAndre Fischer ::com::sun::star::uno::Reference<
CreateAccessibleObject(const::com::sun::star::uno::Reference<::com::sun::star::accessibility::XAccessible> &)937a32b0c8SAndre Fischer ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject (
947a32b0c8SAndre Fischer const ::com::sun::star::uno::Reference<
957a32b0c8SAndre Fischer ::com::sun::star::accessibility::XAccessible>& )
967a32b0c8SAndre Fischer {
977a32b0c8SAndre Fischer if (ProvideWrappedControl())
987a32b0c8SAndre Fischer return mpWrappedControl->GetAccessible();
997a32b0c8SAndre Fischer else
1007a32b0c8SAndre Fischer return NULL;
1017a32b0c8SAndre Fischer }
1027a32b0c8SAndre Fischer
1037a32b0c8SAndre Fischer
1047a32b0c8SAndre Fischer
1057a32b0c8SAndre Fischer
SetSidebar(const cssu::Reference<css::ui::XSidebar> & rxSidebar)1067a32b0c8SAndre Fischer void PanelBase::SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar)
1077a32b0c8SAndre Fischer {
1087a32b0c8SAndre Fischer mxSidebar = rxSidebar;
109*b862c97cSHerbert Dürr if (mxSidebar.is() && bool(mpWrappedControl))
1107a32b0c8SAndre Fischer mxSidebar->requestLayout();
1117a32b0c8SAndre Fischer }
1127a32b0c8SAndre Fischer
1137a32b0c8SAndre Fischer
1147a32b0c8SAndre Fischer
1157a32b0c8SAndre Fischer
ProvideWrappedControl(void)1167a32b0c8SAndre Fischer bool PanelBase::ProvideWrappedControl (void)
1177a32b0c8SAndre Fischer {
1187a32b0c8SAndre Fischer if ( ! mpWrappedControl)
1197a32b0c8SAndre Fischer {
1207a32b0c8SAndre Fischer mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase));
1217a32b0c8SAndre Fischer OSL_TRACE("created wrapped control at %x for parent PanelBase at %x", mpWrappedControl.get(), this);
1227a32b0c8SAndre Fischer if (mpWrappedControl)
1237a32b0c8SAndre Fischer mpWrappedControl->Show();
1247a32b0c8SAndre Fischer if (mxSidebar.is())
1257a32b0c8SAndre Fischer mxSidebar->requestLayout();
1267a32b0c8SAndre Fischer }
1277a32b0c8SAndre Fischer return mpWrappedControl.get() != NULL;
1287a32b0c8SAndre Fischer }
1297a32b0c8SAndre Fischer
1307a32b0c8SAndre Fischer } } // end of namespace sd::sidebar
131