diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-27 16:17:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-27 20:37:02 +0200 |
commit | 5f41f7b33e2f85be4c9d7380822916a7469cf39b (patch) | |
tree | 78a6f5e989ecf918598c9cc621411b92341f4d91 /sw/source/filter | |
parent | b9d2c3345a14420ae2f936ffa37f269fcfe74475 (diff) |
loplugin:constantparam in sw
Change-Id: Ia477de0fb910f6a8fbb0a5054f4bdb43dd9ff381
Reviewed-on: https://gerrit.libreoffice.org/43951
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/basflt/fltshell.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/html/css1atr.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/html/htmlatr.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmldrawwriter.cxx | 70 | ||||
-rw-r--r-- | sw/source/filter/html/htmlflywriter.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmt.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmte.cxx | 3 |
9 files changed, 53 insertions, 66 deletions
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index a2110025381c..bcfa1e5b61b9 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -484,11 +484,10 @@ static bool MakePoint(const SwFltStackEntry& rEntry, SwDoc* pDoc, // it adheres to certain restrictions on bookmarks in tables (cannot // span more than one cell) static bool MakeBookRegionOrPoint(const SwFltStackEntry& rEntry, SwDoc* pDoc, - SwPaM& rRegion, bool bCheck ) + SwPaM& rRegion ) { - if (rEntry.MakeRegion(pDoc, rRegion, bCheck )) + if (rEntry.MakeRegion(pDoc, rRegion, true/*bCheck*/ )) { - // sal_Bool b1 = rNds[rRegion.GetPoint()->nNode]->FindTableNode() != 0; if (rRegion.GetPoint()->nNode.GetNode().FindTableBoxStartNode() != rRegion.GetMark()->nNode.GetNode().FindTableBoxStartNode()) { @@ -633,7 +632,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, if ( ( !IsFlagSet(HYPO) || IsFlagSet(BOOK_AND_REF) ) && !rEntry.bConsumedByField ) { - MakeBookRegionOrPoint(rEntry, pDoc, aRegion, true); + MakeBookRegionOrPoint(rEntry, pDoc, aRegion); // #i120879# - create a cross reference heading bookmark if appropriate. const IDocumentMarkAccess::MarkType eBookmarkType = ( pB->IsTOCBookmark() && @@ -646,7 +645,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, break; case RES_FLTR_ANNOTATIONMARK: { - if (MakeBookRegionOrPoint(rEntry, pDoc, aRegion, true)) + if (MakeBookRegionOrPoint(rEntry, pDoc, aRegion)) { SwTextNode const*const pTextNode( aRegion.End()->nNode.GetNode().GetTextNode()); @@ -678,7 +677,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, break; case RES_FLTR_RDFMARK: { - if (MakeBookRegionOrPoint(rEntry, pDoc, aRegion, true)) + if (MakeBookRegionOrPoint(rEntry, pDoc, aRegion)) { SwFltRDFMark* pMark = static_cast<SwFltRDFMark*>(rEntry.pAttr.get()); if (aRegion.GetNode().IsTextNode()) diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 69fe4a3a99d8..aeaac6d5af73 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -147,8 +147,7 @@ static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt, const SvxULSpaceItem *pULSpace, const SvxLRSpaceItem *pLRSpace ); static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt, - const SfxItemSet& rItemSet, - bool bDeep ); + const SfxItemSet& rItemSet ); static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt, Css1Background nMode, const OUString *pGraphicName ); @@ -1702,7 +1701,7 @@ static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rPageDesc, true ); } - OutCSS1_SvxULSpace_SvxLRSpace( rWrt, aItemSet, false ); + OutCSS1_SvxULSpace_SvxLRSpace( rWrt, aItemSet ); // If for a Pseudo-Selector no Property had been set, we still // have to export something, so that the corresponding template is @@ -2988,16 +2987,15 @@ static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt, } static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt, - const SfxItemSet& rItemSet, - bool bDeep ) + const SfxItemSet& rItemSet ) { const SvxULSpaceItem *pULSpace = nullptr; const SvxLRSpaceItem *pLRSpace = nullptr; const SfxPoolItem *pItem; - if( SfxItemState::SET == rItemSet.GetItemState( RES_LR_SPACE, bDeep, &pItem ) ) + if( SfxItemState::SET == rItemSet.GetItemState( RES_LR_SPACE, false/*bDeep*/, &pItem ) ) pLRSpace = static_cast<const SvxLRSpaceItem *>(pItem); - if( SfxItemState::SET == rItemSet.GetItemState( RES_UL_SPACE, bDeep, &pItem ) ) + if( SfxItemState::SET == rItemSet.GetItemState( RES_UL_SPACE, false/*bDeep*/, &pItem ) ) pULSpace = static_cast<const SvxULSpaceItem *>(pItem); if( pLRSpace || pULSpace ) diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index ee63d5a3ddec..deffa526c817 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -1837,7 +1837,7 @@ void HTMLEndPosLst::Insert( const SwDrawFrameFormat& rFormat, sal_Int32 nPos, const SfxItemSet& rFormatItemSet = rFormat.GetAttrSet(); SfxItemSet aItemSet( *rFormatItemSet.GetPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END>{} ); - SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, pTextObj, true ); + SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, pTextObj ); bool bOutStylesOld = bOutStyles; bOutStyles = false; Insert( aItemSet, nPos, nPos+1, rFormatInfos, false ); diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx index e6667fddc1d6..3df710abde87 100644 --- a/sw/source/filter/html/htmldrawwriter.cxx +++ b/sw/source/filter/html/htmldrawwriter.cxx @@ -70,8 +70,7 @@ const SdrObject *SwHTMLWriter::GetMarqueeTextObj( const SwDrawFrameFormat& rForm } void SwHTMLWriter::GetEEAttrsFromDrwObj( SfxItemSet& rItemSet, - const SdrObject *pObj, - bool bSetDefaults ) + const SdrObject *pObj ) { // get the edit script::Engine attributes from object SfxItemSet rObjItemSet = pObj->GetMergedItemSet(); @@ -86,42 +85,39 @@ void SwHTMLWriter::GetEEAttrsFromDrwObj( SfxItemSet& rItemSet, bool bSet = SfxItemState::SET == rObjItemSet.GetItemState( nEEWhich, false, &pEEItem ); - if( bSet || bSetDefaults ) + sal_uInt16 nSwWhich = 0; + switch( nEEWhich ) { - sal_uInt16 nSwWhich = 0; - switch( nEEWhich ) - { - case EE_CHAR_COLOR: nSwWhich = RES_CHRATR_COLOR; break; - case EE_CHAR_STRIKEOUT: nSwWhich = RES_CHRATR_CROSSEDOUT; break; - case EE_CHAR_ESCAPEMENT: nSwWhich = RES_CHRATR_ESCAPEMENT; break; - case EE_CHAR_FONTINFO: nSwWhich = RES_CHRATR_FONT; break; - case EE_CHAR_FONTINFO_CJK: nSwWhich = RES_CHRATR_CJK_FONT; break; - case EE_CHAR_FONTINFO_CTL: nSwWhich = RES_CHRATR_CTL_FONT; break; - case EE_CHAR_FONTHEIGHT: nSwWhich = RES_CHRATR_FONTSIZE; break; - case EE_CHAR_FONTHEIGHT_CJK:nSwWhich = RES_CHRATR_CJK_FONTSIZE; break; - case EE_CHAR_FONTHEIGHT_CTL:nSwWhich = RES_CHRATR_CTL_FONTSIZE; break; - case EE_CHAR_KERNING: nSwWhich = RES_CHRATR_KERNING; break; - case EE_CHAR_ITALIC: nSwWhich = RES_CHRATR_POSTURE; break; - case EE_CHAR_ITALIC_CJK: nSwWhich = RES_CHRATR_CJK_POSTURE; break; - case EE_CHAR_ITALIC_CTL: nSwWhich = RES_CHRATR_CTL_POSTURE; break; - case EE_CHAR_UNDERLINE: nSwWhich = RES_CHRATR_UNDERLINE; break; - case EE_CHAR_WEIGHT: nSwWhich = RES_CHRATR_WEIGHT; break; - case EE_CHAR_WEIGHT_CJK: nSwWhich = RES_CHRATR_CJK_WEIGHT; break; - case EE_CHAR_WEIGHT_CTL: nSwWhich = RES_CHRATR_CTL_WEIGHT; break; - } - - if( nSwWhich ) - { - // if the item isn't set we maybe take the default item - if( !bSet ) - pEEItem = &rObjItemSet.GetPool()->GetDefaultItem(nEEWhich); - - // now we clone the item with the which id of the writer - SfxPoolItem *pSwItem = pEEItem->Clone(); - pSwItem->SetWhich( nSwWhich ); - rItemSet.Put( *pSwItem ); - delete pSwItem; - } + case EE_CHAR_COLOR: nSwWhich = RES_CHRATR_COLOR; break; + case EE_CHAR_STRIKEOUT: nSwWhich = RES_CHRATR_CROSSEDOUT; break; + case EE_CHAR_ESCAPEMENT: nSwWhich = RES_CHRATR_ESCAPEMENT; break; + case EE_CHAR_FONTINFO: nSwWhich = RES_CHRATR_FONT; break; + case EE_CHAR_FONTINFO_CJK: nSwWhich = RES_CHRATR_CJK_FONT; break; + case EE_CHAR_FONTINFO_CTL: nSwWhich = RES_CHRATR_CTL_FONT; break; + case EE_CHAR_FONTHEIGHT: nSwWhich = RES_CHRATR_FONTSIZE; break; + case EE_CHAR_FONTHEIGHT_CJK:nSwWhich = RES_CHRATR_CJK_FONTSIZE; break; + case EE_CHAR_FONTHEIGHT_CTL:nSwWhich = RES_CHRATR_CTL_FONTSIZE; break; + case EE_CHAR_KERNING: nSwWhich = RES_CHRATR_KERNING; break; + case EE_CHAR_ITALIC: nSwWhich = RES_CHRATR_POSTURE; break; + case EE_CHAR_ITALIC_CJK: nSwWhich = RES_CHRATR_CJK_POSTURE; break; + case EE_CHAR_ITALIC_CTL: nSwWhich = RES_CHRATR_CTL_POSTURE; break; + case EE_CHAR_UNDERLINE: nSwWhich = RES_CHRATR_UNDERLINE; break; + case EE_CHAR_WEIGHT: nSwWhich = RES_CHRATR_WEIGHT; break; + case EE_CHAR_WEIGHT_CJK: nSwWhich = RES_CHRATR_CJK_WEIGHT; break; + case EE_CHAR_WEIGHT_CTL: nSwWhich = RES_CHRATR_CTL_WEIGHT; break; + } + + if( nSwWhich ) + { + // if the item isn't set we maybe take the default item + if( !bSet ) + pEEItem = &rObjItemSet.GetPool()->GetDefaultItem(nEEWhich); + + // now we clone the item with the which id of the writer + SfxPoolItem *pSwItem = pEEItem->Clone(); + pSwItem->SetWhich( nSwWhich ); + rItemSet.Put( *pSwItem ); + delete pSwItem; } nEEWhich = aIter.NextWhich(); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 90a3ebecd7cc..07adc94c39b6 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1832,7 +1832,7 @@ static Writer& OutHTML_FrameFormatAsMarquee( Writer& rWrt, const SwFrameFormat& const SfxItemSet& rFormatItemSet = rFrameFormat.GetAttrSet(); SfxItemSet aItemSet( *rFormatItemSet.GetPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END>{} ); - SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, &rSdrObj, true ); + SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, &rSdrObj ); bool bCfgOutStylesOld = rHTMLWrt.m_bCfgOutStyles; rHTMLWrt.m_bCfgOutStyles = false; rHTMLWrt.m_bTextAttr = true; diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 6ded81694981..bacea748f300 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -541,8 +541,7 @@ public: bool bCheckDropCap ); static void GetEEAttrsFromDrwObj( SfxItemSet& rItemSet, - const SdrObject *pObj, - bool bSetDefaults ); + const SdrObject *pObj ); static sal_uInt16 GetDefListLvl( const OUString& rNm, sal_uInt16 nPoolId ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index bb961c9a1462..52862a07d17d 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -149,7 +149,7 @@ using namespace nsHdFtFlags; #include <comphelper/storagehelper.hxx> #include <sfx2/DocumentMetadataAccess.hxx> -SwMacroInfo* GetMacroInfo( SdrObject* pObj, bool bCreate ) // static +static SwMacroInfo* GetMacroInfo( SdrObject* pObj ) { if ( pObj ) { @@ -163,12 +163,9 @@ SwMacroInfo* GetMacroInfo( SdrObject* pObj, bool bCreate ) // static return dynamic_cast<SwMacroInfo*>(pData); } } - if ( bCreate ) - { - SwMacroInfo* pData = new SwMacroInfo; - pObj->AppendUserData(pData); - return pData; - } + SwMacroInfo* pData = new SwMacroInfo; + pObj->AppendUserData(pData); + return pData; } return nullptr; @@ -1098,7 +1095,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, if (pObj && !hlStr.hLinkAddr.isEmpty()) { - SwMacroInfo* pInfo = GetMacroInfo( pObj, true ); + SwMacroInfo* pInfo = GetMacroInfo( pObj ); if( pInfo ) { pInfo->SetShapeId( rObjData.nShapeId ); diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index c918f9899eb0..ec75d3b00951 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -593,8 +593,7 @@ void SwXMLItemSetStyleContext_Impl::ConnectPageDesc() sMasterPageName ); SwStyleNameMapper::FillUIName( sName, sName, - SwGetPoolIdFromName::PageDesc, - true); + SwGetPoolIdFromName::PageDesc); SwPageDesc *pPageDesc = pDoc->FindPageDesc(sName); if( !pPageDesc ) { diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index 7ee76a429f9f..deb42e5cdcc5 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -91,8 +91,7 @@ void SwXMLExport::ExportFormat( const SwFormat& rFormat, enum XMLTokenEnum eFami SwStyleNameMapper::FillProgName( pPageDesc->GetName(), sName, - SwGetPoolIdFromName::PageDesc, - true); + SwGetPoolIdFromName::PageDesc); AddAttribute( XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, EncodeStyleName( sName ) ); } |