Revert "remove Fraction::operator tools::Long()"

This reverts commit 48b667a7e7.

Reason for revert: some discussion required

Change-Id: Ia0990d280837fb68b7ddc9f472ec78b1467b4311
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105540
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-11-12 16:53:22 +01:00
parent 768cfcee17
commit c45753847d
48 changed files with 158 additions and 155 deletions
+1 -1
View File
@@ -493,7 +493,7 @@ void DlgEditor::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
Size aSize = rRenderContext.PixelToLogic( Size( 400, 300 ) );
// align with grid
Size aGridSize_(sal_Int32(pDlgEdView->GetSnapGridWidthX()), sal_Int32(pDlgEdView->GetSnapGridWidthY()));
Size aGridSize_(tools::Long(pDlgEdView->GetSnapGridWidthX()), tools::Long(pDlgEdView->GetSnapGridWidthY()));
aSize.AdjustWidth( -(aSize.Width() % aGridSize_.Width()) );
aSize.AdjustHeight( -(aSize.Height() % aGridSize_.Height()) );
+1 -1
View File
@@ -451,7 +451,7 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs)
if (m_xMtrRadius->get_value_changed_from_saved())
{
Fraction aUIScale = pView->GetModel()->GetUIScale();
tools::Long nTmp = sal_Int32(GetCoreValue(*m_xMtrRadius, ePoolUnit) * aUIScale);
tools::Long nTmp = tools::Long(GetCoreValue(*m_xMtrRadius, ePoolUnit) * aUIScale);
rAttrs->Put( makeSdrEckenradiusItem( nTmp ) );
bModified = true;
+3
View File
@@ -53,6 +53,9 @@ public:
sal_Int32 GetDenominator() const;
explicit operator sal_Int32() const;
#if SAL_TYPES_SIZEOFPOINTER == 8
explicit operator ::tools::Long() const { return sal_Int32(*this); }
#endif
explicit operator double() const;
Fraction& operator=( const Fraction& rfrFrac ) = default;
+1 -1
View File
@@ -46,7 +46,7 @@ void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl
{
Fraction aCornerSpace(tools::Long(CORNER_SPACE));
aCornerSpace *= rRenderContext.GetMapMode().GetScaleX();
const tools::Long nCornerSpace = sal_Int32(aCornerSpace);
const tools::Long nCornerSpace = tools::Long(aCornerSpace);
Size aSize = GetSizePixel();
aSize.AdjustWidth(nCornerSpace );
@@ -137,7 +137,7 @@ sal_Int32 OReportWindow::getMaxMarkerWidth() const
{
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH));
aStartWidth *= m_aViewsWindow->GetMapMode().GetScaleX();
return static_cast<sal_Int32>(aStartWidth);
return sal_Int32(static_cast<tools::Long>(aStartWidth));
}
sal_Int32 OReportWindow::GetTotalWidth() const
@@ -149,9 +149,9 @@ sal_Int32 OReportWindow::GetTotalWidth() const
const Fraction aZoom(m_pView->getController().getZoomValue(),100);
aStartWidth *= aZoom;
sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
nPaperWidth = sal_Int32(nPaperWidth * aZoom);
nPaperWidth = tools::Long(nPaperWidth * aZoom);
const Size aPageSize = LogicToPixel(Size(nPaperWidth,0));
nWidth = aPageSize.Width() + sal_Int32(aStartWidth);
nWidth = aPageSize.Width() + tools::Long(aStartWidth);
}
return nWidth;
}
@@ -166,7 +166,7 @@ void OReportWindow::Resize()
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100);
const Point aOffset = LogicToPixel(Point(SECTION_OFFSET, 0), MapMode(MapUnit::MapAppFont));
Point aStartPoint(static_cast<sal_Int32>(aStartWidth) + aOffset.X(),0);
Point aStartPoint(static_cast<tools::Long>(aStartWidth) + aOffset.X(),0);
uno::Reference<report::XReportDefinition> xReportDefinition = getReportView()->getController().getReportDefinition();
const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
@@ -404,14 +404,14 @@ sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const
break;
case SvxZoomType::WHOLEPAGE:
{
nZoom = static_cast<sal_uInt16>(static_cast<sal_Int32>(Fraction(aSize.Width()*100,impl_getRealPixelWidth())));
nZoom = static_cast<sal_uInt16>(static_cast<tools::Long>(Fraction(aSize.Width()*100,impl_getRealPixelWidth())));
MapMode aMap( MapUnit::Map100thMM );
const Size aHeight = m_aViewsWindow->LogicToPixel(m_aViewsWindow->PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler->GetSizePixel().Height())),aMap);
nZoom = ::std::min(nZoom,static_cast<sal_uInt16>(static_cast<sal_Int32>(Fraction(aSize.Height()*100,aHeight.Height()))));
nZoom = ::std::min(nZoom,static_cast<sal_uInt16>(static_cast<tools::Long>(Fraction(aSize.Height()*100,aHeight.Height()))));
}
break;
case SvxZoomType::PAGEWIDTH:
nZoom = static_cast<sal_uInt16>(static_cast<sal_Int32>(Fraction(aSize.Width()*100,impl_getRealPixelWidth())));
nZoom = static_cast<sal_uInt16>(static_cast<tools::Long>(Fraction(aSize.Width()*100,impl_getRealPixelWidth())));
break;
default:
break;
@@ -172,8 +172,8 @@ Size OScrollWindowHelper::ResizeScrollBars()
// resize scrollbars and set their ranges
{
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100);
const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - static_cast<sal_Int32>(aStartWidth);
lcl_setScrollBar(nNewWidth,Point( static_cast<sal_Int32>(aStartWidth) + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll);
const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - static_cast<tools::Long>(aStartWidth);
lcl_setScrollBar(nNewWidth,Point( static_cast<tools::Long>(aStartWidth) + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll);
}
{
const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow->getRulerHeight();
@@ -227,7 +227,7 @@ void OSectionWindow::Resize()
Window::Resize();
Size aOutputSize = GetOutputSizePixel();
tools::Long nEndWidth = sal_Int32(REPORT_ENDMARKER_WIDTH * GetMapMode().GetScaleX());
tools::Long nEndWidth = tools::Long(REPORT_ENDMARKER_WIDTH * GetMapMode().GetScaleX());
const Point aThumbPos = m_pParent->getView()->getThumbPos();
aOutputSize.AdjustWidth( -(aThumbPos.X()) );
@@ -242,7 +242,7 @@ void OSectionWindow::Resize()
{
const bool bShowEndMarker = m_pParent->getView()->GetTotalWidth() <= (aThumbPos.X() + aOutputSize.Width() );
tools::Long nStartWidth = sal_Int32(REPORT_STARTMARKER_WIDTH * GetMapMode().GetScaleX());
tools::Long nStartWidth = tools::Long(REPORT_STARTMARKER_WIDTH * GetMapMode().GetScaleX());
// set start marker
m_aStartMarker->SetPosSizePixel(Point(0,0),Size(nStartWidth,aOutputSize.Height()));
@@ -101,7 +101,7 @@ sal_Int32 OStartMarker::getMinHeight() const
{
Fraction aExtraWidth(tools::Long(2 * REPORT_EXTRA_SPACE));
aExtraWidth *= GetMapMode().GetScaleX();
return LogicToPixel(Size(0, m_aText->GetTextHeight())).Height() + sal_Int32(aExtraWidth);
return LogicToPixel(Size(0, m_aText->GetTextHeight())).Height() + tools::Long(aExtraWidth);
}
void OStartMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
@@ -236,7 +236,7 @@ void OStartMarker::Resize()
aImageSize.setWidth( tools::Long(aImageSize.Width() * static_cast<double>(rMapMode.GetScaleX())) );
aImageSize.setHeight( tools::Long(aImageSize.Height() * static_cast<double>(rMapMode.GetScaleY())) );
tools::Long nExtraWidth = sal_Int32(REPORT_EXTRA_SPACE * rMapMode.GetScaleX());
tools::Long nExtraWidth = tools::Long(REPORT_EXTRA_SPACE * rMapMode.GetScaleX());
Point aPos(aImageSize.Width() + (nExtraWidth * 2), nExtraWidth);
const tools::Long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText->GetTextHeight())).Height());
@@ -257,7 +257,7 @@ void OViewsWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
rRenderContext.SetTextFillColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
Size aOut(GetOutputSizePixel());
tools::Long nStartWidth = sal_Int32(REPORT_STARTMARKER_WIDTH * rRenderContext.GetMapMode().GetScaleX());
tools::Long nStartWidth = tools::Long(REPORT_STARTMARKER_WIDTH * rRenderContext.GetMapMode().GetScaleX());
aOut.AdjustWidth( -nStartWidth );
aOut = rRenderContext.PixelToLogic(aOut);
@@ -1633,7 +1633,7 @@ void OViewsWindow::zoom(const Fraction& _aZoom)
Resize();
Size aOut = GetOutputSizePixel();
aOut.setWidth( sal_Int32(aStartWidth) );
aOut.setWidth( tools::Long(aStartWidth) );
aOut = PixelToLogic(aOut);
tools::Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
+2 -2
View File
@@ -73,7 +73,7 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH));
aStartWidth *= m_pParent->GetMapMode().GetScaleX();
aOut.AdjustWidth( -static_cast<sal_Int32>(aStartWidth) );
aOut.AdjustWidth( -static_cast<tools::Long>(aStartWidth) );
aOut.setHeight( m_pParent->GetOutputSizePixel().Height() );
Point aPos = pScrollWindow->getThumbPos();
@@ -82,7 +82,7 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
tools::Rectangle aOutRect( aPos, aOut );
aOutRect = m_pParent->PixelToLogic( aOutRect );
tools::Rectangle aWorkArea(Point(), pScrollWindow->getTotalSize());
aWorkArea.AdjustRight( -static_cast<sal_Int32>(aStartWidth) );
aWorkArea.AdjustRight( -static_cast<tools::Long>(aStartWidth) );
aWorkArea = pScrollWindow->PixelToLogic( aWorkArea );
if( !aOutRect.IsInside( rPos ) && aWorkArea.IsInside( rPos ) )
{
+2 -2
View File
@@ -440,7 +440,7 @@ tools::Long ScColumn::GetNeededSize(
constexpr tools::Long nFilterButtonWidthPix = 20; // Autofilter pixel width at 100% zoom.
if ( pFlag->HasAutoFilter() && !bTextWysiwyg )
nDocWidth -= bInPrintTwips ?
(nFilterButtonWidthPix * TWIPS_PER_PIXEL) : sal_Int32(rZoomX * nFilterButtonWidthPix);
(nFilterButtonWidthPix * TWIPS_PER_PIXEL) : tools::Long(rZoomX * nFilterButtonWidthPix);
aPaper.setWidth( nDocWidth );
@@ -596,7 +596,7 @@ tools::Long ScColumn::GetNeededSize(
ScMF nFlags = pPattern->GetItem(ATTR_MERGE_FLAG).GetValue();
if (nFlags & ScMF::Auto)
nValue += bInPrintTwips ?
(nFilterButtonWidthPix * TWIPS_PER_PIXEL) : sal_Int32(rZoomX * nFilterButtonWidthPix);
(nFilterButtonWidthPix * TWIPS_PER_PIXEL) : tools::Long(rZoomX * nFilterButtonWidthPix);
}
return nValue;
+1 -1
View File
@@ -206,7 +206,7 @@ void ScClient::ViewChanged()
tools::Rectangle aLogicRect = pDrawObj->GetLogicRect();
Fraction aFractX = GetScaleWidth() * aVisSize.Width();
Fraction aFractY = GetScaleHeight() * aVisSize.Height();
aVisSize = Size( static_cast<sal_Int32>(aFractX), static_cast<sal_Int32>(aFractY) ); // Scaled for Draw model
aVisSize = Size( static_cast<tools::Long>(aFractX), static_cast<tools::Long>(aFractY) ); // Scaled for Draw model
// pClientData->SetObjArea before pDrawObj->SetLogicRect, so that we don't
// calculate wrong scalings:
+4 -4
View File
@@ -2261,10 +2261,10 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
Fraction aScaleX( aLocationPixel.GetWidth(), aLocationMM.GetWidth() );
Fraction aScaleY( aLocationPixel.GetHeight(), aLocationMM.GetHeight() );
tools::Long nX1 = aLocationPixel.Left() + static_cast<sal_Int32>( Fraction( aTargetRect.Left() - aLocationMM.Left(), 1 ) * aScaleX );
tools::Long nX2 = aLocationPixel.Left() + static_cast<sal_Int32>( Fraction( aTargetRect.Right() - aLocationMM.Left(), 1 ) * aScaleX );
tools::Long nY1 = aLocationPixel.Top() + static_cast<sal_Int32>( Fraction( aTargetRect.Top() - aLocationMM.Top(), 1 ) * aScaleY );
tools::Long nY2 = aLocationPixel.Top() + static_cast<sal_Int32>( Fraction( aTargetRect.Bottom() - aLocationMM.Top(), 1 ) * aScaleY );
tools::Long nX1 = aLocationPixel.Left() + static_cast<tools::Long>( Fraction( aTargetRect.Left() - aLocationMM.Left(), 1 ) * aScaleX );
tools::Long nX2 = aLocationPixel.Left() + static_cast<tools::Long>( Fraction( aTargetRect.Right() - aLocationMM.Left(), 1 ) * aScaleX );
tools::Long nY1 = aLocationPixel.Top() + static_cast<tools::Long>( Fraction( aTargetRect.Top() - aLocationMM.Top(), 1 ) * aScaleY );
tools::Long nY2 = aLocationPixel.Top() + static_cast<tools::Long>( Fraction( aTargetRect.Bottom() - aLocationMM.Top(), 1 ) * aScaleY );
if ( nX1 > aLocationPixel.Right() ) nX1 = aLocationPixel.Right();
if ( nX2 > aLocationPixel.Right() ) nX2 = aLocationPixel.Right();
+1 -1
View File
@@ -1368,7 +1368,7 @@ sal_Int16 ScTabViewObj::GetZoom() const
if (pViewSh)
{
const Fraction& rZoomY = pViewSh->GetViewData().GetZoomY(); // Y will be shown
return static_cast<sal_Int16>(sal_Int32( rZoomY * 100 ));
return static_cast<sal_Int16>(tools::Long( rZoomY * 100 ));
}
return 0;
}
+1 -1
View File
@@ -141,7 +141,7 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle&
ScDDComboBoxButton aComboButton(pDev);
aComboButton.SetOptSizePixel();
tools::Long nBWidth = sal_Int32(aComboButton.GetSizePixel().Width() * rZoomY);
tools::Long nBWidth = tools::Long(aComboButton.GetSizePixel().Width() * rZoomY);
tools::Long nBHeight = nVer + aTextSize.Height() + 1;
Size aButSize( nBWidth, nBHeight );
tools::Long nButtonPos = bLayoutRTL ? aOuter.Left() : aOuter.Right()-nBWidth+1;
+2 -2
View File
@@ -737,7 +737,7 @@ void ScTabView::UpdateVarZoom()
bInZoomUpdate = true;
const Fraction& rOldX = GetViewData().GetZoomX();
const Fraction& rOldY = GetViewData().GetZoomY();
tools::Long nOldPercent = sal_Int32(rOldY * 100);
tools::Long nOldPercent = tools::Long(rOldY * 100);
sal_uInt16 nNewZoom = CalcZoom( eZoomType, static_cast<sal_uInt16>(nOldPercent) );
Fraction aNew( nNewZoom, 100 );
@@ -956,7 +956,7 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
// and can't be changed directly
const Fraction& rOldY = aViewData.GetZoomY();
tools::Long nOld = static_cast<sal_Int32>( rOldY * 100 );
tools::Long nOld = static_cast<tools::Long>( rOldY * 100 );
tools::Long nNew;
if ( pData->GetDelta() < 0 )
nNew = std::max( tools::Long(MINZOOM), basegfx::zoomtools::zoomOut( nOld ));
+1 -1
View File
@@ -698,7 +698,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
SvxZoomType eOldZoomType = GetZoomType();
SvxZoomType eNewZoomType = eOldZoomType;
const Fraction& rOldY = GetViewData().GetZoomY(); // Y is shown
sal_uInt16 nOldZoom = static_cast<sal_uInt16>(sal_Int32( rOldY * 100 ));
sal_uInt16 nOldZoom = static_cast<sal_uInt16>(tools::Long( rOldY * 100 ));
sal_uInt16 nZoom = nOldZoom;
bool bCancel = false;
+2 -2
View File
@@ -298,7 +298,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
else
{
const Fraction& rOldY = GetViewData().GetZoomY();
sal_uInt16 nZoom = static_cast<sal_uInt16>(sal_Int32( rOldY * 100 ));
sal_uInt16 nZoom = static_cast<sal_uInt16>(tools::Long( rOldY * 100 ));
rSet.Put( SvxZoomItem( SvxZoomType::PERCENT, nZoom, nWhich ) );
}
break;
@@ -310,7 +310,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
else
{
const Fraction& rOldY = GetViewData().GetZoomY();
sal_uInt16 nCurrentZoom = static_cast<sal_uInt16>(sal_Int32( rOldY * 100 ));
sal_uInt16 nCurrentZoom = static_cast<sal_uInt16>(tools::Long( rOldY * 100 ));
if( nCurrentZoom )
{
+10 -10
View File
@@ -575,8 +575,8 @@ void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>
pSettings[SC_POSITION_BOTTOM].Name = SC_POSITIONBOTTOM;
pSettings[SC_POSITION_BOTTOM].Value <<= sal_Int32(nPosY[SC_SPLIT_BOTTOM]);
sal_Int32 nZoomValue = sal_Int32(aZoomY * 100);
sal_Int32 nPageZoomValue = sal_Int32(aPageZoomY * 100);
sal_Int32 nZoomValue = tools::Long(aZoomY * 100);
sal_Int32 nPageZoomValue = tools::Long(aPageZoomY * 100);
pSettings[SC_TABLE_ZOOM_TYPE].Name = SC_ZOOMTYPE;
pSettings[SC_TABLE_ZOOM_TYPE].Value <<= sal_Int16(eZoomType);
pSettings[SC_TABLE_ZOOM_VALUE].Name = SC_ZOOMVALUE;
@@ -3098,8 +3098,8 @@ void ScViewData::UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY
aHeight *= Fraction( aScrSize.Height(),1 );
aHeight /= aOldY;
aScrSize.setWidth( static_cast<sal_Int32>(aWidth) );
aScrSize.setHeight( static_cast<sal_Int32>(aHeight) );
aScrSize.setWidth( static_cast<tools::Long>(aWidth) );
aScrSize.setHeight( static_cast<tools::Long>(aHeight) );
}
void ScViewData::CalcPPT()
@@ -3162,9 +3162,9 @@ void ScViewData::WriteUserData(OUString& rData)
// PosX[left]/PosX[right]/PosY[top]/PosY[bottom]
// when rows bigger than 8192, "+" instead of "/"
sal_uInt16 nZoom = static_cast<sal_uInt16>(sal_Int32(pThisTab->aZoomY * 100));
sal_uInt16 nZoom = static_cast<sal_uInt16>(tools::Long(pThisTab->aZoomY * 100));
rData = OUString::number( nZoom ) + "/";
nZoom = static_cast<sal_uInt16>(sal_Int32(pThisTab->aPageZoomY * 100));
nZoom = static_cast<sal_uInt16>(tools::Long(pThisTab->aPageZoomY * 100));
rData += OUString::number( nZoom ) + "/";
if (bPagebreak)
rData += "1";
@@ -3422,8 +3422,8 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
// view mode and zoom
rTabSett.mbPageMode = bPagebreak;
rTabSett.mnNormalZoom = static_cast< sal_Int32 >( pViewTab->aZoomY * Fraction( 100.0 ) );
rTabSett.mnPageZoom = static_cast< sal_Int32 >( pViewTab->aPageZoomY * Fraction( 100.0 ) );
rTabSett.mnNormalZoom = static_cast< tools::Long >( pViewTab->aZoomY * Fraction( 100.0 ) );
rTabSett.mnPageZoom = static_cast< tools::Long >( pViewTab->aPageZoomY * Fraction( 100.0 ) );
}
}
}
@@ -3640,8 +3640,8 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
pSettings[SC_ACTIVE_TABLE].Value <<= sName;
pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Name = SC_HORIZONTALSCROLLBARWIDTH;
pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Value <<= sal_Int32(pView->GetTabBarWidth());
sal_Int32 nZoomValue = sal_Int32(pThisTab->aZoomY * 100);
sal_Int32 nPageZoomValue = sal_Int32(pThisTab->aPageZoomY * 100);
sal_Int32 nZoomValue = tools::Long(pThisTab->aZoomY * 100);
sal_Int32 nPageZoomValue = tools::Long(pThisTab->aPageZoomY * 100);
pSettings[SC_ZOOM_TYPE].Name = SC_ZOOMTYPE;
pSettings[SC_ZOOM_TYPE].Value <<= sal_Int16(pThisTab->eZoomType);
pSettings[SC_ZOOM_VALUE].Name = SC_ZOOMVALUE;
@@ -348,7 +348,7 @@ void AnnotationWindow::Rescale()
if ( mpMeta )
{
vcl::Font aFont( mpMeta->GetSettings().GetStyleSettings().GetLabelFont() );
sal_Int32 nHeight = sal_Int32(aFont.GetFontHeight() * aMode.GetScaleY());
sal_Int32 nHeight = ::tools::Long(aFont.GetFontHeight() * aMode.GetScaleY());
aFont.SetFontHeight( nHeight );
mpMeta->SetControlFont( aFont );
}
+18 -18
View File
@@ -94,10 +94,10 @@ void CopyDlg::Reset()
// tdf#125011 draw/impress sizes are in mm_100th already, "normalize" to
// decimal shift by number of decimal places the widgets are using (2) then
// scale by the ui scaling factor
auto nPageWidth = sal_Int32(m_xMtrFldMoveX->normalize(aPageSize.Width()) / maUIScale);
auto nPageHeight = sal_Int32(m_xMtrFldMoveX->normalize(aPageSize.Height()) / maUIScale);
auto nRectWidth = sal_Int32(m_xMtrFldMoveX->normalize(aRect.GetWidth()) / maUIScale);
auto nRectHeight = sal_Int32(m_xMtrFldMoveX->normalize(aRect.GetHeight()) / maUIScale);
auto nPageWidth = tools::Long(m_xMtrFldMoveX->normalize(aPageSize.Width()) / maUIScale);
auto nPageHeight = tools::Long(m_xMtrFldMoveX->normalize(aPageSize.Height()) / maUIScale);
auto nRectWidth = tools::Long(m_xMtrFldMoveX->normalize(aRect.GetWidth()) / maUIScale);
auto nRectHeight = tools::Long(m_xMtrFldMoveX->normalize(aRect.GetHeight()) / maUIScale);
m_xMtrFldMoveX->set_range(-nPageWidth, nPageWidth, FieldUnit::MM_100TH);
m_xMtrFldMoveY->set_range(-nPageHeight, nPageHeight, FieldUnit::MM_100TH);
@@ -123,12 +123,12 @@ void CopyDlg::Reset()
tools::Long nMoveX = 500;
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) )
nMoveX = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
SetMetricValue( *m_xMtrFldMoveX, sal_Int32(nMoveX / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldMoveX, tools::Long(nMoveX / maUIScale), MapUnit::Map100thMM);
tools::Long nMoveY = 500;
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) )
nMoveY = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
SetMetricValue( *m_xMtrFldMoveY, sal_Int32(nMoveY / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldMoveY, tools::Long(nMoveY / maUIScale), MapUnit::Map100thMM);
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) )
m_xMtrFldAngle->set_value(static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(), FieldUnit::NONE);
@@ -138,12 +138,12 @@ void CopyDlg::Reset()
tools::Long nWidth = 0;
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) )
nWidth = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
SetMetricValue( *m_xMtrFldWidth, sal_Int32(nWidth / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldWidth, tools::Long(nWidth / maUIScale), MapUnit::Map100thMM);
tools::Long nHeight = 0;
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, true, &pPoolItem ) )
nHeight = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
SetMetricValue( *m_xMtrFldHeight, sal_Int32(nHeight / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldHeight, tools::Long(nHeight / maUIScale), MapUnit::Map100thMM);
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) )
{
@@ -179,10 +179,10 @@ void CopyDlg::Reset()
*/
void CopyDlg::GetAttr( SfxItemSet& rOutAttrs )
{
tools::Long nMoveX = sal_Int32( GetCoreValue( *m_xMtrFldMoveX, MapUnit::Map100thMM) * maUIScale);
tools::Long nMoveY = sal_Int32( GetCoreValue( *m_xMtrFldMoveY, MapUnit::Map100thMM) * maUIScale);
tools::Long nHeight = sal_Int32( GetCoreValue( *m_xMtrFldHeight, MapUnit::Map100thMM) * maUIScale);
tools::Long nWidth = sal_Int32( GetCoreValue( *m_xMtrFldWidth, MapUnit::Map100thMM) * maUIScale);
tools::Long nMoveX = tools::Long( GetCoreValue( *m_xMtrFldMoveX, MapUnit::Map100thMM) * maUIScale);
tools::Long nMoveY = tools::Long( GetCoreValue( *m_xMtrFldMoveY, MapUnit::Map100thMM) * maUIScale);
tools::Long nHeight = tools::Long( GetCoreValue( *m_xMtrFldHeight, MapUnit::Map100thMM) * maUIScale);
tools::Long nWidth = tools::Long( GetCoreValue( *m_xMtrFldWidth, MapUnit::Map100thMM) * maUIScale);
rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, static_cast<sal_uInt16>(m_xNumFldCopies->get_value()) ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) );
@@ -219,9 +219,9 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData, weld::Button&, void)
{
::tools::Rectangle aRect = mpView->GetAllMarkedRect();
SetMetricValue( *m_xMtrFldMoveX, sal_Int32( aRect.GetWidth() /
SetMetricValue( *m_xMtrFldMoveX, tools::Long( aRect.GetWidth() /
maUIScale ), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldMoveY, sal_Int32( aRect.GetHeight() /
SetMetricValue( *m_xMtrFldMoveY, tools::Long( aRect.GetHeight() /
maUIScale ), MapUnit::Map100thMM);
// sets color attribute
@@ -241,13 +241,13 @@ IMPL_LINK_NOARG(CopyDlg, SetDefault, weld::Button&, void)
m_xNumFldCopies->set_value(1);
tools::Long nValue = 500;
SetMetricValue( *m_xMtrFldMoveX, sal_Int32(nValue / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldMoveY, sal_Int32(nValue / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldMoveX, tools::Long(nValue / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldMoveY, tools::Long(nValue / maUIScale), MapUnit::Map100thMM);
nValue = 0;
m_xMtrFldAngle->set_value(nValue, FieldUnit::DEGREE);
SetMetricValue( *m_xMtrFldWidth, sal_Int32(nValue / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldHeight, sal_Int32(nValue / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldWidth, tools::Long(nValue / maUIScale), MapUnit::Map100thMM);
SetMetricValue( *m_xMtrFldHeight, tools::Long(nValue / maUIScale), MapUnit::Map100thMM);
// set color attribute
const SfxPoolItem* pPoolItem = nullptr;
+2 -2
View File
@@ -161,8 +161,8 @@ void Client::ViewChanged()
Size aSize = pSdrOle2Obj->GetOrigObjSize( &aMap100 );
aVisArea.SetSize( aSize );
Size aScaledSize( static_cast< sal_Int32 >( GetScaleWidth() * Fraction( aVisArea.GetWidth() ) ),
static_cast< sal_Int32 >( GetScaleHeight() * Fraction( aVisArea.GetHeight() ) ) );
Size aScaledSize( static_cast< ::tools::Long >( GetScaleWidth() * Fraction( aVisArea.GetWidth() ) ),
static_cast< ::tools::Long >( GetScaleHeight() * Fraction( aVisArea.GetHeight() ) ) );
// react to the change if the difference is bigger than one pixel
Size aPixelDiff =
+10 -10
View File
@@ -600,8 +600,8 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
Point aPos = GetActiveWindow()->PixelToLogic(maMousePos);
pPageView->LogicToPagePos(aPos);
Fraction aUIScale(GetDoc()->GetUIScale());
aPos.setX( sal_Int32(aPos.X() / aUIScale) );
aPos.setY( sal_Int32(aPos.Y() / aUIScale) );
aPos.setX( ::tools::Long(aPos.X() / aUIScale) );
aPos.setY( ::tools::Long(aPos.Y() / aUIScale) );
// position- and size items
if ( mpDrawView->IsAction() )
@@ -615,12 +615,12 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
{
pPageView->LogicToPagePos(aRect);
aPos = aRect.TopLeft();
aPos.setX( sal_Int32(aPos.X() / aUIScale) );
aPos.setY( sal_Int32(aPos.Y() / aUIScale) );
aPos.setX( ::tools::Long(aPos.X() / aUIScale) );
aPos.setY( ::tools::Long(aPos.Y() / aUIScale) );
rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) );
Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
aSize.setHeight( sal_Int32(aSize.Height() / aUIScale) );
aSize.setWidth( sal_Int32(aSize.Width() / aUIScale) );
aSize.setHeight( ::tools::Long(aSize.Height() / aUIScale) );
aSize.setWidth( ::tools::Long(aSize.Width() / aUIScale) );
rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
}
}
@@ -633,13 +633,13 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
// Show the position of the selected shape(s)
Point aShapePosition (aRect.TopLeft());
aShapePosition.setX( sal_Int32(aShapePosition.X() / aUIScale) );
aShapePosition.setY( sal_Int32(aShapePosition.Y() / aUIScale) );
aShapePosition.setX( ::tools::Long(aShapePosition.X() / aUIScale) );
aShapePosition.setY( ::tools::Long(aShapePosition.Y() / aUIScale) );
rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition));
Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
aSize.setHeight( sal_Int32(aSize.Height() / aUIScale) );
aSize.setWidth( sal_Int32(aSize.Width() / aUIScale) );
aSize.setHeight( ::tools::Long(aSize.Height() / aUIScale) );
aSize.setWidth( ::tools::Long(aSize.Width() / aUIScale) );
rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
}
else
+1 -1
View File
@@ -183,7 +183,7 @@ void Window::SetMaxZoom (::tools::Long nMax)
{
if( GetMapMode().GetScaleX().GetDenominator() )
{
return sal_Int32(GetMapMode().GetScaleX() * 100);
return ::tools::Long(GetMapMode().GetScaleX() * 100);
}
else
{
+10 -10
View File
@@ -416,8 +416,8 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getPlacement()
// apply scaling to object area and convert to pixels
tools::Rectangle aRealObjArea( m_aObjArea );
aRealObjArea.SetSize( Size( sal_Int32( aRealObjArea.GetWidth() * m_aScaleWidth),
sal_Int32( aRealObjArea.GetHeight() * m_aScaleHeight) ) );
aRealObjArea.SetSize( Size( tools::Long( aRealObjArea.GetWidth() * m_aScaleWidth),
tools::Long( aRealObjArea.GetHeight() * m_aScaleHeight) ) );
// In Writer and Impress the map mode is disabled. So when a chart is
// activated (for in place editing) we get the chart win size in 100th mm
@@ -451,8 +451,8 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getClipRectangle()
// currently(?) same as placement
tools::Rectangle aRealObjArea( m_aObjArea );
aRealObjArea.SetSize( Size( sal_Int32( aRealObjArea.GetWidth() * m_aScaleWidth),
sal_Int32( aRealObjArea.GetHeight() * m_aScaleHeight) ) );
aRealObjArea.SetSize( Size( tools::Long( aRealObjArea.GetWidth() * m_aScaleWidth),
tools::Long( aRealObjArea.GetHeight() * m_aScaleHeight) ) );
// See comment for SfxInPlaceClient_Impl::getPlacement.
if (comphelper::LibreOfficeKit::isActive())
@@ -522,8 +522,8 @@ void SAL_CALL SfxInPlaceClient_Impl::changedPlacement( const awt::Rectangle& aPo
SfxBooleanFlagGuard aGuard( m_bResizeNoScale );
// new size of the object area without scaling
Size aNewObjSize( sal_Int32( aNewLogicRect.GetWidth() / m_aScaleWidth ),
sal_Int32( aNewLogicRect.GetHeight() / m_aScaleHeight ) );
Size aNewObjSize( tools::Long( aNewLogicRect.GetWidth() / m_aScaleWidth ),
tools::Long( aNewLogicRect.GetHeight() / m_aScaleHeight ) );
// now remove scaling from new placement and keep this at the new object area
aNewLogicRect.SetSize( aNewObjSize );
@@ -760,8 +760,8 @@ const tools::Rectangle& SfxInPlaceClient::GetObjArea() const
tools::Rectangle SfxInPlaceClient::GetScaledObjArea() const
{
tools::Rectangle aRealObjArea( m_xImp->m_aObjArea );
aRealObjArea.SetSize( Size( sal_Int32( aRealObjArea.GetWidth() * m_xImp->m_aScaleWidth ),
sal_Int32( aRealObjArea.GetHeight() * m_xImp->m_aScaleHeight ) ) );
aRealObjArea.SetSize( Size( tools::Long( aRealObjArea.GetWidth() * m_xImp->m_aScaleWidth ),
tools::Long( aRealObjArea.GetHeight() * m_xImp->m_aScaleHeight ) ) );
return aRealObjArea;
}
@@ -815,8 +815,8 @@ void SfxInPlaceClient::Invalidate()
// the object area is provided in logical coordinates of the window but without scaling applied
tools::Rectangle aRealObjArea( m_xImp->m_aObjArea );
aRealObjArea.SetSize( Size( sal_Int32( aRealObjArea.GetWidth() * m_xImp->m_aScaleWidth ),
sal_Int32( aRealObjArea.GetHeight() * m_xImp->m_aScaleHeight ) ) );
aRealObjArea.SetSize( Size( tools::Long( aRealObjArea.GetWidth() * m_xImp->m_aScaleWidth ),
tools::Long( aRealObjArea.GetHeight() * m_xImp->m_aScaleHeight ) ) );
m_pEditWin->Invalidate( aRealObjArea );
ViewChanged();
+2 -2
View File
@@ -1504,12 +1504,12 @@ bool lcl_CountBlanks(const MathMLAttributeLengthValue &rLV,
return false;
const Fraction aTwo(2, 1);
auto aWide = rLV.aNumber / aTwo;
auto nWide = static_cast<sal_Int32>(aWide);
auto nWide = static_cast<sal_Int32>(static_cast<tools::Long>(aWide));
if (nWide < 0)
return false;
const Fraction aPointFive(1, 2);
auto aNarrow = (rLV.aNumber - Fraction(nWide, 1) * aTwo) / aPointFive;
auto nNarrow = static_cast<sal_Int32>(aNarrow);
auto nNarrow = static_cast<sal_Int32>(static_cast<tools::Long>(aNarrow));
if (nNarrow < 0)
return false;
*pWide = nWide;
+3 -3
View File
@@ -154,7 +154,7 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType)
{
Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()),
rSize.GetDenominator());
tools::Long nHeight = static_cast<sal_Int32>(aVal);
tools::Long nHeight = static_cast<tools::Long>(aVal);
aFntSize = GetFont().GetFontSize();
aFntSize.setWidth( 0 );
@@ -173,12 +173,12 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType)
break;
case FontSizeType::MULTIPLY:
aFntSize.setHeight( static_cast<sal_Int32>(Fraction(aFntSize.Height()) * rSize) );
aFntSize.setHeight( static_cast<tools::Long>(Fraction(aFntSize.Height()) * rSize) );
break;
case FontSizeType::DIVIDE:
if (rSize != Fraction(0))
aFntSize.setHeight( static_cast<sal_Int32>(Fraction(aFntSize.Height()) / rSize) );
aFntSize.setHeight( static_cast<tools::Long>(Fraction(aFntSize.Height()) / rSize) );
break;
default:
break;
+2 -2
View File
@@ -230,8 +230,8 @@ SmFace & operator *= (SmFace &rFace, const Fraction &rFrac)
// It's main use is to make scaling fonts look easier.
{ const Size &rFaceSize = rFace.GetFontSize();
rFace.SetSize(Size(sal_Int32(rFaceSize.Width() * rFrac),
sal_Int32(rFaceSize.Height() * rFrac)));
rFace.SetSize(Size(tools::Long(rFaceSize.Width() * rFrac),
tools::Long(rFaceSize.Height() * rFrac)));
return rFace;
}
+5 -5
View File
@@ -906,7 +906,7 @@ void SmViewShell::QueryObjAreaPixel( tools::Rectangle& rRect ) const
void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY )
{
const Fraction &rFrac = std::min(rX, rY);
GetGraphicWindow().SetZoom(sal::static_int_cast<sal_uInt16>(sal_Int32(rFrac * Fraction( 100, 1 ))));
GetGraphicWindow().SetZoom(sal::static_int_cast<sal_uInt16>(tools::Long(rFrac * Fraction( 100, 1 ))));
//To avoid rounding errors base class regulates crooked values too
//if necessary
@@ -1190,8 +1190,8 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri
Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(),
aOutRect.GetHeight()), MapMode(MapUnit::Map100thMM)));
Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MapUnit::Map100thMM)));
sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(sal_Int32(Fraction(OutputSize.Width() * 100, GraphicSize.Width())),
sal_Int32(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(tools::Long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())),
tools::Long(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
nZ -= 10;
Fraction aFraction (std::max(MINZOOM, std::min(MAXZOOM, nZ)), 100);
@@ -2012,8 +2012,8 @@ void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet)
Size OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(),
OutputRect.GetHeight()), aMap));
Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap));
sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(sal_Int32(Fraction(OutputSize.Width() * 100, GraphicSize.Width())),
sal_Int32(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(tools::Long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())),
tools::Long(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
mpGraphic->SetZoom (nZ);
break;
}
+6 -6
View File
@@ -1441,8 +1441,8 @@ SdrObjectUniquePtr FmXFormView::implCreateXFormsControl( const svx::OXFormsDescr
getView()->getSdrModelFromSdrView(),
SdrInventor::FmForm,
nObjID));
controlSize.setWidth( sal_Int32(controlSize.Width() * eTargetMode.GetScaleX()) );
controlSize.setHeight( sal_Int32(controlSize.Height() * eTargetMode.GetScaleY()) );
controlSize.setWidth( tools::Long(controlSize.Width() * eTargetMode.GetScaleX()) );
controlSize.setHeight( tools::Long(controlSize.Height() * eTargetMode.GetScaleY()) );
::Point controlPos( OutputDevice::LogicToLogic( ::Point( controlSize.Width(), 0 ), eSourceMode, eTargetMode ) );
::tools::Rectangle controlRect( controlPos, OutputDevice::LogicToLogic( controlSize, eSourceMode, eTargetMode ) );
pControl->SetLogicRect(controlRect);
@@ -1548,8 +1548,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
aRealSize.setHeight( aDefSize.Height() );
// adjust to scaling of the target device (#53523#)
aRealSize.setWidth( sal_Int32(Fraction(aRealSize.Width(), 1) * eTargetMode.GetScaleX()) );
aRealSize.setHeight( sal_Int32(Fraction(aRealSize.Height(), 1) * eTargetMode.GetScaleY()) );
aRealSize.setWidth( tools::Long(Fraction(aRealSize.Width(), 1) * eTargetMode.GetScaleX()) );
aRealSize.setHeight( tools::Long(Fraction(aRealSize.Height(), 1) * eTargetMode.GetScaleY()) );
// for boolean fields, we do not create a label, but just a checkbox
bool bNeedLabel = ( _nControlObjectID != OBJ_FM_CHECKBOX );
@@ -1626,8 +1626,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
if ( OBJ_FM_IMAGECONTROL == _nControlObjectID )
aControlSize = aDefImageSize;
aControlSize.setWidth( sal_Int32(Fraction(aControlSize.Width(), 1) * eTargetMode.GetScaleX()) );
aControlSize.setHeight( sal_Int32(Fraction(aControlSize.Height(), 1) * eTargetMode.GetScaleY()) );
aControlSize.setWidth( tools::Long(Fraction(aControlSize.Width(), 1) * eTargetMode.GetScaleX()) );
aControlSize.setHeight( tools::Long(Fraction(aControlSize.Height(), 1) * eTargetMode.GetScaleY()) );
pControl->SetLogicRect( ::tools::Rectangle(
OutputDevice::LogicToLogic( ::Point( aRealSize.Width() + _nXOffsetMM, _nYOffsetMM ), eSourceMode, eTargetMode ),
@@ -408,7 +408,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, weld::MetricSpinButton&, v
tools::Long lX = GetCoreValue( *mxMtrPosX, mePoolUnit );
Fraction aUIScale = mpView->GetModel()->GetUIScale();
lX = sal_Int32( lX * aUIScale );
lX = tools::Long( lX * aUIScale );
SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,static_cast<sal_uInt32>(lX));
@@ -424,7 +424,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, weld::MetricSpinButton&, v
tools::Long lY = GetCoreValue( *mxMtrPosY, mePoolUnit );
Fraction aUIScale = mpView->GetModel()->GetUIScale();
lY = sal_Int32( lY * aUIScale );
lY = tools::Long( lY * aUIScale );
SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,static_cast<sal_uInt32>(lY));
@@ -519,7 +519,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pWidthItem)
{
tools::Long lOldWidth1 = sal_Int32( pWidthItem->GetValue() / maUIScale );
tools::Long lOldWidth1 = tools::Long( pWidthItem->GetValue() / maUIScale );
SetFieldUnit( *mxMtrWidth, meDlgUnit, true );
SetMetricValue( *mxMtrWidth, lOldWidth1, mePoolUnit );
limitWidth(*mxMtrWidth);
@@ -539,7 +539,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pHeightItem)
{
tools::Long nTmp = sal_Int32( pHeightItem->GetValue() / maUIScale);
tools::Long nTmp = tools::Long( pHeightItem->GetValue() / maUIScale);
SetFieldUnit( *mxMtrHeight, meDlgUnit, true );
SetMetricValue( *mxMtrHeight, nTmp, mePoolUnit );
limitWidth(*mxMtrHeight);
@@ -559,7 +559,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
tools::Long nTmp = sal_Int32(pItem->GetValue() / maUIScale);
tools::Long nTmp = tools::Long(pItem->GetValue() / maUIScale);
SetFieldUnit( *mxMtrPosX, meDlgUnit, true );
SetMetricValue( *mxMtrPosX, nTmp, mePoolUnit );
limitWidth(*mxMtrPosX);
@@ -578,7 +578,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
tools::Long nTmp = sal_Int32(pItem->GetValue() / maUIScale);
tools::Long nTmp = tools::Long(pItem->GetValue() / maUIScale);
SetFieldUnit( *mxMtrPosY, meDlgUnit, true );
SetMetricValue( *mxMtrPosY, nTmp, mePoolUnit );
limitWidth(*mxMtrPosY);
@@ -598,7 +598,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
mlRotX = pItem->GetValue();
mlRotX = sal_Int32( mlRotX / maUIScale );
mlRotX = tools::Long( mlRotX / maUIScale );
}
}
break;
@@ -611,7 +611,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
mlRotY = pItem->GetValue();
mlRotY = sal_Int32( mlRotY / maUIScale );
mlRotY = tools::Long( mlRotY / maUIScale );
}
}
break;
+10 -10
View File
@@ -180,8 +180,8 @@ tools::Rectangle SdrLightEmbeddedClient_Impl::impl_getScaledRect_nothrow() const
{
tools::Rectangle aLogicRect( mpObj->GetLogicRect() );
// apply scaling to object area and convert to pixels
aLogicRect.SetSize( Size( sal_Int32( aLogicRect.GetWidth() * m_aScaleWidth),
sal_Int32( aLogicRect.GetHeight() * m_aScaleHeight) ) );
aLogicRect.SetSize( Size( tools::Long( aLogicRect.GetWidth() * m_aScaleWidth),
tools::Long( aLogicRect.GetHeight() * m_aScaleHeight) ) );
return aLogicRect;
}
@@ -259,8 +259,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent( const document::EventObj
aVisArea.SetSize( Size( aSz.Width, aSz.Height ) );
aVisArea = OutputDevice::LogicToLogic(aVisArea, MapMode(aObjMapUnit), MapMode(aContainerMapUnit));
Size aScaledSize( static_cast< sal_Int32 >( m_aScaleWidth * Fraction( aVisArea.GetWidth() ) ),
static_cast< sal_Int32 >( m_aScaleHeight * Fraction( aVisArea.GetHeight() ) ) );
Size aScaledSize( static_cast< tools::Long >( m_aScaleWidth * Fraction( aVisArea.GetWidth() ) ),
static_cast< tools::Long >( m_aScaleHeight * Fraction( aVisArea.GetHeight() ) ) );
tools::Rectangle aLogicRect( mpObj->GetLogicRect() );
// react to the change if the difference is bigger than one pixel
@@ -500,8 +500,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::changedPlacement( const awt::Rectangl
//SfxBooleanFlagGuard aGuard( m_bResizeNoScale, true );
// new size of the object area without scaling
Size aNewObjSize( sal_Int32( aNewLogicRect.GetWidth() / m_aScaleWidth ),
sal_Int32( aNewLogicRect.GetHeight() / m_aScaleHeight ) );
Size aNewObjSize( tools::Long( aNewLogicRect.GetWidth() / m_aScaleWidth ),
tools::Long( aNewLogicRect.GetHeight() / m_aScaleHeight ) );
// now remove scaling from new placement and keep this at the new object area
aNewLogicRect.SetSize( aNewObjSize );
@@ -1488,8 +1488,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
// objects' visual area. The scaling will not change, but it might exist already and must
// be used in calculations
MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( mpImpl->mxObjRef->getMapUnit( GetAspect() ) );
Size aVisSize( static_cast<sal_Int32>( Fraction( maRect.GetWidth() ) / aScaleWidth ),
static_cast<sal_Int32>( Fraction( maRect.GetHeight() ) / aScaleHeight ) );
Size aVisSize( static_cast<tools::Long>( Fraction( maRect.GetWidth() ) / aScaleWidth ),
static_cast<tools::Long>( Fraction( maRect.GetHeight() ) / aScaleHeight ) );
aVisSize = OutputDevice::LogicToLogic(
aVisSize,
@@ -1508,8 +1508,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
{}
tools::Rectangle aAcceptedVisArea;
aAcceptedVisArea.SetSize( Size( static_cast<sal_Int32>( Fraction( tools::Long( aSz.Width ) ) * aScaleWidth ),
static_cast<sal_Int32>( Fraction( tools::Long( aSz.Height ) ) * aScaleHeight ) ) );
aAcceptedVisArea.SetSize( Size( static_cast<tools::Long>( Fraction( tools::Long( aSz.Width ) ) * aScaleWidth ),
static_cast<tools::Long>( Fraction( tools::Long( aSz.Height ) ) * aScaleHeight ) ) );
if (aVisSize != aAcceptedVisArea.GetSize())
{
// server changed VisArea to its liking and the VisArea is different than the suggested one
+1 -1
View File
@@ -2940,7 +2940,7 @@ static void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewH
Fraction aTmp( nMyOldH );
aTmp *= Fraction( nNewHeight, nOldHeight );
aTmp += Fraction( 1, 2 ); // round up if needed
nMyNewH = sal_Int32(aTmp);
nMyNewH = tools::Long(aTmp);
}
SwFrameSize eSize = SwFrameSize::Minimum;
+1 -1
View File
@@ -5263,7 +5263,7 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect,
SwTwips nPrtWidth = aRectFnSet.GetWidth(getFramePrintArea());
Fraction aFract( nPrtWidth, 1 );
aFract *= rInf.GetWidth();
const SwTwips nWidth = static_cast<sal_Int32>(aFract);
const SwTwips nWidth = static_cast<tools::Long>(aFract);
SwTwips nX = aRectFnSet.GetPrtLeft(*this);
switch ( rInf.GetAdj() )
+1 -1
View File
@@ -543,7 +543,7 @@ void SwFntObj::CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut )
pOut->GetMapMode().GetScaleY().IsValid() &&
pOut->GetMapMode().GetScaleX() == pOut->GetMapMode().GetScaleY() )
{
nTmp = sal_Int32(100 * pOut->GetMapMode().GetScaleX());
nTmp = tools::Long(100 * pOut->GetMapMode().GetScaleX());
}
else
nTmp = 0;
+1 -1
View File
@@ -209,7 +209,7 @@ void SwPagePreviewLayout::Init( const sal_uInt16 _nCols,
{
// adjust scaling for Drawing layer.
aYScale *= Fraction( 1000, 1 );
tools::Long nNewNuminator = sal_Int32(aYScale);
tools::Long nNewNuminator = aYScale.operator long();
if( nNewNuminator < 1 )
nNewNuminator = 1;
aYScale = Fraction( nNewNuminator, 1000 );
+1 -1
View File
@@ -160,7 +160,7 @@ void SwViewShell::PrintProspect(
{
// Round percentages for Drawings so that these can paint their objects properly
aScY *= Fraction( 1000, 1 );
tools::Long nTmp = static_cast<sal_Int32>(aScY);
tools::Long nTmp = static_cast<tools::Long>(aScY);
if( 1 < nTmp )
--nTmp;
else
+2 -2
View File
@@ -343,7 +343,7 @@ sal_uInt16 SwWriteTable::GetRelWidth( sal_uInt16 nCol, sal_uInt16 nColSpan ) con
{
tools::Long nWidth = GetRawWidth( nCol, nColSpan );
return static_cast<sal_uInt16>(static_cast<sal_Int32>(Fraction( nWidth*256 + GetBaseWidth()/2,
return static_cast<sal_uInt16>(static_cast<tools::Long>(Fraction( nWidth*256 + GetBaseWidth()/2,
GetBaseWidth() )));
}
@@ -353,7 +353,7 @@ sal_uInt16 SwWriteTable::GetPercentWidth( sal_uInt16 nCol, sal_uInt16 nColSpan )
// Looks funny, but is nothing more than
// [(100 * nWidth) + .5] without rounding errors
return static_cast<sal_uInt16>(static_cast<sal_Int32>(Fraction( nWidth*100 + GetBaseWidth()/2,
return static_cast<sal_uInt16>(static_cast<tools::Long>(Fraction( nWidth*100 + GetBaseWidth()/2,
GetBaseWidth() )));
}
+1 -1
View File
@@ -682,7 +682,7 @@ namespace sw
const Size &rSize = pNd->GetTwipSize();
Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
aMoveHack *= Fraction(15, 1);
sal_Int32 nMove(aMoveHack);
tools::Long nMove(aMoveHack);
Fraction aHackX(ww::nWrap100Percent + nMove,
ww::nWrap100Percent);
+1 -1
View File
@@ -2050,7 +2050,7 @@ void SwWW8ImplReader::MapWrapIntoFlyFormat(SvxMSDffImportRec const * pRecord,
*/
Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
aMoveHack *= Fraction(15, 1);
sal_Int32 nMove(aMoveHack);
tools::Long nMove(aMoveHack);
aPoly.Move(nMove, 0);
Fraction aHackX(ww::nWrap100Percent, ww::nWrap100Percent + nMove);
+1 -1
View File
@@ -201,7 +201,7 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet)
// width
Fraction aTmp( 100, 1 );
aTmp *= pFootnoteInfo->GetWidth();
m_xLineLengthEdit->set_value(static_cast<sal_Int32>(aTmp), FieldUnit::PERCENT);
m_xLineLengthEdit->set_value(static_cast<tools::Long>(aTmp), FieldUnit::PERCENT);
// gap footnote area
m_xDistEdit->set_value(m_xDistEdit->normalize(pFootnoteInfo->GetTopDist()), FieldUnit::TWIP);
+10 -10
View File
@@ -634,21 +634,21 @@ void SwAnnotationWin::Rescale()
if ( mpMetadataAuthor )
{
vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetLabelFont() );
sal_Int32 nHeight = sal_Int32(aFont.GetFontHeight() * rFraction);
sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
aFont.SetFontHeight( nHeight );
mpMetadataAuthor->SetControlFont( aFont );
}
if ( mpMetadataDate )
{
vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() );
sal_Int32 nHeight = sal_Int32(aFont.GetFontHeight() * rFraction);
sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
aFont.SetFontHeight( nHeight );
mpMetadataDate->SetControlFont( aFont );
}
if ( mpMetadataResolved )
{
vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetLabelFont() );
sal_Int32 nHeight = sal_Int32(aFont.GetFontHeight() * rFraction);
sal_Int32 nHeight = tools::Long(aFont.GetFontHeight() * rFraction);
aFont.SetFontHeight( nHeight );
mpMetadataResolved->SetControlFont( aFont );
}
@@ -959,10 +959,10 @@ void SwAnnotationWin::DoResize()
const Fraction& fy( GetMapMode().GetScaleY() );
const Point aPos( mpMetadataAuthor->GetPosPixel());
mpMenuButton->setPosSizePixel( sal_Int32(aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx),
sal_Int32(aPos.Y()+5*fy),
sal_Int32(METABUTTON_WIDTH*fx),
sal_Int32(METABUTTON_HEIGHT*fy) );
mpMenuButton->setPosSizePixel( tools::Long(aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx),
tools::Long(aPos.Y()+5*fy),
tools::Long(METABUTTON_WIDTH*fx),
tools::Long(METABUTTON_HEIGHT*fy) );
}
void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
@@ -1426,14 +1426,14 @@ sal_Int32 SwAnnotationWin::GetScrollbarWidth() const
sal_Int32 SwAnnotationWin::GetMetaButtonAreaWidth() const
{
const Fraction& f( GetMapMode().GetScaleX() );
return sal_Int32(METABUTTON_AREA_WIDTH * f);
return tools::Long(METABUTTON_AREA_WIDTH * f);
}
sal_Int32 SwAnnotationWin::GetMetaHeight() const
{
const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
const int fields = GetNumFields();
return sal_Int32(fields*POSTIT_META_FIELD_HEIGHT*f);
return tools::Long(fields*POSTIT_META_FIELD_HEIGHT*f);
}
sal_Int32 SwAnnotationWin::GetNumFields() const
@@ -1449,7 +1449,7 @@ sal_Int32 SwAnnotationWin::GetMinimumSizeWithMeta() const
sal_Int32 SwAnnotationWin::GetMinimumSizeWithoutMeta() const
{
const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
return sal_Int32(POSTIT_MINIMUMSIZE_WITHOUT_META * f);
return tools::Long(POSTIT_MINIMUMSIZE_WITHOUT_META * f);
}
void SwAnnotationWin::SetSpellChecking()
+4 -4
View File
@@ -67,8 +67,8 @@ void SwOleClient::RequestNewObjectArea( tools::Rectangle& aLogRect )
MapMode aObjectMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( GetObject()->getMapUnit( GetAspect() ) ) );
MapMode aClientMap( GetEditWin()->GetMapMode().GetMapUnit() );
Size aNewObjSize( sal_Int32( aLogRect.GetWidth() / GetScaleWidth() ),
sal_Int32( aLogRect.GetHeight() / GetScaleHeight() ) );
Size aNewObjSize( tools::Long( aLogRect.GetWidth() / GetScaleWidth() ),
tools::Long( aLogRect.GetHeight() / GetScaleHeight() ) );
// convert to logical coordinates of the embedded object
Size aNewSize = GetEditWin()->LogicToLogic( aNewObjSize, &aClientMap, &aObjectMap );
@@ -141,8 +141,8 @@ void SwOleClient::ViewChanged()
const MapMode aObjMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( GetObject()->getMapUnit( GetAspect() ) ) );
aVisSize = OutputDevice::LogicToLogic( aVisSize, aObjMap, aMyMap );
aVisSize.setWidth( sal_Int32(aVisSize.Width() * GetScaleWidth()) );
aVisSize.setHeight( sal_Int32(aVisSize.Height() * GetScaleHeight()) );
aVisSize.setWidth( tools::Long(aVisSize.Width() * GetScaleWidth()) );
aVisSize.setHeight( tools::Long(aVisSize.Height() * GetScaleHeight()) );
SwRect aRect( Point( LONG_MIN, LONG_MIN ), aVisSize );
rSh.LockView( true ); // Prevent scrolling in the EndAction
+2 -2
View File
@@ -990,7 +990,7 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize, bool )
const Fraction& rFrac = GetEditWin().GetMapMode().GetScaleX();
tools::Long nZoom = 100;
if (rFrac.IsValid())
nZoom = sal_Int32(rFrac * 100);
nZoom = tools::Long(rFrac * 100);
const Fraction aFrac( nZoom, 100 );
m_pVRuler->SetZoom( aFrac );
@@ -1140,7 +1140,7 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
void SwView::SetZoomFactor( const Fraction &rX, const Fraction &rY )
{
const Fraction &rFrac = rX < rY ? rX : rY;
SetZoom( SvxZoomType::PERCENT, static_cast<short>(sal_Int32(rFrac * Fraction( 100, 1 ))) );
SetZoom( SvxZoomType::PERCENT, static_cast<short>(tools::Long(rFrac * Fraction( 100, 1 ))) );
// To minimize rounding errors we also adjust the odd values
// of the base class if necessary.
+1 -1
View File
@@ -86,7 +86,7 @@ bool SwPageFootnoteInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const
{
Fraction aTmp( 100, 1 );
aTmp *= aFootnoteInfo.GetWidth();
rVal <<= static_cast<sal_Int8>(static_cast<sal_Int32>(aTmp));
rVal <<= static_cast<sal_Int8>(static_cast<tools::Long>(aTmp));
}
break;
case MID_LINE_ADJUST : rVal <<= static_cast<sal_Int16>(aFootnoteInfo.GetAdj());break;//text::HorizontalAdjust
+2 -2
View File
@@ -856,8 +856,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
}
else
{
aArea.Width ( sal_Int32( aArea.Width() / pCli->GetScaleWidth() ) );
aArea.Height( sal_Int32( aArea.Height() / pCli->GetScaleHeight() ) );
aArea.Width ( tools::Long( aArea.Width() / pCli->GetScaleWidth() ) );
aArea.Height( tools::Long( aArea.Height() / pCli->GetScaleHeight() ) );
}
pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
+2 -2
View File
@@ -38,8 +38,8 @@
#include <sal/log.hxx>
#define SCALEPOINT(aPT,aFracX,aFracY) (aPT).setX(sal_Int32((aPT).X()*aFracX)); \
(aPT).setY(sal_Int32((aPT).Y()*aFracY));
#define SCALEPOINT(aPT,aFracX,aFracY) (aPT).setX(tools::Long((aPT).X()*aFracX)); \
(aPT).setY(tools::Long((aPT).Y()*aFracY));
/******************************************************************************/
@@ -84,7 +84,7 @@ WrapPolygon::Pointer_t WrapPolygon::scale(const Fraction & rFractionX, const Fra
while (aIt != aItEnd)
{
awt::Point aPoint(sal_Int32(Fraction(tools::Long(aIt->X)) * rFractionX), sal_Int32(Fraction(tools::Long(aIt->Y)) * rFractionY));
awt::Point aPoint((Fraction(tools::Long(aIt->X)) * rFractionX).operator long(), (Fraction(tools::Long(aIt->Y)) * rFractionY).operator long());
pResult->addPoint(aPoint);
++aIt;
}
@@ -100,7 +100,7 @@ WrapPolygon::Pointer_t WrapPolygon::correctWordWrapPolygon(const awt::Size & rSr
Fraction aMove(nWrap100Percent, rSrcSize.Width);
aMove = aMove * Fraction(convertTwipToMm100(15), 1);
awt::Point aMovePoint(sal_Int32(aMove), 0);
awt::Point aMovePoint(aMove.operator long(), 0);
pResult = move(aMovePoint);
Fraction aScaleX = nWrap100Percent / (nWrap100Percent + aMove);