diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-02 10:36:43 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2013-05-22 10:44:29 +0000 |
commit | 6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 (patch) | |
tree | 2746468845d6f1159e3759ee2cf7a620fca15b6e | |
parent | 697a007c61b9cabceb9767fad87cd5822b300452 (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>
122 files changed, 550 insertions, 507 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index a6b87743f4f0..6a0a688652d8 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -838,10 +838,8 @@ bool DialogWindow::SaveDialog() xStringResourceWithLocation->newLocale( rLocale ); } - Reference< XStringResourceManager > xTargetStringResourceManager( xStringResourceWithLocation, uno::UNO_QUERY ); - LocalizationMgr::copyResourceForDialog( xDialogModel, - xStringResourceResolver, xTargetStringResourceManager ); + xStringResourceResolver, xStringResourceWithLocation ); xStringResourceWithLocation->store(); } diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 68b41ba53eb0..ae513291a8fb 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -802,8 +802,7 @@ void LibPage::InsertLib() aFilter += ";*.sdd;*.sxi;*.odp" ; // presentation aFilter += ";*.sti;*.otp" ; // presentation template aFilter += ";*.sxm;*.odf" ; // formula - Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( aTitle, aFilter ); + xFP->appendFilter( aTitle, aFilter ); // set display directory and filter OUString aPath(GetExtraData()->GetAddLibPath()); @@ -817,14 +816,14 @@ void LibPage::InsertLib() OUString aLastFilter(GetExtraData()->GetAddLibFilter()); if ( !aLastFilter.isEmpty() ) - xFltMgr->setCurrentFilter( aLastFilter ); + xFP->setCurrentFilter( aLastFilter ); else - xFltMgr->setCurrentFilter( IDE_RESSTR(RID_STR_BASIC) ); + xFP->setCurrentFilter( IDE_RESSTR(RID_STR_BASIC) ); if ( xFP->execute() == RET_OK ) { GetExtraData()->SetAddLibPath( xFP->getDisplayDirectory() ); - GetExtraData()->SetAddLibFilter( xFltMgr->getCurrentFilter() ); + GetExtraData()->SetAddLibFilter( xFP->getCurrentFilter() ); // library containers for import Reference< script::XLibraryContainer2 > xModLibContImport; @@ -1252,8 +1251,7 @@ void LibPage::ExportAsPackage( const String& aLibName ) OUString aTitle = String( IDEResId( RID_STR_PACKAGE_BUNDLE ) ); OUString aFilter; aFilter = "*.oxt" ; // library files - Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( aTitle, aFilter ); + xFP->appendFilter( aTitle, aFilter ); // set display directory and filter String aPath = GetExtraData()->GetAddLibPath(); @@ -1266,7 +1264,7 @@ void LibPage::ExportAsPackage( const String& aLibName ) // macro path from configuration management xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); } - xFltMgr->setCurrentFilter( aTitle ); + xFP->setCurrentFilter( aTitle ); if ( xFP->execute() == RET_OK ) { diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 7b81631570a7..d7a7bf191d4d 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -381,10 +381,9 @@ namespace basic //-------------------------------------------------------------------- BasicManagerPointer& ImplRepository::impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel ) { - Reference< XInterface > xNormalized( _rxDocumentModel, UNO_QUERY ); - DBG_ASSERT( xNormalized.is(), "ImplRepository::impl_getLocationForModel: invalid model!" ); + DBG_ASSERT( _rxDocumentModel.is(), "ImplRepository::impl_getLocationForModel: invalid model!" ); - BasicManagerPointer& location = m_aStore[ xNormalized ]; + BasicManagerPointer& location = m_aStore[ _rxDocumentModel ]; return location; } @@ -489,9 +488,8 @@ namespace basic impl_notifyCreationListeners( _rxDocumentModel, *_out_rpBasicManager ); // register as listener for this model being disposed/closed - Reference< XComponent > xDocumentComponent( _rxDocumentModel, UNO_QUERY ); - OSL_ENSURE( xDocumentComponent.is(), "ImplRepository::impl_createManagerForModel: the document must be an XComponent!" ); - startComponentListening( xDocumentComponent ); + OSL_ENSURE( _rxDocumentModel.is(), "ImplRepository::impl_createManagerForModel: the document must be an XComponent!" ); + startComponentListening( _rxDocumentModel ); // register as listener for the BasicManager being destroyed StartListening( *_out_rpBasicManager ); diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 6ba2ff153f31..a20fd88c3223 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -240,7 +240,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( mxContext ); ::xmlscript::importDialogModel( xInput, xDialogModel, mxContext, mxOwnerDocument ); std::vector< OUString > vEmbeddedImageURLs; - GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs ); + GraphicObject::InspectForGraphicObjectImageURL( xDialogModel, vEmbeddedImageURLs ); if ( !vEmbeddedImageURLs.empty() ) { // Export the images to the storage diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 69e8fbfbd9e8..4586bac3b3b3 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -295,8 +295,7 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi throw RuntimeException("addContainerListener called with null xListener", static_cast< cppu::OWeakObject * >(this)); } - Reference< XInterface > xIface( xListener, UNO_QUERY ); - maContainerListeners.addInterface( xIface ); + maContainerListeners.addInterface( xListener ); } void SAL_CALL NameContainer::removeContainerListener( const Reference< XContainerListener >& xListener ) @@ -306,8 +305,7 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine { throw RuntimeException(); } - Reference< XInterface > xIface( xListener, UNO_QUERY ); - maContainerListeners.removeInterface( xIface ); + maContainerListeners.removeInterface( xListener ); } // Methods XChangesNotifier @@ -318,8 +316,7 @@ void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListen { throw RuntimeException(); } - Reference< XInterface > xIface( xListener, UNO_QUERY ); - maChangesListeners.addInterface( xIface ); + maChangesListeners.addInterface( xListener ); } void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesListener >& xListener ) @@ -329,8 +326,7 @@ void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesLis { throw RuntimeException(); } - Reference< XInterface > xIface( xListener, UNO_QUERY ); - maChangesListeners.removeInterface( xIface ); + maChangesListeners.removeInterface( xListener ); } //============================================================================ @@ -2969,8 +2965,7 @@ void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifie leaveMethod(); Reference< XModel > xModel = mxOwnerDocument; // weak-ref -> ref - Reference< XInterface > xSender( xModel, UNO_QUERY_THROW ); - vba::VBAScriptEvent aEvent( xSender, nIdentifier, rModuleName ); + vba::VBAScriptEvent aEvent( xModel, nIdentifier, rModuleName ); maVBAScriptListeners.notify( aEvent ); } diff --git a/comphelper/source/processfactory/processfactory.cxx b/comphelper/source/processfactory/processfactory.cxx index fe6c96b2af4a..5690cc005477 100644 --- a/comphelper/source/processfactory/processfactory.cxx +++ b/comphelper/source/processfactory/processfactory.cxx @@ -80,14 +80,14 @@ Reference< XComponentContext > getComponentContext( catch (beans::UnknownPropertyException & e) { throw DeploymentException( "unknown service factory DefaultContext property: " + e.Message, - Reference< XInterface >( factory, UNO_QUERY ) ); + factory ); } } if ( !xRet.is() ) { throw DeploymentException( "no service factory DefaultContext", - Reference< XInterface >( factory, UNO_QUERY ) ); + factory ); } return xRet; } diff --git a/compilerplugins/clang/store/referencecasting.cxx b/compilerplugins/clang/store/referencecasting.cxx new file mode 100644 index 000000000000..c05c233cc337 --- /dev/null +++ b/compilerplugins/clang/store/referencecasting.cxx @@ -0,0 +1,194 @@ +/* + * This file is part of the LibreOffice project. + * + * Based on LLVM/Clang. + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + */ + +#include "referencecasting.hxx" + +#include <clang/AST/Attr.h> +#include <iostream> + +namespace loplugin +{ + +/* +This is a compile-time checker. + +Check for cases where we have + - two IDL interfaces A and B, + - B extends A + - we are converting a Reference<B> to a Reference<A> + +Note that it generates the occasional false positive. + +Also, it makes clang3.2 crash on about 4 files in the LO codebase. +I have logged a bug here: + http://llvm.org/bugs/show_bug.cgi?id=15902 + +*/ + +ReferenceCasting::ReferenceCasting( CompilerInstance& compiler ) + : Plugin( compiler ) +{ +} + +void ReferenceCasting::run() +{ + TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); +} + +// This: +// static void example_method() +// { +// css::uno::Reference<B> b; +// css::uno::Reference<A>(b, css::uno::UNO_QUERY); +// } +// Compiles to this AST: +// (CompoundStmt 0x205d430 </noel-extra1/libo-clang/compilerplugins/clang/noel1.cxx:17:1, line:20:1> +// (DeclStmt 0x20580a8 <line:18:5, col:32> +// (0x20530e0 "css::uno::Reference<B> refB = +// (CXXConstructExpr 0x2058078 <col:28> 'css::uno::Reference<B>':'class com::sun::star::uno::Reference<class B>''void (void)')")) +// (DeclStmt 0x205d418 <line:19:5, col:59> +// (0x2058310 "css::uno::Reference<A> refA = +// (CXXConstructExpr 0x205d3d8 <col:28, col:58> 'css::uno::Reference<A>':'class com::sun::star::uno::Reference<class A>''void (const class com::sun::star::uno::BaseReference &, enum com::sun::star::uno::UnoReference_Query)' +// (ImplicitCastExpr 0x205d3c0 <col:33> 'const class com::sun::star::uno::BaseReference' lvalue <NoOp> +// (ImplicitCastExpr 0x205d3a0 <col:33> 'class com::sun::star::uno::BaseReference' lvalue <DerivedToBase (BaseReference)> +// (DeclRefExpr 0x20582a0 <col:33> 'css::uno::Reference<B>':'class com::sun::star::uno::Reference<class B>' lvalue Var 0x20530e0 'refB' 'css::uno::Reference<B>':'class com::sun::star::uno::Reference<class B>'))) +// (DeclRefExpr 0x2058398 <col:39, col:49> 'enum com::sun::star::uno::UnoReference_Query' EnumConstant 0x1831de0 'UNO_QUERY' 'enum com::sun::star::uno::UnoReference_Query'))"))) +// +// +// This: +// static void example_method1(css::uno::Reference<A>) +// { +// } +// static void example_method2() +// { +// css::uno::Reference<B> refB; +// example_method1(css::uno::Reference<A>(refB, css::uno::UNO_QUERY)); +// } +// Compiles to this AST: +// static void example_method1(css::uno::Reference<A>) (CompoundStmt 0x2a74ee8 </noel-extra1/libo-clang/compilerplugins/clang/noel1.cxx:17:1, line:18:1>) +// static void example_method2() (CompoundStmt 0x2a7a650 </noel-extra1/libo-clang/compilerplugins/clang/noel1.cxx:21:1, line:24:1> +// (DeclStmt 0x2a7a1a8 <line:22:5, col:32> +// (0x2a751e0 "css::uno::Reference<B> refB = +// (CXXConstructExpr 0x2a7a178 <col:28> 'css::uno::Reference<B>':'class com::sun::star::uno::Reference<class B>''void (void)')")) +// (ExprWithCleanups 0x2a7a638 <line:23:5, col:70> 'void' +// (CallExpr 0x2a7a570 <col:5, col:70> 'void' +// (ImplicitCastExpr 0x2a7a558 <col:5> 'void (*)(css::uno::Reference<A>)' <FunctionToPointerDecay> +// (DeclRefExpr 0x2a7a4d8 <col:5> 'void (css::uno::Reference<A>)' lvalue Function 0x2a6ff00 'example_method1' 'void (css::uno::Reference<A>)')) +// (CXXBindTemporaryExpr 0x2a7a618 <col:21, col:69> 'css::uno::Reference<A>':'class com::sun::star::uno::Reference<class A>' (CXXTemporary 0x2a7a610) +// (CXXConstructExpr 0x2a7a5d8 <col:21, col:69> 'css::uno::Reference<A>':'class com::sun::star::uno::Reference<class A>''void (const Reference<class A> &)' elidable +// (MaterializeTemporaryExpr 0x2a7a5c0 <col:21, col:69> 'const Reference<class A>':'const class com::sun::star::uno::Reference<class A>' lvalue +// (ImplicitCastExpr 0x2a7a5a8 <col:21, col:69> 'const Reference<class A>':'const class com::sun::star::uno::Reference<class A>' <NoOp> +// (CXXBindTemporaryExpr 0x2a7a4b8 <col:21, col:69> 'css::uno::Reference<A>':'class com::sun::star::uno::Reference<class A>' (CXXTemporary 0x2a7a4b0) +// (CXXTemporaryObjectExpr 0x2a7a460 <col:21, col:69> 'css::uno::Reference<A>':'class com::sun::star::uno::Reference<class A>''void (const class com::sun::star::uno::BaseReference &, enum com::sun::star::uno::UnoReference_Query)' +// (ImplicitCastExpr 0x2a7a448 <col:44> 'const class com::sun::star::uno::BaseReference' lvalue <NoOp> +// (ImplicitCastExpr 0x2a7a428 <col:44> 'class com::sun::star::uno::BaseReference' lvalue <DerivedToBase (BaseReference)> +// (DeclRefExpr 0x2a7a340 <col:44> 'css::uno::Reference<B>':'class com::sun::star::uno::Reference<class B>' lvalue Var 0x2a751e0 'refB' 'css::uno::Reference<B>':'class com::sun::star::uno::Reference<class B>'))) +// (DeclRefExpr 0x2a7a398 <col:50, col:60> 'enum com::sun::star::uno::UnoReference_Query' EnumConstant 0x224ee20 'UNO_QUERY' 'enum com::sun::star::uno::UnoReference_Query')))))))))) + +static const Type* extractTemplateType(Expr* cce); + +bool ReferenceCasting::VisitCXXConstructExpr( CXXConstructExpr* cce ) +{ + // don't bother processing anything in the Reference.h file. Makes my life easier when debugging this. + if( compiler.getSourceManager().getFilename( cce->getSourceRange().getBegin() ).find( "Reference.h" ) != StringRef::npos ) + return true; + + // look for calls to the Reference<T>(x,UNO_something) constructor + if( cce->getConstructor()->getNameInfo().getName().getAsString() != "Reference" ) + return true; + + if( cce->getNumArgs() != 2 ) + return true; + + // extract the type parameter passed to the template + const Type * templateParamType = extractTemplateType(cce); + if ( !templateParamType ) + return true; + + // extract the type of the first parameter passed to the constructor + Expr* constructorArg0 = cce->getArg(0); + if( !constructorArg0 ) + return true; + + // ignore the Reference(XInterface*,...) constructor + if( constructorArg0->getType()->isPointerType() ) + return true; + + // drill down the expression tree till we hit the bottom + DeclRefExpr* constructorSubArg2; + Expr* constructorArg0SubExpr = constructorArg0; + for(;;) + { + // if we've hit the member expression we want, break + constructorSubArg2 = dyn_cast<DeclRefExpr>( constructorArg0SubExpr ); + if( constructorSubArg2 ) + break; + CastExpr* tmp1 = dyn_cast<CastExpr>( constructorArg0SubExpr ); + if( tmp1 ) { + constructorArg0SubExpr = tmp1->getSubExpr(); + continue; + } + MaterializeTemporaryExpr* tmp2 = dyn_cast<MaterializeTemporaryExpr>( constructorArg0SubExpr ); + if( tmp2 ) { + constructorArg0SubExpr = tmp2->GetTemporaryExpr(); + continue; + } + CXXBindTemporaryExpr* tmp3 = dyn_cast<CXXBindTemporaryExpr>( constructorArg0SubExpr ); + if( tmp3 ) { + constructorArg0SubExpr = tmp3->getSubExpr(); + continue; + } + CXXTemporaryObjectExpr* tmp4 = dyn_cast<CXXTemporaryObjectExpr>( constructorArg0SubExpr ); + if( tmp4 ) { + constructorArg0SubExpr = tmp4->getArg(0); + continue; + } + return true; + } + + const Type * tmp3 = extractTemplateType( constructorSubArg2 ); + if ( !tmp3 ) + return true; + + const RecordType* templateParamRT = dyn_cast<RecordType>( templateParamType ); + const RecordType* constructorArgRT = dyn_cast<RecordType>( tmp3 ); + if( !templateParamRT || !constructorArgRT ) + return true; + + CXXRecordDecl* templateParamRD = dyn_cast<CXXRecordDecl>( templateParamRT->getDecl() ); + CXXRecordDecl* constructorArgRD = dyn_cast<CXXRecordDecl>( constructorArgRT->getDecl() ); + + if (constructorArgRD->Equals(templateParamRD) || constructorArgRD->isDerivedFrom(templateParamRD)) + report( DiagnosticsEngine::Warning, + "the source reference is already a subtype of the destination reference", + cce->getLocStart()) // and the exact position where the message should point + << cce->getSourceRange(); // and the full return statement to highlight (optional) + + return true; +} + +static const Type* extractTemplateType(Expr* cce) +{ + QualType cceQT = cce->getType(); + const Type* cceType = cceQT.getTypePtr(); + const TemplateSpecializationType* cceTST = dyn_cast<TemplateSpecializationType>( cceType ); + if( !cceTST ) + return NULL; + if( cceTST->getNumArgs() != 1 ) + return NULL; + const TemplateArgument & cceTA = cceTST->getArg(0); + QualType templateParamQT = cceTA.getAsType(); + return templateParamQT.getTypePtr(); +} + + +static Plugin::Registration< ReferenceCasting > X( "referencecasting" ); + +} // namespace diff --git a/compilerplugins/clang/store/referencecasting.hxx b/compilerplugins/clang/store/referencecasting.hxx new file mode 100644 index 000000000000..732e32de7b75 --- /dev/null +++ b/compilerplugins/clang/store/referencecasting.hxx @@ -0,0 +1,31 @@ +/* + * This file is part of the LibreOffice project. + * + * Based on LLVM/Clang. + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + */ + +#ifndef REFERENCECASTING_H +#define REFERENCECASTING_H + +#include "plugin.hxx" + +namespace loplugin +{ + +class ReferenceCasting + : public RecursiveASTVisitor< ReferenceCasting > + , public Plugin + { + public: + explicit ReferenceCasting( CompilerInstance& compiler ); + virtual void run(); + bool VisitCXXConstructExpr( CXXConstructExpr* cce ); + }; + +} // namespace + +#endif // REFERENCECASTING_H diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx index edbd7c2782dc..ffa32ff7ace6 100644 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ b/cui/source/dialogs/hangulhanjadlg.cxx @@ -937,10 +937,9 @@ namespace svx m_aDictsLB.Clear(); Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer(); - Reference< XNameAccess > xNameAccess = Reference< XNameAccess >( xNameCont, UNO_QUERY ); - if( xNameAccess.is() ) + if( xNameCont.is() ) { - Sequence< OUString > aDictNames( xNameAccess->getElementNames() ); + Sequence< OUString > aDictNames( xNameCont->getElementNames() ); const OUString* pDic = aDictNames.getConstArray(); sal_Int32 nCount = aDictNames.getLength(); @@ -948,7 +947,7 @@ namespace svx sal_Int32 i; for( i = 0 ; i < nCount ; ++i ) { - Any aAny( xNameAccess->getByName( pDic[ i ] ) ); + Any aAny( xNameCont->getByName( pDic[ i ] ) ); Reference< XConversionDictionary > xDic; if( ( aAny >>= xDic ) && xDic.is() ) { diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index eab99e44fe66..8572341db884 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -613,8 +613,7 @@ IMPL_LINK(SvxEditDictionaryDialog, NewDelHdl, PushButton*, pBtn) // if remove has failed the following add should fail too // and thus a warning message should be triggered... - Reference<XDictionary> aXDictionary(xDic, UNO_QUERY); - nAddRes = linguistic::AddEntryToDic( aXDictionary, + nAddRes = linguistic::AddEntryToDic( xDic, aNewWord, bIsNegEntry, aRplcText, LanguageTag( xDic->getLocale() ).getLanguageType(), sal_False ); } diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index e015e7cbfa78..e269f19ec7c8 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -223,8 +223,7 @@ Reference< XStorage > DocumentStorageAccess::impl_openSubStorage_nothrow( const sal_Int32 nRealMode = m_pModelImplementation->m_bDocumentReadOnly ? ElementModes::READ : _nDesiredMode; if ( nRealMode == ElementModes::READ ) { - Reference< XNameAccess > xSubStorageNames( xRootStorage, UNO_QUERY ); - if ( xSubStorageNames.is() && !xSubStorageNames->hasByName( _rStorageName ) ) + if ( xRootStorage.is() && !xRootStorage->hasByName( _rStorageName ) ) return xStorage; } @@ -331,8 +330,7 @@ Sequence< OUString > SAL_CALL DocumentStorageAccess::getDocumentSubStoragesNames ::std::vector< OUString > aNames; - Reference< XNameAccess > xNames( xRootStor, UNO_QUERY_THROW ); - Sequence< OUString > aElementNames( xNames->getElementNames() ); + Sequence< OUString > aElementNames( xRootStor->getElementNames() ); for ( sal_Int32 i=0; i<aElementNames.getLength(); ++i ) { if ( xRootStor->isStorageElement( aElementNames[i] ) ) diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 8691098954ef..3f70b12d9706 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -694,7 +694,7 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const OUString& _s return aFind->second; } } - return Reference< XInterface >(xRet,UNO_QUERY); + return xRet; } Reference< XInterface > SAL_CALL OConnection::createInstanceWithArguments( const OUString& _sServiceSpecifier, const Sequence< Any >& /*Arguments*/ ) throw (Exception, RuntimeException) diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 2b3147b82120..d8e24d7b6f83 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -895,12 +895,10 @@ namespace try { // obtain all properties currently known at the bag - Reference< XPropertySet > xPropertySet( _rxPropertyBag, UNO_QUERY_THROW ); - Reference< XPropertySetInfo > xPSI( xPropertySet->getPropertySetInfo(), UNO_QUERY_THROW ); + Reference< XPropertySetInfo > xPSI( _rxPropertyBag->getPropertySetInfo(), UNO_QUERY_THROW ); Sequence< Property > aAllExistentProperties( xPSI->getProperties() ); Reference< XPropertyState > xPropertyState( _rxPropertyBag, UNO_QUERY_THROW ); - Reference< XPropertyContainer > xPropertyContainer( _rxPropertyBag, UNO_QUERY_THROW ); // loop through them, and reset resp. default properties which are not to be set const Property* pExistentProperty( aAllExistentProperties.getConstArray() ); @@ -913,7 +911,7 @@ namespace // this property is not to be set, but currently exists in the bag. // -> Remove it, or reset it to the default. if ( ( pExistentProperty->Attributes & PropertyAttribute::REMOVABLE ) != 0 ) - xPropertyContainer->removeProperty( pExistentProperty->Name ); + _rxPropertyBag->removeProperty( pExistentProperty->Name ); else xPropertyState->setPropertyToDefault( pExistentProperty->Name ); } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 6ea9709132e2..1e9b62c87ef2 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -150,9 +150,8 @@ namespace dbaccess OUString sContentType; try { - Reference< XStorage > xContainerStorage( _rxContainerStorage, UNO_QUERY_THROW ); ::utl::SharedUNOComponent< XPropertySet > xStorageProps( - xContainerStorage->openStorageElement( _rEntityName, ElementModes::READ ), UNO_QUERY_THROW ); + _rxContainerStorage->openStorageElement( _rEntityName, ElementModes::READ ), UNO_QUERY_THROW ); OSL_VERIFY( xStorageProps->getPropertyValue( INFO_MEDIATYPE ) >>= sContentType ); } catch( const Exception& ) @@ -1170,8 +1169,7 @@ namespace { try { - Reference< XComponentSupplier > xCompProv( _rxEmbeddedObject, UNO_QUERY_THROW ); - Reference< XDrawPageSupplier > xSuppPage( xCompProv->getComponent(), UNO_QUERY_THROW ); + Reference< XDrawPageSupplier > xSuppPage( _rxEmbeddedObject->getComponent(), UNO_QUERY_THROW ); // if this interface does not exist, then either getComponent returned NULL, // or the document is a multi-page document. The latter is allowed, but currently // simply not handled by this code, as it would not normally happen. @@ -1390,8 +1388,7 @@ sal_Bool ODocumentDefinition::saveAs() Reference< XStorage> xStorage = getContainerStorage(); const static OUString sBaseName("Obj"); - Reference<XNameAccess> xElements(xStorage,UNO_QUERY_THROW); - OUString sPersistentName = ::dbtools::createUniqueName(xElements,sBaseName); + OUString sPersistentName = ::dbtools::createUniqueName(xStorage,sBaseName); xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xStorage,sPersistentName); OUString sOldName = m_pImpl->m_aProps.aTitle; diff --git a/dbaccess/source/core/recovery/subcomponentloader.cxx b/dbaccess/source/core/recovery/subcomponentloader.cxx index 85ae960dea4a..5dd294daa6c2 100644 --- a/dbaccess/source/core/recovery/subcomponentloader.cxx +++ b/dbaccess/source/core/recovery/subcomponentloader.cxx @@ -61,14 +61,14 @@ namespace dbaccess Reference< XWindow > xAppComponentWindow; SubComponentLoader_Data( const Reference< XCommandProcessor >& i_rDocumentDefinition ) - :xDocDefCommands( i_rDocumentDefinition, UNO_SET_THROW ) + :xDocDefCommands( i_rDocumentDefinition ) ,xNonDocComponent() { } SubComponentLoader_Data( const Reference< XComponent >& i_rNonDocumentComponent ) :xDocDefCommands() - ,xNonDocComponent( i_rNonDocumentComponent, UNO_SET_THROW ) + ,xNonDocComponent( i_rNonDocumentComponent ) { } }; diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 7c5a37df3721..85d2aed7b08e 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -523,8 +523,8 @@ namespace dbmm const Reference< XEventAttacherManager >& _rxManager, const sal_Int32 _nIndex ) - :m_xComponent( _rxComponent, UNO_SET_THROW ) - ,m_xManager( _rxManager, UNO_SET_THROW ) + :m_xComponent( _rxComponent ) + ,m_xManager( _rxManager ) ,m_nIndex( _nIndex ) { } @@ -557,7 +557,7 @@ namespace dbmm { public: FormComponentIterator( const Reference< XIndexAccess >& _rxContainer ) - :m_xContainer( _rxContainer, UNO_SET_THROW ) + :m_xContainer( _rxContainer ) ,m_xEventManager( _rxContainer, UNO_QUERY_THROW ) ,m_nElementCount( _rxContainer->getCount() ) ,m_nCurrentElement( 0 ) diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index 5ed65de095ee..24b20c388877 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -290,12 +290,11 @@ namespace dbaui bool bSuccess = false; try { - Reference< XCommandProcessor > xCommandProcessor( _rxCommandProcessor, UNO_SET_THROW ); - sal_Int32 nCommandIdentifier = xCommandProcessor->createCommandIdentifier(); + sal_Int32 nCommandIdentifier = _rxCommandProcessor->createCommandIdentifier(); Command aCommand; aCommand.Name = OUString( "close" ); - xCommandProcessor->execute( aCommand, nCommandIdentifier, NULL ); + _rxCommandProcessor->execute( aCommand, nCommandIdentifier, NULL ); bSuccess = true; } catch( const Exception& ) diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx index 7ae47ed6f318..b45555b18fb7 100644 --- a/dbaccess/source/ui/browser/exsrcbrw.cxx +++ b/dbaccess/source/ui/browser/exsrcbrw.cxx @@ -347,7 +347,6 @@ void SbaExternalSourceBrowser::Attach(const Reference< XRowSet > & xMaster) sal_Bool bWasInsertRow = sal_False; sal_Bool bBeforeFirst = sal_True; sal_Bool bAfterLast = sal_True; - Reference< XResultSet > xResultSet(xMaster, UNO_QUERY); Reference< XRowLocate > xCursor(xMaster, UNO_QUERY); Reference< XPropertySet > xMasterProps(xMaster, UNO_QUERY); @@ -359,10 +358,10 @@ void SbaExternalSourceBrowser::Attach(const Reference< XRowSet > & xMaster) // the grid will move the form's cursor to the first record, but we want the form to remain unchanged // restore the old position - if (xCursor.is() && xResultSet.is()) + if (xCursor.is() && xMaster.is()) { - bBeforeFirst = xResultSet->isBeforeFirst(); - bAfterLast = xResultSet->isAfterLast(); + bBeforeFirst = xMaster->isBeforeFirst(); + bAfterLast = xMaster->isAfterLast(); if(!bBeforeFirst && !bAfterLast) aOldPos = xCursor->getBookmark(); } @@ -402,10 +401,10 @@ void SbaExternalSourceBrowser::Attach(const Reference< XRowSet > & xMaster) xUpdate->moveToInsertRow(); else if (xCursor.is() && aOldPos.hasValue()) xCursor->moveToBookmark(aOldPos); - else if(bBeforeFirst && xResultSet.is()) - xResultSet->beforeFirst(); - else if(bAfterLast && xResultSet.is()) - xResultSet->afterLast(); + else if(bBeforeFirst && xMaster.is()) + xMaster->beforeFirst(); + else if(bAfterLast && xMaster.is()) + xMaster->afterLast(); } catch(Exception&) { diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index e16813fc2b31..2679257de5f3 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -853,10 +853,9 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource(); Reference< XDatabaseContext > xDatabaseContext( DatabaseContext::create(getORB()) ); - Reference< XNameAccess > xNameAccessDatabaseContext(xDatabaseContext, UNO_QUERY_THROW ); INetURLObject aURL( _sPath ); OUString sFilename = aURL.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - OUString sDatabaseName = ::dbtools::createUniqueName(xNameAccessDatabaseContext, sFilename,sal_False); + OUString sDatabaseName = ::dbtools::createUniqueName(xDatabaseContext, sFilename,sal_False); xDatabaseContext->registerObject(sDatabaseName, xDatasource); } diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 195776f3e49f..de16f0a1c5bf 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2438,8 +2438,7 @@ void Desktop::OpenClients() // session management try { - Reference< XSessionManagerListener > r(xSessionListener, UNO_QUERY_THROW); - r->doRestore(); + xSessionListener->doRestore(); } catch(const com::sun::star::uno::Exception& e) { diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index 9c94c01858a3..bc0f78eb63a0 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -89,17 +89,15 @@ namespace abp //............................................................. // create a new data source - Reference< XSingleServiceFactory > xFactory( xContext, UNO_QUERY ); Reference< XPropertySet > xNewDataSource; - if (xFactory.is()) - xNewDataSource = Reference< XPropertySet >( xFactory->createInstance(), UNO_QUERY ); + if (xContext.is()) + xNewDataSource = Reference< XPropertySet >( xContext->createInstance(), UNO_QUERY ); DBG_ASSERT( xNewDataSource.is(), "lcl_implCreateAndInsert: could not create a new data source!" ); //............................................................. // insert the data source into the context - Reference< XNamingService > xDynamicContext( xContext, UNO_QUERY ); - DBG_ASSERT( xDynamicContext.is(), "lcl_implCreateAndInsert: missing an interface on the context (XNamingService)!" ); - if (xDynamicContext.is()) + DBG_ASSERT( xContext.is(), "lcl_implCreateAndInsert: missing an interface on the context (XNamingService)!" ); + if (xContext.is()) { // xDynamicContext->registerObject( _rName, xNewDataSource ); _rxNewDataSource = xNewDataSource; diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index f4cfa2b7bb6c..3509dc0ca873 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -90,10 +90,10 @@ Reference< XConnection > getConnection(const OUString& _rURL) Reference< XDatabaseContext > xNamingContext = DatabaseContext::create(xContext); if (xNamingContext->hasByName(_rURL)) { - DBG_ASSERT(Reference< XNamingService > (xNamingContext, UNO_QUERY).is(), "::getDataSource : no NamingService interface on the sdb::DatabaseAccessContext !"); + DBG_ASSERT(xNamingContext.is(), "::getDataSource : no NamingService interface on the sdb::DatabaseAccessContext !"); try { - xDataSource = Reference< XDataSource > (Reference< XNamingService > (xNamingContext, UNO_QUERY)->getRegisteredObject(_rURL), UNO_QUERY); + xDataSource = Reference< XDataSource > (xNamingContext->getRegisteredObject(_rURL), UNO_QUERY); } catch (const Exception&) { diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 0937f1440454..cf199753581c 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2053,10 +2053,7 @@ namespace pcr Reference< XForm > xAsForm( m_xComponent, UNO_QUERY ); if ( xAsForm.is() ) { - Reference< XChild > xFormAsChild( xAsForm, UNO_QUERY ); - Reference< XForm > xFormsParent; - if ( xFormAsChild.is() ) - xFormsParent = xFormsParent.query( xFormAsChild->getParent() ); + Reference< XForm > xFormsParent = xFormsParent.query( xAsForm->getParent() ); m_bComponentIsSubForm = xFormsParent.is(); } diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx index 6738b66ae02c..ae513295893f 100644 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -686,8 +686,7 @@ namespace pcr Reference< XTableRows > xRows( xColsRows->getRows(), UNO_SET_THROW ); sal_Int32 nNewAnchorRow = lcl_getLowerBoundRowOrColumn( xRows.get(), true, aRelativePosition ); - Reference< XCellRange > xSheetCellRange( xSheet, UNO_QUERY_THROW ); - Any aNewAnchorCell( xSheetCellRange->getCellByPosition( nNewAnchorCol, nNewAnchorRow ) ); + Any aNewAnchorCell( xSheet->getCellByPosition( nNewAnchorCol, nNewAnchorRow ) ); m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, aNewAnchorCell ); } break; diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index 2fdf007266d1..079e6f0b8a15 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -363,8 +363,7 @@ namespace pcr String FormLinkDialog::getFormDataSourceType( const Reference< XPropertySet >& _rxForm ) const SAL_THROW(()) { String sReturn; - Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY ); - if ( !xFormProps.is() ) + if ( !_rxForm.is() ) return sReturn; try @@ -372,8 +371,8 @@ namespace pcr sal_Int32 nCommandType = CommandType::COMMAND; OUString sCommand; - xFormProps->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nCommandType; - xFormProps->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand; + _rxForm->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nCommandType; + _rxForm->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand; if ( ( nCommandType == CommandType::TABLE ) || ( nCommandType == CommandType::QUERY ) @@ -398,16 +397,15 @@ namespace pcr { WaitObject aWaitCursor( const_cast< FormLinkDialog* >( this ) ); - Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY ); - OSL_ENSURE( xFormProps.is(), "FormLinkDialog::getFormFields: invalid form!" ); + OSL_ENSURE( _rxForm.is(), "FormLinkDialog::getFormFields: invalid form!" ); sal_Int32 nCommandType = CommandType::COMMAND; - xFormProps->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nCommandType; - xFormProps->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand; + _rxForm->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nCommandType; + _rxForm->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand; Reference< XConnection > xConnection; - ensureFormConnection( xFormProps, xConnection ); + ensureFormConnection( _rxForm, xConnection ); _rNames = ::dbtools::getFieldNamesByCommandDescriptor( xConnection, diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index c82dbfd9e353..e4e1ae13707c 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -7226,8 +7226,7 @@ void CreateTableRows( Reference< XTableRows > xTableRows, const std::set< sal_In std::set< sal_Int32 >::const_iterator aIter( rRows.begin() ); sal_Int32 nLastPosition( *aIter ); - Reference< XIndexAccess > xIndexAccess( xTableRows, UNO_QUERY_THROW ); - for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ ) + for ( sal_Int32 n = 0; n < xTableRows->getCount(); n++ ) { sal_Int32 nHeight; if ( ++aIter != rRows.end() ) @@ -7239,7 +7238,7 @@ void CreateTableRows( Reference< XTableRows > xTableRows, const std::set< sal_In nHeight = nTableBottom - nLastPosition; static const OUString sWidth( "Height" ); - Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW ); + Reference< XPropertySet > xPropSet( xTableRows->getByIndex( n ), UNO_QUERY_THROW ); xPropSet->setPropertyValue( sWidth, Any( nHeight ) ); } } @@ -7251,8 +7250,7 @@ void CreateTableColumns( Reference< XTableColumns > xTableColumns, const std::se std::set< sal_Int32 >::const_iterator aIter( rColumns.begin() ); sal_Int32 nLastPosition( *aIter ); - Reference< XIndexAccess > xIndexAccess( xTableColumns, UNO_QUERY_THROW ); - for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ ) + for ( sal_Int32 n = 0; n < xTableColumns->getCount(); n++ ) { sal_Int32 nWidth; if ( ++aIter != rColumns.end() ) @@ -7264,7 +7262,7 @@ void CreateTableColumns( Reference< XTableColumns > xTableColumns, const std::se nWidth = nTableRight - nLastPosition; static const OUString sWidth( "Width" ); - Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW ); + Reference< XPropertySet > xPropSet( xTableColumns->getByIndex( n ), UNO_QUERY_THROW ); xPropSet->setPropertyValue( sWidth, Any( nWidth ) ); } } @@ -7432,7 +7430,6 @@ void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable >& xTabl } break; } - Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW ); std::vector< sal_Int32 >::const_iterator aIter( vPositions.begin() ); while( aIter != vPositions.end() ) { @@ -7447,7 +7444,7 @@ void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable >& xTabl sal_Int32 nFlags = *aIter &~0xffffff; sal_Int32 nRow = nPosition / nColumns; sal_Int32 nColumn = nPosition - ( nRow * nColumns ); - Reference< XCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ) ); + Reference< XCell > xCell( xTable->getCellByPosition( nColumn, nRow ) ); Reference< XPropertySet > xPropSet( xCell, UNO_QUERY_THROW ); if ( nFlags & LinePositionLeft ) @@ -7498,10 +7495,8 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab Reference< XTable > xTable( pTable->getTable() ); try { - Reference< XColumnRowRange > xColumnRowRange( xTable, UNO_QUERY_THROW ); - - CreateTableRows( xColumnRowRange->getRows(), aRows, pGroup->GetSnapRect().Bottom() ); - CreateTableColumns( xColumnRowRange->getColumns(), aColumns, pGroup->GetSnapRect().Right() ); + CreateTableRows( xTable->getRows(), aRows, pGroup->GetSnapRect().Bottom() ); + CreateTableColumns( xTable->getColumns(), aColumns, pGroup->GetSnapRect().Right() ); sal_Int32 nCellCount = aRows.size() * aColumns.size(); sal_Int32 *pMergedCellIndexTable = new sal_Int32[ nCellCount ]; @@ -7521,8 +7516,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab sal_Int32 nColumnCount = 0; if ( GetCellPosition( pObj, aRows, aColumns, nTableIndex, nRow, nRowCount, nColumn, nColumnCount ) ) { - Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW ); - Reference< XCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ) ); + Reference< XCell > xCell( xTable->getCellByPosition( nColumn, nRow ) ); ApplyCellAttributes( pObj, xCell ); diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 27a7125b0e61..d923b499927a 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -1216,8 +1216,7 @@ void SVGFilter::implExportTextShapeIndex() { OUString sTextShapeIdList = mTextShapeIdListMap[xDrawPage].trim(); - Reference< XInterface > xRef( xDrawPage, UNO_QUERY ); - const OUString& rPageId = implGetValidIDFromInterface( xRef ); + const OUString& rPageId = implGetValidIDFromInterface( xDrawPage ); if( !rPageId.isEmpty() && !sTextShapeIdList.isEmpty() ) { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, rPageId ); @@ -1770,8 +1769,7 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape ) } - Reference< XInterface > xRef( rxShape, UNO_QUERY ); - const OUString& rShapeId = implGetValidIDFromInterface( xRef ); + const OUString& rShapeId = implGetValidIDFromInterface( rxShape ); if( !rShapeId.isEmpty() ) { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", rShapeId ); @@ -1836,10 +1834,8 @@ sal_Bool SVGFilter::implCreateObjects() mCreateOjectsCurrentMasterPage = xMasterPage; implCreateObjectsFromBackground( xMasterPage ); - Reference< XShapes > xShapes( xMasterPage, UNO_QUERY ); - - if( xShapes.is() ) - implCreateObjectsFromShapes( xMasterPage, xShapes ); + if( xMasterPage.is() ) + implCreateObjectsFromShapes( xMasterPage, xMasterPage ); } } @@ -1871,10 +1867,9 @@ sal_Bool SVGFilter::implCreateObjects() } } #endif - Reference< XShapes > xShapes( xDrawPage, UNO_QUERY ); - if( xShapes.is() ) - implCreateObjectsFromShapes( xDrawPage, xShapes ); + if( xDrawPage.is() ) + implCreateObjectsFromShapes( xDrawPage, xDrawPage ); } } return sal_True; @@ -1956,8 +1951,7 @@ sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XDrawPage > & r { // We create a map of text shape ids. implRegisterInterface( rxShape ); - Reference< XInterface > xRef( rxShape, UNO_QUERY ); - const OUString& rShapeId = implGetValidIDFromInterface( xRef ); + const OUString& rShapeId = implGetValidIDFromInterface( rxShape ); if( !rShapeId.isEmpty() ) { mTextShapeIdListMap[rxPage] += rShapeId; diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 410215a499aa..d1f3c4a6e39a 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -844,8 +844,7 @@ sal_Bool SVGTextWriter::createParagraphEnumeration() { if( mrTextShape.is() ) { - Reference< XInterface > xRef( mrTextShape, UNO_QUERY ); - msShapeId = implGetValidIDFromInterface( xRef ); + msShapeId = implGetValidIDFromInterface( mrTextShape ); Reference< XEnumerationAccess > xEnumerationAccess( mrTextShape, UNO_QUERY_THROW ); Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW ); @@ -1009,8 +1008,7 @@ sal_Bool SVGTextWriter::nextParagraph() return sal_False; } - Reference< XInterface > xRef( xTextContent, UNO_QUERY ); - const OUString& rParagraphId = implGetValidIDFromInterface( xRef ); + const OUString& rParagraphId = implGetValidIDFromInterface( xTextContent ); if( !rParagraphId.isEmpty() ) { mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); @@ -1118,8 +1116,7 @@ sal_Bool SVGTextWriter::nextTextPortion() { implRegisterInterface( xPortionTextRange ); - Reference< XInterface > xRef( xPortionTextRange, UNO_QUERY ); - const OUString& rTextPortionId = implGetValidIDFromInterface( xRef ); + const OUString& rTextPortionId = implGetValidIDFromInterface( xPortionTextRange ); if( !rTextPortionId.isEmpty() ) { msHyperlinkIdList += rTextPortionId; @@ -1575,8 +1572,7 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos, implRegisterInterface( mrCurrentTextParagraph ); // Add the needed info to the BulletListItemMap - Reference< XInterface > xRef( mrCurrentTextParagraph, UNO_QUERY ); - OUString sId = implGetValidIDFromInterface( xRef ); + OUString sId = implGetValidIDFromInterface( mrCurrentTextParagraph ); if( !sId.isEmpty() ) { sId += ".bp"; @@ -1595,8 +1591,7 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos, } } - Reference< XInterface > xRef( mrCurrentTextPortion, UNO_QUERY ); - const OUString& rTextPortionId = implGetValidIDFromInterface( xRef ); + const OUString& rTextPortionId = implGetValidIDFromInterface( mrCurrentTextPortion ); if( !rTextPortionId.isEmpty() ) { mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rTextPortionId ); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 099aec7933d6..807393253b0b 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -630,11 +630,10 @@ void XMLFilterTestDialog::import( const OUString& rURL ) aOutputFile.open( osl_File_OpenFlag_Write ); Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) ); - Reference< XActiveDataSource > xDocSrc( xWriter, UNO_QUERY ); - xDocSrc->setOutputStream( xOS ); + xWriter->setOutputStream( xOS ); Sequence< OUString > aFilterUserData( m_pFilterInfo->getFilterUserData() ); - xImporter->importer( aSourceData, Reference<XDocumentHandler>(xWriter, UNO_QUERY_THROW), aFilterUserData ); + xImporter->importer( aSourceData, xWriter, aFilterUserData ); } displayXMLFile( aTempFileURL ); diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index ca3142566205..fc3fd0f5356f 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -867,8 +867,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) // and to be a little bit more compatible we make the following section skippable { - Reference< XDataOutputStream > xOut(_rxOutStream, UNO_QUERY); - OStreamSection aDownCompat(xOut); + OStreamSection aDownCompat(_rxOutStream); // a sub version within the skippable block _rxOutStream->writeShort(0x0000); @@ -881,7 +880,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) } { - OStreamSection aDownCompat2(xOut); + OStreamSection aDownCompat2(_rxOutStream); switch (aEffectiveValue.getValueType().getTypeClass()) { case TypeClass_STRING: @@ -943,8 +942,7 @@ void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream) thr if (nVersion == 0x0003) { // since version 3 there is a "skippable" block at this position - Reference< XDataInputStream > xIn(_rxInStream, UNO_QUERY); - OStreamSection aDownCompat(xIn); + OStreamSection aDownCompat(_rxInStream); sal_Int16 nSubVersion = _rxInStream->readShort(); (void)nSubVersion; @@ -952,7 +950,7 @@ void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream) thr // version 0 and higher : the "effective value" property Any aEffectiveValue; { - OStreamSection aDownCompat2(xIn); + OStreamSection aDownCompat2(_rxInStream); switch (_rxInStream->readShort()) { case 0: // String diff --git a/forms/source/component/navigationbar.cxx b/forms/source/component/navigationbar.cxx index 2138caf56b41..9d1ac5fc40dc 100644 --- a/forms/source/component/navigationbar.cxx +++ b/forms/source/component/navigationbar.cxx @@ -225,14 +225,13 @@ namespace frm { // open a section for compatibility - if we later on write additional members, // then older versions can skip them - Reference< XDataOutputStream > xDataOut( _rxOutStream, UNO_QUERY ); - OStreamSection aEnsureBlockCompat( xDataOut ); + OStreamSection aEnsureBlockCompat( _rxOutStream ); // base class OControlModel::write( _rxOutStream ); { - OStreamSection aEnsureCompat( xDataOut ); + OStreamSection aEnsureCompat( _rxOutStream ); // determine which properties are not void and need to be written sal_Int32 nNonVoids = 0; if ( m_aTabStop.hasValue() ) @@ -270,7 +269,7 @@ namespace frm } { - OStreamSection aEnsureCompat( xDataOut ); + OStreamSection aEnsureCompat( _rxOutStream ); ::comphelper::operator<<( _rxOutStream, getFont() ); } @@ -297,14 +296,13 @@ namespace frm //------------------------------------------------------------------ void SAL_CALL ONavigationBarModel::read( const Reference< XObjectInputStream >& _rxInStream ) throw ( IOException, RuntimeException ) { - Reference< XDataInputStream > xDataIn( _rxInStream, UNO_QUERY ); - OStreamSection aEnsureBlockCompat( xDataIn ); + OStreamSection aEnsureBlockCompat( _rxInStream ); // base class OControlModel::read( _rxInStream ); { - OStreamSection aEnsureCompat( xDataIn ); + OStreamSection aEnsureCompat( _rxInStream ); // determine which properties were non-void sal_Int32 nNonVoids = _rxInStream->readLong( ); @@ -331,7 +329,7 @@ namespace frm } { - OStreamSection aEnsureCompat( xDataIn ); + OStreamSection aEnsureCompat( _rxInStream ); FontDescriptor aFont; ::comphelper::operator>>( _rxInStream, aFont ); setFont( aFont ); diff --git a/forms/source/component/scrollbar.cxx b/forms/source/component/scrollbar.cxx index fbab6e7ad2e0..e0ecb47fd5a5 100644 --- a/forms/source/component/scrollbar.cxx +++ b/forms/source/component/scrollbar.cxx @@ -250,7 +250,7 @@ namespace frm OBoundControlModel::write( _rxOutStream ); ::osl::MutexGuard aGuard( m_aMutex ); - OStreamSection aSection( Reference< XDataOutputStream >( _rxOutStream, UNO_QUERY ) ); + OStreamSection aSection( _rxOutStream ); // version _rxOutStream->writeShort( 0x0001 ); @@ -268,7 +268,7 @@ namespace frm // version { - OStreamSection aSection( Reference< XDataInputStream >( _rxInStream, UNO_QUERY ) ); + OStreamSection aSection( _rxInStream ); sal_uInt16 nVersion = _rxInStream->readShort(); if ( nVersion == 0x0001 ) diff --git a/forms/source/component/spinbutton.cxx b/forms/source/component/spinbutton.cxx index 1faa874f7bab..70237f38b09d 100644 --- a/forms/source/component/spinbutton.cxx +++ b/forms/source/component/spinbutton.cxx @@ -206,7 +206,7 @@ namespace frm OBoundControlModel::write( _rxOutStream ); ::osl::MutexGuard aGuard( m_aMutex ); - OStreamSection aSection( Reference< XDataOutputStream >( _rxOutStream, UNO_QUERY ) ); + OStreamSection aSection( _rxOutStream ); // version _rxOutStream->writeShort( 0x0001 ); @@ -224,7 +224,7 @@ namespace frm // version { - OStreamSection aSection( Reference< XDataInputStream >( _rxInStream, UNO_QUERY ) ); + OStreamSection aSection( _rxInStream ); sal_uInt16 nVersion = _rxInStream->readShort(); if ( nVersion == 0x0001 ) diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index 3a1361db17cc..9996a7d7b729 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -262,8 +262,7 @@ void OInterfaceContainer::disposing() // revoke event knittings if ( m_xEventAttacher.is() ) { - Reference< XInterface > xIfc( xSet, UNO_QUERY ); - m_xEventAttacher->detach( i - 1, xIfc ); + m_xEventAttacher->detach( i - 1, xSet ); m_xEventAttacher->removeEntry( i - 1 ); } diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx index 60863373746e..8a27b2efe4fe 100644 --- a/forms/source/xforms/model.cxx +++ b/forms/source/xforms/model.cxx @@ -159,7 +159,7 @@ EvaluationContext Model::getEvaluationContext() xElement = Reference<XNode>( xInstance->createElement( "instanceData" ), UNO_QUERY_THROW ); - Reference<XNode>( xInstance, UNO_QUERY_THROW)->appendChild( xElement ); + xInstance->appendChild( xElement ); } OSL_ENSURE( xElement.is() && diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx index 39c269087710..7e28623c5a2f 100644 --- a/forms/source/xforms/model_ui.cxx +++ b/forms/source/xforms/model_ui.cxx @@ -669,7 +669,7 @@ Model::XNode_t Model::renameNode( const XNode_t& xNode, // replace node Reference<XNode> xParent = xNode->getParentNode(); xParent->removeChild( xNode ); - xNew = xParent->appendChild( Reference<XNode>( xAttr, UNO_QUERY ) ); + xNew = xParent->appendChild( xAttr ); } else { @@ -790,9 +790,7 @@ static OUString lcl_serializeForDisplay( const Reference<XNodeList>& xNodes ) Reference<XDocument> xDocument( getDocumentBuilder()->newDocument() ); Reference<XDocumentFragment> xFragment( xDocument->createDocumentFragment() ); - Reference<XNode> xNode( xFragment, UNO_QUERY ); OSL_ENSURE( xFragment.is(), "xFragment" ); - OSL_ENSURE( xNode.is(), "xNode" ); sal_Int32 nAttributeNodes = 0; @@ -824,7 +822,7 @@ static OUString lcl_serializeForDisplay( const Reference<XNodeList>& xNodes ) } // append node - xNode->appendChild( xDocument->importNode( xCurrent, sal_True ) ); + xFragment->appendChild( xDocument->importNode( xCurrent, sal_True ) ); } OSL_ENSURE( ( nAttributeNodes == 0 ) || ( nAttributeNodes == nLength ), "lcl_serializeForDisplay: mixed attribute and non-attribute nodes?" ); diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index a9dd5348627e..cc4f53ccf48e 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -666,7 +666,7 @@ Reference< XDocumentFragment > Submission::createSubmissionDocument(const Refere aListItem = Reference< XNode >( (Reference< XDocument >(aListItem, UNO_QUERY))->getDocumentElement(), UNO_QUERY); // copy relevant nodes from instance into fragment - _cloneNodes(*getModelImpl(), Reference< XNode >(aFragment, UNO_QUERY), aListItem, bRemoveWSNodes); + _cloneNodes(*getModelImpl(), aFragment, aListItem, bRemoveWSNodes); } } return aFragment; diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index 18da787de5f0..24391c062cd2 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -85,8 +85,8 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con Reference< XElement > oldRoot = aDocument->getDocumentElement(); Reference< XElement > newRoot = aNewDocument->getDocumentElement(); - Reference< XNode > aImportedNode = aDocument->importNode(Reference< XNode >(newRoot, UNO_QUERY_THROW), sal_True); - Reference< XNode >(aDocument, UNO_QUERY_THROW)->replaceChild(aImportedNode, Reference< XNode >(oldRoot, UNO_QUERY_THROW)); + Reference< XNode > aImportedNode = aDocument->importNode(newRoot, sal_True); + aDocument->replaceChild(aImportedNode, oldRoot); return CSubmission::SUCCESS; } else { return CSubmission::UNKNOWN_ERROR; 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; } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 0c75daad2c5a..65cf4b7b83a6 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -269,7 +269,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) OUString aOldModuleIdentifier( aModuleIdentifier ); try { - aModuleIdentifier = m_xModuleManager->identify( Reference< XInterface >( xFrame, UNO_QUERY ) ); + aModuleIdentifier = m_xModuleManager->identify( xFrame ); } catch( const Exception& ) {} diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index f18152b5ebea..5f03d48f4555 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -216,7 +216,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) : // get dispatch provider Reference<XDesktop2> xDesktop = Desktop::create( comphelper::getProcessComponentContext() ); - mxDesktopDispatchProvider = Reference< XDispatchProvider >( xDesktop, UNO_QUERY ); + mxDesktopDispatchProvider = xDesktop; maWriterButton.SetHelpId( ".HelpId:StartCenter:WriterButton" ); maCalcButton.SetHelpId( ".HelpId:StartCenter:CalcButton" ); diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index f4d6883cd6f9..5cf8482ced7e 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -243,8 +243,7 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, OUString aResURLPrefix( aBuf.makeStringAndClear() ); UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap; - Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY ); - Sequence< OUString > aUIElementNames = xNameAccess->getElementNames(); + Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames(); for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ ) { UIElementData aUIElementData; @@ -513,7 +512,6 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData( UIElementDataHashMap::iterator pIter = rHashMap.begin(); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY ); sal_Int16 nType = rUserElementType.nElementType; @@ -533,7 +531,7 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData( ConfigurationEvent aReplaceEvent; aReplaceEvent.ResourceURL = rElement.aResourceURL; aReplaceEvent.Accessor <<= xThis; - aReplaceEvent.Source = xIfac; + aReplaceEvent.Source = xThis; aReplaceEvent.ReplacedElement <<= xOldSettings; aReplaceEvent.Element <<= rElement.xSettings; @@ -550,7 +548,7 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData( ConfigurationEvent aEvent; aEvent.ResourceURL = rElement.aResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.Element <<= rElement.xSettings; rRemoveNotifyContainer.push_back( aEvent ); @@ -583,7 +581,6 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); sal_Int16 nType = rUserElementType.nElementType; while ( pIter != rHashMap.end() ) @@ -602,7 +599,7 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( aReplaceEvent.ResourceURL = rElement.aResourceURL; aReplaceEvent.Accessor <<= xThis; - aReplaceEvent.Source = xIfac; + aReplaceEvent.Source = xThis; aReplaceEvent.ReplacedElement <<= xOldSettings; aReplaceEvent.Element <<= rElement.xSettings; rReplaceNotifyContainer.push_back( aReplaceEvent ); @@ -620,7 +617,7 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( aReplaceEvent.ResourceURL = rElement.aResourceURL; aReplaceEvent.Accessor <<= xThis; - aReplaceEvent.Source = xIfac; + aReplaceEvent.Source = xThis; aReplaceEvent.ReplacedElement <<= xOldSettings; aReplaceEvent.Element <<= rElement.xSettings; rReplaceNotifyContainer.push_back( aReplaceEvent ); @@ -637,7 +634,7 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( aRemoveEvent.ResourceURL = rElement.aResourceURL; aRemoveEvent.Accessor <<= xThis; - aRemoveEvent.Source = xIfac; + aRemoveEvent.Source = xThis; aRemoveEvent.Element <<= rElement.xSettings; rRemoveNotifyContainer.push_back( aRemoveEvent ); @@ -905,8 +902,7 @@ void SAL_CALL ModuleUIConfigurationManager::reset() throw (::com::sun::star::uno if ( xSubStorage.is() ) { bool bCommitSubStorage( false ); - Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY ); - Sequence< OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames(); + Sequence< OUString > aUIElementStreamNames = xSubStorage->getElementNames(); for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ ) { xSubStorage->removeElement( aUIElementStreamNames[j] ); @@ -1115,11 +1111,9 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la // Create event to notify listener about replaced element settings ConfigurationEvent aEvent; - Reference< XInterface > xIfac( xThis, UNO_QUERY ); - aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.ReplacedElement <<= xOldSettings; aEvent.Element <<= pDataSettings->xSettings; @@ -1161,14 +1155,13 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la rElements.insert( UIElementDataHashMap::value_type( ResourceURL, aUIElementData )); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about replaced element settings ConfigurationEvent aEvent; aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.ReplacedElement <<= pDataSettings->xSettings; aEvent.Element <<= aUIElementData.xSettings; @@ -1221,7 +1214,6 @@ throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException rElementType.bModified = true; Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Check if we have settings in the default layer which replaces the user-defined one! UIElementData* pDefaultDataSettings = impl_findUIElementData( ResourceURL, nElementType ); @@ -1232,7 +1224,7 @@ throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.Element <<= xRemovedSettings; aEvent.ReplacedElement <<= pDefaultDataSettings->xSettings; @@ -1247,7 +1239,7 @@ throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.Element <<= xRemovedSettings; aGuard.unlock(); @@ -1305,14 +1297,13 @@ throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about removed element settings ConfigurationEvent aEvent; aEvent.ResourceURL = NewResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.Element <<= xInsertSettings; aGuard.unlock(); @@ -1378,7 +1369,7 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManage lArgs[0] <<= aProp; xInit->initialize(lArgs); - m_xModuleAcceleratorManager = Reference< XInterface >( xManager, UNO_QUERY ); + m_xModuleAcceleratorManager = xManager; } return m_xModuleAcceleratorManager; diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index c32e2d90c452..51ee1de325f2 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -190,8 +190,7 @@ void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementTy OUString aResURLPrefix( aBuf.makeStringAndClear() ); UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap; - Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY ); - Sequence< OUString > aUIElementNames = xNameAccess->getElementNames(); + Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames(); for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ ) { UIElementData aUIElementData; @@ -443,7 +442,6 @@ void UIConfigurationManager::impl_resetElementTypeData( UIElementDataHashMap::iterator pIter = rHashMap.begin(); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling // our listeners! @@ -456,7 +454,7 @@ void UIConfigurationManager::impl_resetElementTypeData( ConfigurationEvent aEvent; aEvent.ResourceURL = rElement.aResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.Element <<= rElement.xSettings; rRemoveNotifyContainer.push_back( aEvent ); @@ -483,10 +481,8 @@ void UIConfigurationManager::impl_reloadElementTypeData( UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap; UIElementDataHashMap::iterator pIter = rHashMap.begin(); Reference< XStorage > xElementStorage( rDocElementType.xStorage ); - Reference< XNameAccess > xElementNameAccess( xElementStorage, UNO_QUERY ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); sal_Int16 nType = rDocElementType.nElementType; while ( pIter != rHashMap.end() ) @@ -494,7 +490,7 @@ void UIConfigurationManager::impl_reloadElementTypeData( UIElementData& rElement = pIter->second; if ( rElement.bModified ) { - if ( xElementNameAccess->hasByName( rElement.aName )) + if ( xElementStorage->hasByName( rElement.aName )) { // Replace settings with data from user layer Reference< XIndexAccess > xOldSettings( rElement.xSettings ); @@ -505,7 +501,7 @@ void UIConfigurationManager::impl_reloadElementTypeData( aReplaceEvent.ResourceURL = rElement.aResourceURL; aReplaceEvent.Accessor <<= xThis; - aReplaceEvent.Source = xIfac; + aReplaceEvent.Source = xThis; aReplaceEvent.ReplacedElement <<= xOldSettings; aReplaceEvent.Element <<= rElement.xSettings; rReplaceNotifyContainer.push_back( aReplaceEvent ); @@ -519,7 +515,7 @@ void UIConfigurationManager::impl_reloadElementTypeData( aRemoveEvent.ResourceURL = rElement.aResourceURL; aRemoveEvent.Accessor <<= xThis; - aRemoveEvent.Source = xIfac; + aRemoveEvent.Source = xThis; aRemoveEvent.Element <<= rElement.xSettings; rRemoveNotifyContainer.push_back( aRemoveEvent ); @@ -694,8 +690,7 @@ void SAL_CALL UIConfigurationManager::reset() throw (::com::sun::star::uno::Runt if ( xSubStorage.is() ) { bool bCommitSubStorage( false ); - Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY ); - Sequence< OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames(); + Sequence< OUString > aUIElementStreamNames = xSubStorage->getElementNames(); for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ ) { xSubStorage->removeElement( aUIElementStreamNames[j] ); @@ -895,11 +890,10 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la // Create event to notify listener about replaced element settings ConfigurationEvent aEvent; - Reference< XInterface > xIfac( xThis, UNO_QUERY ); aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.ReplacedElement <<= xOldSettings; aEvent.Element <<= pDataSettings->xSettings; @@ -950,14 +944,13 @@ throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException rElementType.bModified = true; Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about removed element settings ConfigurationEvent aEvent; aEvent.ResourceURL = ResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.Element <<= xRemovedSettings; aGuard.unlock(); @@ -1027,14 +1020,13 @@ throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about removed element settings ConfigurationEvent aEvent; aEvent.ResourceURL = NewResourceURL; aEvent.Accessor <<= xThis; - aEvent.Source = xIfac; + aEvent.Source = xThis; aEvent.Element <<= xInsertSettings; aGuard.unlock(); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 05f15ba3fb2c..fdbb17ba8634 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1969,7 +1969,7 @@ IMPL_LINK( ToolBarManager, MenuSelect, Menu*, pMenu ) try { xItemContainer->replaceByIndex( i, makeAny( aProp )); - xUIElementSettings->setSettings( Reference< XIndexAccess >( xItemContainer, UNO_QUERY )); + xUIElementSettings->setSettings( xItemContainer ); Reference< XPropertySet > xPropSet( xUIElementSettings, UNO_QUERY ); if ( xPropSet.is() ) { diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index 6cf90ce300e8..ef24e5567ae0 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -147,7 +147,7 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL if ( !bHasSettings ) { - OUString aModuleIdentifier = _xModuleManager->identify( Reference< XInterface >( xFrame, UNO_QUERY )); + OUString aModuleIdentifier = _xModuleManager->identify( xFrame ); if ( !aModuleIdentifier.isEmpty() ) { Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index 8669247b9b86..cf3237ac76eb 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -436,7 +436,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l try { if ( xFrame.is() && xManager.is() ) - aModuleId = xManager->identify( Reference< XInterface >( xFrame, UNO_QUERY ) ); + aModuleId = xManager->identify( xFrame ); Reference< XUIElementFactory > xUIElementFactory = getFactory( ResourceURL, aModuleId ); if ( xUIElementFactory.is() ) diff --git a/framework/source/xml/imagesconfiguration.cxx b/framework/source/xml/imagesconfiguration.cxx index 5325dcb512f8..31bd8e6df753 100644 --- a/framework/source/xml/imagesconfiguration.cxx +++ b/framework/source/xml/imagesconfiguration.cxx @@ -90,8 +90,7 @@ sal_Bool ImagesConfiguration::StoreImages( try { - Reference< XDocumentHandler > xHandler( xWriter, UNO_QUERY_THROW ); - OWriteImagesDocumentHandler aWriteImagesDocumentHandler( rItems, xHandler ); + OWriteImagesDocumentHandler aWriteImagesDocumentHandler( rItems, xWriter ); aWriteImagesDocumentHandler.WriteImagesDocument(); return sal_True; } diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index e36ecf1def58..fde8d67d9009 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/chart/XAxisZSupplier.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/RelativeSize.hpp> #include <com/sun/star/chart2/XTitle2.hpp> @@ -88,7 +89,7 @@ void TitleLayoutInfo::convertTitlePos( ConverterRoot& rRoot, const Reference< cs if( mxTitle.is() && mpGetShape ) try { // try to get the title shape - Reference< XShape > xTitleShape( mpGetShape( rxChart1Doc ), UNO_SET_THROW ); + Reference< XShape > xTitleShape = mpGetShape( rxChart1Doc ); // get title rotation angle, needed for correction of position of top-left edge double fAngle = mxTitle->getTextRotation(); // convert the position @@ -181,8 +182,7 @@ ConverterData::ConverterData( // lock the model to suppress internal updates during conversion try { - Reference< XModel > xModel( mxDoc, UNO_QUERY_THROW ); - xModel->lockControllers(); + mxDoc->lockControllers(); } catch( Exception& ) { @@ -202,8 +202,7 @@ ConverterData::~ConverterData() // unlock the model try { - Reference< XModel > xModel( mxDoc, UNO_QUERY_THROW ); - xModel->unlockControllers(); + mxDoc->unlockControllers(); } catch( Exception& ) { diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx index 95f5e24f7fb6..bf566bae218e 100644 --- a/oox/source/drawingml/textfield.cxx +++ b/oox/source/drawingml/textfield.cxx @@ -138,8 +138,7 @@ sal_Int32 TextField::insertAt( try { PropertyMap aioBulletList; - Reference< XTextRange > xStart( xAt, UNO_QUERY ); - Reference< XPropertySet > xProps( xStart, UNO_QUERY); + Reference< XPropertySet > xProps( xAt, UNO_QUERY); PropertySet aPropSet( xProps ); maTextParagraphProperties.pushToPropSet( &rFilterBase, xProps, aioBulletList, NULL, sal_True, 18 ); @@ -168,15 +167,15 @@ sal_Int32 TextField::insertAt( } else { - xText->insertString( xStart, " ", sal_False ); + xText->insertString( xAt, " ", sal_False ); } - xText->insertTextContent( xStart, xContent, sal_False ); + xText->insertTextContent( xAt, xContent, sal_False ); } } } else { - xText->insertString( xStart, getText(), sal_False ); + xText->insertString( xAt, getText(), sal_False ); } } catch( const Exception& ) diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx index 4679858f0bc4..c4e82b31ff04 100644 --- a/oox/source/drawingml/textparagraph.cxx +++ b/oox/source/drawingml/textparagraph.cxx @@ -51,7 +51,6 @@ void TextParagraph::insertAt( { try { sal_Int32 nParagraphSize = 0; - Reference< XTextRange > xStart( xAt, UNO_QUERY ); sal_Int16 nLevel = maProperties.getLevel(); @@ -72,14 +71,14 @@ void TextParagraph::insertAt( if( !bFirst ) { - xText->insertControlCharacter( xStart, ControlCharacter::APPEND_PARAGRAPH, sal_False ); + xText->insertControlCharacter( xAt, ControlCharacter::APPEND_PARAGRAPH, sal_False ); xAt->gotoEnd( sal_True ); } sal_Int32 nCharHeight = 0; if ( maRuns.begin() == maRuns.end() ) { - PropertySet aPropSet( xStart ); + PropertySet aPropSet( xAt ); TextCharacterProperties aTextCharacterProps( aTextCharacterStyle ); aTextCharacterProps.assignUsed( maEndProperties ); @@ -103,7 +102,7 @@ void TextParagraph::insertAt( xAt->gotoEnd( sal_True ); PropertyMap aioBulletList; - Reference< XPropertySet > xProps( xStart, UNO_QUERY); + Reference< XPropertySet > xProps( xAt, UNO_QUERY); float fCharacterSize = nCharHeight > 0 ? GetFontHeight( nCharHeight ) : 18; if ( pTextParagraphStyle.get() ) { diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx index 6193cf0c244b..c4648c205d8d 100644 --- a/oox/source/drawingml/textrun.cxx +++ b/oox/source/drawingml/textrun.cxx @@ -116,7 +116,7 @@ sal_Int32 TextRun::insertAt( if ( nIndex >= getText().getLength() ) break; - xStart = Reference< XTextRange >( xAt, UNO_QUERY ); + xStart = xAt; aPropSet = PropertySet( xStart ); aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); } @@ -136,8 +136,7 @@ sal_Int32 TextRun::insertAt( PropertySet aFieldProps( xField ); aFieldProps.setProperties( maTextCharacterProperties.maHyperlinkPropertyMap ); aFieldProps.setProperty( PROP_Representation, getText() ); - Reference< XTextContent > xContent( xField, UNO_QUERY); - xText->insertTextContent( xStart, xContent, sal_False ); + xText->insertTextContent( xStart, xField, sal_False ); xTextFieldCursor->gotoEnd( sal_True ); @@ -146,8 +145,7 @@ sal_Int32 TextRun::insertAt( if ( !maTextCharacterProperties.moUnderline.has() ) aTextCharacterProps.moUnderline.set( XML_sng ); - Reference< XTextRange > xFieldRange( xTextFieldCursor, UNO_QUERY ); - PropertySet aFieldTextPropSet( xFieldRange ); + PropertySet aFieldTextPropSet( xTextFieldCursor ); aTextCharacterProps.pushToPropSet( aFieldTextPropSet, rFilterBase ); oox::core::TextField aTextField; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index b0831125c346..6f28d9286066 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -843,7 +843,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs Reference< XTextField > rXTextField; GET( rXTextField, TextField ); if( rXTextField.is() ) - rXPropSet.set( rXTextField, UNO_QUERY ); + rRun.set( rXTextField, UNO_QUERY ); } // field properties starts here diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 75a5b596ea91..c487d2dddf36 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1178,9 +1178,8 @@ void ShapeExport::WriteTable( Reference< XShape > rXShape ) mpFS->startElementNS( XML_a, XML_tbl, FSEND ); mpFS->singleElementNS( XML_a, XML_tblPr, FSEND ); - Reference< XColumnRowRange > xColumnRowRange( xTable, UNO_QUERY_THROW ); - Reference< container::XIndexAccess > xColumns( xColumnRowRange->getColumns(), UNO_QUERY_THROW ); - Reference< container::XIndexAccess > xRows( xColumnRowRange->getRows(), UNO_QUERY_THROW ); + Reference< container::XIndexAccess > xColumns( xTable->getColumns(), UNO_QUERY_THROW ); + Reference< container::XIndexAccess > xRows( xTable->getRows(), UNO_QUERY_THROW ); sal_uInt16 nRowCount = static_cast< sal_uInt16 >( xRows->getCount() ); sal_uInt16 nColumnCount = static_cast< sal_uInt16 >( xColumns->getCount() ); @@ -1197,7 +1196,6 @@ void ShapeExport::WriteTable( Reference< XShape > rXShape ) mpFS->endElementNS( XML_a, XML_tblGrid ); - Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW ); for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ ) { Reference< XPropertySet > xRowPropSet( xRows->getByIndex( nRow ), UNO_QUERY_THROW ); @@ -1209,7 +1207,7 @@ void ShapeExport::WriteTable( Reference< XShape > rXShape ) for( sal_Int32 nColumn = 0; nColumn < nColumnCount; nColumn++ ) { - Reference< XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ), UNO_QUERY_THROW ); + Reference< XMergeableCell > xCell( xTable->getCellByPosition( nColumn, nRow ), UNO_QUERY_THROW ); if ( !xCell->isMerged() ) { mpFS->startElementNS( XML_a, XML_tc, FSEND ); diff --git a/oox/source/helper/containerhelper.cxx b/oox/source/helper/containerhelper.cxx index 0686395010e2..bc2f76ffae1c 100644 --- a/oox/source/helper/containerhelper.cxx +++ b/oox/source/helper/containerhelper.cxx @@ -124,8 +124,7 @@ OUString ContainerHelper::insertByUnusedName( OSL_ENSURE( rxNameContainer.is(), "ContainerHelper::insertByUnusedName - missing XNameContainer interface" ); // find an unused name - Reference< XNameAccess > xNameAccess( rxNameContainer, UNO_QUERY ); - OUString aNewName = getUnusedName( xNameAccess, rSuggestedName, cSeparator ); + OUString aNewName = getUnusedName( rxNameContainer, rSuggestedName, cSeparator ); // rename existing object if( bRenameOldExisting && rxNameContainer->hasByName( rSuggestedName ) ) diff --git a/package/source/manifest/ManifestWriter.cxx b/package/source/manifest/ManifestWriter.cxx index f6a0c0b65925..eaf67942ab4e 100644 --- a/package/source/manifest/ManifestWriter.cxx +++ b/package/source/manifest/ManifestWriter.cxx @@ -55,8 +55,7 @@ void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStr Reference < XWriter > xSource = Writer::create( m_xContext ); xSource->setOutputStream ( rStream ); try { - Reference < XDocumentHandler > xHandler ( xSource, UNO_QUERY ); - ManifestExport( xHandler, rSequence); + ManifestExport( xSource, rSequence); } catch( SAXException& ) { diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 63a4e907ffb0..5ee12cc0e5bd 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1905,12 +1905,11 @@ XclExpWebQueryBuffer::XclExpWebQueryBuffer( const XclExpRoot& rRoot ) Reference< XAreaLinks > xAreaLinks; aModelProp.GetProperty( xAreaLinks, SC_UNO_AREALINKS ); - Reference< XIndexAccess > xLinksIA( xAreaLinks, UNO_QUERY ); - if( !xLinksIA.is() ) return; + if( !xAreaLinks.is() ) return; - for( sal_Int32 nIndex = 0, nCount = xLinksIA->getCount(); nIndex < nCount; ++nIndex ) + for( sal_Int32 nIndex = 0, nCount = xAreaLinks->getCount(); nIndex < nCount; ++nIndex ) { - Reference< XAreaLink > xAreaLink( xLinksIA->getByIndex( nIndex ), UNO_QUERY ); + Reference< XAreaLink > xAreaLink( xAreaLinks->getByIndex( nIndex ), UNO_QUERY ); if( xAreaLink.is() ) { CellRangeAddress aDestRange( xAreaLink->getDestArea() ); diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index cb85b90d4f9c..d5cd1310e3e3 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -262,9 +262,8 @@ void XclImpChRoot::InitConversion( const Reference<XChartDocument>& xChartDoc, c mxChData->InitConversion( GetRoot(), xChartDoc, rChartRect ); // lock the model to suppress any internal updates - Reference< XModel > xModel( xChartDoc, UNO_QUERY ); - if( xModel.is() ) - xModel->lockControllers(); + if( xChartDoc.is() ) + xChartDoc->lockControllers(); SfxObjectShell* pDocShell = GetDocShell(); Reference< XDataReceiver > xDataRec( xChartDoc, UNO_QUERY ); diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 4d4a205239a7..0d0467d5139b 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -2837,9 +2837,8 @@ void CellStyleBuffer::finalizeImport() Reference< XStyle > xStyle( xStyleFamilyIA->getByIndex( nIndex ), UNO_QUERY_THROW ); if( bReserveAll || !xStyle->isUserDefined() ) { - Reference< XNamed > xStyleName( xStyle, UNO_QUERY_THROW ); // create an empty entry by using ::std::map<>::operator[] - aCellStyles[ xStyleName->getName() ]; + aCellStyles[ xStyle->getName() ]; } } } diff --git a/sc/source/filter/oox/viewsettings.cxx b/sc/source/filter/oox/viewsettings.cxx index ba92331a65a4..960708329f9e 100644 --- a/sc/source/filter/oox/viewsettings.cxx +++ b/sc/source/filter/oox/viewsettings.cxx @@ -614,9 +614,8 @@ void ViewSettings::finalizeImport() aPropMap[ PROP_IsOutlineSymbolsSet ] <<= rxActiveSheetView->mbShowOutline; xContainer->insertByIndex( 0, Any( aPropMap.makePropertyValueSequence() ) ); - Reference< XIndexAccess > xIAccess( xContainer, UNO_QUERY_THROW ); Reference< XViewDataSupplier > xViewDataSuppl( getDocument(), UNO_QUERY_THROW ); - xViewDataSuppl->setViewData( xIAccess ); + xViewDataSuppl->setViewData( xContainer ); } catch( Exception& ) { diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 09c6947c1477..6ab4ecab8450 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -449,8 +449,7 @@ Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString // find an unused name PropertySet aDocProps( mxDoc ); Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW ); - Reference< XNameAccess > xNameAccess( xDatabaseRanges, UNO_QUERY_THROW ); - orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' ); + orName = ContainerHelper::getUnusedName( xDatabaseRanges, orName, '_' ); // create the database range xDatabaseRanges->addNewByName( orName, aDestRange ); xDatabaseRange.set( xDatabaseRanges->getByName( orName ), UNO_QUERY ); diff --git a/sc/source/filter/oox/worksheetbuffer.cxx b/sc/source/filter/oox/worksheetbuffer.cxx index 1a0bcb1df172..b589f849e041 100644 --- a/sc/source/filter/oox/worksheetbuffer.cxx +++ b/sc/source/filter/oox/worksheetbuffer.cxx @@ -174,7 +174,6 @@ WorksheetBuffer::IndexNamePair WorksheetBuffer::createSheet( const OUString& rPr { Reference< XSpreadsheets > xSheets( getDocument()->getSheets(), UNO_QUERY_THROW ); Reference< XIndexAccess > xSheetsIA( xSheets, UNO_QUERY_THROW ); - Reference< XNameAccess > xSheetsNA( xSheets, UNO_QUERY_THROW ); sal_Int16 nCalcSheet = -1; OUString aSheetName = rPreferredName.isEmpty() ? "Sheet" : rPreferredName; PropertySet aPropSet; @@ -185,7 +184,7 @@ WorksheetBuffer::IndexNamePair WorksheetBuffer::createSheet( const OUString& rPr Reference< XNamed > xSheetName( xSheetsIA->getByIndex( nSheetPos ), UNO_QUERY_THROW ); if( xSheetName->getName() != aSheetName ) { - aSheetName = ContainerHelper::getUnusedName( xSheetsNA, aSheetName, ' ' ); + aSheetName = ContainerHelper::getUnusedName( xSheets, aSheetName, ' ' ); xSheetName->setName( aSheetName ); } aPropSet.set( xSheetName ); @@ -194,7 +193,7 @@ WorksheetBuffer::IndexNamePair WorksheetBuffer::createSheet( const OUString& rPr { nCalcSheet = static_cast< sal_Int16 >( xSheetsIA->getCount() ); // new sheet - insert with unused name - aSheetName = ContainerHelper::getUnusedName( xSheetsNA, aSheetName, ' ' ); + aSheetName = ContainerHelper::getUnusedName( xSheets, aSheetName, ' ' ); xSheets->insertNewByName( aSheetName, nCalcSheet ); aPropSet.set( xSheetsIA->getByIndex( nCalcSheet ) ); } diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 98ae353c9ddf..8722a4706a02 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -523,11 +523,11 @@ namespace dlgprov Reference< XInterface >* pObjects = aObjects.getArray(); for ( sal_Int32 i = 0; i < nControlCount; ++i ) { - pObjects[i] = Reference< XInterface >( pControls[i], UNO_QUERY ); + pObjects[i] = pControls[i]; } // also add the dialog control itself to the sequence - pObjects[nControlCount] = Reference< XInterface >( rxControl, UNO_QUERY ); + pObjects[nControlCount] = rxControl; Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess, diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index 5b50526d29f6..cfb53af971e8 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -384,7 +384,7 @@ private: DefaultBrowseNode(); public: - DefaultBrowseNode( const Reference< XComponentContext >& xCtx, const Reference< browse::XBrowseNode>& xNode ) : m_xWrappedBrowseNode( xNode ), m_xWrappedTypeProv( xNode, UNO_QUERY ), m_xCtx( xCtx, UNO_QUERY ) + DefaultBrowseNode( const Reference< XComponentContext >& xCtx, const Reference< browse::XBrowseNode>& xNode ) : m_xWrappedBrowseNode( xNode ), m_xWrappedTypeProv( xNode, UNO_QUERY ), m_xCtx( xCtx ) { OSL_ENSURE( m_xWrappedBrowseNode.is(), "DefaultBrowseNode::DefaultBrowseNode(): No BrowseNode to wrap" ); OSL_ENSURE( m_xWrappedTypeProv.is(), "DefaultBrowseNode::DefaultBrowseNode(): No BrowseNode to wrap" ); diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 689f6f7b4c4b..8d8bade1601d 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -163,8 +163,7 @@ void StringResourceImpl::addModifyListener( const Reference< XModifyListener >& throw RuntimeException(); ::osl::MutexGuard aGuard( getMutex() ); - Reference< XInterface > xIface( aListener, UNO_QUERY ); - m_aListenerContainer.addInterface( xIface ); + m_aListenerContainer.addInterface( aListener ); } void StringResourceImpl::removeModifyListener( const Reference< XModifyListener >& aListener ) @@ -174,8 +173,7 @@ void StringResourceImpl::removeModifyListener( const Reference< XModifyListener throw RuntimeException(); ::osl::MutexGuard aGuard( getMutex() ); - Reference< XInterface > xIface( aListener, UNO_QUERY ); - m_aListenerContainer.removeInterface( xIface ); + m_aListenerContainer.removeInterface( aListener ); } diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 827bed2af29f..dc73646245cf 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -1055,26 +1055,24 @@ void CustomAnimationEffect::setIterateType( sal_Int16 nIterateType ) xNewContainer->appendChild( xChildNode ); } - Reference< XAnimationNode > xNewNode( xNewContainer, UNO_QUERY_THROW ); - - xNewNode->setBegin( mxNode->getBegin() ); - xNewNode->setDuration( mxNode->getDuration() ); - xNewNode->setEnd( mxNode->getEnd() ); - xNewNode->setEndSync( mxNode->getEndSync() ); - xNewNode->setRepeatCount( mxNode->getRepeatCount() ); - xNewNode->setFill( mxNode->getFill() ); - xNewNode->setFillDefault( mxNode->getFillDefault() ); - xNewNode->setRestart( mxNode->getRestart() ); - xNewNode->setRestartDefault( mxNode->getRestartDefault() ); - xNewNode->setAcceleration( mxNode->getAcceleration() ); - xNewNode->setDecelerate( mxNode->getDecelerate() ); - xNewNode->setAutoReverse( mxNode->getAutoReverse() ); - xNewNode->setRepeatDuration( mxNode->getRepeatDuration() ); - xNewNode->setEndSync( mxNode->getEndSync() ); - xNewNode->setRepeatCount( mxNode->getRepeatCount() ); - xNewNode->setUserData( mxNode->getUserData() ); - - mxNode = xNewNode; + xNewContainer->setBegin( mxNode->getBegin() ); + xNewContainer->setDuration( mxNode->getDuration() ); + xNewContainer->setEnd( mxNode->getEnd() ); + xNewContainer->setEndSync( mxNode->getEndSync() ); + xNewContainer->setRepeatCount( mxNode->getRepeatCount() ); + xNewContainer->setFill( mxNode->getFill() ); + xNewContainer->setFillDefault( mxNode->getFillDefault() ); + xNewContainer->setRestart( mxNode->getRestart() ); + xNewContainer->setRestartDefault( mxNode->getRestartDefault() ); + xNewContainer->setAcceleration( mxNode->getAcceleration() ); + xNewContainer->setDecelerate( mxNode->getDecelerate() ); + xNewContainer->setAutoReverse( mxNode->getAutoReverse() ); + xNewContainer->setRepeatDuration( mxNode->getRepeatDuration() ); + xNewContainer->setEndSync( mxNode->getEndSync() ); + xNewContainer->setRepeatCount( mxNode->getRepeatCount() ); + xNewContainer->setUserData( mxNode->getUserData() ); + + mxNode = xNewContainer; Any aTarget; if( nIterateType ) @@ -1659,8 +1657,7 @@ void CustomAnimationEffect::setStopAudio() xCommand->setCommand( EffectCommands::STOPAUDIO ); Reference< XTimeContainer > xContainer( mxNode, UNO_QUERY_THROW ); - Reference< XAnimationNode > xChild( xCommand, UNO_QUERY_THROW ); - xContainer->appendChild( xChild ); + xContainer->appendChild( xCommand ); mnCommand = EffectCommands::STOPAUDIO; } @@ -1898,8 +1895,7 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const SdrPathObj& rPathOb if( rTarget.getValueType() == ::getCppuType((const ParagraphTarget*)0) ) nSubItem = ShapeAnimationSubType::ONLY_TEXT; - Reference< XAnimationNode > xEffectNode( xEffectContainer, UNO_QUERY_THROW ); - pEffect.reset( new CustomAnimationEffect( xEffectNode ) ); + pEffect.reset( new CustomAnimationEffect( xEffectContainer ) ); pEffect->setEffectSequence( this ); pEffect->setTarget( rTarget ); pEffect->setTargetSubItem( nSubItem ); @@ -2039,8 +2035,7 @@ void EffectSequenceHelper::implRebuild() xOnClickContainer->setBegin( aBegin ); - Reference< XAnimationNode > xOnClickContainerNode( xOnClickContainer, UNO_QUERY_THROW ); - mxSequenceRoot->appendChild( xOnClickContainerNode ); + mxSequenceRoot->appendChild( xOnClickContainer ); double fBegin = 0.0; @@ -2048,9 +2043,8 @@ void EffectSequenceHelper::implRebuild() { // create a par container for the current click or after effect node and all following with effects Reference< XTimeContainer > xWithContainer( ParallelTimeContainer::create( ::comphelper::getProcessComponentContext() ), UNO_QUERY_THROW ); - Reference< XAnimationNode > xWithContainerNode( xWithContainer, UNO_QUERY_THROW ); xWithContainer->setBegin( makeAny( fBegin ) ); - xOnClickContainer->appendChild( xWithContainerNode ); + xOnClickContainer->appendChild( xWithContainer ); double fDuration = 0.0; do @@ -2193,9 +2187,8 @@ void stl_process_after_effect_node_func(AfterEffectNode& rNode) // this does not yet have a child container, create one xNextContainer.set( ParallelTimeContainer::create(xContext), UNO_QUERY_THROW ); - Reference< XAnimationNode > xNode( xNextContainer, UNO_QUERY_THROW ); - xNode->setBegin( makeAny( (double)0.0 ) ); - xNextClickContainer->appendChild( xNode ); + xNextContainer->setBegin( makeAny( (double)0.0 ) ); + xNextClickContainer->appendChild( xNextContainer ); } DBG_ASSERT( xNextContainer.is(), "ppt::stl_process_after_effect_node_func::operator(), could not find/create container!" ); } @@ -2206,24 +2199,20 @@ void stl_process_after_effect_node_func(AfterEffectNode& rNode) { Reference< XTimeContainer > xNewClickContainer( ParallelTimeContainer::create( xContext ), UNO_QUERY_THROW ); - Reference< XAnimationNode > xNewClickNode( xNewClickContainer, UNO_QUERY_THROW ); - Event aEvent; aEvent.Trigger = EventTrigger::ON_NEXT; aEvent.Repeat = 0; - xNewClickNode->setBegin( makeAny( aEvent ) ); + xNewClickContainer->setBegin( makeAny( aEvent ) ); - Reference< XAnimationNode > xRefNode( xClickContainer, UNO_QUERY_THROW ); - xSequenceContainer->insertAfter( xNewClickNode, xRefNode ); + xSequenceContainer->insertAfter( xNewClickContainer, xClickContainer ); xNextContainer.set( ParallelTimeContainer::create( xContext ), UNO_QUERY_THROW ); DBG_ASSERT( xNextContainer.is(), "ppt::stl_process_after_effect_node_func::operator(), could not create container!" ); if( xNextContainer.is() ) { - Reference< XAnimationNode > xNode( xNextContainer, UNO_QUERY_THROW ); - xNode->setBegin( makeAny( (double)0.0 ) ); - xNewClickContainer->appendChild( xNode ); + xNextContainer->setBegin( makeAny( (double)0.0 ) ); + xNewClickContainer->appendChild( xNextContainer ); } } @@ -3157,9 +3146,7 @@ void EffectSequenceHelper::processAfterEffect( const Reference< XAnimationNode > else { // its a hide - Reference< XChild > xNodeChild( xNode, UNO_QUERY_THROW ); - Reference< XChild > xMasterChild( xMaster, UNO_QUERY_THROW ); - pMasterEffect->setAfterEffectOnNext( xNodeChild->getParent() != xMasterChild->getParent() ); + pMasterEffect->setAfterEffectOnNext( xNode->getParent() != xMaster->getParent() ); } } } @@ -3371,9 +3358,8 @@ InteractiveSequencePtr MainSequence::createInteractiveSequence( const ::com::sun xISRoot->setUserData( aUserData ); Reference< XChild > xChild( mxSequenceRoot, UNO_QUERY_THROW ); - Reference< XAnimationNode > xISNode( xISRoot, UNO_QUERY_THROW ); Reference< XTimeContainer > xParent( xChild->getParent(), UNO_QUERY_THROW ); - xParent->appendChild( xISNode ); + xParent->appendChild( xISRoot ); pIS.reset( new InteractiveSequence( xISRoot, this) ); pIS->setTriggerShape( xShape ); diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index cb4259d0cf49..95d9e3a8dcc9 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -611,8 +611,7 @@ void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIn if( pModel ) { pModel->SetChanged(); - Reference< XInterface > xSource( xAnnotation, UNO_QUERY ); - NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted" , xSource ); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted" , xAnnotation ); } } @@ -632,8 +631,7 @@ void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation ) if( pModel ) { pModel->SetChanged(); - Reference< XInterface > xSource( xAnnotation, UNO_QUERY ); - NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), OUString( "OnAnnotationRemoved" ), xSource ); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), OUString( "OnAnnotationRemoved" ), xAnnotation ); } } diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 488e6f540d3a..ffa64d50b8c2 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -567,7 +567,7 @@ void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool& rSourcePool) } } - OUString sName( Reference< XNamed >( xSourceTableStyle, UNO_QUERY_THROW )->getName() ); + OUString sName( xSourceTableStyle->getName() ); if( xTarget->hasByName( sName ) ) xTarget->replaceByName( sName, Any( xNewTableStyle ) ); else diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx index d112fb48b798..fa2160b83d69 100644 --- a/sd/source/filter/eppt/pptexanimations.cxx +++ b/sd/source/filter/eppt/pptexanimations.cxx @@ -969,9 +969,7 @@ sal_Int16 AnimationExporter::exportAnimPropertySet( SvStream& rStrm, const Refer if( xMaster.is() ) { sal_Int32 nMasterRel = 2; - Reference< XChild > xNodeChild( xNode, UNO_QUERY ); - Reference< XChild > xMasterChild( xMaster, UNO_QUERY ); - if( xNodeChild.is() && xMasterChild.is() && (xNodeChild->getParent() == xMasterChild->getParent() ) ) + if( xNode.is() && xMaster.is() && (xNode->getParent() == xMaster->getParent() ) ) nMasterRel = 0; aMasterRel <<= nMasterRel; diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 9578918c0a0c..f26cb75b234b 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -2414,8 +2414,7 @@ void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimation xRoot->setUserData( aUserData ); xRoot->appendChild( xAnimationNode ); - Reference< XAnimationNode > xNode( xRoot, UNO_QUERY ); - SlideShow::StartPreview( mrBase, mxCurrentPage, xNode ); + SlideShow::StartPreview( mrBase, mxCurrentPage, xRoot ); } diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 08b903b560fb..45191b372d5c 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -578,10 +578,9 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& r { bool bRelocationSuccessfull (false); Reference<XRelocatableResource> xResource (pDescriptor->mxView, UNO_QUERY); - Reference<XResource> xNewAnchor (rxPane, UNO_QUERY); - if (xResource.is() && xNewAnchor.is()) + if (xResource.is() && rxPane.is()) { - if (xResource->relocateToAnchor(xNewAnchor)) + if (xResource->relocateToAnchor(rxPane)) bRelocationSuccessfull = true; } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 91091c49bb1e..67c22e176ee9 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -1125,9 +1125,8 @@ OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext(), UNO_QUERY_THROW ); Reference< XModuleManager2 > xModuleManager( ModuleManager::create(xContext) ); - Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW ); - OUString aModuleIdentifier( xModuleManager->identify( xIfac ) ); + OUString aModuleIdentifier( xModuleManager->identify( xFrame ) ); if( !aModuleIdentifier.isEmpty() ) { diff --git a/sdext/source/minimizer/graphiccollector.cxx b/sdext/source/minimizer/graphiccollector.cxx index 13fcff570d09..b488ed85c606 100644 --- a/sdext/source/minimizer/graphiccollector.cxx +++ b/sdext/source/minimizer/graphiccollector.cxx @@ -283,14 +283,12 @@ void GraphicCollector::CollectGraphics( const Reference< XComponentContext >& rx { Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW ); ImpCollectBackgroundGraphic( rxMSF, xDrawPage, rGraphicSettings, rGraphicList ); - Reference< XShapes > xDrawShapes( xDrawPage, UNO_QUERY_THROW ); - ImpCollectGraphicObjects( rxMSF, xDrawShapes, rGraphicSettings, rGraphicList ); + ImpCollectGraphicObjects( rxMSF, xDrawPage, rGraphicSettings, rGraphicList ); Reference< XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW ); Reference< XDrawPage > xNotesPage( xPresentationPage->getNotesPage() ); ImpCollectBackgroundGraphic( rxMSF, xNotesPage, rGraphicSettings, rGraphicList ); - Reference< XShapes > xNotesShapes( xNotesPage, UNO_QUERY_THROW ); - ImpCollectGraphicObjects( rxMSF, xNotesShapes, rGraphicSettings, rGraphicList ); + ImpCollectGraphicObjects( rxMSF, xNotesPage, rGraphicSettings, rGraphicList ); } Reference< XMasterPagesSupplier > xMasterPagesSupplier( rxModel, UNO_QUERY_THROW ); Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW ); @@ -298,8 +296,7 @@ void GraphicCollector::CollectGraphics( const Reference< XComponentContext >& rx { Reference< XDrawPage > xMasterPage( xMasterPages->getByIndex( i ), UNO_QUERY_THROW ); ImpCollectBackgroundGraphic( rxMSF, xMasterPage, rGraphicSettings, rGraphicList ); - Reference< XShapes > xMasterPageShapes( xMasterPage, UNO_QUERY_THROW ); - ImpCollectGraphicObjects( rxMSF, xMasterPageShapes, rGraphicSettings, rGraphicList ); + ImpCollectGraphicObjects( rxMSF, xMasterPage, rGraphicSettings, rGraphicList ); } std::vector< GraphicCollector::GraphicEntity >::iterator aGraphicIter( rGraphicList.begin() ); @@ -421,14 +418,12 @@ void GraphicCollector::CountGraphics( const Reference< XComponentContext >& rxMS { Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW ); ImpCountBackgroundGraphic( xDrawPage, rnGraphics ); - Reference< XShapes > xDrawShapes( xDrawPage, UNO_QUERY_THROW ); - ImpCountGraphicObjects( rxMSF, xDrawShapes, rGraphicSettings, rnGraphics ); + ImpCountGraphicObjects( rxMSF, xDrawPage, rGraphicSettings, rnGraphics ); Reference< XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW ); Reference< XDrawPage > xNotesPage( xPresentationPage->getNotesPage() ); ImpCountBackgroundGraphic( xNotesPage, rnGraphics ); - Reference< XShapes > xNotesShapes( xNotesPage, UNO_QUERY_THROW ); - ImpCountGraphicObjects( rxMSF, xNotesShapes, rGraphicSettings, rnGraphics ); + ImpCountGraphicObjects( rxMSF, xNotesPage, rGraphicSettings, rnGraphics ); } Reference< XMasterPagesSupplier > xMasterPagesSupplier( rxModel, UNO_QUERY_THROW ); Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW ); @@ -436,8 +431,7 @@ void GraphicCollector::CountGraphics( const Reference< XComponentContext >& rxMS { Reference< XDrawPage > xMasterPage( xMasterPages->getByIndex( i ), UNO_QUERY_THROW ); ImpCountBackgroundGraphic( xMasterPage, rnGraphics ); - Reference< XShapes > xMasterPageShapes( xMasterPage, UNO_QUERY_THROW ); - ImpCountGraphicObjects( rxMSF, xMasterPageShapes, rGraphicSettings, rnGraphics ); + ImpCountGraphicObjects( rxMSF, xMasterPage, rGraphicSettings, rnGraphics ); } } catch ( Exception& ) diff --git a/sdext/source/presenter/PresenterViewFactory.cxx b/sdext/source/presenter/PresenterViewFactory.cxx index 4ebc8fe59245..1e24207166fe 100644 --- a/sdext/source/presenter/PresenterViewFactory.cxx +++ b/sdext/source/presenter/PresenterViewFactory.cxx @@ -392,7 +392,7 @@ Reference<XResource> PresenterViewFactory::CreateView( xView = NULL; } - return Reference<XResource>(xView, UNO_QUERY); + return xView; } Reference<XView> PresenterViewFactory::CreateSlideShowView( diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index cf1ba0403df6..def791316986 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -2332,11 +2332,10 @@ IMPL_LINK_NOARG(SfxHelpTextWindow_Impl, SelectHdl) { // create descriptor, set string and find all words Reference < XSearchDescriptor > xSrchDesc = xSearchable->createSearchDescriptor(); - Reference < XPropertySet > xPropSet( xSrchDesc, UNO_QUERY ); - xPropSet->setPropertyValue( "SearchRegularExpression", + xSrchDesc->setPropertyValue( "SearchRegularExpression", makeAny( sal_Bool( sal_True ) ) ); if ( bIsFullWordSearch ) - xPropSet->setPropertyValue( "SearchWords", + xSrchDesc->setPropertyValue( "SearchWords", makeAny( sal_Bool( sal_True ) ) ); String sSearchString = sfx2::PrepareSearchString( aSearchText, GetBreakIterator(), false ); @@ -2394,10 +2393,9 @@ IMPL_LINK( SfxHelpTextWindow_Impl, FindHdl, sfx2::SearchDialog*, pDlg ) { // create descriptor, set string and find all words Reference < XSearchDescriptor > xSrchDesc = xSearchable->createSearchDescriptor(); - Reference < XPropertySet > xPropSet( xSrchDesc, UNO_QUERY ); - xPropSet->setPropertyValue( "SearchWords", makeAny( sal_Bool( pDlg->IsOnlyWholeWords() != false ) ) ); - xPropSet->setPropertyValue( "SearchCaseSensitive", makeAny( sal_Bool( pDlg->IsMarchCase() != false ) ) ); - xPropSet->setPropertyValue( "SearchBackwards", makeAny( sal_Bool( pDlg->IsSearchBackwards() != false ) ) ); + xSrchDesc->setPropertyValue( "SearchWords", makeAny( sal_Bool( pDlg->IsOnlyWholeWords() != false ) ) ); + xSrchDesc->setPropertyValue( "SearchCaseSensitive", makeAny( sal_Bool( pDlg->IsMarchCase() != false ) ) ); + xSrchDesc->setPropertyValue( "SearchBackwards", makeAny( sal_Bool( pDlg->IsSearchBackwards() != false ) ) ); xSrchDesc->setSearchString( sSearchText ); Reference< XInterface > xSelection; Reference< XTextRange > xCursor = getCursor(); diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index c7aa092801e5..894dc547759e 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -274,7 +274,7 @@ namespace sfx2 } CustomPanelUIElement( const Reference< XUIElement >& i_rUIElement ) - :m_xUIElement( i_rUIElement, UNO_SET_THROW ) + :m_xUIElement( i_rUIElement ) ,m_xToolPanel( i_rUIElement->getRealInterface(), UNO_QUERY_THROW ) ,m_xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ) { diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index c3a2a50cdd4d..f35000f9cb08 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -250,7 +250,7 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nV Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW ); xFrame->initialize( xWin.get() ); - xDesktop->getFrames()->append( Reference<XFrame>(xFrame, uno::UNO_QUERY_THROW) ); + xDesktop->getFrames()->append( xFrame ); if ( xWin->isActive() ) xFrame->activate(); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index e857318c0e8b..95f35531d6f4 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1888,8 +1888,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell try { // if there is a backing component, use it - Reference< XFramesSupplier > xTaskSupplier( xDesktop , css::uno::UNO_QUERY_THROW ); - ::framework::FrameListAnalyzer aAnalyzer( xTaskSupplier, Reference< XFrame >(), ::framework::FrameListAnalyzer::E_BACKINGCOMPONENT ); + ::framework::FrameListAnalyzer aAnalyzer( xDesktop, Reference< XFrame >(), ::framework::FrameListAnalyzer::E_BACKINGCOMPONENT ); if ( aAnalyzer.m_xBackingComponent.is() ) xFrame = aAnalyzer.m_xBackingComponent; diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 3cb54c3b2890..ec99e649f140 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -1603,7 +1603,7 @@ IMPL_LINK_NOARG(SvtDocumentTemplateDialog , OrganizerHdl_Impl) Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); Reference < XFrame > xFrame( xDesktop->getActiveFrame() ); if ( !xFrame.is() ) - xFrame = Reference < XFrame >( xDesktop, UNO_QUERY ); + xFrame = xDesktop; com::sun::star::util::URL aTargetURL; aTargetURL.Complete = "slot:5540"; diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index 2a19a5332561..23778c8dbc8c 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -337,10 +337,9 @@ void SvxRubyDialog::Activate() aName >>= sName; } } - Reference<XNamed> xNamed(xStyle, UNO_QUERY); - if(xNamed.is()) + if(xStyle.is()) { - sCoreName = xNamed->getName(); + sCoreName = xStyle->getName(); if(sName.isEmpty()) sName = sCoreName; } diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 8b665eb9a508..efa44e784330 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -393,8 +393,7 @@ namespace OUString sLabelName; try { - Reference< XControl > xControl( _rxControl, UNO_SET_THROW ); - Reference< XPropertySet > xModel( xControl->getModel(), UNO_QUERY_THROW ); + Reference< XPropertySet > xModel( _rxControl->getModel(), UNO_QUERY_THROW ); sLabelName = getLabelName( xModel ); } catch( const Exception& ) @@ -409,8 +408,7 @@ namespace Reference< XPropertySet > xField; try { - Reference< XControl > xControl( _rxControl, UNO_SET_THROW ); - Reference< XPropertySet > xModelProps( xControl->getModel(), UNO_QUERY_THROW ); + Reference< XPropertySet > xModelProps( _rxControl->getModel(), UNO_QUERY_THROW ); xField.set( xModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ), UNO_QUERY_THROW ); } catch( const Exception& ) @@ -672,8 +670,7 @@ void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, FmPar } // now add dependent controllers - Reference< XIndexAccess > xControllerAsIndex( xController, UNO_QUERY ); - Update( xControllerAsIndex, pFormItem ); + Update( xController, pFormItem ); } } catch( const Exception& ) diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 34949302dc9f..d7738dbc4128 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -287,7 +287,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage) Reference< XIndexContainer > xOldParent(xMeAsFormComp->getParent(), UNO_QUERY); if (xOldParent.is()) { - sal_Int32 nPos = getElementPos(Reference< XIndexAccess > (xOldParent, UNO_QUERY), xMeAsFormComp); + sal_Int32 nPos = getElementPos(xOldParent, xMeAsFormComp); if (nPos > -1) xOldParent->removeByIndex(nPos); } @@ -586,7 +586,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > } while ( nTokIndex >= 0 ); - return Reference< XInterface > (xDestContainer, UNO_QUERY); + return xDestContainer; } //------------------------------------------------------------------ diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index eebc4aba5749..de8b2b215bab 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -440,14 +440,13 @@ Reference< XForm > FmFormPageImpl::getDefaultForm() OUString sName = String( SVX_RES( RID_STR_STDFORMNAME ) ); xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) ); - Reference< XIndexContainer > xContainer( xForms, UNO_QUERY ); if( pModel->IsUndoEnabled() ) { pModel->AddUndo(new FmUndoContainerAction(*(FmFormModel*)pModel, FmUndoContainerAction::Inserted, - xContainer, + xForms, xForm, - xContainer->getCount())); + xForms->getCount())); } xForms->insertByName( sName, makeAny( xForm ) ); xCurrentForm = xForm; @@ -649,8 +648,7 @@ OUString FmFormPageImpl::setUniqueName(const Reference< XFormComponent > & xForm #if OSL_DEBUG_LEVEL > 0 try { - Reference< XChild > xChild( xFormComponent, UNO_QUERY_THROW ); - OSL_ENSURE( !xChild->getParent().is(), "FmFormPageImpl::setUniqueName: to be called before insertion!" ); + OSL_ENSURE( !xFormComponent->getParent().is(), "FmFormPageImpl::setUniqueName: to be called before insertion!" ); } catch( const Exception& ) { diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 78de8a7e69a4..1a38d5018beb 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2542,7 +2542,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn m_arrRelativeGridColumn.push_back(-1); // and for the formatted search... - pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControl, UNO_QUERY)); + pfmscContextInfo->arrFields.push_back(xControl); } } } @@ -2731,7 +2731,7 @@ void FmXFormShell::selectionChanged(const EventObject& rEvent) throw(::com::sun: Reference< XForm > xNewForm( GetForm( rEvent.Source ) ); InterfaceBag aNewSelection; - aNewSelection.insert( Reference< XInterface >( xSelObj, UNO_QUERY ) ); + aNewSelection.insert( xSelObj ); if ( setCurrentSelection( aNewSelection ) && IsPropBrwOpen() ) ShowSelectionProperties( sal_True ); @@ -3571,7 +3571,7 @@ void FmXFormShell::CreateExternalView() Reference< XResultSet> xForm(xCurrentNavController->getModel(), UNO_QUERY); aArg.Value <<= xForm; - m_xExternalDisplayedForm = Reference< XResultSet>(xForm, UNO_QUERY); + m_xExternalDisplayedForm = xForm; // do this before dispatching the "attach" command, as the atach may result in a call to our queryDispatch (for the FormSlots) // whichs needs the m_xExternalDisplayedForm diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index ddeb875695ac..da7f05fb5800 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -177,9 +177,8 @@ sal_Int32 getElementPos(const Reference< ::com::sun::star::container::XIndexAcce return nIndex; - Reference< XInterface > xNormalized( xElement, UNO_QUERY ); - DBG_ASSERT( xNormalized.is(), "getElementPos: invalid element!" ); - if ( xNormalized.is() ) + DBG_ASSERT( xElement.is(), "getElementPos: invalid element!" ); + if ( xElement.is() ) { // Feststellen an welcher Position sich das Kind befindet nIndex = xCont->getCount(); @@ -190,7 +189,7 @@ sal_Int32 getElementPos(const Reference< ::com::sun::star::container::XIndexAcce Reference< XInterface > xCurrent(xCont->getByIndex( nIndex ),UNO_QUERY); DBG_ASSERT( xCurrent.get() == Reference< XInterface >( xCurrent, UNO_QUERY ).get(), "getElementPos: container element not normalized!" ); - if ( xNormalized.get() == xCurrent.get() ) + if ( xElement.get() == xCurrent.get() ) break; } catch(Exception&) diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 29ef91a77aa5..cf1567b73ba1 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -805,8 +805,7 @@ void FmXUndoEnvironment::AddForms(const Reference< XNameContainer > & rForms) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::AddForms" ); Lock(); - Reference< XInterface > xInt(rForms, UNO_QUERY); - AddElement(xInt); + AddElement(rForms); UnLock(); } @@ -815,8 +814,7 @@ void FmXUndoEnvironment::RemoveForms(const Reference< XNameContainer > & rForms) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::RemoveForms" ); Lock(); - Reference< XInterface > xInt(rForms, UNO_QUERY); - RemoveElement(xInt); + RemoveElement(rForms); UnLock(); } diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 3dc99ea74da4..c309bb850631 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -221,8 +221,7 @@ void FormViewPageWindowAdapter::dispose() } // dispose the formcontroller - Reference< XComponent > xComp( xController, UNO_QUERY_THROW ); - xComp->dispose(); + xController->dispose(); } catch (const Exception&) { @@ -301,7 +300,7 @@ Reference< XFormController > getControllerSearchChildren( const Reference< XInd return xController; else { - xController = getControllerSearchChildren(Reference< XIndexAccess > (xController, UNO_QUERY), xModel); + xController = getControllerSearchChildren(xController, xModel); if ( xController.is() ) return xController; } @@ -370,8 +369,7 @@ void FormViewPageWindowAdapter::setController(const Reference< XForm > & xForm, // attaching the events Reference< XEventAttacherManager > xEventManager( xForm->getParent(), UNO_QUERY ); - Reference< XInterface > xIfc(xController, UNO_QUERY); - xEventManager->attach(m_aControllerList.size() - 1, xIfc, makeAny(xController) ); + xEventManager->attach(m_aControllerList.size() - 1, xController, makeAny(xController) ); } // jetzt die Subforms durchgehen diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index 0fbe0dc9c5d4..1382e0296637 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -276,8 +276,7 @@ ColumnInfoCache::ColumnInfoCache( const Reference< XColumnsSupplier >& _rxColSup { m_aColumns.clear(); - Reference< XColumnsSupplier > xSupplyCols( _rxColSupplier, UNO_SET_THROW ); - Reference< XIndexAccess > xColumns( xSupplyCols->getColumns(), UNO_QUERY_THROW ); + Reference< XIndexAccess > xColumns( _rxColSupplier->getColumns(), UNO_QUERY_THROW ); sal_Int32 nColumnCount = xColumns->getCount(); m_aColumns.reserve( nColumnCount ); @@ -354,8 +353,6 @@ void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > lcl_resetColumnControlInfo( *col ); - Reference< XInterface > xNormColumn( col->xColumn, UNO_QUERY_THROW ); - const Reference< XControl >* pControl( _rControls.getConstArray() ); const Reference< XControl >* pControlEnd( pControl + _rControls.getLength() ); for ( ; pControl != pControlEnd; ++pControl ) @@ -377,7 +374,7 @@ void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > { Reference< XPropertySet > xGridColumnModel( xGridColAccess->getByIndex( gridCol ), UNO_QUERY_THROW ); - if ( !lcl_isBoundTo( xGridColumnModel, xNormColumn ) + if ( !lcl_isBoundTo( xGridColumnModel, col->xColumn ) || !lcl_isInputRequired( xGridColumnModel ) ) continue; // with next grid column @@ -397,7 +394,7 @@ void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > } if ( !xModelPSI->hasPropertyByName( FM_PROP_BOUNDFIELD ) - || !lcl_isBoundTo( xModel, xNormColumn ) + || !lcl_isBoundTo( xModel, col->xColumn ) || !lcl_isInputRequired( xModel ) ) continue; // with next control @@ -2019,8 +2016,7 @@ void FormController::addToEventAttacher(const Reference< XControl > & xControl) m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; if ((XFormComponent*)xComp.get() == (XFormComponent*)xTemp.get()) { - Reference< XInterface > xIfc(xControl, UNO_QUERY); - m_xModelAsManager->attach( nPos, xIfc, makeAny(xControl) ); + m_xModelAsManager->attach( nPos, xControl, makeAny(xControl) ); break; } } @@ -2047,8 +2043,7 @@ void FormController::removeFromEventAttacher(const Reference< XControl > & xCont m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; if ((XFormComponent*)xComp.get() == (XFormComponent*)xTemp.get()) { - Reference< XInterface > xIfc(xControl, UNO_QUERY); - m_xModelAsManager->detach( nPos, xIfc ); + m_xModelAsManager->detach( nPos, xControl ); break; } } @@ -3055,8 +3050,7 @@ void SAL_CALL FormController::addChildController( const Reference< XFormControll m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; if ( xFormOfChild == xTemp ) { - Reference< XInterface > xIfc( _ChildController, UNO_QUERY ); - m_xModelAsManager->attach( nPos, xIfc, makeAny( _ChildController) ); + m_xModelAsManager->attach( nPos, _ChildController, makeAny( _ChildController) ); break; } } diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx index b344483c1748..bd5e5336cf43 100644 --- a/svx/source/form/formcontrolling.cxx +++ b/svx/source/form/formcontrolling.cxx @@ -252,8 +252,7 @@ namespace svx // to prevent the controller from displaying any error messages which happen while we operate on it, // we add ourself as XSQLErrorListener. By contract, a FormController displays errors if and only if // no SQLErrorListeners are registered. - Reference< XSQLErrorBroadcaster > xErrorBroadcast( _rxController, UNO_QUERY_THROW ); - xErrorBroadcast->addSQLErrorListener( this ); + _rxController->addSQLErrorListener( this ); } catch( const Exception& ) { diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 828054700dc4..768facd272e8 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1102,7 +1102,7 @@ namespace svxform GetNavModel()->GetRootList()->remove( pCurrentUserData ); // aus dem Container entfernen - sal_Int32 nIndex = getElementPos(Reference< XIndexAccess > (xContainer, UNO_QUERY), xCurrentChild); + sal_Int32 nIndex = getElementPos(xContainer, xCurrentChild); GetNavModel()->m_pPropChangeList->Lock(); // die Undo-Action fuer das Rausnehmen if ( bUndo && GetNavModel()->m_pPropChangeList->CanUndo()) @@ -1400,7 +1400,7 @@ namespace svxform if( pFormShell ) { InterfaceBag aSelection; - aSelection.insert( Reference< XInterface >( xNewForm, UNO_QUERY ) ); + aSelection.insert( xNewForm ); pFormShell->GetImpl()->setCurrentSelection( aSelection ); pFormShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_PROPERTIES,sal_True,sal_True); diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx index 01dc44a1422e..c2de01badeab 100644 --- a/svx/source/form/navigatortreemodel.cxx +++ b/svx/source/form/navigatortreemodel.cxx @@ -960,7 +960,7 @@ namespace svxform { FmFormData* pFormData = (FmFormData*)pEntryData; Reference< XForm > xForm( pFormData->GetFormIface()); - xFormComponent = Reference< XFormComponent > (xForm, UNO_QUERY); + xFormComponent = xForm; } if( pEntryData->ISA(FmControlData) ) 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(); } diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 52f290fdd3d8..7c6682e8bab5 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -1405,8 +1405,7 @@ void ControlContainerBase::ImplRemoveControl( Reference< XControlModel >& rxMode removeControl( xCtrl ); try { - Reference< XComponent > const xControlComp( xCtrl, UNO_QUERY_THROW ); - xControlComp->dispose(); + xCtrl->dispose(); } catch (const Exception&) { diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index 37e8b8fb6a0e..584f1b0ef4ee 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -187,8 +187,7 @@ namespace toolkit // dispose the removed column try { - Reference< XComponent > const xColComp( xColumn, UNO_QUERY_THROW ); - xColComp->dispose(); + xColumn->dispose(); } catch( const Exception& ) { diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx index efbac8b28b54..26036c14a091 100644 --- a/toolkit/source/controls/tabpagecontainer.cxx +++ b/toolkit/source/controls/tabpagecontainer.cxx @@ -101,8 +101,7 @@ namespace { try { - Reference< XPropertySet > const xParentDelegator( i_parentModel, UNO_QUERY_THROW ); - Reference< XPropertySetInfo > const xPSI( xParentDelegator->getPropertySetInfo() ); + Reference< XPropertySetInfo > const xPSI( i_parentModel->getPropertySetInfo() ); bool const isGeometryControlModel = xPSI.is() && xPSI->hasPropertyByName( OUString( "PositionX" ) ); Reference< XInterface > xInstance; diff --git a/ucb/source/cacher/dynamicresultsetwrapper.cxx b/ucb/source/cacher/dynamicresultsetwrapper.cxx index 3faca33ec7aa..e50863fc2c90 100644 --- a/ucb/source/cacher/dynamicresultsetwrapper.cxx +++ b/ucb/source/cacher/dynamicresultsetwrapper.cxx @@ -353,8 +353,7 @@ Reference< XResultSet > SAL_CALL DynamicResultSetWrapper if( xSource.is() ) { - Reference< XComponent > xSourceComponent( xSource, UNO_QUERY ); - xSourceComponent->addEventListener( xMyListenerImpl ); + xSource->addEventListener( xMyListenerImpl ); } if( !xSource.is() ) m_aSourceSet.wait(); diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index 2959d5dea872..302149cc11bf 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -743,8 +743,7 @@ BaseContent::getParent( try { - Reference< XContent > content = m_pMyShell->m_pProvider->queryContent( Identifier ); - return Reference<XInterface>(content,UNO_QUERY); + return m_pMyShell->m_pProvider->queryContent( Identifier ); } catch (const IllegalIdentifierException&) { diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index c3f22b6a2f01..e2172875fcfa 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -541,12 +541,11 @@ namespace fileaccess { } else if(errorCode == TASKHANDLING_INPUTSTREAM_FOR_WRITE) { - Reference<XInterface> xContext(xComProc,UNO_QUERY); aAny <<= MissingInputStreamException( OUString( "the inputstream is missing necessary" "to create a content"), - xContext); + xComProc); cancelCommandExecution(aAny,xEnv); } else if( errorCode == TASKHANDLING_NOREPLACE_FOR_WRITE ) @@ -555,8 +554,7 @@ namespace fileaccess { NameClashException excep; excep.Name = getTitle(aUncPath); excep.Classification = InteractionClassification_ERROR; - Reference<XInterface> xContext(xComProc,UNO_QUERY); - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "file exists and overwrite forbidden"); aAny <<= excep; cancelCommandExecution( aAny,xEnv ); @@ -578,8 +576,7 @@ namespace fileaccess { seq[0] <<= prop; excep.Arguments = seq; excep.Classification = InteractionClassification_ERROR; - Reference<XInterface> xContext(xComProc,UNO_QUERY); - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "the name contained invalid characters"); if(isHandled) throw excep; @@ -600,8 +597,7 @@ namespace fileaccess { NameClashException excep; excep.Name = getTitle(aUncPath); excep.Classification = InteractionClassification_ERROR; - Reference<XInterface> xContext(xComProc,UNO_QUERY); - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "folder exists and overwrite forbidden"); if(isHandled) throw excep; @@ -793,12 +789,10 @@ namespace fileaccess { } else if( errorCode == TASKHANDLING_TRANSFER_INVALIDSCHEME ) { - Reference<XInterface> xContext(xComProc,UNO_QUERY); - aAny <<= InteractiveBadTransferURLException( OUString( "bad tranfer url"), - xContext); + xComProc); cancelCommandExecution( aAny,xEnv ); } else if( errorCode == TASKHANDLING_OVERWRITE_FOR_MOVE || @@ -859,8 +853,7 @@ namespace fileaccess { NameClashException excep; excep.Name = getTitle(aUncPath); excep.Classification = InteractionClassification_ERROR; - Reference<XInterface> xContext(xComProc,UNO_QUERY); - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "name clash during copy or move"); aAny <<= excep; @@ -869,11 +862,9 @@ namespace fileaccess { else if( errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_MOVE || errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_COPY ) { - Reference<XInterface> xContext( - xComProc,UNO_QUERY); UnsupportedNameClashException excep; excep.NameClash = minorCode; - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "name clash value not supported during copy or move"); aAny <<= excep; diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index 3e145ad18766..eedc779a7736 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -673,8 +673,7 @@ FTPContent::getParent( ) { Reference<XContentIdentifier> xIdent(new FTPContentIdentifier(m_aFTPURL.parent(false))); - Reference<XContent> xContent(m_xProvider->queryContent(xIdent)); - return Reference<XInterface>(xContent,UNO_QUERY); + return m_xProvider->queryContent(xIdent); } diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 7e89095e5e00..228fc5d9c402 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -439,7 +439,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se } else { - xNode = Reference< XInterface >(xHierarchyAccess, UNO_QUERY); + xNode = xHierarchyAccess; } xSet = Reference< XPropertySet >(xNode, UNO_QUERY); diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx index dfa15b1f16be..4eaa92216056 100644 --- a/unoxml/source/dom/attr.cxx +++ b/unoxml/source/dom/attr.cxx @@ -207,7 +207,7 @@ namespace DOM guard.clear(); // release mutex before calling event handlers - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchEvent(event); dispatchSubtreeModified(); } diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx index e2b4ba97fa49..2282171e438b 100644 --- a/unoxml/source/dom/characterdata.cxx +++ b/unoxml/source/dom/characterdata.cxx @@ -48,7 +48,7 @@ namespace DOM "DOMCharacterDataModified", sal_True, sal_False, Reference< XNode >(), prevValue, newValue, OUString(), (AttrChangeType)0 ); - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchEvent(event); dispatchSubtreeModified(); } diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index 0c69dfb64cee..779b4c5d7416 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -898,7 +898,7 @@ namespace DOM "DOMNodeInsertedIntoDocument", sal_True, sal_False, Reference< XNode >(), OUString(), OUString(), OUString(), (AttrChangeType)0 ); Reference< XEventTarget > const xDocET(xDocument, UNO_QUERY); - xDocET->dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + xDocET->dispatchEvent(event); } return xNode; diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index 0149ca972768..41cfb0f0a515 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -575,13 +575,13 @@ namespace DOM Reference< XMutationEvent > event(docevent->createEvent( "DOMAttrModified"), UNO_QUERY); event->initMutationEvent("DOMAttrModified", - sal_True, sal_False, Reference< XNode >(xAttr, UNO_QUERY), + sal_True, sal_False, xAttr, OUString(), xAttr->getValue(), xAttr->getName(), AttrChangeType_ADDITION); guard.clear(); // release mutex before calling event handlers - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchEvent(event); dispatchSubtreeModified(); return xAttr; @@ -645,7 +645,7 @@ namespace DOM oldValue, value, name, aChangeType); guard.clear(); // release mutex before calling event handlers - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchEvent(event); dispatchSubtreeModified(); } @@ -727,7 +727,7 @@ namespace DOM oldValue, value, qualifiedName, aChangeType); guard.clear(); // release mutex before calling event handlers - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchEvent(event); dispatchSubtreeModified(); } diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index a071247a1a2b..e68cd6afbf6d 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -378,7 +378,7 @@ namespace DOM // and call event listeners, so release mutex to prevent deadlocks. guard.clear(); - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchEvent(event); // dispatch subtree modified for this node dispatchSubtreeModified(); @@ -819,7 +819,7 @@ namespace DOM // and call event listeners, so release mutex to prevent deadlocks. guard.clear(); - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchEvent(event); // subtree modified for this node dispatchSubtreeModified(); @@ -943,7 +943,7 @@ namespace DOM "DOMSubtreeModified", sal_True, sal_False, Reference< XNode >(), OUString(), OUString(), OUString(), (AttrChangeType)0 ); - dispatchEvent(Reference< XEvent >(event, UNO_QUERY)); + dispatchEvent(event); } /** diff --git a/unoxml/source/dom/node.hxx b/unoxml/source/dom/node.hxx index b7e29544300a..093b7023cbb8 100644 --- a/unoxml/source/dom/node.hxx +++ b/unoxml/source/dom/node.hxx @@ -63,7 +63,7 @@ namespace DOM maNamespaces( 1, std::vector<Namespace>() ), maNamespaceMap(101), mxAttribList(new FastAttributeList(i_xTokenHandler)), - mxCurrentHandler(i_xHandler, UNO_QUERY_THROW), + mxCurrentHandler(i_xHandler), mxDocHandler(i_xHandler), mxTokenHandler(i_xTokenHandler) {} diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx index 459cd6bb9ee9..4568e745e008 100644 --- a/unoxml/source/dom/saxbuilder.cxx +++ b/unoxml/source/dom/saxbuilder.cxx @@ -135,7 +135,7 @@ namespace DOM m_aDocument = ownerDoc; Reference< XDocumentFragment > aFragment = m_aDocument->createDocumentFragment(); - m_aNodeStack.push(Reference< XNode >(aFragment, UNO_QUERY)); + m_aNodeStack.push(aFragment); m_aFragment = aFragment; m_aState = SAXDocumentBuilderState_BUILDING_FRAGMENT; } @@ -169,7 +169,7 @@ namespace DOM Reference< XDocumentBuilder > aBuilder(DocumentBuilder::create(comphelper::getComponentContext(m_aServiceManager))); Reference< XDocument > aDocument = aBuilder->newDocument(); - m_aNodeStack.push(Reference< XNode >(aDocument, UNO_QUERY)); + m_aNodeStack.push(aDocument); m_aDocument = aDocument; m_aState = SAXDocumentBuilderState_BUILDING_DOCUMENT; } @@ -258,9 +258,9 @@ namespace DOM aElement = m_aDocument->createElement(aName); } aElement = Reference< XElement > ( - m_aNodeStack.top()->appendChild(Reference< XNode >(aElement, UNO_QUERY)), + m_aNodeStack.top()->appendChild(aElement), UNO_QUERY); - m_aNodeStack.push(Reference< XNode >(aElement, UNO_QUERY)); + m_aNodeStack.push(aElement); // set non xmlns attributes aPrefix = OUString(); @@ -332,7 +332,7 @@ namespace DOM throw SAXException(); Reference< XText > aText = m_aDocument->createTextNode(aChars); - m_aNodeStack.top()->appendChild(Reference< XNode >(aText, UNO_QUERY)); + m_aNodeStack.top()->appendChild(aText); } void SAL_CALL CSAXDocumentBuilder::ignorableWhitespace(const OUString& ) @@ -358,7 +358,7 @@ namespace DOM Reference< XProcessingInstruction > aInstruction = m_aDocument->createProcessingInstruction( aTarget, aData); - m_aNodeStack.top()->appendChild(Reference< XNode >(aInstruction, UNO_QUERY)); + m_aNodeStack.top()->appendChild(aInstruction); } void SAL_CALL CSAXDocumentBuilder::setDocumentLocator(const Reference< XLocator >& aLocator) diff --git a/xmloff/source/core/DomBuilderContext.cxx b/xmloff/source/core/DomBuilderContext.cxx index 8d02dd45972d..cc6200dc550b 100644 --- a/xmloff/source/core/DomBuilderContext.cxx +++ b/xmloff/source/core/DomBuilderContext.cxx @@ -238,9 +238,8 @@ static Reference<XNode> lcl_createElement( SvXMLImport& rImport, DBG_ASSERT( xElement.is(), "can't create element" ); // add new element to parent and return - Reference<XNode> xNode( xElement, UNO_QUERY_THROW ); - xParent->appendChild( xNode ); - return xNode; + xParent->appendChild( xElement ); + return xElement; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/core/DomExport.cxx b/xmloff/source/core/DomExport.cxx index 7e87c621aba2..ca1190d6eaae 100644 --- a/xmloff/source/core/DomExport.cxx +++ b/xmloff/source/core/DomExport.cxx @@ -129,7 +129,7 @@ void visitNode( DomVisitor& rVisitor, const Reference<XNode>& xNode ) void visit( DomVisitor& rVisitor, const Reference<XDocument>& xDocument ) { - visit( rVisitor, Reference<XNode>( xDocument, UNO_QUERY_THROW ) ); + visit( rVisitor, xDocument ); } void visit( DomVisitor& rVisitor, const Reference<XNode>& xNode ) diff --git a/xmloff/source/script/XMLEventExport.cxx b/xmloff/source/script/XMLEventExport.cxx index e619d96a6db2..4ddde6e61d82 100644 --- a/xmloff/source/script/XMLEventExport.cxx +++ b/xmloff/source/script/XMLEventExport.cxx @@ -106,8 +106,7 @@ void XMLEventExport::Export( Reference<XEventsSupplier> & rSupplier, void XMLEventExport::Export( Reference<XNameReplace> & rReplace, sal_Bool bWhitespace) { - Reference<XNameAccess> xAccess(rReplace, UNO_QUERY); - Export(xAccess, bWhitespace); + Export(rReplace, bWhitespace); } void XMLEventExport::Export( Reference<XNameAccess> & rAccess, diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index b9ca2ad2e67e..318cc0d1c6f4 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -396,14 +396,13 @@ void XMLStyleExport::exportStyleFamily( if( !xStyleCont.is() ) return; - Reference< XNameAccess > xStyles( xStyleCont, UNO_QUERY ); // If next styles are supported and used styles should be exported only, // the next style may be unused but has to be exported, too. In this case // the names of all exported styles are remembered. boost::scoped_ptr<std::set<OUString> > pExportedStyles(0); sal_Bool bFirstStyle = sal_True; - const uno::Sequence< OUString> aSeq = xStyles->getElementNames(); + const uno::Sequence< OUString> aSeq = xStyleCont->getElementNames(); const OUString* pIter = aSeq.getConstArray(); const OUString* pEnd = pIter + aSeq.getLength(); for(;pIter != pEnd;++pIter) @@ -411,7 +410,7 @@ void XMLStyleExport::exportStyleFamily( Reference< XStyle > xStyle; try { - xStyles->getByName( *pIter ) >>= xStyle; + xStyleCont->getByName( *pIter ) >>= xStyle; } catch(const lang::IndexOutOfBoundsException&) { @@ -428,7 +427,7 @@ void XMLStyleExport::exportStyleFamily( if( !bUsed || xStyle->isInUse() ) { sal_Bool bExported = exportStyle( xStyle, rXMLFamily, rPropMapper, - xStyles,pPrefix ); + xStyleCont,pPrefix ); if( bUsed && bFirstStyle && bExported ) { // If this is the first style, find out whether next styles @@ -464,7 +463,7 @@ void XMLStyleExport::exportStyleFamily( for(;pIter != pEnd;++pIter) { Reference< XStyle > xStyle; - xStyles->getByName( *pIter ) >>= xStyle; + xStyleCont->getByName( *pIter ) >>= xStyle; DBG_ASSERT( xStyle.is(), "Style not found for export!" ); if( xStyle.is() ) @@ -500,7 +499,7 @@ void XMLStyleExport::exportStyleFamily( xStyleCont->getByName( sNextName ) >>= xStyle; DBG_ASSERT( xStyle.is(), "Style not found for export!" ); - if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, xStyles,pPrefix ) ) + if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, xStyleCont, pPrefix ) ) pExportedStyles->insert( sTmp ); } } diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx index 0212621ad528..5c5041876e18 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.cxx +++ b/xmloff/source/text/XMLAutoTextEventExport.cxx @@ -92,8 +92,7 @@ void XMLAutoTextEventExport::initialize( rArguments[1] >>= xReplace; if (xReplace.is()) { - Reference<XNameAccess> xAccess(xReplace, UNO_QUERY); - xEvents = xAccess; + xEvents = xReplace; } else { diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index ae89ab099658..6b538f00fbe6 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -286,9 +286,6 @@ void XMLTextMarkImportContext::EndElement() // create a file with subsequence // start/end elements - Reference<XTextRange> xInsertionRange( - xInsertionCursor, UNO_QUERY); - bool bImportAsField=((lcl_MarkType)nTmp==TypeFieldmarkEnd && m_rHelper.hasCurrentFieldCtx()); // insert reference @@ -296,7 +293,7 @@ void XMLTextMarkImportContext::EndElement() CreateAndInsertMark(GetImport(), (bImportAsField?sAPI_fieldmark:sAPI_bookmark), m_sBookmarkName, - xInsertionRange, + xInsertionCursor, m_sXmlId) ); if (pRDFaAttributes) { diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 4b15efc9acfc..94f91c08a10b 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1715,25 +1715,24 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( makeAny(rCursor->getString())); // insert the field over it's original text - Reference<XTextRange> xRange(rCursor, UNO_QUERY); Reference<XTextContent> xTextContent(xTmp, UNO_QUERY); - if (m_pImpl->m_xText.is() && xRange.is()) + if (m_pImpl->m_xText.is() && rCursor.is()) { // #i107225# the combined characters need to be inserted first // the selected text has to be removed afterwards - m_pImpl->m_xText->insertTextContent( xRange->getStart(), xTextContent, sal_True ); + m_pImpl->m_xText->insertTextContent( rCursor->getStart(), xTextContent, sal_True ); - if( !xRange->getString().isEmpty() ) + if( !rCursor->getString().isEmpty() ) { try { - uno::Reference< text::XTextCursor > xCrsr = xRange->getText()->createTextCursorByRange( xRange->getStart() ); + uno::Reference< text::XTextCursor > xCrsr = rCursor->getText()->createTextCursorByRange( rCursor->getStart() ); xCrsr->goLeft( 1, true ); uno::Reference< beans::XPropertySet> xCrsrProperties( xCrsr, uno::UNO_QUERY_THROW ); //the hard properties of the removed text need to be applied to the combined characters field pStyle->FillPropertySet( xCrsrProperties ); xCrsr->collapseToEnd(); - xCrsr->gotoRange( xRange->getEnd(), true ); + xCrsr->gotoRange( rCursor->getEnd(), true ); xCrsr->setString( OUString() ); } catch(const uno::Exception&) diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 3b5933be9e2f..d6b309b8edf3 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1605,8 +1605,7 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( sal_Bool bIsProgres { Any aAny = xTables->getByIndex( i ); Reference< XTextTable > xTable = *(Reference<XTextTable>*)aAny.getValue(); - Reference < XTextContent > xTextContent( xTable, uno::UNO_QUERY ); - exportTable( xTextContent, sal_True, sal_True ); + exportTable( xTable, sal_True, sal_True ); } } } @@ -1966,17 +1965,16 @@ void XMLTextParagraphExport::exportParagraph( xPropSet ) >>= sStyle; } - Reference< XInterface > xRef( rTextContent, UNO_QUERY ); - if( xRef.is() ) + if( rTextContent.is() ) { - const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( xRef ); + const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( rTextContent ); if( !rIdentifier.isEmpty() ) { // FIXME: this is just temporary until EditEngine // paragraphs implement XMetadatable. // then that must be used and not the mapper, because // when both can be used we get two xml:id! - uno::Reference<rdf::XMetadatable> const xMeta(xRef, + uno::Reference<rdf::XMetadatable> const xMeta(rTextContent, uno::UNO_QUERY); OSL_ENSURE(!xMeta.is(), "paragraph that implements " "XMetadatable used in interfaceToIdentifierMapper?"); diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index a50aee001901..df7faffbb505 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -786,9 +786,7 @@ void XMLMetaImportContextBase::EndElement() xEndRange) ); xInsertionCursor->gotoRange(m_xStart, sal_True); - const Reference<XTextRange> xInsertionRange(xInsertionCursor, UNO_QUERY); - - InsertMeta(xInsertionRange); + InsertMeta(xInsertionCursor); } SvXMLImportContext * XMLMetaImportContextBase::CreateChildContext( @@ -2004,9 +2002,8 @@ XMLParaContext::~XMLParaContext() if( xIdCursor.is() ) { xIdCursor->gotoRange( xEnd, sal_True ); - Reference< XInterface > xRef( xIdCursor, UNO_QUERY ); GetImport().getInterfaceToIdentifierMapper().registerReference( - m_sXmlId, xRef); + m_sXmlId, xIdCursor); } } @@ -2147,16 +2144,13 @@ XMLParaContext::~XMLParaContext() if( !pHint->GetEnd().is() ) pHint->SetEnd(xEnd); - // convert XCursor to XTextRange - Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY); - // reference name uses rStyleName member // borrow from XMLTextMarkImportContext XMLTextMarkImportContext::CreateAndInsertMark( GetImport(), OUString( "com.sun.star.text.ReferenceMark"), rRefName, - xRange); + xAttrCursor); } } break; @@ -2179,9 +2173,8 @@ XMLParaContext::~XMLParaContext() Reference<beans::XPropertySet> xMark( ((const XMLIndexMarkHint_Impl *)pHint)->GetMark()); Reference<XTextContent> xContent(xMark, UNO_QUERY); - Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY); xTxtImport->GetText()->insertTextContent( - xRange, xContent, sal_True ); + xAttrCursor, xContent, sal_True ); } break; case XML_HINT_TEXT_FRAME: @@ -2196,10 +2189,9 @@ XMLParaContext::~XMLParaContext() /* Core impl. of the unification of drawing objects and Writer fly frames (#i26791#) */ - Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY); if ( pFHint->IsBoundAtChar() ) { - xTextContent->attach( xRange ); + xTextContent->attach( xAttrCursor ); } } /* Consider, that hint can also contain a shape - diff --git a/xmloff/source/xforms/xformsexport.cxx b/xmloff/source/xforms/xformsexport.cxx index 28ba107ab108..170cdd1c025d 100644 --- a/xmloff/source/xforms/xformsexport.cxx +++ b/xmloff/source/xforms/xformsexport.cxx @@ -561,7 +561,7 @@ static void lcl_exportDataType( SvXMLExport& rExport, // export facets lcl_exportDataTypeFacets( rExport, - Reference<XPropertySet>( xType, UNO_QUERY ), + xType, aDataTypeFacetTable ); } |