summaryrefslogtreecommitdiff
path: root/chart2
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 /chart2
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 'chart2')
-rw-r--r--chart2/source/controller/main/ChartController_Position.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_TextEdit.cxx2
-rw-r--r--chart2/source/controller/main/ShapeController.cxx151
3 files changed, 62 insertions, 93 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 );
}
}
}