summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-31 08:29:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-12 08:24:04 +0200
commit51c879d8649c7aad7a0c9be0c7ea042d041254d8 (patch)
treed454d885be767ba7d113547b1fa91ee85cabcf6a /sc/source/ui/view
parentaf66cd6e0809982d61b962fbcf2042981084f770 (diff)
simplify calls to *DialogFactory::Create methods
we don't need to check for nullptr here, it's never null. Change-Id: I3cc5337a8f4dec6747821679e39ccba3cec20f56 Reviewed-on: https://gerrit.libreoffice.org/55114 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/cellsh1.cxx13
-rw-r--r--sc/source/ui/view/cellsh2.cxx5
-rw-r--r--sc/source/ui/view/cellsh3.cxx14
-rw-r--r--sc/source/ui/view/editsh.cxx19
-rw-r--r--sc/source/ui/view/prevwsh.cxx23
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx30
-rw-r--r--sc/source/ui/view/tabvwshb.cxx11
-rw-r--r--sc/source/ui/view/tabvwshf.cxx9
-rw-r--r--sc/source/ui/view/viewutil.cxx13
9 files changed, 42 insertions, 95 deletions
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;
}