diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-12 09:52:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-26 07:35:36 +0100 |
commit | 4fbd63860500b2db76df4d5aedbe5e3aa31fac69 (patch) | |
tree | 5fa96dc262ba651e82244b0f9e508f79e88ea2df /toolkit | |
parent | 62fa5bb8c1299469eacc21cb35ee670b65120713 (diff) |
switching long to a 64-bit type on 64-bit windows
(*) create a rewriting plugin to do most of the work, heavily
based on the fakebool plugin
(*) but there are still a number of "long"s in the codebase
that will need to be done by hand
(*) the plugin needs lots of handholding, due to needing to
add #include and update macros
Change-Id: I8184d7000ca482c0469514bb73178c3a1123b1e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104203
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/helper/btndlg.hxx | 6 | ||||
-rw-r--r-- | toolkit/inc/helper/scrollabledialog.hxx | 12 | ||||
-rw-r--r-- | toolkit/source/awt/animatedimagespeer.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/awt/scrollabledialog.cxx | 14 | ||||
-rw-r--r-- | toolkit/source/awt/vclxgraphics.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/awt/vclxspinbutton.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 12 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 14 | ||||
-rw-r--r-- | toolkit/source/controls/filectrl.cxx | 6 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 19 | ||||
-rw-r--r-- | toolkit/source/helper/btndlg.cxx | 18 |
11 files changed, 55 insertions, 54 deletions
diff --git a/toolkit/inc/helper/btndlg.hxx b/toolkit/inc/helper/btndlg.hxx index 5f3d994d4f81..8894b8dec619 100644 --- a/toolkit/inc/helper/btndlg.hxx +++ b/toolkit/inc/helper/btndlg.hxx @@ -57,12 +57,12 @@ public: void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; } - void AddButton( StandardButtonType eType, sal_uInt16 nId, ButtonDialogFlags nBtnFlags, long nSepPixel = 0 ); + void AddButton( StandardButtonType eType, sal_uInt16 nId, ButtonDialogFlags nBtnFlags, tools::Long nSepPixel = 0 ); void RemoveButton( sal_uInt16 nId ); protected: ButtonDialog( WindowType nType ); - long ImplGetButtonSize(); + tools::Long ImplGetButtonSize(); private: ButtonDialog( const ButtonDialog & ) = delete; @@ -72,7 +72,7 @@ private: std::vector<std::unique_ptr<ImplBtnDlgItem>> m_ItemList; Size maPageSize; Size maCtrlSize; - long mnButtonSize; + tools::Long mnButtonSize; sal_uInt16 mnCurButtonId; sal_uInt16 mnFocusButtonId; bool mbFormat; diff --git a/toolkit/inc/helper/scrollabledialog.hxx b/toolkit/inc/helper/scrollabledialog.hxx index 099bbbd6045e..26068b4f5c98 100644 --- a/toolkit/inc/helper/scrollabledialog.hxx +++ b/toolkit/inc/helper/scrollabledialog.hxx @@ -37,10 +37,10 @@ namespace toolkit bool mbHasHoriBar; bool mbHasVertBar; Point mnScrollPos; - long mnScrWidth; + tools::Long mnScrWidth; ScrollBarVisibility maScrollVis; - void lcl_Scroll( long nX, long nY ); + void lcl_Scroll( tools::Long nX, tools::Long nY ); DECL_LINK( ScrollBarHdl, ScrollBar*, void ); public: @@ -50,10 +50,10 @@ namespace toolkit // Window virtual void Resize() override; - void SetScrollWidth( long nWidth ); - void SetScrollHeight( long nHeight ); - void SetScrollLeft( long nLeft ); - void SetScrollTop( long Top ); + void SetScrollWidth( tools::Long nWidth ); + void SetScrollHeight( tools::Long nHeight ); + void SetScrollLeft( tools::Long nLeft ); + void SetScrollTop( tools::Long Top ); void setScrollVisibility( ScrollBarVisibility rState ); void ResetScrollBars(); }; diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx index 087ddb4d381e..ecee7b365194 100644 --- a/toolkit/source/awt/animatedimagespeer.cxx +++ b/toolkit/source/awt/animatedimagespeer.cxx @@ -219,7 +219,7 @@ namespace toolkit // find the set with the smallest difference between window size and image size const ::Size aWindowSizePixel = pThrobber->GetSizePixel(); - long nMinimalDistance = ::std::numeric_limits< long >::max(); + tools::Long nMinimalDistance = ::std::numeric_limits< long >::max(); for ( ::std::vector< Size >::const_iterator check = aImageSizes.begin(); check != aImageSizes.end(); ++check diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx index ff9abf48b58d..bcc8d18e0717 100644 --- a/toolkit/source/awt/scrollabledialog.cxx +++ b/toolkit/source/awt/scrollabledialog.cxx @@ -88,10 +88,10 @@ void ScrollableDialog::dispose() Dialog::dispose(); } -void ScrollableDialog::lcl_Scroll( long nX, long nY ) +void ScrollableDialog::lcl_Scroll( tools::Long nX, tools::Long nY ) { - long nXScroll = mnScrollPos.X() - nX; - long nYScroll = mnScrollPos.Y() - nY; + tools::Long nXScroll = mnScrollPos.X() - nX; + tools::Long nYScroll = mnScrollPos.Y() - nY; mnScrollPos = Point( nX, nY ); tools::Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() ); @@ -118,7 +118,7 @@ IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB, void ) lcl_Scroll(nPos, mnScrollPos.Y() ); } -void ScrollableDialog::SetScrollTop( long nTop ) +void ScrollableDialog::SetScrollTop( tools::Long nTop ) { Point aOld = mnScrollPos; lcl_Scroll( mnScrollPos.X() , mnScrollPos.Y() - nTop ); @@ -126,7 +126,7 @@ void ScrollableDialog::SetScrollTop( long nTop ) // new pos is 0,0 mnScrollPos = aOld; } -void ScrollableDialog::SetScrollLeft( long nLeft ) +void ScrollableDialog::SetScrollLeft( tools::Long nLeft ) { Point aOld = mnScrollPos; lcl_Scroll( mnScrollPos.X() - nLeft , mnScrollPos.Y() ); @@ -135,13 +135,13 @@ void ScrollableDialog::SetScrollLeft( long nLeft ) mnScrollPos = aOld; } -void ScrollableDialog::SetScrollWidth( long nWidth ) +void ScrollableDialog::SetScrollWidth( tools::Long nWidth ) { maScrollArea.setWidth( nWidth ); ResetScrollBars(); } -void ScrollableDialog::SetScrollHeight( long nHeight ) +void ScrollableDialog::SetScrollHeight( tools::Long nHeight ) { maScrollArea.setHeight( nHeight ); ResetScrollBars(); diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index 72ce78fb4fd1..5b6cf29334c5 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -287,13 +287,13 @@ void VCLXGraphics::draw( const uno::Reference< awt::XDisplayBitmap >& rxBitmapHa if(nDestWidth != nSourceWidth) { float zoomX = static_cast<float>(nDestWidth) / static_cast<float>(nSourceWidth); - aSz.setWidth( static_cast<long>(static_cast<float>(aSz.Width()) * zoomX) ); + aSz.setWidth( static_cast<tools::Long>(static_cast<float>(aSz.Width()) * zoomX) ); } if(nDestHeight != nSourceHeight) { float zoomY = static_cast<float>(nDestHeight) / static_cast<float>(nSourceHeight); - aSz.setHeight( static_cast<long>(static_cast<float>(aSz.Height()) * zoomY) ); + aSz.setHeight( static_cast<tools::Long>(static_cast<float>(aSz.Height()) * zoomY) ); } if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight) diff --git a/toolkit/source/awt/vclxspinbutton.cxx b/toolkit/source/awt/vclxspinbutton.cxx index 7941f3760c9a..20a06c010618 100644 --- a/toolkit/source/awt/vclxspinbutton.cxx +++ b/toolkit/source/awt/vclxspinbutton.cxx @@ -94,7 +94,7 @@ namespace toolkit namespace { - typedef void (SpinButton::*SetSpinButtonValue) (long); + typedef void (SpinButton::*SetSpinButtonValue) (tools::Long); typedef long (SpinButton::*GetSpinButtonValue) () const; diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 7bf211d7150f..12fb64bee90b 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -274,10 +274,10 @@ void MessBox::ImplPosControls() Size aImageSize; Size aPageSize; Size aMEditSize; - long nTitleWidth; - long nButtonSize = ImplGetButtonSize(); - long nMaxLineWidth; - long nWidth; + tools::Long nTitleWidth; + tools::Long nButtonSize = ImplGetButtonSize(); + tools::Long nMaxLineWidth; + tools::Long nWidth; WinBits nWinStyle = WB_LEFT | WB_NOLABEL; DrawTextFlags nTextStyle = DrawTextFlags::MultiLine | DrawTextFlags::Top | DrawTextFlags::Left; @@ -288,7 +288,7 @@ void MessBox::ImplPosControls() OUString aMessText(maMessText.replaceAll("\t", " ")); //If window too small, we make dialog box be wider - long nMaxWidth = 630 * GetDPIScaleFactor(); + tools::Long nMaxWidth = 630 * GetDPIScaleFactor(); // MessagBox should be at least as wide as to see the title // Extra-Width for Close button, because Close button is set after this call @@ -2209,7 +2209,7 @@ css::uno::Sequence< OUString > VCLXToolkit::getSupportedServiceNames() css::uno::Reference< css::awt::XTopWindow > SAL_CALL VCLXToolkit::getTopWindow(::sal_Int32 nIndex) { - vcl::Window * p = ::Application::GetTopWindow(static_cast< long >(nIndex)); + vcl::Window * p = ::Application::GetTopWindow(static_cast< tools::Long >(nIndex)); // XXX numeric overflow return css::uno::Reference< css::awt::XTopWindow >( p == nullptr ? nullptr : static_cast< css::awt::XWindow * >(p->GetWindowPeer()), diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 7909612e562e..554b5fc7f212 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -3741,7 +3741,7 @@ void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) css::awt::Size VCLXScrollBar::implGetMinimumSize( vcl::Window const * p ) { - long n = p->GetSettings().GetStyleSettings().GetScrollBarSize(); + tools::Long n = p->GetSettings().GetStyleSettings().GetScrollBarSize(); return css::awt::Size( n, n ); } @@ -5482,7 +5482,7 @@ void VCLXNumericField::setValue( double Value ) // (e.g., input 105 using 2 digits returns 1,05) // Thus, to set a value of 1,05, insert 105 and 2 digits pNumericFormatter->SetValue( - static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); + static_cast<tools::Long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); // #107218# Call same listeners like VCL would do after user interaction VclPtr< Edit > pEdit = GetAs< Edit >(); @@ -5512,7 +5512,7 @@ void VCLXNumericField::setMin( double Value ) NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); if ( pNumericFormatter ) pNumericFormatter->SetMin( - static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); + static_cast<tools::Long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); } double VCLXNumericField::getMin() @@ -5532,7 +5532,7 @@ void VCLXNumericField::setMax( double Value ) NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); if ( pNumericFormatter ) pNumericFormatter->SetMax( - static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); + static_cast<tools::Long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); } double VCLXNumericField::getMax() @@ -5552,7 +5552,7 @@ void VCLXNumericField::setFirst( double Value ) NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); if ( pNumericFormatter ) pNumericFormatter->SetFirst( - static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); + static_cast<tools::Long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); } double VCLXNumericField::getFirst() @@ -5572,7 +5572,7 @@ void VCLXNumericField::setLast( double Value ) NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); if ( pNumericFormatter ) pNumericFormatter->SetLast( - static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); + static_cast<tools::Long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); } double VCLXNumericField::getLast() @@ -5602,7 +5602,7 @@ void VCLXNumericField::setSpinSize( double Value ) NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter()); if ( pNumericFormatter ) pNumericFormatter->SetSpinSize( - static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); + static_cast<tools::Long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) ); } double VCLXNumericField::getSpinSize() diff --git a/toolkit/source/controls/filectrl.cxx b/toolkit/source/controls/filectrl.cxx index cebbd9371818..bea09aeb7e12 100644 --- a/toolkit/source/controls/filectrl.cxx +++ b/toolkit/source/controls/filectrl.cxx @@ -145,14 +145,14 @@ void FileControl::StateChanged( StateChangedType nType ) void FileControl::Resize() { - static const long ButtonBorder = 10; + static const tools::Long ButtonBorder = 10; if( mnInternalFlags & FileControlMode_Internal::INRESIZE ) return; mnInternalFlags |= FileControlMode_Internal::INRESIZE;//InResize = sal_True Size aOutSz = GetOutputSizePixel(); - long nButtonTextWidth = maButton->GetTextWidth( maButtonText ); + tools::Long nButtonTextWidth = maButton->GetTextWidth( maButtonText ); if ( !(mnInternalFlags & FileControlMode_Internal::ORIGINALBUTTONTEXT) || ( nButtonTextWidth < aOutSz.Width()/3 ) ) { @@ -165,7 +165,7 @@ void FileControl::Resize() nButtonTextWidth = maButton->GetTextWidth( aSmallText ); } - long nButtonWidth = nButtonTextWidth+ButtonBorder; + tools::Long nButtonWidth = nButtonTextWidth+ButtonBorder; maEdit->setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() ); maButton->setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() ); diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 695b6fcb00e5..5725cd16501a 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -35,6 +35,7 @@ #include <sal/log.hxx> #include <tools/diagnose_ex.h> #include <tools/debug.hxx> +#include <tools/long.hxx> #include <toolkit/helper/property.hxx> #include <toolkit/helper/emptyfontdescriptor.hxx> #include <unotools/localedatawrapper.hxx> @@ -661,7 +662,7 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt { css::uno::Sequence< OUString> aSeq; rValue >>= aSeq; - long nEntries = aSeq.getLength(); + tools::Long nEntries = aSeq.getLength(); OutStream->writeLong( nEntries ); for ( const auto& rVal : std::as_const(aSeq) ) OutStream->writeUTF( rVal ); @@ -670,7 +671,7 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt { css::uno::Sequence<sal_uInt16> aSeq; rValue >>= aSeq; - long nEntries = aSeq.getLength(); + tools::Long nEntries = aSeq.getLength(); OutStream->writeLong( nEntries ); for ( const auto nVal : aSeq ) OutStream->writeShort( nVal ); @@ -679,7 +680,7 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt { css::uno::Sequence<sal_Int16> aSeq; rValue >>= aSeq; - long nEntries = aSeq.getLength(); + tools::Long nEntries = aSeq.getLength(); OutStream->writeLong( nEntries ); for ( const auto nVal : aSeq ) OutStream->writeShort( nVal ); @@ -870,9 +871,9 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre } else if ( *pType == cppu::UnoType< css::uno::Sequence< OUString> >::get() ) { - long nEntries = InStream->readLong(); + tools::Long nEntries = InStream->readLong(); css::uno::Sequence< OUString> aSeq( nEntries ); - for ( long n = 0; n < nEntries; n++ ) + for ( tools::Long n = 0; n < nEntries; n++ ) aSeq.getArray()[n] = InStream->readUTF(); aValue <<= aSeq; @@ -880,17 +881,17 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre else if ( *pType == cppu::UnoType< cppu::UnoSequenceType<cppu::UnoUnsignedShortType> >::get() ) { - long nEntries = InStream->readLong(); + tools::Long nEntries = InStream->readLong(); css::uno::Sequence<sal_uInt16> aSeq( nEntries ); - for ( long n = 0; n < nEntries; n++ ) + for ( tools::Long n = 0; n < nEntries; n++ ) aSeq.getArray()[n] = static_cast<sal_uInt16>(InStream->readShort()); aValue <<= aSeq; } else if ( *pType == cppu::UnoType< css::uno::Sequence<sal_Int16> >::get() ) { - long nEntries = InStream->readLong(); + tools::Long nEntries = InStream->readLong(); css::uno::Sequence<sal_Int16> aSeq( nEntries ); - for ( long n = 0; n < nEntries; n++ ) + for ( tools::Long n = 0; n < nEntries; n++ ) aSeq.getArray()[n] = InStream->readShort(); aValue <<= aSeq; } diff --git a/toolkit/source/helper/btndlg.cxx b/toolkit/source/helper/btndlg.cxx index 9885f9468b85..5aec00335260 100644 --- a/toolkit/source/helper/btndlg.cxx +++ b/toolkit/source/helper/btndlg.cxx @@ -29,7 +29,7 @@ struct ImplBtnDlgItem { sal_uInt16 mnId; bool mbOwnButton; - long mnSepSize; + tools::Long mnSepSize; VclPtr<PushButton> mpPushButton; ImplBtnDlgItem() : mnId(0), mbOwnButton(false), mnSepSize(0) {} @@ -87,27 +87,27 @@ VclPtr<PushButton> ButtonDialog::ImplCreatePushButton( ButtonDialogFlags nBtnFla return pBtn; } -long ButtonDialog::ImplGetButtonSize() +tools::Long ButtonDialog::ImplGetButtonSize() { if ( !mbFormat ) return mnButtonSize; // Calculate ButtonSize - long nLastSepSize = 0; - long nSepSize = 0; + tools::Long nLastSepSize = 0; + tools::Long nSepSize = 0; maCtrlSize = Size( IMPL_MINSIZE_BUTTON_WIDTH, IMPL_MINSIZE_BUTTON_HEIGHT ); for (const auto & it : m_ItemList) { nSepSize += nLastSepSize; - long nTxtWidth = it->mpPushButton->GetCtrlTextWidth(it->mpPushButton->GetText()); + tools::Long nTxtWidth = it->mpPushButton->GetCtrlTextWidth(it->mpPushButton->GetText()); nTxtWidth += IMPL_EXTRA_BUTTON_WIDTH; if ( nTxtWidth > maCtrlSize.Width() ) maCtrlSize.setWidth( nTxtWidth ); - long nTxtHeight = it->mpPushButton->GetTextHeight(); + tools::Long nTxtHeight = it->mpPushButton->GetTextHeight(); nTxtHeight += IMPL_EXTRA_BUTTON_HEIGHT; if ( nTxtHeight > maCtrlSize.Height() ) @@ -141,8 +141,8 @@ void ButtonDialog::ImplPosControls() // determine dialog size Size aDlgSize = maPageSize; - long nX; - long nY; + tools::Long nX; + tools::Long nY; if ( GetStyle() & WB_HORZ ) { if ( mnButtonSize+(IMPL_DIALOG_OFFSET*2) > aDlgSize.Width() ) @@ -244,7 +244,7 @@ void ButtonDialog::StateChanged( StateChangedType nType ) } void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId, - ButtonDialogFlags nBtnFlags, long nSepPixel ) + ButtonDialogFlags nBtnFlags, tools::Long nSepPixel ) { // PageItem anlegen std::unique_ptr<ImplBtnDlgItem> pItem(new ImplBtnDlgItem); |