Kaydet (Commit) 3b416a7f authored tarafından Michael Meeks's avatar Michael Meeks

svtools: switch UNO pieces to use VclPtr enabled toolkit.

Change-Id: Ib243b14e3476d3a65ad1414e3843511420201c7c
üst 60fcbc1a
......@@ -85,6 +85,10 @@ public:
VCLXWindow* GetVCLXWindow() const { return mpVCLXindow; }
VclPtr<vcl::Window> GetWindow() const;
template< class derived_type > VclPtr< derived_type > GetAs() const {
return VclPtr< derived_type >( static_cast< derived_type * >( GetWindow().get() ) ); }
template< class derived_type > VclPtr< derived_type > GetAsDynamic() const {
return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetWindow().get() ) ); }
virtual void SAL_CALL disposing() SAL_OVERRIDE;
......
......@@ -59,7 +59,7 @@ public:
VCLXDevice();
virtual ~VCLXDevice();
void SetOutputDevice( VclPtr<OutputDevice> pOutDev ) { mpOutputDevice = pOutDev; }
void SetOutputDevice( const VclPtr<OutputDevice> &pOutDev ) { mpOutputDevice = pOutDev; }
VclPtr<OutputDevice> GetOutputDevice() const { return mpOutputDevice; }
void SetCreatedWithToolkit( bool bCreatedWithToolkit );
......
......@@ -128,7 +128,7 @@ public:
VCLXWindow( bool bWithDefaultProps = false );
virtual ~VCLXWindow();
virtual void SetWindow( VclPtr<vcl::Window> pWindow );
virtual void SetWindow( const VclPtr< vcl::Window > &pWindow );
template< class derived_type > VclPtr< derived_type > GetAs() const {
return VclPtr< derived_type >( static_cast< derived_type * >( GetOutputDevice().get() ) ); }
template< class derived_type > VclPtr< derived_type > GetAsDynamic() const {
......
......@@ -56,11 +56,10 @@ VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar( VCLXWindow* pVCLWindow )
:VCLXAccessibleComponent( pVCLWindow )
,m_pHeadBar(NULL)
{
m_pHeadBar = static_cast< HeaderBar* >( GetWindow() );
m_pHeadBar = GetAs< HeaderBar >();
}
VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar()
{
}
......
......@@ -124,7 +124,7 @@ public:
VCLXFileControl();
virtual ~VCLXFileControl();
void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......@@ -176,8 +176,6 @@ protected:
sal_Int32 nKeyToSetDelayed;
FormattedField* GetFormattedField() const { return static_cast<FormattedField*>(GetWindow()); }
public:
SVTXFormattedField();
virtual ~SVTXFormattedField();
......@@ -210,7 +208,7 @@ protected:
void NotifyTextListeners();
::com::sun::star::uno::Any convertEffectiveValue(const ::com::sun::star::uno::Any& rValue);
virtual void SetWindow(vcl::Window* _pWindow) SAL_OVERRIDE;
virtual void SetWindow( const VclPtr< vcl::Window > &_pWindow) SAL_OVERRIDE;
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) SAL_OVERRIDE { return ImplGetPropertyIds( aIds ); }
......@@ -250,8 +248,7 @@ private:
static RMItemData GetRMItemData( const ::com::sun::star::container::ContainerEvent& _rEvent );
protected:
::svt::ORoadmap* GetRoadmap() const;
void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
virtual ~SVTXRoadmap();
......
......@@ -97,7 +97,7 @@ namespace svt
i_rStateSet.AddState( AccessibleStateType::EXPANDABLE );
i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) );
VclPtr< ToolPanelDrawer > pDrawer = GetAsDynamic< ToolPanelDrawer > ();
ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" );
if ( pDrawer->IsExpanded() )
i_rStateSet.AddState( AccessibleStateType::EXPANDED );
......
......@@ -216,7 +216,7 @@ void SAL_CALL PopupWindowController::doubleClick() throw (RuntimeException, std:
Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() throw (RuntimeException, std::exception)
{
ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
VclPtr< ToolBox > pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if( pToolBox )
{
vcl::Window* pItemWindow = pToolBox->GetItemWindow( pToolBox->GetDownItemId() );
......
......@@ -517,7 +517,7 @@ void StatusbarController::bindListener()
if ( m_xParentWindow.is() )
{
StatusBar* pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ));
VclPtr< StatusBar > pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ).get() );
if ( pStatusBar && pStatusBar->GetType() == WINDOW_STATUSBAR )
aRect = pStatusBar->GetItemRect( m_nID );
}
......
......@@ -89,7 +89,7 @@ SVTXGridControl::~SVTXGridControl()
}
void SVTXGridControl::SetWindow( vcl::Window* pWindow )
void SVTXGridControl::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
SVTXGridControl_Base::SetWindow( pWindow );
impl_checkTableModelInit();
......@@ -114,8 +114,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y)
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getRowAtPoint: no control (anymore)!", -1 );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::getRowAtPoint: no control (anymore)!", -1 );
TableCell const tableCell = pTable->getTableControlInterface().hitTest( Point( x, y ) );
return ( tableCell.nRow >= 0 ) ? tableCell.nRow : -1;
......@@ -126,8 +126,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getColumnAtPoint: no control (anymore)!", -1 );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::getColumnAtPoint: no control (anymore)!", -1 );
TableCell const tableCell = pTable->getTableControlInterface().hitTest( Point( x, y ) );
return ( tableCell.nColumn >= 0 ) ? tableCell.nColumn : -1;
......@@ -138,8 +138,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentColumn( ) throw (RuntimeException
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentColumn: no control (anymore)!", -1 );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::getCurrentColumn: no control (anymore)!", -1 );
sal_Int32 const nColumn = pTable->GetCurrentColumn();
return ( nColumn >= 0 ) ? nColumn : -1;
......@@ -150,8 +150,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentRow( ) throw (RuntimeException, s
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!", -1 );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::getCurrentRow: no control (anymore)!", -1 );
sal_Int32 const nRow = pTable->GetCurrentRow();
return ( nRow >= 0 ) ? nRow : -1;
......@@ -162,8 +162,8 @@ void SAL_CALL SVTXGridControl::goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!" );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::getCurrentRow: no control (anymore)!" );
impl_checkColumnIndex_throw( *pTable, i_columnIndex );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
......@@ -188,8 +188,8 @@ void SVTXGridControl::setProperty( const OUString& PropertyName, const Any& aVal
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::setProperty: no control (anymore)!" );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::setProperty: no control (anymore)!" );
switch( GetPropertyId( PropertyName ) )
{
......@@ -438,7 +438,7 @@ void SVTXGridControl::impl_checkTableModelInit()
{
if ( !m_bTableModelInitCompleted && m_xTableModel->hasColumnModel() && m_xTableModel->hasDataModel() )
{
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
if ( pTable )
{
pTable->SetModel( PTableModel( m_xTableModel ) );
......@@ -472,8 +472,8 @@ Any SVTXGridControl::getProperty( const OUString& PropertyName ) throw(RuntimeEx
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getProperty: no control (anymore)!", Any() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::getProperty: no control (anymore)!", Any() );
Any aPropertyValue;
......@@ -625,7 +625,7 @@ void SAL_CALL SVTXGridControl::dataChanged( const GridDataEvent& i_event ) throw
// if the data model is sortable, a dataChanged event is also fired in case the sort order changed.
// So, just in case, invalidate the column header area, too.
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::dataChanged: no control (anymore)!" );
pTable->getTableControlInterface().invalidate( TableAreaColumnHeaders );
}
......@@ -636,7 +636,7 @@ void SAL_CALL SVTXGridControl::rowHeadingChanged( const GridDataEvent& i_event )
SolarMutexGuard aGuard;
OSL_UNUSED( i_event );
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::rowHeadingChanged: no control (anymore)!" );
// TODO: we could do better than this - invalidate the header area only
......@@ -686,7 +686,7 @@ void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (Runtim
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectRow: no control (anymore)!" );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
......@@ -699,7 +699,7 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (RuntimeException, std::exc
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectAllRows: no control (anymore)!" );
pTable->SelectAllRows( true );
......@@ -710,7 +710,7 @@ void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (Runt
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectRow: no control (anymore)!" );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
......@@ -723,7 +723,7 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (RuntimeException, std::e
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectAllRows: no control (anymore)!" );
pTable->SelectAllRows( false );
......@@ -734,7 +734,7 @@ Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelectedRows() throw (Runti
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelectedRows: no control (anymore)!", Sequence< sal_Int32 >() );
sal_Int32 selectionCount = pTable->GetSelectedRowCount();
......@@ -749,7 +749,7 @@ sal_Bool SAL_CALL SVTXGridControl::hasSelectedRows() throw (RuntimeException, st
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::hasSelectedRows: no control (anymore)!", sal_True );
return pTable->GetSelectedRowCount() > 0;
......@@ -760,7 +760,7 @@ sal_Bool SAL_CALL SVTXGridControl::isRowSelected( ::sal_Int32 index ) throw (Run
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::isRowSelected: no control (anymore)!", sal_False );
return pTable->IsRowSelected( index );
......@@ -782,7 +782,7 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
Reference< XWindow > xKeepAlive( this );
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" );
bool handled = false;
......@@ -870,7 +870,7 @@ void SVTXGridControl::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno:
void SVTXGridControl::ImplCallItemListeners()
{
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ImplCallItemListeners: no control (anymore)!" );
if ( m_aSelectionListeners.getLength() )
......@@ -891,8 +891,8 @@ void SVTXGridControl::impl_updateColumnsFromModel_nothrow()
{
Reference< XGridColumnModel > const xColumnModel( m_xTableModel->getColumnModel() );
ENSURE_OR_RETURN_VOID( xColumnModel.is(), "no model!" );
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN_VOID( pTable != NULL, "no table!" );
VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "no table!" );
try
{
......
......@@ -106,7 +106,7 @@ public:
protected:
// VCLXWindow
virtual void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
private:
void impl_updateColumnsFromModel_nothrow();
......
......@@ -785,7 +785,7 @@ bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox )
if( (m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) )
return m_nToolBoxId;
ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if( (m_nToolBoxId == SAL_MAX_UINT16) && pToolBox )
{
......
......@@ -223,7 +223,7 @@ void TreeControlPeer::disposeControl()
void TreeControlPeer::SetWindow( vcl::Window* pWindow )
void TreeControlPeer::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
VCLXWindow::SetWindow( pWindow );
}
......
......@@ -58,7 +58,7 @@ public:
vcl::Window* createVclControl( vcl::Window* pParent, sal_Int64 nWinStyle );
// VCLXWindow
virtual void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
// ::com::sun::star::view::XSelectionSupplier
virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
This diff is collapsed.
......@@ -366,7 +366,7 @@ void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
return mpImpl->getAccessibleFactory().getFactory();
}
void VCLXWindow::SetWindow( VclPtr<vcl::Window> pWindow )
void VCLXWindow::SetWindow( const VclPtr<vcl::Window> &pWindow )
{
if ( GetWindow() )
{
......
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