summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-02 10:36:43 +0200
committerNoel Grandin <noelgrandin@gmail.com>2013-05-22 10:44:29 +0000
commit6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 (patch)
tree2746468845d6f1159e3759ee2cf7a620fca15b6e /sw
parent697a007c61b9cabceb9767fad87cd5822b300452 (diff)
Use the new type-checking Reference constructor to reduce code noise
Also create a Clang compiler plugin to detect such cases. Change-Id: I61ad1a1d6b1c017eeb51f226d2dde0e9bb7f1752 Reviewed-on: https://gerrit.libreoffice.org/4001 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/xml/xmlexp.cxx5
-rw-r--r--sw/source/filter/xml/xmltbli.cxx2
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx6
-rw-r--r--sw/source/ui/dbui/dbtree.cxx9
4 files changed, 8 insertions, 14 deletions
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index e12b3f3631bd..fca627d3af85 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -361,7 +361,7 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps)
Reference < XIndexContainer > xBox = IndexedPropertyValues::create( comphelper::getProcessComponentContext() );
pValue[nIndex].Name = OUString( "Views");
- pValue[nIndex++].Value <<= Reference < XIndexAccess > ( xBox, UNO_QUERY );
+ pValue[nIndex++].Value <<= xBox;
SwDoc *pDoc = getDoc();
const Rectangle rRect =
@@ -464,9 +464,8 @@ void SwXMLExport::_ExportContent()
if (xPage.is())
{
// prevent export of form controls which are embedded in mute sections
- Reference<XIndexAccess> xIAPage( xPage, UNO_QUERY );
GetTextParagraphExport()->PreventExportOfControlsInMuteSections(
- xIAPage, GetFormExport() );
+ xPage, GetFormExport() );
// #i36597#
if ( GetFormExport()->pageContainsForms( xPage ) || GetFormExport()->documentContainsXForms() )
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 5a367cd49bd5..9cc801f5f2f8 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1403,7 +1403,7 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
try
{
- xTextContent = Reference< XTextContent >( xTable, UNO_QUERY );
+ xTextContent = xTable;
GetImport().GetTextImport()->InsertTextContent( xTextContent );
}
catch( IllegalArgumentException& )
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 51db9f330ce6..ae7a0d6b2ee5 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -2281,7 +2281,6 @@ String SwNewDBMgr::LoadAndRegisterDataSource()
{
Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
- Reference<XSingleServiceFactory> xFact( xDBContext, UNO_QUERY);
String sNewName = INetURLObject::decode( aURL.getName(),
INET_HEX_ESCAPE,
@@ -2308,7 +2307,7 @@ String SwNewDBMgr::LoadAndRegisterDataSource()
}
else
{
- xNewInstance = xFact->createInstance();
+ xNewInstance = xDBContext->createInstance();
Reference<XPropertySet> xDataProperties(xNewInstance, UNO_QUERY);
if(aURLAny.hasValue())
@@ -2346,8 +2345,7 @@ String SwNewDBMgr::LoadAndRegisterDataSource()
}
xStore->storeAsURL(sTmpName, Sequence< PropertyValue >());
}
- Reference<XNamingService> xNaming(xDBContext, UNO_QUERY);
- xNaming->registerObject( sFind, xNewInstance );
+ xDBContext->registerObject( sFind, xNewInstance );
}
catch(const Exception&)
diff --git a/sw/source/ui/dbui/dbtree.cxx b/sw/source/ui/dbui/dbtree.cxx
index 8a5193733c80..77c67718a6d1 100644
--- a/sw/source/ui/dbui/dbtree.cxx
+++ b/sw/source/ui/dbui/dbtree.cxx
@@ -96,14 +96,13 @@ class SwDBTreeList_Impl : public cppu::WeakImplHelper1 < XContainerListener >
SwDBTreeList_Impl::~SwDBTreeList_Impl()
{
- Reference<XContainer> xContainer(xDBContext, UNO_QUERY);
- if(xContainer.is())
+ if(xDBContext.is())
{
m_refCount++;
//block necessary due to solaris' compiler behaviour to
//remove temporaries at the block's end
{
- xContainer->removeContainerListener( this );
+ xDBContext->removeContainerListener( this );
}
m_refCount--;
}
@@ -145,9 +144,7 @@ sal_Bool SwDBTreeList_Impl::HasContext()
{
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
xDBContext = DatabaseContext::create(xContext);
- Reference<XContainer> xContainer(xDBContext, UNO_QUERY);
- if(xContainer.is())
- xContainer->addContainerListener( this );
+ xDBContext->addContainerListener( this );
}
return xDBContext.is();
}