[Libreoffice-commits] core.git: Branch 'feature/vclref' - include/toolkit svtools/source toolkit/source
Michael Meeks
michael.meeks at collabora.com
Sat Mar 14 16:43:41 PDT 2015
include/toolkit/awt/vclxaccessiblecomponent.hxx | 4
include/toolkit/awt/vclxdevice.hxx | 2
include/toolkit/awt/vclxwindow.hxx | 2
svtools/source/control/vclxaccessibleheaderbar.cxx | 3
svtools/source/inc/unoiface.hxx | 9
svtools/source/toolpanel/toolpaneldrawerpeer.cxx | 2
svtools/source/uno/popupwindowcontroller.cxx | 2
svtools/source/uno/statusbarcontroller.cxx | 2
svtools/source/uno/svtxgridcontrol.cxx | 58 ++---
svtools/source/uno/svtxgridcontrol.hxx | 2
svtools/source/uno/toolboxcontroller.cxx | 2
svtools/source/uno/treecontrolpeer.cxx | 2
svtools/source/uno/treecontrolpeer.hxx | 2
svtools/source/uno/unoiface.cxx | 205 ++++++++++-----------
toolkit/source/awt/vclxwindow.cxx | 2
15 files changed, 146 insertions(+), 153 deletions(-)
New commits:
commit ea2054c1ba66a01474f478dd1d702c97f384beee
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sat Mar 14 23:48:14 2015 +0000
svtools: switch UNO pieces to use VclPtr enabled toolkit.
Change-Id: Ib243b14e3476d3a65ad1414e3843511420201c7c
diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx
index dd72bd2..85509b4 100644
--- a/include/toolkit/awt/vclxaccessiblecomponent.hxx
+++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx
@@ -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;
diff --git a/include/toolkit/awt/vclxdevice.hxx b/include/toolkit/awt/vclxdevice.hxx
index 751ffd8..47a99ea 100644
--- a/include/toolkit/awt/vclxdevice.hxx
+++ b/include/toolkit/awt/vclxdevice.hxx
@@ -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 );
diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx
index dfc42aa..1ab1f9e 100644
--- a/include/toolkit/awt/vclxwindow.hxx
+++ b/include/toolkit/awt/vclxwindow.hxx
@@ -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 {
diff --git a/svtools/source/control/vclxaccessibleheaderbar.cxx b/svtools/source/control/vclxaccessibleheaderbar.cxx
index 19a1e55..7c92837 100644
--- a/svtools/source/control/vclxaccessibleheaderbar.cxx
+++ b/svtools/source/control/vclxaccessibleheaderbar.cxx
@@ -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()
{
}
diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx
index 684c964..f81a3a7 100644
--- a/svtools/source/inc/unoiface.hxx
+++ b/svtools/source/inc/unoiface.hxx
@@ -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:
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();
diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
index 5f7af79..8e83866 100644
--- a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
+++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
@@ -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 );
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index bdd9282..af2445f 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -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() );
diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx
index d0f6eec..cded0cf 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -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 );
}
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index df7c51b..22da505 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -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_pTableModel->hasColumnModel() && m_pTableModel->hasDataModel() )
{
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
if ( pTable )
{
pTable->SetModel( PTableModel( m_pTableModel ) );
@@ -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_pTableModel->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
{
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index 2deadde..2554d53 100644
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -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();
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index fd02c9d..2c5207b 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -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 )
{
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index b3e447b..3a6b99d 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -223,7 +223,7 @@ void TreeControlPeer::disposeControl()
-void TreeControlPeer::SetWindow( vcl::Window* pWindow )
+void TreeControlPeer::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
VCLXWindow::SetWindow( pWindow );
}
diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx
index 9b07062..6b3b422 100644
--- a/svtools/source/uno/treecontrolpeer.hxx
+++ b/svtools/source/uno/treecontrolpeer.hxx
@@ -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;
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index d59d92b..052f491 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -215,7 +215,7 @@ void VCLXMultiLineEdit::setText( const OUString& aText ) throw(::com::sun::star:
{
SolarMutexGuard aGuard;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
pEdit->SetText( aText );
@@ -232,7 +232,7 @@ void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel
{
SolarMutexGuard aGuard;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
setSelection( rSel );
@@ -245,7 +245,7 @@ OUString VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeExcept
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aText = pEdit->GetText( meLineEndType );
return aText;
@@ -256,7 +256,7 @@ OUString VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::Runti
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit)
aText = pMultiLineEdit->GetSelected( meLineEndType );
return aText;
@@ -267,7 +267,7 @@ void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aS
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
pMultiLineEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
@@ -279,7 +279,7 @@ void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aS
SolarMutexGuard aGuard;
::com::sun::star::awt::Selection aSel;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
aSel.Min = pMultiLineEdit->GetSelection().Min();
@@ -292,7 +292,7 @@ sal_Bool VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeExc
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
return ( pMultiLineEdit && !pMultiLineEdit->IsReadOnly() && pMultiLineEdit->IsEnabled() ) ? sal_True : sal_False;
}
@@ -300,7 +300,7 @@ void VCLXMultiLineEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
pMultiLineEdit->SetReadOnly( !bEditable );
}
@@ -309,7 +309,7 @@ void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
pMultiLineEdit->SetMaxTextLen( nLen );
}
@@ -318,7 +318,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
return pMultiLineEdit ? (sal_Int16)pMultiLineEdit->GetMaxTextLen() : (sal_Int16)0;
}
@@ -327,7 +327,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aText = pEdit->GetTextLines( meLineEndType );
return aText;
@@ -338,7 +338,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcMinimumSize());
return aSz;
@@ -354,7 +354,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz = rNewSize;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcAdjustedSize( VCLSize(rNewSize )));
return aSz;
@@ -365,7 +365,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcBlockSize( nCols, nLines ));
return aSz;
@@ -376,7 +376,7 @@ void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines
SolarMutexGuard aGuard;
nCols = nLines = 0;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
sal_uInt16 nC, nL;
@@ -412,7 +412,7 @@ void VCLXMultiLineEdit::setProperty( const OUString& PropertyName, const ::com::
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -469,7 +469,7 @@ void VCLXMultiLineEdit::setProperty( const OUString& PropertyName, const ::com::
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -542,7 +542,7 @@ VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
VCLXFileControl::~VCLXFileControl()
{
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
pControl->GetEdit().SetModifyHdl( Link() );
}
@@ -567,7 +567,7 @@ void SAL_CALL VCLXFileControl::setProperty( const OUString& PropertyName, const
{
SolarMutexGuard aGuard;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -590,13 +590,13 @@ void SAL_CALL VCLXFileControl::setProperty( const OUString& PropertyName, const
}
}
-void VCLXFileControl::SetWindow( vcl::Window* pWindow )
+void VCLXFileControl::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
- FileControl* pPrevFileControl = dynamic_cast<FileControl*>( GetWindow() );
+ VclPtr< FileControl > pPrevFileControl = GetAsDynamic< FileControl >();
if ( pPrevFileControl )
pPrevFileControl->GetEdit().SetModifyHdl( Link() );
- FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow );
+ FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow.get() );
if ( pNewFileControl )
pNewFileControl->GetEdit().SetModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
@@ -632,7 +632,7 @@ void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel,
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
{
pFileControl->GetEdit().SetSelection( Selection( rSel.Min, rSel.Max ) );
@@ -656,7 +656,7 @@ OUString VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::Runtime
SolarMutexGuard aGuard;
OUString aText;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl)
aText = pFileControl->GetEdit().GetSelected();
return aText;
@@ -667,7 +667,7 @@ void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSel
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetSelection( Selection( aSelection.Min, aSelection.Max ) );
}
@@ -677,7 +677,7 @@ void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSel
SolarMutexGuard aGuard;
::com::sun::star::awt::Selection aSel;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
{
aSel.Min = pFileControl->GetEdit().GetSelection().Min();
@@ -690,7 +690,7 @@ sal_Bool VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
return ( pFileControl && !pFileControl->GetEdit().IsReadOnly() && pFileControl->GetEdit().IsEnabled() ) ? sal_True : sal_False;
}
@@ -698,7 +698,7 @@ void VCLXFileControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetReadOnly( !bEditable );
}
@@ -707,7 +707,7 @@ void VCLXFileControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetMaxTextLen( nLen );
}
@@ -716,7 +716,7 @@ sal_Int16 VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeE
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
return pFileControl ? pFileControl->GetEdit().GetMaxTextLen() : 0;
}
@@ -735,7 +735,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
Size aTmpSize = pControl->GetEdit().CalcMinimumSize();
@@ -757,7 +757,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz =rNewSize;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
::com::sun::star::awt::Size aMinSz = getMinimumSize();
@@ -772,7 +772,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
aSz = AWTSize(pControl->GetEdit().CalcSize( nCols ));
@@ -787,7 +787,7 @@ void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines )
nCols = 0;
nLines = 1;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
nCols = pControl->GetEdit().GetMaxVisChars();
}
@@ -824,11 +824,11 @@ SVTXFormattedField::~SVTXFormattedField()
}
-void SVTXFormattedField::SetWindow( vcl::Window* _pWindow )
+void SVTXFormattedField::SetWindow( const VclPtr< vcl::Window > &_pWindow )
{
VCLXSpinField::SetWindow(_pWindow);
- if (GetFormattedField())
- GetFormattedField()->SetAutoColor(true);
+ if (GetAs< FormattedField >())
+ GetAs< FormattedField >()->SetAutoColor(true);
}
@@ -836,7 +836,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -963,7 +963,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
::com::sun::star::uno::Any aReturn;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1033,7 +1033,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
{
::com::sun::star::uno::Any aReturn;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return aReturn;
@@ -1091,7 +1091,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1120,7 +1120,7 @@ void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
::com::sun::star::uno::Any SVTXFormattedField::GetMinValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || !pField->HasMinValue())
return ::com::sun::star::uno::Any();
@@ -1132,7 +1132,7 @@ void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1160,7 +1160,7 @@ void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
::com::sun::star::uno::Any SVTXFormattedField::GetMaxValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || !pField->HasMaxValue())
return ::com::sun::star::uno::Any();
@@ -1172,7 +1172,7 @@ void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1205,7 +1205,7 @@ void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValu
::com::sun::star::uno::Any SVTXFormattedField::GetDefaultValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || pField->IsEmptyFieldEnabled())
return ::com::sun::star::uno::Any();
@@ -1220,7 +1220,7 @@ void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValu
bool SVTXFormattedField::GetTreatAsNumber()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
return pField->TreatingAsNumber();
@@ -1230,7 +1230,7 @@ bool SVTXFormattedField::GetTreatAsNumber()
void SVTXFormattedField::SetTreatAsNumber(bool bSet)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
pField->TreatAsNumber(bSet);
}
@@ -1238,7 +1238,7 @@ void SVTXFormattedField::SetTreatAsNumber(bool bSet)
::com::sun::star::uno::Any SVTXFormattedField::GetValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return ::com::sun::star::uno::Any();
@@ -1260,7 +1260,7 @@ void SVTXFormattedField::SetTreatAsNumber(bool bSet)
void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1296,7 +1296,7 @@ void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
SvNumberFormatsSupplierObj* pNew = NULL;
if (!xSupplier.is())
@@ -1338,14 +1338,14 @@ void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Referen
sal_Int32 SVTXFormattedField::getFormatKey(void) const
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetFormatKey() : 0;
}
void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
{
if (pField->GetFormatter())
@@ -1400,19 +1400,12 @@ void SVTXFormattedField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
// class SVTXRoadmap
-
using namespace svt;
-::svt::ORoadmap* SVTXRoadmap::GetRoadmap() const
-{
- return static_cast<svt::ORoadmap*>(GetWindow());
-}
-
SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this )
{
}
-
SVTXRoadmap::~SVTXRoadmap()
{
}
@@ -1424,7 +1417,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VCLEVENT_ROADMAP_ITEMSELECTED:
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_Int16 CurItemID = pField->GetCurrentRoadmapItemID();
@@ -1446,7 +1439,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRoadmapItem;
@@ -1520,7 +1513,7 @@ RMItemData SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::Contai
void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
RMItemData CurItemData = GetRMItemData( _rEvent );
@@ -1533,7 +1526,7 @@ void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerE
void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_Int32 DelIndex = 0;
@@ -1545,7 +1538,7 @@ void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEv
void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
RMItemData CurItemData = GetRMItemData( _rEvent );
@@ -1562,7 +1555,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1619,7 +1612,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::uno::Any aReturn;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1645,7 +1638,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
void SVTXRoadmap::ImplSetNewImage()
{
OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" );
- ::svt::ORoadmap* pButton = static_cast< ::svt::ORoadmap* >( GetWindow() );
+ VclPtr< ::svt::ORoadmap > pButton = GetAs< ::svt::ORoadmap >();
pButton->SetRoadmapBitmap( GetImage().GetBitmapEx() );
}
@@ -1691,7 +1684,7 @@ void SVTXNumericField::setValue( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetValue( Value );
}
@@ -1700,7 +1693,7 @@ double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1708,7 +1701,7 @@ void SVTXNumericField::setMin( double Value ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMinValue( Value );
}
@@ -1717,7 +1710,7 @@ double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1725,7 +1718,7 @@ void SVTXNumericField::setMax( double Value ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMaxValue( Value );
}
@@ -1734,7 +1727,7 @@ double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1742,7 +1735,7 @@ void SVTXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinFirst( Value );
}
@@ -1751,7 +1744,7 @@ double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1759,7 +1752,7 @@ void SVTXNumericField::setLast( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinLast( Value );
}
@@ -1768,7 +1761,7 @@ double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1776,7 +1769,7 @@ void SVTXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinSize( Value );
}
@@ -1785,7 +1778,7 @@ double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1793,7 +1786,7 @@ void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::sta
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetDecimalDigits( Value );
}
@@ -1802,7 +1795,7 @@ sal_Int16 SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetDecimalDigits() : 0;
}
@@ -1810,7 +1803,7 @@ void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::sta
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetStrictFormat( bStrict );
}
@@ -1819,7 +1812,7 @@ sal_Bool SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::Runtime
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->IsStrictFormat() : sal_False;
}
@@ -1857,7 +1850,7 @@ void SVTXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetValue( Value );
}
@@ -1866,7 +1859,7 @@ double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1874,7 +1867,7 @@ void SVTXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMinValue( Value );
}
@@ -1883,7 +1876,7 @@ double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1891,7 +1884,7 @@ void SVTXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMaxValue( Value );
}
@@ -1900,7 +1893,7 @@ double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1908,7 +1901,7 @@ void SVTXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinFirst( Value );
}
@@ -1917,7 +1910,7 @@ double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1925,7 +1918,7 @@ void SVTXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinLast( Value );
}
@@ -1934,7 +1927,7 @@ double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1942,7 +1935,7 @@ void SVTXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinSize( Value );
}
@@ -1951,7 +1944,7 @@ double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeExce
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1959,7 +1952,7 @@ void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::st
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetDecimalDigits( Value );
}
@@ -1968,7 +1961,7 @@ sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetDecimalDigits() : 0;
}
@@ -1976,7 +1969,7 @@ void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::st
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetStrictFormat( bStrict );
}
@@ -1985,7 +1978,7 @@ sal_Bool SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->IsStrictFormat() : sal_False;
}
@@ -1993,7 +1986,7 @@ void SVTXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
{
SolarMutexGuard aGuard;
- DoubleCurrencyField* pField = static_cast<DoubleCurrencyField*>(GetFormattedField());
+ VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2028,7 +2021,7 @@ void SVTXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
::com::sun::star::uno::Any aReturn;
- DoubleCurrencyField* pField = static_cast<DoubleCurrencyField*>(GetFormattedField());
+ VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2078,7 +2071,7 @@ VCLXProgressBar::~VCLXProgressBar()
void VCLXProgressBar::ImplUpdateValue()
{
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_Int32 nVal;
@@ -2209,7 +2202,7 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const ::com::su
{
SolarMutexGuard aGuard;
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2268,7 +2261,7 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const ::com::su
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2326,7 +2319,7 @@ void SAL_CALL SVTXDateField::setProperty( const OUString& PropertyName, const ::
VCLXDateField::setProperty( PropertyName, Value );
// some properties need to be forwarded to the sub edit, too
- Edit* pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow() )->GetSubEdit() : NULL;
+ VclPtr< Edit > pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow().get() )->GetSubEdit() : NULL;
if ( !pSubEdit )
return;
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index cdad2f9..d68f00f 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -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() )
{
More information about the Libreoffice-commits
mailing list