drawinglayer/source/primitive2d/textlayoutdevice.cxx | 2 - editeng/source/accessibility/AccessibleStringWrap.cxx | 2 - include/vcl/outdev.hxx | 2 - include/vcl/vcllayout.hxx | 2 - vcl/inc/sallayout.hxx | 4 +- vcl/inc/textlayout.hxx | 4 +- vcl/source/control/edit.cxx | 26 +++++++++--------- vcl/source/gdi/sallayout.cxx | 10 +++--- vcl/source/gdi/textlayout.cxx | 6 ++-- vcl/source/outdev/text.cxx | 20 ++++++------- 10 files changed, 39 insertions(+), 39 deletions(-)
New commits: commit 91399f5d9d9990d2e249155f4810cdaa5051e72b Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sat Oct 30 15:43:48 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Oct 30 18:25:25 2021 +0200 tools::Long->sal_Int32 in GetCaretPositions Change-Id: Id3f037e132a4d07cb2b68dbb93dd24f7f6b33ab6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124461 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 3dfd0258f099..102effd7fde1 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -331,7 +331,7 @@ std::vector<double> TextLayouterDevice::getCaretPositions(const OUString& rText, if (nTextLength) { aRetval.reserve(2 * nTextLength); - std::vector<tools::Long> aArray(2 * nTextLength); + std::vector<sal_Int32> aArray(2 * nTextLength); mrDevice.GetCaretPositions(rText, aArray.data(), nIndex, nLength); aRetval.assign(aArray.begin(), aArray.end()); } diff --git a/editeng/source/accessibility/AccessibleStringWrap.cxx b/editeng/source/accessibility/AccessibleStringWrap.cxx index 29ed20295760..9dff63c3ce75 100644 --- a/editeng/source/accessibility/AccessibleStringWrap.cxx +++ b/editeng/source/accessibility/AccessibleStringWrap.cxx @@ -56,7 +56,7 @@ void AccessibleStringWrap::GetCharacterBounds( sal_Int32 nIndex, tools::Rectangl } else { - tools::Long aXArray[2]; + sal_Int32 aXArray[2]; mrDev.GetCaretPositions( maText, aXArray, nIndex, 1 ); rRect.SetLeft( 0 ); rRect.SetTop( 0 ); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 900a4e88db80..151ab8236c6c 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1061,7 +1061,7 @@ public: vcl::text::TextLayoutCache const* = nullptr, SalLayoutGlyphs const*const pLayoutCache = nullptr) const; - void GetCaretPositions( const OUString&, tools::Long* pCaretXArray, + void GetCaretPositions( const OUString&, sal_Int32* pCaretXArray, sal_Int32 nIndex, sal_Int32 nLen, const SalLayoutGlyphs* pGlyphs = nullptr ) const; void DrawStretchText( const Point& rStartPt, sal_uLong nWidth, diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index 34acb2fe733e..6ea9bc61bfbb 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -88,7 +88,7 @@ public: virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const = 0; virtual DeviceCoordinate FillDXArray( std::vector<DeviceCoordinate>* pDXArray ) const = 0; virtual DeviceCoordinate GetTextWidth() const { return FillDXArray( nullptr ); } - virtual void GetCaretPositions( int nArraySize, tools::Long* pCaretXArray ) const = 0; + virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const = 0; virtual bool IsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594 // methods using glyph indexing diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 8dc16d9021c1..ab29a2022985 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -63,7 +63,7 @@ public: void DrawText(SalGraphics&) const override; sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override; DeviceCoordinate FillDXArray(std::vector<DeviceCoordinate>* pDXArray) const override; - void GetCaretPositions(int nArraySize, tools::Long* pCaretXArray) const override; + void GetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) const override; bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart, const LogicalFontInstance** ppGlyphFont = nullptr, const vcl::font::PhysicalFontFace** pFallbackFont = nullptr) const override; @@ -115,7 +115,7 @@ public: DeviceCoordinate GetTextWidth() const final override; DeviceCoordinate FillDXArray(std::vector<DeviceCoordinate>* pDXArray) const final override; sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const final override; - void GetCaretPositions(int nArraySize, tools::Long* pCaretXArray) const final override; + void GetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) const final override; // used by display layers LogicalFontInstance& GetFont() const diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx index 6d23b1827155..43757d6421b3 100644 --- a/vcl/inc/textlayout.hxx +++ b/vcl/inc/textlayout.hxx @@ -32,7 +32,7 @@ namespace vcl virtual tools::Long GetTextWidth( const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0; virtual void DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText ) = 0; - virtual void GetCaretPositions( const OUString& _rText, tools::Long* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0; + virtual void GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0; virtual sal_Int32 GetTextBreak( const OUString& _rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0; virtual bool DecomposeTextRectAction() const = 0; @@ -65,7 +65,7 @@ namespace vcl OUString* _pDisplayText ) override; virtual void GetCaretPositions( const OUString& _rText, - tools::Long* _pCaretXArray, + sal_Int32* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const override; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index ece46f6ae3a2..46d9f67dc240 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -471,15 +471,15 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const tools::Rectangl const OUString aText = ImplGetText(); const sal_Int32 nLen = aText.getLength(); - tools::Long nDXBuffer[256]; - std::unique_ptr<tools::Long[]> pDXBuffer; - tools::Long* pDX = nDXBuffer; + sal_Int32 nDXBuffer[256]; + std::unique_ptr<sal_Int32[]> pDXBuffer; + sal_Int32* pDX = nDXBuffer; if (nLen) { if (o3tl::make_unsigned(2 * nLen) > SAL_N_ELEMENTS(nDXBuffer)) { - pDXBuffer.reset(new tools::Long[2 * (nLen + 1)]); + pDXBuffer.reset(new sal_Int32[2 * (nLen + 1)]); pDX = pDXBuffer.get(); } @@ -1067,15 +1067,15 @@ void Edit::ImplShowCursor( bool bOnlyIfVisible ) tools::Long nTextPos = 0; - tools::Long nDXBuffer[256]; - std::unique_ptr<tools::Long[]> pDXBuffer; - tools::Long* pDX = nDXBuffer; + sal_Int32 nDXBuffer[256]; + std::unique_ptr<sal_Int32[]> pDXBuffer; + sal_Int32* pDX = nDXBuffer; if( !aText.isEmpty() ) { if( o3tl::make_unsigned(2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) { - pDXBuffer.reset(new tools::Long[2*(aText.getLength()+1)]); + pDXBuffer.reset(new sal_Int32[2*(aText.getLength()+1)]); pDX = pDXBuffer.get(); } @@ -1191,12 +1191,12 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const sal_Int32 nIndex = EDIT_NOLIMIT; OUString aText = ImplGetText(); - tools::Long nDXBuffer[256]; - std::unique_ptr<tools::Long[]> pDXBuffer; - tools::Long* pDX = nDXBuffer; + sal_Int32 nDXBuffer[256]; + std::unique_ptr<sal_Int32[]> pDXBuffer; + sal_Int32* pDX = nDXBuffer; if( o3tl::make_unsigned(2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) { - pDXBuffer.reset(new tools::Long[2*(aText.getLength()+1)]); + pDXBuffer.reset(new sal_Int32[2*(aText.getLength()+1)]); pDX = pDXBuffer.get(); } @@ -2128,7 +2128,7 @@ void Edit::Command( const CommandEvent& rCEvt ) if (mpIMEInfos && mpIMEInfos->nLen > 0) { OUString aText = ImplGetText(); - std::vector<tools::Long> aDX(2*(aText.getLength()+1)); + std::vector<sal_Int32> aDX(2*(aText.getLength()+1)); GetOutDev()->GetCaretPositions( aText, aDX.data(), 0, aText.getLength() ); diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index bdd6deaaa49e..ebf10bf8e17c 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -442,7 +442,7 @@ void GenericSalLayout::ApplyAsianKerning(const OUString& rStr) } } -void GenericSalLayout::GetCaretPositions( int nMaxIndex, tools::Long* pCaretXArray ) const +void GenericSalLayout::GetCaretPositions( int nMaxIndex, sal_Int32* pCaretXArray ) const { // initialize result array for (int i = 0; i < nMaxIndex; ++i) @@ -1080,7 +1080,7 @@ DeviceCoordinate MultiSalLayout::FillDXArray( std::vector<DeviceCoordinate>* pCh return nMaxWidth; } -void MultiSalLayout::GetCaretPositions( int nMaxIndex, tools::Long* pCaretXArray ) const +void MultiSalLayout::GetCaretPositions( int nMaxIndex, sal_Int32* pCaretXArray ) const { SalLayout& rLayout = *mpLayouts[ 0 ]; rLayout.GetCaretPositions( nMaxIndex, pCaretXArray ); @@ -1088,7 +1088,7 @@ void MultiSalLayout::GetCaretPositions( int nMaxIndex, tools::Long* pCaretXArray if( mnLevel <= 1 ) return; - std::unique_ptr<tools::Long[]> const pTempPos(new tools::Long[nMaxIndex]); + std::unique_ptr<sal_Int32[]> const pTempPos(new sal_Int32[nMaxIndex]); for( int n = 1; n < mnLevel; ++n ) { mpLayouts[ n ]->GetCaretPositions( nMaxIndex, pTempPos.get() ); @@ -1097,8 +1097,8 @@ void MultiSalLayout::GetCaretPositions( int nMaxIndex, tools::Long* pCaretXArray for( int i = 0; i < nMaxIndex; ++i ) if( pTempPos[i] >= 0 ) { - tools::Long w = pTempPos[i]; - w = static_cast<tools::Long>(w*fUnitMul + 0.5); + sal_Int32 w = pTempPos[i]; + w = static_cast<sal_Int32>(w*fUnitMul + 0.5); pCaretXArray[i] = w; } } diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 760dba073750..0f63c969931d 100644 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -51,7 +51,7 @@ namespace vcl m_rTargetDevice.DrawText( _rStartPoint, _rText, _nStartIndex, _nLength, _pVector, _pDisplayText ); } - void DefaultTextLayout::GetCaretPositions( const OUString& _rText, tools::Long* _pCaretXArray, + void DefaultTextLayout::GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const { m_rTargetDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ); @@ -76,7 +76,7 @@ namespace vcl // ITextLayout virtual tools::Long GetTextWidth( const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen ) const override; virtual void DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText ) override; - virtual void GetCaretPositions( const OUString& _rText, tools::Long* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const override; + virtual void GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const override; virtual sal_Int32 GetTextBreak(const OUString& _rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override; virtual bool DecomposeTextRectAction() const override; @@ -214,7 +214,7 @@ namespace vcl m_aCompleteTextRect.Union( tools::Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) ); } - void ReferenceDeviceTextLayout::GetCaretPositions( const OUString& _rText, tools::Long* _pCaretXArray, + void ReferenceDeviceTextLayout::GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const { if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 3de36a88e4e1..57a8a1e55568 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1060,7 +1060,7 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_In #endif /* VCL_FLOAT_DEVICE_PIXEL */ } -void OutputDevice::GetCaretPositions( const OUString& rStr, tools::Long* pCaretXArray, +void OutputDevice::GetCaretPositions( const OUString& rStr, sal_Int32* pCaretXArray, sal_Int32 nIndex, sal_Int32 nLen, const SalLayoutGlyphs* pGlyphs ) const { @@ -1613,11 +1613,11 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta tools::Long nMnemonicY; DeviceCoordinate nMnemonicWidth; - std::unique_ptr<tools::Long[]> const pCaretXArray(new tools::Long[2 * nLineLen]); + std::unique_ptr<sal_Int32[]> const pCaretXArray(new sal_Int32[2 * nLineLen]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), nIndex, nLineLen ); - tools::Long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; - tools::Long lc_x2 = pCaretXArray[2*(nMnemonicPos - nIndex)+1]; + sal_Int32 lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; + sal_Int32 lc_x2 = pCaretXArray[2*(nMnemonicPos - nIndex)+1]; nMnemonicWidth = rTargetDevice.LogicWidthToDeviceCoordinate( std::abs(lc_x1 - lc_x2) ); Point aTempPos = rTargetDevice.LogicToPixel( aPos ); @@ -1682,10 +1682,10 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta DeviceCoordinate nMnemonicWidth = 0; if ( nMnemonicPos != -1 ) { - std::unique_ptr<tools::Long[]> const pCaretXArray(new tools::Long[2 * aStr.getLength()]); + std::unique_ptr<sal_Int32[]> const pCaretXArray(new sal_Int32[2 * aStr.getLength()]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() ); - tools::Long lc_x1 = pCaretXArray[2*nMnemonicPos]; - tools::Long lc_x2 = pCaretXArray[2*nMnemonicPos+1]; + sal_Int32 lc_x1 = pCaretXArray[2*nMnemonicPos]; + sal_Int32 lc_x2 = pCaretXArray[2*nMnemonicPos+1]; nMnemonicWidth = rTargetDevice.LogicWidthToDeviceCoordinate( std::abs(lc_x1 - lc_x2) ); Point aTempPos = rTargetDevice.LogicToPixel( aPos ); @@ -2122,10 +2122,10 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, nMnemonicPos = nLen-1; } - std::unique_ptr<tools::Long[]> const pCaretXArray(new tools::Long[2 * nLen]); + std::unique_ptr<sal_Int32[]> const pCaretXArray(new sal_Int32[2 * nLen]); /*sal_Bool bRet =*/ GetCaretPositions( aStr, pCaretXArray.get(), nIndex, nLen, pGlyphs ); - tools::Long lc_x1 = pCaretXArray[ 2*(nMnemonicPos - nIndex) ]; - tools::Long lc_x2 = pCaretXArray[ 2*(nMnemonicPos - nIndex)+1 ]; + sal_Int32 lc_x1 = pCaretXArray[ 2*(nMnemonicPos - nIndex) ]; + sal_Int32 lc_x2 = pCaretXArray[ 2*(nMnemonicPos - nIndex)+1 ]; nMnemonicWidth = ::abs(static_cast<int>(lc_x1 - lc_x2)); Point aTempPos( std::min(lc_x1,lc_x2), GetFontMetric().GetAscent() );