summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-06-21 12:14:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-06-25 13:53:21 +0200
commit4583911575edf98ccd5b15af8eafa6a3a7b64034 (patch)
treef3f33e53c45dd870f19e7e42db9bb5b4bf1f23bf /sc
parent1942182a3d1817bc539229d7fda3af69f7e295b8 (diff)
improve loplugin:simplifyconstruct
Change-Id: If863d28c6db470faa0d22273020888d4219e069e Reviewed-on: https://gerrit.libreoffice.org/74559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/extras/anchor.cxx2
-rw-r--r--sc/qa/extras/scpdfexport.cxx6
-rw-r--r--sc/qa/unit/ucalc.cxx6
-rw-r--r--sc/qa/unit/ucalc_sort.cxx2
-rw-r--r--sc/source/core/data/column.cxx2
-rw-r--r--sc/source/core/data/column2.cxx2
-rw-r--r--sc/source/core/tool/detfunc.cxx2
-rw-r--r--sc/source/core/tool/sharedformula.cxx2
-rw-r--r--sc/source/filter/excel/xename.cxx4
-rw-r--r--sc/source/filter/oox/pivottablebuffer.cxx6
-rw-r--r--sc/source/filter/oox/sheetdatabuffer.cxx2
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx4
-rw-r--r--sc/source/filter/xml/xmltransformationi.cxx4
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx2
-rw-r--r--sc/source/ui/view/cellsh.cxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx4
-rw-r--r--sc/source/ui/view/gridwin4.cxx2
-rw-r--r--sc/source/ui/view/printfun.cxx4
18 files changed, 28 insertions, 30 deletions
diff --git a/sc/qa/extras/anchor.cxx b/sc/qa/extras/anchor.cxx
index 9e0e920ec281..8d61466b5a29 100644
--- a/sc/qa/extras/anchor.cxx
+++ b/sc/qa/extras/anchor.cxx
@@ -170,7 +170,7 @@ void ScAnchorTest::testTdf76183()
SdrPage* pPage = pDrawLayer->GetPage(0);
// Add a circle somewhere below first row.
- const tools::Rectangle aOrigRect = tools::Rectangle(1000, 1000, 1200, 1200);
+ const tools::Rectangle aOrigRect(1000, 1000, 1200, 1200);
SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
pPage->InsertObject(pObj);
// Anchor to cell
diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index 18ed4d166891..c21cdaa2dde7 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -84,8 +84,7 @@ void ScPDFExportTest::setUp()
xTargetFrame = xDesktop->findFrame("_blank", 0);
CPPUNIT_ASSERT(xTargetFrame.is());
- uno::Reference<frame::XModel> xModel
- = uno::Reference<frame::XModel>(mxComponent, uno::UNO_QUERY);
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
uno::Reference<frame::XModel2> xModel2(xModel, UNO_QUERY);
CPPUNIT_ASSERT(xModel2.is());
@@ -222,8 +221,7 @@ void ScPDFExportTest::setFont(ScFieldEditEngine& rEE, sal_Int32 nStart, sal_Int3
void ScPDFExportTest::testExportRange_Tdf120161()
{
// create test document
- uno::Reference<frame::XModel> xModel
- = uno::Reference<frame::XModel>(mxComponent, uno::UNO_QUERY);
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
uno::Reference<sheet::XSpreadsheetDocument> xDoc(xModel, uno::UNO_QUERY_THROW);
uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), UNO_SET_THROW);
uno::Reference<container::XIndexAccess> xIndex(xSheets, uno::UNO_QUERY_THROW);
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 06881c84b5bb..4db44ce1b6c1 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2765,7 +2765,7 @@ void Test::testGraphicsInGroup()
{
// Add a circle.
- tools::Rectangle aOrigRect = tools::Rectangle(10,10,210,210); // 200 x 200
+ tools::Rectangle aOrigRect(10,10,210,210); // 200 x 200
SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
pPage->InsertObject(pObj);
const tools::Rectangle& rNewRect = pObj->GetLogicRect();
@@ -3518,14 +3518,14 @@ void Test::testCopyPasteTranspose()
// transpose clipboard, paste and check on Sheet2
m_pDoc->InsertTab(1, "Sheet2");
- ScRange aSrcRange = ScRange(0,0,0,2,0,0);
+ ScRange aSrcRange(0,0,0,2,0,0);
ScDocument aNewClipDoc(SCDOCMODE_CLIP);
copyToClip(m_pDoc, aSrcRange, &aNewClipDoc);
ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP));
aNewClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::ALL, false);
- ScRange aDestRange = ScRange(3,1,1,3,3,1);//target: Sheet2.D2:D4
+ ScRange aDestRange(3,1,1,3,3,1);//target: Sheet2.D2:D4
ScMarkData aMark;
aMark.SetMarkArea(aDestRange);
m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pTransClip.get());
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index 00473f4d7757..689177d7e42e 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -1913,7 +1913,7 @@ void Test::testSortImages()
}
// Insert graphic in cell B2.
- const tools::Rectangle aOrigRect = tools::Rectangle(1000, 1000, 1200, 1200);
+ const tools::Rectangle aOrigRect(1000, 1000, 1200, 1200);
SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT(pPage);
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 76fc911a82a6..7bf3eb55d5e6 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1925,7 +1925,7 @@ void ScColumn::UpdateDrawObjectsForRow( std::vector<SdrObject*>& pObjects, SCCOL
{
for (auto &pObject : pObjects)
{
- ScAddress aNewAddress = ScAddress(nTargetCol, nTargetRow, nTab);
+ ScAddress aNewAddress(nTargetCol, nTargetRow, nTab);
// Update draw object according to new anchor
ScDrawLayer* pDrawLayer = GetDoc()->GetDrawLayer();
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index b4dfbfac64aa..4bfacdde4190 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -397,7 +397,7 @@ long ScColumn::GetNeededSize(
pEngine->SetHyphenator( xXHyphenator );
}
- Size aPaper = Size( 1000000, 1000000 );
+ Size aPaper( 1000000, 1000000 );
if ( eOrient==SvxCellOrientation::Stacked && !bAsianVertical )
aPaper.setWidth( 1 );
else if (bBreak)
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 9d52ba167d4c..48a6c432db1e 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -550,7 +550,7 @@ void ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
long nPageSign = bNegativePage ? -1 : 1;
Point aStartPos = GetDrawPos( nStartCol, nStartRow, DrawPosMode::DetectiveArrow );
- Point aEndPos = Point( aStartPos.X() + 1000 * nPageSign, aStartPos.Y() - 1000 );
+ Point aEndPos( aStartPos.X() + 1000 * nPageSign, aStartPos.Y() - 1000 );
if (aEndPos.Y() < 0)
aEndPos.AdjustY(2000 );
diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx
index ea815b115aeb..daef7a95d082 100644
--- a/sc/source/core/tool/sharedformula.cxx
+++ b/sc/source/core/tool/sharedformula.cxx
@@ -432,7 +432,7 @@ void SharedFormulaUtil::startListeningAsGroup( sc::StartListeningContext& rCxt,
ScAddress aPos1 = rRef1.toAbs(rTopCell.aPos);
ScAddress aPos2 = rRef2.toAbs(rTopCell.aPos);
- ScRange aOrigRange = ScRange(aPos1, aPos2);
+ ScRange aOrigRange(aPos1, aPos2);
ScRange aListenedRange = aOrigRange;
if (rRef2.IsRowRel())
aListenedRange.aEnd.IncRow(xGroup->mnLength-1);
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 35d84b86194e..599d001b29b2 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -542,7 +542,7 @@ void XclExpNameManagerImpl::SaveXml( XclExpXmlStream& rStrm )
sal_uInt16 XclExpNameManagerImpl::FindNamedExp( SCTAB nTab, OUString sName )
{
- NamedExpMap::key_type key = NamedExpMap::key_type(nTab, sName);
+ NamedExpMap::key_type key(nTab, sName);
NamedExpMap::const_iterator itr = maNamedExpMap.find(key);
return (itr == maNamedExpMap.end()) ? 0 : itr->second;
}
@@ -617,7 +617,7 @@ sal_uInt16 XclExpNameManagerImpl::CreateName( SCTAB nTab, const ScRangeData& rRa
xName->SetLocalTab(nTab);
sal_uInt16 nNameIdx = Append( xName );
// store the index of the NAME record in the lookup map
- NamedExpMap::key_type key = NamedExpMap::key_type(nTab, rRangeData.GetName());
+ NamedExpMap::key_type key(nTab, rRangeData.GetName());
maNamedExpMap[key] = nNameIdx;
/* Create the definition formula.
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx
index 8af348942bcd..e9cc4010b673 100644
--- a/sc/source/filter/oox/pivottablebuffer.cxx
+++ b/sc/source/filter/oox/pivottablebuffer.cxx
@@ -1223,9 +1223,9 @@ void PivotTable::finalizeImport()
Reference< XDataPilotTables > xDPTables( xDPTablesSupp->getDataPilotTables(), UNO_SET_THROW );
mxDPDescriptor.set( xDPTables->createDataPilotDescriptor(), UNO_SET_THROW );
ScRange aRange = mpPivotCache->getSourceRange();
- CellRangeAddress aCellRangeAddress = CellRangeAddress( aRange.aStart.Tab(),
- aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row() );
+ CellRangeAddress aCellRangeAddress( aRange.aStart.Tab(),
+ aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row() );
mxDPDescriptor->setSourceRange( aCellRangeAddress );
mxDPDescriptor->setTag( maDefModel.maTag );
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index fcc54e1880b1..1408d432e3d3 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -256,7 +256,7 @@ void SheetDataBuffer::setFormulaCell( const CellModel& rModel, const ApiTokenSeq
array formula. In this case, the cell will be remembered. After
reading the formula definition it will be retried to insert the
formula via retryPendingSharedFormulaCell(). */
- ScAddress aTokenAddr = ScAddress ( aTokenInfo.First.Column, aTokenInfo.First.Row, aTokenInfo.First.Sheet );
+ ScAddress aTokenAddr( aTokenInfo.First.Column, aTokenInfo.First.Row, aTokenInfo.First.Sheet );
BinAddress aBaseAddr( aTokenAddr );
aTokens = resolveSharedFormula( aTokenAddr );
if( !aTokens.hasElements() )
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index c4bd8fa8c292..77d8bd7cd048 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2734,8 +2734,8 @@ bool ScXMLExport::GetMerged (const table::CellRangeAddress* pCellAddress,
uno::Reference<sheet::XCellRangeAddressable> xCellAddress (xCursor, uno::UNO_QUERY);
xCursor->collapseToMergedArea();
table::CellRangeAddress aCellAddress2(xCellAddress->getRangeAddress());
- ScRange aScRange = ScRange( aCellAddress2.StartColumn, aCellAddress2.StartRow, aCellAddress2.Sheet,
- aCellAddress2.EndColumn, aCellAddress2.EndRow, aCellAddress2.Sheet );
+ ScRange aScRange( aCellAddress2.StartColumn, aCellAddress2.StartRow, aCellAddress2.Sheet,
+ aCellAddress2.EndColumn, aCellAddress2.EndRow, aCellAddress2.Sheet );
if ((aScRange.aEnd.Row() > nRow ||
aScRange.aEnd.Col() > nCol) &&
diff --git a/sc/source/filter/xml/xmltransformationi.cxx b/sc/source/filter/xml/xmltransformationi.cxx
index c8e3d4768900..6c2871b138e6 100644
--- a/sc/source/filter/xml/xmltransformationi.cxx
+++ b/sc/source/filter/xml/xmltransformationi.cxx
@@ -260,7 +260,7 @@ ScXMLColumnTextContext::ScXMLColumnTextContext(
: ScXMLImportContext(rImport)
, maType(sc::TEXT_TRANSFORM_TYPE::TO_LOWER)
{
- OUString aType = OUString();
+ OUString aType;
if (rAttrList.is())
{
@@ -339,7 +339,7 @@ ScXMLColumnAggregateContext::ScXMLColumnAggregateContext(
: ScXMLImportContext(rImport)
, maType(sc::AGGREGATE_FUNCTION::SUM)
{
- OUString aType = OUString();
+ OUString aType;
if (rAttrList.is())
{
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index bddb591f0391..4887523e09c5 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -243,7 +243,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
Size aStrSize;
sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow, true ));
- Point aPos = Point(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
+ Point aPos(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
sal_uInt16 nRightX = 0;
bool bJustify = pCurData->GetIncludeJustify();
SvxCellHorJustify eJustification;
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 3d21cd96d3c3..4f6bbb937ce4 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -1189,7 +1189,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case FID_DEFINE_CURRENT_NAME:
{
- ScAddress aCurrentAddress = ScAddress( nPosX, nPosY, nTab );
+ ScAddress aCurrentAddress( nPosX, nPosY, nTab );
if ( pDoc &&
!pDoc->IsAddressInRangeName( RangeNameScope::GLOBAL, aCurrentAddress ) &&
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index dce120c95779..74826da1aa37 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5674,8 +5674,8 @@ bool ScGridWindow::InsideVisibleRange( SCCOL nPosX, SCROW nPosY )
OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight,
long nTileWidth, long nTileHeight )
{
- Fraction zoomX = Fraction(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth);
- Fraction zoomY = Fraction(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight);
+ Fraction zoomX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth);
+ Fraction zoomY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight);
return getCellCursor(zoomX, zoomY);
}
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 663ce00737ca..5e1280cbd98f 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -666,7 +666,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
MapMode aCurrentMapMode(pContentDev->GetMapMode());
pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
- tools::Rectangle aPixRect = tools::Rectangle( Point(), GetOutputSizePixel() );
+ tools::Rectangle aPixRect( Point(), GetOutputSizePixel() );
pContentDev->SetFillColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor );
pContentDev->SetLineColor();
if ( nX2==MAXCOL )
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 15664211f0ff..b2ca243b63e5 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1975,7 +1975,7 @@ long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, bool bDoPrint, ScPr
// adjust aPageRect for left/right page
- tools::Rectangle aTempRect = tools::Rectangle( Point(), aPageSize );
+ tools::Rectangle aTempRect( Point(), aPageSize );
if (IsMirror(nPageNo))
{
aPageRect.SetLeft( ( aTempRect.Left() + nRightMargin ) * 100 / nZoom );
@@ -2044,7 +2044,7 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
// adjust aPageRect for left/right page
- tools::Rectangle aTempRect = tools::Rectangle( Point(), aPageSize );
+ tools::Rectangle aTempRect( Point(), aPageSize );
if (IsMirror(nPageNo))
{
aPageRect.SetLeft( ( aTempRect.Left() + nRightMargin ) * 100 / nZoom );