summaryrefslogtreecommitdiff
path: root/forms/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 15:32:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 18:29:34 +0200
commit6595240f39c34fa9ae5cd1bb319f6287206e4b92 (patch)
tree64f7bde04c093e1cf8ee2f20081a60826881fe7f /forms/source
parentc3741a89a99fcd58824d5137054b96b01bc32a11 (diff)
loplugin:referencecasting in forms..fpicker
Change-Id: I0aa040b6d3264d2efde5797f79994d3d65ceaddf Reviewed-on: https://gerrit.libreoffice.org/75957 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms/source')
-rw-r--r--forms/source/component/ComboBox.cxx9
-rw-r--r--forms/source/component/FormComponent.cxx4
-rw-r--r--forms/source/component/RadioButton.cxx6
-rw-r--r--forms/source/helper/commandimageprovider.cxx2
-rw-r--r--forms/source/helper/controlfeatureinterception.cxx5
-rw-r--r--forms/source/runtime/formoperations.cxx28
-rw-r--r--forms/source/xforms/binding.cxx8
-rw-r--r--forms/source/xforms/model.cxx2
-rw-r--r--forms/source/xforms/model_ui.cxx8
-rw-r--r--forms/source/xforms/submission.cxx2
-rw-r--r--forms/source/xforms/submission/serialization_app_xml.cxx2
-rw-r--r--forms/source/xforms/submission/serialization_urlencoded.cxx2
12 files changed, 32 insertions, 46 deletions
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
index 06f5f4234c0d..03d46288a6bf 100644
--- a/forms/source/component/ComboBox.cxx
+++ b/forms/source/component/ComboBox.cxx
@@ -474,10 +474,9 @@ void OComboBoxModel::loadData( bool _bForce )
return;
// Get Connection
- Reference<XRowSet> xForm(m_xCursor, UNO_QUERY);
- if (!xForm.is())
+ if (!m_xCursor.is())
return;
- Reference<XConnection> xConnection = getConnection(xForm);
+ Reference<XConnection> xConnection = getConnection(m_xCursor);
if (!xConnection.is())
return;
@@ -518,7 +517,7 @@ void OComboBoxModel::loadData( bool _bForce )
else
{
// otherwise look for the alias
- Reference<XPropertySet> xFormProp(xForm,UNO_QUERY);
+ Reference<XPropertySet> xFormProp(m_xCursor,UNO_QUERY);
Reference< XColumnsSupplier > xSupplyFields;
xFormProp->getPropertyValue("SingleSelectQueryComposer") >>= xSupplyFields;
@@ -627,7 +626,7 @@ void OComboBoxModel::loadData( bool _bForce )
if ( !xDataField.is() )
return;
- ::dbtools::FormattedColumnValue aValueFormatter( getContext(), xForm, xDataField );
+ ::dbtools::FormattedColumnValue aValueFormatter( getContext(), m_xCursor, xDataField );
// Fill Lists
sal_Int16 i = 0;
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 6d46f3a9825e..eb4cbf3f9598 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -259,7 +259,7 @@ void OControl::impl_resetStateGuard_nothrow()
try
{
xWindow.set( getPeer(), UNO_QUERY );
- xModel.set( getModel(), UNO_QUERY );
+ xModel = getModel();
}
catch( const Exception& )
{
@@ -1920,7 +1920,7 @@ void OBoundControlModel::connectToField(const Reference<XRowSet>& rForm)
DBG_ASSERT(xColumnsSupplier.is(), "OBoundControlModel::connectToField : the row set should support the css::sdb::ResultSet service !");
if (xColumnsSupplier.is())
{
- Reference<XNameAccess> xColumns(xColumnsSupplier->getColumns(), UNO_QUERY);
+ Reference<XNameAccess> xColumns = xColumnsSupplier->getColumns();
if (xColumns.is() && xColumns->hasByName(m_aControlSource))
{
OSL_VERIFY( xColumns->getByName(m_aControlSource) >>= xFieldCandidate );
diff --git a/forms/source/component/RadioButton.cxx b/forms/source/component/RadioButton.cxx
index 0fac875bb2a1..5505ee92ea85 100644
--- a/forms/source/component/RadioButton.cxx
+++ b/forms/source/component/RadioButton.cxx
@@ -126,8 +126,7 @@ void ORadioButtonModel::SetSiblingPropsTo(const OUString& rPropName, const Any&
Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY);
if (xIndexAccess.is())
{
- Reference<XPropertySet> xMyProps(
- static_cast<XWeak*>(this), css::uno::UNO_QUERY);
+ Reference<XPropertySet> xMyProps = this;
OUString sCurrentGroup;
sal_Int32 nNumSiblings = xIndexAccess->getCount();
for (sal_Int32 i=0; i<nNumSiblings; ++i)
@@ -203,8 +202,7 @@ void ORadioButtonModel::setControlSource()
getPropertyValue(PROPERTY_GROUP_NAME) >>= sGroupName;
getPropertyValue(PROPERTY_NAME) >>= sName;
- Reference<XPropertySet> xMyProps(
- static_cast<XWeak*>(this), css::uno::UNO_QUERY);
+ Reference<XPropertySet> xMyProps = this;
for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
{
Reference<XPropertySet> xSiblingProperties(xIndexAccess->getByIndex(i), UNO_QUERY);
diff --git a/forms/source/helper/commandimageprovider.cxx b/forms/source/helper/commandimageprovider.cxx
index 570d58abe94d..a40783149416 100644
--- a/forms/source/helper/commandimageprovider.cxx
+++ b/forms/source/helper/commandimageprovider.cxx
@@ -82,7 +82,7 @@ namespace frm
try
{
Reference< XUIConfigurationManagerSupplier > xSuppUIConfig( _rxDocument, UNO_QUERY_THROW );
- Reference< XUIConfigurationManager > xUIConfig( xSuppUIConfig->getUIConfigurationManager(), UNO_QUERY );
+ Reference< XUIConfigurationManager > xUIConfig = xSuppUIConfig->getUIConfigurationManager();
m_xDocumentImageManager.set( xUIConfig->getImageManager(), UNO_QUERY_THROW );
}
catch( const Exception& )
diff --git a/forms/source/helper/controlfeatureinterception.cxx b/forms/source/helper/controlfeatureinterception.cxx
index 5e79a5c65995..16fa4154935d 100644
--- a/forms/source/helper/controlfeatureinterception.cxx
+++ b/forms/source/helper/controlfeatureinterception.cxx
@@ -48,9 +48,8 @@ namespace frm
if ( m_xFirstDispatchInterceptor.is() )
{
// there is already an interceptor; the new one will become its master
- Reference< XDispatchProvider > xFirstProvider( m_xFirstDispatchInterceptor, UNO_QUERY );
- _rxInterceptor->setSlaveDispatchProvider( xFirstProvider );
- m_xFirstDispatchInterceptor->setMasterDispatchProvider( xFirstProvider );
+ _rxInterceptor->setSlaveDispatchProvider( m_xFirstDispatchInterceptor );
+ m_xFirstDispatchInterceptor->setMasterDispatchProvider( m_xFirstDispatchInterceptor );
}
// we are the master of the chain's first interceptor
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index adb5cf877f79..eb4133ee5493 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -259,8 +259,7 @@ namespace frm
case FormFeature::ReloadForm:
{
// there must be an active connection
- Reference< XRowSet > xCursorRowSet( m_xCursor, UNO_QUERY );
- aState.Enabled = ::dbtools::getConnection( xCursorRowSet ).is();
+ aState.Enabled = ::dbtools::getConnection( m_xCursor ).is();
// and an active command
OUString sActiveCommand;
@@ -480,14 +479,12 @@ namespace frm
{
bool shouldCommit(true);
assert(xCntrl.is());
- Reference< XIndexAccess > xSubForms(xCntrl, UNO_QUERY);
- assert(xSubForms.is());
- if(xSubForms.is())
+ if(xCntrl.is())
{
- const sal_Int32 cnt = xSubForms->getCount();
+ const sal_Int32 cnt = xCntrl->getCount();
for(int i=0; i < cnt; ++i)
{
- Reference< XFormController > xSubForm(xSubForms->getByIndex(i), UNO_QUERY);
+ Reference< XFormController > xSubForm(xCntrl->getByIndex(i), UNO_QUERY);
assert(xSubForm.is());
if (xSubForm.is())
{
@@ -1091,9 +1088,8 @@ namespace frm
m_xCursorProperties->removePropertyChangeListener( PROPERTY_ISNEW, this );
}
- Reference< XModifyBroadcaster > xBroadcaster( m_xController, UNO_QUERY );
- if ( xBroadcaster.is() )
- xBroadcaster->removeModifyListener( this );
+ if ( m_xController.is() )
+ m_xController->removeModifyListener( this );
}
catch( const Exception& )
{
@@ -1127,9 +1123,8 @@ namespace frm
impl_initFromForm_throw();
- Reference< XModifyBroadcaster > xBroadcaster( m_xController, UNO_QUERY );
- if ( xBroadcaster.is() )
- xBroadcaster->addModifyListener( this );
+ if ( m_xController.is() )
+ m_xController->addModifyListener( this );
}
@@ -1691,13 +1686,12 @@ namespace frm
css::uno::Reference<css::awt::XWindow> xDialogParent;
//tdf#122152 extract parent for dialog
- css::uno::Reference<css::awt::XTabController> xTabController(m_xController, css::uno::UNO_QUERY);
- if (xTabController.is())
+ if (m_xController.is())
{
- css::uno::Reference<css::awt::XControl> xContainerControl(xTabController->getContainer(), css::uno::UNO_QUERY);
+ css::uno::Reference<css::awt::XControl> xContainerControl(m_xController->getContainer(), css::uno::UNO_QUERY);
if (xContainerControl.is())
{
- css::uno::Reference<css::awt::XWindowPeer> xContainerPeer(xContainerControl->getPeer(), css::uno::UNO_QUERY);
+ css::uno::Reference<css::awt::XWindowPeer> xContainerPeer = xContainerControl->getPeer();
xDialogParent = css::uno::Reference<css::awt::XWindow>(xContainerPeer, css::uno::UNO_QUERY);
}
}
diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx
index b36d2bf074df..d2c1be56aa7b 100644
--- a/forms/source/xforms/binding.cxx
+++ b/forms/source/xforms/binding.cxx
@@ -543,10 +543,8 @@ void Binding::bind( bool bForceRebind )
aContext.mxNamespaces ) )
{
aContext.mxContextNode->appendChild(
- Reference<XNode>(
aContext.mxContextNode->getOwnerDocument()->createElement(
- maBindingExpression.getExpression() ),
- UNO_QUERY ) );
+ maBindingExpression.getExpression() ) );
maBindingExpression.evaluate( aContext );
OSL_ENSURE( maBindingExpression.getNode().is(),
"we should bind to the newly inserted node!" );
@@ -751,8 +749,8 @@ css::uno::Reference<css::xsd::XDataType> Binding::getDataType()
OSL_ENSURE( getModel().is(), "need model" );
OSL_ENSURE( getModel()->getDataTypeRepository().is(), "need types" );
- Reference<XDataTypeRepository> xRepository(
- getModel()->getDataTypeRepository(), UNO_QUERY );
+ Reference<XDataTypeRepository> xRepository =
+ getModel()->getDataTypeRepository();
OUString sTypeName = maMIP.getTypeName();
return ( xRepository.is() && xRepository->hasByName( sTypeName ) )
diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx
index 2bddfea5db30..0b5b4cbd245f 100644
--- a/forms/source/xforms/model.cxx
+++ b/forms/source/xforms/model.cxx
@@ -113,7 +113,7 @@ EvaluationContext Model::getEvaluationContext()
// the default context is the top-level element node. A default
// node (instanceData' is inserted when there is no default node
Reference<XDocument> xInstance = getDefaultInstance();
- Reference<XNode> xElement( xInstance->getDocumentElement(), UNO_QUERY );
+ Reference<XNode> xElement = xInstance->getDocumentElement();
// no element found? Then insert default element 'instanceData'
if( ! xElement.is() )
diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx
index e37dfa3d490b..b2ffffa2ec0c 100644
--- a/forms/source/xforms/model_ui.cxx
+++ b/forms/source/xforms/model_ui.cxx
@@ -550,8 +550,7 @@ css::uno::Reference<css::xml::dom::XNode> Model::createElement( const css::uno::
&& isValidXMLName( sName ) )
{
// TODO: implement proper namespace handling
- xNode.set( xParent->getOwnerDocument()->createElement( sName ),
- UNO_QUERY );
+ xNode = xParent->getOwnerDocument()->createElement( sName );
}
return xNode;
}
@@ -575,8 +574,7 @@ css::uno::Reference<css::xml::dom::XNode> Model::createAttribute( const css::uno
}
// TODO: implement proper namespace handling
- xNode.set( xParent->getOwnerDocument()->createAttribute( sUniqueName ),
- UNO_QUERY );
+ xNode = xParent->getOwnerDocument()->createAttribute( sUniqueName );
}
return xNode;
}
@@ -603,7 +601,7 @@ css::uno::Reference<css::xml::dom::XNode> Model::renameNode( const css::uno::Ref
if( xNode->getNodeType() == NodeType_ELEMENT_NODE )
{
Reference<XElement> xElem = xDoc->createElement( sName );
- xNew.set( xElem, UNO_QUERY );
+ xNew = xElem;
// iterate over all attributes and append them to the new element
Reference<XElement> xOldElem( xNode, UNO_QUERY );
diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx
index c4d786877674..f20b72f11973 100644
--- a/forms/source/xforms/submission.cxx
+++ b/forms/source/xforms/submission.cxx
@@ -558,7 +558,7 @@ Reference< XDocumentFragment > Submission::createSubmissionDocument(const Refere
{
aListItem = aList->item(i);
if (aListItem->getNodeType()==NodeType_DOCUMENT_NODE)
- aListItem.set( (Reference< XDocument >(aListItem, UNO_QUERY))->getDocumentElement(), UNO_QUERY);
+ aListItem = (Reference< XDocument >(aListItem, UNO_QUERY))->getDocumentElement();
// copy relevant nodes from instance into fragment
cloneNodes(*getModelImpl(), aFragment, aListItem, bRemoveWSNodes);
}
diff --git a/forms/source/xforms/submission/serialization_app_xml.cxx b/forms/source/xforms/submission/serialization_app_xml.cxx
index c8ad9ef642e3..afe23e63c426 100644
--- a/forms/source/xforms/submission/serialization_app_xml.cxx
+++ b/forms/source/xforms/submission/serialization_app_xml.cxx
@@ -67,7 +67,7 @@ CSerializationAppXML::getInputStream()
{
// The pipes output is provided through it's
// XOutputStream interface aspect
- return Reference< css::io::XInputStream >(m_xBuffer, UNO_QUERY);
+ return m_xBuffer;
}
void
diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx
index 43dafdc714c6..51d29ceed0c9 100644
--- a/forms/source/xforms/submission/serialization_urlencoded.cxx
+++ b/forms/source/xforms/submission/serialization_urlencoded.cxx
@@ -173,7 +173,7 @@ void CSerializationURLEncoded::serialize()
Reference< XInputStream > CSerializationURLEncoded::getInputStream()
{
- return Reference< XInputStream >(m_aPipe, UNO_QUERY);
+ return m_aPipe;
}