basctl/source/basicide/basicrenderable.cxx | 2 - basctl/source/basicide/basicrenderable.hxx | 2 - forms/source/richtext/richtextcontrol.cxx | 12 ++++----- svx/source/fmcomp/fmgridif.cxx | 37 ++++++++++++++--------------- 4 files changed, 26 insertions(+), 27 deletions(-)
New commits: commit 1b020ddb312ef42752bdbf5f79e3de172f6120eb Author: Michael Meeks <[email protected]> Date: Mon Mar 16 17:46:20 2015 +0000 basctl, forms, svx: cleanup for new VclPtr API. Change-Id: I3bfd7933d2cddf707662d10e9366e0c82f33d276 diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx index 04b372d..42f20ce 100644 --- a/basctl/source/basicide/basicrenderable.cxx +++ b/basctl/source/basicide/basicrenderable.cxx @@ -84,7 +84,7 @@ VclPtr< Printer > Renderable::getPrinter() if( aValue >>= xRenderDevice ) { VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice); - VclPtr< OutputDevice > pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >; + VclPtr< OutputDevice > pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >(); pPrinter = dynamic_cast<Printer*>(pOut.get()); } return pPrinter; diff --git a/basctl/source/basicide/basicrenderable.hxx b/basctl/source/basicide/basicrenderable.hxx index db96dfc..dd60f16 100644 --- a/basctl/source/basicide/basicrenderable.hxx +++ b/basctl/source/basicide/basicrenderable.hxx @@ -36,7 +36,7 @@ class Renderable : VclPtr<BaseWindow> mpWindow; osl::Mutex maMutex; - Printer* getPrinter(); + VclPtr<Printer> getPrinter(); public: Renderable (BaseWindow*); virtual ~Renderable(); diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index 50a72a0..a8952d3 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -339,7 +339,7 @@ namespace frm { { SolarMutexGuard aGuard; - VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl* >(); + VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl >(); if ( pRichTextControl ) { @@ -365,7 +365,7 @@ namespace frm { SolarMutexGuard aGuard; - RichTextControl* pControl = static_cast< RichTextControl* >( GetWindow() ); + VclPtr< RichTextControl > pControl = GetAs< RichTextControl >(); if ( !pControl ) return; @@ -400,7 +400,7 @@ namespace frm if ( _rPropertyName == PROPERTY_BACKGROUNDCOLOR ) { - RichTextControl* pControl = static_cast< RichTextControl* >( GetWindow() ); + VclPtr< RichTextControl > pControl = GetAs< RichTextControl >(); if ( !_rValue.hasValue() ) { pControl->SetBackgroundColor( ); @@ -426,7 +426,7 @@ namespace frm } else if ( _rPropertyName == PROPERTY_READONLY ) { - RichTextControl* pControl = static_cast< RichTextControl* >( GetWindow() ); + VclPtr< RichTextControl > pControl = GetAs< RichTextControl >(); bool bReadOnly( pControl->IsReadOnly() ); OSL_VERIFY( _rValue >>= bReadOnly ); pControl->SetReadOnly( bReadOnly ); @@ -442,7 +442,7 @@ namespace frm } else if ( _rPropertyName == PROPERTY_HIDEINACTIVESELECTION ) { - VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl* >(); + VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl >(); bool bHide = pRichTextControl->GetHideInactiveSelection(); OSL_VERIFY( _rValue >>= bHide ); pRichTextControl->SetHideInactiveSelection( bHide ); @@ -494,7 +494,7 @@ namespace frm ORichTextPeer::SingleAttributeDispatcher ORichTextPeer::implCreateDispatcher( SfxSlotId _nSlotId, const ::com::sun::star::util::URL& _rURL ) { - VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl* >(); + VclPtr< RichTextControl > pRichTextControl = GetAs< RichTextControl >(); OSL_PRECOND( pRichTextControl, "ORichTextPeer::implCreateDispatcher: invalid window!" ); if ( !pRichTextControl ) return SingleAttributeDispatcher( NULL ); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 149b418..678aead 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1399,7 +1399,7 @@ void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt) throw( RuntimeE // this should not be (deadlock) critical, as by definition, every component should release // any own mutexes before notifying - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (!pGrid) return; @@ -1519,7 +1519,7 @@ void FmXGridPeer::removeUpdateListener(const Reference< XUpdateListener >& l) th sal_Bool FmXGridPeer::commit() throw( RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (!m_xCursor.is() || !pGrid) return sal_True; @@ -1542,7 +1542,7 @@ sal_Bool FmXGridPeer::commit() throw( RuntimeException, std::exception ) void FmXGridPeer::cursorMoved(const EventObject& _rEvent) throw( RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); // we are not interested in move to insert row only in the resetted event // which is fired after positioning an the insert row if (pGrid && pGrid->IsOpen() && !::comphelper::getBOOL(Reference< XPropertySet > (_rEvent.Source, UNO_QUERY)->getPropertyValue(FM_PROP_ISNEW))) @@ -1552,7 +1552,7 @@ void FmXGridPeer::cursorMoved(const EventObject& _rEvent) throw( RuntimeExceptio void FmXGridPeer::rowChanged(const EventObject& _rEvent) throw( RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (pGrid && pGrid->IsOpen()) { if (m_xCursor->rowUpdated() && !pGrid->IsCurrentAppending()) @@ -1655,7 +1655,7 @@ void FmXGridPeer::setColumns(const Reference< XIndexContainer >& Columns) throw( { SolarMutexGuard aGuard; - FmGridControl* pGrid = static_cast< FmGridControl* >( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (m_xColumns.is()) { @@ -1771,7 +1771,7 @@ void FmXGridPeer::elementReplaced(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()) @@ -1826,7 +1826,7 @@ void FmXGridPeer::elementRemoved(const ContainerEvent& evt) throw( RuntimeExcept { 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())) @@ -1843,7 +1843,7 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value) t { SolarMutexGuard aGuard; - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); bool bVoid = !Value.hasValue(); @@ -2256,14 +2256,14 @@ void SAL_CALL FmXGridPeer::removeGridControlListener( const Reference< XGridCont sal_Int16 FmXGridPeer::getCurrentColumnPosition() throw( RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); return pGrid ? pGrid->GetViewColumnPos(pGrid->GetCurColumnId()) : -1; } void FmXGridPeer::setCurrentColumnPosition(sal_Int16 nPos) throw( RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (pGrid) pGrid->GoToColumnId(pGrid->GetColumnIdFromViewPos(nPos)); } @@ -2273,7 +2273,7 @@ void FmXGridPeer::selectionChanged(const EventObject& evt) throw( RuntimeExcepti { SolarMutexGuard aGuard; - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (pGrid) { Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(evt.Source, UNO_QUERY); @@ -2341,7 +2341,7 @@ Reference< XEnumeration > FmXGridPeer::createEnumeration() throw( RuntimeExcept sal_Int32 FmXGridPeer::getCount() throw( RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (pGrid) return pGrid->GetViewColCount(); else @@ -2351,7 +2351,7 @@ sal_Int32 FmXGridPeer::getCount() throw( RuntimeException, std::exception ) Any FmXGridPeer::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception ) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (_nIndex < 0 || _nIndex >= getCount() || !pGrid) throw IndexOutOfBoundsException(); @@ -2430,7 +2430,7 @@ sal_Bool FmXGridPeer::supportsMode(const OUString& Mode) throw( RuntimeException void FmXGridPeer::columnVisible(DbGridColumn* pColumn) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); sal_Int32 _nIndex = pGrid->GetModelColumnPos(pColumn->GetId()); Reference< ::com::sun::star::awt::XControl > xControl(pColumn->GetCell()); @@ -2445,7 +2445,7 @@ void FmXGridPeer::columnVisible(DbGridColumn* pColumn) void FmXGridPeer::columnHidden(DbGridColumn* pColumn) { - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); sal_Int32 _nIndex = pGrid->GetModelColumnPos(pColumn->GetId()); Reference< ::com::sun::star::awt::XControl > xControl(pColumn->GetCell()); @@ -2600,7 +2600,7 @@ void FmXGridPeer::statusChanged(const ::com::sun::star::frame::FeatureStateEvent { DBG_ASSERT(m_pDispatchers[i] == Event.Source, "FmXGridPeer::statusChanged : the event source is a little bit suspect !"); m_pStateCache[i] = Event.IsEnabled; - FmGridControl* pGrid = static_cast<FmGridControl*>( GetWindow() ); + VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); if (*pSlots != SID_FM_RECORD_UNDO) pGrid->GetNavigationBar().InvalidateState(*pSlots); break; @@ -2622,8 +2622,7 @@ sal_Bool SAL_CALL FmXGridPeer::select( const Any& _rSelection ) throw (IllegalAr if ( !( _rSelection >>= aBookmarks ) ) throw IllegalArgumentException(); - FmGridControl* pVclControl = static_cast<FmGridControl*>(GetWindow()); - return pVclControl->selectBookmarks(aBookmarks); + return GetAs< FmGridControl >()->selectBookmarks(aBookmarks); // TODO: // speaking strictly, we would have to adjust our model, as our ColumnSelection may have changed. @@ -2636,7 +2635,7 @@ sal_Bool SAL_CALL FmXGridPeer::select( const Any& _rSelection ) throw (IllegalAr Any SAL_CALL FmXGridPeer::getSelection( ) throw (RuntimeException, std::exception) { - FmGridControl* pVclControl = static_cast<FmGridControl*>(GetWindow()); + VclPtr< FmGridControl > pVclControl = GetAs< FmGridControl >(); Sequence< Any > aSelectionBookmarks = pVclControl->getSelectionBookmarks(); return makeAny(aSelectionBookmarks); } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
