summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-16 10:41:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-21 12:44:55 +0100
commit2dbd02b576f28224204ac962f6ce20fde6687093 (patch)
tree28b3f8807d5909e7bcc3c5a629dadd6f475ad9d3 /sw
parent48314f25241e014a634dd5371543b90137ffd2bc (diff)
loplugin:redundantfcast improvements
check for calls to constructors, and extend the list of types we check for unnecessary temporary creation Change-Id: Ia2c1f202b41ed6866779fff5343c821128033eec Reviewed-on: https://gerrit.libreoffice.org/63472 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx18
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx2
-rw-r--r--sw/source/core/access/accfrmobj.cxx2
-rw-r--r--sw/source/core/bastyp/calc.cxx2
-rw-r--r--sw/source/core/crsr/swcrsr.cxx4
-rw-r--r--sw/source/core/doc/docbm.cxx4
-rw-r--r--sw/source/core/doc/doctxm.cxx5
-rw-r--r--sw/source/core/layout/paintfrm.cxx6
-rw-r--r--sw/source/ui/chrdlg/tblnumfm.cxx2
-rw-r--r--sw/source/ui/config/optload.cxx2
-rw-r--r--sw/source/uibase/shells/grfsh.cxx2
-rw-r--r--sw/source/uibase/uiview/srcview.cxx2
-rw-r--r--sw/source/uibase/utlui/uitool.cxx4
13 files changed, 27 insertions, 28 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 0f60b411ede2..6bc9b8fa006b 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1612,7 +1612,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeight") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(100.), fFloat);
xCell1Style->getPropertyValue("CharPosture") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, eCharPosture);
xCell1Style->getPropertyValue("CharFontName") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString);
xCell1Style->getPropertyValue("CharFontStyleName") >>= sString;
@@ -1627,7 +1627,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeightAsian") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(100.), fFloat);
xCell1Style->getPropertyValue("CharPostureAsian") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, eCharPosture);
xCell1Style->getPropertyValue("CharFontNameAsian") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString);
xCell1Style->getPropertyValue("CharFontStyleNameAsian") >>= sString;
@@ -1642,7 +1642,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeightComplex") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(100.), fFloat);
xCell1Style->getPropertyValue("CharPostureComplex") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, eCharPosture);
xCell1Style->getPropertyValue("CharFontNameComplex") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Courier"), sString);
xCell1Style->getPropertyValue("CharFontStyleNameComplex") >>= sString;
@@ -1673,7 +1673,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeight") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(150.), fFloat);
xCell1Style->getPropertyValue("CharPosture") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, eCharPosture);
xCell1Style->getPropertyValue("CharFontName") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString);
xCell1Style->getPropertyValue("CharFontStyleName") >>= sString;
@@ -1688,7 +1688,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeightAsian") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(150.), fFloat);
xCell1Style->getPropertyValue("CharPostureAsian") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, eCharPosture);
xCell1Style->getPropertyValue("CharFontNameAsian") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString);
xCell1Style->getPropertyValue("CharFontStyleNameAsian") >>= sString;
@@ -1703,7 +1703,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeightComplex") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(150.), fFloat);
xCell1Style->getPropertyValue("CharPostureComplex") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_NONE), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, eCharPosture);
xCell1Style->getPropertyValue("CharFontNameComplex") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), sString);
xCell1Style->getPropertyValue("CharFontStyleNameComplex") >>= sString;
@@ -1734,7 +1734,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeight") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(100.), fFloat);
xCell1Style->getPropertyValue("CharPosture") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_ITALIC), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, eCharPosture);
xCell1Style->getPropertyValue("CharFontName") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString);
xCell1Style->getPropertyValue("CharFontStyleName") >>= sString;
@@ -1749,7 +1749,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeightAsian") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(100.), fFloat);
xCell1Style->getPropertyValue("CharPostureAsian") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_ITALIC), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, eCharPosture);
xCell1Style->getPropertyValue("CharFontNameAsian") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString);
xCell1Style->getPropertyValue("CharFontStyleNameAsian") >>= sString;
@@ -1764,7 +1764,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt")
xCell1Style->getPropertyValue("CharWeightComplex") >>= fFloat;
CPPUNIT_ASSERT_EQUAL(float(100.), fFloat);
xCell1Style->getPropertyValue("CharPostureComplex") >>= eCharPosture;
- CPPUNIT_ASSERT_EQUAL(awt::FontSlant(awt::FontSlant_ITALIC), eCharPosture);
+ CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, eCharPosture);
xCell1Style->getPropertyValue("CharFontNameComplex") >>= sString;
CPPUNIT_ASSERT_EQUAL(OUString("Open Sans"), sString);
xCell1Style->getPropertyValue("CharFontStyleNameComplex") >>= sString;
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index b711a3cbbd90..a636718275a3 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4562,7 +4562,7 @@ void SwUiWriterTest::testTdf96479()
CPPUNIT_ASSERT(!xCursorNew->isCollapsed());
xCursorNew->getText()->insertTextContent(xCursorNew, xTextField, true);
xBookmarkNew = uno::Reference<text::XTextContent>(xBookmarksSupplier->getBookmarks()->getByName("replacement"), uno::UNO_QUERY);
- xCursorNew = uno::Reference<text::XTextCursor>(xBookmarkNew->getAnchor()->getText()->createTextCursorByRange(xBookmarkNew->getAnchor()));
+ xCursorNew = xBookmarkNew->getAnchor()->getText()->createTextCursorByRange(xBookmarkNew->getAnchor());
CPPUNIT_ASSERT(!xCursorNew->isCollapsed());
// Can't check the actual content of the text node via UNO
diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx
index c617a62a4e22..3057d226957f 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -234,7 +234,7 @@ SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& rAccMap ) const
}
else if ( mpFrame->IsTabFrame() )
{
- aBox = SwRect( mpFrame->getFrameArea() );
+ aBox = mpFrame->getFrameArea();
aBox.Intersection( mpFrame->GetUpper()->getFrameArea() );
}
else
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 4d80b9a2302e..f9665474a1a7 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -585,7 +585,7 @@ void SwCalc::VarChange( const OUString& rStr, const SwSbxValue& rValue )
if( !pFnd )
{
- pFnd = new SwCalcExp( aStr, SwSbxValue( rValue ), nullptr );
+ pFnd = new SwCalcExp( aStr, rValue, nullptr );
pFnd->pNext = std::move( m_aVarTable[ nPos ] );
m_aVarTable[ nPos ].reset( pFnd );
}
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 798ca463b69e..ad453fc2b8de 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1442,11 +1442,11 @@ bool SwCursor::SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType
--w.m_nPtIndex;
w.AssignBack(pTextNd, nPtPos);
- aBndry = Boundary( g_pBreakIt->GetBreakIter()->getWordBoundary(
+ aBndry = g_pBreakIt->GetBreakIter()->getWordBoundary(
*w.m_pText, w.m_nPtIndex,
g_pBreakIt->GetLocale( pTextNd->GetLang( nPtPos ) ),
nWordType,
- bForward ));
+ bForward );
}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index aaa9731bba31..7710f4a2b8a7 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -141,13 +141,13 @@ namespace
bool bPosAtEndOfNode = false;
if ( pNode == nullptr)
{
- SwNodeIndex aEnd = SwNodeIndex(rEnd);
+ SwNodeIndex aEnd = rEnd;
pNode = rEnd.GetNodes().GoNext( &aEnd );
bPosAtEndOfNode = false;
}
if ( pNode == nullptr )
{
- SwNodeIndex aStt = SwNodeIndex(rStt);
+ SwNodeIndex aStt = rStt;
pNode = SwNodes::GoPrevious(&aStt);
bPosAtEndOfNode = true;
}
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 3d04e1eaff69..d39c33c2f5a5 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1664,8 +1664,7 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
sal_uInt16 nOld = rNums[0],
nBeg = nOld,
nCount = 0;
- OUString aNumStr( SvxNumberType( rDescs[0]->GetNumType() ).
- GetNumStr( nBeg ) );
+ OUString aNumStr( rDescs[0]->GetNumType().GetNumStr( nBeg ) );
if( xCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg ))
{
xCharStyleIdx->push_back( 0 );
@@ -1759,7 +1758,7 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
aNumStr += S_PAGE_DELI;
//#58127# If nCount == 0, then the only PageNumber is already in aNumStr!
if(nCount)
- aNumStr += SvxNumberType( rDescs[i-1]->GetNumType() ).GetNumStr( nBeg+nCount );
+ aNumStr += rDescs[i-1]->GetNumType().GetNumStr( nBeg+nCount );
}
}
pNd->InsertText( aNumStr, aPos, SwInsertFlags::EMPTYEXPAND | SwInsertFlags::FORCEHINTEXPAND );
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index de8d04311d64..dfa37544339e 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -734,7 +734,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects, S
{
// get a copy instead of a reference, because an <insert> may destroy
// the object due to a necessary array resize.
- const SwLineRect aSubsLineRect = SwLineRect(aLineRects[i]);
+ const SwLineRect aSubsLineRect(aLineRects[i]);
// add condition <aSubsLineRect.IsLocked()> in order to consider only
// border lines, which are *not* locked.
@@ -3576,9 +3576,9 @@ void SwColumnFrame::PaintBreak( ) const
aRect.Left() + nTextOff, aRect.Top() ) );
if ( IsVertical() )
{
- aTextMatrix = basegfx::B2DHomMatrix( basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix (
+ aTextMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix (
aFontSize.getX(), aFontSize.getY(), 0.0, M_PI_2,
- aRect.Right(), aRect.Top() + nTextOff ) );
+ aRect.Right(), aRect.Top() + nTextOff );
}
drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText =
diff --git a/sw/source/ui/chrdlg/tblnumfm.cxx b/sw/source/ui/chrdlg/tblnumfm.cxx
index 46fe5c8455e4..d790a7e7d03d 100644
--- a/sw/source/ui/chrdlg/tblnumfm.cxx
+++ b/sw/source/ui/chrdlg/tblnumfm.cxx
@@ -38,7 +38,7 @@ SwNumFormatDlg::SwNumFormatDlg(weld::Window* pParent, const SfxItemSet& rSet)
TabPageParent pPageParent(get_content_area(), this);
VclPtr<SfxTabPage> xNewPage = (*fnCreatePage)(pPageParent, &rSet);
SfxAllItemSet aSet(*(rSet.GetPool()));
- aSet.Put(SvxNumberInfoItem(xNewPage->GetItemSet().Get( SID_ATTR_NUMBERFORMAT_INFO)));
+ aSet.Put(xNewPage->GetItemSet().Get( SID_ATTR_NUMBERFORMAT_INFO));
xNewPage->PageCreated(aSet);
SetTabPage(xNewPage);
}
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 43ab57535bec..1b630df9b71f 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -418,7 +418,7 @@ void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext)
if (!mbFontInitialized)
{
- maFont = vcl::Font(rRenderContext.GetFont());
+ maFont = rRenderContext.GetFont();
maFont.SetFontHeight(maFont.GetFontHeight() * 120 / 100);
mbFontInitialized = true;
}
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index f8fd3b7739a0..211b36959e83 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -213,7 +213,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
convertTwipToMm100(aCrop.GetRight()),
convertTwipToMm100(aCrop.GetBottom()) );
- Graphic aGraphic = Graphic( *pGraphic );
+ Graphic aGraphic = *pGraphic;
CompressGraphicsDialog aDialog(GetView().GetFrameWeld(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings());
if (aDialog.run() == RET_OK)
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 80d11e67ec02..a66e6f165bdf 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -829,7 +829,7 @@ void SwSrcView::Load(SwDocShell* pDocShell)
ErrCode nRes = aWriter.Write(xWriter, &sWriteName);
if(nRes)
{
- ErrorHandler::HandleError(ErrCode(nRes));
+ ErrorHandler::HandleError(nRes);
aEditWin->SetReadonly(true);
}
aMedium.Commit();
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index aa679eb392e9..c3d2c69780f7 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -453,7 +453,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
aHeaderSet.Put(aFirstShared);
// Size
- SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrameSize.GetSize()));
+ SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, rFrameSize.GetSize());
aHeaderSet.Put(aSize);
// Shifting frame attributes
@@ -503,7 +503,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
aFooterSet.Put(aFirstShared);
// Size
- SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrameSize.GetSize()));
+ SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, rFrameSize.GetSize());
aFooterSet.Put(aSize);
// Shifting Frame attributes