[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 10 06:20:25 UTC 2018
sw/source/core/access/acccontext.cxx | 16 +--------
sw/source/core/doc/docdraw.cxx | 31 +++++++------------
sw/source/core/frmedt/feshview.cxx | 2 -
sw/source/core/unocore/unorefmk.cxx | 2 -
sw/source/filter/html/swhtml.cxx | 4 --
sw/source/filter/ww8/wrtw8esh.cxx | 3 -
sw/source/filter/ww8/wrtw8sty.cxx | 2 -
sw/source/filter/ww8/wrtww8gr.cxx | 2 -
sw/source/filter/ww8/ww8atr.cxx | 12 ++-----
sw/source/uibase/app/swmodul1.cxx | 2 -
sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 4 +-
sw/source/uibase/dialog/regionsw.cxx | 4 +-
sw/source/uibase/dochdl/swdtflvr.cxx | 2 -
sw/source/uibase/ribbar/concustomshape.cxx | 2 -
sw/source/uibase/shells/mediash.cxx | 4 +-
sw/source/uibase/sidebar/PageFooterPanel.cxx | 8 ++--
sw/source/uibase/sidebar/PageFormatPanel.cxx | 6 +--
sw/source/uibase/sidebar/PageHeaderPanel.cxx | 8 ++--
sw/source/uibase/sidebar/PageStylesPanel.cxx | 4 +-
sw/source/uibase/uno/unotxdoc.cxx | 3 -
20 files changed, 47 insertions(+), 74 deletions(-)
New commits:
commit b268ef57e97e692644335afeae834205ecb73557
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Aug 9 16:30:08 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 10 08:19:55 2018 +0200
unnecessary null check before dynamic_cast, in sw
Change-Id: I4f3f3f8b8b7fdf57fe76ff9a24cd8c58e386392d
Reviewed-on: https://gerrit.libreoffice.org/58770
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 57847272b505..b60cf277560d 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -101,29 +101,17 @@ vcl::Window *SwAccessibleContext::GetWindow()
// get SwViewShell from accessibility map, and cast to cursor shell
SwCursorShell* SwAccessibleContext::GetCursorShell()
{
- SwCursorShell* pCursorShell;
SwViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : nullptr;
OSL_ENSURE( pViewShell, "no view shell" );
- if( pViewShell && dynamic_cast<const SwCursorShell*>( pViewShell) != nullptr )
- pCursorShell = static_cast<SwCursorShell*>( pViewShell );
- else
- pCursorShell = nullptr;
-
- return pCursorShell;
+ return dynamic_cast<SwCursorShell*>( pViewShell);
}
const SwCursorShell* SwAccessibleContext::GetCursorShell() const
{
// just like non-const GetCursorShell
- const SwCursorShell* pCursorShell;
const SwViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : nullptr;
OSL_ENSURE( pViewShell, "no view shell" );
- if( pViewShell && dynamic_cast<const SwCursorShell*>( pViewShell) != nullptr )
- pCursorShell = static_cast<const SwCursorShell*>( pViewShell );
- else
- pCursorShell = nullptr;
-
- return pCursorShell;
+ return dynamic_cast<const SwCursorShell*>( pViewShell);
}
enum class Action { NONE, SCROLLED, SCROLLED_WITHIN,
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index b41c2ca7a973..a09301ecba71 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -504,37 +504,31 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
const SvxFieldItem& rField = pInfo->GetField();
const SvxFieldData* pField = rField.GetField();
- if (pField && dynamic_cast<const SvxDateField*>( pField) != nullptr)
+ if (auto pDateField = dynamic_cast<const SvxDateField*>( pField))
{
// Date field
pInfo->SetRepresentation(
- static_cast<const SvxDateField*>( pField)->GetFormatted(
+ pDateField->GetFormatted(
*GetNumberFormatter(), LANGUAGE_SYSTEM) );
}
- else if (pField && dynamic_cast<const SvxURLField*>( pField) != nullptr)
+ else if (auto pURLField = dynamic_cast<const SvxURLField*>( pField))
{
// URL field
- switch ( static_cast<const SvxURLField*>( pField)->GetFormat() )
+ switch ( pURLField->GetFormat() )
{
case SvxURLFormat::AppDefault: //!!! Can be set in App???
case SvxURLFormat::Repr:
- {
- pInfo->SetRepresentation(
- static_cast<const SvxURLField*>(pField)->GetRepresentation());
- }
- break;
+ pInfo->SetRepresentation(pURLField->GetRepresentation());
+ break;
case SvxURLFormat::Url:
- {
- pInfo->SetRepresentation(
- static_cast<const SvxURLField*>(pField)->GetURL());
- }
- break;
+ pInfo->SetRepresentation(pURLField->GetURL());
+ break;
}
sal_uInt16 nChrFormat;
- if (IsVisitedURL(static_cast<const SvxURLField*>(pField)->GetURL()))
+ if (IsVisitedURL(pURLField->GetURL()))
nChrFormat = RES_POOLCHR_INET_VISIT;
else
nChrFormat = RES_POOLCHR_INET_NORMAL;
@@ -547,17 +541,16 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
pInfo->SetTextColor(aColor);
}
- else if (pField && dynamic_cast<const SdrMeasureField*>( pField) != nullptr)
+ else if (dynamic_cast<const SdrMeasureField*>( pField))
{
// Measure field
pInfo->ClearFieldColor();
}
- else if ( pField && dynamic_cast<const SvxExtTimeField*>( pField) != nullptr)
+ else if ( auto pTimeField = dynamic_cast<const SvxExtTimeField*>( pField) )
{
// Time field
pInfo->SetRepresentation(
- static_cast<const SvxExtTimeField*>( pField)->GetFormatted(
- *GetNumberFormatter(), LANGUAGE_SYSTEM) );
+ pTimeField->GetFormatted(*GetNumberFormatter(), LANGUAGE_SYSTEM) );
}
else
{
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 3094133cf81b..37a526d855e2 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1512,7 +1512,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool
// In this case we want to iterate over the group members.
aPos = GetCharRect().Center();
const SdrObject* pStartObj = pPV ? pPV->GetCurrentGroup() : nullptr;
- if ( pStartObj && dynamic_cast<const SdrObjGroup*>( pStartObj) != nullptr )
+ if ( dynamic_cast<const SdrObjGroup*>( pStartObj) )
pList = pStartObj->GetSubList();
}
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 87bd776c433b..86cabc326f5b 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -1260,7 +1260,7 @@ SwXMetaField::SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
TextRangeList_t const*const pPortions)
: SwXMetaField_Base(pDoc, pMeta, xParentText, pPortions)
{
- OSL_ENSURE(pMeta && dynamic_cast< ::sw::MetaField* >(pMeta),
+ OSL_ENSURE(dynamic_cast< ::sw::MetaField* >(pMeta),
"SwXMetaField created for wrong hint!");
}
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index c3130d840b52..21fda9474e88 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -785,9 +785,7 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() )
pCNd->EndOfSectionIndex() && !bHasFlysOrMarks )
{
SwViewShell *pVSh = CheckActionViewShell();
- SwCursorShell *pCursorSh = pVSh && dynamic_cast< const SwCursorShell *>( pVSh ) != nullptr
- ? static_cast < SwCursorShell * >( pVSh )
- : nullptr;
+ SwCursorShell *pCursorSh = dynamic_cast<SwCursorShell *>( pVSh );
if( pCursorSh &&
pCursorSh->GetCursor()->GetPoint()
->nNode.GetIndex() == nNodeIdx )
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 98ec36fe9534..d212c27bb204 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1083,11 +1083,10 @@ void MSWord_SdrAttrIter::OutEEField(const SfxPoolItem& rHt)
{
const SvxFieldItem &rField = static_cast<const SvxFieldItem &>(rHt);
const SvxFieldData *pField = rField.GetField();
- if (pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr)
+ if (auto pURL = dynamic_cast< const SvxURLField *>( pField ))
{
sal_uInt8 nOldTextTyp = m_rExport.m_nTextTyp;
m_rExport.m_nTextTyp = mnTyp;
- const SvxURLField *pURL = static_cast<const SvxURLField *>(pField);
m_rExport.AttrOutput().StartURL( pURL->GetURL(), pURL->GetTargetFrame() );
const OUString &rStr = pURL->GetRepresentation();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index ef4b2c21d6f9..dc57e91f6c5f 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2306,7 +2306,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
// is it a writer or sdr - textbox?
const SdrObject* pObj = static_cast<SdrObject const *>(aContent[ i ]);
sal_Int32 nCnt = 1;
- if (pObj && dynamic_cast< const SdrTextObj *>( pObj ) == nullptr )
+ if (dynamic_cast< const SdrTextObj *>( pObj ))
{
// find the "highest" SdrObject of this
const SwFrameFormat& rFormat = *::FindFrameFormat( pObj );
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 9f908a86ec0a..e1db0e0a33e8 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -421,7 +421,7 @@ void WW8Export::OutGrf(const ww8::Frame &rFrame)
bool bVert = false;
//The default for word in vertical text mode is to center,
//otherwise a sub/super script hack is employed
- if (m_pOutFormatNode && dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) != nullptr )
+ if (dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) )
{
const SwTextNode* pTextNd = static_cast<const SwTextNode*>(m_pOutFormatNode);
SwPosition aPos(*pTextNd);
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index d72c0cd37af9..3f82fa3963dc 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3241,10 +3241,8 @@ void AttributeOutputBase::TextField( const SwFormatField& rField )
void AttributeOutputBase::TextFlyContent( const SwFormatFlyCnt& rFlyContent )
{
- if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) != nullptr )
+ if ( auto pTextNd = dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) )
{
- const SwTextNode* pTextNd = static_cast<const SwTextNode*>(GetExport().m_pOutFormatNode);
-
Point aLayPos;
aLayPos = pTextNd->FindLayoutRect( false, &aLayPos ).Pos();
@@ -3745,7 +3743,7 @@ void WW8AttributeOutput::TableRowEnd(sal_uInt32 nDepth)
void AttributeOutputBase::FormatPageDescription( const SwFormatPageDesc& rPageDesc )
{
- if ( GetExport().m_bStyDef && GetExport().m_pOutFormatNode && dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) != nullptr )
+ if ( GetExport().m_bStyDef && dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) )
{
const SwTextFormatColl* pC = static_cast<const SwTextFormatColl*>(GetExport().m_pOutFormatNode);
if ( (SfxItemState::SET != pC->GetItemState( RES_BREAK, false ) ) && rPageDesc.KnowsPageDesc() )
@@ -4656,14 +4654,12 @@ void AttributeOutputBase::ParaLineSpacing( const SvxLineSpacingItem& rSpacing )
sal_uInt16 nScript =
i18n::ScriptType::LATIN;
const SwAttrSet *pSet = nullptr;
- if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwFormat *>( GetExport().m_pOutFormatNode ) != nullptr )
+ if ( auto pFormat = dynamic_cast< const SwFormat *>( GetExport().m_pOutFormatNode ) )
{
- const SwFormat *pFormat = static_cast<const SwFormat*>( GetExport().m_pOutFormatNode );
pSet = &pFormat->GetAttrSet();
}
- else if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwTextNode *>( GetExport().m_pOutFormatNode ) != nullptr )
+ else if ( auto pNd = dynamic_cast< const SwTextNode *>( GetExport().m_pOutFormatNode ) )
{
- const SwTextNode* pNd = static_cast<const SwTextNode*>(GetExport().m_pOutFormatNode);
pSet = &pNd->GetSwAttrSet();
nScript = g_pBreakIt->GetBreakIter()->getScriptType(pNd->GetText(), 0);
}
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index 10ad0ef5d8fa..e23635f8485e 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -148,7 +148,7 @@ void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(GetUsrPref(
nDest == SvViewOpt::DestWeb
|| (nDest != SvViewOpt::DestText
- && pCurrView && dynamic_cast< const SwWebView *>( pCurrView ) != nullptr) ));
+ && dynamic_cast< const SwWebView *>( pCurrView )) ));
// with Uno, only sdbcx::View, but not the Module should be changed
bool bViewOnly = SvViewOpt::DestViewOnly == nDest;
diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
index b9a5ea30a518..98c5fbf74835 100644
--- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
@@ -732,8 +732,8 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
if ( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- if( pObj && dynamic_cast< const SdrTextObj *>( pObj ) != nullptr )
- pCurrentTextObj = static_cast<SdrTextObj*>(pObj);
+ if( auto pSdrTextObj = dynamic_cast<SdrTextObj *>( pObj ) )
+ pCurrentTextObj = pSdrTextObj;
}
// at first fill the list of drawing objects
if(!m_pSpellState->m_bTextObjectsCollected )
diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx
index 95617aac1b0a..e0f25330ddd4 100644
--- a/sw/source/uibase/dialog/regionsw.cxx
+++ b/sw/source/uibase/dialog/regionsw.cxx
@@ -216,9 +216,9 @@ void SwBaseShell::EditRegionDialog(SfxRequest const & rReq)
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
ScopedVclPtr<AbstractEditRegionDlg> pEditRegionDlg(pFact->CreateEditRegionDlg(pParentWin, rWrtShell));
- if(pItem && dynamic_cast< const SfxStringItem *>( pItem ) != nullptr)
+ if(auto pStringItem = dynamic_cast< const SfxStringItem *>( pItem ))
{
- pEditRegionDlg->SelectSection(static_cast<const SfxStringItem*>(pItem)->GetValue());
+ pEditRegionDlg->SelectSection(pStringItem->GetValue());
}
pEditRegionDlg->Execute();
}
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index a9a5fa476219..07b93273c1a7 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1304,7 +1304,7 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData,
// drop as if from external
const SwFrameFormat* pSwFrameFormat = rSh.GetFormatFromObj(*pPt);
- if(pSwFrameFormat && dynamic_cast< const SwDrawFrameFormat* >(pSwFrameFormat) != nullptr)
+ if(dynamic_cast< const SwDrawFrameFormat* >(pSwFrameFormat))
{
bPrivateDrop = false;
bNeedToSelectBeforePaste = true;
diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx
index a9f5cc718fa8..ad9351aaae6f 100644
--- a/sw/source/uibase/ribbar/concustomshape.cxx
+++ b/sw/source/uibase/ribbar/concustomshape.cxx
@@ -178,7 +178,7 @@ void ConstCustomShape::CreateDefaultObject()
if ( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- if ( pObj && dynamic_cast< const SdrObjCustomShape *>( pObj ) != nullptr )
+ if ( dynamic_cast< const SdrObjCustomShape *>( pObj ) )
SetAttributes( pObj );
}
}
diff --git a/sw/source/uibase/shells/mediash.cxx b/sw/source/uibase/shells/mediash.cxx
index d28f804adccf..fba429fba732 100644
--- a/sw/source/uibase/shells/mediash.cxx
+++ b/sw/source/uibase/shells/mediash.cxx
@@ -121,7 +121,7 @@ void SwMediaShell::ExecMedia(SfxRequest const &rReq)
{
SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< const SdrMediaObj *>( pObj ) != nullptr )
+ if( dynamic_cast< const SdrMediaObj *>( pObj ) )
{
static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
static_cast< const ::avmedia::MediaItem& >( *pItem ) );
@@ -164,7 +164,7 @@ void SwMediaShell::GetMediaState(SfxItemSet &rSet)
{
SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< const SdrMediaObj *>( pObj ) != nullptr )
+ if( dynamic_cast< const SdrMediaObj *>( pObj ) )
{
::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
diff --git a/sw/source/uibase/sidebar/PageFooterPanel.cxx b/sw/source/uibase/sidebar/PageFooterPanel.cxx
index 308c35b59421..e600a80b0ef5 100644
--- a/sw/source/uibase/sidebar/PageFooterPanel.cxx
+++ b/sw/source/uibase/sidebar/PageFooterPanel.cxx
@@ -177,7 +177,7 @@ void PageFooterPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_FOOTER:
{
if(eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast<const SfxBoolItem*>( pState) != nullptr )
+ dynamic_cast<const SfxBoolItem*>( pState) )
{
mpFooterItem.reset( static_cast<SfxBoolItem*>(pState->Clone()) );
mpFooterToggle->Check(mpFooterItem->GetValue());
@@ -188,7 +188,7 @@ void PageFooterPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_FOOTER_LRMARGIN:
{
if(eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast<const SvxLongLRSpaceItem*>( pState) != nullptr )
+ dynamic_cast<const SvxLongLRSpaceItem*>( pState) )
{
mpFooterLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) );
UpdateMarginControl();
@@ -198,7 +198,7 @@ void PageFooterPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_FOOTER_SPACING:
{
if(eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast<const SvxLongULSpaceItem*>( pState) != nullptr )
+ dynamic_cast<const SvxLongULSpaceItem*>( pState) )
{
mpFooterSpacingItem.reset(static_cast<SvxLongULSpaceItem*>(pState->Clone()) );
UpdateSpacingControl();
@@ -208,7 +208,7 @@ void PageFooterPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_FOOTER_LAYOUT:
{
if(eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast<const SfxInt16Item*>( pState) != nullptr )
+ dynamic_cast<const SfxInt16Item*>( pState) )
{
mpFooterLayoutItem.reset(static_cast<SfxInt16Item*>(pState->Clone()) );
UpdateLayoutControl();
diff --git a/sw/source/uibase/sidebar/PageFormatPanel.cxx b/sw/source/uibase/sidebar/PageFormatPanel.cxx
index 25c7018edeb4..e0d6b385acd7 100644
--- a/sw/source/uibase/sidebar/PageFormatPanel.cxx
+++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx
@@ -178,7 +178,7 @@ void PageFormatPanel::NotifyItemUpdate(
case SID_ATTR_PAGE:
{
if ( eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast< const SvxPageItem *>( pState ) != nullptr )
+ dynamic_cast< const SvxPageItem *>( pState ) )
{
mpPageItem.reset( static_cast<SvxPageItem*>(pState->Clone()) );
if ( mpPageItem->IsLandscape() )
@@ -191,7 +191,7 @@ void PageFormatPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_LRSPACE:
{
if ( eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast< const SvxLongLRSpaceItem *>( pState ) != nullptr )
+ dynamic_cast< const SvxLongLRSpaceItem *>( pState ) )
{
mpPageLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) );
UpdateMarginBox();
@@ -201,7 +201,7 @@ void PageFormatPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_ULSPACE:
{
if ( eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast< const SvxLongULSpaceItem *>( pState ) != nullptr )
+ dynamic_cast< const SvxLongULSpaceItem *>( pState ) )
{
mpPageULMarginItem.reset( static_cast<SvxLongULSpaceItem*>(pState->Clone()) );
UpdateMarginBox();
diff --git a/sw/source/uibase/sidebar/PageHeaderPanel.cxx b/sw/source/uibase/sidebar/PageHeaderPanel.cxx
index 0421b18e6200..b5206aeec426 100644
--- a/sw/source/uibase/sidebar/PageHeaderPanel.cxx
+++ b/sw/source/uibase/sidebar/PageHeaderPanel.cxx
@@ -180,7 +180,7 @@ void PageHeaderPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_HEADER:
{
if(eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast<const SfxBoolItem*>( pState) != nullptr )
+ dynamic_cast<const SfxBoolItem*>( pState) )
{
mpHeaderItem.reset( static_cast<SfxBoolItem*>(pState->Clone()) );
mpHeaderToggle->Check(mpHeaderItem->GetValue());
@@ -191,7 +191,7 @@ void PageHeaderPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_HEADER_LRMARGIN:
{
if(eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast<const SvxLongLRSpaceItem*>( pState) != nullptr )
+ dynamic_cast<const SvxLongLRSpaceItem*>( pState) )
{
mpHeaderLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) );
UpdateMarginControl();
@@ -201,7 +201,7 @@ void PageHeaderPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_HEADER_SPACING:
{
if(eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast<const SvxLongULSpaceItem*>( pState) != nullptr )
+ dynamic_cast<const SvxLongULSpaceItem*>( pState) )
{
mpHeaderSpacingItem.reset(static_cast<SvxLongULSpaceItem*>(pState->Clone()) );
UpdateSpacingControl();
@@ -211,7 +211,7 @@ void PageHeaderPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_HEADER_LAYOUT:
{
if(eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast<const SfxInt16Item*>( pState) != nullptr )
+ dynamic_cast<const SfxInt16Item*>( pState) )
{
mpHeaderLayoutItem.reset(static_cast<SfxInt16Item*>(pState->Clone()) );
UpdateLayoutControl();
diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx
index 1e13e367c272..94a5d99c46cc 100644
--- a/sw/source/uibase/sidebar/PageStylesPanel.cxx
+++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx
@@ -331,7 +331,7 @@ void PageStylesPanel::NotifyItemUpdate(
case SID_ATTR_PAGE_COLUMN:
{
if ( eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast< const SfxInt16Item *>( pState ) != nullptr )
+ dynamic_cast< const SfxInt16Item *>( pState ) )
{
mpPageColumnItem.reset( static_cast<SfxInt16Item*>(pState->Clone()) );
if(mpPageColumnItem->GetValue() <= 5)
@@ -352,7 +352,7 @@ void PageStylesPanel::NotifyItemUpdate(
case SID_ATTR_PAGE:
{
if( eState >= SfxItemState::DEFAULT &&
- pState && dynamic_cast< const SvxPageItem*>( pState ) != nullptr )
+ dynamic_cast< const SvxPageItem*>( pState ) )
{
mpPageItem.reset( static_cast<SvxPageItem*>(pState->Clone()) );
SvxNumType eNumType = mpPageItem->GetNumType();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 328f3c209502..56ca22fe98d0 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2446,14 +2446,13 @@ SwDoc * SwXTextDocument::GetRenderDoc(
// the view shell should be SwView for documents PDF export.
// for the page preview no selection should be possible
// (the export dialog does not allow for this option)
- if (rpView && dynamic_cast< const SwView *>( rpView ) != nullptr)
+ if (auto pSwView = dynamic_cast<SwView *>( rpView ))
{
if (!m_pRenderData)
{
OSL_FAIL("GetRenderDoc: no renderdata");
return nullptr;
}
- SwView *const pSwView(static_cast<SwView *>(rpView));
SfxObjectShellLock xDocSh(m_pRenderData->GetTempDocShell());
if (!xDocSh.Is())
{
More information about the Libreoffice-commits
mailing list