summaryrefslogtreecommitdiff
path: root/framework/source/fwe
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 /framework/source/fwe
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 'framework/source/fwe')
-rw-r--r--framework/source/fwe/helper/actiontriggerhelper.cxx7
-rw-r--r--framework/source/fwe/helper/documentundoguard.cxx2
-rw-r--r--framework/source/fwe/xml/menuconfiguration.cxx5
-rw-r--r--framework/source/fwe/xml/statusbarconfiguration.cxx3
4 files changed, 7 insertions, 10 deletions
diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx
index 08f01d366d55..67fdd65ff413 100644
--- a/framework/source/fwe/helper/actiontriggerhelper.cxx
+++ b/framework/source/fwe/helper/actiontriggerhelper.cxx
@@ -100,18 +100,17 @@ void GetMenuItemAttributes( Reference< XPropertySet > xActionTriggerPropertySet,
void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, Reference< XIndexContainer > xActionTriggerContainer )
{
- Reference< XIndexAccess > xIndexAccess( xActionTriggerContainer, UNO_QUERY );
- if ( xIndexAccess.is() )
+ if ( xActionTriggerContainer.is() )
{
AddonsOptions aAddonOptions;
OUString aSlotURL( "slot:" );
- for ( sal_Int32 i = 0; i < xIndexAccess->getCount(); i++ )
+ for ( sal_Int32 i = 0; i < xActionTriggerContainer->getCount(); i++ )
{
try
{
Reference< XPropertySet > xPropSet;
- if (( xIndexAccess->getByIndex( i ) >>= xPropSet ) && ( xPropSet.is() ))
+ if (( xActionTriggerContainer->getByIndex( i ) >>= xPropSet ) && ( xPropSet.is() ))
{
if ( IsSeparator( xPropSet ))
{
diff --git a/framework/source/fwe/helper/documentundoguard.cxx b/framework/source/fwe/helper/documentundoguard.cxx
index 470eb0285dcd..cec4c0a253a3 100644
--- a/framework/source/fwe/helper/documentundoguard.cxx
+++ b/framework/source/fwe/helper/documentundoguard.cxx
@@ -56,7 +56,7 @@ namespace framework
{
public:
UndoManagerContextListener( const Reference< XUndoManager >& i_undoManager )
- :m_xUndoManager( i_undoManager, UNO_QUERY_THROW )
+ :m_xUndoManager( i_undoManager )
,m_nRelativeContextDepth( 0 )
,m_documentDisposed( false )
{
diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx
index 0f0e894eb69d..3e3600128517 100644
--- a/framework/source/fwe/xml/menuconfiguration.cxx
+++ b/framework/source/fwe/xml/menuconfiguration.cxx
@@ -82,7 +82,7 @@ throw ( WrappedTargetException )
try
{
xParser->parseStream( aInputSource );
- return Reference< XIndexAccess >( xItemContainer, UNO_QUERY );
+ return xItemContainer;
}
catch ( const RuntimeException& e )
{
@@ -126,8 +126,7 @@ throw ( WrappedTargetException )
try
{
- Reference< XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
- OWriteMenuDocumentHandler aWriteMenuDocumentHandler( rMenuBarConfiguration, xHandler );
+ OWriteMenuDocumentHandler aWriteMenuDocumentHandler( rMenuBarConfiguration, xWriter );
aWriteMenuDocumentHandler.WriteMenuDocument();
}
catch ( const RuntimeException& e )
diff --git a/framework/source/fwe/xml/statusbarconfiguration.cxx b/framework/source/fwe/xml/statusbarconfiguration.cxx
index b2a4f8369655..22f2b8ba918e 100644
--- a/framework/source/fwe/xml/statusbarconfiguration.cxx
+++ b/framework/source/fwe/xml/statusbarconfiguration.cxx
@@ -89,8 +89,7 @@ sal_Bool StatusBarConfiguration::StoreStatusBar(
try
{
- Reference< XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
- OWriteStatusBarDocumentHandler aWriteStatusBarDocumentHandler( rStatusbarConfiguration, xHandler );
+ OWriteStatusBarDocumentHandler aWriteStatusBarDocumentHandler( rStatusbarConfiguration, xWriter );
aWriteStatusBarDocumentHandler.WriteStatusBarDocument();
return sal_True;
}