[Libreoffice-commits] core.git: Branch 'feature/vclptr' - 10 commits - cppcanvas/qa include/toolkit include/vcl sfx2/source starmath/source svtools/source toolkit/source vcl/qa vcl/source
Michael Meeks
michael.meeks at collabora.com
Fri Apr 10 02:58:30 PDT 2015
cppcanvas/qa/unit/test.cxx | 2
include/toolkit/awt/vclxaccessiblecomponent.hxx | 7
include/toolkit/awt/vclxdevice.hxx | 19
include/toolkit/awt/vclxwindow.hxx | 8
include/toolkit/controls/accessiblecontrolcontext.hxx | 3
include/toolkit/helper/vclunohelper.hxx | 9
include/vcl/outdev.hxx | 30 +
include/vcl/window.hxx | 19
sfx2/source/appl/workwin.cxx | 11
sfx2/source/inc/workwin.hxx | 2
sfx2/source/view/viewprn.cxx | 2
starmath/source/view.cxx | 1
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/animatedimagespeer.cxx | 39 -
toolkit/source/awt/vclxaccessiblecomponent.cxx | 21
toolkit/source/awt/vclxdevice.cxx | 23
toolkit/source/awt/vclxspinbutton.cxx | 2
toolkit/source/awt/vclxtabpagecontainer.cxx | 31 -
toolkit/source/awt/vclxwindow.cxx | 10
toolkit/source/awt/vclxwindows.cxx | 505 ++++++++----------
toolkit/source/controls/accessiblecontrolcontext.cxx | 11
toolkit/source/helper/vclunohelper.cxx | 12
vcl/qa/cppunit/lifecycle.cxx | 10
vcl/source/outdev/outdev.cxx | 19
vcl/source/window/window.cxx | 10
35 files changed, 538 insertions(+), 557 deletions(-)
New commits:
commit 3b416a7f845e7fda384951c1ac37ac9d47fe9354
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 d168ee1..0fdc2a8 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 187956a..a6e065a 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:
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();
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 1f4bfce..d308d53 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 766b021..88f1026 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 6fec302..b1fb0a2 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_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
{
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index f533a19..eae8f13 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 5b21c44..c56a378 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 8feb8d3..5453863 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 fb6a787..d1cb564 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 e9bf072..3673f2f 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -216,7 +216,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 );
@@ -233,7 +233,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 );
@@ -246,7 +246,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;
@@ -257,7 +257,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;
@@ -268,7 +268,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 ) );
@@ -280,7 +280,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();
@@ -293,7 +293,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;
}
@@ -301,7 +301,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 );
}
@@ -310,7 +310,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 );
}
@@ -319,7 +319,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;
}
@@ -328,7 +328,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;
@@ -339,7 +339,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;
@@ -355,7 +355,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;
@@ -366,7 +366,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;
@@ -377,7 +377,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;
@@ -413,7 +413,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 );
@@ -470,7 +470,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 );
@@ -543,7 +543,7 @@ VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
VCLXFileControl::~VCLXFileControl()
{
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
pControl->GetEdit().SetModifyHdl( Link() );
}
@@ -568,7 +568,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 );
@@ -591,13 +591,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 ) );
@@ -633,7 +633,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 ) );
@@ -657,7 +657,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;
@@ -668,7 +668,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 ) );
}
@@ -678,7 +678,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();
@@ -691,7 +691,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;
}
@@ -699,7 +699,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 );
}
@@ -708,7 +708,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 );
}
@@ -717,7 +717,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;
}
@@ -736,7 +736,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();
@@ -758,7 +758,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();
@@ -773,7 +773,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 ));
@@ -788,7 +788,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();
}
@@ -825,11 +825,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);
}
@@ -837,7 +837,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 );
@@ -964,7 +964,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 );
@@ -1034,7 +1034,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;
@@ -1092,7 +1092,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;
@@ -1121,7 +1121,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();
@@ -1133,7 +1133,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;
@@ -1161,7 +1161,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();
@@ -1173,7 +1173,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;
@@ -1206,7 +1206,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();
@@ -1221,7 +1221,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();
@@ -1231,7 +1231,7 @@ bool SVTXFormattedField::GetTreatAsNumber()
void SVTXFormattedField::SetTreatAsNumber(bool bSet)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
pField->TreatAsNumber(bSet);
}
@@ -1239,7 +1239,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();
@@ -1261,7 +1261,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;
@@ -1297,7 +1297,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())
@@ -1339,14 +1339,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())
@@ -1401,19 +1401,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()
{
}
@@ -1425,7 +1418,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();
@@ -1447,7 +1440,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;
@@ -1521,7 +1514,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 );
@@ -1534,7 +1527,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;
@@ -1546,7 +1539,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 );
@@ -1563,7 +1556,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 );
@@ -1620,7 +1613,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 );
@@ -1646,7 +1639,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() );
}
@@ -1692,7 +1685,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 );
}
@@ -1701,7 +1694,7 @@ double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1709,7 +1702,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 );
}
@@ -1718,7 +1711,7 @@ double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1726,7 +1719,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 );
}
@@ -1735,7 +1728,7 @@ double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1743,7 +1736,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 );
}
@@ -1752,7 +1745,7 @@ double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1760,7 +1753,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 );
}
@@ -1769,7 +1762,7 @@ double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1777,7 +1770,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 );
}
@@ -1786,7 +1779,7 @@ double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1794,7 +1787,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 );
}
@@ -1803,7 +1796,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;
}
@@ -1811,7 +1804,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 );
}
@@ -1820,7 +1813,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;
}
@@ -1858,7 +1851,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 );
}
@@ -1867,7 +1860,7 @@ double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1875,7 +1868,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 );
}
@@ -1884,7 +1877,7 @@ double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1892,7 +1885,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 );
}
@@ -1901,7 +1894,7 @@ double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1909,7 +1902,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 );
}
@@ -1918,7 +1911,7 @@ double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1926,7 +1919,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 );
}
@@ -1935,7 +1928,7 @@ double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1943,7 +1936,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 );
}
@@ -1952,7 +1945,7 @@ double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeExce
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1960,7 +1953,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 );
}
@@ -1969,7 +1962,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;
}
@@ -1977,7 +1970,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 );
}
@@ -1986,7 +1979,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;
}
@@ -1994,7 +1987,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 );
@@ -2029,7 +2022,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 );
@@ -2079,7 +2072,7 @@ VCLXProgressBar::~VCLXProgressBar()
void VCLXProgressBar::ImplUpdateValue()
{
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_Int32 nVal;
@@ -2210,7 +2203,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 );
@@ -2269,7 +2262,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 );
@@ -2327,7 +2320,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 84a1d75..0cfeff1 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() )
{
commit 60fcbc1af412b56f95561e26aff2cc63dd81b2aa
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sat Mar 14 23:15:17 2015 +0000
toolkit: more VclPtr pieces.
Change-Id: I0393d906657b94cc547986a2165960a85d36cf48
diff --git a/include/toolkit/controls/accessiblecontrolcontext.hxx b/include/toolkit/controls/accessiblecontrolcontext.hxx
index 78fdfe7..b991b80 100644
--- a/include/toolkit/controls/accessiblecontrolcontext.hxx
+++ b/include/toolkit/controls/accessiblecontrolcontext.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XWindow.hpp>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
@@ -116,7 +117,7 @@ namespace toolkit
// stops listening at the control model
void stopModelListening( );
- vcl::Window* implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const;
+ VclPtr< vcl::Window > implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const;
};
diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx
index dc1ae88..c902e5c 100644
--- a/include/toolkit/helper/vclunohelper.hxx
+++ b/include/toolkit/helper/vclunohelper.hxx
@@ -56,11 +56,12 @@ namespace com { namespace sun { namespace star { namespace awt {
#include <vcl/bitmapex.hxx>
#include <vcl/region.hxx>
#include <vcl/metric.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
#include <tools/mapunit.hxx>
#include <tools/fldunit.hxx>
#include <tools/poly.hxx>
-namespace vcl { class Window; }
class OutputDevice;
class MouseEvent;
class KeyEvent;
@@ -79,9 +80,9 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap );
// Window
- static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow );
- static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 );
- static vcl::Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer );
+ static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow );
+ static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 );
+ static VclPtr< vcl::Window > GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer );
static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> GetInterface( vcl::Window* pWindow );
// OutputDevice
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index e9a6b4a..ca4400e 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -5162,7 +5162,7 @@ void VCLXTimeField::setTime( const util::Time& aTime ) throw(::com::sun::star::u
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
{
pTimeField->SetTime( aTime );
@@ -5179,7 +5179,7 @@ util::Time VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetTime().GetUNOTime();
else
@@ -5190,7 +5190,7 @@ void VCLXTimeField::setMin( const util::Time& aTime ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetMin( aTime );
}
@@ -5199,7 +5199,7 @@ util::Time VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetMin().GetUNOTime();
else
@@ -5210,7 +5210,7 @@ void VCLXTimeField::setMax( const util::Time& aTime ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetMax( aTime );
}
@@ -5219,7 +5219,7 @@ util::Time VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetMax().GetUNOTime();
else
@@ -5230,7 +5230,7 @@ void VCLXTimeField::setFirst( const util::Time& aTime ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetFirst( aTime );
}
@@ -5239,7 +5239,7 @@ util::Time VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetFirst().GetUNOTime();
else
@@ -5250,7 +5250,7 @@ void VCLXTimeField::setLast( const util::Time& aTime ) throw(::com::sun::star::u
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetLast( aTime );
}
@@ -5259,7 +5259,7 @@ util::Time VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
return pTimeField->GetLast().GetUNOTime();
else
@@ -5270,7 +5270,7 @@ void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException, st
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
if ( pTimeField )
pTimeField->SetEmptyTime();
}
@@ -5279,7 +5279,7 @@ sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+ VclPtr< TimeField > pTimeField = GetAs< TimeField >();
return pTimeField ? pTimeField->IsEmptyTime() : sal_False;
}
@@ -5309,8 +5309,8 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
{
if ( bVoid )
{
- static_cast<TimeField*>(GetWindow())->EnableEmptyFieldValue( true );
- static_cast<TimeField*>(GetWindow())->SetEmptyFieldValue();
+ GetAs< TimeField >()->EnableEmptyFieldValue( true );
+ GetAs< TimeField >()->SetEmptyFieldValue();
}
else
{
@@ -5338,14 +5338,14 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
{
sal_Int16 n = sal_Int16();
if ( Value >>= n )
- static_cast<TimeField*>(GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n );
+ GetAs< TimeField >()->SetExtFormat( (ExtTimeFieldFormat) n );
}
break;
case BASEPROPERTY_ENFORCE_FORMAT:
{
bool bEnforce( true );
OSL_VERIFY( Value >>= bEnforce );
- static_cast< TimeField* >( GetWindow() )->EnforceValidValue( bEnforce );
+ GetAs< TimeField >()->EnforceValidValue( bEnforce );
}
break;
default:
@@ -5383,7 +5383,7 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
break;
case BASEPROPERTY_ENFORCE_FORMAT:
{
- aProp <<= static_cast< TimeField* >( GetWindow() )->IsEnforceValidValue( );
+ aProp <<= GetAs< TimeField >()->IsEnforceValidValue( );
}
break;
default:
@@ -5536,7 +5536,7 @@ void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
if ( pNumericField )
pNumericField->SetFirst(
(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5546,7 +5546,7 @@ double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
return pNumericField
? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() )
: 0;
@@ -5556,7 +5556,7 @@ void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
if ( pNumericField )
pNumericField->SetLast(
(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5566,7 +5566,7 @@ double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
return pNumericField
? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() )
: 0;
@@ -5587,7 +5587,7 @@ void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
if ( pNumericField )
pNumericField->SetSpinSize(
(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5597,7 +5597,7 @@ double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+ VclPtr< NumericField > pNumericField = GetAs< NumericField >();
return pNumericField
? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() )
: 0;
@@ -5639,8 +5639,8 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
{
if ( bVoid )
{
- static_cast<NumericField*>(GetWindow())->EnableEmptyFieldValue( true );
- static_cast<NumericField*>(GetWindow())->SetEmptyFieldValue();
+ GetAs< NumericField >()->EnableEmptyFieldValue( true );
+ GetAs< NumericField >()->SetEmptyFieldValue();
}
else
{
@@ -5682,7 +5682,7 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
{
bool b = bool();
if ( Value >>= b )
- static_cast<NumericField*>(GetWindow())->SetUseThousandSep( b );
+ GetAs< NumericField >()->SetUseThousandSep( b );
}
break;
default:
@@ -5726,7 +5726,7 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
break;
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
{
- aProp <<= static_cast<NumericField*>(GetWindow())->IsUseThousandSep();
+ aProp <<= GetAs< NumericField >()->IsUseThousandSep();
}
break;
default:
@@ -5794,7 +5794,7 @@ MetricFormatter *VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::u
MetricField *VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException)
{
- MetricField *pField = static_cast<MetricField *>(GetWindow());
+ VclPtr< MetricField > pField = GetAs< MetricField >();
if (!pField)
throw ::com::sun::star::uno::RuntimeException();
return pField;
@@ -5932,21 +5932,21 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const ::com::su
{
bool b = false;
if ( Value >>= b )
- static_cast<NumericField*>(GetWindow())->SetUseThousandSep( b );
+ GetAs< NumericField >()->SetUseThousandSep( b );
}
break;
case BASEPROPERTY_UNIT:
{
sal_uInt16 nVal = 0;
if ( Value >>= nVal )
- static_cast<MetricField*>(GetWindow())->SetUnit( (FieldUnit) nVal );
+ GetAs< MetricField >()->SetUnit( (FieldUnit) nVal );
break;
}
case BASEPROPERTY_CUSTOMUNITTEXT:
{
OUString aStr;
if ( Value >>= aStr )
- static_cast<MetricField*>(GetWindow())->SetCustomUnitText( aStr );
+ GetAs< MetricField >()->SetCustomUnitText( aStr );
break;
}
default:
@@ -5970,13 +5970,13 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const ::com::su
switch ( nPropType )
{
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
- aProp <<= static_cast<NumericField*>(GetWindow())->IsUseThousandSep();
+ aProp <<= GetAs< NumericField >()->IsUseThousandSep();
break;
case BASEPROPERTY_UNIT:
- aProp <<= (sal_uInt16) (static_cast<MetricField*>(GetWindow())->GetUnit());
+ aProp <<= (sal_uInt16) (GetAs< MetricField >()->GetUnit());
break;
case BASEPROPERTY_CUSTOMUNITTEXT:
- aProp <<= OUString( static_cast<MetricField*>(GetWindow())->GetCustomUnitText() );
+ aProp <<= OUString( GetAs< MetricField >()->GetCustomUnitText() );
break;
default:
{
@@ -6132,7 +6132,7 @@ void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
if ( pCurrencyField )
pCurrencyField->SetFirst(
ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6142,7 +6142,7 @@ double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
return pCurrencyField
? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() )
: 0;
@@ -6152,7 +6152,7 @@ void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
if ( pCurrencyField )
pCurrencyField->SetLast(
ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6162,7 +6162,7 @@ double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
return pCurrencyField
? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() )
: 0;
@@ -6172,7 +6172,7 @@ void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
if ( pCurrencyField )
pCurrencyField->SetSpinSize(
ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6182,7 +6182,7 @@ double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeExce
{
SolarMutexGuard aGuard;
- LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+ VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
return pCurrencyField
? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() )
: 0;
@@ -6235,8 +6235,8 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
{
if ( bVoid )
{
- static_cast<LongCurrencyField*>(GetWindow())->EnableEmptyFieldValue( true );
- static_cast<LongCurrencyField*>(GetWindow())->SetEmptyFieldValue();
+ GetAs< LongCurrencyField >()->EnableEmptyFieldValue( true );
+ GetAs< LongCurrencyField >()->SetEmptyFieldValue();
}
else
{
@@ -6278,14 +6278,14 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
{
OUString aString;
if ( Value >>= aString )
- static_cast<LongCurrencyField*>(GetWindow())->SetCurrencySymbol( aString );
+ GetAs< LongCurrencyField >()->SetCurrencySymbol( aString );
}
break;
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
{
bool b = bool();
if ( Value >>= b )
- static_cast<LongCurrencyField*>(GetWindow())->SetUseThousandSep( b );
+ GetAs< LongCurrencyField >()->SetUseThousandSep( b );
}
break;
default:
@@ -6329,12 +6329,12 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
break;
case BASEPROPERTY_CURRENCYSYMBOL:
{
- aProp <<= OUString( static_cast<LongCurrencyField*>(GetWindow())->GetCurrencySymbol() );
+ aProp <<= OUString( GetAs< LongCurrencyField >()->GetCurrencySymbol() );
}
break;
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
{
- aProp <<= static_cast<LongCurrencyField*>(GetWindow())->IsUseThousandSep();
+ aProp <<= GetAs< LongCurrencyField >()->IsUseThousandSep();
}
break;
default:
@@ -6406,7 +6406,7 @@ void VCLXPatternField::setMasks( const OUString& EditMask, const OUString& Liter
{
SolarMutexGuard aGuard;
- PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+ VclPtr< PatternField > pPatternField = GetAs< PatternField >();
if ( pPatternField )
{
pPatternField->SetMask( OUStringToOString(EditMask, RTL_TEXTENCODING_ASCII_US), LiteralMask );
@@ -6417,7 +6417,7 @@ void VCLXPatternField::getMasks( OUString& EditMask, OUString& LiteralMask ) thr
{
SolarMutexGuard aGuard;
- PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+ VclPtr< PatternField > pPatternField = GetAs< PatternField >();
if ( pPatternField )
{
EditMask = OStringToOUString(pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US);
@@ -6428,12 +6428,9 @@ void VCLXPatternField::getMasks( OUString& EditMask, OUString& LiteralMask ) thr
void VCLXPatternField::setString( const OUString& Str ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+ VclPtr< PatternField > pPatternField = GetAs< PatternField >();
if ( pPatternField )
- {
pPatternField->SetString( Str );
- }
}
OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException, std::exception)
@@ -6441,7 +6438,7 @@ OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeExcep
SolarMutexGuard aGuard;
OUString aString;
- PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+ VclPtr< PatternField > pPatternField = GetAs< PatternField >();
if ( pPatternField )
aString = pPatternField->GetString();
return aString;
diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx
index d8084d4..bf8f380 100644
--- a/toolkit/source/controls/accessiblecontrolcontext.cxx
+++ b/toolkit/source/controls/accessiblecontrolcontext.cxx
@@ -225,17 +225,18 @@ namespace toolkit
}
- vcl::Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
+ VclPtr< vcl::Window > OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
{
Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY );
Reference< awt::XWindow > xWindow;
if ( xControl.is() )
xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY);
- vcl::Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : NULL;
+ VclPtr< vcl::Window > pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : VclPtr< vcl::Window >();
if ( _pxUNOWindow )
*_pxUNOWindow = xWindow;
+
return pWindow;
}
@@ -259,7 +260,7 @@ namespace toolkit
// our control
Reference< awt::XWindow > xWindow;
- vcl::Window* pVCLWindow = implGetWindow( &xWindow );
+ VclPtr< vcl::Window > pVCLWindow = implGetWindow( &xWindow );
awt::Rectangle aBounds( 0, 0, 0, 0 );
if ( xWindow.is() )
@@ -319,7 +320,7 @@ namespace toolkit
// want to do some VCL stuff here ...
OContextEntryGuard aGuard( this );
- vcl::Window* pWindow = implGetWindow( );
+ VclPtr< vcl::Window > pWindow = implGetWindow();
sal_Int32 nColor = 0;
if ( pWindow )
{
@@ -345,7 +346,7 @@ namespace toolkit
// want to do some VCL stuff here ...
OContextEntryGuard aGuard( this );
- vcl::Window* pWindow = implGetWindow( );
+ VclPtr< vcl::Window > pWindow = implGetWindow();
sal_Int32 nColor = 0;
if ( pWindow )
{
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
index 7b80bc7..005cacc 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -108,22 +108,22 @@ BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com:
return xBmp;
}
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
{
VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
}
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
{
VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
}
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
{
VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
- return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
}
vcl::Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion )
commit 95f686d99ec2772d547bec45736644d4ca527b09
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sat Mar 14 22:30:45 2015 +0000
toolkit: more cleanup.
Change-Id: I2aa5c818d4f2c07926bda539da30ada63620f69d
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index b3c07eb..e9a6b4a 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -1239,7 +1239,7 @@ void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- VclPtr< RadioButton > pButton = GetAs< RadioButton >();
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton)
{
pRadioButton->Check( b );
@@ -1258,7 +1258,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- VclPtr< RadioButton > pButton = GetAs< RadioButton >();
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
return pRadioButton ? pRadioButton->IsChecked() : sal_False;
}
@@ -1267,7 +1267,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti
SolarMutexGuard aGuard;
Size aSz;
- VclPtr< RadioButton > pButton = GetAs< RadioButton >();
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton )
aSz = pRadioButton->CalcMinimumSize();
return AWTSize(aSz);
@@ -1283,7 +1283,7 @@ sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeExcepti
SolarMutexGuard aGuard;
Size aSz = VCLSize(rNewSize);
- VclPtr< RadioButton > pButton = GetAs< RadioButton >();
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton )
{
Size aMinSz = pRadioButton->CalcMinimumSize();
@@ -1329,7 +1329,7 @@ void VCLXRadioButton::ImplClickedOrToggled( bool bToggled )
{
// In the formulars, RadioChecked is not enabled, call itemStateChanged only for click
// In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
- VclPtr< RadioButton > pButton = GetAs< RadioButton >();
+ VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >();
if ( pRadioButton && ( pRadioButton->IsRadioCheckEnabled() == bToggled ) && ( bToggled || pRadioButton->IsStateChanged() ) && maItemListeners.getLength() )
{
::com::sun::star::awt::ItemEvent aEvent;
@@ -1798,7 +1798,7 @@ void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
case VCLEVENT_LISTBOX_SELECT:
{
- VclPtr< ListBox > pBox = GetAs< ListBox >();
+ VclPtr< ListBox > pListBox = GetAs< ListBox >();
if( pListBox )
{
bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False;
@@ -2321,7 +2321,7 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException, s
sal_Int16 nRet = 0;
if ( GetWindow() )
{
- Dialog* pDlg = static_cast<Dialog*>(GetWindow());
+ VclPtr< Dialog > pDlg = GetAs< Dialog >();
vcl::Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
vcl::Window* pOldParent = NULL;
vcl::Window* pSetParent = NULL;
@@ -2355,7 +2355,6 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s
{
SolarMutexGuard aGuard;
VclPtr< vcl::Window > pWindow = GetWindow();
-
if ( pWindow )
{
OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
@@ -2374,7 +2373,7 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s
::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
SolarMutexGuard aGuard;
- Dialog* pDlg = static_cast<Dialog*>(GetWindow());
+ VclPtr< Dialog > pDlg = GetAs< Dialog >();
if ( pDlg )
pDlg->GetDrawWindowBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
@@ -2387,8 +2386,7 @@ void SAL_CALL VCLXDialog::setProperty(
throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- Dialog* pDialog = static_cast<Dialog*>(GetWindow());
+ VclPtr< Dialog > pDialog = GetAs< Dialog >();
if ( pDialog )
{
bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
@@ -2541,7 +2539,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
SolarMutexGuard aGuard;
OSL_TRACE(" **** VCLXMultiPage::setProperty( %s )", OUStringToOString( PropertyName, RTL_TEXTENCODING_UTF8 ).getStr() );
- TabControl* pTabControl = static_cast<TabControl*>(GetWindow());
+ VclPtr< TabControl > pTabControl = GetAs< TabControl >();
if ( pTabControl )
{
bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
@@ -2593,7 +2591,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException)
{
- TabControl *pTabControl = dynamic_cast< TabControl* >( GetWindow() );
+ VclPtr<TabControl> pTabControl = GetAsDynamic< TabControl >();
if ( pTabControl )
return pTabControl;
throw uno::RuntimeException();
@@ -2794,8 +2792,7 @@ void SAL_CALL VCLXTabPage::setProperty(
throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- TabPage* pTabPage = static_cast<TabPage*>(GetWindow());
+ VclPtr< TabPage > pTabPage = GetAs< TabPage >();
if ( pTabPage )
{
bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
@@ -2845,7 +2842,7 @@ throw(::com::sun::star::uno::RuntimeException, std::exception)
TabPage *VCLXTabPage::getTabPage() const throw (uno::RuntimeException)
{
- TabPage *pTabPage = dynamic_cast< TabPage* >( GetWindow() );
+ VclPtr< TabPage > pTabPage = GetAsDynamic< TabPage >();
if ( pTabPage )
return pTabPage;
throw uno::RuntimeException();
@@ -2906,7 +2903,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve
{
// open the URL
OUString sURL;
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
sURL = pBase->GetURL();
Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::com::sun::star::system::SystemShellExecute::create(
@@ -2940,8 +2937,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve
void VCLXFixedHyperlink::setText( const OUString& Text ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if (pBase)
pBase->SetText(Text);
}
@@ -2960,8 +2956,7 @@ OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeExcep
void VCLXFixedHyperlink::setURL( const OUString& URL ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
pBase->SetURL( URL );
}
@@ -2971,7 +2966,7 @@ OUString VCLXFixedHyperlink::getURL( ) throw(::com::sun::star::uno::RuntimeExce
SolarMutexGuard aGuard;
OUString aText;
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
aText = pBase->GetURL();
return aText;
@@ -3032,9 +3027,8 @@ void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Refe
::com::sun::star::awt::Size VCLXFixedHyperlink::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
Size aSz;
- FixedText* pFixedText = static_cast<FixedText*>(GetWindow());
+ VclPtr< FixedText > pFixedText = GetAs< FixedText >();
if ( pFixedText )
aSz = pFixedText->CalcMinimumSize();
return AWTSize(aSz);
@@ -3061,7 +3055,7 @@ void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const ::com:
{
SolarMutexGuard aGuard;
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -3096,7 +3090,7 @@ void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const ::com:
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- FixedHyperlink* pBase = static_cast<FixedHyperlink*>(GetWindow());
+ VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
if ( pBase )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -3264,7 +3258,7 @@ short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeExceptio
SolarMutexGuard aGuard;
Size aSz;
- FixedText* pFixedText = static_cast<FixedText*>(GetWindow());
+ VclPtr< FixedText > pFixedText = GetAs< FixedText >();
if ( pFixedText )
aSz = pFixedText->CalcMinimumSize();
return AWTSize(aSz);
@@ -3280,7 +3274,7 @@ short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeExceptio
SolarMutexGuard aGuard;
Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) );
- FixedText* pFixedText = static_cast<FixedText*>(GetWindow());
+ VclPtr< FixedText > pFixedText = GetAs< FixedText >();
if ( pFixedText )
aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width );
return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize );
@@ -3369,7 +3363,7 @@ void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::Runtime
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->DoScroll( n );
}
@@ -3378,7 +3372,7 @@ void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 n
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
{
pScrollBar->SetVisibleSize( nVisible );
@@ -3391,7 +3385,7 @@ sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetThumbPos() : 0;
}
@@ -3399,7 +3393,7 @@ void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetRangeMax( n );
}
@@ -3408,7 +3402,7 @@ sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeExcept
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetRangeMax() : 0;
}
@@ -3416,7 +3410,7 @@ void VCLXScrollBar::setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetRangeMin( n );
}
@@ -3425,7 +3419,7 @@ sal_Int32 VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeExcept
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetRangeMin() : 0;
}
@@ -3433,7 +3427,7 @@ void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetLineSize( n );
}
@@ -3442,7 +3436,7 @@ sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::Runtime
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetLineSize() : 0;
}
@@ -3450,7 +3444,7 @@ void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetPageSize( n );
}
@@ -3459,7 +3453,7 @@ sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetPageSize() : 0;
}
@@ -3467,7 +3461,7 @@ void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::R
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
pScrollBar->SetVisibleSize( n );
}
@@ -3476,7 +3470,7 @@ sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeEx
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
return pScrollBar ? pScrollBar->GetVisibleSize() : 0;
}
@@ -3522,7 +3516,7 @@ void VCLXScrollBar::setProperty( const OUString& PropertyName, const ::com::sun:
{
SolarMutexGuard aGuard;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
{
bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
@@ -3638,7 +3632,7 @@ void VCLXScrollBar::setProperty( const OUString& PropertyName, const ::com::sun:
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if ( pScrollBar )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -3715,7 +3709,7 @@ void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if ( maAdjustmentListeners.getLength() )
{
- ScrollBar* pScrollBar = static_cast<ScrollBar*>(GetWindow());
+ VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
if( pScrollBar )
{
@@ -3855,7 +3849,7 @@ void VCLXEdit::setText( const OUString& aText ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
pEdit->SetText( aText );
@@ -3872,7 +3866,7 @@ void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const O
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) );
@@ -3902,7 +3896,7 @@ OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeExcepti
SolarMutexGuard aGuard;
OUString aText;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit)
aText = pEdit->GetSelected();
return aText;
@@ -3913,7 +3907,7 @@ void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
}
@@ -3923,7 +3917,7 @@ void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection
SolarMutexGuard aGuard;
Selection aSel;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
aSel = pEdit->GetSelection();
return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() );
@@ -3933,7 +3927,7 @@ sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException, s
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False;
}
@@ -3941,7 +3935,7 @@ void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
pEdit->SetReadOnly( !bEditable );
}
@@ -3951,7 +3945,7 @@ void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
pEdit->SetMaxTextLen( nLen );
}
@@ -3960,7 +3954,7 @@ sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
return pEdit ? pEdit->GetMaxTextLen() : 0;
}
@@ -3968,7 +3962,7 @@ void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
pEdit->SetEchoChar( cEcho );
}
@@ -3977,7 +3971,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star
{
SolarMutexGuard aGuard;
- Edit* pEdit = static_cast<Edit*>(GetWindow());
+ VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -4023,7 +4017,7 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const ::com::sun::star
SolarMutexGuard aGuard;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list