diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-02-19 06:06:12 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-02-19 06:06:12 +0000 |
commit | 1b8304e84ee5e944c439ba72884579ea22748a7d (patch) | |
tree | 6ef4cf558c46e255d183ff31cfebfc242f3a0bd2 | |
parent | e46a88d536fa058931fcc65130ec742d1c115708 (diff) |
CWS-TOOLING: integrate CWS jsc315
2009-02-12 18:02:11 +0100 jsc r267683 : #i99045# filter events
2009-02-09 14:47:09 +0100 jsc r267515 : #i99045# correct activate tab
2009-02-06 13:25:37 +0100 jsc r267456 : #i98925# change code to accept event handler object instead of service string or impl name
-rw-r--r-- | framework/inc/classes/fwktabwindow.hxx | 12 | ||||
-rw-r--r-- | framework/source/classes/fwktabwindow.cxx | 55 | ||||
-rw-r--r-- | framework/source/services/tabwindowservice.cxx | 7 |
3 files changed, 34 insertions, 40 deletions
diff --git a/framework/inc/classes/fwktabwindow.hxx b/framework/inc/classes/fwktabwindow.hxx index ed63e2d66afa..c3acfb17f2da 100644 --- a/framework/inc/classes/fwktabwindow.hxx +++ b/framework/inc/classes/fwktabwindow.hxx @@ -57,7 +57,7 @@ class FwkTabControl : public TabControl public: FwkTabControl( Window* pParent, const ResId& rResId ); - void BroadcastEvent( ULONG nEvent );
+ void BroadcastEvent( ULONG nEvent ); }; class FwkTabPage : public TabPage @@ -65,7 +65,7 @@ class FwkTabPage : public TabPage private: rtl::OUString m_sPageURL; rtl::OUString m_sEventHdl; - css::uno::Reference< css::awt::XWindow > m_xPage;
+ css::uno::Reference< css::awt::XWindow > m_xPage; css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider; @@ -76,7 +76,7 @@ public: FwkTabPage( Window* pParent, const rtl::OUString& rPageURL, - const rtl::OUString& rEventHdl, + const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl, const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ); virtual ~FwkTabPage(); @@ -94,13 +94,13 @@ struct TabEntry sal_Int32 m_nIndex; FwkTabPage* m_pPage; ::rtl::OUString m_sPageURL; - ::rtl::OUString m_sEventHdl; + css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; TabEntry() : m_nIndex( -1 ), m_pPage( NULL ) {} - TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, ::rtl::OUString sEvent ) : - m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_sEventHdl( sEvent ) {} + TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) : + m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {} ~TabEntry() { delete m_pPage; } }; diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx index e9aa87a3e058..cd9ff97dc652 100644 --- a/framework/source/classes/fwktabwindow.cxx +++ b/framework/source/classes/fwktabwindow.cxx @@ -81,18 +81,19 @@ void FwkTabControl::BroadcastEvent( ULONG nEvent ) { DBG_ERRORFILE( "FwkTabControl::BroadcastEvent(): illegal event" ); } -}
+} // class FwkTabPage ------------------------------------------------ FwkTabPage::FwkTabPage( - Window* pParent, const rtl::OUString& rPageURL, const rtl::OUString& rEventHdl, - const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ) : + Window* pParent, const rtl::OUString& rPageURL, + const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl, + const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ) : TabPage( pParent, WB_DIALOGCONTROL ), m_sPageURL ( rPageURL ), - m_sEventHdl ( rEventHdl ), + m_xEventHdl ( rEventHdl ), m_xWinProvider ( rProvider ) { @@ -113,17 +114,13 @@ void FwkTabPage::CreateDialog() try { uno::Reference< uno::XInterface > xHandler; - if ( m_sEventHdl.getLength() > 0 ) - { - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - m_xEventHdl = uno::Reference< awt::XContainerWindowEventHandler >( - xFactory->createInstance( m_sEventHdl ), uno::UNO_QUERY ); - xHandler = m_xEventHdl; - } + if ( m_xEventHdl.is() ) + xHandler = m_xEventHdl; + uno::Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), uno::UNO_QUERY ); m_xPage = uno::Reference < awt::XWindow >( m_xWinProvider->createContainerWindow( - m_sPageURL, rtl::OUString(), xParent, xHandler ), uno::UNO_QUERY );
+ m_sPageURL, rtl::OUString(), xParent, xHandler ), uno::UNO_QUERY ); CallMethod( INITIALIZE_METHOD ); } @@ -165,10 +162,10 @@ void FwkTabPage::ActivatePage() if ( !m_xPage.is() ) CreateDialog(); - if ( m_xPage.is() )
- {
+ if ( m_xPage.is() ) + { Resize (); - m_xPage->setVisible( sal_True );
+ m_xPage->setVisible( sal_True ); } } @@ -221,8 +218,8 @@ FwkTabWindow::FwkTabWindow( Window* pParent ) : uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); m_xWinProvider = uno::Reference < awt::XContainerWindowProvider >( xFactory->createInstance( SERVICENAME_WINPROVIDER ), uno::UNO_QUERY ); -
- SetPaintTransparent(true);
+ + SetPaintTransparent(true); m_aTabCtrl.SetActivatePageHdl( LINK( this, FwkTabWindow, ActivatePageHdl ) ); m_aTabCtrl.SetDeactivatePageHdl( LINK( this, FwkTabWindow, DeactivatePageHdl ) ); @@ -283,15 +280,14 @@ IMPL_LINK( FwkTabWindow, ActivatePageHdl, TabControl *, EMPTYARG ) TabEntry* pEntry = FindEntry( nId ); if ( pEntry ) { - pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_sEventHdl, m_xWinProvider ); + pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_xEventHdl, m_xWinProvider ); pTabPage->Show(); pTabPage->ActivatePage(); m_aTabCtrl.SetTabPage( nId, pTabPage ); } - }
- else
+ } else { pTabPage->ActivatePage(); - + } m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_ACTIVATE ); return 1; } @@ -323,7 +319,8 @@ void FwkTabWindow::AddEventListener( const Link& rEventListener ) FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< beans::NamedValue >& rProperties ) { - ::rtl::OUString sTitle, sToolTip, sPageURL, sEventHdl; + ::rtl::OUString sTitle, sToolTip, sPageURL; + uno::Reference< css::awt::XContainerWindowEventHandler > xEventHdl; uno::Reference< graphic::XGraphic > xImage; bool bDisabled = false; @@ -341,14 +338,14 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea else if ( sName.equalsAscii("PageURL") ) aAny >>= sPageURL; else if ( sName.equalsAscii("EventHdl") ) - aAny >>= sEventHdl; + aAny >>= xEventHdl; else if ( sName.equalsAscii("Image") ) aAny >>= xImage; else if ( sName.equalsAscii("Disabled") ) aAny >>= bDisabled; } - TabEntry* pEntry = new TabEntry( nIndex, sPageURL, sEventHdl ); + TabEntry* pEntry = new TabEntry( nIndex, sPageURL, xEventHdl ); m_TabList.push_back( pEntry ); USHORT nIdx = static_cast< USHORT >( nIndex ); m_aTabCtrl.InsertPage( nIdx, sTitle ); @@ -357,8 +354,8 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea if ( xImage.is() ) m_aTabCtrl.SetPageImage( nIdx, Image( xImage ) ); if ( bDisabled ) - m_aTabCtrl.EnablePage( nIdx, false );
-
+ m_aTabCtrl.EnablePage( nIdx, false ); + return pEntry->m_pPage; } @@ -385,11 +382,11 @@ sal_Int32 FwkTabWindow::GetActivePageId() const } // ----------------------------------------------------------------------- -void FwkTabWindow::Resize()
-{
+void FwkTabWindow::Resize() +{ Size aPageSize = GetSizePixel(); m_aTabCtrl.SetTabPageSizePixel( aPageSize ); -}
+} } // namespace framework diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx index ce1b2cad520e..fb3c08876687 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -154,7 +154,7 @@ TabWindowService::~TabWindowService() ResetableGuard aGuard( m_aLock ); ::sal_Int32 nID = m_nPageIndexCounter++; - TTabPageInfo aInfo(m_nPageIndexCounter); + TTabPageInfo aInfo(nID); m_lTabPageInfos[nID] = aInfo; @@ -357,10 +357,7 @@ css::uno::Any SAL_CALL TabWindowService::impl_getPropertyValue(const ::rtl::OUSt //***************************************************************************************************************** IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent ) { - if ( - ( ! pEvent ) || - ( pEvent->ISA(VclWindowEvent) ) - ) + if ( !pEvent && !pEvent->ISA(VclWindowEvent)) return 0; ULONG nEventId = pEvent->GetId(); |