summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 09:49:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 12:22:43 +0200
commitee2bb231036b1d9d954dec369855948e6ea1f53a (patch)
treeeb7d4e569683d981e7cb9c76863f78739eefa870 /basctl
parent1f6c4328bfa00da5cf351dd050a80b75e0f1acde (diff)
loplugin:referencecasting in avmedia..basic
Change-Id: I6790b2e3902d64fb6f714f031affa221dbaba014 Reviewed-on: https://gerrit.libreoffice.org/75934 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/accessibility/accessibledialogcontrolshape.cxx2
-rw-r--r--basctl/source/basicide/baside3.cxx6
-rw-r--r--basctl/source/basicide/bastype2.cxx40
-rw-r--r--basctl/source/basicide/bastype3.cxx4
-rw-r--r--basctl/source/basicide/iderdll.cxx2
-rw-r--r--basctl/source/basicide/moduldl2.cxx23
-rw-r--r--basctl/source/basicide/moduldlg.cxx3
-rw-r--r--basctl/source/dlged/dlged.cxx37
-rw-r--r--basctl/source/dlged/dlgedobj.cxx6
9 files changed, 48 insertions, 75 deletions
diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
index 0eac8917ed00..11b9610375b7 100644
--- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx
+++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
@@ -169,7 +169,7 @@ vcl::Window* AccessibleDialogControlShape::GetWindow() const
vcl::Window* pWindow = nullptr;
if ( m_pDlgEdObj )
{
- Reference< awt::XControl > xControl( m_pDlgEdObj->GetControl(), UNO_QUERY );
+ Reference< awt::XControl > xControl = m_pDlgEdObj->GetControl();
if ( xControl.is() )
pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ).get();
}
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index eda571040c6b..ab9bbe06f544 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1034,16 +1034,14 @@ bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const Script
}
else if( !bLibLocalized )
{
- Reference< resource::XStringResourceManager > xImportStringResourceManager( xImportStringResource, UNO_QUERY );
- LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResourceManager );
+ LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResource );
bCopyResourcesForDialog = false;
}
if( bCopyResourcesForDialog )
{
- Reference< resource::XStringResourceResolver > xImportStringResourceResolver( xImportStringResource, UNO_QUERY );
LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, aXmlDlgName,
- xLibStringResourceManager, xImportStringResourceResolver );
+ xLibStringResourceManager, xImportStringResource );
}
}
else if( bLibLocalized )
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 2141278861b2..b63a2f889daf 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -696,20 +696,16 @@ void TreeListBox::GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& r
try
{
OUString sModule( xModuleManager->identify( rDocument.getDocument() ) );
- Reference< container::XNameAccess > xModuleConfig( xModuleManager, UNO_QUERY );
- if ( xModuleConfig.is() )
+ Sequence< beans::PropertyValue > aModuleDescr;
+ xModuleManager->getByName( sModule ) >>= aModuleDescr;
+ sal_Int32 nCount = aModuleDescr.getLength();
+ const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray();
+ for ( sal_Int32 i = 0; i < nCount; ++i )
{
- Sequence< beans::PropertyValue > aModuleDescr;
- xModuleConfig->getByName( sModule ) >>= aModuleDescr;
- sal_Int32 nCount = aModuleDescr.getLength();
- const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray();
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ if ( pModuleDescr[ i ].Name == "ooSetupFactoryEmptyDocumentURL" )
{
- if ( pModuleDescr[ i ].Name == "ooSetupFactoryEmptyDocumentURL" )
- {
- pModuleDescr[ i ].Value >>= sFactoryURL;
- break;
- }
+ pModuleDescr[ i ].Value >>= sFactoryURL;
+ break;
}
}
}
@@ -1392,20 +1388,16 @@ OUString SbTreeListBox::GetRootEntryBitmaps(const ScriptDocument& rDocument)
try
{
OUString sModule( xModuleManager->identify( rDocument.getDocument() ) );
- Reference< container::XNameAccess > xModuleConfig( xModuleManager, UNO_QUERY );
- if ( xModuleConfig.is() )
+ Sequence< beans::PropertyValue > aModuleDescr;
+ xModuleManager->getByName( sModule ) >>= aModuleDescr;
+ sal_Int32 nCount = aModuleDescr.getLength();
+ const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray();
+ for ( sal_Int32 i = 0; i < nCount; ++i )
{
- Sequence< beans::PropertyValue > aModuleDescr;
- xModuleConfig->getByName( sModule ) >>= aModuleDescr;
- sal_Int32 nCount = aModuleDescr.getLength();
- const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray();
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ if ( pModuleDescr[ i ].Name == "ooSetupFactoryEmptyDocumentURL" )
{
- if ( pModuleDescr[ i ].Name == "ooSetupFactoryEmptyDocumentURL" )
- {
- pModuleDescr[ i ].Value >>= sFactoryURL;
- break;
- }
+ pModuleDescr[ i ].Value >>= sFactoryURL;
+ break;
}
}
}
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 084b7def7345..e4944bda3f97 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -89,7 +89,7 @@ void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry )
// load dialog library
bool bDlgLibLoaded = false;
- Reference< script::XLibraryContainer > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
+ Reference< script::XLibraryContainer > xDlgLibContainer = aDocument.getLibraryContainer( E_DIALOGS );
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
{
if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
@@ -178,7 +178,7 @@ IMPL_LINK(SbTreeListBox, RequestingChildrenHdl, const weld::TreeIter&, rEntry, b
// load dialog library
bool bDlgLibLoaded = false;
- Reference< script::XLibraryContainer > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
+ Reference< script::XLibraryContainer > xDlgLibContainer = aDocument.getLibraryContainer( E_DIALOGS );
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
{
if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx
index 12b8c3f6a8a9..9f2f2dcf6315 100644
--- a/basctl/source/basicide/iderdll.cxx
+++ b/basctl/source/basicide/iderdll.cxx
@@ -179,7 +179,7 @@ IMPL_STATIC_LINK(ExtraData, GlobalBasicBreakHdl, StarBASIC *, pBasic, BasicDebug
if ( aDocument.isValid() )
{
OUString aOULibName( pBasic->GetName() );
- Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
+ Reference< script::XLibraryContainer > xModLibContainer = aDocument.getLibraryContainer( E_SCRIPTS );
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
{
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 37254f2c63ee..515cbc55aa67 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -271,8 +271,7 @@ IMPL_LINK(LibPage, EditingEntryHdl, const weld::TreeIter&, rIter, bool)
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{
OUString aPassword;
- Reference< script::XLibraryContainer > xModLibContainer1( xModLibContainer, UNO_QUERY );
- bOK = QueryPassword( xModLibContainer1, aLibName, aPassword );
+ bOK = QueryPassword( xModLibContainer, aLibName, aPassword );
}
if ( !bOK )
return false;
@@ -613,13 +612,13 @@ void LibPage::InsertLib()
OUString aModURL( aModURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
if ( xSFA->exists( aModURL ) )
{
- xModLibContImport.set( script::DocumentScriptLibraryContainer::createWithURL(xContext, aModURL), UNO_QUERY );
+ xModLibContImport = script::DocumentScriptLibraryContainer::createWithURL(xContext, aModURL);
}
OUString aDlgURL( aDlgURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
if ( xSFA->exists( aDlgURL ) )
{
- xDlgLibContImport.set( script::DocumentDialogLibraryContainer::createWithURL(xContext, aDlgURL), UNO_QUERY );
+ xDlgLibContImport = script::DocumentDialogLibraryContainer::createWithURL(xContext, aDlgURL);
}
if ( !xModLibContImport.is() && !xDlgLibContImport.is() )
@@ -627,9 +626,7 @@ void LibPage::InsertLib()
std::shared_ptr<LibDialog> xLibDlg;
- Reference< script::XLibraryContainer > xModLibContImp( xModLibContImport, UNO_QUERY );
- Reference< script::XLibraryContainer > xDlgLibContImp( xDlgLibContImport, UNO_QUERY );
- Sequence< OUString > aLibNames = GetMergedLibraryNames( xModLibContImp, xDlgLibContImp );
+ Sequence< OUString > aLibNames = GetMergedLibraryNames( xModLibContImport, xDlgLibContImport );
sal_Int32 nLibCount = aLibNames.getLength();
const OUString* pLibNames = aLibNames.getConstArray();
for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
@@ -672,7 +669,7 @@ void LibPage::InsertLib()
if ( aExtension != aLibExtension && aExtension != aContExtension )
xLibDlg->EnableReference(false);
- weld::DialogController::runAsync(xLibDlg, [aContExtension, aDlgURLObj, aExtension, aLibExtension, aModURLObj, xLibDlg, xDlgLibContImport, xModLibContImp, xModLibContImport, this](sal_Int32 nResult)
+ weld::DialogController::runAsync(xLibDlg, [aContExtension, aDlgURLObj, aExtension, aLibExtension, aModURLObj, xLibDlg, xDlgLibContImport, xModLibContImport, this](sal_Int32 nResult)
{
if (!nResult )
return;
@@ -744,7 +741,7 @@ void LibPage::InsertLib()
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY );
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) && !bReference )
{
- bOK = QueryPassword( xModLibContImp, aLibName, aPassword, true, true );
+ bOK = QueryPassword( xModLibContImport, aLibName, aPassword, true, true );
if ( !bOK )
{
@@ -928,8 +925,7 @@ void LibPage::Export()
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{
OUString aPassword;
- Reference< script::XLibraryContainer > xModLibContainer1( xModLibContainer, UNO_QUERY );
- bOK = QueryPassword( xModLibContainer1, aLibName, aPassword );
+ bOK = QueryPassword( xModLibContainer, aLibName, aPassword );
}
if ( !bOK )
return;
@@ -1052,10 +1048,7 @@ void LibPage::ExportAsPackage( const OUString& aLibName )
Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) );
implExportLib( aLibName, aTmpPath, xDummyHandler );
- Reference< XCommandEnvironment > xCmdEnv =
- new OLibCommandEnvironment(
- Reference< task::XInteractionHandler >(
- xHandler, UNO_QUERY));
+ Reference< XCommandEnvironment > xCmdEnv = new OLibCommandEnvironment(xHandler);
::ucbhelper::Content sourceContent( aSourcePath, xCmdEnv, comphelper::getProcessComponentContext() );
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 531fd7a00e0e..cf4ff447547f 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -165,8 +165,7 @@ void Shell::CopyDialogResources(
{
if( bSourceLocalized && bDestLocalized )
{
- Reference< resource::XStringResourceResolver > xSourceStringResolver( xSourceMgr, UNO_QUERY );
- LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, rDlgName, xDestMgr, xSourceStringResolver );
+ LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, rDlgName, xDestMgr, xSourceMgr );
}
else if( bSourceLocalized )
{
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 33d10a9ed7df..9d276a92ff7b 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -362,11 +362,10 @@ void DlgEditor::SetDialog( const uno::Reference< container::XNameContainer >& xU
pDlgEdForm->StartListening();
// create controls
- Reference< css::container::XNameAccess > xNameAcc( m_xUnoControlDialogModel, UNO_QUERY );
- if ( xNameAcc.is() )
+ if ( m_xUnoControlDialogModel.is() )
{
// get sequence of control names
- Sequence< OUString > aNames = xNameAcc->getElementNames();
+ Sequence< OUString > aNames = m_xUnoControlDialogModel->getElementNames();
const OUString* pNames = aNames.getConstArray();
sal_Int32 nCtrls = aNames.getLength();
@@ -379,7 +378,7 @@ void DlgEditor::SetDialog( const uno::Reference< container::XNameContainer >& xU
// get tab index
sal_Int16 nTabIndex = -1;
- Any aCtrl = xNameAcc->getByName( aName );
+ Any aCtrl = m_xUnoControlDialogModel->getByName( aName );
Reference< css::beans::XPropertySet > xPSet;
aCtrl >>= xPSet;
if ( xPSet.is() )
@@ -392,7 +391,7 @@ void DlgEditor::SetDialog( const uno::Reference< container::XNameContainer >& xU
// create controls and insert them into drawing page
for (auto const& indexToName : aIndexToNameMap)
{
- Any aCtrl = xNameAcc->getByName( indexToName.second );
+ Any aCtrl = m_xUnoControlDialogModel->getByName( indexToName.second );
Reference< css::awt::XControlModel > xCtrlModel;
aCtrl >>= xCtrlModel;
DlgEdObj* pCtrlObj = new DlgEdObj(*pDlgEdModel);
@@ -679,10 +678,9 @@ void DlgEditor::Copy()
Reference< util::XCloneable > xNewClone = xClone->createClone();
Reference< container::XNameContainer > xClipDialogModel( xNewClone, UNO_QUERY );
- Reference< container::XNameAccess > xNAcc( xClipDialogModel, UNO_QUERY );
- if ( xNAcc.is() )
+ if ( xClipDialogModel.is() )
{
- Sequence< OUString > aNames = xNAcc->getElementNames();
+ Sequence< OUString > aNames = xClipDialogModel->getElementNames();
const OUString* pNames = aNames.getConstArray();
sal_uInt32 nCtrls = aNames.getLength();
@@ -708,10 +706,9 @@ void DlgEditor::Copy()
xMarkPSet->getPropertyValue( DLGED_PROP_NAME ) >>= aName;
}
- Reference< container::XNameAccess > xNameAcc(m_xUnoControlDialogModel, UNO_QUERY );
- if ( xNameAcc.is() && xNameAcc->hasByName(aName) )
+ if ( m_xUnoControlDialogModel.is() && m_xUnoControlDialogModel->hasByName(aName) )
{
- Any aCtrl = xNameAcc->getByName( aName );
+ Any aCtrl = m_xUnoControlDialogModel->getByName( aName );
// clone control model
Reference< util::XCloneable > xCtrl;
@@ -759,9 +756,7 @@ void DlgEditor::Copy()
// With resource, support old and new format
// Export xClipDialogModel another time with ids replaced by current language string
- uno::Reference< resource::XStringResourceManager >
- xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
- LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
+ LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourcePersistence );
Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
Reference< XInputStream > xStream2( xISP2->createInputStream() );
Sequence< sal_Int8 > NoResourceDialogModelBytes;
@@ -906,10 +901,9 @@ void DlgEditor::Paste()
}
// get control models from clipboard dialog model
- Reference< css::container::XNameAccess > xNameAcc( xClipDialogModel, UNO_QUERY );
- if ( xNameAcc.is() )
+ if ( xClipDialogModel.is() )
{
- Sequence< OUString > aNames = xNameAcc->getElementNames();
+ Sequence< OUString > aNames = xClipDialogModel->getElementNames();
const OUString* pNames = aNames.getConstArray();
sal_uInt32 nCtrls = aNames.getLength();
@@ -921,7 +915,7 @@ void DlgEditor::Paste()
}
for( sal_uInt32 n = 0; n < nCtrls; n++ )
{
- Any aA = xNameAcc->getByName( pNames[n] );
+ Any aA = xClipDialogModel->getByName( pNames[n] );
Reference< css::awt::XControlModel > xCM;
aA >>= xCM;
@@ -940,8 +934,7 @@ void DlgEditor::Paste()
xPSet->setPropertyValue( DLGED_PROP_NAME, Any(aOUniqueName) );
// set tabindex
- Reference< container::XNameAccess > xNA( m_xUnoControlDialogModel , UNO_QUERY );
- Sequence< OUString > aNames_ = xNA->getElementNames();
+ Sequence< OUString > aNames_ = m_xUnoControlDialogModel->getElementNames();
xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any(static_cast<sal_Int16>(aNames_.getLength())) );
if( bLocalized )
@@ -950,10 +943,8 @@ void DlgEditor::Paste()
aControlAny <<= xCtrlModel;
if( bSourceIsLocalized && xStringResourcePersistence.is() )
{
- Reference< resource::XStringResourceResolver >
- xSourceStringResolver( xStringResourcePersistence, UNO_QUERY );
LocalizationMgr::copyResourcesForPastedEditorObject( this,
- aControlAny, aOUniqueName, xSourceStringResolver );
+ aControlAny, aOUniqueName, xStringResourcePersistence );
}
else
{
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 32ad92c98692..0d491bd303e0 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -464,7 +464,7 @@ void DlgEdObj::NameChange( const css::beans::PropertyChangeEvent& evt )
Reference< container::XNameContainer > xCont(xNameAcc, UNO_QUERY );
if ( xCont.is() )
{
- Reference< awt::XControlModel > xCtrl(GetUnoControlModel(), UNO_QUERY);
+ Reference< awt::XControlModel > xCtrl = GetUnoControlModel();
Any aAny;
aAny <<= xCtrl;
xCont->removeByName( aOldName );
@@ -1521,7 +1521,7 @@ void DlgEdForm::UpdateGroups()
sal_uInt32 nSize = aChildList.size();
Sequence< Reference< awt::XControl > > aSeqControls( nSize );
for ( sal_uInt32 i = 0; i < nSize; ++i )
- aSeqControls.getArray()[i].set( aChildList[i]->GetControl(), UNO_QUERY );
+ aSeqControls.getArray()[i] = aChildList[i]->GetControl();
sal_Int32 nGroupCount = xTabModel->getGroupCount();
for ( sal_Int32 nGroup = 0; nGroup < nGroupCount; ++nGroup )
@@ -1557,7 +1557,7 @@ void DlgEdForm::UpdateGroups()
}
// set the group at the dialog peer
- Reference< awt::XControl > xDlg( GetControl(), UNO_QUERY );
+ Reference< awt::XControl > xDlg = GetControl();
if ( xDlg.is() )
{
Reference< awt::XVclContainerPeer > xDlgPeer( xDlg->getPeer(), UNO_QUERY );