summaryrefslogtreecommitdiff
path: root/svx/source
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 /svx/source
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 'svx/source')
-rw-r--r--svx/source/dialog/SpellDialogChildWindow.cxx1
-rw-r--r--svx/source/dialog/databaseregistrationui.cxx7
-rw-r--r--svx/source/dialog/grfflt.cxx54
-rw-r--r--svx/source/dialog/hdft.cxx110
-rw-r--r--svx/source/dialog/imapwnd.cxx41
-rw-r--r--svx/source/dialog/srchdlg.cxx94
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx10
-rw-r--r--svx/source/form/fmshell.cxx14
-rw-r--r--svx/source/form/fmshimp.cxx22
-rw-r--r--svx/source/gallery2/galbrws1.cxx23
-rw-r--r--svx/source/gallery2/galbrws2.cxx25
-rw-r--r--svx/source/svdraw/svdedtv2.cxx355
-rw-r--r--svx/source/table/tablecontroller.cxx10
13 files changed, 349 insertions, 417 deletions
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;