diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 12:58:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 14:20:20 +0200 |
commit | 8f719de217b1079bd985b3bc63bbfa97069483bc (patch) | |
tree | cb15a422b7df468d913cb0815d628f7c0bc4fd9b /svx/source/gallery2 | |
parent | bfc298d02ca6275588d5897d97ced9498a3e91aa (diff) |
loplugin:flatten in svx
Change-Id: I31f33a5f693d5fdb8282181c5bd7f31971efe784
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100236
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/gallery2')
-rw-r--r-- | svx/source/gallery2/codec.cxx | 100 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws1.cxx | 70 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 298 | ||||
-rw-r--r-- | svx/source/gallery2/galctrl.cxx | 20 | ||||
-rw-r--r-- | svx/source/gallery2/gallery1.cxx | 26 | ||||
-rw-r--r-- | svx/source/gallery2/galmisc.cxx | 26 | ||||
-rw-r--r-- | svx/source/gallery2/galobj.cxx | 22 |
7 files changed, 281 insertions, 281 deletions
diff --git a/svx/source/gallery2/codec.cxx b/svx/source/gallery2/codec.cxx index 5063632d1d93..5adef9b37841 100644 --- a/svx/source/gallery2/codec.cxx +++ b/svx/source/gallery2/codec.cxx @@ -85,67 +85,67 @@ void GalleryCodec::Read( SvStream& rStmToRead ) { sal_uInt32 nVersion = 0; - if( IsCoded( rStm, nVersion ) ) - { - sal_uInt32 nCompressedSize, nUnCompressedSize; + if( !IsCoded( rStm, nVersion ) ) + return; + + sal_uInt32 nCompressedSize, nUnCompressedSize; - rStm.SeekRel( 6 ); - rStm.ReadUInt32( nUnCompressedSize ).ReadUInt32( nCompressedSize ); + rStm.SeekRel( 6 ); + rStm.ReadUInt32( nUnCompressedSize ).ReadUInt32( nCompressedSize ); - // decompress - if( 1 == nVersion ) + // decompress + if( 1 == nVersion ) + { + std::unique_ptr<sal_uInt8[]> pCompressedBuffer(new sal_uInt8[ nCompressedSize ]); + rStm.ReadBytes(pCompressedBuffer.get(), nCompressedSize); + sal_uInt8* pInBuf = pCompressedBuffer.get(); + std::unique_ptr<sal_uInt8[]> pOutBuf(new sal_uInt8[ nUnCompressedSize ]); + sal_uInt8* pTmpBuf = pOutBuf.get(); + sal_uInt8* pLast = pOutBuf.get() + nUnCompressedSize - 1; + sal_uIntPtr nIndex = 0, nCountByte, nRunByte; + bool bEndDecoding = false; + + do { - std::unique_ptr<sal_uInt8[]> pCompressedBuffer(new sal_uInt8[ nCompressedSize ]); - rStm.ReadBytes(pCompressedBuffer.get(), nCompressedSize); - sal_uInt8* pInBuf = pCompressedBuffer.get(); - std::unique_ptr<sal_uInt8[]> pOutBuf(new sal_uInt8[ nUnCompressedSize ]); - sal_uInt8* pTmpBuf = pOutBuf.get(); - sal_uInt8* pLast = pOutBuf.get() + nUnCompressedSize - 1; - sal_uIntPtr nIndex = 0, nCountByte, nRunByte; - bool bEndDecoding = false; - - do + nCountByte = *pInBuf++; + + if ( !nCountByte ) { - nCountByte = *pInBuf++; + nRunByte = *pInBuf++; - if ( !nCountByte ) + if ( nRunByte > 2 ) { - nRunByte = *pInBuf++; - - if ( nRunByte > 2 ) - { - // filling absolutely - memcpy( &pTmpBuf[ nIndex ], pInBuf, nRunByte ); - pInBuf += nRunByte; - nIndex += nRunByte; - - // note WORD alignment - if ( nRunByte & 1 ) - pInBuf++; - } - else if ( nRunByte == 1 ) // End of the image - bEndDecoding = true; - } - else - { - const sal_uInt8 cVal = *pInBuf++; - - memset( &pTmpBuf[ nIndex ], cVal, nCountByte ); - nIndex += nCountByte; + // filling absolutely + memcpy( &pTmpBuf[ nIndex ], pInBuf, nRunByte ); + pInBuf += nRunByte; + nIndex += nRunByte; + + // note WORD alignment + if ( nRunByte & 1 ) + pInBuf++; } + else if ( nRunByte == 1 ) // End of the image + bEndDecoding = true; } - while ( !bEndDecoding && ( pTmpBuf <= pLast ) ); + else + { + const sal_uInt8 cVal = *pInBuf++; - rStmToRead.WriteBytes(pOutBuf.get(), nUnCompressedSize); + memset( &pTmpBuf[ nIndex ], cVal, nCountByte ); + nIndex += nCountByte; + } } - else if( 2 == nVersion ) - { - ZCodec aCodec; + while ( !bEndDecoding && ( pTmpBuf <= pLast ) ); - aCodec.BeginCompression(); - aCodec.Decompress( rStm, rStmToRead ); - aCodec.EndCompression(); - } + rStmToRead.WriteBytes(pOutBuf.get(), nUnCompressedSize); + } + else if( 2 == nVersion ) + { + ZCodec aCodec; + + aCodec.BeginCompression(); + aCodec.Decompress( rStm, rStmToRead ); + aCodec.EndCompression(); } } diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index f4c3da3b41a8..cb0b291b106d 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -89,19 +89,19 @@ void GalleryBrowser1::ImplInsertThemeEntry( const GalleryThemeEntry* pEntry ) { static const bool bShowHiddenThemes = ( getenv( "GALLERY_SHOW_HIDDEN_THEMES" ) != nullptr ); - if( pEntry && ( !pEntry->IsHidden() || bShowHiddenThemes ) ) - { - const OUString* pImage; + if( !(pEntry && ( !pEntry->IsHidden() || bShowHiddenThemes )) ) + return; - if( pEntry->IsReadOnly() ) - pImage = &aImgReadOnly; - else if( pEntry->IsDefault() ) - pImage = &aImgDefault; - else - pImage = &aImgNormal; + const OUString* pImage; - mxThemes->append("", pEntry->GetThemeName(), *pImage); - } + if( pEntry->IsReadOnly() ) + pImage = &aImgReadOnly; + else if( pEntry->IsDefault() ) + pImage = &aImgDefault; + else + pImage = &aImgNormal; + + mxThemes->append("", pEntry->GetThemeName(), *pImage); } void GalleryBrowser1::ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData ) @@ -135,37 +135,37 @@ void GalleryBrowser1::ImplGetExecuteVector(std::vector<OString>& o_aExec) { GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); - if( pTheme ) - { - bool bUpdateAllowed, bRenameAllowed, bRemoveAllowed; - static const bool bIdDialog = ( getenv( "GALLERY_ENABLE_ID_DIALOG" ) != nullptr ); + if( !pTheme ) + return; - if( pTheme->IsReadOnly() ) - bUpdateAllowed = bRenameAllowed = bRemoveAllowed = false; - else if( pTheme->IsDefault() ) - { - bUpdateAllowed = bRenameAllowed = true; - bRemoveAllowed = false; - } - else - bUpdateAllowed = bRenameAllowed = bRemoveAllowed = true; + bool bUpdateAllowed, bRenameAllowed, bRemoveAllowed; + static const bool bIdDialog = ( getenv( "GALLERY_ENABLE_ID_DIALOG" ) != nullptr ); - if( bUpdateAllowed && pTheme->GetObjectCount() ) - o_aExec.emplace_back("update"); + if( pTheme->IsReadOnly() ) + bUpdateAllowed = bRenameAllowed = bRemoveAllowed = false; + else if( pTheme->IsDefault() ) + { + bUpdateAllowed = bRenameAllowed = true; + bRemoveAllowed = false; + } + else + bUpdateAllowed = bRenameAllowed = bRemoveAllowed = true; - if( bRenameAllowed ) - o_aExec.emplace_back("rename"); + if( bUpdateAllowed && pTheme->GetObjectCount() ) + o_aExec.emplace_back("update"); - if( bRemoveAllowed ) - o_aExec.emplace_back("delete"); + if( bRenameAllowed ) + o_aExec.emplace_back("rename"); - if( bIdDialog && !pTheme->IsReadOnly() ) - o_aExec.emplace_back("assign"); + if( bRemoveAllowed ) + o_aExec.emplace_back("delete"); - o_aExec.emplace_back("properties"); + if( bIdDialog && !pTheme->IsReadOnly() ) + o_aExec.emplace_back("assign"); - mpGallery->ReleaseTheme( pTheme, *this ); - } + o_aExec.emplace_back("properties"); + + mpGallery->ReleaseTheme( pTheme, *this ); } void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew ) diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index b1449a811d93..352faf0b1caa 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -495,25 +495,25 @@ void GalleryBrowser2::ShowContextMenu(const CommandEvent& rCEvt) Point aSelPos; const sal_uInt32 nItemId = ImplGetSelectedItemId( rCEvt.IsMouseEvent() ? &aMousePos : nullptr, aSelPos ); - if( mpCurTheme && nItemId && ( nItemId <= mpCurTheme->GetObjectCount() ) ) - { - ImplSelectItemId( nItemId ); + if( !(mpCurTheme && nItemId && ( nItemId <= mpCurTheme->GetObjectCount() )) ) + return; - css::uno::Reference< css::frame::XFrame > xFrame( GetFrame() ); - if ( xFrame.is() ) - { - weld::Widget* pParent = GetViewWindow(); - mnCurActionPos = nItemId - 1; - rtl::Reference< GalleryThemePopup > xPopup( - new GalleryThemePopup( - pParent, - mpCurTheme, - mnCurActionPos, - GALLERYBROWSERMODE_PREVIEW == GetMode(), - this ) ); - xPopup->ExecutePopup(pParent, aSelPos); - } - } + ImplSelectItemId( nItemId ); + + css::uno::Reference< css::frame::XFrame > xFrame( GetFrame() ); + if ( !xFrame.is() ) + return; + + weld::Widget* pParent = GetViewWindow(); + mnCurActionPos = nItemId - 1; + rtl::Reference< GalleryThemePopup > xPopup( + new GalleryThemePopup( + pParent, + mpCurTheme, + mnCurActionPos, + GALLERYBROWSERMODE_PREVIEW == GetMode(), + this ) ); + xPopup->ExecutePopup(pParent, aSelPos); } bool GalleryBrowser2::ViewBoxHasFocus() const @@ -630,83 +630,83 @@ void GalleryBrowser2::SelectTheme( const OUString& rThemeName ) void GalleryBrowser2::SetMode( GalleryBrowserMode eMode ) { - if( GetMode() != eMode ) - { - meLastMode = GetMode(); + if( GetMode() == eMode ) + return; - switch( eMode ) + meLastMode = GetMode(); + + switch( eMode ) + { + case GALLERYBROWSERMODE_ICON: { - case GALLERYBROWSERMODE_ICON: - { - mxListView->hide(); + mxListView->hide(); - mxPreview->Hide(); - mxPreview->SetGraphic( Graphic() ); - GalleryPreview::PreviewMedia( INetURLObject() ); + mxPreview->Hide(); + mxPreview->SetGraphic( Graphic() ); + GalleryPreview::PreviewMedia( INetURLObject() ); - mxIconView->Show(); + mxIconView->Show(); - mxIconButton->set_sensitive(true); - mxListButton->set_sensitive(true); + mxIconButton->set_sensitive(true); + mxListButton->set_sensitive(true); - mxIconButton->set_active(true); - mxListButton->set_active(false); - } - break; + mxIconButton->set_active(true); + mxListButton->set_active(false); + } + break; - case GALLERYBROWSERMODE_LIST: - { - mxIconView->Hide(); + case GALLERYBROWSERMODE_LIST: + { + mxIconView->Hide(); - mxPreview->Hide(); - mxPreview->SetGraphic( Graphic() ); - GalleryPreview::PreviewMedia( INetURLObject() ); + mxPreview->Hide(); + mxPreview->SetGraphic( Graphic() ); + GalleryPreview::PreviewMedia( INetURLObject() ); - mxListView->show(); - UpdateRows(true); + mxListView->show(); + UpdateRows(true); - mxIconButton->set_sensitive(true); - mxListButton->set_sensitive(true); + mxIconButton->set_sensitive(true); + mxListButton->set_sensitive(true); - mxIconButton->set_active(false); - mxListButton->set_active(true); - } - break; + mxIconButton->set_active(false); + mxListButton->set_active(true); + } + break; - case GALLERYBROWSERMODE_PREVIEW: - { - Graphic aGraphic; - Point aSelPos; - const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos ); + case GALLERYBROWSERMODE_PREVIEW: + { + Graphic aGraphic; + Point aSelPos; + const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos ); - if( nItemId ) - { - const sal_uInt32 nPos = nItemId - 1; + if( nItemId ) + { + const sal_uInt32 nPos = nItemId - 1; - mxIconView->Hide(); - mxListView->hide(); + mxIconView->Hide(); + mxListView->hide(); - if( mpCurTheme ) - mpCurTheme->GetGraphic( nPos, aGraphic ); + if( mpCurTheme ) + mpCurTheme->GetGraphic( nPos, aGraphic ); - mxPreview->SetGraphic( aGraphic ); - mxPreview->Show(); + mxPreview->SetGraphic( aGraphic ); + mxPreview->Show(); - if( mpCurTheme && mpCurTheme->GetObjectKind( nPos ) == SgaObjKind::Sound ) - GalleryPreview::PreviewMedia( mpCurTheme->GetObjectURL( nPos ) ); + if( mpCurTheme && mpCurTheme->GetObjectKind( nPos ) == SgaObjKind::Sound ) + GalleryPreview::PreviewMedia( mpCurTheme->GetObjectURL( nPos ) ); - mxIconButton->set_sensitive(false); - mxListButton->set_sensitive(false); - } + mxIconButton->set_sensitive(false); + mxListButton->set_sensitive(false); } - break; - - default: - break; } + break; - GalleryBrowser2::meInitMode = meMode = eMode; + default: + break; } + + GalleryBrowser2::meInitMode = meMode = eMode; } weld::Widget* GalleryBrowser2::GetViewWindow() const @@ -728,51 +728,51 @@ weld::Widget* GalleryBrowser2::GetViewWindow() const void GalleryBrowser2::Travel( GalleryBrowserTravel eTravel ) { - if( mpCurTheme ) + if( !mpCurTheme ) + return; + + Point aSelPos; + const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos ); + + if( !nItemId ) + return; + + sal_uInt32 nNewItemId = nItemId; + + switch( eTravel ) { - Point aSelPos; - const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos ); + case GalleryBrowserTravel::First: nNewItemId = 1; break; + case GalleryBrowserTravel::Last: nNewItemId = mpCurTheme->GetObjectCount(); break; + case GalleryBrowserTravel::Previous: nNewItemId--; break; + case GalleryBrowserTravel::Next: nNewItemId++; break; + default: + break; + } - if( nItemId ) - { - sal_uInt32 nNewItemId = nItemId; + if( nNewItemId < 1 ) + nNewItemId = 1; + else if( nNewItemId > mpCurTheme->GetObjectCount() ) + nNewItemId = mpCurTheme->GetObjectCount(); - switch( eTravel ) - { - case GalleryBrowserTravel::First: nNewItemId = 1; break; - case GalleryBrowserTravel::Last: nNewItemId = mpCurTheme->GetObjectCount(); break; - case GalleryBrowserTravel::Previous: nNewItemId--; break; - case GalleryBrowserTravel::Next: nNewItemId++; break; - default: - break; - } + if( nNewItemId == nItemId ) + return; - if( nNewItemId < 1 ) - nNewItemId = 1; - else if( nNewItemId > mpCurTheme->GetObjectCount() ) - nNewItemId = mpCurTheme->GetObjectCount(); + ImplSelectItemId( nNewItemId ); + ImplUpdateInfoBar(); - if( nNewItemId != nItemId ) - { - ImplSelectItemId( nNewItemId ); - ImplUpdateInfoBar(); + if( GALLERYBROWSERMODE_PREVIEW != GetMode() ) + return; - if( GALLERYBROWSERMODE_PREVIEW == GetMode() ) - { - Graphic aGraphic; - const sal_uInt32 nPos = nNewItemId - 1; + Graphic aGraphic; + const sal_uInt32 nPos = nNewItemId - 1; - mpCurTheme->GetGraphic( nPos, aGraphic ); - mxPreview->SetGraphic( aGraphic ); + mpCurTheme->GetGraphic( nPos, aGraphic ); + mxPreview->SetGraphic( aGraphic ); - if( SgaObjKind::Sound == mpCurTheme->GetObjectKind( nPos ) ) - GalleryPreview::PreviewMedia( mpCurTheme->GetObjectURL( nPos ) ); + if( SgaObjKind::Sound == mpCurTheme->GetObjectKind( nPos ) ) + GalleryPreview::PreviewMedia( mpCurTheme->GetObjectURL( nPos ) ); - mxPreview->Invalidate(); - } - } - } - } + mxPreview->Invalidate(); } void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId ) @@ -1099,61 +1099,61 @@ void GalleryBrowser2::Execute(const OString &rIdent) Point aSelPos; const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos ); - if( mpCurTheme && nItemId ) - { - mnCurActionPos = nItemId - 1; + if( !(mpCurTheme && nItemId) ) + return; - if (rIdent == "preview") - SetMode( ( GALLERYBROWSERMODE_PREVIEW != GetMode() ) ? GALLERYBROWSERMODE_PREVIEW : meLastMode ); - else if (rIdent == "delete") + mnCurActionPos = nItemId - 1; + + if (rIdent == "preview") + SetMode( ( GALLERYBROWSERMODE_PREVIEW != GetMode() ) ? GALLERYBROWSERMODE_PREVIEW : meLastMode ); + else if (rIdent == "delete") + { + if (!mpCurTheme->IsReadOnly()) { - if (!mpCurTheme->IsReadOnly()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetViewWindow(), "svx/ui/querydeleteobjectdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteObjectDialog")); + if (xQuery->run() == RET_YES) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetViewWindow(), "svx/ui/querydeleteobjectdialog.ui")); - std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteObjectDialog")); - if (xQuery->run() == RET_YES) - { - mpCurTheme->RemoveObject( mnCurActionPos ); - } + mpCurTheme->RemoveObject( mnCurActionPos ); } } - else if (rIdent == "title") + } + else if (rIdent == "title") + { + std::unique_ptr<SgaObject> pObj = mpCurTheme->AcquireObject( mnCurActionPos ); + + if( pObj ) { - std::unique_ptr<SgaObject> pObj = mpCurTheme->AcquireObject( mnCurActionPos ); + const OUString aOldTitle( GetItemText( *pObj, GalleryItemFlags::Title ) ); - if( pObj ) + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog(GetViewWindow(), aOldTitle)); + if( aDlg->Execute() == RET_OK ) { - const OUString aOldTitle( GetItemText( *pObj, GalleryItemFlags::Title ) ); + OUString aNewTitle( aDlg->GetTitle() ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog(GetViewWindow(), aOldTitle)); - if( aDlg->Execute() == RET_OK ) + if( ( aNewTitle.isEmpty() && !pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) ) { - OUString aNewTitle( aDlg->GetTitle() ); - - if( ( aNewTitle.isEmpty() && !pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) ) - { - if( aNewTitle.isEmpty() ) - aNewTitle = "__<empty>__"; + if( aNewTitle.isEmpty() ) + aNewTitle = "__<empty>__"; - pObj->SetTitle( aNewTitle ); - mpCurTheme->InsertObject( *pObj ); - } + pObj->SetTitle( aNewTitle ); + mpCurTheme->InsertObject( *pObj ); } } } - else if (rIdent == "copy") - { - mpCurTheme->CopyToClipboard(mnCurActionPos); - } - else if (rIdent == "paste") + } + else if (rIdent == "copy") + { + mpCurTheme->CopyToClipboard(mnCurActionPos); + } + else if (rIdent == "paste") + { + if( !mpCurTheme->IsReadOnly() ) { - if( !mpCurTheme->IsReadOnly() ) - { - TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromClipboard(GetSystemClipboard())); - mpCurTheme->InsertTransferable( aDataHelper.GetTransferable(), mnCurActionPos ); - } - } + TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromClipboard(GetSystemClipboard())); + mpCurTheme->InsertTransferable( aDataHelper.GetTransferable(), mnCurActionPos ); + } } } diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx index 47ef1757755d..1cb99eb5ae37 100644 --- a/svx/source/gallery2/galctrl.cxx +++ b/svx/source/gallery2/galctrl.cxx @@ -198,19 +198,19 @@ bool GalleryPreview::StartDrag() void GalleryPreview::PreviewMedia( const INetURLObject& rURL ) { #if HAVE_FEATURE_AVMEDIA - if (rURL.GetProtocol() != INetProtocol::NotValid) - { - ::avmedia::MediaFloater* pFloater = avmedia::getMediaFloater(); + if (rURL.GetProtocol() == INetProtocol::NotValid) + return; - if (!pFloater) - { - SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_AVMEDIA_PLAYER, SfxCallMode::SYNCHRON ); - pFloater = avmedia::getMediaFloater(); - } + ::avmedia::MediaFloater* pFloater = avmedia::getMediaFloater(); - if (pFloater) - pFloater->setURL( rURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ), "", true ); + if (!pFloater) + { + SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_AVMEDIA_PLAYER, SfxCallMode::SYNCHRON ); + pFloater = avmedia::getMediaFloater(); } + + if (pFloater) + pFloater->setURL( rURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ), "", true ); #else (void) rURL; #endif diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 79533c4f0891..a7dc2bd4823f 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -583,21 +583,21 @@ void Gallery::RenameTheme( const OUString& rOldName, const OUString& rNewName ) GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rOldName ); // check if the new theme name is already present - if( pThemeEntry && !HasTheme( rNewName ) && !pThemeEntry->IsReadOnly() ) - { - SfxListener aListener; - GalleryTheme* pThm = AcquireTheme( rOldName, aListener ); + if( !pThemeEntry || HasTheme( rNewName ) || pThemeEntry->IsReadOnly() ) + return; - if( pThm ) - { - pThemeEntry->SetName( rNewName ); - if (pThm->pThm->IsModified()) - if (!pThm->mpGalleryBinaryEngine->implWrite(*pThm)) - pThm->ImplSetModified(false); + SfxListener aListener; + GalleryTheme* pThm = AcquireTheme( rOldName, aListener ); - Broadcast( GalleryHint( GalleryHintType::THEME_RENAMED, rOldName, pThm->GetName() ) ); - ReleaseTheme( pThm, aListener ); - } + if( pThm ) + { + pThemeEntry->SetName( rNewName ); + if (pThm->pThm->IsModified()) + if (!pThm->mpGalleryBinaryEngine->implWrite(*pThm)) + pThm->ImplSetModified(false); + + Broadcast( GalleryHint( GalleryHintType::THEME_RENAMED, rOldName, pThm->GetName() ) ); + ReleaseTheme( pThm, aListener ); } } diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index ca425f661d17..8a5c7ac50ebf 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -322,25 +322,25 @@ GalleryProgress::GalleryProgress( const GraphicFilter* pFilter ) uno::Reference< awt::XProgressMonitor > xMonitor( xMgr->createInstance( "com.sun.star.awt.XProgressMonitor" ), uno::UNO_QUERY ); - if ( xMonitor.is() ) - { - mxProgressBar = xMonitor; + if ( !xMonitor.is() ) + return; - OUString aProgressText; + mxProgressBar = xMonitor; - if( pFilter ) - { - aProgressText = SvxResId(RID_SVXSTR_GALLERY_FILTER); + OUString aProgressText; + + if( pFilter ) + { + aProgressText = SvxResId(RID_SVXSTR_GALLERY_FILTER); // pFilter->SetUpdatePercentHdl( LINK( this, GalleryProgress, Update ) ); // sj: progress wasn't working up from SO7 at all // // so I am removing this. The gallery progress should // // be changed to use the XStatusIndicator instead of XProgressMonitor - } - else - aProgressText = "Gallery"; - - xMonitor->addText( "Gallery", aProgressText, false ) ; - mxProgressBar->setRange( 0, GALLERY_PROGRESS_RANGE ); } + else + aProgressText = "Gallery"; + + xMonitor->addText( "Gallery", aProgressText, false ) ; + mxProgressBar->setRange( 0, GALLERY_PROGRESS_RANGE ); } GalleryProgress::~GalleryProgress() diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index e2922419f1e4..fea1384300e0 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -398,19 +398,19 @@ SvxGalleryDrawModel::SvxGalleryDrawModel() { mxDoc = SfxObjectShell::CreateObjectByFactoryName( "sdraw" ); - if( mxDoc.Is() ) - { - mxDoc->DoInitNew(); + if( !mxDoc.Is() ) + return; + + mxDoc->DoInitNew(); - uno::Reference< lang::XUnoTunnel > xTunnel( mxDoc->GetModel(), uno::UNO_QUERY ); - if( xTunnel.is() ) + uno::Reference< lang::XUnoTunnel > xTunnel( mxDoc->GetModel(), uno::UNO_QUERY ); + if( xTunnel.is() ) + { + mpFormModel = dynamic_cast< FmFormModel* >( + reinterpret_cast<SdrModel*>(xTunnel->getSomething(SdrModel::getUnoTunnelId()))); + if( mpFormModel ) { - mpFormModel = dynamic_cast< FmFormModel* >( - reinterpret_cast<SdrModel*>(xTunnel->getSomething(SdrModel::getUnoTunnelId()))); - if( mpFormModel ) - { - mpFormModel->InsertPage( mpFormModel->AllocPage( false ) ); - } + mpFormModel->InsertPage( mpFormModel->AllocPage( false ) ); } } } |