summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-26 13:27:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-27 10:24:14 +0100
commit8be5a49f377e5451da953aee598fd22f9665fbd6 (patch)
treed8aad16822c91a6a3115824e3840530e4d59a012
parent814e50e6622ea9701094f3ec309a395d175c494f (diff)
drop old tools/gen.hxx methods in sc
Change-Id: I3652c0a35a6873e80ee22d908a8969d09410776b Reviewed-on: https://gerrit.libreoffice.org/50361 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/core/data/drwlayer.cxx42
-rw-r--r--sc/source/core/data/postit.cxx2
-rw-r--r--sc/source/filter/excel/xlpage.cxx7
-rw-r--r--sc/source/ui/cctrl/cbuttonw.cxx6
-rw-r--r--sc/source/ui/cctrl/tbzoomsliderctrl.cxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx24
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/notemark.cxx2
-rw-r--r--sc/source/ui/view/output.cxx2
-rw-r--r--sc/source/ui/view/output3.cxx8
-rw-r--r--sc/source/ui/view/preview.cxx2
-rw-r--r--sc/source/ui/view/printfun.cxx6
-rw-r--r--sc/source/ui/view/tabview5.cxx4
13 files changed, 55 insertions, 54 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 537e99791005..9ed0568b45fe 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -214,22 +214,12 @@ inline long HmmToTwips (long nVal)
FUNIT_100TH_MM, FUNIT_TWIP) );
}
-inline void TwipsToMM( long& nVal )
-{
- nVal = TwipsToHmm (nVal);
-}
-
-inline void ReverseTwipsToMM( long& nVal )
-{
- nVal = HmmToTwips (nVal);
-}
-
static void lcl_ReverseTwipsToMM( tools::Rectangle& rRect )
{
- ReverseTwipsToMM( rRect.Left() );
- ReverseTwipsToMM( rRect.Right() );
- ReverseTwipsToMM( rRect.Top() );
- ReverseTwipsToMM( rRect.Bottom() );
+ rRect.SetLeft( HmmToTwips( rRect.Left() ) );
+ rRect.SetRight( HmmToTwips( rRect.Right() ) );
+ rRect.SetTop( HmmToTwips( rRect.Top()) );
+ rRect.SetBottom( HmmToTwips(rRect.Bottom()) );
}
ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const OUString& rName ) :
@@ -643,15 +633,15 @@ void ScDrawLayer::ResizeLastRectFromAnchor( const SdrObject* pObj, ScDrawObjData
SCROW nRow2 = rData.maEnd.Row();
SCTAB nTab2 = rData.maEnd.Tab();
Point aPos( pDoc->GetColOffset( nCol1, nTab1, bHiddenAsZero ), pDoc->GetRowOffset( nRow1, nTab1, bHiddenAsZero ) );
- TwipsToMM( aPos.X() );
- TwipsToMM( aPos.Y() );
+ aPos.setX(TwipsToHmm( aPos.X() ));
+ aPos.setY(TwipsToHmm( aPos.Y() ));
aPos += lcl_calcAvailableDiff(*pDoc, nCol1, nRow1, nTab1, rData.maStartOffset);
if( bCanResize )
{
Point aEnd( pDoc->GetColOffset( nCol2, nTab2, bHiddenAsZero ), pDoc->GetRowOffset( nRow2, nTab2, bHiddenAsZero ) );
- TwipsToMM( aEnd.X() );
- TwipsToMM( aEnd.Y() );
+ aEnd.setX(TwipsToHmm( aEnd.X() ));
+ aEnd.setY(TwipsToHmm( aEnd.Y() ));
aEnd += lcl_calcAvailableDiff(*pDoc, nCol2, nRow2, nTab2, rData.maEndOffset);
tools::Rectangle aNew = tools::Rectangle( aPos, aEnd );
@@ -707,8 +697,8 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
rData.maLastRect = pObj->GetLogicRect();
Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
- TwipsToMM( aPos.X() );
- TwipsToMM( aPos.Y() );
+ aPos.setX(TwipsToHmm( aPos.X() ));
+ aPos.setY(TwipsToHmm( aPos.Y() ));
// Calculations and values as in detfunc.cxx
@@ -749,8 +739,8 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
aPos.AdjustX(pDoc->GetColWidth( nCol1, nTab1 ) / 4 );
if (!pDoc->RowHidden(nRow1, nTab1, nullptr, &nLastRow))
aPos.AdjustY(pDoc->GetRowHeight( nRow1, nTab1 ) / 2 );
- TwipsToMM( aPos.X() );
- TwipsToMM( aPos.Y() );
+ aPos.setX(TwipsToHmm( aPos.X() ));
+ aPos.setY(TwipsToHmm( aPos.Y() ));
Point aStartPos = aPos;
if ( bNegativePage )
aStartPos.setX( -aStartPos.X() ); // don't modify aPos - used below
@@ -787,8 +777,8 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
aPos.AdjustX(pDoc->GetColWidth( nCol2, nTab2 ) / 4 );
if (!pDoc->RowHidden(nRow2, nTab2, nullptr, &nLastRow))
aPos.AdjustY(pDoc->GetRowHeight( nRow2, nTab2 ) / 2 );
- TwipsToMM( aPos.X() );
- TwipsToMM( aPos.Y() );
+ aPos.setX(TwipsToHmm( aPos.X() ));
+ aPos.setY(TwipsToHmm( aPos.Y() ));
Point aEndPos = aPos;
if ( bNegativePage )
aEndPos.setX( -aEndPos.X() ); // don't modify aPos - used below
@@ -1225,10 +1215,10 @@ bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
{
aTestRect.SetBottom( aTestRect.Top() );
aTestRect.AdjustBottom(pDoc->GetRowHeight( nStartRow, nEndRow, nTab) );
- TwipsToMM( aTestRect.Bottom() );
+ aTestRect.SetBottom(TwipsToHmm( aTestRect.Bottom() ));
}
- TwipsToMM( aTestRect.Top() );
+ aTestRect.SetTop(TwipsToHmm( aTestRect.Top() ));
aTestRect.SetLeft( 0 );
aTestRect.SetRight( MAXMM );
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index f46e619c201e..d9c87af47391 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -366,7 +366,7 @@ Point ScCaptionCreator::CalcTailPos( bool bTailFront )
Point aTailPos = bTailLeft ? maCellRect.TopLeft() : maCellRect.TopRight();
// move caption point 1/10 mm inside cell
if( bTailLeft ) aTailPos.AdjustX(10 ); else aTailPos.AdjustX( -10 );
- aTailPos.Y() += 10;
+ aTailPos.AdjustY(10);
return aTailPos;
}
diff --git a/sc/source/filter/excel/xlpage.cxx b/sc/source/filter/excel/xlpage.cxx
index 08327c90bbcc..ef9c68ca65e5 100644
--- a/sc/source/filter/excel/xlpage.cxx
+++ b/sc/source/filter/excel/xlpage.cxx
@@ -220,7 +220,12 @@ Size XclPageData::GetScPaperSize() const
aSize = SvxPaperInfo::GetDefaultPaperSize();
if( !mbPortrait )
- ::std::swap( aSize.Width(), aSize.Height() );
+ {
+ // swap width and height
+ long n = aSize.Width();
+ aSize.setWidth(aSize.Height());
+ aSize.setHeight(n);
+ }
return aSize;
}
diff --git a/sc/source/ui/cctrl/cbuttonw.cxx b/sc/source/ui/cctrl/cbuttonw.cxx
index 0b0965f61e90..acca81ea9266 100644
--- a/sc/source/ui/cctrl/cbuttonw.cxx
+++ b/sc/source/ui/cctrl/cbuttonw.cxx
@@ -71,7 +71,7 @@ void ScDDComboBoxButton::Draw( const Point& rAt,
aInnerRect.AdjustLeft(1 );
aInnerRect.AdjustTop(1 );
aInnerRect.AdjustRight( -1 );
- aInnerRect.Bottom() -= 1;
+ aInnerRect.AdjustBottom( -1 );
Size aInnerSize = aInnerRect.GetSize();
Point aInnerCenter = aInnerRect.Center();
@@ -128,8 +128,8 @@ void ScDDComboBoxButton::ImpDrawArrow( const tools::Rectangle& rRect )
while( aPos1.X() <= aPos2.X() )
{
pOut->DrawLine( aPos1, aPos2 );
- aPos1.AdjustX( 1 ); aPos2.X()--;
- aPos1.AdjustY( 1 ); aPos2.Y()++;
+ aPos1.AdjustX( 1 ); aPos2.AdjustX( -1 );
+ aPos1.AdjustY( 1 ); aPos2.AdjustY( 1 );
}
pOut->DrawLine( Point( aCenter.X() - aSize3.Width(), aPos1.Y()+1 ),
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 09ae675c052a..b0e7c6d3d8c0 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -463,7 +463,7 @@ void ScZoomSliderWnd::DoPaint(vcl::RenderContext& rRenderContext)
Point aImagePoint = aRect.TopLeft();
aImagePoint.AdjustX(Zoom2Offset(mpImpl->mnCurrentZoom) );
aImagePoint.AdjustX( -(nButtonWidth / 2) );
- aImagePoint.Y() += (aSliderWindowSize.Height() - nButtonHeight) / 2;
+ aImagePoint.AdjustY( (aSliderWindowSize.Height() - nButtonHeight) / 2 );
pVDev->DrawImage(aImagePoint, mpImpl->maSliderButton);
// draw decrease button
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 17f597270876..f9e78ba99034 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2111,10 +2111,11 @@ tools::Rectangle ScDocShell::GetVisArea( sal_uInt16 nAspect ) const
namespace {
-void SnapHor( const ScDocument& rDoc, SCTAB nTab, long& rVal, SCCOL& rStartCol )
+SAL_WARN_UNUSED_RESULT
+long SnapHorizontal( const ScDocument& rDoc, SCTAB nTab, long nVal, SCCOL& rStartCol )
{
SCCOL nCol = 0;
- long nTwips = static_cast<long>(rVal / HMM_PER_TWIPS);
+ long nTwips = static_cast<long>(nVal / HMM_PER_TWIPS);
long nSnap = 0;
while ( nCol<MAXCOL )
{
@@ -2127,14 +2128,16 @@ void SnapHor( const ScDocument& rDoc, SCTAB nTab, long& rVal, SCCOL& rStartCol )
else
break;
}
- rVal = static_cast<long>( nSnap * HMM_PER_TWIPS );
+ nVal = static_cast<long>( nSnap * HMM_PER_TWIPS );
rStartCol = nCol;
+ return nVal;
}
-void SnapVer( const ScDocument& rDoc, SCTAB nTab, long& rVal, SCROW& rStartRow )
+SAL_WARN_UNUSED_RESULT
+long SnapVertical( const ScDocument& rDoc, SCTAB nTab, long nVal, SCROW& rStartRow )
{
SCROW nRow = 0;
- long nTwips = static_cast<long>(rVal / HMM_PER_TWIPS);
+ long nTwips = static_cast<long>(nVal / HMM_PER_TWIPS);
long nSnap = 0;
bool bFound = false;
@@ -2163,8 +2166,9 @@ void SnapVer( const ScDocument& rDoc, SCTAB nTab, long& rVal, SCROW& rStartRow )
if (!bFound)
nRow = MAXROW; // all hidden down to the bottom
- rVal = static_cast<long>( nSnap * HMM_PER_TWIPS );
+ nVal = static_cast<long>( nSnap * HMM_PER_TWIPS );
rStartRow = nRow;
+ return nVal;
}
}
@@ -2177,14 +2181,14 @@ void ScDocShell::SnapVisArea( tools::Rectangle& rRect ) const
ScDrawLayer::MirrorRectRTL( rRect ); // calculate with positive (LTR) values
SCCOL nCol = 0;
- SnapHor( aDocument, nTab, rRect.Left(), nCol );
+ rRect.SetLeft( SnapHorizontal( aDocument, nTab, rRect.Left(), nCol ) );
++nCol; // at least one column
- SnapHor( aDocument, nTab, rRect.Right(), nCol );
+ rRect.SetRight( SnapHorizontal( aDocument, nTab, rRect.Right(), nCol ) );
SCROW nRow = 0;
- SnapVer( aDocument, nTab, rRect.Top(), nRow );
+ rRect.SetTop( SnapVertical( aDocument, nTab, rRect.Top(), nRow ) );
++nRow; // at least one row
- SnapVer( aDocument, nTab, rRect.Bottom(), nRow );
+ rRect.SetBottom( SnapVertical( aDocument, nTab, rRect.Bottom(), nRow ) );
if ( bNegativePage )
ScDrawLayer::MirrorRectRTL( rRect ); // back to real rectangle
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 33a2d1626596..fb2ac988fd25 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1038,7 +1038,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
tools::Rectangle aCellRect( OutputToScreenPixel(aPos), Size(nSizeX,nSizeY) );
aPos.AdjustX( -1 );
- aPos.Y() += nSizeY - 1;
+ aPos.AdjustY( nSizeY - 1 );
mpFilterFloat.reset(VclPtr<ScFilterFloatingWindow>::Create(this, WinBits(WB_BORDER)));
mpFilterFloat->SetPopupModeEndHdl(LINK( this, ScGridWindow, PopupModeEndHdl));
diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx
index d8b3021168eb..fe6f89476de2 100644
--- a/sc/source/ui/view/notemark.cxx
+++ b/sc/source/ui/view/notemark.cxx
@@ -145,7 +145,7 @@ static MapMode lcl_MoveMapMode( const MapMode& rMap, const Size& rMove )
MapMode aNew = rMap;
Point aOrigin = aNew.GetOrigin();
aOrigin.AdjustX( -(rMove.Width()) );
- aOrigin.Y() -= rMove.Height();
+ aOrigin.AdjustY( -rMove.Height() );
aNew.SetOrigin(aOrigin);
return aNew;
}
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index e01710039ad3..9bf0c94d3b88 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -833,7 +833,7 @@ void drawDataBars(vcl::RenderContext& rRenderContext, const ScDataBarInfo* pOldD
tools::Rectangle aPaintRect = rRect;
aPaintRect.AdjustTop(2 * nOneY );
aPaintRect.AdjustBottom( -(2 * nOneY) );
- aPaintRect.Left() += 2 * nOneX;
+ aPaintRect.AdjustLeft( 2 * nOneX );
aPaintRect.AdjustRight( -(2 * nOneX) );
if(pOldDataBarInfo->mnZero)
{
diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx
index d86fcb3fcc36..270d974e3a0b 100644
--- a/sc/source/ui/view/output3.cxx
+++ b/sc/source/ui/view/output3.cxx
@@ -45,7 +45,7 @@ Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY )
for (nCol=0; nCol<nX1; nCol++)
aOffset.AdjustX( -(mpDoc->GetColWidth( nCol, nTab ) * nLayoutSign) );
- aOffset.Y() -= mpDoc->GetRowHeight( 0, nY1-1, nTab );
+ aOffset.AdjustY( -sal_Int32(mpDoc->GetRowHeight( 0, nY1-1, nTab )) );
long nDataWidth = 0;
for (nCol=nX1; nCol<=nX2; nCol++)
@@ -54,8 +54,10 @@ Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY )
if ( bLayoutRTL )
aOffset.AdjustX(nDataWidth );
- aRect.Left() = aRect.Right() = -aOffset.X();
- aRect.Top() = aRect.Bottom() = -aOffset.Y();
+ aRect.SetLeft( -aOffset.X() );
+ aRect.SetRight( -aOffset.X() );
+ aRect.SetTop( -aOffset.Y() );
+ aRect.SetBottom( -aOffset.Y() );
Point aMMOffset( aOffset );
aMMOffset.setX( static_cast<long>(aMMOffset.X() * HMM_PER_TWIPS) );
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index b3bf1aa0db7e..ae4a3fc029cf 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -815,7 +815,7 @@ sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly)
// -> add only 0.10cm, so there is some margin in all cases.
Size aMarginSize( LogicToPixel(Size(100, 100), MapMode(MapUnit::Map100thMM)) );
aWinSize.AdjustWidth( -(2 * aMarginSize.Width()) );
- aWinSize.Height() -= 2 * aMarginSize.Height();
+ aWinSize.AdjustHeight( -(2 * aMarginSize.Height()) );
Size aLocalPageSize = lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab );
if ( aLocalPageSize.Width() && aLocalPageSize.Height() )
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index e4c6dc309a80..09819b9c2f2c 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1093,7 +1093,7 @@ Size ScPrintFunc::GetDataSize() const
{
Size aSize = aPageSize;
aSize.AdjustWidth( -(nLeftMargin + nRightMargin) );
- aSize.Height() -= nTopMargin + nBottomMargin;
+ aSize.AdjustHeight( -(nTopMargin + nBottomMargin) );
aSize.AdjustHeight( -(aHdr.nHeight + aFtr.nHeight) );
return aSize;
}
@@ -1102,7 +1102,7 @@ void ScPrintFunc::GetScaleData( Size& rPhysSize, long& rDocHdr, long& rDocFtr )
{
rPhysSize = aPageSize;
rPhysSize.AdjustWidth( -(nLeftMargin + nRightMargin) );
- rPhysSize.Height() -= nTopMargin + nBottomMargin;
+ rPhysSize.AdjustHeight( -(nTopMargin + nBottomMargin) );
rDocHdr = aHdr.nHeight;
rDocFtr = aFtr.nHeight;
@@ -1538,7 +1538,7 @@ void ScPrintFunc::LocateArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
Point aTwipOffset;
for (nCol=0; nCol<nX1; nCol++)
aTwipOffset.AdjustX( -(pDoc->GetColWidth( nCol, nPrintTab )) );
- aTwipOffset.Y() -= pDoc->GetRowHeight( 0, nY1-1, nPrintTab );
+ aTwipOffset.AdjustY( -sal_Int32(pDoc->GetRowHeight( 0, nY1-1, nPrintTab )) );
Point aMMOffset( aTwipOffset );
aMMOffset.setX( static_cast<long>(aMMOffset.X() * HMM_PER_TWIPS) );
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 59c12f27a39d..f263f3daaff3 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -668,9 +668,9 @@ void ScTabView::OnLOKNoteStateChanged(const ScPostIt* pNote)
const int nBorderSize = 200;
tools::Rectangle aInvalidRect = aRect;
aInvalidRect.AdjustLeft( -nBorderSize );
- aInvalidRect.Right() += nBorderSize;
+ aInvalidRect.AdjustRight( nBorderSize );
aInvalidRect.AdjustTop( -nBorderSize );
- aInvalidRect.Bottom() += nBorderSize;
+ aInvalidRect.AdjustBottom( nBorderSize );
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
while (pViewShell)