From ad73967e99235a2ba9b5a2106c5d6d0f8efaa1ca Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 22 Feb 2014 17:09:35 +0100 Subject: Remove unnecessary extractInterface Change-Id: I4848bf84615274ad5732223a354fb7a6b845d9a8 --- svx/source/fmcomp/fmgridcl.cxx | 46 +++++++++++++++++++------------------- svx/source/fmcomp/fmgridif.cxx | 20 +++++++---------- svx/source/fmcomp/gridcell.cxx | 5 ++--- svx/source/fmcomp/gridctrl.cxx | 5 ++--- svx/source/form/formcontroller.cxx | 5 ++--- 5 files changed, 37 insertions(+), 44 deletions(-) (limited to 'svx') diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 25f3511d58d8..fd5bac9ff86e 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -638,8 +637,8 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe sal_uInt16 nPos2 = GetModelColumnPos(nColId); Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast(GetParent())->GetPeer()->getColumns()); - Reference< ::com::sun::star::beans::XPropertySet> xColumn; - ::cppu::extractInterface(xColumn, xColumns->getByIndex(nPos2)); + Reference< ::com::sun::star::beans::XPropertySet> xColumn( + xColumns->getByIndex(nPos2), css::uno::UNO_QUERY); Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY); if (xSelSupplier.is()) xSelSupplier->select(makeAny(xColumn)); @@ -669,8 +668,8 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe if (pMenu && xCols.is() && nColId) { - Reference< ::com::sun::star::beans::XPropertySet > xSet; - ::cppu::extractInterface(xSet, xCols->getByIndex(nPos)); + Reference< ::com::sun::star::beans::XPropertySet > xSet( + xCols->getByIndex(nPos), css::uno::UNO_QUERY); sal_Int16 nClassId; xSet->getPropertyValue(FM_PROP_CLASSID) >>= nClassId; @@ -718,7 +717,7 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe Any aHidden,aName; for (sal_uInt16 i=0; igetCount(); ++i) { - ::cppu::extractInterface(xCurCol, xCols->getByIndex(i)); + xCurCol.set(xCols->getByIndex(i), css::uno::UNO_QUERY); DBG_ASSERT(xCurCol.is(), "FmGridHeader::PreExecuteColumnContextMenu : the Peer has invalid columns !"); aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN); DBG_ASSERT(aHidden.getValueType().getTypeClass() == TypeClass_BOOLEAN, @@ -789,8 +788,8 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe { case SID_FM_DELETECOL: { - Reference< XInterface > xCol; - ::cppu::extractInterface(xCol, xCols->getByIndex(nPos)); + Reference< XInterface > xCol( + xCols->getByIndex(nPos), css::uno::UNO_QUERY); xCols->removeByIndex(nPos); ::comphelper::disposeComponent(xCol); } break; @@ -850,8 +849,8 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe break; case SID_FM_HIDECOL: { - Reference< ::com::sun::star::beans::XPropertySet > xCurCol; - ::cppu::extractInterface(xCurCol, xCols->getByIndex(nPos)); + Reference< ::com::sun::star::beans::XPropertySet > xCurCol( + xCols->getByIndex(nPos), css::uno::UNO_QUERY); xCurCol->setPropertyValue(FM_PROP_HIDDEN, makeAny((sal_Bool)sal_True)); } break; @@ -875,7 +874,7 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe Reference< ::com::sun::star::beans::XPropertySet > xCurCol; for (sal_uInt16 i=0; igetCount(); ++i) { - ::cppu::extractInterface(xCurCol, xCols->getByIndex(i)); + xCurCol.set(xCols->getByIndex(i), css::uno::UNO_QUERY); xCurCol->setPropertyValue(FM_PROP_HIDDEN, makeAny((sal_Bool)sal_False)); } // TODO : there must be a more clever way to do this .... @@ -889,7 +888,7 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe Reference< ::com::sun::star::beans::XPropertySet > xCurCol; for (sal_uInt16 i=0; igetCount() && nExecutionResult; ++i) { - ::cppu::extractInterface(xCurCol, xCols->getByIndex(i)); + xCurCol.set(xCols->getByIndex(i), css::uno::UNO_QUERY); Any aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN); if (::comphelper::getBOOL(aHidden)) if (!--nExecutionResult) @@ -1089,11 +1088,11 @@ void FmGridControl::SetDesignMode(bool bMode) Any aSelection = xSelSupplier->getSelection(); Reference< ::com::sun::star::beans::XPropertySet > xColumn; if (aSelection.getValueType().getTypeClass() == TypeClass_INTERFACE) - ::cppu::extractInterface(xColumn, aSelection); + xColumn.set(aSelection, css::uno::UNO_QUERY); Reference< XInterface > xCurrent; for (sal_uInt16 i=0; igetCount(); ++i) { - ::cppu::extractInterface(xCurrent, xColumns->getByIndex(i)); + xCurrent.set(xColumns->getByIndex(i), css::uno::UNO_QUERY); if (xCurrent == xColumn) { markColumn(GetColumnIdFromModelPos(i)); @@ -1528,7 +1527,7 @@ void FmGridControl::ColumnMoved(sal_uInt16 nId) Reference< XInterface > xCurrent; for (i = 0; !xCol.is() && i < xColumns->getCount(); i++) { - ::cppu::extractInterface(xCurrent, xColumns->getByIndex(i)); + xCurrent.set(xColumns->getByIndex(i), css::uno::UNO_QUERY); if (xCurrent == pCol->getModel()) { xCol = pCol->getModel(); @@ -1570,8 +1569,8 @@ void FmGridControl::InitColumnsByModels(const Reference< ::com::sun::star::conta Any aWidth; for (i = 0; i < xColumns->getCount(); ++i) { - Reference< ::com::sun::star::beans::XPropertySet > xCol; - ::cppu::extractInterface(xCol, xColumns->getByIndex(i)); + Reference< ::com::sun::star::beans::XPropertySet > xCol( + xColumns->getByIndex(i), css::uno::UNO_QUERY); OUString aName( comphelper::getString(xCol->getPropertyValue(FM_PROP_LABEL))); @@ -1593,8 +1592,8 @@ void FmGridControl::InitColumnsByModels(const Reference< ::com::sun::star::conta Any aHidden; for (i = 0; i < xColumns->getCount(); ++i) { - Reference< ::com::sun::star::beans::XPropertySet > xCol; - ::cppu::extractInterface(xCol, xColumns->getByIndex(i)); + Reference< ::com::sun::star::beans::XPropertySet > xCol( + xColumns->getByIndex(i), css::uno::UNO_QUERY); aHidden = xCol->getPropertyValue(FM_PROP_HIDDEN); if (::comphelper::getBOOL(aHidden)) HideColumn(GetColumnIdFromModelPos((sal_uInt16)i)); @@ -1691,8 +1690,8 @@ void FmGridControl::InitColumnsByFields(const Reference< ::com::sun::star::conta OSL_ENSURE(pCol,"No grid column!"); if ( pCol ) { - Reference< XPropertySet > xColumnModel; - ::cppu::extractInterface( xColumnModel, xColumns->getByIndex( i ) ); + Reference< XPropertySet > xColumnModel( + xColumns->getByIndex( i ), css::uno::UNO_QUERY); InitColumnByField( pCol, xColumnModel, xFieldsAsNames, _rxFields ); } @@ -1985,8 +1984,9 @@ void FmGridControl::Select() { if (nSelectedColumn != SAL_MAX_UINT16) { - Reference< XPropertySet > xColumn; - ::cppu::extractInterface(xColumn,xColumns->getByIndex(nSelectedColumn)); + Reference< XPropertySet > xColumn( + xColumns->getByIndex(nSelectedColumn), + css::uno::UNO_QUERY); xSelSupplier->select(makeAny(xColumn)); } else diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 659739661a3d..f50c77f45b41 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -45,7 +45,6 @@ #include #include -#include #include #include #include @@ -1471,7 +1470,7 @@ void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt) throw( RuntimeE for ( i = 0; i < m_xColumns->getCount(); i++) { - ::cppu::extractInterface(xCurrent, m_xColumns->getByIndex(i)); + xCurrent.set(m_xColumns->getByIndex(i), css::uno::UNO_QUERY); if (evt.Source == xCurrent) break; } @@ -1718,7 +1717,7 @@ void FmXGridPeer::setColumns(const Reference< XIndexContainer >& Columns) throw( Reference< XPropertySet > xCol; for (sal_Int32 i = 0; i < m_xColumns->getCount(); i++) { - ::cppu::extractInterface(xCol, m_xColumns->getByIndex(i)); + xCol.set(m_xColumns->getByIndex(i), css::uno::UNO_QUERY); removeColumnListeners(xCol); } Reference< XContainer > xContainer(m_xColumns, UNO_QUERY); @@ -1742,7 +1741,7 @@ void FmXGridPeer::setColumns(const Reference< XIndexContainer >& Columns) throw( Reference< XPropertySet > xCol; for (sal_Int32 i = 0; i < Columns->getCount(); i++) { - ::cppu::extractInterface(xCol, Columns->getByIndex(i)); + xCol.set(Columns->getByIndex(i), css::uno::UNO_QUERY); addColumnListeners(xCol); } @@ -1799,8 +1798,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) throw( RuntimeExcep if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount())) return; - Reference< XPropertySet > xSet; - ::cppu::extractInterface(xSet, evt.Element); + Reference< XPropertySet > xSet(evt.Element, css::uno::UNO_QUERY); addColumnListeners(xSet); Reference< XPropertySet > xNewColumn(xSet); @@ -1834,10 +1832,9 @@ void FmXGridPeer::elementReplaced(const ContainerEvent& evt) throw( RuntimeExcep if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove()) return; - Reference< XPropertySet > xNewColumn; - Reference< XPropertySet > xOldColumn; - ::cppu::extractInterface(xNewColumn, evt.Element); - ::cppu::extractInterface(xOldColumn, evt.ReplacedElement); + Reference< XPropertySet > xNewColumn(evt.Element, css::uno::UNO_QUERY); + Reference< XPropertySet > xOldColumn( + evt.ReplacedElement, css::uno::UNO_QUERY); sal_Bool bWasEditing = pGrid->IsEditing(); if (bWasEditing) @@ -1892,8 +1889,7 @@ void FmXGridPeer::elementRemoved(const ContainerEvent& evt) throw( RuntimeExcept pGrid->RemoveColumn(pGrid->GetColumnIdFromModelPos((sal_uInt16)::comphelper::getINT32(evt.Accessor))); - Reference< XPropertySet > xOldColumn; - ::cppu::extractInterface(xOldColumn, evt.Element); + Reference< XPropertySet > xOldColumn(evt.Element, css::uno::UNO_QUERY); removeColumnListeners(xOldColumn); } diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index ad402ddc863d..aca59abe9bc6 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -45,7 +45,6 @@ #include #include -#include #include #include #include @@ -1324,7 +1323,7 @@ void DbFormattedField::Init( Window& rParent, const Reference< XRowSet >& xCurso Any aSupplier( xUnoModel->getPropertyValue(FM_PROP_FORMATSSUPPLIER)); if (aSupplier.hasValue()) { - ::cppu::extractInterface(m_xSupplier, aSupplier); + m_xSupplier.set(aSupplier, css::uno::UNO_QUERY); if (m_xSupplier.is()) { // wenn wir den Supplier vom Model nehmen, dann auch den Key @@ -3138,7 +3137,7 @@ void DbFilterField::Update() Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(xListCursor, UNO_QUERY); Reference< ::com::sun::star::container::XIndexAccess > xFields(xSupplyCols->getColumns(), UNO_QUERY); - ::cppu::extractInterface(xDataField, xFields->getByIndex(0)); + xDataField.set(xFields->getByIndex(0), css::uno::UNO_QUERY); if (!xDataField.is()) return; } diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 761426ecba81..b503013335f0 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -771,8 +770,8 @@ DbGridRow::DbGridRow(CursorWrapper* pCur, sal_Bool bPaintCursor) DataColumn* pColumn; for (sal_Int32 i = 0; i < xColumns->getCount(); ++i) { - Reference< XPropertySet > xColSet; - ::cppu::extractInterface(xColSet, xColumns->getByIndex(i)); + Reference< XPropertySet > xColSet( + xColumns->getByIndex(i), css::uno::UNO_QUERY); pColumn = new DataColumn(xColSet); m_aVariants.push_back( pColumn ); } diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index 97d3dd8c2c58..325765178b81 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -65,7 +65,6 @@ #include #include -#include #include #include #include @@ -3967,8 +3966,8 @@ sal_Bool SAL_CALL FormController::approveParameter(const DatabaseParameterEvent& const PropertyValue* pFinalValues = aFinalValues.getConstArray(); for (sal_Int32 i=0; i xParam; - ::cppu::extractInterface(xParam, aRequest.Parameters->getByIndex(i)); + Reference< XPropertySet > xParam( + aRequest.Parameters->getByIndex(i), css::uno::UNO_QUERY); if (xParam.is()) { #ifdef DBG_UTIL -- cgit