diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-03-16 17:28:03 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 11:32:31 +0100 |
commit | 65741289ea32fe642af179b732398c1c3e41911e (patch) | |
tree | 528600a1c8518c0de4ca59e649866f3edfce9c2f | |
parent | a13007adddadf7f5c7b503d6732cf11f3e62e619 (diff) |
cleanup Printer VclRef pieces.
Change-Id: Ib47b2ec3cb54e374675981ad929856f43987418f
-rw-r--r-- | basctl/source/basicide/basicrenderable.cxx | 8 | ||||
-rw-r--r-- | chart2/source/controller/main/ShapeToolbarController.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/brwview.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/genericcontroller.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/control/toolboxcontroller.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/ColumnPeer.cxx | 11 | ||||
-rw-r--r-- | extensions/source/propctrlr/browserline.cxx | 2 | ||||
-rw-r--r-- | extensions/source/propctrlr/propcontroller.cxx | 2 | ||||
-rw-r--r-- | forms/source/richtext/richtextcontrol.cxx | 6 | ||||
-rw-r--r-- | forms/source/solar/component/navbarcontrol.cxx | 8 | ||||
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 2 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridif.cxx | 20 |
13 files changed, 36 insertions, 39 deletions
diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx index ee5ed4bef958..8a36a560a770 100644 --- a/basctl/source/basicide/basicrenderable.cxx +++ b/basctl/source/basicide/basicrenderable.cxx @@ -77,17 +77,17 @@ Renderable::~Renderable() { } -Printer* Renderable::getPrinter() +VclPtr< Printer > Renderable::getPrinter() { - Printer* pPrinter = NULL; + VclPtr< Printer > pPrinter; Any aValue( getValue( "RenderDevice" ) ); Reference<awt::XDevice> xRenderDevice; if( aValue >>= xRenderDevice ) { VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice); - OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; - pPrinter = dynamic_cast<Printer*>(pOut); + VclPtr< OutputDevice > pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >; + pPrinter = dynamic_cast<Printer*>(pOut.get()); } return pPrinter; } diff --git a/chart2/source/controller/main/ShapeToolbarController.cxx b/chart2/source/controller/main/ShapeToolbarController.cxx index 46c7cda65740..999c9bacdd5c 100644 --- a/chart2/source/controller/main/ShapeToolbarController.cxx +++ b/chart2/source/controller/main/ShapeToolbarController.cxx @@ -105,7 +105,7 @@ void ShapeToolbarController::initialize( const Sequence< uno::Any >& rArguments SolarMutexGuard aSolarMutexGuard; ::osl::MutexGuard aGuard( m_aMutex ); - ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); + VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); if ( pToolBox ) { const sal_uInt16 nCount = pToolBox->GetItemCount(); diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx index 07db06618208..59585c50c0f4 100644 --- a/dbaccess/source/ui/browser/brwview.cxx +++ b/dbaccess/source/ui/browser/brwview.cxx @@ -264,7 +264,7 @@ SbaGridControl* UnoDataBrowserView::getVclControl() const UnoDataBrowserView* pTHIS = const_cast<UnoDataBrowserView*>(this); if ( pPeer ) { - m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow()); + m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow().get()); pTHIS->startComponentListening(Reference<XComponent>(VCLUnoHelper::GetInterface(m_pVclControl),UNO_QUERY)); } } diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 7b129ee4f313..64522f299b4a 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -291,7 +291,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen xParent = xFrame->getContainerWindow(); VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(xParent); - vcl::Window* pParentWin = pParentComponent ? pParentComponent->GetWindow() : NULL; + VclPtr< vcl::Window > pParentWin = pParentComponent ? pParentComponent->GetWindow() : VclPtr< vcl::Window >(); if (!pParentWin) { throw IllegalArgumentException("Parent window is null", *this, 1 ); diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 9b9d8c8d86ac..030d38e3947b 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -309,7 +309,7 @@ void SAL_CALL SbaXGridPeer::dispose(void) throw( RuntimeException, std::exceptio void SbaXGridPeer::NotifyStatusChanged(const ::com::sun::star::util::URL& _rUrl, const Reference< ::com::sun::star::frame::XStatusListener > & xControl) { - SbaGridControl* pGrid = static_cast<SbaGridControl*>(GetWindow()); + VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >(); if (!pGrid) return; @@ -361,7 +361,7 @@ Reference< ::com::sun::star::frame::XDispatch > SAL_CALL SbaXGridPeer::queryDis IMPL_LINK( SbaXGridPeer, OnDispatchEvent, void*, /*NOTINTERESTEDIN*/ ) { - SbaGridControl* pGrid = static_cast< SbaGridControl* >( GetWindow() ); + VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >(); if ( pGrid ) // if this fails, we were disposing before arriving here { if ( Application::GetMainThreadIdentifier() != ::osl::Thread::getCurrentIdentifier() ) @@ -398,7 +398,7 @@ SbaXGridPeer::DispatchType SbaXGridPeer::classifyDispatchURL( const URL& _rURL ) void SAL_CALL SbaXGridPeer::dispatch(const URL& aURL, const Sequence< PropertyValue >& aArgs) throw( RuntimeException, std::exception ) { - SbaGridControl* pGrid = static_cast<SbaGridControl*>(GetWindow()); + VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >(); if (!pGrid) return; diff --git a/dbaccess/source/ui/control/toolboxcontroller.cxx b/dbaccess/source/ui/control/toolboxcontroller.cxx index ca97d796c024..079e4a5f61e8 100644 --- a/dbaccess/source/ui/control/toolboxcontroller.cxx +++ b/dbaccess/source/ui/control/toolboxcontroller.cxx @@ -169,7 +169,7 @@ namespace dbaui { m_aCommandURL = aFind->first; - ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent())); + VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get()); lcl_copy(pMenu.get(),nItemId,i,pToolBox,m_nToolBoxId, m_aCommandURL); break; } @@ -228,7 +228,7 @@ namespace dbaui SolarMutexGuard aSolarMutexGuard; ::osl::MutexGuard aGuard(m_aMutex); - ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent())); + VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get()); ::std::unique_ptr<PopupMenu> pMenu = getMenu(); sal_uInt16 nSelected = pMenu->Execute(pToolBox, pToolBox->GetItemRect( m_nToolBoxId ),POPUPMENU_EXECUTE_DOWN); diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx index 1422c629b3a1..723f10377a10 100644 --- a/dbaccess/source/ui/uno/ColumnPeer.cxx +++ b/dbaccess/source/ui/uno/ColumnPeer.cxx @@ -46,19 +46,16 @@ OColumnPeer::OColumnPeer(vcl::Window* _pParent,const Reference<XComponentContext void OColumnPeer::setEditWidth(sal_Int32 _nWidth) { SolarMutexGuard aGuard; - - OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() ); + VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>(); if ( pFieldControl ) - { pFieldControl->setEditWidth(_nWidth); - } } void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn) { SolarMutexGuard aGuard; - OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() ); + VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>(); if ( pFieldControl ) { if ( m_pActFieldDescr ) @@ -105,7 +102,7 @@ void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn) void OColumnPeer::setConnection(const Reference< XConnection>& _xCon) { SolarMutexGuard aGuard; - OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() ); + VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>(); if ( pFieldControl ) pFieldControl->setConnection(_xCon); } @@ -131,7 +128,7 @@ void OColumnPeer::setProperty( const OUString& _rPropertyName, const Any& Value) Any OColumnPeer::getProperty( const OUString& _rPropertyName ) throw( RuntimeException, std::exception ) { Any aProp; - OFieldDescControl* pFieldControl = static_cast<OFieldDescControl*>( GetWindow() ); + VclPtr< OFieldDescControl > pFieldControl = GetAs< OFieldDescControl >(); if (pFieldControl && _rPropertyName == PROPERTY_COLUMN) { aProp <<= m_xColumn; diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index ccc5b54a9642..9a8490511569 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -109,7 +109,7 @@ namespace pcr void OBrowserLine::setControl( const Reference< XPropertyControl >& _rxControl ) { m_xControl = _rxControl; - m_pControlWindow = m_xControl.is() ? VCLUnoHelper::GetWindow( _rxControl->getControlWindow() ) : NULL; + m_pControlWindow = m_xControl.is() ? VCLUnoHelper::GetWindow( _rxControl->getControlWindow() ) : VclPtr<vcl::Window>(); DBG_ASSERT( m_pControlWindow, "OBrowserLine::setControl: setting NULL controls/windows is not allowed!" ); if ( m_pControlWindow ) diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 95786ad18e65..66cea9ec4684 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -375,7 +375,7 @@ namespace pcr // announcement is responsible for calling setComponent, too. Reference< XWindow > xContainerWindow = m_xFrame->getContainerWindow(); VCLXWindow* pContainerWindow = VCLXWindow::GetImplementation(xContainerWindow); - vcl::Window* pParentWin = pContainerWindow ? pContainerWindow->GetWindow() : NULL; + VclPtr<vcl::Window> pParentWin = pContainerWindow ? pContainerWindow->GetWindow() : VclPtr<vcl::Window>(); if (!pParentWin) throw RuntimeException("The frame is invalid. Unable to extract the container window.",*this); diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index 39a29a2b9651..7377389189e0 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -314,7 +314,7 @@ namespace frm { { SolarMutexGuard aGuard; - RichTextControl* pRichTextControl = static_cast< RichTextControl* >( GetWindow() ); + VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl* >(); if ( pRichTextControl ) { @@ -417,7 +417,7 @@ namespace frm } else if ( _rPropertyName == PROPERTY_HIDEINACTIVESELECTION ) { - RichTextControl* pRichTextControl = static_cast< RichTextControl* >( GetWindow() ); + VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl* >(); bool bHide = pRichTextControl->GetHideInactiveSelection(); OSL_VERIFY( _rValue >>= bHide ); pRichTextControl->SetHideInactiveSelection( bHide ); @@ -469,7 +469,7 @@ namespace frm ORichTextPeer::SingleAttributeDispatcher ORichTextPeer::implCreateDispatcher( SfxSlotId _nSlotId, const ::com::sun::star::util::URL& _rURL ) { - RichTextControl* pRichTextControl = static_cast< RichTextControl* >( GetWindow() ); + VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl* >(); OSL_PRECOND( pRichTextControl, "ORichTextPeer::implCreateDispatcher: invalid window!" ); if ( !pRichTextControl ) return SingleAttributeDispatcher( NULL ); diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx index 3f2afea11653..695aadcd3bb2 100644 --- a/forms/source/solar/component/navbarcontrol.cxx +++ b/forms/source/solar/component/navbarcontrol.cxx @@ -275,7 +275,7 @@ namespace frm { SolarMutexGuard aGuard; - NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() ); + VclPtr< NavigationToolBar > pNavBar = GetAs< NavigationToolBar >(); if ( !pNavBar ) { VCLXWindow::setProperty( _rPropertyName, _rValue ); @@ -356,7 +356,7 @@ namespace frm SolarMutexGuard aGuard; Any aReturn; - NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() ); + VclPtr< NavigationToolBar > pNavBar = GetAs< NavigationToolBar >(); if ( _rPropertyName == PROPERTY_BACKGROUNDCOLOR ) { @@ -408,7 +408,7 @@ namespace frm void ONavigationBarPeer::featureStateChanged( sal_Int16 _nFeatureId, bool _bEnabled ) { // enable this button on the toolbox - NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() ); + VclPtr< NavigationToolBar > pNavBar = GetAs< NavigationToolBar >(); if ( pNavBar ) { pNavBar->enableFeature( _nFeatureId, _bEnabled ); @@ -436,7 +436,7 @@ namespace frm void ONavigationBarPeer::allFeatureStatesChanged( ) { // force the control to update it's states - NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() ); + VclPtr< NavigationToolBar > pNavBar = GetAs< NavigationToolBar >(); if ( pNavBar ) pNavBar->setDispatcher( this ); diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 7e2c7092fcb7..9c5c98f6d535 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -2307,7 +2307,7 @@ static vcl::Window* lcl_GetSearchLabelWindow() return 0; css::uno::Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW); - ToolBox* pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) ); + VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow).get() ); for (size_t i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) if (pToolBox->GetItemCommand(i) == ".uno:SearchLabel") return pToolBox->GetItemWindow(i); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index f7a258d5b42f..87965d90ae0a 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1251,7 +1251,7 @@ Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType Reference< XIndexContainer > xColumns = getColumns(); - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); sal_Int32 nColumns = pGrid->GetViewColCount(); DbGridColumns aColumns = pGrid->GetColumns(); @@ -1305,7 +1305,7 @@ Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type& xType ) throw(RuntimeException, std::exception) { - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); DBG_ASSERT(pGrid && pGrid->IsOpen(), "FmXGridPeer::queryFieldData : have no valid grid window !"); if (!pGrid || !pGrid->IsOpen()) return Sequence< Any>(); @@ -1737,7 +1737,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) throw( RuntimeExcep { SolarMutexGuard aGuard; - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); // Handle Column beruecksichtigen if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount())) return; @@ -2056,7 +2056,7 @@ Any FmXGridPeer::getProperty( const OUString& _rPropertyName ) throw( RuntimeExc Any aProp; if (GetWindow()) { - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); vcl::Window* pDataWindow = &pGrid->GetDataWindow(); if ( _rPropertyName == FM_PROP_NAME ) @@ -2192,7 +2192,7 @@ void FmXGridPeer::stopCursorListening() void FmXGridPeer::updateGrid(const Reference< XRowSet >& _rxCursor) { - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (pGrid) pGrid->setDataSource(_rxCursor); } @@ -2206,7 +2206,7 @@ Reference< XRowSet > FmXGridPeer::getRowSet() throw( RuntimeException, std::exc void FmXGridPeer::setRowSet(const Reference< XRowSet >& _rDatabaseCursor) throw( RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (!pGrid || !m_xColumns.is() || !m_xColumns->getCount()) return; // unregister all listeners @@ -2383,7 +2383,7 @@ void FmXGridPeer::setMode(const OUString& Mode) throw( NoSupportException, Runti m_aMode = Mode; - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if ( Mode == "FilterMode" ) pGrid->SetFilterMode(true); else @@ -2459,7 +2459,7 @@ void FmXGridPeer::columnHidden(DbGridColumn* pColumn) void FmXGridPeer::draw( sal_Int32 x, sal_Int32 y ) throw( RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); sal_Int32 nOldFlags = pGrid->GetBrowserFlags(); pGrid->SetBrowserFlags(nOldFlags | EBBF_NOROWPICTURE); @@ -2657,7 +2657,7 @@ void FmXGridPeer::resetted(const EventObject& rEvent) throw( RuntimeException, s { if (m_xColumns == rEvent.Source) { // my model was reset -> refresh the grid content - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (!pGrid) return; SolarMutexGuard aGuard; @@ -2667,7 +2667,7 @@ void FmXGridPeer::resetted(const EventObject& rEvent) throw( RuntimeException, s else if (m_xCursor == rEvent.Source) { SolarMutexGuard aGuard; - FmGridControl* pGrid = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (pGrid && pGrid->IsOpen()) pGrid->positioned(rEvent); } |