diff options
Diffstat (limited to 'svtools/source/uno')
-rw-r--r-- | svtools/source/uno/addrtempuno.cxx | 10 | ||||
-rw-r--r-- | svtools/source/uno/generictoolboxcontroller.cxx | 6 | ||||
-rw-r--r-- | svtools/source/uno/genericunodialog.cxx | 5 | ||||
-rw-r--r-- | svtools/source/uno/popupwindowcontroller.cxx | 10 | ||||
-rw-r--r-- | svtools/source/uno/statusbarcontroller.cxx | 2 | ||||
-rw-r--r-- | svtools/source/uno/svtxgridcontrol.cxx | 58 | ||||
-rw-r--r-- | svtools/source/uno/svtxgridcontrol.hxx | 2 | ||||
-rw-r--r-- | svtools/source/uno/toolboxcontroller.cxx | 2 | ||||
-rw-r--r-- | svtools/source/uno/treecontrolpeer.cxx | 11 | ||||
-rw-r--r-- | svtools/source/uno/treecontrolpeer.hxx | 4 | ||||
-rw-r--r-- | svtools/source/uno/unoiface.cxx | 221 | ||||
-rw-r--r-- | svtools/source/uno/wizard/unowizard.cxx | 28 | ||||
-rw-r--r-- | svtools/source/uno/wizard/wizardshell.cxx | 16 | ||||
-rw-r--r-- | svtools/source/uno/wizard/wizardshell.hxx | 5 |
14 files changed, 185 insertions, 195 deletions
diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index 1a9a8645ba50..d21a3baefa6f 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -71,7 +71,7 @@ namespace { protected: // OGenericUnoDialog overridables - virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE; + virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE; virtual void implInitialize(const com::sun::star::uno::Any& _rValue) SAL_OVERRIDE; @@ -134,7 +134,7 @@ namespace { if ( _nExecutionResult ) if ( m_pDialog ) - static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases ); + static_cast< AddressBookSourceDialog* >( m_pDialog.get() )->getFieldMapping( m_aAliases ); } void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments) throw(Exception, RuntimeException, std::exception) @@ -212,12 +212,12 @@ namespace { } - Dialog* OAddressBookSourceDialogUno::createDialog(vcl::Window* _pParent) + VclPtr<Dialog> OAddressBookSourceDialogUno::createDialog(vcl::Window* _pParent) { if ( m_xDataSource.is() && !m_sTable.isEmpty() ) - return new AddressBookSourceDialog(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); + return VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); else - return new AddressBookSourceDialog( _pParent, m_aContext ); + return VclPtr<AddressBookSourceDialog>::Create( _pParent, m_aContext ); } } diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx index 1c78816e63af..04e6203477a4 100644 --- a/svtools/source/uno/generictoolboxcontroller.cxx +++ b/svtools/source/uno/generictoolboxcontroller.cxx @@ -74,11 +74,9 @@ void SAL_CALL GenericToolboxController::dispose() throw ( RuntimeException, std::exception ) { SolarMutexGuard aSolarMutexGuard; - - svt::ToolboxController::dispose(); - - m_pToolbox = 0; + m_pToolbox.clear(); m_nID = 0; + svt::ToolboxController::dispose(); } void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ ) diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx index b0186d2c8dc0..4b7f82f3d753 100644 --- a/svtools/source/uno/genericunodialog.cxx +++ b/svtools/source/uno/genericunodialog.cxx @@ -178,7 +178,7 @@ bool OGenericUnoDialog::impl_ensureDialog_lck() // the title OUString sTitle = m_sTitle; - Dialog* pDialog = createDialog( pParent ); + VclPtr<Dialog> pDialog = createDialog( pParent ); OSL_ENSURE( pDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!" ); if ( !pDialog ) return false; @@ -313,8 +313,7 @@ void SAL_CALL OGenericUnoDialog::initialize( const Sequence< Any >& aArguments ) void OGenericUnoDialog::destroyDialog() { - delete m_pDialog; - m_pDialog = NULL; + m_pDialog.disposeAndClear(); } diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index aa6277a81c07..82f61e3b9e49 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -47,8 +47,8 @@ public: DECL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, vcl::Window* ); private: - vcl::Window* mpPopupWindow; - ToolBox* mpToolBox; + VclPtr<vcl::Window> mpPopupWindow; + VclPtr<ToolBox> mpToolBox; }; PopupWindowControllerImpl::PopupWindowControllerImpl() @@ -99,7 +99,7 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, (void*)mpPopupWindow ); mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 ); - svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow ); + svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow.get() ); if( pToolbarMenu ) pToolbarMenu->highlightFirstEntry(); break; @@ -126,7 +126,7 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve IMPL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, vcl::Window*, pWindow ) { (void)*pThis; - delete pWindow; + pWindow->disposeOnce(); return 0; } @@ -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 766b02128e9f..88f10265e99e 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 6fec3022a7fb..b1fb0a2e0cbd 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 f533a19eaead..eae8f131b22c 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 d8bdc68bb902..86ed9a7ccdf4 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 00efbd5d4ac2..e1d132694a13 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -86,6 +86,7 @@ class UnoTreeListBoxImpl : public SvTreeListBox public: UnoTreeListBoxImpl( TreeControlPeer* pPeer, vcl::Window* pParent, WinBits nWinStyle ); virtual ~UnoTreeListBoxImpl(); + virtual void dispose() SAL_OVERRIDE; sal_uInt32 insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,sal_uLong nPos=TREELIST_APPEND ); @@ -206,7 +207,7 @@ UnoTreeListEntry* TreeControlPeer::getEntry( const Reference< XTreeNode >& xNode vcl::Window* TreeControlPeer::createVclControl( vcl::Window* pParent, sal_Int64 nWinStyle ) { - mpTreeImpl = new UnoTreeListBoxImpl( this, pParent, nWinStyle ); + mpTreeImpl = VclPtr<UnoTreeListBoxImpl>::Create( this, pParent, nWinStyle ); return mpTreeImpl; } @@ -222,7 +223,7 @@ void TreeControlPeer::disposeControl() -void TreeControlPeer::SetWindow( vcl::Window* pWindow ) +void TreeControlPeer::SetWindow( const VclPtr< vcl::Window > &pWindow ) { VCLXWindow::SetWindow( pWindow ); } @@ -1490,8 +1491,14 @@ UnoTreeListBoxImpl::UnoTreeListBoxImpl( TreeControlPeer* pPeer, vcl::Window* pPa UnoTreeListBoxImpl::~UnoTreeListBoxImpl() { + disposeOnce(); +} + +void UnoTreeListBoxImpl::dispose() +{ if( mxPeer.is() ) mxPeer->disposeControl(); + SvTreeListBox::dispose(); } diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx index 870a34fcbc7c..d1cb56441348 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; @@ -159,7 +159,7 @@ private: TreeExpansionListenerMultiplexer maTreeExpansionListeners; TreeEditListenerMultiplexer maTreeEditListeners; bool mbIsRootDisplayed; - UnoTreeListBoxImpl* mpTreeImpl; + VclPtr<UnoTreeListBoxImpl> mpTreeImpl; sal_Int32 mnEditLock; OUString msDefaultCollapsedGraphicURL; OUString msDefaultExpandedGraphicURL; diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 1bda41b744fc..32746ba9d765 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -68,7 +68,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const :: { if ( pParent ) { - pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB); + pWindow = VclPtr<MultiLineEdit>::Create( pParent, nWinBits|WB_IGNORETAB); static_cast< MultiLineEdit* >( pWindow )->DisableSelectionOnFocus(); *ppNewComp = new VCLXMultiLineEdit; } @@ -82,7 +82,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const :: { if ( pParent ) { - pWindow = new FileControl( pParent, nWinBits ); + pWindow = VclPtr<FileControl>::Create( pParent, nWinBits ); *ppNewComp = new VCLXFileControl; } else @@ -93,22 +93,22 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const :: } else if (aServiceName.equalsIgnoreAsciiCase("FormattedField") ) { - pWindow = new FormattedField( pParent, nWinBits ); + pWindow = VclPtr<FormattedField>::Create( pParent, nWinBits ); *ppNewComp = new SVTXFormattedField; } else if (aServiceName.equalsIgnoreAsciiCase("NumericField") ) { - pWindow = new DoubleNumericField( pParent, nWinBits ); + pWindow = VclPtr<DoubleNumericField>::Create( pParent, nWinBits ); *ppNewComp = new SVTXNumericField; } else if (aServiceName.equalsIgnoreAsciiCase("LongCurrencyField") ) { - pWindow = new DoubleCurrencyField( pParent, nWinBits ); + pWindow = VclPtr<DoubleCurrencyField>::Create( pParent, nWinBits ); *ppNewComp = new SVTXCurrencyField; } else if (aServiceName.equalsIgnoreAsciiCase("datefield") ) { - pWindow = new CalendarField( pParent, nWinBits); + pWindow = VclPtr<CalendarField>::Create( pParent, nWinBits); static_cast<CalendarField*>(pWindow)->EnableToday(); static_cast<CalendarField*>(pWindow)->EnableNone(); static_cast<CalendarField*>(pWindow)->EnableEmptyFieldValue( true ); @@ -125,7 +125,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const :: { if ( pParent ) { - pWindow = new ProgressBar( pParent, nWinBits ); + pWindow = VclPtr<ProgressBar>::Create( pParent, nWinBits ); *ppNewComp = new VCLXProgressBar; } else @@ -144,7 +144,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const :: { if ( pParent ) { - pWindow = new FixedHyperlink( pParent, nWinBits ); + pWindow = VclPtr<FixedHyperlink>::Create( pParent, nWinBits ); *ppNewComp = new VCLXFixedHyperlink; } else @@ -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() 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/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index b0998a583420..3980085246df 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -136,7 +136,7 @@ namespace { virtual ~Wizard(); protected: - virtual Dialog* createDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual void destroyDialog() SAL_OVERRIDE; private: @@ -268,12 +268,12 @@ namespace { } - Dialog* Wizard::createDialog( vcl::Window* i_pParent ) + VclPtr<Dialog> Wizard::createDialog( vcl::Window* i_pParent ) { - WizardShell* pDialog( new WizardShell( i_pParent, m_xController, m_aWizardSteps ) ); + VclPtrInstance<WizardShell> pDialog( i_pParent, m_xController, m_aWizardSteps ); pDialog->SetHelpId( lcl_getHelpId( m_sHelpURL ) ); pDialog->setTitleBase( m_sTitle ); - return pDialog; + return pDialog.get(); } @@ -359,7 +359,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" ); pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable ); @@ -371,7 +371,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" ); pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) ); @@ -383,7 +383,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" ); return pWizardImpl->travelNext(); @@ -395,7 +395,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" ); return pWizardImpl->travelPrevious(); @@ -407,7 +407,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" ); if ( !pWizardImpl->knowsPage( i_PageID ) ) @@ -425,7 +425,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" ); pWizardImpl->updateTravelUI(); @@ -437,7 +437,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" ); return pWizardImpl->advanceTo( i_PageId ); @@ -449,7 +449,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" ); return pWizardImpl->goBackTo( i_PageId ); @@ -461,7 +461,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() ); return pWizardImpl->getCurrentWizardPage(); @@ -476,7 +476,7 @@ namespace { if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) ) throw NoSuchElementException( OUString(), *this ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" ); pWizardImpl->activatePath( i_PathIndex, i_Final ); diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index d10db321ee60..b3504d9d5f55 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -90,11 +90,6 @@ namespace svt { namespace uno } - WizardShell::~WizardShell() - { - } - - short WizardShell::Execute() { ActivatePage(); @@ -187,17 +182,17 @@ namespace svt { namespace uno } - TabPage* WizardShell::createPage( WizardState i_nState ) + VclPtr<TabPage> WizardShell::createPage( WizardState i_nState ) { ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", NULL ); ::boost::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) ); - TabPage* pPage = pController->getTabPage(); - OSL_ENSURE( pPage != NULL, "WizardShell::createPage: illegal tab page!" ); - if ( pPage == NULL ) + VclPtr<TabPage> pPage = pController->getTabPage(); + OSL_ENSURE( pPage, "WizardShell::createPage: illegal tab page!" ); + if ( !pPage ) { // fallback for ill-behaved clients: empty page - pPage = new TabPage( this, 0 ); + pPage = VclPtr<TabPage>::Create( this, 0 ); pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MAP_APPFONT ) ); } @@ -205,7 +200,6 @@ namespace svt { namespace uno return pPage; } - IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const { return impl_getController( i_pCurrentPage ).get(); diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index 4d2e3e8f0315..68650dd067cf 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -48,13 +48,12 @@ namespace svt { namespace uno const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths ); - virtual ~WizardShell(); // Dialog overridables virtual short Execute() SAL_OVERRIDE; // OWizardMachine overridables - virtual TabPage* createPage( WizardState i_nState ) SAL_OVERRIDE; + virtual VclPtr<TabPage> createPage( WizardState i_nState ) SAL_OVERRIDE; virtual void enterState( WizardState i_nState ) SAL_OVERRIDE; virtual bool leaveState( WizardState i_nState ) SAL_OVERRIDE; virtual OUString getStateDisplayName( WizardState i_nState ) const SAL_OVERRIDE; @@ -118,7 +117,7 @@ namespace svt { namespace uno using WizardShell_Base::activatePath; private: - typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap; + typedef ::std::map< VclPtr<TabPage>, PWizardPageController > Page2ControllerMap; const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; const sal_Int16 m_nFirstPageID; |