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