1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_framework.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <classes/fwktabwindow.hxx> 32*cdf0e10cSrcweir #include "framework.hrc" 33*cdf0e10cSrcweir #include <classes/fwkresid.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/awt/XContainerWindowEventHandler.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/awt/XContainerWindowProvider.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/awt/XControl.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 46*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 47*cdf0e10cSrcweir #include <tools/stream.hxx> 48*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 49*cdf0e10cSrcweir #include <vcl/bitmap.hxx> 50*cdf0e10cSrcweir #include <vcl/image.hxx> 51*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir const ::rtl::OUString SERVICENAME_WINPROVIDER 54*cdf0e10cSrcweir = ::rtl::OUString::createFromAscii("com.sun.star.awt.ContainerWindowProvider"); 55*cdf0e10cSrcweir const ::rtl::OUString EXTERNAL_EVENT = ::rtl::OUString::createFromAscii("external_event"); 56*cdf0e10cSrcweir const ::rtl::OUString BACK_METHOD = ::rtl::OUString::createFromAscii("back"); 57*cdf0e10cSrcweir const ::rtl::OUString INITIALIZE_METHOD = ::rtl::OUString::createFromAscii("initialize"); 58*cdf0e10cSrcweir const ::rtl::OUString OK_METHOD = ::rtl::OUString::createFromAscii("ok"); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir using namespace ::com::sun::star; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir namespace framework 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir // class FwkTabControl --------------------------------------------------- 66*cdf0e10cSrcweir FwkTabControl::FwkTabControl( Window* pParent, const ResId& rResId ) : 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir TabControl( pParent, rResId ) 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir } 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir // ----------------------------------------------------------------------- 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir void FwkTabControl::BroadcastEvent( sal_uLong nEvent ) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir if ( VCLEVENT_TABPAGE_ACTIVATE == nEvent || VCLEVENT_TABPAGE_DEACTIVATE == nEvent ) 77*cdf0e10cSrcweir ImplCallEventListeners( nEvent, (void*)(sal_uIntPtr)GetCurPageId() ); 78*cdf0e10cSrcweir else 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir DBG_ERRORFILE( "FwkTabControl::BroadcastEvent(): illegal event" ); 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir } 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir // class FwkTabPage ------------------------------------------------ 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir FwkTabPage::FwkTabPage( 87*cdf0e10cSrcweir Window* pParent, const rtl::OUString& rPageURL, 88*cdf0e10cSrcweir const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl, 89*cdf0e10cSrcweir const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ) : 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir TabPage( pParent, WB_DIALOGCONTROL | WB_TABSTOP | WB_CHILDDLGCTRL ), 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir m_sPageURL ( rPageURL ), 94*cdf0e10cSrcweir m_xEventHdl ( rEventHdl ), 95*cdf0e10cSrcweir m_xWinProvider ( rProvider ) 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir } 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // ----------------------------------------------------------------------- 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir FwkTabPage::~FwkTabPage() 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir Hide(); 105*cdf0e10cSrcweir DeactivatePage(); 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // ----------------------------------------------------------------------- 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir void FwkTabPage::CreateDialog() 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir try 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir uno::Reference< uno::XInterface > xHandler; 115*cdf0e10cSrcweir if ( m_xEventHdl.is() ) 116*cdf0e10cSrcweir xHandler = m_xEventHdl; 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir uno::Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), uno::UNO_QUERY ); 119*cdf0e10cSrcweir m_xPage = uno::Reference < awt::XWindow >( 120*cdf0e10cSrcweir m_xWinProvider->createContainerWindow( 121*cdf0e10cSrcweir m_sPageURL, rtl::OUString(), xParent, xHandler ), uno::UNO_QUERY ); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir uno::Reference< awt::XControl > xPageControl( m_xPage, uno::UNO_QUERY ); 124*cdf0e10cSrcweir if ( xPageControl.is() ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir uno::Reference< awt::XWindowPeer > xWinPeer( xPageControl->getPeer() ); 127*cdf0e10cSrcweir if ( xWinPeer.is() ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir Window* pWindow = VCLUnoHelper::GetWindow( xWinPeer ); 130*cdf0e10cSrcweir if ( pWindow ) 131*cdf0e10cSrcweir pWindow->SetStyle( pWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL ); 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir CallMethod( INITIALIZE_METHOD ); 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir catch ( lang::IllegalArgumentException& ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir DBG_ERRORFILE( "FwkTabPage::CreateDialog(): illegal argument" ); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir catch ( uno::Exception& ) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir DBG_ERRORFILE( "FwkTabPage::CreateDialog(): exception of XDialogProvider2::createContainerWindow()" ); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir // ----------------------------------------------------------------------- 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir sal_Bool FwkTabPage::CallMethod( const rtl::OUString& rMethod ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir sal_Bool bRet = sal_False; 152*cdf0e10cSrcweir if ( m_xEventHdl.is() ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir try 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir bRet = m_xEventHdl->callHandlerMethod( m_xPage, uno::makeAny( rMethod ), EXTERNAL_EVENT ); 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir catch ( uno::Exception& ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir return bRet; 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir // ----------------------------------------------------------------------- 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir void FwkTabPage::ActivatePage() 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir TabPage::ActivatePage(); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir if ( !m_xPage.is() ) 173*cdf0e10cSrcweir CreateDialog(); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir if ( m_xPage.is() ) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir Resize (); 178*cdf0e10cSrcweir m_xPage->setVisible( sal_True ); 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // ----------------------------------------------------------------------- 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir void FwkTabPage::DeactivatePage() 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir TabPage::DeactivatePage(); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir if ( m_xPage.is() ) 189*cdf0e10cSrcweir m_xPage->setVisible( sal_False ); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir // ----------------------------------------------------------------------- 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir void FwkTabPage::Resize() 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir if ( m_xPage.is () ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir Size aSize = GetSizePixel (); 199*cdf0e10cSrcweir Point aPos = GetPosPixel (); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir m_xPage->setPosSize( 0, 0, aSize.Width()-1 , aSize.Height()-1, awt::PosSize::POSSIZE ); 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir // class FwkTabWindow --------------------------------------------- 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir FwkTabWindow::FwkTabWindow( Window* pParent ) : 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir Window( pParent, FwkResId( WIN_TABWINDOW ) ), 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir m_aTabCtrl ( this, FwkResId( TC_TABCONTROL ) ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 214*cdf0e10cSrcweir m_xWinProvider = uno::Reference < awt::XContainerWindowProvider >( 215*cdf0e10cSrcweir xFactory->createInstance( SERVICENAME_WINPROVIDER ), uno::UNO_QUERY ); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir SetPaintTransparent(true); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir m_aTabCtrl.SetActivatePageHdl( LINK( this, FwkTabWindow, ActivatePageHdl ) ); 220*cdf0e10cSrcweir m_aTabCtrl.SetDeactivatePageHdl( LINK( this, FwkTabWindow, DeactivatePageHdl ) ); 221*cdf0e10cSrcweir m_aTabCtrl.Show(); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir // ----------------------------------------------------------------------- 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir FwkTabWindow::~FwkTabWindow() 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir ClearEntryList(); 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir // ----------------------------------------------------------------------- 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir void FwkTabWindow::ClearEntryList() 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir TabEntryList::const_iterator pIt; 236*cdf0e10cSrcweir for ( pIt = m_TabList.begin(); 237*cdf0e10cSrcweir pIt != m_TabList.end(); 238*cdf0e10cSrcweir ++pIt ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir delete *pIt; 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir m_TabList.clear(); 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // ----------------------------------------------------------------------- 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir bool FwkTabWindow::RemoveEntry( sal_Int32 nIndex ) 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir TabEntryList::iterator pIt; 251*cdf0e10cSrcweir for ( pIt = m_TabList.begin(); 252*cdf0e10cSrcweir pIt != m_TabList.end(); 253*cdf0e10cSrcweir ++pIt ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir if ( (*pIt)->m_nIndex == nIndex ) 256*cdf0e10cSrcweir break; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir // remove entry from vector 260*cdf0e10cSrcweir if ( pIt != m_TabList.end()) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir m_TabList.erase(pIt); 263*cdf0e10cSrcweir return true; 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir else 266*cdf0e10cSrcweir return false; 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir // ----------------------------------------------------------------------- 270*cdf0e10cSrcweir TabEntry* FwkTabWindow::FindEntry( sal_Int32 nIndex ) const 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir TabEntry* pEntry = NULL; 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir TabEntryList::const_iterator pIt; 275*cdf0e10cSrcweir for ( pIt = m_TabList.begin(); 276*cdf0e10cSrcweir pIt != m_TabList.end(); 277*cdf0e10cSrcweir ++pIt ) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir if ( (*pIt)->m_nIndex == nIndex ) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir pEntry = *pIt; 282*cdf0e10cSrcweir break; 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir return pEntry; 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir // ----------------------------------------------------------------------- 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir IMPL_LINK( FwkTabWindow, ActivatePageHdl, TabControl *, EMPTYARG ) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir const sal_uInt16 nId = m_aTabCtrl.GetCurPageId(); 294*cdf0e10cSrcweir FwkTabPage* pTabPage = static_cast< FwkTabPage* >( m_aTabCtrl.GetTabPage( nId ) ); 295*cdf0e10cSrcweir if ( !pTabPage ) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir TabEntry* pEntry = FindEntry( nId ); 298*cdf0e10cSrcweir if ( pEntry ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_xEventHdl, m_xWinProvider ); 301*cdf0e10cSrcweir pEntry->m_pPage = pTabPage; 302*cdf0e10cSrcweir m_aTabCtrl.SetTabPage( nId, pTabPage ); 303*cdf0e10cSrcweir pTabPage->Show(); 304*cdf0e10cSrcweir pTabPage->ActivatePage(); 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir } else { 307*cdf0e10cSrcweir pTabPage->ActivatePage(); 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_ACTIVATE ); 310*cdf0e10cSrcweir return 1; 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir // ----------------------------------------------------------------------- 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir IMPL_LINK( FwkTabWindow, DeactivatePageHdl, TabControl *, EMPTYARG ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_DEACTIVATE ); 318*cdf0e10cSrcweir return 1; 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir // ----------------------------------------------------------------------- 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir IMPL_LINK( FwkTabWindow, CloseHdl, PushButton *, EMPTYARG ) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir // Close(); 326*cdf0e10cSrcweir return 0; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir // ----------------------------------------------------------------------- 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir void FwkTabWindow::AddEventListener( const Link& rEventListener ) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir m_aTabCtrl.AddEventListener( rEventListener ); 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir void FwkTabWindow::RemoveEventListener( const Link& rEventListener ) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir m_aTabCtrl.RemoveEventListener( rEventListener ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir // ----------------------------------------------------------------------- 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< beans::NamedValue >& rProperties ) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir ::rtl::OUString sTitle, sToolTip, sPageURL; 346*cdf0e10cSrcweir uno::Reference< css::awt::XContainerWindowEventHandler > xEventHdl; 347*cdf0e10cSrcweir uno::Reference< graphic::XGraphic > xImage; 348*cdf0e10cSrcweir bool bDisabled = false; 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir sal_Int32 i = 0, nLen = rProperties.getLength(); 351*cdf0e10cSrcweir for ( i = 0; i < nLen; ++i ) 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir beans::NamedValue aValue = rProperties[i]; 354*cdf0e10cSrcweir ::rtl::OUString sName = aValue.Name; 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir if ( sName.equalsAscii("Title") ) 357*cdf0e10cSrcweir aValue.Value >>= sTitle; 358*cdf0e10cSrcweir else if ( sName.equalsAscii("ToolTip") ) 359*cdf0e10cSrcweir aValue.Value >>= sToolTip; 360*cdf0e10cSrcweir else if ( sName.equalsAscii("PageURL") ) 361*cdf0e10cSrcweir aValue.Value >>= sPageURL; 362*cdf0e10cSrcweir else if ( sName.equalsAscii("EventHdl") ) 363*cdf0e10cSrcweir aValue.Value >>= xEventHdl; 364*cdf0e10cSrcweir else if ( sName.equalsAscii("Image") ) 365*cdf0e10cSrcweir aValue.Value >>= xImage; 366*cdf0e10cSrcweir else if ( sName.equalsAscii("Disabled") ) 367*cdf0e10cSrcweir aValue.Value >>= bDisabled; 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir TabEntry* pEntry = new TabEntry( nIndex, sPageURL, xEventHdl ); 371*cdf0e10cSrcweir m_TabList.push_back( pEntry ); 372*cdf0e10cSrcweir sal_uInt16 nIdx = static_cast< sal_uInt16 >( nIndex ); 373*cdf0e10cSrcweir m_aTabCtrl.InsertPage( nIdx, sTitle ); 374*cdf0e10cSrcweir if ( sToolTip.getLength() > 0 ) 375*cdf0e10cSrcweir m_aTabCtrl.SetHelpText( nIdx, sToolTip ); 376*cdf0e10cSrcweir if ( xImage.is() ) 377*cdf0e10cSrcweir m_aTabCtrl.SetPageImage( nIdx, Image( xImage ) ); 378*cdf0e10cSrcweir if ( bDisabled ) 379*cdf0e10cSrcweir m_aTabCtrl.EnablePage( nIdx, false ); 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir return pEntry->m_pPage; 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir // ----------------------------------------------------------------------- 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir void FwkTabWindow::ActivatePage( sal_Int32 nIndex ) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir m_aTabCtrl.SetCurPageId( static_cast< sal_uInt16 >( nIndex ) ); 389*cdf0e10cSrcweir ActivatePageHdl( &m_aTabCtrl ); 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir // ----------------------------------------------------------------------- 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir void FwkTabWindow::RemovePage( sal_Int32 nIndex ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir TabEntry* pEntry = FindEntry(nIndex); 397*cdf0e10cSrcweir if ( pEntry ) 398*cdf0e10cSrcweir { 399*cdf0e10cSrcweir m_aTabCtrl.RemovePage( static_cast< sal_uInt16 >( nIndex ) ); 400*cdf0e10cSrcweir if (RemoveEntry(nIndex)) 401*cdf0e10cSrcweir delete pEntry; 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir // ----------------------------------------------------------------------- 406*cdf0e10cSrcweir void FwkTabWindow::Resize() 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir Size aPageSize = GetSizePixel(); 409*cdf0e10cSrcweir m_aTabCtrl.SetTabPageSizePixel( aPageSize ); 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir } // namespace framework 413*cdf0e10cSrcweir 414