diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 12:53:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-23 09:02:58 +0200 |
commit | a8622c77d26ca7a635afc95bba9a5054dc31eb7c (patch) | |
tree | ecb1ce71272291515dec10fc5fe94061f7231b78 /sfx2 | |
parent | 2684aefcf5d2804351bda01a2d2fe7bbbd351451 (diff) |
loplugin:flatten in sdext..stoc
Change-Id: I460e813e20a691c53738373376d3363f553bbab2
Reviewed-on: https://gerrit.libreoffice.org/42636
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/thumbnailviewacc.cxx | 21 | ||||
-rw-r--r-- | sfx2/source/doc/Metadatable.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/doc/printhelper.cxx | 19 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 184 | ||||
-rw-r--r-- | sfx2/source/sidebar/UnoDecks.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/sidebar/UnoPanels.cxx | 12 |
9 files changed, 135 insertions, 180 deletions
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index cab703490918..d6f977f4bd74 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -138,14 +138,12 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewAcc::getAcces { ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; - uno::Reference< accessibility::XAccessible > xRet; ThumbnailViewItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i)); - if( pItem ) - xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled ); - else + if( !pItem ) throw lang::IndexOutOfBoundsException(); + uno::Reference< accessibility::XAccessible > xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled ); return xRet; } @@ -414,12 +412,10 @@ void SAL_CALL ThumbnailViewAcc::selectAccessibleChild( sal_Int32 nChildIndex ) const SolarMutexGuard aSolarGuard; ThumbnailViewItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex)); - if(pItem != nullptr) - { - mpParent->SelectItem( pItem->mnId ); - } - else + if(pItem == nullptr) throw lang::IndexOutOfBoundsException(); + + mpParent->SelectItem( pItem->mnId ); } sal_Bool SAL_CALL ThumbnailViewAcc::isAccessibleChildSelected( sal_Int32 nChildIndex ) @@ -427,14 +423,11 @@ sal_Bool SAL_CALL ThumbnailViewAcc::isAccessibleChildSelected( sal_Int32 nChildI ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; ThumbnailViewItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex)); - bool bRet = false; - if (pItem != nullptr) - bRet = mpParent->IsItemSelected( pItem->mnId ); - else + if (pItem == nullptr) throw lang::IndexOutOfBoundsException(); - return bRet; + return mpParent->IsItemSelected( pItem->mnId ); } void SAL_CALL ThumbnailViewAcc::clearAccessibleSelection() diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index b7913dc4e349..2879e12e1131 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -1281,15 +1281,13 @@ void Metadatable::SetMetadataReference( const css::beans::StringPair & i_rRefere IsInContent() ? s_content : s_styles ); } XmlIdRegistry & rReg( dynamic_cast<XmlIdRegistry&>( GetRegistry() ) ); - if (rReg.TryRegisterMetadatable(*this, streamName, i_rReference.Second)) - { - m_pReg = &rReg; - } - else + if (!rReg.TryRegisterMetadatable(*this, streamName, i_rReference.Second)) { throw lang::IllegalArgumentException( "Metadatable::SetMetadataReference: argument is invalid", /*this*/nullptr, 0); } + + m_pReg = &rReg; } } diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index ecbdededf266..f3e6c5124024 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1843,16 +1843,15 @@ SfxDocumentMetaData::storeToStorage( xExp->setSourceDocument(css::uno::Reference<css::lang::XComponent>(this)); css::uno::Reference<css::document::XFilter> xFilter(xExp, css::uno::UNO_QUERY_THROW); - if (xFilter->filter(css::uno::Sequence< css::beans::PropertyValue >())) { - css::uno::Reference<css::embed::XTransactedObject> xTransaction( - xStorage, css::uno::UNO_QUERY); - if (xTransaction.is()) { - xTransaction->commit(); - } - } else { + if (!xFilter->filter(css::uno::Sequence< css::beans::PropertyValue >())) { throw css::io::IOException( "SfxDocumentMetaData::storeToStorage: cannot filter", *this); } + css::uno::Reference<css::embed::XTransactedObject> xTransaction( + xStorage, css::uno::UNO_QUERY); + if (xTransaction.is()) { + xTransaction->commit(); + } } void SAL_CALL @@ -1955,17 +1954,16 @@ void SAL_CALL SfxDocumentMetaData::initialize( const css::uno::Sequence< css::un for (sal_Int32 i = 0; i < aArguments.getLength(); ++i) { const css::uno::Any any = aArguments[i]; - if (any >>= xDoc) { - if (!xDoc.is()) { - throw css::lang::IllegalArgumentException( - "SfxDocumentMetaData::initialize: argument is null", - *this, static_cast<sal_Int16>(i)); - } - } else { + if (!(any >>= xDoc)) { throw css::lang::IllegalArgumentException( "SfxDocumentMetaData::initialize: argument must be XDocument", *this, static_cast<sal_Int16>(i)); } + if (!xDoc.is()) { + throw css::lang::IllegalArgumentException( + "SfxDocumentMetaData::initialize: argument is null", + *this, static_cast<sal_Int16>(i)); + } } if (!xDoc.is()) { diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 75a6c4f9353b..548ccd30d161 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -613,15 +613,7 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName ) GetMediaDescr() >> aPropsForDialog; xFilterProperties->setPropertyValues( aPropsForDialog ); - if( xFilterDialog->execute() ) - { - uno::Sequence< beans::PropertyValue > aPropsFromDialog = - xFilterProperties->getPropertyValues(); - const sal_Int32 nPropsLen {aPropsFromDialog.getLength()}; - for ( sal_Int32 nInd = 0; nInd < nPropsLen; ++nInd ) - GetMediaDescr()[aPropsFromDialog[nInd].Name] = aPropsFromDialog[nInd].Value; - } - else + if( !xFilterDialog->execute() ) { throw task::ErrorCodeIOException( ("ModelData_Impl::ExecuteFilterDialog_Impl:" @@ -629,6 +621,12 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName ) uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); } + + uno::Sequence< beans::PropertyValue > aPropsFromDialog = + xFilterProperties->getPropertyValues(); + const sal_Int32 nPropsLen {aPropsFromDialog.getLength()}; + for ( sal_Int32 nInd = 0; nInd < nPropsLen; ++nInd ) + GetMediaDescr()[aPropsFromDialog[nInd].Name] = aPropsFromDialog[nInd].Value; } } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 0dfd5b80959f..6dc7fc317dc2 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -622,15 +622,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) SfxStoringHelper aHelper; - if ( QueryHiddenInformation( bIsPDFExport ? HiddenWarningFact::WhenCreatingPDF : HiddenWarningFact::WhenSaving, nullptr ) == RET_YES ) - { - aHelper.GUIStoreModel( GetModel(), - OUString::createFromAscii( pSlot->GetUnoName() ), - aDispatchArgs, - bPreselectPassword, - GetDocumentSignatureState() ); - } - else + if ( QueryHiddenInformation( bIsPDFExport ? HiddenWarningFact::WhenCreatingPDF : HiddenWarningFact::WhenSaving, nullptr ) != RET_YES ) { // the user has decided not to store the document throw task::ErrorCodeIOException( @@ -638,6 +630,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); } + aHelper.GUIStoreModel( GetModel(), + OUString::createFromAscii( pSlot->GetUnoName() ), + aDispatchArgs, + bPreselectPassword, + GetDocumentSignatureState() ); + + // merge aDispatchArgs to the request SfxAllItemSet aResultParams( GetPool() ); TransformParameters( nId, diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index f4824a6b8fe8..3e02827bbe6e 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -698,7 +698,6 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& sal_Int32 nCopies = 0; if ( !( rProp.Value >>= nCopies ) ) throw css::lang::IllegalArgumentException(); - aCheckedArgs[nProps].Name = rProp.Name; aCheckedArgs[nProps++].Value <<= nCopies; } @@ -708,26 +707,20 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& else if ( rProp.Name == "Collate" || rProp.Name == "Sort" ) { bool bTemp; - if ( rProp.Value >>= bTemp ) - { - aCheckedArgs[nProps].Name = "Collate"; - aCheckedArgs[nProps++].Value <<= bTemp; - } - else + if ( !(rProp.Value >>= bTemp) ) throw css::lang::IllegalArgumentException(); + aCheckedArgs[nProps].Name = "Collate"; + aCheckedArgs[nProps++].Value <<= bTemp; } // Pages-Property else if ( rProp.Name == "Pages" ) { OUString sTemp; - if( rProp.Value >>= sTemp ) - { - aCheckedArgs[nProps].Name = rProp.Name; - aCheckedArgs[nProps++].Value <<= sTemp; - } - else + if( !(rProp.Value >>= sTemp) ) throw css::lang::IllegalArgumentException(); + aCheckedArgs[nProps].Name = rProp.Name; + aCheckedArgs[nProps++].Value <<= sTemp; } // MonitorVisible diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index d3907953cbb0..ce5f43c9bf9d 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1878,95 +1878,87 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla { if ( aFlavor.MimeType == "application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"" ) { - if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() ) - { - TransferableObjectDescriptor aDesc; + if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() ) + throw datatransfer::UnsupportedFlavorException(); - aDesc.maClassName = m_pData->m_pObjectShell->GetClassName(); - aDesc.maTypeName = aFlavor.HumanPresentableName; + TransferableObjectDescriptor aDesc; - // TODO/LATER: ViewAspect needs to be sal_Int64 - aDesc.mnViewAspect = sal::static_int_cast< sal_uInt16 >( embed::Aspects::MSOLE_CONTENT ); + aDesc.maClassName = m_pData->m_pObjectShell->GetClassName(); + aDesc.maTypeName = aFlavor.HumanPresentableName; - Size aSize = m_pData->m_pObjectShell->GetVisArea().GetSize(); + // TODO/LATER: ViewAspect needs to be sal_Int64 + aDesc.mnViewAspect = sal::static_int_cast< sal_uInt16 >( embed::Aspects::MSOLE_CONTENT ); - MapUnit aMapUnit = m_pData->m_pObjectShell->GetMapUnit(); - aDesc.maSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MapUnit::Map100thMM ); - aDesc.maDragStartPos = Point(); - aDesc.maDisplayName.clear(); + Size aSize = m_pData->m_pObjectShell->GetVisArea().GetSize(); - SvMemoryStream aMemStm( 1024, 1024 ); - WriteTransferableObjectDescriptor( aMemStm, aDesc ); - aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Tell() ); - } - else - throw datatransfer::UnsupportedFlavorException(); + MapUnit aMapUnit = m_pData->m_pObjectShell->GetMapUnit(); + aDesc.maSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MapUnit::Map100thMM ); + aDesc.maDragStartPos = Point(); + aDesc.maDisplayName.clear(); + + SvMemoryStream aMemStm( 1024, 1024 ); + WriteTransferableObjectDescriptor( aMemStm, aDesc ); + aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Tell() ); } else if ( aFlavor.MimeType == "application/x-openoffice-embed-source;windows_formatname=\"Star EMBS\"" ) { - if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() ) + if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() ) + throw datatransfer::UnsupportedFlavorException(); + + try + { + utl::TempFile aTmp; + aTmp.EnableKillingFile(); + storeToURL( aTmp.GetURL(), Sequence < beans::PropertyValue >() ); + SvStream* pStream = aTmp.GetStream( StreamMode::READ ); + const sal_uInt32 nLen = pStream->Seek( STREAM_SEEK_TO_END ); + Sequence< sal_Int8 > aSeq( nLen ); + pStream->Seek( STREAM_SEEK_TO_BEGIN ); + pStream->ReadBytes(aSeq.getArray(), nLen); + delete pStream; + if( aSeq.getLength() ) + aAny <<= aSeq; + } + catch ( Exception& ) { - try - { - utl::TempFile aTmp; - aTmp.EnableKillingFile(); - storeToURL( aTmp.GetURL(), Sequence < beans::PropertyValue >() ); - SvStream* pStream = aTmp.GetStream( StreamMode::READ ); - const sal_uInt32 nLen = pStream->Seek( STREAM_SEEK_TO_END ); - Sequence< sal_Int8 > aSeq( nLen ); - pStream->Seek( STREAM_SEEK_TO_BEGIN ); - pStream->ReadBytes(aSeq.getArray(), nLen); - delete pStream; - if( aSeq.getLength() ) - aAny <<= aSeq; - } - catch ( Exception& ) - { - } } - else - throw datatransfer::UnsupportedFlavorException(); } else if ( aFlavor.MimeType == "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) { - if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() ) - { + if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() ) + throw datatransfer::UnsupportedFlavorException(); - std::shared_ptr<GDIMetaFile> xMetaFile = - m_pData->m_pObjectShell->GetPreviewMetaFile( true ); - if (xMetaFile) - { - SvMemoryStream aMemStm( 65535, 65535 ); - aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); + std::shared_ptr<GDIMetaFile> xMetaFile = + m_pData->m_pObjectShell->GetPreviewMetaFile( true ); - xMetaFile->Write( aMemStm ); - aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), - aMemStm.Seek( STREAM_SEEK_TO_END ) ); - } + if (xMetaFile) + { + SvMemoryStream aMemStm( 65535, 65535 ); + aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); + + xMetaFile->Write( aMemStm ); + aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), + aMemStm.Seek( STREAM_SEEK_TO_END ) ); } - else - throw datatransfer::UnsupportedFlavorException(); } else if ( aFlavor.MimeType == "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) { - if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() ) - { - std::shared_ptr<GDIMetaFile> xMetaFile = - m_pData->m_pObjectShell->CreatePreviewMetaFile_Impl( true ); + if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() ) + throw datatransfer::UnsupportedFlavorException(); - if (xMetaFile) - { - SvMemoryStream aMemStm( 65535, 65535 ); - aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); + std::shared_ptr<GDIMetaFile> xMetaFile = + m_pData->m_pObjectShell->CreatePreviewMetaFile_Impl( true ); - xMetaFile->Write( aMemStm ); - aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), - aMemStm.Seek( STREAM_SEEK_TO_END ) ); - } + if (xMetaFile) + { + SvMemoryStream aMemStm( 65535, 65535 ); + aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); + + xMetaFile->Write( aMemStm ); + aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), + aMemStm.Seek( STREAM_SEEK_TO_END ) ); } - else - throw datatransfer::UnsupportedFlavorException(); } else if ( aFlavor.MimeType == "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" ) { @@ -2045,51 +2037,47 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla } else if ( aFlavor.MimeType == "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" ) { - if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() ) + if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() ) + throw datatransfer::UnsupportedFlavorException(); + + std::shared_ptr<GDIMetaFile> xMetaFile = + m_pData->m_pObjectShell->GetPreviewMetaFile( true ); + + if (xMetaFile) { - std::shared_ptr<GDIMetaFile> xMetaFile = - m_pData->m_pObjectShell->GetPreviewMetaFile( true ); + std::shared_ptr<SvMemoryStream> xStream( + GraphicHelper::getFormatStrFromGDI_Impl( + xMetaFile.get(), ConvertDataFormat::BMP ) ); - if (xMetaFile) + if (xStream) { - std::shared_ptr<SvMemoryStream> xStream( - GraphicHelper::getFormatStrFromGDI_Impl( - xMetaFile.get(), ConvertDataFormat::BMP ) ); - - if (xStream) - { - xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT ); - aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ), - xStream->Seek( STREAM_SEEK_TO_END ) ); - } + xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT ); + aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ), + xStream->Seek( STREAM_SEEK_TO_END ) ); } } - else - throw datatransfer::UnsupportedFlavorException(); } else if ( aFlavor.MimeType == "image/png" ) { - if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() ) + if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() ) + throw datatransfer::UnsupportedFlavorException(); + + std::shared_ptr<GDIMetaFile> xMetaFile = + m_pData->m_pObjectShell->GetPreviewMetaFile( true ); + + if (xMetaFile) { - std::shared_ptr<GDIMetaFile> xMetaFile = - m_pData->m_pObjectShell->GetPreviewMetaFile( true ); + std::shared_ptr<SvMemoryStream> xStream( + GraphicHelper::getFormatStrFromGDI_Impl( + xMetaFile.get(), ConvertDataFormat::PNG ) ); - if (xMetaFile) + if (xStream) { - std::shared_ptr<SvMemoryStream> xStream( - GraphicHelper::getFormatStrFromGDI_Impl( - xMetaFile.get(), ConvertDataFormat::PNG ) ); - - if (xStream) - { - xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT ); - aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ), - xStream->Seek( STREAM_SEEK_TO_END ) ); - } + xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT ); + aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ), + xStream->Seek( STREAM_SEEK_TO_END ) ); } } - else - throw datatransfer::UnsupportedFlavorException(); } else throw datatransfer::UnsupportedFlavorException(); diff --git a/sfx2/source/sidebar/UnoDecks.cxx b/sfx2/source/sidebar/UnoDecks.cxx index 66dcc0719092..9812bc5c6dfa 100644 --- a/sfx2/source/sidebar/UnoDecks.cxx +++ b/sfx2/source/sidebar/UnoDecks.cxx @@ -38,17 +38,11 @@ uno::Any SAL_CALL SfxUnoDecks::getByName( const OUString& aName ) { SolarMutexGuard aGuard; - uno::Any aRet; - - if (hasByName(aName)) - { - uno::Reference<ui::XDeck> xDeck = new SfxUnoDeck(xFrame, aName); - aRet <<= xDeck; - } - else + if (!hasByName(aName)) throw container::NoSuchElementException(); - return aRet; + uno::Reference<ui::XDeck> xDeck = new SfxUnoDeck(xFrame, aName); + return uno::Any(xDeck); } diff --git a/sfx2/source/sidebar/UnoPanels.cxx b/sfx2/source/sidebar/UnoPanels.cxx index 257c75cea4bc..a74763572cdb 100644 --- a/sfx2/source/sidebar/UnoPanels.cxx +++ b/sfx2/source/sidebar/UnoPanels.cxx @@ -47,17 +47,11 @@ uno::Any SAL_CALL SfxUnoPanels::getByName( const OUString& aName ) { SolarMutexGuard aGuard; - uno::Any aRet; - - if (hasByName(aName)) - { - uno::Reference<ui::XPanel> xPanel = new SfxUnoPanel(xFrame, aName, mDeckId); - aRet <<= xPanel; - } - else + if (!hasByName(aName)) throw container::NoSuchElementException(); - return aRet; + uno::Reference<ui::XPanel> xPanel = new SfxUnoPanel(xFrame, aName, mDeckId); + return uno::Any(xPanel); } |