Kaydet (Commit) f565a4b3 authored tarafından Carsten Driesner's avatar Carsten Driesner

#i107087# TabWindowService must set member pointer to zero on…

#i107087# TabWindowService must set member pointer to zero on VCLEVENT_OBJECT_DYING. The window life time is controlled by the docking window! Adding missing RemoveEventListener call.
üst 875ac204
......@@ -125,6 +125,7 @@ public:
~FwkTabWindow();
void AddEventListener( const Link& rEventListener );
void RemoveEventListener( const Link& rEventListener );
FwkTabPage* AddTabPage( sal_Int32 nIndex, const css::uno::Sequence< css::beans::NamedValue >& rProperties );
void ActivatePage( sal_Int32 nIndex );
void RemovePage( sal_Int32 nIndex );
......
......@@ -48,13 +48,13 @@
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
#include <general.h>
#include <general.h>
#include <stdtypes.h>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/awt/XSimpleTabController.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
......@@ -62,7 +62,7 @@
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
#include <cppuhelper/weak.hxx>
#include <vcl/window.hxx>
......@@ -81,31 +81,31 @@ namespace framework{
//_________________________________________________________________________________________________________________
struct TTabPageInfo
{
public:
TTabPageInfo()
: m_nIndex ( -1 )
, m_bCreated (sal_False)
, m_pPage ( NULL )
, m_lProperties ( )
{}
TTabPageInfo(::sal_Int32 nID)
: m_nIndex ( nID )
, m_bCreated (sal_False)
, m_pPage ( NULL )
, m_lProperties ( )
{}
public:
::sal_Int32 m_nIndex;
{
public:
TTabPageInfo()
: m_nIndex ( -1 )
, m_bCreated (sal_False)
, m_pPage ( NULL )
, m_lProperties ( )
{}
TTabPageInfo(::sal_Int32 nID)
: m_nIndex ( nID )
, m_bCreated (sal_False)
, m_pPage ( NULL )
, m_lProperties ( )
{}
public:
::sal_Int32 m_nIndex;
::sal_Bool m_bCreated;
FwkTabPage* m_pPage;
css::uno::Sequence< css::beans::NamedValue > m_lProperties;
};
};
typedef ::std::hash_map< ::sal_Int32 ,
TTabPageInfo ,
Int32HashCode ,
......@@ -118,10 +118,11 @@ typedef ::std::hash_map< ::sal_Int32 ,
class TabWindowService : public css::lang::XTypeProvider
, public css::lang::XServiceInfo
, public css::awt::XSimpleTabController
, public css::lang::XComponent
, public ThreadHelpBase
, public TransactionBase
, public PropertySetHelper
, public ::cppu::OWeakObject
, public PropertySetHelper
, public ::cppu::OWeakObject
{
//-------------------------------------------------------------------------------------------------------------
// public methods
......@@ -132,7 +133,7 @@ class TabWindowService : public css::lang::XTypeProvider
//---------------------------------------------------------------------------------------------------------
// constructor / destructor
//---------------------------------------------------------------------------------------------------------
TabWindowService( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
virtual ~TabWindowService();
......@@ -186,8 +187,8 @@ class TabWindowService : public css::lang::XTypeProvider
DECL_DLLPRIVATE_LINK( EventListener, VclSimpleEvent * );
void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
FwkTabWindow* mem_TabWin ();
/*
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
......@@ -203,26 +204,26 @@ class TabWindowService : public css::lang::XTypeProvider
private:
/// reference to factory, which has created this instance
css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
/// the tab window as XWindow ( to hold window* alive !)
css::uno::Reference< css::awt::XWindow > m_xTabWin;
/// the VCL tab window
FwkTabWindow* m_pTabWin;
/// container of inserted tab pages
TTabPageInfoHash m_lTabPageInfos;
css::uno::Reference< css::awt::XWindow > m_xTabWin;
/// the VCL tab window
FwkTabWindow* m_pTabWin;
/// container of inserted tab pages
TTabPageInfoHash m_lTabPageInfos;
/// container of the added TabListener
::cppu::OMultiTypeInterfaceContainerHelper m_lListener;
/// counter of the tabpage indexes
::sal_Int32 m_nPageIndexCounter;
::sal_Int32 m_nPageIndexCounter;
/// index of the current active page
::sal_Int32 m_nCurrentPageIndex;
/// title of the tabcontrolled window
::rtl::OUString m_sTitle;
......
......@@ -65,7 +65,6 @@ namespace framework
{
// class FwkTabControl ---------------------------------------------------
FwkTabControl::FwkTabControl( Window* pParent, const ResId& rResId ) :
TabControl( pParent, rResId )
......@@ -336,6 +335,11 @@ void FwkTabWindow::AddEventListener( const Link& rEventListener )
m_aTabCtrl.AddEventListener( rEventListener );
}
void FwkTabWindow::RemoveEventListener( const Link& rEventListener )
{
m_aTabCtrl.RemoveEventListener( rEventListener );
}
// -----------------------------------------------------------------------
FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< beans::NamedValue >& rProperties )
......
......@@ -75,18 +75,20 @@ namespace framework{
// css::uno::XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
DEFINE_XINTERFACE_5 ( TabWindowService ,
DEFINE_XINTERFACE_6 ( TabWindowService ,
OWeakObject ,
DIRECT_INTERFACE(css::lang::XTypeProvider ),
DIRECT_INTERFACE(css::lang::XServiceInfo ),
DIRECT_INTERFACE(css::lang::XComponent),
DIRECT_INTERFACE(css::awt::XSimpleTabController),
DIRECT_INTERFACE(css::beans::XPropertySet ),
DIRECT_INTERFACE(css::beans::XPropertySetInfo )
)
DEFINE_XTYPEPROVIDER_5 ( TabWindowService ,
DEFINE_XTYPEPROVIDER_6 ( TabWindowService ,
css::lang::XTypeProvider ,
css::lang::XServiceInfo ,
css::lang::XComponent ,
css::awt::XSimpleTabController ,
css::beans::XPropertySet ,
css::beans::XPropertySetInfo
......@@ -100,7 +102,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( TabWindowService ,
DEFINE_INIT_SERVICE ( TabWindowService,
{
impl_initializePropInfo();
impl_initializePropInfo();
m_aTransactionManager.setWorkingMode( E_WORK );
}
)
......@@ -141,7 +143,7 @@ TabWindowService::TabWindowService( const css::uno::Reference< css::lang::XMulti
// destructor
//*****************************************************************************************************************
TabWindowService::~TabWindowService()
{
{
}
//*****************************************************************************************************************
......@@ -286,8 +288,11 @@ void SAL_CALL TabWindowService::dispose()
m_lListener.disposeAndClear (aEvent);
if (m_pTabWin)
m_pTabWin->RemoveEventListener( LINK( this, TabWindowService, EventListener ) );
m_pTabWin = NULL;
m_xTabWin.clear ();
m_xTabWin.clear();
}
//*****************************************************************************************************************
......@@ -357,6 +362,7 @@ css::uno::Any SAL_CALL TabWindowService::impl_getPropertyValue(const ::rtl::OUSt
//*****************************************************************************************************************
IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent )
{
if ( !pEvent && !pEvent->ISA(VclWindowEvent))
return 0;
......@@ -369,6 +375,11 @@ IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent )
if (nEventId == VCLEVENT_OBJECT_DYING)
{
m_lListener.disposeAndClear (aEvent);
m_pTabWin->RemoveEventListener( LINK( this, TabWindowService, EventListener ) );
m_pTabWin = NULL;
m_xTabWin.clear();
return 0;
}
......@@ -454,9 +465,9 @@ FwkTabWindow* TabWindowService::mem_TabWin ()
FwkTabWindow* pWin = NULL;
if ( ! m_xTabWin.is ())
{
Window* pFakeParent = dynamic_cast< Window* >(Application::GetDefaultDevice ());
{
Window* pFakeParent = dynamic_cast< Window* >(Application::GetDefaultDevice ());
m_pTabWin = new FwkTabWindow (pFakeParent);
m_xTabWin = VCLUnoHelper::GetInterface (m_pTabWin);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment