diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-12 18:39:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-15 08:37:54 +0200 |
commit | b52f309f2b9037ee53ab8ac2d66967c012ba82f1 (patch) | |
tree | 4a4ace081c742af0cef50909e06394d9aef80345 /sw | |
parent | 897493fbd34a1bd10320767b48cbf04d422f89b3 (diff) |
improve loplugin simplifyconstruct
to find stuff like
OUString s = OUString("xxx")
Change-Id: Ie7ed074c1ae012734c67a2a89c564c1900a4ab04
Reviewed-on: https://gerrit.libreoffice.org/70697
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/core/uwriter.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/crsr/DropDownFormFieldButton.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/autofmt.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/fields/reffld.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/frmcrsr.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/guess.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/porlay.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/pormulti.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmlsect.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldvar.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/vba/vbalisthelper.cxx | 2 |
17 files changed, 25 insertions, 26 deletions
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 9589035e3d30..c5d179d36e87 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -2079,8 +2079,8 @@ void SwDocTest::testTableCellComparison() CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A2", "Z2", "A1", "Z1", true) ); CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A6", "Z2", "A1", "Z1", true) ); - OUString rCell1 = OUString("A1"); - OUString rCell2 = OUString("C5"); + OUString rCell1("A1"); + OUString rCell2("C5"); sw_NormalizeRange(rCell1, rCell2); CPPUNIT_ASSERT_EQUAL( OUString("A1"), rCell1 ); diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 5579c802833b..e08e29403d9d 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1052,7 +1052,7 @@ DECLARE_ODFEXPORT_TEST(testShapeRelsize, "shape-relsize.odt") DECLARE_ODFEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.odt") { uno::Reference<drawing::XShape> xShape = getShape(1); - comphelper::SequenceAsHashMap aCustomShapeGeometry = comphelper::SequenceAsHashMap(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); + comphelper::SequenceAsHashMap aCustomShapeGeometry(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); // Test that the shape is a rounded rectangle. CPPUNIT_ASSERT_EQUAL(OUString("round-rectangle"), aCustomShapeGeometry["Type"].get<OUString>()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 82139b936f16..734ada046e6a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -868,7 +868,7 @@ DECLARE_OOXMLEXPORT_TEST(testCommentInitials, "comment_initials.odt") DECLARE_OOXMLEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.docx") { uno::Reference<drawing::XShape> xShape = getShape(1); - comphelper::SequenceAsHashMap aCustomShapeGeometry = comphelper::SequenceAsHashMap(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); + comphelper::SequenceAsHashMap aCustomShapeGeometry(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); // Test that the shape is a rounded rectangle. CPPUNIT_ASSERT_EQUAL(OUString("ooxml-roundRect"), aCustomShapeGeometry["Type"].get<OUString>()); diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 359144d5169e..53f09826a2c1 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -483,7 +483,7 @@ DECLARE_RTFEXPORT_TEST(testFdo61507, "fdo61507.rtf") mxComponent, uno::UNO_QUERY); uno::Reference<document::XDocumentProperties> xDocumentProperties( xDocumentPropertiesSupplier->getDocumentProperties()); - OUString aExpected = OUString(u"\u00C9\u00C1\u0150\u0170\u222D"); + OUString aExpected(u"\u00C9\u00C1\u0150\u0170\u222D"); CPPUNIT_ASSERT_EQUAL(aExpected, xDocumentProperties->getTitle()); // Only "Hello.", no additional characters. diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 693038a268dd..c63fc4064685 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -6855,11 +6855,11 @@ void SwUiWriterTest::testTdf108423() pWrtShell->AutoCorrect(corr, cChar); // The word "i" should be capitalized due to autocorrect, followed by a typographical apostrophe sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); - OUString sIApostrophe = OUString(u"I" + OUStringLiteral1(0x2019)); + OUString sIApostrophe(u"I" + OUStringLiteral1(0x2019)); CPPUNIT_ASSERT_EQUAL(sIApostrophe, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); pWrtShell->Insert(" i"); pWrtShell->AutoCorrect(corr, cChar); - OUString sText = OUString(sIApostrophe + u" " + sIApostrophe); + OUString sText(sIApostrophe + u" " + sIApostrophe); CPPUNIT_ASSERT_EQUAL(sText, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); } diff --git a/sw/source/core/crsr/DropDownFormFieldButton.cxx b/sw/source/core/crsr/DropDownFormFieldButton.cxx index bef4c873dace..49cebffed0fa 100644 --- a/sw/source/core/crsr/DropDownFormFieldButton.cxx +++ b/sw/source/core/crsr/DropDownFormFieldButton.cxx @@ -199,8 +199,7 @@ void DropDownFormFieldButton::Paint(vcl::RenderContext& rRenderContext, const to //const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); Color aLineColor = COL_BLACK; - Color aFillColor - = Color(lcl_GetFillColor(aLineColor.getBColor(), (m_pFieldPopup ? 0.5 : 0.75))); + Color aFillColor(lcl_GetFillColor(aLineColor.getBColor(), (m_pFieldPopup ? 0.5 : 0.75))); // Draw the frame around the field // GTK3 backend cuts down the frame's top and left border, to avoid that add a padding around the frame diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index fbd57a8e1b75..a116479520c3 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1461,7 +1461,7 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType, if( rOLEObj.IsOleRef() ) // Not yet loaded { - SvGlobalName aTmpName = SvGlobalName( rOLEObj.GetOleRef()->getClassID() ); + SvGlobalName aTmpName( rOLEObj.GetOleRef()->getClassID() ); SwTOOElements nObj = ::lcl_IsSOObject( aTmpName ); bInclude = ( (nMyOLEOptions & SwTOOElements::Other) && SwTOOElements::NONE == nObj ) || (nMyOLEOptions & nObj); diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 2827659def58..740b3cc1f99b 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -465,8 +465,8 @@ sal_uInt16 SwAutoFormat::CalcLevel(const SwTextFrame & rFrame, ++nLvl; } - for (TextFrameIndex n = TextFrameIndex(0), - nEnd = TextFrameIndex(rText.getLength()); n < nEnd; ++n) + for (TextFrameIndex n(0), + nEnd(rText.getLength()); n < nEnd; ++n) { switch (rText[sal_Int32(n)]) { @@ -514,8 +514,8 @@ bool SwAutoFormat::IsNoAlphaLine(const SwTextFrame & rFrame) const // or better: determine via number of AlphaNum and !AlphaNum characters sal_Int32 nANChar = 0, nBlnk = 0; - for (TextFrameIndex n = TextFrameIndex(0), - nEnd = TextFrameIndex(rStr.getLength()); n < nEnd; ++n) + for (TextFrameIndex n(0), + nEnd(rStr.getLength()); n < nEnd; ++n) if (IsSpace(rStr[sal_Int32(n)])) ++nBlnk; else @@ -741,8 +741,8 @@ sal_Int32 SwAutoFormat::GetTrailingBlanks( const OUString& rStr ) bool SwAutoFormat::IsFirstCharCapital(const SwTextFrame& rFrame) const { const OUString& rText = rFrame.GetText(); - for (TextFrameIndex n = TextFrameIndex(0), - nEnd = TextFrameIndex(rText.getLength()); n < nEnd; ++n) + for (TextFrameIndex n(0), + nEnd(rText.getLength()); n < nEnd; ++n) if (!IsSpace(rText[sal_Int32(n)])) { auto const pair = rFrame.MapViewToModel(n); diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 1546e71d6d61..6ad230c05075 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1427,7 +1427,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) // then there are RefFields in the DescDox - so all RefFields in the SourceDoc // need to be converted to have unique IDs for both documents - RefIdsMap aFntMap = RefIdsMap(OUString()); + RefIdsMap aFntMap { OUString() }; std::vector<std::unique_ptr<RefIdsMap>> aFieldMap; SwIterator<SwFormatField,SwFieldType> aIter( *this ); diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index e3bb28798d84..e47dc10c3a25 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1161,7 +1161,7 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset, if ( !IsEmpty() && !IsHiddenNow() ) { - TextFrameIndex nFormat = TextFrameIndex(COMPLETE_STRING); + TextFrameIndex nFormat(COMPLETE_STRING); do { if (nFormat != TextFrameIndex(COMPLETE_STRING) && !IsFollow() && diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 76fb43c1eb9e..d6fbbababd9e 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -185,7 +185,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, } bool bHyph = rInf.IsHyphenate() && !rInf.IsHyphForbud(); - TextFrameIndex nHyphPos = TextFrameIndex(0); + TextFrameIndex nHyphPos(0); // nCutPos is the first character not fitting to the current line // nHyphPos is the first character not fitting to the current line, diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 011490cc3568..312a7a7b38d2 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -946,7 +946,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode, // all of the characters in this group are weak. We have to assign // the scripts to these characters depending on the fonts which are // set for these characters to display them. - TextFrameIndex nEnd = TextFrameIndex( + TextFrameIndex nEnd( g_pBreakIt->GetBreakIter()->endOfScript(rText, sal_Int32(nChg), WEAK)); if (nEnd > TextFrameIndex(rText.getLength()) || nEnd < TextFrameIndex(0)) diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 22a401be9514..875d3c1b90a0 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -307,14 +307,14 @@ SwDoubleLinePortion::SwDoubleLinePortion( SwFontScript nTmp = SW_SCRIPTS; if( pBracket->cPre > 255 ) { - OUString aText = OUString(pBracket->cPre); + OUString aText(pBracket->cPre); nTmp = SwScriptInfo::WhichFont(0, aText); } pBracket->nPreScript = nTmp; nTmp = SW_SCRIPTS; if( pBracket->cPost > 255 ) { - OUString aText = OUString(pBracket->cPost); + OUString aText(pBracket->cPost); nTmp = SwScriptInfo::WhichFont(0, aText); } pBracket->nPostScript = nTmp; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index ed39672d4f5a..ed312422a361 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2197,7 +2197,7 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf) const long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf ); - for (TextFrameIndex j = TextFrameIndex(0); j < rInf.GetLen(); j++) + for (TextFrameIndex j(0); j < rInf.GetLen(); j++) { long nScr = pKernArray[sal_Int32(j)] + (nSpaceAdd + nGridWidthAdd) * (sal_Int32(j) + 1); if( nScr >= rInf.GetOfst()) diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 8ebd982fd635..a168f47203e3 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -235,7 +235,7 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken ) { SwContentNode *pCNd = m_xDoc->GetNodes()[pStartNdIdx->GetIndex()+1]->GetContentNode(); - SwNodeIndex aTmpSwNodeIndex = SwNodeIndex(*pCNd); + SwNodeIndex aTmpSwNodeIndex(*pCNd); SwPosition aNewPos( aTmpSwNodeIndex, SwIndex( pCNd, 0 ) ); SaveDocContext(xCntxt.get(), HtmlContextFlags::MultiColMask, &aNewPos); aId.clear(); diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 9d152e0d6bfa..0f304387ab58 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -1166,7 +1166,7 @@ bool SwFieldVarPage::FillItemSet(SfxItemSet* ) else { nSubType--; - OUString sSeparator = OUString(m_xSeparatorED->get_text()[0]); + OUString sSeparator(m_xSeparatorED->get_text()[0]); cSeparator = !sSeparator.isEmpty() ? sSeparator[0] : ' '; } break; diff --git a/sw/source/ui/vba/vbalisthelper.cxx b/sw/source/ui/vba/vbalisthelper.cxx index 0fed4ca41936..e1284240e4e0 100644 --- a/sw/source/ui/vba/vbalisthelper.cxx +++ b/sw/source/ui/vba/vbalisthelper.cxx @@ -379,7 +379,7 @@ void SwVbaListHelper::CreateOutlineNumberForType1() void SwVbaListHelper::CreateOutlineNumberForType2() { sal_Int16 nParentNumbering = 0; - OUString sSuffix = OUString( '.' ); + OUString sSuffix( '.' ); uno::Sequence< beans::PropertyValue > aPropertyValues; for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ ) |