[Libreoffice-commits] core.git: basctl/source basic/source comphelper/source compilerplugins/clang cui/source dbaccess/source desktop/source extensions/source filter/source forms/source framework/source oox/source package/source scripting/source sc/source sdext/source sd/source sfx2/source svtools/source svx/source sw/source toolkit/source ucb/source unotools/source unoxml/source xmloff/source
Noel Grandin
noel at peralex.com
Wed May 22 03:44:51 PDT 2013
basctl/source/basicide/baside3.cxx | 4
basctl/source/basicide/moduldl2.cxx | 14
basic/source/basmgr/basicmanagerrepository.cxx | 10
basic/source/uno/dlgcont.cxx | 2
basic/source/uno/namecont.cxx | 15
comphelper/source/processfactory/processfactory.cxx | 4
compilerplugins/clang/store/referencecasting.cxx | 194 ++++++++++
compilerplugins/clang/store/referencecasting.hxx | 31 +
cui/source/dialogs/hangulhanjadlg.cxx | 7
cui/source/options/optdict.cxx | 3
dbaccess/source/core/dataaccess/ModelImpl.cxx | 6
dbaccess/source/core/dataaccess/connection.cxx | 2
dbaccess/source/core/dataaccess/datasource.cxx | 6
dbaccess/source/core/dataaccess/documentdefinition.cxx | 9
dbaccess/source/core/recovery/subcomponentloader.cxx | 4
dbaccess/source/ext/macromigration/migrationengine.cxx | 6
dbaccess/source/ui/app/subcomponentmanager.cxx | 5
dbaccess/source/ui/browser/exsrcbrw.cxx | 15
dbaccess/source/ui/dlg/dbwizsetup.cxx | 3
desktop/source/app/app.cxx | 3
extensions/source/abpilot/datasourcehandling.cxx | 10
extensions/source/bibliography/datman.cxx | 4
extensions/source/propctrlr/formcomponenthandler.cxx | 5
extensions/source/propctrlr/formgeometryhandler.cxx | 3
extensions/source/propctrlr/formlinkdialog.cxx | 16
filter/source/msfilter/svdfppt.cxx | 22 -
filter/source/svg/svgexport.cxx | 20 -
filter/source/svg/svgwriter.cxx | 15
filter/source/xsltdialog/xmlfiltertestdialog.cxx | 5
forms/source/component/FormattedField.cxx | 10
forms/source/component/navigationbar.cxx | 14
forms/source/component/scrollbar.cxx | 4
forms/source/component/spinbutton.cxx | 4
forms/source/misc/InterfaceContainer.cxx | 3
forms/source/xforms/model.cxx | 2
forms/source/xforms/model_ui.cxx | 6
forms/source/xforms/submission.cxx | 2
forms/source/xforms/submission/replace.cxx | 4
framework/source/fwe/helper/actiontriggerhelper.cxx | 7
framework/source/fwe/helper/documentundoguard.cxx | 2
framework/source/fwe/xml/menuconfiguration.cxx | 5
framework/source/fwe/xml/statusbarconfiguration.cxx | 3
framework/source/layoutmanager/layoutmanager.cxx | 2
framework/source/services/backingwindow.cxx | 2
framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 35 -
framework/source/uiconfiguration/uiconfigurationmanager.cxx | 26 -
framework/source/uielement/toolbarmanager.cxx | 2
framework/source/uifactory/menubarfactory.cxx | 2
framework/source/uifactory/uielementfactorymanager.cxx | 2
framework/source/xml/imagesconfiguration.cxx | 3
oox/source/drawingml/chart/converterbase.cxx | 9
oox/source/drawingml/textfield.cxx | 9
oox/source/drawingml/textparagraph.cxx | 7
oox/source/drawingml/textrun.cxx | 8
oox/source/export/drawingml.cxx | 2
oox/source/export/shapes.cxx | 8
oox/source/helper/containerhelper.cxx | 3
package/source/manifest/ManifestWriter.cxx | 3
sc/source/filter/excel/xecontent.cxx | 7
sc/source/filter/excel/xichart.cxx | 5
sc/source/filter/oox/stylesbuffer.cxx | 3
sc/source/filter/oox/viewsettings.cxx | 3
sc/source/filter/oox/workbookhelper.cxx | 3
sc/source/filter/oox/worksheetbuffer.cxx | 5
scripting/source/dlgprov/dlgprov.cxx | 4
scripting/source/provider/BrowseNodeFactoryImpl.cxx | 2
scripting/source/stringresource/stringresource.cxx | 6
sd/source/core/CustomAnimationEffect.cxx | 74 +--
sd/source/core/sdpage2.cxx | 6
sd/source/core/stlpool.cxx | 2
sd/source/filter/eppt/pptexanimations.cxx | 4
sd/source/ui/animations/CustomAnimationPane.cxx | 3
sd/source/ui/framework/factories/BasicViewFactory.cxx | 5
sd/source/ui/view/ViewShellBase.cxx | 3
sdext/source/minimizer/graphiccollector.cxx | 18
sdext/source/presenter/PresenterViewFactory.cxx | 2
sfx2/source/appl/newhelp.cxx | 12
sfx2/source/dialog/taskpane.cxx | 2
sfx2/source/view/frame2.cxx | 2
sfx2/source/view/viewfrm.cxx | 3
svtools/source/contnr/templwin.cxx | 2
svx/source/dialog/rubydialog.cxx | 5
svx/source/form/filtnav.cxx | 9
svx/source/form/fmobj.cxx | 4
svx/source/form/fmpgeimp.cxx | 8
svx/source/form/fmshimp.cxx | 6
svx/source/form/fmtools.cxx | 7
svx/source/form/fmundo.cxx | 6
svx/source/form/fmvwimp.cxx | 8
svx/source/form/formcontroller.cxx | 18
svx/source/form/formcontrolling.cxx | 3
svx/source/form/navigatortree.cxx | 4
svx/source/form/navigatortreemodel.cxx | 2
sw/source/filter/xml/xmlexp.cxx | 5
sw/source/filter/xml/xmltbli.cxx | 2
sw/source/ui/dbui/dbmgr.cxx | 6
sw/source/ui/dbui/dbtree.cxx | 9
toolkit/source/controls/controlmodelcontainerbase.cxx | 3
toolkit/source/controls/grid/defaultgridcolumnmodel.cxx | 3
toolkit/source/controls/tabpagecontainer.cxx | 3
ucb/source/cacher/dynamicresultsetwrapper.cxx | 3
ucb/source/ucp/file/bc.cxx | 3
ucb/source/ucp/file/filglob.cxx | 23 -
ucb/source/ucp/ftp/ftpcontent.cxx | 3
unotools/source/config/configitem.cxx | 2
unoxml/source/dom/attr.cxx | 2
unoxml/source/dom/characterdata.cxx | 2
unoxml/source/dom/document.cxx | 2
unoxml/source/dom/element.cxx | 8
unoxml/source/dom/node.cxx | 6
unoxml/source/dom/node.hxx | 2
unoxml/source/dom/saxbuilder.cxx | 12
xmloff/source/core/DomBuilderContext.cxx | 5
xmloff/source/core/DomExport.cxx | 2
xmloff/source/script/XMLEventExport.cxx | 3
xmloff/source/style/styleexp.cxx | 11
xmloff/source/text/XMLAutoTextEventExport.cxx | 3
xmloff/source/text/XMLTextMarkImportContext.cxx | 5
xmloff/source/text/txtimp.cxx | 11
xmloff/source/text/txtparae.cxx | 10
xmloff/source/text/txtparai.cxx | 18
xmloff/source/xforms/xformsexport.cxx | 2
122 files changed, 550 insertions(+), 507 deletions(-)
New commits:
commit 6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37
Author: Noel Grandin <noel at peralex.com>
Date: Thu May 2 10:36:43 2013 +0200
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 at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
Tested-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index a6b8774..6a0a688 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 68b41ba..ae513291 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 7b81631..d7a7bf1 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 6ba2ff1..a20fd88 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 69e8fbf..4586bac 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 fe6c96b..5690cc0 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 0000000..c05c233
--- /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 0000000..732e32d
--- /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 edbd7c2..ffa32ff 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 eab99e4..8572341 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 e015e7c..e269f19 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 8691098..3f70b12 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 2b3147b..d8e24d7 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 6ea9709..1e9b62c 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 85ae960..5dd294d 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 7c5a37d..85d2aed 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 5ed65de..24b20c3 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 7ae47ed..b45555b 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 e16813f..2679257 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 195776f..de16f0a 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 9c94c01..bc0f78e 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 f4cfa2b..3509dc0 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 0937f14..cf19975 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 6738b66..ae513295 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 2fdf007..079e6f0 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 c82dbfd..e4e1ae1 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 27a7125..d923b49 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 410215a..d1f3c4a 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 099aec7..8073932 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 ca31425..fc3fd0f 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 2138caf..9d1ac5f 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 fbab6e7..e0ecb47 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 1faa874..70237f3 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 3a1361d..9996a7d 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 6086337..8a27b2e 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 39c2690..7e28623 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 a9dd534..cc4f53c 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 18da787..24391c0 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 08f01d3..67fdd65 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 470eb02..cec4c0a 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 0f0e894..3e36001 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 b2a4f83..22f2b8b 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 0c75daa..65cf4b7 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 f18152b..5f03d48 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 f4d6883..5cf8482 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 c32e2d9..51ee1de 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 05f15ba..fdbb17b 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 6cf90ce..ef24e55 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 8669247..cf3237a 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 5325dcb..31bd8e6 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 e36ecf1..fde8d67 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 95f5e24..bf566ba 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 4679858..c4e82b3 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 6193cf0..c4648c2 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 b083112..6f28d92 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 75a5b59..c487d2d 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 0686395..bc2f76f 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 f6a0c0b..eaf6794 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 63a4e90..5ee12cc 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 cb85b90..d5cd131 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 4d4a205..0d0467d 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 ba92331..9607083 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 09c6947..6ab4eca 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 );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list