diff options
117 files changed, 1134 insertions, 1646 deletions
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index 2304bb72cda0..dc7c194b87dc 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -135,11 +135,9 @@ void ChartController::executeDispatch_PositionAndSize() SolarMutexGuard aGuard; SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create(); - OSL_ENSURE( pFact, "No dialog factory" ); vcl::Window* pWin = GetChartWindow(); ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSchTransformTabDialog( pWin ? pWin->GetFrameWeld() : nullptr, &aItemSet, pSdrView, bResizePossible)); - OSL_ENSURE( pDlg, "Couldn't create SchTransformTabDialog" ); if( pDlg->Execute() == RET_OK ) { diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index 89cc3ca0e513..dfb94cc64725 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -155,7 +155,6 @@ void ChartController::executeDispatch_InsertSpecialCharacter() StartTextEdit(); SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create(); - OSL_ENSURE( pFact, "No dialog factory" ); SfxAllItemSet aSet( m_pDrawModelWrapper->GetItemPool() ); aSet.Put( SfxBoolItem( FN_PARAM_1, false ) ); @@ -168,7 +167,6 @@ void ChartController::executeDispatch_InsertSpecialCharacter() vcl::Window* pWin = GetChartWindow(); ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(pWin ? pWin->GetFrameWeld() : nullptr, aSet, false)); - OSL_ENSURE( pDlg, "Couldn't create SvxCharacterMap dialog" ); if( pDlg->Execute() == RET_OK ) { const SfxItemSet* pSet = pDlg->GetOutputItemSet(); diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index 80203f179b83..7767d77773e0 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -254,22 +254,19 @@ void ShapeController::executeDispatch_FormatLine() pDrawViewWrapper->MergeAttrFromMarked( aAttr, false ); } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) + ScopedVclPtr< SfxAbstractTabDialog > pDlg( + pFact->CreateSvxLineTabDialog( pChartWindow, &aAttr, &pDrawModelWrapper->getSdrModel(), + pSelectedObj, bHasMarked ) ); + if ( pDlg->Execute() == RET_OK ) { - ScopedVclPtr< SfxAbstractTabDialog > pDlg( - pFact->CreateSvxLineTabDialog( pChartWindow, &aAttr, &pDrawModelWrapper->getSdrModel(), - pSelectedObj, bHasMarked ) ); - if ( pDlg->Execute() == RET_OK ) + const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); + if ( bHasMarked ) { - const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); - if ( bHasMarked ) - { - pDrawViewWrapper->SetAttrToMarked( *pOutAttr, false ); - } - else - { - pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false ); - } + pDrawViewWrapper->SetAttrToMarked( *pOutAttr, false ); + } + else + { + pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false ); } } } @@ -293,24 +290,18 @@ void ShapeController::executeDispatch_FormatArea() pDrawViewWrapper->MergeAttrFromMarked( aAttr, false ); } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { ScopedVclPtr< AbstractSvxAreaTabDialog > pDlg( pFact->CreateSvxAreaTabDialog( pChartWindow, &aAttr, &pDrawModelWrapper->getSdrModel(), true ) ); - if ( pDlg.get() ) + if ( pDlg->Execute() == RET_OK ) + { + const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); + if ( bHasMarked ) { - if ( pDlg->Execute() == RET_OK ) - { - const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); - if ( bHasMarked ) - { - pDrawViewWrapper->SetAttrToMarked( *pOutAttr, false ); - } - else - { - pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false ); - } - } + pDrawViewWrapper->SetAttrToMarked( *pOutAttr, false ); + } + else + { + pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false ); } } } @@ -333,21 +324,18 @@ void ShapeController::executeDispatch_TextAttributes() pDrawViewWrapper->MergeAttrFromMarked( aAttr, false ); } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) + ScopedVclPtr< SfxAbstractTabDialog > pDlg( + pFact->CreateTextTabDialog( pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, &aAttr, pDrawViewWrapper ) ); + if ( pDlg->Execute() == RET_OK ) { - ScopedVclPtr< SfxAbstractTabDialog > pDlg( - pFact->CreateTextTabDialog( pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, &aAttr, pDrawViewWrapper ) ); - if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) + const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); + if ( bHasMarked ) { - const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); - if ( bHasMarked ) - { - pDrawViewWrapper->SetAttributes( *pOutAttr ); - } - else - { - pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false ); - } + pDrawViewWrapper->SetAttributes( *pOutAttr ); + } + else + { + pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false ); } } } @@ -372,39 +360,30 @@ void ShapeController::executeDispatch_TransformDialog() // item set for position and size SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) + ScopedVclPtr< SfxAbstractTabDialog > pDlg( + pFact->CreateCaptionDialog( pChartWindow, pDrawViewWrapper ) ); + const sal_uInt16* pRange = pDlg->GetInputRanges( *aAttr.GetPool() ); + SfxItemSet aCombAttr( *aAttr.GetPool(), pRange ); + aCombAttr.Put( aAttr ); + aCombAttr.Put( aGeoAttr ); + pDlg->SetInputSet( &aCombAttr ); + if ( pDlg->Execute() == RET_OK ) { - ScopedVclPtr< SfxAbstractTabDialog > pDlg( - pFact->CreateCaptionDialog( pChartWindow, pDrawViewWrapper ) ); - if ( pDlg.get() ) - { - const sal_uInt16* pRange = pDlg->GetInputRanges( *aAttr.GetPool() ); - SfxItemSet aCombAttr( *aAttr.GetPool(), pRange ); - aCombAttr.Put( aAttr ); - aCombAttr.Put( aGeoAttr ); - pDlg->SetInputSet( &aCombAttr ); - if ( pDlg->Execute() == RET_OK ) - { - const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); - pDrawViewWrapper->SetAttributes( *pOutAttr ); - pDrawViewWrapper->SetGeoAttrToMarked( *pOutAttr ); - } - } + const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); + pDrawViewWrapper->SetAttributes( *pOutAttr ); + pDrawViewWrapper->SetGeoAttrToMarked( *pOutAttr ); } } else { SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) + ScopedVclPtr< SfxAbstractTabDialog > pDlg( + pFact->CreateSvxTransformTabDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, &aGeoAttr, pDrawViewWrapper)); + if ( pDlg->Execute() == RET_OK ) { - ScopedVclPtr< SfxAbstractTabDialog > pDlg( - pFact->CreateSvxTransformTabDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, &aGeoAttr, pDrawViewWrapper)); - if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) - { - const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); - pDrawViewWrapper->SetGeoAttrToMarked( *pOutAttr ); - } + const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); + pDrawViewWrapper->SetGeoAttrToMarked( *pOutAttr ); } } } @@ -425,18 +404,15 @@ void ShapeController::executeDispatch_ObjectTitleDescription() OUString aTitle( pSelectedObj->GetTitle() ); OUString aDescription( pSelectedObj->GetDescription() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) + VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() ); + ScopedVclPtr< AbstractSvxObjectTitleDescDialog > pDlg( + pFact->CreateSvxObjectTitleDescDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, aTitle, aDescription ) ); + if ( pDlg->Execute() == RET_OK ) { - VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() ); - ScopedVclPtr< AbstractSvxObjectTitleDescDialog > pDlg( - pFact->CreateSvxObjectTitleDescDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, aTitle, aDescription ) ); - if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) - { - pDlg->GetTitle( aTitle ); - pDlg->GetDescription( aDescription ); - pSelectedObj->SetTitle( aTitle ); - pSelectedObj->SetDescription( aDescription ); - } + pDlg->GetTitle( aTitle ); + pDlg->GetDescription( aDescription ); + pSelectedObj->SetTitle( aTitle ); + pSelectedObj->SetDescription( aDescription ); } } } @@ -456,19 +432,16 @@ void ShapeController::executeDispatch_RenameObject() { OUString aName = pSelectedObj->GetName(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) + VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() ); + ScopedVclPtr< AbstractSvxObjectNameDialog > pDlg( + pFact->CreateSvxObjectNameDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, aName)); + pDlg->SetCheckNameHdl( LINK( this, ShapeController, CheckNameHdl ) ); + if ( pDlg->Execute() == RET_OK ) { - VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() ); - ScopedVclPtr< AbstractSvxObjectNameDialog > pDlg( - pFact->CreateSvxObjectNameDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, aName)); - pDlg->SetCheckNameHdl( LINK( this, ShapeController, CheckNameHdl ) ); - if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) + pDlg->GetName(aName); + if (pSelectedObj->GetName() == aName) { - pDlg->GetName(aName); - if (pSelectedObj->GetName() == aName) - { - pSelectedObj->SetName( aName ); - } + pSelectedObj->SetName( aName ); } } } diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx index 6195662e4300..75425a9672df 100644 --- a/cui/source/dialogs/cuifmsearch.cxx +++ b/cui/source/dialogs/cuifmsearch.cxx @@ -357,38 +357,30 @@ IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton, void ) if (m_ppbApproxSettings == pButton) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if (pFact) + ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(GetFrameWeld(), m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(), + m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() )); + if (pDlg->Execute() == RET_OK) { - ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(GetFrameWeld(), m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(), - m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() )); - DBG_ASSERT( pDlg, "FmSearchDialog, OnClickedSpecialSettings: could not load the dialog!" ); - if (pDlg && pDlg->Execute() == RET_OK) - { - m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() ); - m_pSearchEngine->SetLevOther( pDlg->GetOther() ); - m_pSearchEngine->SetLevShorter(pDlg->GetShorter() ); - m_pSearchEngine->SetLevLonger( pDlg->GetLonger() ); - } + m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() ); + m_pSearchEngine->SetLevOther( pDlg->GetOther() ); + m_pSearchEngine->SetLevShorter(pDlg->GetShorter() ); + m_pSearchEngine->SetLevLonger( pDlg->GetLonger() ); } } else if (m_pSoundsLikeCJKSettings == pButton) { SfxItemSet aSet( SfxGetpApp()->GetPool() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractSvxJSearchOptionsDialog> aDlg(pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() )); - aDlg->Execute(); + ScopedVclPtr<AbstractSvxJSearchOptionsDialog> aDlg(pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() )); + aDlg->Execute(); + TransliterationFlags nFlags = aDlg->GetTransliterationFlags(); + m_pSearchEngine->SetTransliterationFlags(nFlags); - TransliterationFlags nFlags = aDlg->GetTransliterationFlags(); - m_pSearchEngine->SetTransliterationFlags(nFlags); - - m_pcbCase->Check(m_pSearchEngine->GetCaseSensitive()); - OnCheckBoxToggled( *m_pcbCase ); - m_pHalfFullFormsCJK->Check( !m_pSearchEngine->GetIgnoreWidthCJK() ); - OnCheckBoxToggled( *m_pHalfFullFormsCJK ); - } + m_pcbCase->Check(m_pSearchEngine->GetCaseSensitive()); + OnCheckBoxToggled( *m_pcbCase ); + m_pHalfFullFormsCJK->Check( !m_pSearchEngine->GetIgnoreWidthCJK() ); + OnCheckBoxToggled( *m_pHalfFullFormsCJK ); } } diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 20018047d8af..6ee8ea97aa67 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -1491,22 +1491,19 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void ) else if (m_pLinguDicsNewPB == pBtn) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<AbstractSvxNewDictionaryDialog> aDlg(pFact->CreateSvxNewDictionaryDialog(GetFrameWeld())); + uno::Reference< XDictionary > xNewDic; + if ( aDlg->Execute() == RET_OK ) + xNewDic.set( aDlg->GetNewDictionary(), UNO_QUERY ); + if ( xNewDic.is() ) { - ScopedVclPtr<AbstractSvxNewDictionaryDialog> aDlg(pFact->CreateSvxNewDictionaryDialog(GetFrameWeld())); - uno::Reference< XDictionary > xNewDic; - if ( aDlg->Execute() == RET_OK ) - xNewDic.set( aDlg->GetNewDictionary(), UNO_QUERY ); - if ( xNewDic.is() ) - { - // add new dics to the end - sal_Int32 nLen = aDics.getLength(); - aDics.realloc( nLen + 1 ); + // add new dics to the end + sal_Int32 nLen = aDics.getLength(); + aDics.realloc( nLen + 1 ); - aDics.getArray()[ nLen ] = xNewDic; + aDics.getArray()[ nLen ] = xNewDic; - AddDicBoxEntry( xNewDic, static_cast<sal_uInt16>(nLen) ); - } + AddDicBoxEntry( xNewDic, static_cast<sal_uInt16>(nLen) ); } } else if (m_pLinguDicsEditPB == pBtn) @@ -1524,11 +1521,8 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void ) if (xDic.is()) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<VclAbstractDialog> aDlg(pFact->CreateSvxEditDictionaryDialog( this, xDic->getName() )); - aDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> aDlg(pFact->CreateSvxEditDictionaryDialog( this, xDic->getName() )); + aDlg->Execute(); } } } diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 2275ce332e6e..7b3ebad23a64 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -555,56 +555,53 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, Button*, void) if ( IsMultiPath_Impl( nPos ) ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - ScopedVclPtr<AbstractSvxMultiPathDialog> pMultiDlg( - pFact->CreateSvxMultiPathDialog( this )); + ScopedVclPtr<AbstractSvxMultiPathDialog> pMultiDlg( + pFact->CreateSvxMultiPathDialog( this )); - OUString sPath( sUser ); - if ( !sPath.isEmpty() ) - sPath += OUStringLiteral1(MULTIPATH_DELIMITER); - sPath += sWritable; - pMultiDlg->SetPath( sPath ); + OUString sPath( sUser ); + if ( !sPath.isEmpty() ) + sPath += OUStringLiteral1(MULTIPATH_DELIMITER); + sPath += sWritable; + pMultiDlg->SetPath( sPath ); - const OUString sPathName = SvTabListBox::GetEntryText( pEntry, 0 ); - const OUString sNewTitle = pImpl->m_sMultiPathDlg.replaceFirst( VAR_ONE, sPathName ); - pMultiDlg->SetTitle( sNewTitle ); + const OUString sPathName = SvTabListBox::GetEntryText( pEntry, 0 ); + const OUString sNewTitle = pImpl->m_sMultiPathDlg.replaceFirst( VAR_ONE, sPathName ); + pMultiDlg->SetTitle( sNewTitle ); - if ( pMultiDlg->Execute() == RET_OK && pEntry ) + if ( pMultiDlg->Execute() == RET_OK && pEntry ) + { + sUser.clear(); + sWritable.clear(); + OUString sFullPath; + OUString sNewPath = pMultiDlg->GetPath(); + if ( !sNewPath.isEmpty() ) { - sUser.clear(); - sWritable.clear(); - OUString sFullPath; - OUString sNewPath = pMultiDlg->GetPath(); - if ( !sNewPath.isEmpty() ) + sal_Int32 nNextPos = 0; + for (;;) { - sal_Int32 nNextPos = 0; - for (;;) + const OUString sToken(sNewPath.getToken( 0, MULTIPATH_DELIMITER, nNextPos )); + if ( nNextPos<0 ) { - const OUString sToken(sNewPath.getToken( 0, MULTIPATH_DELIMITER, nNextPos )); - if ( nNextPos<0 ) - { - // Last token need a different handling - sWritable = sToken; - break; - } - if ( !sUser.isEmpty() ) - sUser += OUStringLiteral1(MULTIPATH_DELIMITER); - sUser += sToken; + // Last token need a different handling + sWritable = sToken; + break; } - sFullPath = sUser; - if ( !sFullPath.isEmpty() ) - sFullPath += OUStringLiteral1(MULTIPATH_DELIMITER); - sFullPath += sWritable; + if ( !sUser.isEmpty() ) + sUser += OUStringLiteral1(MULTIPATH_DELIMITER); + sUser += sToken; } - - pPathBox->SetEntryText( Convert_Impl( sFullPath ), pEntry, 1 ); - // save modified flag - PathUserData_Impl* pPathImpl = static_cast<PathUserData_Impl*>(pEntry->GetUserData()); - pPathImpl->eState = SfxItemState::SET; - pPathImpl->sUserPath = sUser; - pPathImpl->sWritablePath = sWritable; + sFullPath = sUser; + if ( !sFullPath.isEmpty() ) + sFullPath += OUStringLiteral1(MULTIPATH_DELIMITER); + sFullPath += sWritable; } + + pPathBox->SetEntryText( Convert_Impl( sFullPath ), pEntry, 1 ); + // save modified flag + PathUserData_Impl* pPathImpl = static_cast<PathUserData_Impl*>(pEntry->GetUserData()); + pPathImpl->eState = SfxItemState::SET; + pPathImpl->sUserPath = sUser; + pPathImpl->sWritablePath = sWritable; } } else if (pEntry && !bPickFile) diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 86e65d809187..075418222a09 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -1829,21 +1829,14 @@ void SbaXDataBrowserController::ExecuteSearch() SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); VclPtr<AbstractFmSearchDialog> pDialog; - if ( pFact ) - { - std::vector< OUString > aContextNames; - aContextNames.emplace_back("Standard" ); - pDialog = pFact->CreateFmSearchDialog(getBrowserView(), sInitialText, aContextNames, 0, LINK(this, SbaXDataBrowserController, OnSearchContextRequest)); - } - OSL_ENSURE( pDialog, "SbaXDataBrowserController::ExecuteSearch: could not get the search dialog!" ); - if ( pDialog ) - { - pDialog->SetActiveField( sActiveField ); - pDialog->SetFoundHandler( LINK( this, SbaXDataBrowserController, OnFoundData ) ); - pDialog->SetCanceledNotFoundHdl( LINK( this, SbaXDataBrowserController, OnCanceledNotFound ) ); - pDialog->Execute(); - pDialog.disposeAndClear(); - } + std::vector< OUString > aContextNames; + aContextNames.emplace_back("Standard" ); + pDialog = pFact->CreateFmSearchDialog(getBrowserView(), sInitialText, aContextNames, 0, LINK(this, SbaXDataBrowserController, OnSearchContextRequest)); + pDialog->SetActiveField( sActiveField ); + pDialog->SetFoundHandler( LINK( this, SbaXDataBrowserController, OnFoundData ) ); + pDialog->SetCanceledNotFoundHdl( LINK( this, SbaXDataBrowserController, OnCanceledNotFound ) ); + pDialog->Execute(); + pDialog.disposeAndClear(); // restore the grid's normal operating state xModelSet->setPropertyValue("DisplayIsSynchron", css::uno::Any(true)); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 9330789548e4..5dabafb1ba3d 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -893,13 +893,10 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleOptionsBtn, Button*, void) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) - { - OUString sExtensionId = m_pExtensionBox->GetEntryData( nActive )->m_xPackage->getIdentifier().Value; - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog( this, sExtensionId )); + OUString sExtensionId = m_pExtensionBox->GetEntryData( nActive )->m_xPackage->getIdentifier().Value; + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog( this, sExtensionId )); - pDlg->Execute(); - } + pDlg->Execute(); } } diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx index 7dc6930fd19f..f5e549ff8f43 100644 --- a/editeng/source/misc/hangulhanja.cxx +++ b/editeng/source/misc/hangulhanja.cxx @@ -279,26 +279,23 @@ namespace editeng if ( m_bIsInteractive && !m_pConversionDialog ) { EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create(); - if(pFact) - { - m_pConversionDialog = pFact->CreateHangulHanjaConversionDialog(m_pUIParent, m_ePrimaryConversionDirection ); - - m_pConversionDialog->EnableRubySupport( m_pAntiImpl->HasRubySupport() ); - - m_pConversionDialog->SetByCharacter( m_bByCharacter ); - m_pConversionDialog->SetConversionFormat( m_eConversionFormat ); - m_pConversionDialog->SetConversionDirectionState( m_bTryBothDirections, m_ePrimaryConversionDirection ); - - // the handlers - m_pConversionDialog->SetOptionsChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnOptionsChanged ) ); - m_pConversionDialog->SetIgnoreHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnore ) ); - m_pConversionDialog->SetIgnoreAllHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnoreAll ) ); - m_pConversionDialog->SetChangeHdl( LINK( this, HangulHanjaConversion_Impl, OnChange ) ); - m_pConversionDialog->SetChangeAllHdl( LINK( this, HangulHanjaConversion_Impl, OnChangeAll ) ); - m_pConversionDialog->SetClickByCharacterHdl( LINK( this, HangulHanjaConversion_Impl, OnByCharClicked ) ); - m_pConversionDialog->SetConversionFormatChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnConversionTypeChanged ) ); - m_pConversionDialog->SetFindHdl( LINK( this, HangulHanjaConversion_Impl, OnFind ) ); - } + m_pConversionDialog = pFact->CreateHangulHanjaConversionDialog(m_pUIParent, m_ePrimaryConversionDirection ); + + m_pConversionDialog->EnableRubySupport( m_pAntiImpl->HasRubySupport() ); + + m_pConversionDialog->SetByCharacter( m_bByCharacter ); + m_pConversionDialog->SetConversionFormat( m_eConversionFormat ); + m_pConversionDialog->SetConversionDirectionState( m_bTryBothDirections, m_ePrimaryConversionDirection ); + + // the handlers + m_pConversionDialog->SetOptionsChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnOptionsChanged ) ); + m_pConversionDialog->SetIgnoreHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnore ) ); + m_pConversionDialog->SetIgnoreAllHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnoreAll ) ); + m_pConversionDialog->SetChangeHdl( LINK( this, HangulHanjaConversion_Impl, OnChange ) ); + m_pConversionDialog->SetChangeAllHdl( LINK( this, HangulHanjaConversion_Impl, OnChangeAll ) ); + m_pConversionDialog->SetClickByCharacterHdl( LINK( this, HangulHanjaConversion_Impl, OnByCharClicked ) ); + m_pConversionDialog->SetConversionFormatChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnConversionTypeChanged ) ); + m_pConversionDialog->SetFindHdl( LINK( this, HangulHanjaConversion_Impl, OnFind ) ); } } diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 0f12f0cc834d..544fb9b83c1d 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -809,8 +809,6 @@ namespace pcr // the dialog SvxAbstractDialogFactory* pFactory = SvxAbstractDialogFactory::Create(); - if ( !pFactory ) - return InteractiveSelectionResult_Cancelled; ScopedVclPtr<VclAbstractDialog> pDialog( pFactory->CreateSvxMacroAssignDlg( PropertyHandlerHelper::getDialogParentWindow( m_xContext ), diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx index 01896d449ceb..47c2fcfe982d 100644 --- a/extensions/source/propctrlr/fontdialog.cxx +++ b/extensions/source/propctrlr/fontdialog.cxx @@ -177,7 +177,6 @@ namespace pcr , m_nCharsId(0) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - assert(pFact); //CreateFactory fail! m_nCharsId = AddTabPage("font", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME), nullptr ); AddTabPage("fonteffects", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS), nullptr ); } diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 06e7cb3d6398..62257da1efbf 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2644,7 +2644,6 @@ namespace pcr ScopedVclPtrInstance< SfxSingleTabDialog > xDialog( impl_getDefaultDialogParent_nothrow(), aCoreSet, "FormatNumberDialog", "cui/ui/formatnumberdialog.ui"); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT( pFact, "CreateFactory fail!" ); ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ); if ( !fnCreatePage ) throw RuntimeException(); // caught below diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index fba084130f4c..7f19e49543a7 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -4172,56 +4172,54 @@ OSectionWindow* OReportController::getSectionWindow(const css::uno::Reference< c void OReportController::openZoomDialog() { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - static SfxItemInfo aItemInfos[] = - { - { SID_ATTR_ZOOM, true } - }; - std::vector<SfxPoolItem*> pDefaults - { - new SvxZoomItem() - }; - static const sal_uInt16 pRanges[] = - { - SID_ATTR_ZOOM,SID_ATTR_ZOOM, - 0 - }; - SfxItemPool* pPool( new SfxItemPool("ZoomProperties", SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, &pDefaults) ); - pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why - pPool->FreezeIdRanges(); // the same - try - { - ::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges)); - // fill it - SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM ); - aZoomItem.SetValueSet(SvxZoomEnableFlags::N100|SvxZoomEnableFlags::WHOLEPAGE|SvxZoomEnableFlags::PAGEWIDTH); - pDescriptor->Put(aZoomItem); - ScopedVclPtr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(nullptr, *pDescriptor.get()) ); - pDlg->SetLimits( 20, 400 ); - bool bCancel = ( RET_CANCEL == pDlg->Execute() ); + static SfxItemInfo aItemInfos[] = + { + { SID_ATTR_ZOOM, true } + }; + std::vector<SfxPoolItem*> pDefaults + { + new SvxZoomItem() + }; + static const sal_uInt16 pRanges[] = + { + SID_ATTR_ZOOM,SID_ATTR_ZOOM, + 0 + }; + SfxItemPool* pPool( new SfxItemPool("ZoomProperties", SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, &pDefaults) ); + pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why + pPool->FreezeIdRanges(); // the same + try + { + ::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges)); + // fill it + SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM ); + aZoomItem.SetValueSet(SvxZoomEnableFlags::N100|SvxZoomEnableFlags::WHOLEPAGE|SvxZoomEnableFlags::PAGEWIDTH); + pDescriptor->Put(aZoomItem); - if ( !bCancel ) - { - const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->Get( SID_ATTR_ZOOM ); - m_eZoomType = rZoomItem.GetType(); - m_nZoomValue = rZoomItem.GetValue(); - if ( m_eZoomType != SvxZoomType::PERCENT ) - m_nZoomValue = getDesignView()->getZoomFactor( m_eZoomType ); + ScopedVclPtr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(nullptr, *pDescriptor.get()) ); + pDlg->SetLimits( 20, 400 ); + bool bCancel = ( RET_CANCEL == pDlg->Execute() ); - impl_zoom_nothrow(); - } - } - catch(const uno::Exception&) + if ( !bCancel ) { - DBG_UNHANDLED_EXCEPTION("reportdesign"); - } - SfxItemPool::Free(pPool); + const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->Get( SID_ATTR_ZOOM ); + m_eZoomType = rZoomItem.GetType(); + m_nZoomValue = rZoomItem.GetValue(); + if ( m_eZoomType != SvxZoomType::PERCENT ) + m_nZoomValue = getDesignView()->getZoomFactor( m_eZoomType ); - for (SfxPoolItem* pDefault : pDefaults) - delete pDefault; + impl_zoom_nothrow(); + } + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); } + SfxItemPool::Free(pPool); + + for (SfxPoolItem* pDefault : pDefaults) + delete pDefault; } diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 5c0bb28fac0b..f67580c3e9a6 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -113,7 +113,6 @@ void ScScreenshotTest::initialize() CPPUNIT_ASSERT(mpViewShell != nullptr); mpFact = ScAbstractDialogFactory::Create(); - CPPUNIT_ASSERT_MESSAGE("Failed to create dialog factory", mpFact); SvMemoryStream* pNewMemStream = new SvMemoryStream(const_cast<sal_Unicode *>(mCsv.getStr()), mCsv.getLength() * sizeof(sal_Unicode), StreamMode::READ); pNewMemStream->SetStreamCharSet( RTL_TEXTENCODING_UNICODE ); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 16c1cf1b9aef..dc65831465b9 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1184,11 +1184,8 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( aLangText == "*" ) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog(GetActiveDialogParent(), SID_LANGUAGE_OPTIONS)); - pDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog(GetActiveDialogParent(), SID_LANGUAGE_OPTIONS)); + pDlg->Execute(); rDoc.GetLanguage( eLang, eCjk, eCtl ); } diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 16badca23968..22cf65513595 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -261,36 +261,30 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) SfxItemSet aNewGeoAttr(pView->GetGeoAttrFromMarked()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCaptionDialog( pWin, pView )); + + const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); + SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange ); + aCombSet.Put( aNewAttr ); + aCombSet.Put( aNewGeoAttr ); + pDlg->SetInputSet( &aCombSet ); + + if (pDlg->Execute() == RET_OK) { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCaptionDialog( pWin, pView )); - - const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); - SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange ); - aCombSet.Put( aNewAttr ); - aCombSet.Put( aNewGeoAttr ); - pDlg->SetInputSet( &aCombSet ); - - if (pDlg->Execute() == RET_OK) - { - rReq.Done(*(pDlg->GetOutputItemSet())); - pView->SetAttributes(*pDlg->GetOutputItemSet()); - pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet()); - } + rReq.Done(*(pDlg->GetOutputItemSet())); + pView->SetAttributes(*pDlg->GetOutputItemSet()); + pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet()); } } else { SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxTransformTabDialog(pWin ? pWin->GetFrameWeld() : nullptr, &aNewAttr, pView)); + if (pDlg->Execute() == RET_OK) { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxTransformTabDialog(pWin ? pWin->GetFrameWeld() : nullptr, &aNewAttr, pView)); - if (pDlg->Execute() == RET_OK) - { - rReq.Done(*(pDlg->GetOutputItemSet())); - pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet()); - } + rReq.Done(*(pDlg->GetOutputItemSet())); + pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet()); } } } @@ -346,7 +340,7 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, vcl::Window* pWin ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( pWin, *pItemSet, xFrame )); - if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) + if ( pMacroDlg->Execute() == RET_OK ) { const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet(); const SfxPoolItem* pItem; diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx index a5345c51fe87..dfad2d5de902 100644 --- a/sc/source/ui/drawfunc/drtxtob1.cxx +++ b/sc/source/ui/drawfunc/drtxtob1.cxx @@ -43,12 +43,9 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet , sal_uInt16 nSlot) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact && "ScAbstractFactory create fail!"); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg( pViewData->GetDialogParent(), &rArgs, pViewData->GetSfxDocShell())); - assert(pDlg && "Dialog create fail!"); if (nSlot == SID_CHAR_DLG_EFFECT) { pDlg->SetCurPageId("fonteffects"); diff --git a/sc/source/ui/miscdlgs/redcom.cxx b/sc/source/ui/miscdlgs/redcom.cxx index 3c0c8af9a1a0..cea274a5b5cf 100644 --- a/sc/source/ui/miscdlgs/redcom.cxx +++ b/sc/source/ui/miscdlgs/redcom.cxx @@ -32,18 +32,15 @@ ScRedComDialog::ScRedComDialog( weld::Window* pParent, const SfxItemSet& rCoreSe , pDlg(nullptr) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - pDlg = pFact->CreateSvxPostItDialog( pParent, rCoreSet, bPrevNext ); - pDocShell=pShell; - pDlg->DontChangeAuthor(); - pDlg->HideAuthor(); + pDlg = pFact->CreateSvxPostItDialog( pParent, rCoreSet, bPrevNext ); + pDocShell=pShell; + pDlg->DontChangeAuthor(); + pDlg->HideAuthor(); - pDlg->SetPrevHdl(LINK( this, ScRedComDialog, PrevHdl)); - pDlg->SetNextHdl(LINK( this, ScRedComDialog, NextHdl)); + pDlg->SetPrevHdl(LINK( this, ScRedComDialog, PrevHdl)); + pDlg->SetNextHdl(LINK( this, ScRedComDialog, NextHdl)); - ReInit(pAction); - } + ReInit(pAction); } ScRedComDialog::~ScRedComDialog() diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 2d42839f055b..2df5212b0577 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1073,10 +1073,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( pTabViewShell->HasSelectionForDrillDown( nOrientation ) ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact && "ScAbstractFactory create fail!"); ScopedVclPtr<AbstractScDPShowDetailDlg> pDlg( pFact->CreateScDPShowDetailDlg( pTabViewShell->GetFrameWeld(), *pDPObj, nOrientation ) ); - assert(pDlg && "Dialog create fail!"); if ( pDlg->Execute() == RET_OK ) { OUString aNewDimName( pDlg->GetDimensionName() ); @@ -1547,8 +1545,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(pTabViewShell->GetFrameWeld())); - if ( pDlg ) - { for (sal_uInt16 i=0; i<nFormatCount; i++) { SotClipboardFormatId nFormatId = aFormats.GetClipbrdFormatId( i ); @@ -1580,7 +1576,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail rReq.Ignore(); } - } } else rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail @@ -2492,7 +2487,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_OPENDLG_CURRENTCONDFRMT_MANAGER: { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact); ScViewData* pData = GetViewData(); ScDocument* pDoc = pData->GetDocument(); @@ -2935,10 +2929,6 @@ void ScCellShell::ExecuteDataPilotDialog() void ScCellShell::ExecuteXMLSourceDialog() { - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - if (!pFact) - return; - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); if (!pTabViewShell) return; @@ -2984,10 +2974,7 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) aArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, GetViewData(), &aSubTotalParam ) ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact); //"ScAbstractFactory create fail - pDlg.disposeAndReset(pFact->CreateScSubTotalDlg(pTabViewShell->GetDialogParent(), &aArgSet)); - assert(pDlg); // "Dialog create fail pDlg->SetCurPageId("1stgroup"); short bResult = pDlg->Execute(); diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 65d781793d65..52588c005dda 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -496,10 +496,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact); //ScAbstractFactory create fail! - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScSortDlg(pTabViewShell->GetFrameWeld(), &aArgSet)); - assert(pDlg); //Dialog create fail! pDlg->SetCurPageId("criteria"); // 1=sort field tab 2=sort options tab if ( pDlg->Execute() == RET_OK ) @@ -1005,10 +1002,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) aExport.ExportStream( aStream, OUString(), SotClipboardFormatId::STRING ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - OSL_ENSURE( pFact, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pFact is null!" ); ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg( nullptr, OUString(), &aStream, SC_TEXTTOCOLUMNS)); - OSL_ENSURE( pDlg, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDlg is null!" ); if ( pDlg->Execute() == RET_OK ) { diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 18a06369db1c..8da6bfbf0195 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -574,13 +574,10 @@ void ScCellShell::Execute( SfxRequest& rReq ) GetRowHeight( pData->GetCurY(), pData->GetTabNo() ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact); //ScAbstractFactory create fail! - ScopedVclPtr<AbstractScMetricInputDlg> pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "RowHeightDialog", nCurHeight, ScGlobal::nStdRowHeight, eMetric, 2, MAX_ROW_HEIGHT)); - assert(pDlg); //Dialog create fail if ( pDlg->Execute() == RET_OK ) { @@ -615,13 +612,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact); //ScAbstractFactory create fail! - ScopedVclPtr<AbstractScMetricInputDlg> pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "OptimalRowHeightDialog", ScGlobal::nLastRowHeightExtra, 0, eMetric, 1, MAX_EXTRA_HEIGHT)); - assert(pDlg); //Dialog create fail! - if ( pDlg->Execute() == RET_OK ) { long nVal = pDlg->GetInputValue(); @@ -680,13 +673,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) GetColWidth( pData->GetCurX(), pData->GetTabNo() ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact); //ScAbstractFactory create fail! - ScopedVclPtr<AbstractScMetricInputDlg> pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "ColWidthDialog", nCurHeight, STD_COL_WIDTH, eMetric, 2, MAX_COL_WIDTH)); - assert(pDlg); //Dialog create fail! - if ( pDlg->Execute() == RET_OK ) { long nVal = pDlg->GetInputValue(); @@ -720,12 +709,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - assert(pFact); //ScAbstractFactory create fail! - ScopedVclPtr<AbstractScMetricInputDlg> pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "OptimalColWidthDialog", ScGlobal::nLastColWidthExtra, STD_EXTRA_WIDTH, eMetric, 1, MAX_EXTRA_WIDTH)); - assert(pDlg); //Dialog create fail! if ( pDlg->Execute() == RET_OK ) { long nVal = pDlg->GetInputValue(); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 849f11f486d7..2b286e59ad48 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -273,19 +273,16 @@ void ScEditShell::Execute( SfxRequest& rReq ) vcl::Window* pWin = pViewData->GetDialogParent(); ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(pWin ? pWin->GetFrameWeld() : nullptr)); SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; - if ( pDlg ) - { - pDlg->Insert( SotClipboardFormatId::STRING, EMPTY_OUSTRING ); - pDlg->Insert( SotClipboardFormatId::RTF, EMPTY_OUSTRING ); - pDlg->Insert( SotClipboardFormatId::RICHTEXT, EMPTY_OUSTRING ); - // Do not offer SotClipboardFormatId::STRING_TSVC for - // in-cell paste. + pDlg->Insert( SotClipboardFormatId::STRING, EMPTY_OUSTRING ); + pDlg->Insert( SotClipboardFormatId::RTF, EMPTY_OUSTRING ); + pDlg->Insert( SotClipboardFormatId::RICHTEXT, EMPTY_OUSTRING ); + // Do not offer SotClipboardFormatId::STRING_TSVC for + // in-cell paste. - TransferableDataHelper aDataHelper( - TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); + TransferableDataHelper aDataHelper( + TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) ); - nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() ); - } + nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() ); pDlg.disposeAndClear(); // while the dialog was open, edit mode may have been stopped diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 8aef31ae8889..883a2e224ab3 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -618,21 +618,18 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) aSet.Put( aZoomItem ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(nullptr, aSet)); - pDlg->SetLimits( 20, 400 ); - pDlg->HideButton( ZoomButtonId::OPTIMAL ); - bCancel = ( RET_CANCEL == pDlg->Execute() ); + ScopedVclPtr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(nullptr, aSet)); + pDlg->SetLimits( 20, 400 ); + pDlg->HideButton( ZoomButtonId::OPTIMAL ); + bCancel = ( RET_CANCEL == pDlg->Execute() ); - if ( !bCancel ) - { - const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()-> - Get( SID_ATTR_ZOOM ); + if ( !bCancel ) + { + const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()-> + Get( SID_ATTR_ZOOM ); - eZoom = rZoomItem.GetType(); - nZoom = rZoomItem.GetValue(); - } + eZoom = rZoomItem.GetType(); + nZoom = rZoomItem.GetValue(); } } diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 7ee3978f30ac..0d9239f3a69e 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -723,27 +723,21 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) aZoomItem.SetValueSet( nBtnFlags ); aSet.Put( aZoomItem ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - vcl::Window* pWin = GetDialogParent(); - pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(pWin ? pWin->GetFrameWeld() : nullptr, aSet)); - } - if (pDlg) - { - pDlg->SetLimits( MINZOOM, MAXZOOM ); + vcl::Window* pWin = GetDialogParent(); + pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(pWin ? pWin->GetFrameWeld() : nullptr, aSet)); + pDlg->SetLimits( MINZOOM, MAXZOOM ); - bCancel = ( RET_CANCEL == pDlg->Execute() ); + bCancel = ( RET_CANCEL == pDlg->Execute() ); - // bCancel is True only if we were in the previous if block, - // so no need to check again pDlg - if ( !bCancel ) - { - const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()-> - Get( SID_ATTR_ZOOM ); + // bCancel is True only if we were in the previous if block, + // so no need to check again pDlg + if ( !bCancel ) + { + const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()-> + Get( SID_ATTR_ZOOM ); - eNewZoomType = rZoomItem.GetType(); - nZoom = rZoomItem.GetValue(); - } + eNewZoomType = rZoomItem.GetType(); + nZoom = rZoomItem.GetValue(); } } diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index c301750fb97c..ae40de856b47 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -402,13 +402,10 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog( pWin, rDoc.GetLinkManager() )); - if ( pDlg ) - { - pDlg->Execute(); - rBindings.Invalidate( nSlot ); - SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator - rReq.Done(); - } + pDlg->Execute(); + rBindings.Invalidate( nSlot ); + SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); // Navigator + rReq.Done(); } break; diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 7922fdfcdea1..224fbc2ec1c6 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -835,14 +835,11 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) uno::Reference<container::XNameReplace> xEvents( new ScSheetEventsObj( pDocSh, nCurrentTab ) ); uno::Reference<frame::XFrame> xFrame = GetViewFrame()->GetFrame().GetFrameInterface(); SvxAbstractDialogFactory* pDlgFactory = SvxAbstractDialogFactory::Create(); - if (pDlgFactory) + ScopedVclPtr<VclAbstractDialog> pDialog( pDlgFactory->CreateSvxMacroAssignDlg( + GetDialogParent(), xFrame, false, xEvents, 0 ) ); + if ( pDialog->Execute() == RET_OK ) { - ScopedVclPtr<VclAbstractDialog> pDialog( pDlgFactory->CreateSvxMacroAssignDlg( - GetDialogParent(), xFrame, false, xEvents, 0 ) ); - if ( pDialog.get() && pDialog->Execute() == RET_OK ) - { // the dialog modifies the settings directly - } } } break; diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index c7a8a305e6f9..4a9759638584 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -330,14 +330,11 @@ bool ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont, { bool bRet = false; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - SfxAllItemSet aSet( rFrame.GetObjectShell()->GetPool() ); - aSet.Put( SfxBoolItem( FN_PARAM_1, false ) ); - aSet.Put( SvxFontItem( rOldFont.GetFamily(), rOldFont.GetFamilyName(), rOldFont.GetStyleName(), rOldFont.GetPitch(), rOldFont.GetCharSet(), aSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ) ) ); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rFrame.GetWindow().GetFrameWeld(), aSet, true)); - pDlg->Execute(); - } + SfxAllItemSet aSet( rFrame.GetObjectShell()->GetPool() ); + aSet.Put( SfxBoolItem( FN_PARAM_1, false ) ); + aSet.Put( SvxFontItem( rOldFont.GetFamily(), rOldFont.GetFamilyName(), rOldFont.GetStyleName(), rOldFont.GetPitch(), rOldFont.GetCharSet(), aSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ) ) ); + ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rFrame.GetWindow().GetFrameWeld(), aSet, true)); + pDlg->Execute(); return bRet; } diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index 2933ab8b7f0d..f07e156ce178 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -258,16 +258,10 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( if ( bCaughtException ) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - - if ( pFact != nullptr ) - { - ScopedVclPtr<VclAbstractDialog> pDlg( + ScopedVclPtr<VclAbstractDialog> pDlg( pFact->CreateScriptErrorDialog( aException )); - - if ( pDlg ) - pDlg->Execute(); - } - } + pDlg->Execute(); + } if ( xListener.is() ) { diff --git a/sd/source/filter/html/HtmlOptionsDialog.cxx b/sd/source/filter/html/HtmlOptionsDialog.cxx index 1716a2fd1625..092554f0e58c 100644 --- a/sd/source/filter/html/HtmlOptionsDialog.cxx +++ b/sd/source/filter/html/HtmlOptionsDialog.cxx @@ -171,21 +171,15 @@ sal_Int16 SdHtmlOptionsDialog::execute() sal_Int16 nRet = ExecutableDialogResults::CANCEL; SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if( pFact ) + ScopedVclPtr<AbstractSdPublishingDlg> pDlg(pFact->CreateSdPublishingDlg( Application::GetDefDialogParent(), meDocType )); + if( pDlg->Execute() ) { - ScopedVclPtr<AbstractSdPublishingDlg> pDlg(pFact->CreateSdPublishingDlg( Application::GetDefDialogParent(), meDocType )); - if( pDlg ) - { - if( pDlg->Execute() ) - { - pDlg->GetParameterSequence( maFilterDataSequence ); - nRet = ExecutableDialogResults::OK; - } - else - { - nRet = ExecutableDialogResults::CANCEL; - } - } + pDlg->GetParameterSequence( maFilterDataSequence ); + nRet = ExecutableDialogResults::OK; + } + else + { + nRet = ExecutableDialogResults::CANCEL; } return nRet; } diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index e3291634a35e..45af870b9679 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -744,66 +744,63 @@ VclPtr<SfxTabPage> SdModule::CreateTabPage( sal_uInt16 nId, TabPageParent pParen VclPtr<SfxTabPage> pRet; SfxAllItemSet aSet(*(rSet.GetPool())); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if( pFact ) + + switch(nId) { - switch(nId) + case SID_SD_TP_CONTENTS: + case SID_SI_TP_CONTENTS: { - case SID_SD_TP_CONTENTS: - case SID_SI_TP_CONTENTS: - { ::CreateTabPage fnCreatePage = pFact->GetSdOptionsContentsTabPageCreatorFunc(); - if( fnCreatePage ) - pRet = (*fnCreatePage)( pParent, &rSet ); - } - break; - case SID_SD_TP_SNAP: - case SID_SI_TP_SNAP: - { ::CreateTabPage fnCreatePage = pFact->GetSdOptionsSnapTabPageCreatorFunc(); - if( fnCreatePage ) - pRet = (*fnCreatePage)( pParent, &rSet ); - } - break; - case SID_SD_TP_PRINT: - case SID_SI_TP_PRINT: - { - ::CreateTabPage fnCreatePage = pFact->GetSdPrintOptionsTabPageCreatorFunc(); - if( fnCreatePage ) - { - pRet = (*fnCreatePage)( pParent, &rSet ); - if(SID_SD_TP_PRINT == nId) - aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE)); - pRet->PageCreated(aSet); - } - } - break; - case SID_SI_TP_MISC: - case SID_SD_TP_MISC: + ::CreateTabPage fnCreatePage = pFact->GetSdOptionsContentsTabPageCreatorFunc(); + if( fnCreatePage ) + pRet = (*fnCreatePage)( pParent, &rSet ); + } + break; + case SID_SD_TP_SNAP: + case SID_SI_TP_SNAP: + { + ::CreateTabPage fnCreatePage = pFact->GetSdOptionsSnapTabPageCreatorFunc(); + if( fnCreatePage ) + pRet = (*fnCreatePage)( pParent, &rSet ); + } + break; + case SID_SD_TP_PRINT: + case SID_SI_TP_PRINT: + { + ::CreateTabPage fnCreatePage = pFact->GetSdPrintOptionsTabPageCreatorFunc(); + if( fnCreatePage ) { - ::CreateTabPage fnCreatePage = pFact->GetSdOptionsMiscTabPageCreatorFunc(); - if( fnCreatePage ) - { - pRet = (*fnCreatePage)( pParent, &rSet ); - if(SID_SD_TP_MISC == nId) - aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE)); - else - aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_IMPRESS_MODE)); - pRet->PageCreated(aSet); - } + pRet = (*fnCreatePage)( pParent, &rSet ); + if(SID_SD_TP_PRINT == nId) + aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE)); + pRet->PageCreated(aSet); } - break; - case RID_SVXPAGE_TEXTANIMATION : + } + break; + case SID_SI_TP_MISC: + case SID_SD_TP_MISC: + { + ::CreateTabPage fnCreatePage = pFact->GetSdOptionsMiscTabPageCreatorFunc(); + if( fnCreatePage ) { - SfxAbstractDialogFactory* pSfxFact = SfxAbstractDialogFactory::Create(); - if ( pSfxFact ) - { - ::CreateTabPage fnCreatePage = pSfxFact->GetTabPageCreatorFunc( nId ); - if ( fnCreatePage ) - pRet = (*fnCreatePage)( pParent, &rSet ); - } + pRet = (*fnCreatePage)( pParent, &rSet ); + if(SID_SD_TP_MISC == nId) + aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE)); + else + aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_IMPRESS_MODE)); + pRet->PageCreated(aSet); } - break; } - DBG_ASSERT( pRet, "SdModule::CreateTabPage(): no valid ID for TabPage!" ); + break; + case RID_SVXPAGE_TEXTANIMATION : + { + SfxAbstractDialogFactory* pSfxFact = SfxAbstractDialogFactory::Create(); + ::CreateTabPage fnCreatePage = pSfxFact->GetTabPageCreatorFunc( nId ); + if ( fnCreatePage ) + pRet = (*fnCreatePage)( pParent, &rSet ); + } + break; } + DBG_ASSERT( pRet, "SdModule::CreateTabPage(): no valid ID for TabPage!" ); return pRet; } diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index 434d6271ce94..6e22f84315d8 100644 --- a/sd/source/ui/docshell/docshel2.cxx +++ b/sd/source/ui/docshell/docshel2.cxx @@ -283,22 +283,20 @@ bool DrawDocShell::CheckPageName(weld::Window* pWin, OUString& rName) { OUString aDesc( SdResId( STR_WARN_PAGE_EXISTS ) ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if( pFact ) - { - ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(pWin, aStrForDlg, aDesc)); - aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE ); - aNameDlg->SetCheckNameHdl( LINK( this, DrawDocShell, RenameSlideHdl ) ); + ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(pWin, aStrForDlg, aDesc)); + aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE ); - rtl::Reference<FuPoor> xFunc( mpViewShell->GetCurrentFunction() ); - if( xFunc.is() ) - xFunc->cancel(); + aNameDlg->SetCheckNameHdl( LINK( this, DrawDocShell, RenameSlideHdl ) ); - if( aNameDlg->Execute() == RET_OK ) - { - aNameDlg->GetName( rName ); - bIsNameValid = IsNewPageNameValid( rName ); - } + rtl::Reference<FuPoor> xFunc( mpViewShell->GetCurrentFunction() ); + if( xFunc.is() ) + xFunc->cancel(); + + if( aNameDlg->Execute() == RET_OK ) + { + aNameDlg->GetName( rName ); + bIsNameValid = IsNewPageNameValid( rName ); } } diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index e482e5f13b83..b79cd11cf1bb 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -267,9 +267,9 @@ void DrawDocShell::Execute( SfxRequest& rReq ) if (aNewLangTxt == "*" ) { // open the dialog "Tools/Options/Language Settings - Language" - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact && mpViewShell) + if (mpViewShell) { + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( mpViewShell->GetActiveWindow(), SID_LANGUAGE_OPTIONS )); pDlg->Execute(); } diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx index 48ab232e591b..cb62202ea650 100644 --- a/sd/source/ui/func/fuarea.cxx +++ b/sd/source/ui/func/fuarea.cxx @@ -61,9 +61,7 @@ void FuArea::DoExecute( SfxRequest& rReq ) mpView->GetAttributes( aNewAttr ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact ? pFact->CreateSvxAreaTabDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc, true) : nullptr); - if (!pDlg) - return; + VclPtr<AbstractSvxAreaTabDialog> pDlg( pFact->CreateSvxAreaTabDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc, true) ); pDlg->StartExecuteAsync([=](sal_Int32 nResult){ if (nResult == RET_OK) diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index db6df9428138..523578bad564 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -189,10 +189,8 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq ) aSet.Put( *pFontItem ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact ? pFact->CreateCharMapDialog(mpView->GetViewShell()->GetFrameWeld(), aSet, - true ) : nullptr); - if( !pDlg ) - return; + ScopedVclPtr<SfxAbstractDialog> pDlg( pFact->CreateCharMapDialog(mpView->GetViewShell()->GetFrameWeld(), aSet, + true ) ); // If a character is selected, it can be shown // pDLg->SetFont( ); diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx index 3e83b4245881..f53afb018762 100644 --- a/sd/source/ui/func/fuchar.cxx +++ b/sd/source/ui/func/fuchar.cxx @@ -72,40 +72,32 @@ void FuChar::DoExecute( SfxRequest& rReq ) aNewAttr.Put( aEditAttr, false ); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdTabCharDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc->GetDocSh() ) : nullptr); - sal_uInt16 nResult = RET_CANCEL; - if( pDlg ) + ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabCharDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc->GetDocSh() ) ); + if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT) { - if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT) - { - pDlg->SetCurPageId("RID_SVXPAGE_CHAR_EFFECTS"); - } - - nResult = pDlg->Execute(); - - if( nResult == RET_OK ) - { - const SfxItemSet* pOutputSet = pDlg->GetOutputItemSet(); - SfxItemSet aOtherSet( *pOutputSet ); - - // and now the reverse process - const SvxBrushItem* pBrushItem = aOtherSet.GetItem<SvxBrushItem>( SID_ATTR_BRUSH_CHAR ); - - if ( pBrushItem ) - { - SvxBackgroundColorItem aBackColorItem( pBrushItem->GetColor(), EE_CHAR_BKGCOLOR ); - aOtherSet.ClearItem( SID_ATTR_BRUSH_CHAR ); - aOtherSet.Put( aBackColorItem ); - } - - rReq.Done( aOtherSet ); - pArgs = rReq.GetArgs(); - } + pDlg->SetCurPageId("RID_SVXPAGE_CHAR_EFFECTS"); } + + sal_uInt16 nResult = pDlg->Execute(); + if( nResult != RET_OK ) - { return; + + const SfxItemSet* pOutputSet = pDlg->GetOutputItemSet(); + SfxItemSet aOtherSet( *pOutputSet ); + + // and now the reverse process + const SvxBrushItem* pBrushItem = aOtherSet.GetItem<SvxBrushItem>( SID_ATTR_BRUSH_CHAR ); + + if ( pBrushItem ) + { + SvxBackgroundColorItem aBackColorItem( pBrushItem->GetColor(), EE_CHAR_BKGCOLOR ); + aOtherSet.ClearItem( SID_ATTR_BRUSH_CHAR ); + aOtherSet.Put( aBackColorItem ); } + + rReq.Done( aOtherSet ); + pArgs = rReq.GetArgs(); } mpView->SetAttributes(*pArgs); diff --git a/sd/source/ui/func/fuconnct.cxx b/sd/source/ui/func/fuconnct.cxx index a65a92c11e7f..c9f15b0389c5 100644 --- a/sd/source/ui/func/fuconnct.cxx +++ b/sd/source/ui/func/fuconnct.cxx @@ -56,9 +56,9 @@ void FuConnectionDlg::DoExecute( SfxRequest& rReq ) if( !pArgs ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDlg( pFact ? pFact->CreateSfxDialog( nullptr, aNewAttr, mpView, RID_SVXPAGE_CONNECTION) : nullptr); + ScopedVclPtr<SfxAbstractDialog> pDlg( pFact->CreateSfxDialog( nullptr, aNewAttr, mpView, RID_SVXPAGE_CONNECTION) ); - if( pDlg.get() && (pDlg->Execute() == RET_OK) ) + if( pDlg->Execute() == RET_OK ) { rReq.Done( *pDlg->GetOutputItemSet() ); pArgs = rReq.GetArgs(); diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx index a8cde2135f49..e6b1c95f35e2 100644 --- a/sd/source/ui/func/fucopy.cxx +++ b/sd/source/ui/func/fucopy.cxx @@ -99,27 +99,22 @@ void FuCopy::DoExecute( SfxRequest& rReq ) } SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if( pFact ) - { - ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetActiveWindow(), aSet, mpView )); - if (!pDlg) - return; + ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetActiveWindow(), aSet, mpView )); - sal_uInt16 nResult = pDlg->Execute(); + sal_uInt16 nResult = pDlg->Execute(); - switch( nResult ) - { - case RET_OK: - pDlg->GetAttr( aSet ); - rReq.Done( aSet ); - pArgs = rReq.GetArgs(); - break; + switch( nResult ) + { + case RET_OK: + pDlg->GetAttr( aSet ); + rReq.Done( aSet ); + pArgs = rReq.GetArgs(); + break; - default: - { - pDlg.disposeAndClear(); - mpView->EndUndo(); - } + default: + { + pDlg.disposeAndClear(); + mpView->EndUndo(); return; // Cancel } } diff --git a/sd/source/ui/func/fucushow.cxx b/sd/source/ui/func/fucushow.cxx index df6e0f96cc3e..7350da59c6ea 100644 --- a/sd/source/ui/func/fucushow.cxx +++ b/sd/source/ui/func/fucushow.cxx @@ -56,25 +56,22 @@ void FuCustomShowDlg::DoExecute( SfxRequest& ) { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = mpViewShell->GetActiveWindow(); - ScopedVclPtr<AbstractSdCustomShowDlg> pDlg(pFact ? pFact->CreateSdCustomShowDlg(pWin ? pWin->GetFrameWeld() : nullptr, *mpDoc) : nullptr); - if( pDlg ) + ScopedVclPtr<AbstractSdCustomShowDlg> pDlg( pFact->CreateSdCustomShowDlg(pWin ? pWin->GetFrameWeld() : nullptr, *mpDoc) ); + sal_uInt16 nRet = pDlg->Execute(); + if( pDlg->IsModified() ) { - sal_uInt16 nRet = pDlg->Execute(); - if( pDlg->IsModified() ) - { - mpDoc->SetChanged(); - sd::PresentationSettings& rSettings = mpDoc->getPresentationSettings(); - rSettings.mbCustomShow = pDlg->IsCustomShow(); - } - pDlg.disposeAndClear(); + mpDoc->SetChanged(); + sd::PresentationSettings& rSettings = mpDoc->getPresentationSettings(); + rSettings.mbCustomShow = pDlg->IsCustomShow(); + } + pDlg.disposeAndClear(); - if( nRet == RET_YES ) - { - mpViewShell->SetStartShowWithDialog(true); + if( nRet == RET_YES ) + { + mpViewShell->SetStartShowWithDialog(true); - mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION, - SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); - } + mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION, + SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); } } diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 3f910c973047..393bc24bcda2 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -241,48 +241,45 @@ void FuInsertClipboard::DoExecute( SfxRequest& ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(mpViewShell->GetFrameWeld())); - if ( pDlg ) + pDlg->Insert( SotClipboardFormatId::EMBED_SOURCE, OUString() ); + pDlg->Insert( SotClipboardFormatId::LINK_SOURCE, OUString() ); + pDlg->Insert( SotClipboardFormatId::DRAWING, OUString() ); + pDlg->Insert( SotClipboardFormatId::SVXB, OUString() ); + pDlg->Insert( SotClipboardFormatId::GDIMETAFILE, OUString() ); + pDlg->Insert( SotClipboardFormatId::BITMAP, OUString() ); + pDlg->Insert( SotClipboardFormatId::NETSCAPE_BOOKMARK, OUString() ); + pDlg->Insert( SotClipboardFormatId::STRING, OUString() ); + pDlg->Insert( SotClipboardFormatId::HTML, OUString() ); + pDlg->Insert( SotClipboardFormatId::RTF, OUString() ); + pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() ); + pDlg->Insert( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, OUString() ); + + //TODO/MBA: testing + nFormatId = pDlg->GetFormat( aDataHelper ); + if( nFormatId != SotClipboardFormatId::NONE && aDataHelper.GetTransferable().is() ) { - pDlg->Insert( SotClipboardFormatId::EMBED_SOURCE, OUString() ); - pDlg->Insert( SotClipboardFormatId::LINK_SOURCE, OUString() ); - pDlg->Insert( SotClipboardFormatId::DRAWING, OUString() ); - pDlg->Insert( SotClipboardFormatId::SVXB, OUString() ); - pDlg->Insert( SotClipboardFormatId::GDIMETAFILE, OUString() ); - pDlg->Insert( SotClipboardFormatId::BITMAP, OUString() ); - pDlg->Insert( SotClipboardFormatId::NETSCAPE_BOOKMARK, OUString() ); - pDlg->Insert( SotClipboardFormatId::STRING, OUString() ); - pDlg->Insert( SotClipboardFormatId::HTML, OUString() ); - pDlg->Insert( SotClipboardFormatId::RTF, OUString() ); - pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() ); - pDlg->Insert( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, OUString() ); - - //TODO/MBA: testing - nFormatId = pDlg->GetFormat( aDataHelper ); - if( nFormatId != SotClipboardFormatId::NONE && aDataHelper.GetTransferable().is() ) - { - sal_Int8 nAction = DND_ACTION_COPY; - DrawViewShell* pDrViewSh = nullptr; + sal_Int8 nAction = DND_ACTION_COPY; + DrawViewShell* pDrViewSh = nullptr; - if (!mpView->InsertData( aDataHelper, - mpWindow->PixelToLogic( ::tools::Rectangle( Point(), mpWindow->GetOutputSizePixel() ).Center() ), - nAction, false, nFormatId )) - { - pDrViewSh = dynamic_cast<DrawViewShell*>(mpViewShell); - } + if (!mpView->InsertData( aDataHelper, + mpWindow->PixelToLogic( ::tools::Rectangle( Point(), mpWindow->GetOutputSizePixel() ).Center() ), + nAction, false, nFormatId )) + { + pDrViewSh = dynamic_cast<DrawViewShell*>(mpViewShell); + } - if (pDrViewSh) + if (pDrViewSh) + { + INetBookmark aINetBookmark( "", "" ); + + if( ( aDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) && + aDataHelper.GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) ) || + ( aDataHelper.HasFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ) && + aDataHelper.GetINetBookmark( SotClipboardFormatId::FILEGRPDESCRIPTOR, aINetBookmark ) ) || + ( aDataHelper.HasFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) && + aDataHelper.GetINetBookmark( SotClipboardFormatId::UNIFORMRESOURCELOCATOR, aINetBookmark ) ) ) { - INetBookmark aINetBookmark( "", "" ); - - if( ( aDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) && - aDataHelper.GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) ) || - ( aDataHelper.HasFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ) && - aDataHelper.GetINetBookmark( SotClipboardFormatId::FILEGRPDESCRIPTOR, aINetBookmark ) ) || - ( aDataHelper.HasFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) && - aDataHelper.GetINetBookmark( SotClipboardFormatId::UNIFORMRESOURCELOCATOR, aINetBookmark ) ) ) - { - pDrViewSh->InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), "" ); - } + pDrViewSh->InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), "" ); } } } @@ -501,19 +498,16 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) ScopedVclPtr<SfxAbstractInsertObjectDialog> pDlg( pFact->CreateInsertObjectDialog( mpViewShell->GetFrameWeld(), SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommandString(), xStorage, &aServerLst )); - if ( pDlg ) - { - pDlg->Execute(); - bCreateNew = pDlg->IsCreateNew(); - xObj = pDlg->GetObject(); + pDlg->Execute(); + bCreateNew = pDlg->IsCreateNew(); + xObj = pDlg->GetObject(); - xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType ); - if ( xIconMetaFile.is() ) - nAspect = embed::Aspects::MSOLE_ICON; + xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType ); + if ( xIconMetaFile.is() ) + nAspect = embed::Aspects::MSOLE_ICON; - if ( xObj.is() ) - mpViewShell->GetObjectShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName ); - } + if ( xObj.is() ) + mpViewShell->GetObjectShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName ); break; } diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 5ad65b627063..b041615a63d9 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -331,10 +331,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium) mpDocSh->SetWaitCursor( false ); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pParent = mpViewShell ? mpViewShell->GetActiveWindow() : nullptr; - ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg(pFact ? pFact->CreateSdInsertPagesObjsDlg(pParent, mpDoc, pMedium, aFile) : nullptr); - - if( !pDlg ) - return false; + ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( pFact->CreateSdInsertPagesObjsDlg(pParent, mpDoc, pMedium, aFile) ); sal_uInt16 nRet = pDlg->Execute(); @@ -415,9 +412,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium) void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg(pFact ? pFact->CreateSdInsertPagesObjsDlg(mpViewShell->GetActiveWindow(), mpDoc, nullptr, aFile) : nullptr); - if( !pDlg ) - return; + ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( pFact->CreateSdInsertPagesObjsDlg(mpViewShell->GetActiveWindow(), mpDoc, nullptr, aFile) ); mpDocSh->SetWaitCursor( false ); diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx index 3d45adf33000..9735040321c3 100644 --- a/sd/source/ui/func/fuline.cxx +++ b/sd/source/ui/func/fuline.cxx @@ -75,9 +75,7 @@ void FuLine::DoExecute( SfxRequest& rReq ) bool bHasMarked = mpView->AreObjectsMarked(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - VclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSvxLineTabDialog(mpViewShell->GetActiveWindow(), pNewAttr.get(), mpDoc, pObj, bHasMarked) : nullptr); - if (!pDlg) - return; + VclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSvxLineTabDialog(mpViewShell->GetActiveWindow(), pNewAttr.get(), mpDoc, pObj, bHasMarked) ); pDlg->StartExecuteAsync([=](sal_Int32 nResult){ if (nResult == RET_OK) diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx index 36aedff0551d..a4910d96dbac 100644 --- a/sd/source/ui/func/fulinend.cxx +++ b/sd/source/ui/func/fulinend.cxx @@ -115,34 +115,31 @@ void FuLineEnd::DoExecute( SfxRequest& ) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact ? pFact->CreateSvxNameDialog( nullptr, aName, aDesc ) : nullptr); + ScopedVclPtr<AbstractSvxNameDialog> pDlg( pFact->CreateSvxNameDialog( nullptr, aName, aDesc ) ); - if( pDlg ) + pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_LINEEND ); + + if( pDlg->Execute() == RET_OK ) { - pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_LINEEND ); + pDlg->GetName( aName ); + bDifferent = true; + + for( long i = 0; i < nCount && bDifferent; i++ ) + { + if( aName == pLineEndList->GetLineEnd( i )->GetName() ) + bDifferent = false; + } - if( pDlg->Execute() == RET_OK ) + if( bDifferent ) + { + pLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aPolyPolygon, aName)); + } + else { - pDlg->GetName( aName ); - bDifferent = true; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pLineEndList->GetLineEnd( i )->GetName() ) - bDifferent = false; - } - - if( bDifferent ) - { - pLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aPolyPolygon, aName)); - } - else - { - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr, - VclMessageType::Warning, VclButtonsType::Ok, - SdResId(STR_WARN_NAME_DUPLICATE))); - xWarn->run(); - } + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SdResId(STR_WARN_NAME_DUPLICATE))); + xWarn->run(); } } } diff --git a/sd/source/ui/func/fulink.cxx b/sd/source/ui/func/fulink.cxx index a048854f6c3e..4a9027ac4b03 100644 --- a/sd/source/ui/func/fulink.cxx +++ b/sd/source/ui/func/fulink.cxx @@ -59,11 +59,8 @@ void FuLink::DoExecute( SfxRequest& ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog( mpViewShell->GetActiveWindow(), pLinkManager )); - if ( pDlg ) - { - pDlg->Execute(); - mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_MANAGE_LINKS ); - } + pDlg->Execute(); + mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_MANAGE_LINKS ); } } // end of namespace sd diff --git a/sd/source/ui/func/fumeasur.cxx b/sd/source/ui/func/fumeasur.cxx index b4e259a8e154..f9664d76f253 100644 --- a/sd/source/ui/func/fumeasur.cxx +++ b/sd/source/ui/func/fumeasur.cxx @@ -56,9 +56,9 @@ void FuMeasureDlg::DoExecute( SfxRequest& rReq ) if( !pArgs ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDlg( pFact ? pFact->CreateSfxDialog( nullptr, aNewAttr, mpView, RID_SVXPAGE_MEASURE) : nullptr ); + ScopedVclPtr<SfxAbstractDialog> pDlg( pFact->CreateSfxDialog( nullptr, aNewAttr, mpView, RID_SVXPAGE_MEASURE) ); - if( pDlg.get() && (pDlg->Execute() == RET_OK) ) + if( pDlg->Execute() == RET_OK ) { rReq.Done( *pDlg->GetOutputItemSet() ); pArgs = rReq.GetArgs(); diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx index 6fa9494dfb7f..92e7ed2d488d 100644 --- a/sd/source/ui/func/fumorph.cxx +++ b/sd/source/ui/func/fumorph.cxx @@ -92,8 +92,8 @@ void FuMorph::DoExecute( SfxRequest& ) SdrObject* pPolyObj1 = pCloneObj1->ConvertToPolyObj(false, false); SdrObject* pPolyObj2 = pCloneObj2->ConvertToPolyObj(false, false); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractMorphDlg> pDlg(pFact ? pFact->CreateMorphDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, pObj1, pObj2) : nullptr); - if(pPolyObj1 && pPolyObj2 && pDlg && (pDlg->Execute() == RET_OK)) + ScopedVclPtr<AbstractMorphDlg> pDlg( pFact->CreateMorphDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, pObj1, pObj2) ); + if(pPolyObj1 && pPolyObj2 && (pDlg->Execute() == RET_OK)) { B2DPolyPolygonList_impl aPolyPolyList; ::basegfx::B2DPolyPolygon aPolyPoly1; diff --git a/sd/source/ui/func/fuoaprms.cxx b/sd/source/ui/func/fuoaprms.cxx index ab6f3a51b7c8..1d1854d4906b 100644 --- a/sd/source/ui/func/fuoaprms.cxx +++ b/sd/source/ui/func/fuoaprms.cxx @@ -446,18 +446,15 @@ void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq ) aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, false)); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact ? pFact->CreatSdActionDialog(mpViewShell->GetActiveWindow(), &aSet, mpView) : nullptr); + ScopedVclPtr<SfxAbstractDialog> pDlg( pFact->CreatSdActionDialog(mpViewShell->GetActiveWindow(), &aSet, mpView) ); - short nResult = pDlg ? pDlg->Execute() : static_cast<short>(RET_CANCEL); - - if( nResult == RET_OK ) - { - rReq.Done( *( pDlg->GetOutputItemSet() ) ); - pArgs = rReq.GetArgs(); - } + short nResult = pDlg->Execute(); if( nResult != RET_OK ) return; + + rReq.Done( *( pDlg->GetOutputItemSet() ) ); + pArgs = rReq.GetArgs(); } // evaluation of the ItemSets diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index a46166e95dcc..ee657c01e5c8 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -81,41 +81,31 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq ) // create and execute dialog SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr, mpView) : nullptr); - if( pDlg ) - { - if ( pPageItem ) - pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) ); - sal_uInt16 nResult = pDlg->Execute(); + ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdOutlineBulletTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr, mpView) ); + if ( pPageItem ) + pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) ); + sal_uInt16 nResult = pDlg->Execute(); - switch( nResult ) - { - case RET_OK: - { - SfxItemSet aSet( *pDlg->GetOutputItemSet() ); + if( nResult != RET_OK ) + return; - OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); + SfxItemSet aSet( *pDlg->GetOutputItemSet() ); - std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard; + OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); - if (OutlineView* pView = dynamic_cast<OutlineView*>(mpView)) - { - pOLV = pView->GetViewByWindow(mpViewShell->GetActiveWindow()); - aGuard.reset(new OutlineViewModelChangeGuard(*pView)); - } + std::unique_ptr<OutlineViewModelChangeGuard, o3tl::default_delete<OutlineViewModelChangeGuard>> aGuard; - if( pOLV ) - pOLV->EnableBullets(); + if (OutlineView* pView = dynamic_cast<OutlineView*>(mpView)) + { + pOLV = pView->GetViewByWindow(mpViewShell->GetActiveWindow()); + aGuard.reset(new OutlineViewModelChangeGuard(*pView)); + } - rReq.Done( aSet ); - pArgs = rReq.GetArgs(); - } - break; + if( pOLV ) + pOLV->EnableBullets(); - default: - return; - } - } + rReq.Done( aSet ); + pArgs = rReq.GetArgs(); } /* not direct to pOlView; therefore, SdDrawView::SetAttributes can catch diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index 58d359b72bc5..5c2c79847df7 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -330,8 +330,8 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent) { // create the dialog SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact ? pFact->CreateSdTabPageDialog(mpViewShell->GetActiveWindow(), &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage) : nullptr ); - if( pDlg.get() && pDlg->Execute() == RET_OK ) + ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabPageDialog(mpViewShell->GetActiveWindow(), &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage) ); + if( pDlg->Execute() == RET_OK ) pTempSet.reset( new SfxItemSet(*pDlg->GetOutputItemSet()) ); } diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx index 986089feb53f..a2c2ceb9f8d0 100644 --- a/sd/source/ui/func/fuparagr.cxx +++ b/sd/source/ui/func/fuparagr.cxx @@ -90,9 +90,7 @@ void FuParagraph::DoExecute( SfxRequest& rReq ) } SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdParagraphTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr) : nullptr); - if (!pDlg) - return; + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSdParagraphTabDlg(mpViewShell->GetActiveWindow(), &aNewAttr)); sal_uInt16 nResult = pDlg->Execute(); diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx index 12a2003ae097..4d6002d46571 100644 --- a/sd/source/ui/func/fuprlout.cxx +++ b/sd/source/ui/func/fuprlout.cxx @@ -170,9 +170,9 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) else { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSdPresLayoutDlg> pDlg(pFact ? pFact->CreateSdPresLayoutDlg(mpDocSh, aSet ) : nullptr); + ScopedVclPtr<AbstractSdPresLayoutDlg> pDlg( pFact->CreateSdPresLayoutDlg(mpDocSh, aSet ) ); - sal_uInt16 nResult = pDlg ? pDlg->Execute() : static_cast<short>(RET_CANCEL); + sal_uInt16 nResult = pDlg->Execute(); switch (nResult) { diff --git a/sd/source/ui/func/fuprobjs.cxx b/sd/source/ui/func/fuprobjs.cxx index da8032d7f8f8..c9e81ec38c44 100644 --- a/sd/source/ui/func/fuprobjs.cxx +++ b/sd/source/ui/func/fuprobjs.cxx @@ -134,21 +134,18 @@ void FuPresentationObjects::DoExecute( SfxRequest& ) SfxStyleSheetBase& rStyleSheet = *pStyleSheet; SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if (pFact) + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, mpViewShell->GetActiveWindow(), + false, rStyleSheet, ePO, pStyleSheetPool )); + if( pDlg->Execute() == RET_OK ) { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, mpViewShell->GetActiveWindow(), - false, rStyleSheet, ePO, pStyleSheetPool )); - if( pDlg->Execute() == RET_OK ) - { - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - // Undo-Action - StyleSheetUndoAction* pAction = new StyleSheetUndoAction - (mpDoc, static_cast<SfxStyleSheet*>(pStyleSheet), pOutSet); - mpDocSh->GetUndoManager()->AddUndoAction(pAction); - - pStyleSheet->GetItemSet().Put( *pOutSet ); - static_cast<SfxStyleSheet*>( pStyleSheet )->Broadcast( SfxHint( SfxHintId::DataChanged ) ); - } + const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); + // Undo-Action + StyleSheetUndoAction* pAction = new StyleSheetUndoAction + (mpDoc, static_cast<SfxStyleSheet*>(pStyleSheet), pOutSet); + mpDocSh->GetUndoManager()->AddUndoAction(pAction); + + pStyleSheet->GetItemSet().Put( *pOutSet ); + static_cast<SfxStyleSheet*>( pStyleSheet )->Broadcast( SfxHint( SfxHintId::DataChanged ) ); } } } diff --git a/sd/source/ui/func/fuscale.cxx b/sd/source/ui/func/fuscale.cxx index 5b2505985d27..d693fbdacad6 100644 --- a/sd/source/ui/func/fuscale.cxx +++ b/sd/source/ui/func/fuscale.cxx @@ -108,65 +108,62 @@ void FuScale::DoExecute( SfxRequest& rReq ) aNewAttr.Put( *pZoomItem ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxZoomDialog> pDlg(pFact ? pFact->CreateSvxZoomDialog(nullptr, aNewAttr) : nullptr); - if (pDlg) + ScopedVclPtr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(nullptr, aNewAttr) ); + pDlg->SetLimits( static_cast<sal_uInt16>(mpWindow->GetMinZoom()), static_cast<sal_uInt16>(mpWindow->GetMaxZoom()) ); + sal_uInt16 nResult = pDlg->Execute(); + switch( nResult ) { - pDlg->SetLimits( static_cast<sal_uInt16>(mpWindow->GetMinZoom()), static_cast<sal_uInt16>(mpWindow->GetMaxZoom()) ); - sal_uInt16 nResult = pDlg->Execute(); - switch( nResult ) + case RET_CANCEL: { - case RET_CANCEL: - { - rReq.Ignore (); - return; // Cancel - } - default: - { - rReq.Ignore (); - } - break; + rReq.Ignore (); + return; // Cancel } + default: + { + rReq.Ignore (); + } + break; + } - const SfxItemSet aArgs (*(pDlg->GetOutputItemSet ())); + const SfxItemSet aArgs (*(pDlg->GetOutputItemSet ())); - pDlg.disposeAndClear(); + pDlg.disposeAndClear(); - if (!mpViewShell) - return; + if (!mpViewShell) + return; - switch ( aArgs.Get (SID_ATTR_ZOOM).GetType ()) + switch ( aArgs.Get (SID_ATTR_ZOOM).GetType ()) + { + case SvxZoomType::PERCENT: { - case SvxZoomType::PERCENT: - { - nValue = aArgs.Get (SID_ATTR_ZOOM).GetValue (); + nValue = aArgs.Get (SID_ATTR_ZOOM).GetValue (); - mpViewShell->SetZoom( nValue ); + mpViewShell->SetZoom( nValue ); - mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom ); - } - break; + mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom ); + } + break; - case SvxZoomType::OPTIMAL: + case SvxZoomType::OPTIMAL: + { + if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) { - if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) - { - // name confusion: SID_SIZE_ALL -> zoom onto all objects - // --> the program offers it as optimal - mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); - } + // name confusion: SID_SIZE_ALL -> zoom onto all objects + // --> the program offers it as optimal + mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); } - break; + } + break; - case SvxZoomType::PAGEWIDTH: - mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); - break; + case SvxZoomType::PAGEWIDTH: + mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); + break; - case SvxZoomType::WHOLEPAGE: - mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); - break; - default: - break; - } + case SvxZoomType::WHOLEPAGE: + mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); + break; + default: + break; } } else if(mpViewShell && (pArgs->Count () == 1)) diff --git a/sd/source/ui/func/fusldlg.cxx b/sd/source/ui/func/fusldlg.cxx index 1a5ee50eb6b7..b2e9f28a400c 100644 --- a/sd/source/ui/func/fusldlg.cxx +++ b/sd/source/ui/func/fusldlg.cxx @@ -106,8 +106,8 @@ void FuSlideShowDlg::DoExecute( SfxRequest& ) aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) ); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSdStartPresDlg> pDlg(pFact ? pFact->CreateSdStartPresentationDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, aDlgSet, aPageNameList, pCustomShowList) : nullptr); - if( pDlg && (pDlg->Execute() == RET_OK) ) + ScopedVclPtr<AbstractSdStartPresDlg> pDlg( pFact->CreateSdStartPresentationDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, aDlgSet, aPageNameList, pCustomShowList) ); + if( pDlg->Execute() == RET_OK ) { OUString aPage; long nValue32; diff --git a/sd/source/ui/func/fusnapln.cxx b/sd/source/ui/func/fusnapln.cxx index a4719be2bcf9..815f851bd33c 100644 --- a/sd/source/ui/func/fusnapln.cxx +++ b/sd/source/ui/func/fusnapln.cxx @@ -110,10 +110,7 @@ void FuSnapLine::DoExecute( SfxRequest& rReq ) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = mpViewShell->GetActiveWindow(); - ScopedVclPtr<AbstractSdSnapLineDlg> pDlg(pFact ? pFact->CreateSdSnapLineDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, mpView) : nullptr); - OSL_ASSERT(pDlg); - if (!pDlg) - return; + ScopedVclPtr<AbstractSdSnapLineDlg> pDlg( pFact->CreateSdSnapLineDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, mpView) ); if ( bLineExist ) { diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx index 28babc122354..7bb64faae105 100644 --- a/sd/source/ui/func/futransf.cxx +++ b/sd/source/ui/func/futransf.cxx @@ -93,9 +93,6 @@ void FuTransform::DoExecute( SfxRequest& rReq ) mpView->GetAttributes( aNewAttr ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if (!pFact) - return; - pDlg.reset(pFact->CreateCaptionDialog(mpViewShell->GetActiveWindow(), mpView)); const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); @@ -107,9 +104,6 @@ void FuTransform::DoExecute( SfxRequest& rReq ) else { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if (!pFact) - return; - pDlg.reset(pFact->CreateSvxTransformTabDialog(mpViewShell->GetFrameWeld(), &aSet, mpView)); bWelded = true; } diff --git a/sd/source/ui/func/fuvect.cxx b/sd/source/ui/func/fuvect.cxx index 03fd915077b9..b2591437653a 100644 --- a/sd/source/ui/func/fuvect.cxx +++ b/sd/source/ui/func/fuvect.cxx @@ -65,7 +65,7 @@ void FuVectorize::DoExecute( SfxRequest& ) ScopedVclPtr<AbstractSdVectorizeDlg> pDlg( pFact->CreateSdVectorizeDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr, static_cast<SdrGrafObj*>( pObj )->GetGraphic().GetBitmapEx().GetBitmap(), mpDocSh ) ); - if( pDlg && pDlg->Execute() == RET_OK ) + if( pDlg->Execute() == RET_OK ) { const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile(); SdrPageView* pPageView = mpView->GetSdrPageView(); diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index cb86bafb5a8c..8d5b591de045 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -254,14 +254,11 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) case SID_PHOTOALBUM: { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if (pFact) - { - vcl::Window* pWin = mrSlideSorter.GetContentWindow(); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSdPhotoAlbumDialog( - pWin ? pWin->GetFrameWeld() : nullptr, - pDocument)); - pDlg->Execute(); - } + vcl::Window* pWin = mrSlideSorter.GetContentWindow(); + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSdPhotoAlbumDialog( + pWin ? pWin->GetFrameWeld() : nullptr, + pDocument)); + pDlg->Execute(); rRequest.Done (); } break; @@ -270,12 +267,8 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) { #ifdef ENABLE_SDREMOTE SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if (pFact) - { - ScopedVclPtr<VclAbstractDialog> pDlg( pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow() ) ); - if (pDlg) - pDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pDlg( pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow() ) ); + pDlg->Execute(); #endif } break; diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index fb54c8a3ba26..9e71eeeaaaed 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -125,9 +125,9 @@ void DrawViewShell::FuTable(SfxRequest& rReq) if( (nColumns == 0) || (nRows == 0) ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SvxAbstractNewTableDialog> pDlg( pFact ? pFact->CreateSvxNewTableDialog(rReq.GetFrameWeld()) : nullptr); + ScopedVclPtr<SvxAbstractNewTableDialog> pDlg( pFact->CreateSvxNewTableDialog(rReq.GetFrameWeld()) ); - if( !pDlg.get() || (pDlg->Execute() != RET_OK) ) + if( pDlg->Execute() != RET_OK ) break; nColumns = pDlg->getColumns(); diff --git a/sd/source/ui/table/tableobjectbar.cxx b/sd/source/ui/table/tableobjectbar.cxx index 50ec33d0e884..b4fd0e4d35cb 100644 --- a/sd/source/ui/table/tableobjectbar.cxx +++ b/sd/source/ui/table/tableobjectbar.cxx @@ -143,11 +143,11 @@ void TableObjectBar::Execute( SfxRequest& rReq ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); vcl::Window* pWin = mpView->GetViewShell()->GetParentWindow(); - pDlg.disposeAndReset(pFact ? pFact->CreateSvxInsRowColDlg(pWin ? pWin->GetFrameWeld() : nullptr, - nSlotId == SID_TABLE_INSERT_COL_DLG, - SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) : nullptr); + pDlg.disposeAndReset( pFact->CreateSvxInsRowColDlg(pWin ? pWin->GetFrameWeld() : nullptr, + nSlotId == SID_TABLE_INSERT_COL_DLG, + SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) ); - if (!pDlg.get() || (pDlg->Execute() != 1)) + if (pDlg->Execute() != 1) break; } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index d1280bae129a..1db662685938 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1799,45 +1799,42 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = GetActiveWindow(); - ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg(pFact ? pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, true, SdResId(STR_INSERTLAYER)) : nullptr); - if( pDlg ) - { - pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() ); + ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg( pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, true, SdResId(STR_INSERTLAYER)) ); + pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() ); - // test for already existing names - bool bLoop = true; - while( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetAttr( aNewAttr ); - aLayerName = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_NAME)).GetValue (); + // test for already existing names + bool bLoop = true; + while( bLoop && pDlg->Execute() == RET_OK ) + { + pDlg->GetAttr( aNewAttr ); + aLayerName = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_NAME)).GetValue (); - if( rLayerAdmin.GetLayer( aLayerName ) - || aLayerName.isEmpty() ) - { - // name already exists - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(), - VclMessageType::Warning, VclButtonsType::Ok, - SdResId(STR_WARN_NAME_DUPLICATE))); - xWarn->run(); - } - else - bLoop = false; - } - if( bLoop ) // was canceled + if( rLayerAdmin.GetLayer( aLayerName ) + || aLayerName.isEmpty() ) { - pDlg.disposeAndClear(); - Cancel(); - rReq.Ignore (); - break; + // name already exists + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SdResId(STR_WARN_NAME_DUPLICATE))); + xWarn->run(); } else - { - aLayerTitle = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue (); - aLayerDesc = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_DESC)).GetValue (); - bIsVisible = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue (); - bIsLocked = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue () ; - bIsPrintable = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue () ; - } + bLoop = false; + } + if( bLoop ) // was canceled + { + pDlg.disposeAndClear(); + Cancel(); + rReq.Ignore (); + break; + } + else + { + aLayerTitle = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue (); + aLayerDesc = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_DESC)).GetValue (); + bIsVisible = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue (); + bIsLocked = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue () ; + bIsPrintable = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue () ; } } else if (pArgs->Count () != 4) @@ -1967,47 +1964,44 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = GetActiveWindow(); - ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg(pFact ? pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, bDelete, SdResId(STR_MODIFYLAYER)) : nullptr); - if( pDlg ) - { - pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() ); + ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg( pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, bDelete, SdResId(STR_MODIFYLAYER)) ); + pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() ); - // test for already existing names - bool bLoop = true; - sal_uInt16 nRet = 0; - while( bLoop && ( (nRet = pDlg->Execute()) == RET_OK ) ) - { - pDlg->GetAttr( aNewAttr ); - aLayerName = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_NAME)).GetValue (); + // test for already existing names + bool bLoop = true; + sal_uInt16 nRet = 0; + while( bLoop && ( (nRet = pDlg->Execute()) == RET_OK ) ) + { + pDlg->GetAttr( aNewAttr ); + aLayerName = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_NAME)).GetValue (); - if( (rLayerAdmin.GetLayer( aLayerName ) && - aLayerName != aOldLayerName) || aLayerName.isEmpty() ) - { - // name already exists - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(), - VclMessageType::Warning, VclButtonsType::Ok, - SdResId(STR_WARN_NAME_DUPLICATE))); - xWarn->run(); - } - else - bLoop = false; - } - switch (nRet) + if( (rLayerAdmin.GetLayer( aLayerName ) && + aLayerName != aOldLayerName) || aLayerName.isEmpty() ) { - case RET_OK : - aLayerTitle = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue (); - aLayerDesc = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_DESC)).GetValue (); - bIsVisible = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue (); - bIsLocked = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue (); - bIsPrintable = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue (); - break; - - default : - pDlg.disposeAndClear(); - rReq.Ignore (); - Cancel (); - return; + // name already exists + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + SdResId(STR_WARN_NAME_DUPLICATE))); + xWarn->run(); } + else + bLoop = false; + } + switch (nRet) + { + case RET_OK : + aLayerTitle = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue (); + aLayerDesc = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_DESC)).GetValue (); + bIsVisible = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue (); + bIsLocked = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue (); + bIsPrintable = static_cast<const SfxBoolItem &>( aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue (); + break; + + default : + pDlg.disposeAndClear(); + rReq.Ignore (); + Cancel (); + return; } } else if (pArgs->Count () == 4) @@ -2393,8 +2387,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) // Dialog... SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = GetActiveWindow(); - ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg(pFact ? pFact->CreateSdModifyFieldDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFldItem->GetField(), pOLV->GetAttribs() ) : nullptr); - if( pDlg && pDlg->Execute() == RET_OK ) + ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg( pFact->CreateSdModifyFieldDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFldItem->GetField(), pOLV->GetAttribs() ) ); + if( pDlg->Execute() == RET_OK ) { // To make a correct SetAttribs() call at the utlinerView // it is necessary to split the actions here @@ -2792,14 +2786,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) else { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if( pFact ) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateBreakDlg(GetFrameWeld(), mpDrawView.get(), GetDocSh(), nCount, static_cast<sal_uLong>(nCnt) )); - if( pDlg ) - { - pDlg->Execute(); - } - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateBreakDlg(GetFrameWeld(), mpDrawView.get(), GetDocSh(), nCount, static_cast<sal_uLong>(nCnt) )); + pDlg->Execute(); } } @@ -3224,12 +3212,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { #ifdef ENABLE_SDREMOTE SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if (pFact) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateRemoteDialog(GetActiveWindow())); - if (pDlg) - pDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateRemoteDialog(GetActiveWindow())); + pDlg->Execute(); #endif } break; @@ -3315,15 +3299,12 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_PHOTOALBUM: { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if (pFact) - { - vcl::Window* pWin = GetActiveWindow(); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSdPhotoAlbumDialog( - pWin ? pWin->GetFrameWeld() : nullptr, - GetDoc())); + vcl::Window* pWin = GetActiveWindow(); + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSdPhotoAlbumDialog( + pWin ? pWin->GetFrameWeld() : nullptr, + GetDoc())); - pDlg->Execute(); - } + pDlg->Execute(); Cancel(); rReq.Ignore (); } diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 2a286ab4ba47..068aa6f8a637 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -291,14 +291,11 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); ScopedVclPtr<AbstractHeaderFooterDialog> pDlg(pFact ? pFact->CreateHeaderFooterDialog( this, GetActiveWindow(), GetDoc(), mpActualPage ) : nullptr); - if( pDlg ) - { - pDlg->Execute(); - pDlg.disposeAndClear(); + pDlg->Execute(); + pDlg.disposeAndClear(); - GetActiveWindow()->Invalidate(); - UpdatePreview( mpActualPage ); - } + GetActiveWindow()->Invalidate(); + UpdatePreview( mpActualPage ); Invalidate(); rReq.Done (); @@ -314,13 +311,10 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage()); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if (pFact) - { - vcl::Window* pWin = GetActiveWindow(); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, GetDoc(), pPage)); - pDlg->Execute(); - Invalidate(); - } + vcl::Window* pWin = GetActiveWindow(); + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, GetDoc(), pPage)); + pDlg->Execute(); + Invalidate(); rReq.Done (); break; } diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index c398f2148224..f20a0fdcc644 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -287,12 +287,8 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) { #ifdef ENABLE_SDREMOTE SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if (pFact) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateRemoteDialog(GetActiveWindow())); - if (pDlg) - pDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateRemoteDialog(GetActiveWindow())); + pDlg->Execute(); #endif } break; @@ -307,15 +303,13 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) case SID_PHOTOALBUM: { SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - if (pFact) - { - vcl::Window* pWin = GetActiveWindow(); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSdPhotoAlbumDialog( - pWin ? pWin->GetFrameWeld() : nullptr, - GetDoc())); + vcl::Window* pWin = GetActiveWindow(); + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSdPhotoAlbumDialog( + pWin ? pWin->GetFrameWeld() : nullptr, + GetDoc())); + + pDlg->Execute(); - pDlg->Execute(); - } Cancel(); rReq.Ignore (); } @@ -575,7 +569,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); vcl::Window* pWin = GetActiveWindow(); ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg(pFact ? pFact->CreateSdModifyFieldDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFldItem->GetField(), pOutlinerView->GetAttribs() ) : nullptr); - if( pDlg && (pDlg->Execute() == RET_OK) ) + if( pDlg->Execute() == RET_OK ) { std::unique_ptr<SvxFieldData> pField(pDlg->GetField()); if( pField ) diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 81e62d1ba278..710fa4b9147f 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -870,20 +870,17 @@ bool View::GetExchangeList (std::vector<OUString> &rExchangeList, SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact ? pFact->CreateSvxNameDialog(mpViewSh->GetFrameWeld(), aNewName, aDesc) : nullptr); - if (pDlg) - { - pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_OBJECT ); + pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_OBJECT ); - bNameOK = false; - pDlg->SetText( aTitle ); + bNameOK = false; + pDlg->SetText( aTitle ); - while( !bNameOK && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aNewName ); + while( !bNameOK && pDlg->Execute() == RET_OK ) + { + pDlg->GetName( aNewName ); - if( !mrDoc.GetObj( aNewName ) ) - bNameOK = true; - } + if( !mrDoc.GetObj( aNewName ) ) + bNameOK = true; } } } diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 721b5e9e3734..aa3b29329cef 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -496,27 +496,24 @@ SfxApplication::ChooseScript() #if HAVE_FEATURE_SCRIPTING SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) - { - SAL_INFO( "sfx.appl", "create selector dialog"); + SAL_INFO( "sfx.appl", "create selector dialog"); - const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr; - uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() ); + const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); + const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr; + uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() ); - ScopedVclPtr<AbstractScriptSelectorDialog> pDlg( - pFact->CreateScriptSelectorDialog( nullptr, xFrame )); + ScopedVclPtr<AbstractScriptSelectorDialog> pDlg( + pFact->CreateScriptSelectorDialog( nullptr, xFrame )); - SAL_INFO( "sfx.appl", "done, now exec it"); + SAL_INFO( "sfx.appl", "done, now exec it"); - sal_uInt16 nRet = pDlg->Execute(); + sal_uInt16 nRet = pDlg->Execute(); - SAL_INFO( "sfx.appl", "has returned"); + SAL_INFO( "sfx.appl", "has returned"); - if ( nRet == RET_OK ) - { - aScriptURL = pDlg->GetScriptURL(); - } + if ( nRet == RET_OK ) + { + aScriptURL = pDlg->GetScriptURL(); } #endif return aScriptURL; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 60cd0ddb28ee..519bcf1d89f5 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -445,31 +445,25 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) - { - const SfxStringItem* pStringItem = rReq.GetArg<SfxStringItem>(SID_CONFIG); + const SfxStringItem* pStringItem = rReq.GetArg<SfxStringItem>(SID_CONFIG); - SfxItemSet aSet( - GetPool(), svl::Items<SID_CONFIG, SID_CONFIG>{} ); + SfxItemSet aSet( + GetPool(), svl::Items<SID_CONFIG, SID_CONFIG>{} ); - if ( pStringItem ) - { - aSet.Put( SfxStringItem( - SID_CONFIG, pStringItem->GetValue() ) ); - } + if ( pStringItem ) + { + aSet.Put( SfxStringItem( + SID_CONFIG, pStringItem->GetValue() ) ); + } - Reference <XFrame> xFrame(GetRequestFrame(rReq)); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCustomizeTabDialog( - &aSet, xFrame )); + Reference <XFrame> xFrame(GetRequestFrame(rReq)); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCustomizeTabDialog( + &aSet, xFrame )); - if ( pDlg ) - { - const short nRet = pDlg->Execute(); + const short nRet = pDlg->Execute(); - if ( nRet ) - bDone = true; - } - } + if ( nRet ) + bDone = true; break; } @@ -642,12 +636,9 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) case SID_ABOUT: { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_ABOUT )); - pDlg->Execute(); - bDone = true; - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_ABOUT )); + pDlg->Execute(); + bDone = true; break; } @@ -1350,24 +1341,21 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) sPageURL = pURLItem->GetValue(); Reference <XFrame> xFrame(GetRequestFrame(rReq)); SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) + VclPtr<VclAbstractDialog> pDlg = + pFact->CreateFrameDialog(rReq.GetFrameWindow(), xFrame, rReq.GetSlot(), sPageURL ); + short nRet = pDlg->Execute(); + pDlg.disposeAndClear(); + SfxViewFrame* pView = SfxViewFrame::GetFirst(); + while ( pView ) { - VclPtr<VclAbstractDialog> pDlg = - pFact->CreateFrameDialog(rReq.GetFrameWindow(), xFrame, rReq.GetSlot(), sPageURL ); - short nRet = pDlg->Execute(); - pDlg.disposeAndClear(); - SfxViewFrame* pView = SfxViewFrame::GetFirst(); - while ( pView ) + if (nRet == RET_OK) { - if (nRet == RET_OK) - { - SfxObjectShell* pObjSh = pView->GetObjectShell(); - if (pObjSh) - pObjSh->SetConfigOptionsChecked(false); - } - pView->GetBindings().InvalidateAll(false); - pView = SfxViewFrame::GetNext( *pView ); + SfxObjectShell* pObjSh = pView->GetObjectShell(); + if (pObjSh) + pObjSh->SetConfigOptionsChecked(false); } + pView->GetBindings().InvalidateAll(false); + pView = SfxViewFrame::GetNext( *pView ); } break; } @@ -1608,19 +1596,16 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) case SID_AUTO_CORRECT_DLG: { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) - { - SfxItemSet aSet(GetPool(), svl::Items<SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG>{}); - const SfxPoolItem* pItem=nullptr; - const SfxItemSet* pSet = rReq.GetArgs(); - SfxItemPool* pSetPool = pSet ? pSet->GetPool() : nullptr; - if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), false, &pItem ) == SfxItemState::SET ) - aSet.Put( *pItem ); - - const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateAutoCorrTabDialog(pViewFrame? &pViewFrame->GetWindow(): nullptr, &aSet)); - pDlg->Execute(); - } + SfxItemSet aSet(GetPool(), svl::Items<SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG>{}); + const SfxPoolItem* pItem=nullptr; + const SfxItemSet* pSet = rReq.GetArgs(); + SfxItemPool* pSetPool = pSet ? pSet->GetPool() : nullptr; + if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), false, &pItem ) == SfxItemState::SET ) + aSet.Put( *pItem ); + + const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateAutoCorrTabDialog(pViewFrame? &pViewFrame->GetWindow(): nullptr, &aSet)); + pDlg->Execute(); break; } diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 93c90965a9ca..fcbc22b46783 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -81,11 +81,8 @@ struct Data_Impl if ( !fnCreatePage ) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) - { - fnCreatePage = pFact->GetTabPageCreatorFunc( nId ); - fnGetRanges = pFact->GetTabPageRangesFunc( nId ); - } + fnCreatePage = pFact->GetTabPageCreatorFunc( nId ); + fnGetRanges = pFact->GetTabPageRangesFunc( nId ); } } }; @@ -667,7 +664,6 @@ sal_uInt16 SfxTabDialog::AddTabPage ) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - assert(pFact); CreateTabPage pCreateFunc = pFact->GetTabPageCreatorFunc(nPageCreateId); assert(pCreateFunc); GetTabPageRanges pRangesFunc = pFact->GetTabPageRangesFunc(nPageCreateId); diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 7d7fdb02ad98..363b0e266c4c 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -395,8 +395,7 @@ void SAL_CALL IFrameObject::removeVetoableChangeListener(const OUString&, const SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); //we really should set a parent here ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateEditObjectDialog(nullptr, ".uno:InsertObjectFloatingFrame", mxObj)); - if ( pDlg ) - pDlg->Execute(); + pDlg->Execute(); return 0; } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 8bee369851ec..01064386a81f 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1402,14 +1402,9 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon if ( bCaughtException && bRaiseError ) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) - { - ScopedVclPtr<VclAbstractDialog> pScriptErrDlg( pFact->CreateScriptErrorDialog( aException ) ); - OSL_ENSURE( pScriptErrDlg.get(), "SfxObjectShell::CallXScript: no script error dialog!" ); - - if ( pScriptErrDlg.get() ) - pScriptErrDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pScriptErrDlg( pFact->CreateScriptErrorDialog( aException ) ); + if ( pScriptErrDlg.get() ) + pScriptErrDlg->Execute(); } SAL_INFO("sfx", "leaving CallXScript" ); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 346ea88400f3..a95376d75864 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1707,14 +1707,10 @@ void SmViewShell::Execute(SfxRequest& rReq) SfxItemSet aSet( SmDocShell::GetPool(), svl::Items<SID_ATTR_ZOOM, SID_ATTR_ZOOM>{}); aSet.Put( SvxZoomItem( SvxZoomType::PERCENT, mpGraphic->GetZoom())); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractSvxZoomDialog> xDlg(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aSet)); - assert(xDlg); - xDlg->SetLimits( MINZOOM, MAXZOOM ); - if (xDlg->Execute() != RET_CANCEL) - ZoomByItemSet(xDlg->GetOutputItemSet()); - } + ScopedVclPtr<AbstractSvxZoomDialog> xDlg(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aSet)); + xDlg->SetLimits( MINZOOM, MAXZOOM ); + if (xDlg->Execute() != RET_CANCEL) + ZoomByItemSet(xDlg->GetOutputItemSet()); } } } diff --git a/svx/source/dialog/SpellDialogChildWindow.cxx b/svx/source/dialog/SpellDialogChildWindow.cxx index 4e1c4eda1cc8..133230c55b55 100644 --- a/svx/source/dialog/SpellDialogChildWindow.cxx +++ b/svx/source/dialog/SpellDialogChildWindow.cxx @@ -31,7 +31,6 @@ SpellDialogChildWindow::SpellDialogChildWindow ( : SfxChildWindow (_pParent, nId) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "SvxAbstractDialogFactory::Create() failed"); m_xAbstractSpellDialog = pFact->CreateSvxSpellDialog(_pParent, pBindings, this ); diff --git a/svx/source/dialog/databaseregistrationui.cxx b/svx/source/dialog/databaseregistrationui.cxx index 82f0b5738691..04778639eda6 100644 --- a/svx/source/dialog/databaseregistrationui.cxx +++ b/svx/source/dialog/databaseregistrationui.cxx @@ -35,11 +35,8 @@ namespace svx SfxItemSet aRegistrationItems( SfxGetpApp()->GetPool(), svl::Items<SID_SB_DB_REGISTER, SID_SB_DB_REGISTER>{} ); SvxAbstractDialogFactory* pDialogFactory = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDialog; - if ( pDialogFactory ) - pDialog.disposeAndReset( pDialogFactory->CreateSfxDialog( _parentWindow, aRegistrationItems, nullptr, RID_SFXPAGE_DBREGISTER ) ); - if ( pDialog.get() ) - nResult = pDialog->Execute(); + ScopedVclPtr<SfxAbstractDialog> pDialog( pDialogFactory->CreateSfxDialog( _parentWindow, aRegistrationItems, nullptr, RID_SFXPAGE_DBREGISTER ) ); + nResult = pDialog->Execute(); return nResult; } diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx index 3d7a7daf0df7..6ec799628327 100644 --- a/svx/source/dialog/grfflt.cxx +++ b/svx/source/dialog/grfflt.cxx @@ -75,12 +75,9 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const case SID_GRFFILTER_SMOOTH: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSmooth(pWindow, rGraphic, 0.7)); - if( aDlg->Execute() == RET_OK ) - aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); - } + ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSmooth(pWindow, rGraphic, 0.7)); + if( aDlg->Execute() == RET_OK ) + aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); } break; @@ -162,36 +159,27 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const case SID_GRFFILTER_MOSAIC: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterMosaic(pWindow, rGraphic)); - if( aDlg->Execute() == RET_OK ) - aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); - } + ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterMosaic(pWindow, rGraphic)); + if( aDlg->Execute() == RET_OK ) + aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); } break; case SID_GRFFILTER_EMBOSS: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterEmboss(pWindow, rGraphic)); - if( aDlg->Execute() == RET_OK ) - aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); - } + ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterEmboss(pWindow, rGraphic)); + if( aDlg->Execute() == RET_OK ) + aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); } break; case SID_GRFFILTER_POSTER: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterPoster(pWindow, rGraphic)); - if( aDlg->Execute() == RET_OK ) - aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); - } + ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterPoster(pWindow, rGraphic)); + if( aDlg->Execute() == RET_OK ) + aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); } break; @@ -223,24 +211,18 @@ SvxGraphicFilterResult SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest const case SID_GRFFILTER_SEPIA: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSepia(pWindow, rGraphic)); - if( aDlg->Execute() == RET_OK ) - aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); - } + ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSepia(pWindow, rGraphic)); + if( aDlg->Execute() == RET_OK ) + aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); } break; case SID_GRFFILTER_SOLARIZE: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSolarize(pWindow, rGraphic)); - if( aDlg->Execute() == RET_OK ) - aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); - } + ScopedVclPtr<AbstractGraphicFilterDialog> aDlg(pFact->CreateGraphicFilterSolarize(pWindow, rGraphic)); + if( aDlg->Execute() == RET_OK ) + aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); } break; diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 39e0a3d44dbb..88d8067c1c8e 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -88,22 +88,19 @@ namespace svx { { bool bRes = false; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxBorderBackgroundDlg( pParent, *pBBSet, false/*bEnableDrawingLayerFillStyles*/ )); + if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() ) { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxBorderBackgroundDlg( pParent, *pBBSet, false/*bEnableDrawingLayerFillStyles*/ )); - if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() ) - { - SfxItemIter aIter( *pDlg->GetOutputItemSet() ); - const SfxPoolItem* pItem = aIter.FirstItem(); + SfxItemIter aIter( *pDlg->GetOutputItemSet() ); + const SfxPoolItem* pItem = aIter.FirstItem(); - while ( pItem ) - { - if ( !IsInvalidItem( pItem ) ) - pBBSet->Put( *pItem ); - pItem = aIter.NextItem(); - } - bRes = true; + while ( pItem ) + { + if ( !IsInvalidItem( pItem ) ) + pBBSet->Put( *pItem ); + pItem = aIter.NextItem(); } + bRes = true; } return bRes; } @@ -668,67 +665,64 @@ IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxBorderBackgroundDlg( + this, + *pBBSet, + mbEnableDrawingLayerFillStyles)); + + if(RET_OK == pDlg->Execute() && pDlg->GetOutputItemSet()) { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxBorderBackgroundDlg( - this, - *pBBSet, - mbEnableDrawingLayerFillStyles)); + SfxItemIter aIter(*pDlg->GetOutputItemSet()); + const SfxPoolItem* pItem = aIter.FirstItem(); - if(RET_OK == pDlg->Execute() && pDlg->GetOutputItemSet()) + while(pItem) { - SfxItemIter aIter(*pDlg->GetOutputItemSet()); - const SfxPoolItem* pItem = aIter.FirstItem(); - - while(pItem) + if(!IsInvalidItem(pItem)) { - if(!IsInvalidItem(pItem)) - { - pBBSet->Put(*pItem); - } - - pItem = aIter.NextItem(); + pBBSet->Put(*pItem); } - { - drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; - - if(mbEnableDrawingLayerFillStyles) - { - // create FillAttributes directly from DrawingLayer FillStyle entries - aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pBBSet)); - } - else - { - const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH); + pItem = aIter.NextItem(); + } - if(pBBSet->GetItemState(nWhich) == SfxItemState::SET) - { - // create FillAttributes from SvxBrushItem - const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich)); - SfxItemSet aTempSet(*pBBSet->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); + { + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; - setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); - aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); - } - } + if(mbEnableDrawingLayerFillStyles) + { + // create FillAttributes directly from DrawingLayer FillStyle entries + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pBBSet)); + } + else + { + const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH); - if(SID_ATTR_PAGE_HEADERSET == nId) - { - //m_pBspWin->SetHdColor(rItem.GetColor()); - m_pBspWin->setHeaderFillAttributes(aFillAttributes); - } - else + if(pBBSet->GetItemState(nWhich) == SfxItemState::SET) { - //m_pBspWin->SetFtColor(rItem.GetColor()); - m_pBspWin->setFooterFillAttributes(aFillAttributes); + // create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich)); + SfxItemSet aTempSet(*pBBSet->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); } } + if(SID_ATTR_PAGE_HEADERSET == nId) + { + //m_pBspWin->SetHdColor(rItem.GetColor()); + m_pBspWin->setHeaderFillAttributes(aFillAttributes); + } + else + { + //m_pBspWin->SetFtColor(rItem.GetColor()); + m_pBspWin->setFooterFillAttributes(aFillAttributes); + } } - UpdateExample(); } + + UpdateExample(); } void SvxHFPage::UpdateExample() diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index d17d6f52b692..59223912a683 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -669,7 +669,7 @@ void IMapWindow::DoMacroAssign() SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( this, aSet, mxDocumentFrame )); - if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) + if ( pMacroDlg->Execute() == RET_OK ) { const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet(); pIMapObj->SetMacroTable( pOutSet->Get( SID_ATTR_MACROITEM ).GetMacroTable() ); @@ -686,30 +686,27 @@ void IMapWindow::DoPropertyDialog() { IMapObject* pIMapObj = GetIMapObj( pSdrObj ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<AbstractURLDlg> aDlg(pFact->CreateURLDialog( this, pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(), + pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList )); + if ( aDlg->Execute() == RET_OK ) { - ScopedVclPtr<AbstractURLDlg> aDlg(pFact->CreateURLDialog( this, pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(), - pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList )); - if ( aDlg->Execute() == RET_OK ) - { - const OUString aURLText( aDlg->GetURL() ); + const OUString aURLText( aDlg->GetURL() ); - if ( !aURLText.isEmpty() ) - { - INetURLObject aObj( aURLText, INetProtocol::File ); - DBG_ASSERT( aObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL" ); - pIMapObj->SetURL( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); - } - else - pIMapObj->SetURL( aURLText ); - - pIMapObj->SetAltText( aDlg->GetAltText() ); - pIMapObj->SetDesc( aDlg->GetDesc() ); - pIMapObj->SetTarget( aDlg->GetTarget() ); - pIMapObj->SetName( aDlg->GetName() ); - pModel->SetChanged(); - UpdateInfo( true ); + if ( !aURLText.isEmpty() ) + { + INetURLObject aObj( aURLText, INetProtocol::File ); + DBG_ASSERT( aObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL" ); + pIMapObj->SetURL( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); } + else + pIMapObj->SetURL( aURLText ); + + pIMapObj->SetAltText( aDlg->GetAltText() ); + pIMapObj->SetDesc( aDlg->GetDesc() ); + pIMapObj->SetTarget( aDlg->GetTarget() ); + pIMapObj->SetName( aDlg->GetName() ); + pModel->SetChanged(); + UpdateInfo( true ); } } } diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 1df659a36941..f413ed1de17a 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -1412,21 +1412,18 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn, void ) else if (pBtn == m_pSimilarityBtn) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(GetFrameWeld(), + pSearchItem->IsLEVRelaxed(), + pSearchItem->GetLEVOther(), + pSearchItem->GetLEVShorter(), + pSearchItem->GetLEVLonger() )); + if ( pDlg->Execute() == RET_OK ) { - ScopedVclPtr<AbstractSvxSearchSimilarityDialog> pDlg(pFact->CreateSvxSearchSimilarityDialog(GetFrameWeld(), - pSearchItem->IsLEVRelaxed(), - pSearchItem->GetLEVOther(), - pSearchItem->GetLEVShorter(), - pSearchItem->GetLEVLonger() )); - if ( pDlg && pDlg->Execute() == RET_OK ) - { - pSearchItem->SetLEVRelaxed( pDlg->IsRelaxed() ); - pSearchItem->SetLEVOther( pDlg->GetOther() ); - pSearchItem->SetLEVShorter( pDlg->GetShorter() ); - pSearchItem->SetLEVLonger( pDlg->GetLonger() ); - SaveToModule_Impl(); - } + pSearchItem->SetLEVRelaxed( pDlg->IsRelaxed() ); + pSearchItem->SetLEVOther( pDlg->GetOther() ); + pSearchItem->SetLEVShorter( pDlg->GetShorter() ); + pSearchItem->SetLEVLonger( pDlg->GetLonger() ); + SaveToModule_Impl(); } } else if (pBtn == m_pJapOptionsBtn) @@ -1434,17 +1431,14 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn, void ) SfxItemSet aSet( SfxGetpApp()->GetPool() ); pSearchItem->SetTransliterationFlags( GetTransliterationFlags() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<AbstractSvxJSearchOptionsDialog> aDlg(pFact->CreateSvxJSearchOptionsDialog( this, aSet, + pSearchItem->GetTransliterationFlags() )); + int nRet = aDlg->Execute(); + if (RET_OK == nRet) //! true only if FillItemSet of SvxJSearchOptionsPage returns true { - ScopedVclPtr<AbstractSvxJSearchOptionsDialog> aDlg(pFact->CreateSvxJSearchOptionsDialog( this, aSet, - pSearchItem->GetTransliterationFlags() )); - int nRet = aDlg->Execute(); - if (RET_OK == nRet) //! true only if FillItemSet of SvxJSearchOptionsPage returns true - { - TransliterationFlags nFlags = aDlg->GetTransliterationFlags(); - pSearchItem->SetTransliterationFlags( nFlags ); - ApplyTransliterationFlags_Impl( nFlags ); - } + TransliterationFlags nFlags = aDlg->GetTransliterationFlags(); + pSearchItem->SetTransliterationFlags( nFlags ); + ApplyTransliterationFlags_Impl( nFlags ); } } else if (pBtn == m_pSearchComponent1PB || pBtn == m_pSearchComponent2PB) @@ -2030,37 +2024,34 @@ IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTabItemDialog(this, aSet)); - pDlg->SetText( aTxt ); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTabItemDialog(this, aSet)); + pDlg->SetText( aTxt ); - if ( pDlg->Execute() == RET_OK ) - { - DBG_ASSERT( pDlg->GetOutputItemSet(), "invalid Output-Set" ); - SfxItemSet aOutSet( *pDlg->GetOutputItemSet() ); + if ( pDlg->Execute() == RET_OK ) + { + DBG_ASSERT( pDlg->GetOutputItemSet(), "invalid Output-Set" ); + SfxItemSet aOutSet( *pDlg->GetOutputItemSet() ); - SearchAttrItemList* pList = bSearch ? pSearchList.get() : pReplaceList.get(); + SearchAttrItemList* pList = bSearch ? pSearchList.get() : pReplaceList.get(); - const SfxPoolItem* pItem; - for( sal_uInt16 n = 0; n < pList->Count(); ++n ) + const SfxPoolItem* pItem; + for( sal_uInt16 n = 0; n < pList->Count(); ++n ) + { + SearchAttrItem* pAItem; + if( !IsInvalidItem( (pAItem = &pList->GetObject(n))->pItem ) && + SfxItemState::SET == aOutSet.GetItemState( + pAItem->pItem->Which(), false, &pItem ) ) { - SearchAttrItem* pAItem; - if( !IsInvalidItem( (pAItem = &pList->GetObject(n))->pItem ) && - SfxItemState::SET == aOutSet.GetItemState( - pAItem->pItem->Which(), false, &pItem ) ) - { - delete pAItem->pItem; - pAItem->pItem = pItem->Clone(); - aOutSet.ClearItem( pAItem->pItem->Which() ); - } + delete pAItem->pItem; + pAItem->pItem = pItem->Clone(); + aOutSet.ClearItem( pAItem->pItem->Which() ); } + } - if( aOutSet.Count() ) - pList->Put( aOutSet ); + if( aOutSet.Count() ) + pList->Put( aOutSet ); - PaintAttrText_Impl(); // Set AttributText in GroupBox - } + PaintAttrText_Impl(); // Set AttributText in GroupBox } } @@ -2113,11 +2104,8 @@ IMPL_LINK_NOARG(SvxSearchDialog, AttributeHdl_Impl, Button*, void) return; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges.get() )); - pDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges.get() )); + pDlg->Execute(); PaintAttrText_Impl(); } diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 984a4b10a883..74a9fb42f1bb 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -893,13 +893,9 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe else if (sExecutionResult == "more") { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractFmShowColsDialog> pDlg(pFact->CreateFmShowColsDialog()); - pDlg->SetColumns(xCols); - pDlg->Execute(); - } - + ScopedVclPtr<AbstractFmShowColsDialog> pDlg(pFact->CreateFmShowColsDialog()); + pDlg->SetColumns(xCols); + pDlg->Execute(); } else if (sExecutionResult == "all") { diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index aace131faea1..763c1904107c 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -728,16 +728,12 @@ void FmFormShell::Execute(SfxRequest &rReq) else { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT( pFact, "no dialog factory!" ); - if ( pFact ) - { - ScopedVclPtr<AbstractFmInputRecordNoDialog> dlg(pFact->CreateFmInputRecordNoDialog(rReq.GetFrameWeld())); - dlg->SetValue( rController->getCursor()->getRow() ); - if ( dlg->Execute() == RET_OK ) - nRecord = dlg->GetValue(); + ScopedVclPtr<AbstractFmInputRecordNoDialog> dlg(pFact->CreateFmInputRecordNoDialog(rReq.GetFrameWeld())); + dlg->SetValue( rController->getCursor()->getRow() ); + if ( dlg->Execute() == RET_OK ) + nRecord = dlg->GetValue(); - rReq.AppendItem( SfxInt32Item( FN_PARAM_1, nRecord ) ); - } + rReq.AppendItem( SfxInt32Item( FN_PARAM_1, nRecord ) ); } if ( nRecord != -1 ) diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index c4e473daacae..033ea0f337b8 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1569,18 +1569,16 @@ void FmXFormShell::ExecuteSearch_Lock() // somewhat more fluid. Should be, however, somehow made dependent of the // underlying cursor. DAO for example is not thread-safe. SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractFmSearchDialog> pDialog; - if ( pFact ) - pDialog.disposeAndReset(pFact->CreateFmSearchDialog( &m_pShell->GetViewShell()->GetViewFrame()->GetWindow(), strInitialText, aContextNames, nInitialContext, LINK(this, FmXFormShell, OnSearchContextRequest_Lock) )); - DBG_ASSERT( pDialog, "FmXFormShell::ExecuteSearch: could not create the search dialog!" ); - if ( pDialog ) - { - pDialog->SetActiveField( strActiveField ); - pDialog->SetFoundHandler(LINK(this, FmXFormShell, OnFoundData_Lock)); - pDialog->SetCanceledNotFoundHdl(LINK(this, FmXFormShell, OnCanceledNotFound_Lock)); - pDialog->Execute(); - pDialog.disposeAndClear(); - } + ScopedVclPtr<AbstractFmSearchDialog> pDialog( + pFact->CreateFmSearchDialog( + &m_pShell->GetViewShell()->GetViewFrame()->GetWindow(), + strInitialText, aContextNames, nInitialContext, + LINK(this, FmXFormShell, OnSearchContextRequest_Lock) )); + pDialog->SetActiveField( strActiveField ); + pDialog->SetFoundHandler(LINK(this, FmXFormShell, OnFoundData_Lock)); + pDialog->SetCanceledNotFoundHdl(LINK(this, FmXFormShell, OnCanceledNotFound_Lock)); + pDialog->Execute(); + pDialog.disposeAndClear(); // restore GridControls again LoopGrids_Lock(LoopGridsSync::ENABLE_SYNC, LoopGridsFlags::DISABLE_ROCTRLR); diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 992aab0546d6..a860ad8ac592 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -264,9 +264,7 @@ void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, b ImplFillExchangeData( pTheme, *mpExchangeData ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - assert(pFact && "Got no AbstractDialogFactory!"); mpThemePropertiesDialog = pFact->CreateGalleryThemePropertiesDialog(this, mpExchangeData.get(), mpThemePropsDlgItemSet.get()); - assert(mpThemePropertiesDialog && "Got no GalleryThemePropertiesDialog!"); if ( bCreateNew ) { @@ -345,14 +343,11 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent) GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<VclAbstractRefreshableDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog( this, pTheme )); + ScopedVclPtr<VclAbstractRefreshableDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog( this, pTheme )); - aActualizeProgress->Update(); - aActualizeProgress->Execute(); - mpGallery->ReleaseTheme( pTheme, *this ); - } + aActualizeProgress->Update(); + aActualizeProgress->Execute(); + mpGallery->ReleaseTheme( pTheme, *this ); } else if (rIdent == "delete") { @@ -398,13 +393,9 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<AbstractGalleryIdDialog> aDlg(pFact->CreateGalleryIdDialog(GetFrameWeld(), pTheme)); - - if( aDlg->Execute() == RET_OK ) - pTheme->SetId( aDlg->GetId(), true ); - } + ScopedVclPtr<AbstractGalleryIdDialog> aDlg(pFact->CreateGalleryIdDialog(GetFrameWeld(), pTheme)); + if( aDlg->Execute() == RET_OK ) + pTheme->SetId( aDlg->GetId(), true ); } mpGallery->ReleaseTheme( pTheme, *this ); diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 6838801883f6..3570c4c703ed 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -1118,25 +1118,22 @@ void GalleryBrowser2::Execute(const OString &rIdent) const OUString aOldTitle( GetItemText( *mpCurTheme, *pObj, GalleryItemFlags::Title ) ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog(GetFrameWeld(), aOldTitle)); + if( aDlg->Execute() == RET_OK ) { - ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog(GetFrameWeld(), aOldTitle)); - if( aDlg->Execute() == RET_OK ) - { - OUString aNewTitle( aDlg->GetTitle() ); + OUString aNewTitle( aDlg->GetTitle() ); - if( ( aNewTitle.isEmpty() && !pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) ) - { - if( aNewTitle.isEmpty() ) - aNewTitle = "__<empty>__"; + if( ( aNewTitle.isEmpty() && !pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) ) + { + if( aNewTitle.isEmpty() ) + aNewTitle = "__<empty>__"; - pObj->SetTitle( aNewTitle ); - mpCurTheme->InsertObject( *pObj ); - } + pObj->SetTitle( aNewTitle ); + mpCurTheme->InsertObject( *pObj ); } - - GalleryTheme::ReleaseObject( pObj ); } + + GalleryTheme::ReleaseObject( pObj ); } } else if (rIdent == "copy") diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 8d905be3971a..de3ebe183928 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -768,220 +768,217 @@ void SdrEditView::DistributeMarkedObjects() SfxItemSet aNewAttr(mpModel->GetItemPool()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<AbstractSvxDistributeDialog> pDlg(pFact->CreateSvxDistributeDialog(aNewAttr)); + + sal_uInt16 nResult = pDlg->Execute(); + + if(nResult == RET_OK) { - ScopedVclPtr<AbstractSvxDistributeDialog> pDlg(pFact->CreateSvxDistributeDialog(aNewAttr)); + SvxDistributeHorizontal eHor = pDlg->GetDistributeHor(); + SvxDistributeVertical eVer = pDlg->GetDistributeVer(); + ImpDistributeEntryList aEntryList; + ImpDistributeEntryList::iterator itEntryList; + sal_uInt32 nFullLength; - sal_uInt16 nResult = pDlg->Execute(); + const bool bUndo = IsUndoEnabled(); + if( bUndo ) + BegUndo(); - if(nResult == RET_OK) + if(eHor != SvxDistributeHorizontal::NONE) { - SvxDistributeHorizontal eHor = pDlg->GetDistributeHor(); - SvxDistributeVertical eVer = pDlg->GetDistributeVer(); - ImpDistributeEntryList aEntryList; - ImpDistributeEntryList::iterator itEntryList; - sal_uInt32 nFullLength; + // build sorted entry list + nFullLength = 0; - const bool bUndo = IsUndoEnabled(); - if( bUndo ) - BegUndo(); - - if(eHor != SvxDistributeHorizontal::NONE) + for( size_t a = 0; a < nMark; ++a ) { - // build sorted entry list - nFullLength = 0; - - for( size_t a = 0; a < nMark; ++a ) - { - SdrMark* pMark = GetSdrMarkByIndex(a); - ImpDistributeEntry* pNew = new ImpDistributeEntry; + SdrMark* pMark = GetSdrMarkByIndex(a); + ImpDistributeEntry* pNew = new ImpDistributeEntry; - pNew->mpObj = pMark->GetMarkedSdrObj(); + pNew->mpObj = pMark->GetMarkedSdrObj(); - switch(eHor) + switch(eHor) + { + case SvxDistributeHorizontal::Left: { - case SvxDistributeHorizontal::Left: - { - pNew->mnPos = pNew->mpObj->GetSnapRect().Left(); - break; - } - case SvxDistributeHorizontal::Center: - { - pNew->mnPos = (pNew->mpObj->GetSnapRect().Right() + pNew->mpObj->GetSnapRect().Left()) / 2; - break; - } - case SvxDistributeHorizontal::Distance: - { - pNew->mnLength = pNew->mpObj->GetSnapRect().GetWidth() + 1; - nFullLength += pNew->mnLength; - pNew->mnPos = (pNew->mpObj->GetSnapRect().Right() + pNew->mpObj->GetSnapRect().Left()) / 2; - break; - } - case SvxDistributeHorizontal::Right: - { - pNew->mnPos = pNew->mpObj->GetSnapRect().Right(); - break; - } - default: break; + pNew->mnPos = pNew->mpObj->GetSnapRect().Left(); + break; } - - for ( itEntryList = aEntryList.begin(); - itEntryList < aEntryList.end() && (*itEntryList)->mnPos < pNew->mnPos; - ++itEntryList ) - {}; - if ( itEntryList < aEntryList.end() ) - aEntryList.insert( itEntryList, pNew ); - else - aEntryList.push_back( pNew ); - } - - if(eHor == SvxDistributeHorizontal::Distance) - { - // calculate room in-between - sal_Int32 nWidth = GetAllMarkedBoundRect().GetWidth() + 1; - double fStepWidth = (static_cast<double>(nWidth) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1); - double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); - fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ]->mnLength + aEntryList[ 1 ]->mnLength) / 2); - - // move entries 1..n-1 - for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i ) + case SvxDistributeHorizontal::Center: { - ImpDistributeEntry* pCurr = aEntryList[ i ]; - ImpDistributeEntry* pNext = aEntryList[ i + 1]; - sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; - if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); - pCurr->mpObj->Move(Size(nDelta, 0)); - fStepStart += fStepWidth + static_cast<double>((pCurr->mnLength + pNext->mnLength) / 2); + pNew->mnPos = (pNew->mpObj->GetSnapRect().Right() + pNew->mpObj->GetSnapRect().Left()) / 2; + break; } - } - else - { - // calculate distances - sal_Int32 nWidth = aEntryList[ aEntryList.size() - 1 ]->mnPos - aEntryList[ 0 ]->mnPos; - double fStepWidth = static_cast<double>(nWidth) / static_cast<double>(aEntryList.size() - 1); - double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); - fStepStart += fStepWidth; - - // move entries 1..n-1 - for( size_t i = 1 ; i < aEntryList.size()-1 ; ++i ) + case SvxDistributeHorizontal::Distance: + { + pNew->mnLength = pNew->mpObj->GetSnapRect().GetWidth() + 1; + nFullLength += pNew->mnLength; + pNew->mnPos = (pNew->mpObj->GetSnapRect().Right() + pNew->mpObj->GetSnapRect().Left()) / 2; + break; + } + case SvxDistributeHorizontal::Right: { - ImpDistributeEntry* pCurr = aEntryList[ i ]; - sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; - if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); - pCurr->mpObj->Move(Size(nDelta, 0)); - fStepStart += fStepWidth; + pNew->mnPos = pNew->mpObj->GetSnapRect().Right(); + break; } + default: break; } - // clear list - for (ImpDistributeEntry* p : aEntryList) - delete p; - aEntryList.clear(); + for ( itEntryList = aEntryList.begin(); + itEntryList < aEntryList.end() && (*itEntryList)->mnPos < pNew->mnPos; + ++itEntryList ) + {}; + if ( itEntryList < aEntryList.end() ) + aEntryList.insert( itEntryList, pNew ); + else + aEntryList.push_back( pNew ); } - if(eVer != SvxDistributeVertical::NONE) + if(eHor == SvxDistributeHorizontal::Distance) { - // build sorted entry list - nFullLength = 0; - - for( size_t a = 0; a < nMark; ++a ) + // calculate room in-between + sal_Int32 nWidth = GetAllMarkedBoundRect().GetWidth() + 1; + double fStepWidth = (static_cast<double>(nWidth) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1); + double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); + fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ]->mnLength + aEntryList[ 1 ]->mnLength) / 2); + + // move entries 1..n-1 + for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i ) + { + ImpDistributeEntry* pCurr = aEntryList[ i ]; + ImpDistributeEntry* pNext = aEntryList[ i + 1]; + sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; + if( bUndo ) + AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); + pCurr->mpObj->Move(Size(nDelta, 0)); + fStepStart += fStepWidth + static_cast<double>((pCurr->mnLength + pNext->mnLength) / 2); + } + } + else + { + // calculate distances + sal_Int32 nWidth = aEntryList[ aEntryList.size() - 1 ]->mnPos - aEntryList[ 0 ]->mnPos; + double fStepWidth = static_cast<double>(nWidth) / static_cast<double>(aEntryList.size() - 1); + double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); + fStepStart += fStepWidth; + + // move entries 1..n-1 + for( size_t i = 1 ; i < aEntryList.size()-1 ; ++i ) { - SdrMark* pMark = GetSdrMarkByIndex(a); - ImpDistributeEntry* pNew = new ImpDistributeEntry; + ImpDistributeEntry* pCurr = aEntryList[ i ]; + sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; + if( bUndo ) + AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); + pCurr->mpObj->Move(Size(nDelta, 0)); + fStepStart += fStepWidth; + } + } - pNew->mpObj = pMark->GetMarkedSdrObj(); + // clear list + for (ImpDistributeEntry* p : aEntryList) + delete p; + aEntryList.clear(); + } - switch(eVer) - { - case SvxDistributeVertical::Top: - { - pNew->mnPos = pNew->mpObj->GetSnapRect().Top(); - break; - } - case SvxDistributeVertical::Center: - { - pNew->mnPos = (pNew->mpObj->GetSnapRect().Bottom() + pNew->mpObj->GetSnapRect().Top()) / 2; - break; - } - case SvxDistributeVertical::Distance: - { - pNew->mnLength = pNew->mpObj->GetSnapRect().GetHeight() + 1; - nFullLength += pNew->mnLength; - pNew->mnPos = (pNew->mpObj->GetSnapRect().Bottom() + pNew->mpObj->GetSnapRect().Top()) / 2; - break; - } - case SvxDistributeVertical::Bottom: - { - pNew->mnPos = pNew->mpObj->GetSnapRect().Bottom(); - break; - } - default: break; - } + if(eVer != SvxDistributeVertical::NONE) + { + // build sorted entry list + nFullLength = 0; - for ( itEntryList = aEntryList.begin(); - itEntryList < aEntryList.end() && (*itEntryList)->mnPos < pNew->mnPos; - ++itEntryList ) - {}; - if ( itEntryList < aEntryList.end() ) - aEntryList.insert( itEntryList, pNew ); - else - aEntryList.push_back( pNew ); - } + for( size_t a = 0; a < nMark; ++a ) + { + SdrMark* pMark = GetSdrMarkByIndex(a); + ImpDistributeEntry* pNew = new ImpDistributeEntry; - if(eVer == SvxDistributeVertical::Distance) + pNew->mpObj = pMark->GetMarkedSdrObj(); + + switch(eVer) { - // calculate room in-between - sal_Int32 nHeight = GetAllMarkedBoundRect().GetHeight() + 1; - double fStepWidth = (static_cast<double>(nHeight) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1); - double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); - fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ]->mnLength + aEntryList[ 1 ]->mnLength) / 2); - - // move entries 1..n-1 - for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i) + case SvxDistributeVertical::Top: { - ImpDistributeEntry* pCurr = aEntryList[ i ]; - ImpDistributeEntry* pNext = aEntryList[ i + 1 ]; - sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; - if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); - pCurr->mpObj->Move(Size(0, nDelta)); - fStepStart += fStepWidth + static_cast<double>((pCurr->mnLength + pNext->mnLength) / 2); + pNew->mnPos = pNew->mpObj->GetSnapRect().Top(); + break; } - } - else - { - // calculate distances - sal_Int32 nHeight = aEntryList[ aEntryList.size() - 1 ]->mnPos - aEntryList[ 0 ]->mnPos; - double fStepWidth = static_cast<double>(nHeight) / static_cast<double>(aEntryList.size() - 1); - double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); - fStepStart += fStepWidth; - - // move entries 1..n-1 - for(size_t i = 1, n = aEntryList.size()-1; i < n; ++i) + case SvxDistributeVertical::Center: + { + pNew->mnPos = (pNew->mpObj->GetSnapRect().Bottom() + pNew->mpObj->GetSnapRect().Top()) / 2; + break; + } + case SvxDistributeVertical::Distance: + { + pNew->mnLength = pNew->mpObj->GetSnapRect().GetHeight() + 1; + nFullLength += pNew->mnLength; + pNew->mnPos = (pNew->mpObj->GetSnapRect().Bottom() + pNew->mpObj->GetSnapRect().Top()) / 2; + break; + } + case SvxDistributeVertical::Bottom: { - ImpDistributeEntry* pCurr = aEntryList[ i ]; - sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; - if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); - pCurr->mpObj->Move(Size(0, nDelta)); - fStepStart += fStepWidth; + pNew->mnPos = pNew->mpObj->GetSnapRect().Bottom(); + break; } + default: break; } - // clear list - for (ImpDistributeEntry* p : aEntryList) - delete p; - aEntryList.clear(); + for ( itEntryList = aEntryList.begin(); + itEntryList < aEntryList.end() && (*itEntryList)->mnPos < pNew->mnPos; + ++itEntryList ) + {}; + if ( itEntryList < aEntryList.end() ) + aEntryList.insert( itEntryList, pNew ); + else + aEntryList.push_back( pNew ); } - // UNDO-Comment and end of UNDO - mpModel->SetUndoComment(SvxResId(STR_DistributeMarkedObjects)); + if(eVer == SvxDistributeVertical::Distance) + { + // calculate room in-between + sal_Int32 nHeight = GetAllMarkedBoundRect().GetHeight() + 1; + double fStepWidth = (static_cast<double>(nHeight) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1); + double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); + fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ]->mnLength + aEntryList[ 1 ]->mnLength) / 2); + + // move entries 1..n-1 + for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i) + { + ImpDistributeEntry* pCurr = aEntryList[ i ]; + ImpDistributeEntry* pNext = aEntryList[ i + 1 ]; + sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; + if( bUndo ) + AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); + pCurr->mpObj->Move(Size(0, nDelta)); + fStepStart += fStepWidth + static_cast<double>((pCurr->mnLength + pNext->mnLength) / 2); + } + } + else + { + // calculate distances + sal_Int32 nHeight = aEntryList[ aEntryList.size() - 1 ]->mnPos - aEntryList[ 0 ]->mnPos; + double fStepWidth = static_cast<double>(nHeight) / static_cast<double>(aEntryList.size() - 1); + double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); + fStepStart += fStepWidth; + + // move entries 1..n-1 + for(size_t i = 1, n = aEntryList.size()-1; i < n; ++i) + { + ImpDistributeEntry* pCurr = aEntryList[ i ]; + sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; + if( bUndo ) + AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); + pCurr->mpObj->Move(Size(0, nDelta)); + fStepStart += fStepWidth; + } + } - if( bUndo ) - EndUndo(); + // clear list + for (ImpDistributeEntry* p : aEntryList) + delete p; + aEntryList.clear(); } + + // UNDO-Comment and end of UNDO + mpModel->SetUndoComment(SvxResId(STR_DistributeMarkedObjects)); + + if( bUndo ) + EndUndo(); } } } diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index efa76097a420..8d83e471e15f 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -911,13 +911,13 @@ void SvxTableController::onFormatTable( SfxRequest const & rReq ) aNewAttr.Put( aBoxInfoItem ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> xDlg( pFact ? pFact->CreateSvxFormatCellsDialog( + ScopedVclPtr<SfxAbstractTabDialog> xDlg( pFact->CreateSvxFormatCellsDialog( &aNewAttr, rModel, - &rTableObj) : nullptr ); + &rTableObj) ); // Even Cancel Button is returning positive(101) value, - if (xDlg.get() && xDlg->Execute() == RET_OK) + if (xDlg->Execute() == RET_OK) { SfxItemSet aNewSet(*(xDlg->GetOutputItemSet())); @@ -1244,9 +1244,9 @@ void SvxTableController::SplitMarkedCells() return; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr< SvxAbstractSplitTableDialog > xDlg( pFact ? pFact->CreateSvxSplitTableDialog( nullptr, false, 99 ) : nullptr ); + ScopedVclPtr< SvxAbstractSplitTableDialog > xDlg( pFact->CreateSvxSplitTableDialog( nullptr, false, 99 ) ); - if( xDlg.get() && xDlg->Execute() ) + if( xDlg->Execute() ) { const sal_Int32 nCount = xDlg->GetCount() - 1; diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 88df3b3926a5..a7badfffdfea 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -1035,21 +1035,18 @@ OUString SwGlossaryDlg::GetCurrGrpName() const IMPL_LINK_NOARG( SwGlossaryDlg, PathHdl, Button *, void ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + ScopedVclPtr<AbstractSvxMultiPathDialog> pDlg(pFact->CreateSvxPathSelectDialog(GetFrameWeld())); + SvtPathOptions aPathOpt; + const OUString sGlosPath( aPathOpt.GetAutoTextPath() ); + pDlg->SetPath(sGlosPath); + if(RET_OK == pDlg->Execute()) { - ScopedVclPtr<AbstractSvxMultiPathDialog> pDlg(pFact->CreateSvxPathSelectDialog(GetFrameWeld())); - SvtPathOptions aPathOpt; - const OUString sGlosPath( aPathOpt.GetAutoTextPath() ); - pDlg->SetPath(sGlosPath); - if(RET_OK == pDlg->Execute()) + const OUString sTmp(pDlg->GetPath()); + if(sTmp != sGlosPath) { - const OUString sTmp(pDlg->GetPath()); - if(sTmp != sGlosPath) - { - aPathOpt.SetAutoTextPath( sTmp ); - ::GetGlossaries()->UpdateGlosPath( true ); - Init(); - } + aPathOpt.SetAutoTextPath( sTmp ); + ::GetGlossaries()->UpdateGlosPath( true ); + Init(); } } } diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 8424d9310dc1..0420bc94b7c6 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -333,17 +333,14 @@ IMPL_LINK( SwSortDlg, DelimHdl, weld::ToggleButton&, rButton, void ) IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl, weld::Button&, void) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + SfxAllItemSet aSet( rSh.GetAttrPool() ); + aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) ); + ScopedVclPtr<SfxAbstractDialog> pMap(pFact->CreateCharMapDialog(m_xDialog.get(), aSet, false)); + if( RET_OK == pMap->Execute() ) { - SfxAllItemSet aSet( rSh.GetAttrPool() ); - aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) ); - ScopedVclPtr<SfxAbstractDialog> pMap(pFact->CreateCharMapDialog(m_xDialog.get(), aSet, false)); - if( RET_OK == pMap->Execute() ) - { - const SfxInt32Item* pItem = SfxItemSet::GetItem<SfxInt32Item>(pMap->GetOutputItemSet(), SID_ATTR_CHAR, false); - if ( pItem ) - m_xDelimEdt->set_text(OUString(sal_Unicode(pItem->GetValue()))); - } + const SfxInt32Item* pItem = SfxItemSet::GetItem<SfxInt32Item>(pMap->GetOutputItemSet(), SID_ATTR_CHAR, false); + if ( pItem ) + m_xDelimEdt->set_text(OUString(sal_Unicode(pItem->GetValue()))); } } diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx index f9732a261a89..fe03e3793423 100644 --- a/sw/source/uibase/app/appenv.cxx +++ b/sw/source/uibase/app/appenv.cxx @@ -212,8 +212,6 @@ void SwModule::InsertEnv( SfxRequest& rReq ) if ( !pItem ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg.disposeAndReset(pFact->CreateSwEnvDlg(pParent ? pParent->GetFrameWeld() : nullptr, aSet, pOldSh, pTempPrinter, !bEnvChange)); nMode = pDlg->Execute(); } diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index 769d9d2cef71..5c9ca1819568 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -166,7 +166,6 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) aSet.Put( aLabCfg.GetItem() ); SwAbstractDialogFactory* pDialogFactory = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pDialogFactory, "SwAbstractDialogFactory fail!"); ScopedVclPtr<AbstractSwLabDlg> pDlg(pDialogFactory->CreateSwLabDlg(rReq.GetFrameWeld(), aSet, #if HAVE_FEATURE_DBCONNECTIVITY diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index b00e8a8b2fef..ad08b8f24321 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -156,7 +156,6 @@ VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(const SfxItem if ( pVSh && dynamic_cast< const SwSrcView *>( pVSh ) == nullptr ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); pDlg->AddFontTabPage(); pDlg->AddTabPage(RID_SW_TP_DOC_STAT, SwResId(STR_DOC_STAT), pFact->GetTabPageCreatorFunc(RID_SW_TP_DOC_STAT), nullptr); } @@ -762,8 +761,6 @@ void SwDocShell::Execute(SfxRequest& rReq) case FN_ABSTRACT_NEWDOC: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg()); if(RET_OK == pDlg->Execute()) { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 5ef0e4b295c0..3b67b9478572 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -817,10 +817,8 @@ void SwDocShell::Edit( FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode)); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert( pFact ); ScopedVclPtr<SfxAbstractApplyTabDialog> pDlg(pFact->CreateTemplateDialog(&GetView()->GetViewFrame()->GetWindow(), *(xTmp.get()), nFamily, sPage, pCurrShell, bNew)); - assert( pDlg ); std::shared_ptr<ApplyStyle> pApplyStyleHelper(new ApplyStyle(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified)); pDlg->SetApplyHdl(LINK(pApplyStyleHelper.get(), ApplyStyle, ApplyHdl)); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 2aa434b40819..54e678280616 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -3036,7 +3036,6 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh, pFound = FindDSConnection(sDataSource, true); } SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert( pFact && "Factory creation failed!" ); pImpl->pMergeDialog = pFact->CreateMailMergeDlg( &rSh.GetView().GetViewFrame()->GetWindow(), rSh, sDataSource, sDataTableOrQuery, @@ -3142,7 +3141,6 @@ void SwDBManager::InsertText(SwWrtShell& rSh, aDBData.nCommandType = nCmdType; SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert( pFact && "Factory creation failed!" ); ScopedVclPtr<AbstractSwInsertDBColAutoPilot> pDlg(pFact->CreateSwInsertDBColAutoPilot( rSh.GetView(), xSource, xColSupp, diff --git a/sw/source/uibase/dialog/wordcountwrapper.cxx b/sw/source/uibase/dialog/wordcountwrapper.cxx index 9d353d223ca2..090410509a0d 100644 --- a/sw/source/uibase/dialog/wordcountwrapper.cxx +++ b/sw/source/uibase/dialog/wordcountwrapper.cxx @@ -21,9 +21,7 @@ SwWordCountWrapper::SwWordCountWrapper( vcl::Window *pParentWindow, SfxChildWindow(pParentWindow, nId) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); xAbstDlg.reset(pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow, pInfo)); - assert(xAbstDlg && "Dialog construction failed!"); SetWindow(xAbstDlg->GetWindow()); } diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 12720302f0e5..3896c3cbddeb 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -432,8 +432,6 @@ bool SwGlossaryHdl::Expand( const OUString& rShortName, else { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwSelGlossaryDlg> pDlg(pFact->CreateSwSelGlossaryDlg(aShortName)); for(TextBlockInfo_Impl & i : aFoundArr) { diff --git a/sw/source/uibase/fldui/fldwrap.cxx b/sw/source/uibase/fldui/fldwrap.cxx index d1f79d6473fe..7b56883414ac 100644 --- a/sw/source/uibase/fldui/fldwrap.cxx +++ b/sw/source/uibase/fldui/fldwrap.cxx @@ -77,7 +77,6 @@ SwFieldDlgWrapper::SwFieldDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, : SwChildWinWrapper( _pParent, nId ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); pDlgInterface = pFact->CreateSwFieldDlg(pB, this, _pParent); SetWindow( pDlgInterface->GetWindow() ); pDlgInterface->Start(); @@ -117,8 +116,6 @@ SwFieldDataOnlyDlgWrapper::SwFieldDataOnlyDlgWrapper( vcl::Window* _pParent, sal : SwChildWinWrapper( _pParent, nId ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlgInterface = pFact->CreateSwFieldDlg(pB, this, _pParent); SetWindow( pDlgInterface->GetWindow() ); diff --git a/sw/source/uibase/index/idxmrk.cxx b/sw/source/uibase/index/idxmrk.cxx index cd30b9e1a4b3..2ad709b2ecdb 100644 --- a/sw/source/uibase/index/idxmrk.cxx +++ b/sw/source/uibase/index/idxmrk.cxx @@ -49,7 +49,6 @@ SwInsertIdxMarkWrapper::SwInsertIdxMarkWrapper( vcl::Window *pParentWindow, SfxChildWindow(pParentWindow, nId) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); pAbstDlg = pFact->CreateIndexMarkFloatDlg(pBindings, this, pParentWindow, pInfo); SetWindow( pAbstDlg->GetWindow() ); GetWindow()->Show(); // at this point,because before pSh has to be initialized in ReInitDlg() @@ -77,7 +76,6 @@ SwInsertAuthMarkWrapper::SwInsertAuthMarkWrapper( vcl::Window *pParentWindow, SfxChildWindow(pParentWindow, nId) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); pAbstDlg = pFact->CreateAuthMarkFloatDlg(pBindings, this, pParentWindow, pInfo); SetWindow( pAbstDlg->GetWindow() ); } diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index f105072c0443..ab802d2033d5 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -482,8 +482,6 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, SwCharDlgMode::Ann)); if (nSlot == SID_CHAR_DLG_EFFECT) { @@ -533,8 +531,6 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwParaDlg( rView.GetWindow(), rView, aDlgAttr, true )); sal_uInt16 nRet = pDlg->Execute(); if(RET_OK == nRet) diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 8180958d55b9..4a1d27e29692 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -873,8 +873,6 @@ void SwBaseShell::Execute(SfxRequest &rReq) else { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwConvertTableDlg> pDlg(pFact->CreateSwConvertTableDlg(GetView(), bToTable)); if( RET_OK == pDlg->Execute() ) { @@ -2469,8 +2467,6 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) ::PrepareBoxInfo( aSet, rSh ); rSh.GetTabBorders( aSet ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg.disposeAndReset(pFact->CreateSwBorderDlg( pMDI, aSet, SwBorderModes::TABLE )); if ( pDlg->Execute() == RET_OK ) { @@ -2485,8 +2481,6 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) aSet.Put( aMgr.GetAttrSet() ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg.disposeAndReset(pFact->CreateSwBorderDlg( pMDI, aSet, SwBorderModes::FRAME )); if ( pDlg->Execute() == RET_OK ) { @@ -2502,8 +2496,6 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) ::PrepareBoxInfo( aSet, rSh ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg.disposeAndReset(pFact->CreateSwBorderDlg( pMDI, aSet, SwBorderModes::PARA )); if ( pDlg->Execute() == RET_OK ) { @@ -2525,7 +2517,6 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) ScopedVclPtr<SfxAbstractDialog> pDlg; SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); // Table cell(s) selected? if ( rSh.IsTableMode() ) @@ -2882,8 +2873,6 @@ void SwBaseShell::ExecField( SfxRequest const & rReq ) case FN_CHANGE_DBFIELD: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwChangeDBDlg(GetView())); pDlg->Execute(); } diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx index 90f99d4a5fb3..0dfaa6a92c43 100644 --- a/sw/source/uibase/shells/drawdlg.cxx +++ b/sw/source/uibase/shells/drawdlg.cxx @@ -52,20 +52,17 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) case FN_DRAWTEXT_ATTR_DLG: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog(rReq.GetFrameWeld(), &aNewAttr, pView)); - sal_uInt16 nResult = pDlg->Execute(); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog(rReq.GetFrameWeld(), &aNewAttr, pView)); + sal_uInt16 nResult = pDlg->Execute(); - if (nResult == RET_OK) + if (nResult == RET_OK) + { + if (pView->AreObjectsMarked()) { - if (pView->AreObjectsMarked()) - { - pSh->StartAction(); - pView->SetAttributes(*pDlg->GetOutputItemSet()); - rReq.Done(*(pDlg->GetOutputItemSet())); - pSh->EndAction(); - } + pSh->StartAction(); + pView->SetAttributes(*pDlg->GetOutputItemSet()); + rReq.Done(*(pDlg->GetOutputItemSet())); + pSh->EndAction(); } } } diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 610006aabea6..b56ae8aec092 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -137,8 +137,6 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) pSh->GetObjAttr(aSet); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSwWrapDlg( GetView().GetWindow(), aSet, pSh )); if (pDlg->Execute() == RET_OK) diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index ea1810fbc485..15bd355de83d 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -350,8 +350,6 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetWindow(), *pView, aDlgAttr, SwCharDlgMode::Draw)); if (nSlot == SID_CHAR_DLG_EFFECT) { @@ -424,8 +422,6 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwParaDlg( GetView().GetWindow(), GetView(), aDlgAttr, true )); sal_uInt16 nRet = pDlg->Execute(); if(RET_OK == nRet) diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index f4a1f7f8b263..5d6aa79c6a0d 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -437,20 +437,17 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq) SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() ); pSdrView->GetAttributes( aNewAttr ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog( - GetView().GetViewFrame()->GetWindow().GetFrameWeld(), - &aNewAttr, pSdrView )); - sal_uInt16 nResult = pDlg->Execute(); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog( + GetView().GetViewFrame()->GetWindow().GetFrameWeld(), + &aNewAttr, pSdrView )); + sal_uInt16 nResult = pDlg->Execute(); - if (nResult == RET_OK) + if (nResult == RET_OK) + { + if (pSdrView->AreObjectsMarked()) { - if (pSdrView->AreObjectsMarked()) - { - pSdrView->SetAttributes(*pDlg->GetOutputItemSet()); - rReq.Done(*(pDlg->GetOutputItemSet())); - } + pSdrView->SetAttributes(*pDlg->GetOutputItemSet()); + rReq.Done(*(pDlg->GetOutputItemSet())); } } } diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index ffa11114c8e8..b9c0cdf624fd 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -476,7 +476,6 @@ void SwFrameShell::Execute(SfxRequest &rReq) FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &GetView()) != nullptr ); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) )); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact); ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateFrameTabDialog( nSel & SelectionType::Graphic ? OUString("PictureDialog") : nSel & SelectionType::Ole ? OUString("ObjectDialog"): @@ -486,7 +485,6 @@ void SwFrameShell::Execute(SfxRequest &rReq) aSet, false, sDefPage)); - assert(pDlg); if ( nSlot == FN_DRAW_WRAP_DLG ) { @@ -634,12 +632,9 @@ void SwFrameShell::Execute(SfxRequest &rReq) { OUString aName(rSh.GetFlyName()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - assert(pFact); ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg( pFact->CreateSvxObjectNameDialog(GetView().GetFrameWeld(), aName)); - assert(pDlg); - if ( pDlg->Execute() == RET_OK ) { pDlg->GetName(aName); @@ -660,11 +655,9 @@ void SwFrameShell::Execute(SfxRequest &rReq) OUString aTitle(rSh.GetObjTitle()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - assert(pFact); ScopedVclPtr<AbstractSvxObjectTitleDescDialog> pDlg( pFact->CreateSvxObjectTitleDescDialog(GetView().GetFrameWeld(), aTitle, aDescription )); - assert(pDlg); if ( pDlg->Execute() == RET_OK ) { @@ -1296,13 +1289,11 @@ void SwFrameShell::ExecDrawDlgTextFrame(SfxRequest const & rReq) rSh.GetFlyFrameAttr(aNewAttr); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - assert(pFact); ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog( nullptr, &aNewAttr, pDoc, false)); - assert(pDlg); if(RET_OK == pDlg->Execute()) { diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index cc31d9d3ea05..f8fd3b7739a0 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -410,13 +410,10 @@ void SwGrfShell::Execute(SfxRequest &rReq) } SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "no dialog factory!"); ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateFrameTabDialog("PictureDialog", GetView().GetViewFrame(), GetView().GetWindow(), aSet, false)); - OSL_ENSURE(pDlg, "no tab dialog!"); - if (nSlot == FN_DRAW_WRAP_DLG) pDlg->SetCurPageId("wrap"); diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 07b626ad5bb5..b5417f375995 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -121,11 +121,8 @@ namespace SwLangHelper { // open the dialog "Tools/Options/Language Settings - Language" SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS )); - pDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS )); + pDlg->Execute(); } else { diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index d4babd3c0ca5..c319c895483c 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -593,8 +593,6 @@ void SwTableShell::Execute(SfxRequest &rReq) setSvxBrushItemAsFillAttributesToTargetSet(aBrush, aCoreSet); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTableTabDlg(GetView().GetWindow(), &aCoreSet, &rSh)); if (pDlg) @@ -679,7 +677,6 @@ void SwTableShell::Execute(SfxRequest &rReq) sCurText, SID_ATTR_NUMBERFORMAT_INFO )); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateNumFormatDialog(GetView().GetWindow(), aCoreSet)); if (RET_OK == pDlg->Execute()) @@ -826,8 +823,6 @@ void SwTableShell::Execute(SfxRequest &rReq) case SID_AUTOFORMAT: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwAutoFormatDlg> pDlg(pFact->CreateSwAutoFormatDlg(GetView().GetFrameWeld(), &rSh)); pDlg->Execute(); break; @@ -835,7 +830,6 @@ void SwTableShell::Execute(SfxRequest &rReq) case FN_TABLE_SET_ROW_HEIGHT: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwTableHeightDialog(GetView().GetFrameWeld(), rSh)); pDlg->Execute(); break; @@ -948,10 +942,9 @@ void SwTableShell::Execute(SfxRequest &rReq) if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline()) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SvxAbstractInsRowColDlg> pDlg(pFact ? pFact->CreateSvxInsRowColDlg(GetView().GetFrameWeld(), - nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand() ) : nullptr); - - if( pDlg.get() && (pDlg->Execute() == 1) ) + ScopedVclPtr<SvxAbstractInsRowColDlg> pDlg(pFact->CreateSvxInsRowColDlg(GetView().GetFrameWeld(), + nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand())); + if( pDlg->Execute() == 1 ) { const sal_uInt16 nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG) ? FN_TABLE_INSERT_COL_AFTER : FN_TABLE_INSERT_ROW_AFTER; @@ -985,19 +978,16 @@ void SwTableShell::Execute(SfxRequest &rReq) else { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if( pFact ) + const long nMaxVert = rSh.GetAnyCurRect( CurRectType::Frame ).Width() / MINLAY; + ScopedVclPtr<SvxAbstractSplitTableDialog> pDlg(pFact->CreateSvxSplitTableDialog(GetView().GetFrameWeld(), rSh.IsTableVertical(), nMaxVert)); + if( pDlg->Execute() == RET_OK ) { - const long nMaxVert = rSh.GetAnyCurRect( CurRectType::Frame ).Width() / MINLAY; - ScopedVclPtr<SvxAbstractSplitTableDialog> pDlg(pFact->CreateSvxSplitTableDialog(GetView().GetFrameWeld(), rSh.IsTableVertical(), nMaxVert)); - if( pDlg && (pDlg->Execute() == RET_OK) ) - { - nCount = pDlg->GetCount(); - bHorizontal = pDlg->IsHorizontal(); - bProportional = pDlg->IsProportional(); - rReq.AppendItem( SfxInt32Item( FN_TABLE_SPLIT_CELLS, nCount ) ); - rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bHorizontal ) ); - rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bProportional ) ); - } + nCount = pDlg->GetCount(); + bHorizontal = pDlg->IsHorizontal(); + bProportional = pDlg->IsProportional(); + rReq.AppendItem( SfxInt32Item( FN_TABLE_SPLIT_CELLS, nCount ) ); + rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bHorizontal ) ); + rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bProportional ) ); } } @@ -1031,8 +1021,6 @@ void SwTableShell::Execute(SfxRequest &rReq) else { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSplitTableDialog> pDlg(pFact->CreateSplitTableDialog(GetView().GetFrameWeld(), rSh)); pDlg->Execute(); rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(pDlg->GetSplitMode()) ) ); @@ -1049,7 +1037,6 @@ void SwTableShell::Execute(SfxRequest &rReq) if( bPrev && bNext ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateTableMergeDialog(GetView().GetFrameWeld(), bPrev)); if( RET_OK != pDlg->Execute()) bPrev = bNext = false; diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 96ba6359a6ef..a8fc344d7a56 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -138,18 +138,13 @@ void SwTextShell::ExecField(SfxRequest &rReq) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog( pMDI, &rSh.GetLinkManager(), false, &rLink )); - if ( pDlg ) - { - pDlg->Execute(); - } + pDlg->Execute(); } break; } default: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSwFieldEditDlg( GetView() )); pDlg->Execute(); } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 7b37022a9326..5495f890566c 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -183,14 +183,7 @@ void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, *pCoreSet); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg.reset(pFact->CreateSwCharDlg(rWrtSh.GetView().GetWindow(), rWrtSh.GetView(), *pCoreSet, SwCharDlgMode::Std)); - if (!pDlg) - { - SAL_WARN("sw.ui", "Dialog creation failed!"); - return; - } if (nSlot == FN_INSERT_HYPERLINK) pDlg->SetCurPageId("hyperlink"); @@ -419,11 +412,8 @@ void SwTextShell::Execute(SfxRequest &rReq) // open the dialog "Tools/Options/Language Settings - Language" // to set the documents default language SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( GetView().GetWindow(), SID_LANGUAGE_OPTIONS )); - pDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( GetView().GetWindow(), SID_LANGUAGE_OPTIONS )); + pDlg->Execute(); } else { @@ -644,7 +634,6 @@ void SwTextShell::Execute(SfxRequest &rReq) else { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); ScopedVclPtr<AbstractSwBreakDlg> pDlg(pFact->CreateSwBreakDlg(GetView().GetFrameWeld(), rWrtSh)); if ( pDlg->Execute() == RET_OK ) { @@ -700,8 +689,6 @@ void SwTextShell::Execute(SfxRequest &rReq) else { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwInsertBookmarkDlg( GetView().GetWindow(), rWrtSh, rReq )); pDlg->Execute(); } @@ -731,8 +718,6 @@ void SwTextShell::Execute(SfxRequest &rReq) pVFrame->ToggleChildWindow(FN_REDLINE_ACCEPT); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwModalRedlineAcceptDlg> pDlg(pFact->CreateSwModalRedlineAcceptDlg(&GetView().GetEditWin())); switch (lcl_AskRedlineFlags(GetView().GetFrameWeld())) @@ -1062,8 +1047,6 @@ void SwTextShell::Execute(SfxRequest &rReq) sDefPage = OUStringToOString(static_cast<const SfxStringItem*>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg.reset(pFact->CreateSwParaDlg( GetView().GetWindow(),GetView(), aCoreSet, false, sDefPage )); } diff --git a/sw/source/uibase/shells/textsh2.cxx b/sw/source/uibase/shells/textsh2.cxx index 2dc0dc528e89..7a0afc797764 100644 --- a/sw/source/uibase/shells/textsh2.cxx +++ b/sw/source/uibase/shells/textsh2.cxx @@ -248,7 +248,6 @@ IMPL_LINK( SwBaseShell, InsertDBTextHdl, void*, p, void ) { SwDBData aDBData = pDBStruct->aDBData; SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); ScopedVclPtr<AbstractSwInsertDBColAutoPilot>pDlg (pFact->CreateSwInsertDBColAutoPilot(GetView(), xSource, xColSupp, diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index 13e3320ced6f..1788e6fad01d 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -479,7 +479,6 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) HINT_END, HINT_END>{}); rSh.GetCurAttr(aSet); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSwDropCapsDialog(GetView().GetWindow(), aSet)); if (pDlg->Execute() == RET_OK) { diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index f0c9c26a7419..da16e077bad8 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -54,8 +54,6 @@ void SwTableFUNC::ColWidthDlg(weld::Window *pParent) { InitTabCols(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwTableWidthDlg(pParent, *this)); pDlg->Execute(); } diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 0d1a9b048545..69afb012a9c8 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -757,11 +757,7 @@ void SwPagePreview::Execute( SfxRequest &rReq ) aCoreSet.Put( aZoom ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aCoreSet)); - } - + pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aCoreSet)); pDlg->SetLimits( MINZOOM, MAXZOOM ); if( pDlg->Execute() != RET_CANCEL ) diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 14931e2f6f79..592147febec9 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -598,8 +598,6 @@ void SwView::ExecViewOptions(SfxRequest &rReq) void SwView::ExecFormatFootnote() { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetFrameWeld(), GetWrtShell())); pDlg->Execute(); } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 12ee6f975b22..6dd361e72559 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1678,17 +1678,10 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aCoreSet)); - OSL_ENSURE(pDlg, "Zooming fail!"); - if (pDlg) - { - pDlg->SetLimits( MINZOOM, MAXZOOM ); - if( pDlg->Execute() != RET_CANCEL ) - pSet = pDlg->GetOutputItemSet(); - } - } + pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetWindow().GetFrameWeld(), aCoreSet)); + pDlg->SetLimits( MINZOOM, MAXZOOM ); + if( pDlg->Execute() != RET_CANCEL ) + pSet = pDlg->GetOutputItemSet(); } const SfxPoolItem* pViewLayoutItem = nullptr; @@ -1884,10 +1877,7 @@ void SwView::EditLinkDlg() bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog( &GetViewFrame()->GetWindow(), &GetWrtShell().GetLinkManager(), bWeb )); - if ( pDlg ) - { - pDlg->Execute(); - } + pDlg->Execute(); } bool SwView::JumpToSwMark( const OUString& rMark ) @@ -2353,11 +2343,8 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) if (RET_OK == xWarning->run()) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if ( pFact ) - { - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_OPTIONS_DATABASES )); - pDlg->Execute(); - } + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_OPTIONS_DATABASES )); + pDlg->Execute(); } return ; } diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index 7bc9cb1a94b4..e88a14128519 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -53,40 +53,27 @@ void SwView::ExecDlgExt(SfxRequest const &rReq) case FN_INSERT_CAPTION: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<VclAbstractDialog> pDialog(pFact->CreateSwCaptionDialog( &rMDI, *this )); - if ( pDialog ) - { - pDialog->Execute(); - } + pDialog->Execute(); break; } case SID_INSERT_SIGNATURELINE: case SID_EDIT_SIGNATURELINE: { VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); - assert(pFact && "VclAbstractDialogFactory fail!"); - const uno::Reference<frame::XModel> xModel(GetCurrentDocument()); ScopedVclPtr<AbstractSignatureLineDialog> pDialog(pFact->CreateSignatureLineDialog( GetFrameWeld(), xModel, rReq.GetSlot() == SID_EDIT_SIGNATURELINE)); - - if (pDialog) - pDialog->Execute(); + pDialog->Execute(); break; } case SID_SIGN_SIGNATURELINE: { VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); - assert(pFact && "VclAbstractDialogFactory fail!"); - const uno::Reference<frame::XModel> xModel(GetCurrentDocument()); VclPtr<AbstractSignSignatureLineDialog> pDialog = pFact->CreateSignSignatureLineDialog(GetFrameWeld(), xModel); - - if (pDialog) - pDialog->Execute(); + pDialog->Execute(); break; } case FN_EDIT_FOOTNOTE: diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index d7ac18727985..f3138353331c 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -308,9 +308,6 @@ VclPtr<SfxTabPage> CreatePrintOptionsPage( weld::Container* pPage, bool bPreview ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "No Print Dialog"); - if (!pFact) - return nullptr; ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc(TP_OPTPRINT_PAGE); OSL_ENSURE(pFact, "No Page Creator"); diff --git a/sw/source/uibase/uno/SwXFilterOptions.cxx b/sw/source/uibase/uno/SwXFilterOptions.cxx index a5f12b146b0a..d7163846db00 100644 --- a/sw/source/uibase/uno/SwXFilterOptions.cxx +++ b/sw/source/uibase/uno/SwXFilterOptions.cxx @@ -93,10 +93,7 @@ sal_Int16 SwXFilterOptions::execute() } if(pDocShell) { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwAsciiFilterDlg> pAsciiDlg(pFact->CreateSwAsciiFilterDlg(Application::GetFrameWeld(xDialogParent), *pDocShell, pInStream.get())); if(RET_OK == pAsciiDlg->Execute()) diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index aeb0ce137600..80922f4ef11f 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3380,8 +3380,6 @@ void SwContentTree::EditEntry(SvTreeListEntry const * pEntry, EditEntryMode nMod aObj >>= xTmp; uno::Reference< container::XNamed > xNamed(xTmp, uno::UNO_QUERY); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwRenameXNamedDlg> pDlg(pFact->CreateSwRenameXNamedDlg(GetFrameWeld(), xNamed, xNameAccess)); if(xSecond.is()) pDlg->SetAlternativeAccess( xSecond, xThird); diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx index 8b14843ef74c..089e0e9f7445 100644 --- a/sw/source/uibase/utlui/numfmtlb.cxx +++ b/sw/source/uibase/utlui/numfmtlb.cxx @@ -371,7 +371,6 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox&, rBox, void ) aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO, bUseAutomaticLanguage)); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - assert(pFact && "SwAbstractDialogFactory fail!"); ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateNumFormatDialog(this, aCoreSet)); if (RET_OK == pDlg->Execute()) diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index abd73227d1ad..aa3b8bf4c0f8 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -281,8 +281,6 @@ bool SwWrtShell::StartDropDownFieldDlg(SwField* pField, bool bPrevButton, bool b weld::Window* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(pParentWin, *this, pField, bPrevButton, bNextButton)); const short nRet = pDlg->Execute(); |