[Libreoffice-commits] core.git: cui/source editeng/inc editeng/source include/editeng sc/source sd/source sw/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Oct 31 12:58:46 UTC 2017


 cui/source/tabpages/page.cxx                 |    4 +-
 editeng/inc/editdoc.hxx                      |    4 +-
 editeng/source/editeng/editdbg.cxx           |    4 +-
 editeng/source/editeng/editdoc.cxx           |    8 ++---
 editeng/source/items/paperinf.cxx            |    5 +--
 editeng/source/rtf/rtfitem.cxx               |   37 +++++++++++----------------
 include/editeng/paperinf.hxx                 |    2 -
 sc/source/ui/view/printfun.cxx               |    2 -
 sd/source/ui/sidebar/SlideBackground.cxx     |    2 -
 sw/source/ui/envelp/envfmt.cxx               |    4 +-
 sw/source/uibase/sidebar/PageFormatPanel.cxx |    2 -
 11 files changed, 33 insertions(+), 41 deletions(-)

New commits:
commit 4f798ed25645b3b1c2e5100a6353cfbc4650becc
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Oct 31 10:41:55 2017 +0200

    loplugin:constantparam in editeng
    
    Change-Id: I0a07326d5b63e82ef16e02f75fd8523e3b73e1f4
    Reviewed-on: https://gerrit.libreoffice.org/44096
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 4e895fa09ff7..bc83dcfc3f57 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -514,7 +514,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
         Swap( aPaperSize );
 
     // Actual Paper Format
-    Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MapUnit::Map100thMM, true );
+    Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MapUnit::Map100thMM );
 
     if ( PAPER_USER != ePaper )
         aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MapUnit::Map100thMM );
@@ -996,7 +996,7 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeModify_Impl, Edit&, void)
     MapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
     Size aSize( GetCoreValue( *m_pPaperWidthEdit, eUnit ),
                 GetCoreValue( *m_pPaperHeightEdit, eUnit ) );
-    Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, eUnit, true );
+    Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, eUnit );
 
     m_pPaperSizeBox->SetSelection( ePaper );
     UpdateExample_Impl( true );
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 13414dfcb101..c5f6f7ddf1fb 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -792,7 +792,7 @@ public:
     sal_uLong       GetTextLen() const;
 
     OUString       GetParaAsString( sal_Int32 nNode ) const;
-    static OUString  GetParaAsString(const ContentNode* pNode, sal_Int32 nStartPos = 0, sal_Int32 nEndPos = -1, bool bResolveFields = true);
+    static OUString  GetParaAsString(const ContentNode* pNode, sal_Int32 nStartPos = 0, sal_Int32 nEndPos = -1);
 
     EditPaM GetStartPaM() const;
     EditPaM GetEndPaM() const;
@@ -829,7 +829,7 @@ inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, sal_Int3
     return (nAttr < (sal_Int32)rAttribs.size()) ? rAttribs[nAttr].get() : nullptr;
 }
 
-void CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart);
+void CheckOrderedList(const CharAttribList::AttribsType& rAttribs);
 
 class EditEngineItemPool : public SfxItemPool
 {
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 67b5ab852337..c93477eb7309 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -498,12 +498,12 @@ bool ParaPortion::DbgCheckTextPortions(ParaPortion const& rPara)
     return nXLen == rPara.pNode->Len();
 }
 
-void CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart)
+void CheckOrderedList(const CharAttribList::AttribsType& rAttribs)
 {
     sal_Int32 nPrev = 0;
     for (const std::unique_ptr<EditCharAttrib>& rAttr : rAttribs)
     {
-        sal_Int32 const nCur = bStart ? rAttr->GetStart() : rAttr->GetEnd();
+        sal_Int32 const nCur = rAttr->GetStart();
         assert(nCur >= nPrev);
         nPrev = nCur;
     }
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 3938a8b68fdd..db5b4b28799d 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2182,10 +2182,9 @@ OUString EditDoc::GetParaAsString( sal_Int32 nNode ) const
 }
 
 OUString EditDoc::GetParaAsString(
-    const ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nEndPos,
-    bool bResolveFields)
+    const ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nEndPos)
 {
-    return pNode->GetExpandedText(nStartPos, nEndPos, bResolveFields);
+    return pNode->GetExpandedText(nStartPos, nEndPos, true/*bResolveFields*/);
 }
 
 EditPaM EditDoc::GetStartPaM() const
@@ -3007,8 +3006,7 @@ void CharAttribList::DbgCheckAttribs(CharAttribList const& rAttribs)
             assert(zero_set.insert(std::make_pair(rAttr->GetStart(), rAttr->Which())).second && "duplicate 0-length attribute detected");
         }
     }
-    CheckOrderedList(rAttribs.GetAttribs(), true);
-//    CheckOrderedList(rAttribs.GetAttribs(), false); // this does not work - need 2nd array to sort by ends?
+    CheckOrderedList(rAttribs.GetAttribs());
 }
 #endif
 
diff --git a/editeng/source/items/paperinf.cxx b/editeng/source/items/paperinf.cxx
index 9f2da29c14eb..c3b4f7166946 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -85,12 +85,11 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter )
 }
 
 
-Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy )
+Paper SvxPaperInfo::GetSvxPaper( const Size &rSize, MapUnit eUnit )
 {
     Size aSize(eUnit == MapUnit::Map100thMM ? rSize : OutputDevice::LogicToLogic(rSize, MapMode(eUnit), MapMode(MapUnit::Map100thMM)));
     PaperInfo aInfo(aSize.Width(), aSize.Height());
-    if (bSloppy)
-        aInfo.doSloppyFit();
+    aInfo.doSloppyFit();
     return aInfo.getPaper();
 }
 
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 290c90686229..6b6f87e9e1ec 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -85,18 +85,6 @@
 using namespace ::com::sun::star;
 using namespace editeng;
 
-// Some helper functions
-// char
-inline const SvxEscapementItem& GetEscapement(const SfxItemSet& rSet,sal_uInt16 nId,bool bInP)
-    { return static_cast<const SvxEscapementItem&>(rSet.Get( nId,bInP)); }
-inline const SvxLineSpacingItem& GetLineSpacing(const SfxItemSet& rSet,sal_uInt16 nId,bool bInP)
-    { return static_cast<const SvxLineSpacingItem&>(rSet.Get( nId,bInP)); }
-// frm
-inline const SvxLRSpaceItem& GetLRSpace(const SfxItemSet& rSet,sal_uInt16 nId)
-    { return static_cast<const SvxLRSpaceItem&>(rSet.Get( nId)); }
-inline const SvxULSpaceItem& GetULSpace(const SfxItemSet& rSet,sal_uInt16 nId)
-    { return static_cast<const SvxULSpaceItem&>(rSet.Get( nId)); }
-
 void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet,
                                     SfxPoolItem& rItem )
 {
@@ -340,7 +328,8 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
             case RTF_FI:
                 if( aPardMap.nLRSpace )
                 {
-                    SvxLRSpaceItem aLR( GetLRSpace(*pSet, aPardMap.nLRSpace ));
+                    SvxLRSpaceItem aLR(
+                        static_cast<const SvxLRSpaceItem&>(pSet->Get(aPardMap.nLRSpace)));
                     sal_uInt16 nSz = 0;
                     if( -1 != nTokenValue )
                     {
@@ -357,7 +346,8 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
             case RTF_LIN:
                 if( aPardMap.nLRSpace )
                 {
-                    SvxLRSpaceItem aLR( GetLRSpace(*pSet, aPardMap.nLRSpace ));
+                    SvxLRSpaceItem aLR(
+                        static_cast<const SvxLRSpaceItem&>(pSet->Get(aPardMap.nLRSpace)));
                     sal_uInt16 nSz = 0;
                     if( 0 < nTokenValue )
                     {
@@ -374,7 +364,8 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
             case RTF_RIN:
                 if( aPardMap.nLRSpace )
                 {
-                    SvxLRSpaceItem aLR( GetLRSpace(*pSet, aPardMap.nLRSpace ));
+                    SvxLRSpaceItem aLR(
+                        static_cast<const SvxLRSpaceItem&>(pSet->Get(aPardMap.nLRSpace)));
                     sal_uInt16 nSz = 0;
                     if( 0 < nTokenValue )
                     {
@@ -390,7 +381,8 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
             case RTF_SB:
                 if( aPardMap.nULSpace )
                 {
-                    SvxULSpaceItem aUL( GetULSpace(*pSet, aPardMap.nULSpace ));
+                    SvxULSpaceItem aUL(
+                        static_cast<const SvxULSpaceItem&>(pSet->Get(aPardMap.nULSpace)));
                     sal_uInt16 nSz = 0;
                     if( 0 < nTokenValue )
                     {
@@ -406,7 +398,8 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
             case RTF_SA:
                 if( aPardMap.nULSpace )
                 {
-                    SvxULSpaceItem aUL( GetULSpace(*pSet, aPardMap.nULSpace ));
+                    SvxULSpaceItem aUL(
+                        static_cast<const SvxULSpaceItem&>(pSet->Get(aPardMap.nULSpace)));
                     sal_uInt16 nSz = 0;
                     if( 0 < nTokenValue )
                     {
@@ -423,8 +416,8 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
                 if( aPardMap.nLinespacing && 1 == nTokenValue )
                 {
                     // then switches to multi-line!
-                    SvxLineSpacingItem aLSpace( GetLineSpacing( *pSet,
-                                                aPardMap.nLinespacing, false ));
+                    SvxLineSpacingItem aLSpace(
+                            static_cast<const SvxLineSpacingItem&>(pSet->Get( aPardMap.nLinespacing,false)));
 
                     // how much do you get from the line height value?
 
@@ -565,7 +558,8 @@ SET_FONTALIGNMENT:
                         nTokenValue = 6;
                     if( IsCalcValue() )
                         CalcValue();
-                    const SvxEscapementItem& rOld = GetEscapement( *pSet, nEsc, false );
+                    const SvxEscapementItem& rOld =
+                        static_cast<const SvxEscapementItem&>(pSet->Get( nEsc,false));
                     short nEs;
                     sal_uInt8 nProp;
                     if( DFLT_ESC_AUTO_SUPER == rOld.GetEsc() )
@@ -912,7 +906,8 @@ ATTR_SETOVERLINE:
                         nTokenValue = 6;
                     if( IsCalcValue() )
                         CalcValue();
-                    const SvxEscapementItem& rOld = GetEscapement( *pSet, nEsc, false );
+                    const SvxEscapementItem& rOld =
+                        static_cast<const SvxEscapementItem&>(pSet->Get( nEsc,false));
                     short nEs;
                     sal_uInt8 nProp;
                     if( DFLT_ESC_AUTO_SUB == rOld.GetEsc() )
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
index 490c54fba82f..66a945e12e8a 100644
--- a/include/editeng/paperinf.hxx
+++ b/include/editeng/paperinf.hxx
@@ -39,7 +39,7 @@ public:
     static Size     GetDefaultPaperSize( MapUnit eUnit = MapUnit::MapTwip );
     static Size     GetPaperSize( Paper ePaper, MapUnit eUnit = MapUnit::MapTwip );
     static Size     GetPaperSize( const Printer* pPrinter );
-    static Paper    GetSvxPaper( const Size &rSize, MapUnit eUnit, bool bSloppy );
+    static Paper    GetSvxPaper( const Size &rSize, MapUnit eUnit );
     static long     GetSloppyPaperDimension( long nSize );
     static OUString GetName( Paper ePaper );
 };
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 7ee63fe3c1d5..12236ffdac7f 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -2589,7 +2589,7 @@ void ScPrintFunc::ApplyPrintSettings()
                 aEnumSize.Width() = aEnumSize.Height();
                 aEnumSize.Height() = nTemp;
         }
-        Paper ePaper = SvxPaperInfo::GetSvxPaper( aEnumSize, MapUnit::MapTwip, true );
+        Paper ePaper = SvxPaperInfo::GetSvxPaper( aEnumSize, MapUnit::MapTwip );
         sal_uInt16 nPaperBin = static_cast<const SvxPaperBinItem&>(pParamSet->Get(ATTR_PAGE_PAPERBIN)).GetValue();
 
         pPrinter->SetPaper( ePaper );
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index d05c73294d2d..7f88057b8e32 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -809,7 +809,7 @@ void SlideBackground::NotifyItemUpdate(
                 if(mpPaperOrientation->GetSelectedEntryPos() == 0)
                    Swap(aPaperSize);
 
-                Paper ePaper = SvxPaperInfo::GetSvxPaper(aPaperSize, meUnit, true);
+                Paper ePaper = SvxPaperInfo::GetSvxPaper(aPaperSize, meUnit);
                 mpPaperSizeBox->SetSelection( ePaper );
             }
         }
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index a53832123b84..bedd8bb47fd9 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -234,7 +234,7 @@ IMPL_LINK( SwEnvFormatPage, ModifyHdl, SpinField&, rEdit, void )
         long nRotatedWidth = lHeight;
         long nRotatedHeight = lWidth;
         Paper ePaper = SvxPaperInfo::GetSvxPaper(
-            Size(nRotatedWidth, nRotatedHeight), MapUnit::MapTwip, true);
+            Size(nRotatedWidth, nRotatedHeight), MapUnit::MapTwip);
         for (size_t i = 0; i < aIDs.size(); ++i)
             if (aIDs[i] == (sal_uInt16)ePaper)
                 m_pSizeFormatBox->SelectEntryPos(static_cast<sal_Int32>(i));
@@ -516,7 +516,7 @@ void SwEnvFormatPage::Reset(const SfxItemSet* rSet)
 
     Paper ePaper = SvxPaperInfo::GetSvxPaper(
         Size( std::min(rItem.lWidth, rItem.lHeight),
-        std::max(rItem.lWidth, rItem.lHeight)), MapUnit::MapTwip, true);
+        std::max(rItem.lWidth, rItem.lHeight)), MapUnit::MapTwip);
     for (size_t i = 0; i < aIDs.size(); ++i)
         if (aIDs[i] == (sal_uInt16)ePaper)
             m_pSizeFormatBox->SelectEntryPos(static_cast<sal_Int32>(i));
diff --git a/sw/source/uibase/sidebar/PageFormatPanel.cxx b/sw/source/uibase/sidebar/PageFormatPanel.cxx
index c60fe52dfbb9..59301a7b6bd7 100644
--- a/sw/source/uibase/sidebar/PageFormatPanel.cxx
+++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx
@@ -157,7 +157,7 @@ void PageFormatPanel::NotifyItemUpdate(
                 if(mpPaperOrientation->GetSelectedEntryPos() == 1)
                    Swap(aPaperSize);
 
-                Paper ePaper = SvxPaperInfo::GetSvxPaper(aPaperSize, meUnit,true);
+                Paper ePaper = SvxPaperInfo::GetSvxPaper(aPaperSize, meUnit);
                 mpPaperSizeBox->SetSelection( ePaper );
             }
         }


More information about the Libreoffice-commits mailing list