summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-03 17:02:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-05 07:53:31 +0100
commit51ee91a3ca869be23153a235cbf33d4d20267fce (patch)
treed55ad43d12f82b2960d893a016f67e4f99ac5dd3
parent90db24c33060bcb6db6ef900981c4379cd3074af (diff)
TypedWhichId in sw(1)
Change-Id: If9330b2ea7e40f4775b1edd9611d35c6ddf31a00 Reviewed-on: https://gerrit.libreoffice.org/49185 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/charfmt.hxx4
-rw-r--r--sw/inc/doc.hxx4
-rw-r--r--sw/inc/editsh.hxx4
-rw-r--r--sw/inc/format.hxx4
-rw-r--r--sw/source/core/doc/DocumentLayoutManager.cxx2
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx2
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx3
-rw-r--r--sw/source/core/doc/docdesc.cxx8
-rw-r--r--sw/source/core/doc/docfmt.cxx2
-rw-r--r--sw/source/core/doc/fmtcol.cxx2
-rw-r--r--sw/source/core/docnode/section.cxx2
-rw-r--r--sw/source/core/edit/edattr.cxx3
-rw-r--r--sw/source/core/layout/fly.cxx3
-rw-r--r--sw/source/core/layout/pagechg.cxx3
-rw-r--r--sw/source/core/layout/wsfrm.cxx6
-rw-r--r--sw/source/core/table/swtable.cxx4
-rw-r--r--sw/source/core/text/itrpaint.cxx3
-rw-r--r--sw/source/core/text/porlay.cxx3
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx3
-rw-r--r--sw/source/core/unocore/unoevent.cxx2
-rw-r--r--sw/source/filter/html/htmlgrin.cxx2
-rw-r--r--sw/source/filter/html/htmltabw.cxx2
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx4
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx4
-rw-r--r--sw/source/uibase/app/appopt.cxx15
-rw-r--r--sw/source/uibase/app/docshini.cxx9
-rw-r--r--sw/source/uibase/shells/drwbassh.cxx7
-rw-r--r--sw/source/uibase/uiview/viewstat.cxx19
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx11
29 files changed, 70 insertions, 70 deletions
diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx
index c6e61d2de1bc..b84d31c780bc 100644
--- a/sw/inc/charfmt.hxx
+++ b/sw/inc/charfmt.hxx
@@ -44,6 +44,10 @@ namespace CharFormat
{
SW_DLLPUBLIC extern const SfxItemSet* GetItemSet( const SfxPoolItem& rAttr );
extern const SfxPoolItem* GetItem( const SwTextAttr& rAttr, sal_uInt16 nWhich );
+ template<class T> const T* GetItem( const SwTextAttr& rAttr, TypedWhichId<T> nWhich )
+ {
+ return static_cast<const T*>(GetItem(rAttr, sal_uInt16(nWhich)));
+ }
extern bool IsItemIncluded( const sal_uInt16 nWhich, const SwTextAttr *pAttr );
}
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 903cd5b910de..9389604c94aa 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -747,6 +747,10 @@ public:
// Query default attribute in this document.
const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
+ template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
+ }
// Do not expand text attributes.
bool DontExpandFormat( const SwPosition& rPos, bool bFlag = true );
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index d290fd814130..2fd055f6c87c 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -280,6 +280,10 @@ public:
/// Query default attribute of document.
const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
+ template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
+ }
void ResetAttr( const std::set<sal_uInt16> &attrs = std::set<sal_uInt16>(), SwPaM* pCursor = nullptr );
void GCAttr();
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 071d22a2257c..19f8fa2aac6d 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -91,6 +91,10 @@ public:
/// If bInParents is FALSE, search only in this format for attribute.
const SfxPoolItem& GetFormatAttr( sal_uInt16 nWhich,
bool bInParents = true ) const;
+ template<class T> const T& GetFormatAttr( TypedWhichId<T> nWhich, bool bInParents = true ) const
+ {
+ return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
+ }
SfxItemState GetItemState( sal_uInt16 nWhich, bool bSrchInParent = true,
const SfxPoolItem **ppItem = nullptr ) const;
SfxItemState GetBackgroundState(SvxBrushItem &rItem) const;
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx
index dc1cb1637e92..220e5e804ff6 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -280,7 +280,7 @@ void DocumentLayoutManager::DelLayoutFormat( SwFrameFormat *pFormat )
if( pCntIdx )
{
SwNode *pNode = &pCntIdx->GetNode();
- const_cast<SwFormatContent&>(static_cast<const SwFormatContent&>(pFormat->GetFormatAttr( RES_CNTNT ))).SetNewContentIdx( nullptr );
+ const_cast<SwFormatContent&>(pFormat->GetFormatAttr( RES_CNTNT )).SetNewContentIdx( nullptr );
m_rDoc.getIDocumentContentOperations().DeleteSection( pNode );
}
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 130e30424356..367ca13bc80c 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -201,7 +201,7 @@ namespace
SvxNumberFormat::LABEL_WIDTH_AND_POSITION &&
( rNFormat.GetAbsLSpace() || rNFormat.GetFirstLineOffset() ) )
{
- SvxLRSpaceItem aLR( static_cast<const SvxLRSpaceItem&>(pColl->GetFormatAttr( RES_LR_SPACE )) );
+ SvxLRSpaceItem aLR( pColl->GetFormatAttr( RES_LR_SPACE ) );
aLR.SetTextFirstLineOfstValue( rNFormat.GetFirstLineOffset() );
aLR.SetTextLeft( rNFormat.GetAbsLSpace() );
pColl->SetFormatAttr( aLR );
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index ac12245bfd95..c8cb14436e2e 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -612,8 +612,7 @@ static OUString lcl_dbg_out(const SwNode & rNode)
}
const SwNumRuleItem & rItem =
- static_cast<const SwNumRuleItem &>
- (pColl->GetFormatAttr(RES_PARATR_NUMRULE));
+ pColl->GetFormatAttr(RES_PARATR_NUMRULE);
const OUString& sNumruleName = rItem.GetValue();
if (!sNumruleName.isEmpty())
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 861ad72a6073..25ad91c0fba2 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -892,8 +892,7 @@ void SwDoc::SetDefaultPageMode(bool bSquaredPageMode)
if( !bSquaredPageMode == !IsSquaredPageMode() )
return;
- const SwTextGridItem& rGrid =
- static_cast<const SwTextGridItem&>(GetDefault( RES_TEXTGRID ));
+ const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
SwTextGridItem aNewGrid = rGrid;
aNewGrid.SetSquaredMode(bSquaredPageMode);
aNewGrid.Init();
@@ -906,7 +905,7 @@ void SwDoc::SetDefaultPageMode(bool bSquaredPageMode)
SwFrameFormat& rMaster = rDesc.GetMaster();
SwFrameFormat& rLeft = rDesc.GetLeft();
- SwTextGridItem aGrid(static_cast<const SwTextGridItem&>(rMaster.GetFormatAttr(RES_TEXTGRID)));
+ SwTextGridItem aGrid(rMaster.GetFormatAttr(RES_TEXTGRID));
aGrid.SwitchPaperMode( bSquaredPageMode );
rMaster.SetFormatAttr(aGrid);
rLeft.SetFormatAttr(aGrid);
@@ -915,8 +914,7 @@ void SwDoc::SetDefaultPageMode(bool bSquaredPageMode)
bool SwDoc::IsSquaredPageMode() const
{
- const SwTextGridItem& rGrid =
- static_cast<const SwTextGridItem&>(GetDefault( RES_TEXTGRID ));
+ const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
return rGrid.IsSquaredMode();
}
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 85fb36c27b8f..ccc273174886 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1632,7 +1632,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus )
GetIDocumentUndoRedo().AppendUndo( pUndo );
}
- const SvxTabStopItem& rTabItem = static_cast<const SvxTabStopItem&>(GetDefault( RES_PARATR_TABSTOP ));
+ const SvxTabStopItem& rTabItem = GetDefault( RES_PARATR_TABSTOP );
const sal_Int32 nDefDist = rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134;
const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
SwNodeIndex aIdx( rStt.nNode );
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 5b6ed7522253..3cfa19ec5ecb 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -582,7 +582,7 @@ void SwTextFormatColl::SetAttrOutlineLevel( int nLevel)
int SwTextFormatColl::GetAttrOutlineLevel() const
{
- return static_cast<const SfxUInt16Item &>(GetFormatAttr(RES_PARATR_OUTLINELEVEL)).GetValue();
+ return GetFormatAttr(RES_PARATR_OUTLINELEVEL).GetValue();
}
int SwTextFormatColl::GetAssignedOutlineStyleLevel() const
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 1930db0fb453..8eecfc5ac4c7 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -840,7 +840,7 @@ bool SwSectionFormat::GetInfo( SfxPoolItem& rInfo ) const
switch( rInfo.Which() )
{
case RES_FINDNEARESTNODE:
- if( static_cast<const SwFormatPageDesc&>(GetFormatAttr( RES_PAGEDESC )).GetPageDesc() )
+ if( GetFormatAttr( RES_PAGEDESC ).GetPageDesc() )
{
const SwSectionNode* pNd = GetSectionNode();
if( pNd )
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 5e867d92d919..f07debf78c41 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -474,8 +474,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
{
bool bRet = true;
- const SvxTabStopItem& rTabItem = static_cast<const SvxTabStopItem&>(GetDoc()->
- GetDefault( RES_PARATR_TABSTOP ));
+ const SvxTabStopItem& rTabItem = GetDoc()->GetDefault( RES_PARATR_TABSTOP );
sal_uInt16 nDefDist = static_cast<sal_uInt16>(rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134);
if( !nDefDist )
return false;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 3f1d2e522b57..41f8479a0018 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -90,8 +90,7 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch
// Size setting: Fixed size is always the width
const SwFormatFrameSize &rFrameSize = pFormat->GetFrameSize();
- const SvxFrameDirection nDir =
- static_cast<const SvxFrameDirectionItem&>(pFormat->GetFormatAttr( RES_FRAMEDIR )).GetValue();
+ const SvxFrameDirection nDir = pFormat->GetFormatAttr( RES_FRAMEDIR ).GetValue();
if( SvxFrameDirection::Environment == nDir )
{
mbDerivedVert = true;
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index b6bbc0c90ff6..6cb4f071d8e6 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -325,8 +325,7 @@ void SwPageFrame::CheckGrid( bool bInvalidate )
void SwPageFrame::CheckDirection( bool bVert )
{
- SvxFrameDirection nDir =
- static_cast<const SvxFrameDirectionItem&>(GetFormat()->GetFormatAttr( RES_FRAMEDIR )).GetValue();
+ SvxFrameDirection nDir = GetFormat()->GetFormatAttr( RES_FRAMEDIR ).GetValue();
if( bVert )
{
if( SvxFrameDirection::Horizontal_LR_TB == nDir || SvxFrameDirection::Horizontal_RL_TB == nDir )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 684e125de95b..4e2eb99438ce 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -399,7 +399,7 @@ void SwSectionFrame::CheckDirection( bool bVert )
{
const SwViewShell *pSh = getRootFrame()->GetCurrShell();
const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
- CheckDir(static_cast<const SvxFrameDirectionItem&>(pFormat->GetFormatAttr(RES_FRAMEDIR)).GetValue(),
+ CheckDir(pFormat->GetFormatAttr(RES_FRAMEDIR).GetValue(),
bVert, true, bBrowseMode );
}
else
@@ -413,7 +413,7 @@ void SwFlyFrame::CheckDirection( bool bVert )
{
const SwViewShell *pSh = getRootFrame()->GetCurrShell();
const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
- CheckDir(static_cast<const SvxFrameDirectionItem&>(pFormat->GetFormatAttr(RES_FRAMEDIR)).GetValue(),
+ CheckDir(pFormat->GetFormatAttr(RES_FRAMEDIR).GetValue(),
bVert, false, bBrowseMode );
}
else
@@ -427,7 +427,7 @@ void SwTabFrame::CheckDirection( bool bVert )
{
const SwViewShell *pSh = getRootFrame()->GetCurrShell();
const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
- CheckDir(static_cast<const SvxFrameDirectionItem&>(pFormat->GetFormatAttr(RES_FRAMEDIR)).GetValue(),
+ CheckDir(pFormat->GetFormatAttr(RES_FRAMEDIR).GetValue(),
bVert, true, bBrowseMode );
}
else
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 7e8bed4e28ce..2b69e6fe6302 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1901,8 +1901,8 @@ bool SwTable::GetInfo( SfxPoolItem& rInfo ) const
break;
}
case RES_FINDNEARESTNODE:
- if( GetFrameFormat() && static_cast<const SwFormatPageDesc&>(GetFrameFormat()->GetFormatAttr(
- RES_PAGEDESC )).GetPageDesc() &&
+ if( GetFrameFormat() &&
+ GetFrameFormat()->GetFormatAttr( RES_PAGEDESC ).GetPageDesc() &&
!m_TabSortContentBoxes.empty() &&
m_TabSortContentBoxes[0]->GetSttNd()->GetNodes().IsDocNodes() )
static_cast<SwFindNearestNode&>(rInfo).CheckNode( *
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 81697a3ab425..8df27339a3e9 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -521,8 +521,7 @@ void SwTextPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
{
SwTextAttr* const pTextAttr = m_pHints->Get( nTmp );
- const SvxUnderlineItem* pItem =
- static_cast<const SvxUnderlineItem*>(CharFormat::GetItem( *pTextAttr, RES_CHRATR_UNDERLINE ));
+ const SvxUnderlineItem* pItem = CharFormat::GetItem( *pTextAttr, RES_CHRATR_UNDERLINE );
if ( pItem )
{
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index cb134beb479a..ceeaef8bdf68 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2125,8 +2125,7 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTextNode& rNode, MultiSelect
for( size_t nTmp = 0; nTmp < pHints->Count(); ++nTmp )
{
const SwTextAttr* pTextAttr = pHints->Get( nTmp );
- const SvxCharHiddenItem* pHiddenItem =
- static_cast<const SvxCharHiddenItem*>( CharFormat::GetItem( *pTextAttr, RES_CHRATR_HIDDEN ) );
+ const SvxCharHiddenItem* pHiddenItem = CharFormat::GetItem( *pTextAttr, RES_CHRATR_HIDDEN );
if( pHiddenItem )
{
const sal_Int32 nSt = pTextAttr->GetStart();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 83b68aae6f0b..67c8a8975485 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3116,8 +3116,7 @@ bool SwTextNode::GetExpandText( SwTextNode& rDestNd, const SwIndex* pDestIdx,
RES_TXTATR_AUTOFMT == nWhich ))
{
const SvxFontItem* const pFont =
- static_cast<const SvxFontItem*>(
- CharFormat::GetItem( *pHt, RES_CHRATR_FONT ));
+ CharFormat::GetItem( *pHt, RES_CHRATR_FONT );
if ( pFont && RTL_TEXTENCODING_SYMBOL == pFont->GetCharSet() )
{
// attribute in area => copy
diff --git a/sw/source/core/unocore/unoevent.cxx b/sw/source/core/unocore/unoevent.cxx
index 111db21ae357..86128e2a8d4c 100644
--- a/sw/source/core/unocore/unoevent.cxx
+++ b/sw/source/core/unocore/unoevent.cxx
@@ -188,7 +188,7 @@ void SwFrameEventDescriptor::setMacroItem(const SvxMacroItem& rItem)
const SvxMacroItem& SwFrameEventDescriptor::getMacroItem()
{
- return static_cast<const SvxMacroItem&>(rFrame.GetFrameFormat()->GetFormatAttr(RES_FRMMACRO));
+ return rFrame.GetFrameFormat()->GetFormatAttr(RES_FRMMACRO);
}
sal_uInt16 SwFrameEventDescriptor::getMacroItemWhich() const
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 44adccdff122..b0d94be7609d 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -527,7 +527,7 @@ IMAGE_SETEVENT:
{
const SvxColorItem& rColorItem = m_xAttrTab->pFontColor ?
static_cast<const SvxColorItem &>(m_xAttrTab->pFontColor->GetItem()) :
- static_cast<const SvxColorItem &>(m_xDoc->GetDefault(RES_CHRATR_COLOR));
+ m_xDoc->GetDefault(RES_CHRATR_COLOR);
aHBorderLine.SetColor( rColorItem.GetValue() );
aVBorderLine.SetColor( aHBorderLine.GetColor() );
}
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index e4a745f1ca35..bc79a91cf9cf 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -206,7 +206,7 @@ static bool lcl_TableBox_HasTabBorders( const SwTableBox* pBox, bool *pBorders )
else
{
const SvxBoxItem& rBoxItem =
- static_cast<const SvxBoxItem&>(pBox->GetFrameFormat()->GetFormatAttr( RES_BOX ));
+ pBox->GetFrameFormat()->GetFormatAttr( RES_BOX );
*pBorders = rBoxItem.GetTop() || rBoxItem.GetBottom() ||
rBoxItem.GetLeft() || rBoxItem.GetRight();
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index 5332a1c307b9..c92803aa5b30 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -83,7 +83,7 @@ sal_uInt32 SwWriteTable::GetBoxWidth( const SwTableBox *pBox )
{
const SwFrameFormat *pFormat = pBox->GetFrameFormat();
const SwFormatFrameSize& aFrameSize=
- static_cast<const SwFormatFrameSize&>(pFormat->GetFormatAttr( RES_FRM_SIZE ));
+ pFormat->GetFormatAttr( RES_FRM_SIZE );
return sal::static_int_cast<sal_uInt32>(aFrameSize.GetSize().Width());
}
@@ -228,7 +228,7 @@ sal_uInt16 SwWriteTable::MergeBoxBorders( const SwTableBox *pBox,
sal_uInt16 nBorderMask = 0;
const SwFrameFormat *pFrameFormat = pBox->GetFrameFormat();
- const SvxBoxItem& rBoxItem = static_cast<const SvxBoxItem&>(pFrameFormat->GetFormatAttr( RES_BOX ));
+ const SvxBoxItem& rBoxItem = pFrameFormat->GetFormatAttr( RES_BOX );
if( rBoxItem.GetTop() )
{
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index e569ec0a0904..cd8930647624 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2162,7 +2162,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
sStr = FieldString(eCode);
{
- const SwFormatCol& rCol = static_cast<const SwFormatCol&>( rSect.GetFormat()->GetFormatAttr( RES_COL ) );
+ const SwFormatCol& rCol = rSect.GetFormat()->GetFormatAttr( RES_COL );
const SwColumns& rColumns = rCol.GetColumns();
sal_Int32 nCol = rColumns.size();
@@ -2494,7 +2494,7 @@ void AttributeOutputBase::EndTOX( const SwSection& rSect,bool bCareEnd )
if ( pTOX->GetType() == TOX_INDEX && GetExport().AddSectionBreaksForTOX() )
{
- const SwFormatCol& rCol = static_cast<const SwFormatCol&>( rSect.GetFormat()->GetFormatAttr( RES_COL ) );
+ const SwFormatCol& rCol = rSect.GetFormat()->GetFormatAttr( RES_COL );
const SwColumns& rColumns = rCol.GetColumns();
sal_Int32 nCol = rColumns.size();
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index fff3d7e941f3..55f6643174bf 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -134,16 +134,16 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
- std::unique_ptr<SfxPoolItem> pNewItem( static_cast<const SvxLanguageItem&>(
- rWrtShell.GetDefault(RES_CHRATR_LANGUAGE)).CloneSetWhich(SID_ATTR_LANGUAGE) );
+ std::unique_ptr<SfxPoolItem> pNewItem(
+ rWrtShell.GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE) );
pRet->Put(*pNewItem);
- pNewItem.reset(static_cast<const SvxLanguageItem&>(
- rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE)).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE));
+ pNewItem.reset(
+ rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE));
pRet->Put(*pNewItem);
- pNewItem.reset(static_cast<const SvxLanguageItem&>(
- rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE)).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE));
+ pNewItem.reset(
+ rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE));
pRet->Put(*pNewItem);
}
else
@@ -193,8 +193,7 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
if(pAppView)
{
const SvxTabStopItem& rDefTabs =
- static_cast<const SvxTabStopItem&>(pAppView->GetWrtShell().
- GetDefault(RES_PARATR_TABSTOP));
+ pAppView->GetWrtShell().GetDefault(RES_PARATR_TABSTOP);
pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, static_cast<sal_uInt16>(::GetTabDist(rDefTabs))));
}
else
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 8d6c86071324..42dcb2933bef 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -252,20 +252,20 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
sal_uInt16 nFontWhich = RES_CHRATR_FONT;
sal_uInt16 nFontHeightWhich = RES_CHRATR_FONTSIZE;
- LanguageType eLanguage = static_cast<const SvxLanguageItem&>(m_xDoc->GetDefault( RES_CHRATR_LANGUAGE )).GetLanguage();
+ LanguageType eLanguage = m_xDoc->GetDefault( RES_CHRATR_LANGUAGE ).GetLanguage();
for(sal_uInt8 nIdx = 0; nIdx < 24; nIdx += 2)
{
if(nIdx == 8)
{
nFontWhich = RES_CHRATR_CJK_FONT;
nFontHeightWhich = RES_CHRATR_CJK_FONTSIZE;
- eLanguage = static_cast<const SvxLanguageItem&>(m_xDoc->GetDefault( RES_CHRATR_CJK_LANGUAGE )).GetLanguage();
+ eLanguage = m_xDoc->GetDefault( RES_CHRATR_CJK_LANGUAGE ).GetLanguage();
}
else if(nIdx == 16)
{
nFontWhich = RES_CHRATR_CTL_FONT;
nFontHeightWhich = RES_CHRATR_CTL_FONTSIZE;
- eLanguage = static_cast<const SvxLanguageItem&>(m_xDoc->GetDefault( RES_CHRATR_CTL_LANGUAGE )).GetLanguage();
+ eLanguage = m_xDoc->GetDefault( RES_CHRATR_CTL_LANGUAGE ).GetLanguage();
}
SwTextFormatColl *pColl = nullptr;
if(!pStdFont->IsFontDefault(aFontIdPoolId[nIdx]))
@@ -672,8 +672,7 @@ void SwDocShell::SubInitNew()
if(!bWeb)
{
- SvxHyphenZoneItem aHyp( static_cast<const SvxHyphenZoneItem&>( m_xDoc->GetDefault(
- RES_PARATR_HYPHENZONE) ) );
+ SvxHyphenZoneItem aHyp( m_xDoc->GetDefault(RES_PARATR_HYPHENZONE) );
aHyp.GetMinLead() = static_cast< sal_uInt8 >(aLinguOpt.nHyphMinLeading);
aHyp.GetMinTrail() = static_cast< sal_uInt8 >(aLinguOpt.nHyphMinTrailing);
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index e29bd792333d..a084667ce87e 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -61,6 +61,7 @@
#include <com/sun/star/text/RelOrientation.hpp>
#include <IDocumentDrawModelAccess.hxx>
#include <memory>
+#include <fmtfollowtextflow.hxx>
using namespace ::com::sun::star;
@@ -226,12 +227,12 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
aSet.Put( pFrameFormat->GetFormatAttr(RES_FOLLOW_TEXT_FLOW) );
- SwFormatVertOrient aVOrient(static_cast<const SwFormatVertOrient&>(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT)));
+ SwFormatVertOrient aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, aVOrient.GetVertOrient()));
aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, aVOrient.GetRelationOrient() ));
aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, aVOrient.GetPos()));
- SwFormatHoriOrient aHOrient(static_cast<const SwFormatHoriOrient&>(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT)));
+ SwFormatHoriOrient aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, aHOrient.GetHoriOrient()));
aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, aHOrient.GetRelationOrient() ));
aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, aHOrient.IsPosToggle()));
@@ -449,7 +450,7 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
pSh->StartAction();
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
- SwFormatVertOrient aVOrient(static_cast<const SwFormatVertOrient&>(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT)));
+ SwFormatVertOrient aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
aVOrient.SetVertOrient( nVertOrient );
pFrameFormat->SetFormatAttr(aVOrient);
pSh->EndAction();
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index 9ec0f9b96042..9d9dd105be6d 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -184,8 +184,7 @@ void SwView::GetState(SfxItemSet &rSet)
const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
const SwPageDesc& rDesc = m_pWrtShell->GetPageDesc( nCurIdx );
const SwFrameFormat& rMaster = rDesc.GetMaster();
- const SvxBrushItem& rBrush = static_cast<const SvxBrushItem&>(
- rMaster.GetFormatAttr(RES_BACKGROUND));
+ const SvxBrushItem& rBrush = rMaster.GetFormatAttr(RES_BACKGROUND);
rSet.Put(rBrush);
}
break;
@@ -240,31 +239,29 @@ void SwView::GetState(SfxItemSet &rSet)
case RES_PARATR_TABSTOP:
case SID_ATTR_DEFTABSTOP:
{
- const SvxTabStopItem& rDefTabs =
- static_cast<const SvxTabStopItem&>(m_pWrtShell->
- GetDefault(RES_PARATR_TABSTOP));
+ const SvxTabStopItem& rDefTabs = m_pWrtShell->GetDefault(RES_PARATR_TABSTOP);
rSet.Put( SfxUInt16Item( nWhich,
static_cast<sal_uInt16>(::GetTabDist(rDefTabs))));
}
break;
case SID_ATTR_LANGUAGE:
{
- std::unique_ptr<SfxPoolItem> pNewItem(static_cast<const SvxLanguageItem&>(
- m_pWrtShell->GetDefault(RES_CHRATR_LANGUAGE)).CloneSetWhich(SID_ATTR_LANGUAGE));
+ std::unique_ptr<SfxPoolItem> pNewItem(
+ m_pWrtShell->GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE));
rSet.Put(*pNewItem);
}
break;
case RES_CHRATR_CJK_LANGUAGE:
{
- std::unique_ptr<SfxPoolItem> pNewItem(static_cast<const SvxLanguageItem&>(
- m_pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE)).CloneSetWhich(RES_CHRATR_CJK_LANGUAGE));
+ std::unique_ptr<SfxPoolItem> pNewItem(
+ m_pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(RES_CHRATR_CJK_LANGUAGE));
rSet.Put(*pNewItem);
}
break;
case RES_CHRATR_CTL_LANGUAGE:
{
- std::unique_ptr<SfxPoolItem> pNewItem(static_cast<const SvxLanguageItem&>(
- m_pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE)).CloneSetWhich(RES_CHRATR_CTL_LANGUAGE));
+ std::unique_ptr<SfxPoolItem> pNewItem(
+ m_pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(RES_CHRATR_CTL_LANGUAGE));
rSet.Put(*pNewItem);
}
break;
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index cf04fd818603..2434e42a80d5 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -623,8 +623,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
SvxTabStopItem aTabStops( static_cast<const SvxTabStopItem&>(pReqArgs->
Get( nWhich )));
aTabStops.SetWhich(RES_PARATR_TABSTOP);
- const SvxTabStopItem& rDefTabs =
- static_cast<const SvxTabStopItem&>(rSh.GetDefault(RES_PARATR_TABSTOP));
+ const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
// Default tab at pos 0
SfxItemSet aSet( GetPool(), svl::Items<RES_LR_SPACE, RES_LR_SPACE>{} );
@@ -729,8 +728,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
SvxTabStop aSwTabStop( 0, SvxTabAdjust::Default );
aTabStops.Insert(aSwTabStop);
- const SvxTabStopItem& rDefTabs =
- static_cast<const SvxTabStopItem&>(rSh.GetDefault(RES_PARATR_TABSTOP));
+ const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
::MakeDefTabs( ::GetTabDist(rDefTabs), aTabStops );
if( pColl && pColl->IsAutoUpdateFormat())
@@ -1432,8 +1430,7 @@ void SwView::StateTabWin(SfxItemSet& rSet)
{
SvxTabStopItem aTabStops(aCoreSet.Get( RES_PARATR_TABSTOP ));
- const SvxTabStopItem& rDefTabs = static_cast<const SvxTabStopItem&>(
- rSh.GetDefault(RES_PARATR_TABSTOP));
+ const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
OSL_ENSURE(m_pHRuler, "why is there no ruler?");
const long nDefTabDist = ::GetTabDist(rDefTabs);
@@ -1859,7 +1856,7 @@ void SwView::StateTabWin(SfxItemSet& rSet)
SvxColumnItem aColItem(nNum);
const SwRect aPrtRect = rSh.GetAnyCurRect(CurRectType::PagePrt, pPt);
- const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(rMaster.GetFormatAttr(RES_BOX));
+ const SvxBoxItem& rBox = rMaster.GetFormatAttr(RES_BOX);
long nDist = rBox.GetSmallestDistance();
lcl_FillSvxColumn(