vcl: remove MetricVector

Change-Id: Ib700887ca79f423c65dfb75eea36bbfd808fa172
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114976
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
Chris Sherlock 2021-05-02 03:50:05 +10:00 committed by Tomaž Vajngerl
parent 8c756af15e
commit d19dbcc139
16 changed files with 35 additions and 37 deletions

View File

@ -169,7 +169,7 @@ namespace vclcanvas
std::unique_ptr< ::tools::Long []> aOffsets(new ::tools::Long[maLogicalAdvancements.getLength()]);
setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState);
MetricVector aMetricVector;
std::vector< ::tools::Rectangle > aMetricVector;
uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes;
if (pVDev->GetGlyphBoundRects(
Point(0,0),

View File

@ -826,7 +826,7 @@ public:
virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override;
virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
virtual OUString GetAccessibleCellText(sal_Int32 _nRow, sal_uInt16 _nColPos) const override;
virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) override;
virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override;
virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const override;
virtual void GrabFocus() override;
virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;

View File

@ -111,7 +111,7 @@ public:
virtual void GrabTableFocus() = 0;
// OutputDevice
virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) = 0;
virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) = 0;
// Window
virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const = 0;

View File

@ -86,7 +86,7 @@ protected:
*/
tools::Rectangle DrawControlText( OutputDevice& _rTargetDevice, const tools::Rectangle& _rRect,
const OUString& _rStr, DrawTextFlags _nStyle,
MetricVector* _pVector, OUString* _pDisplayText,
std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText,
const Size* i_pDeviceSize = nullptr ) const;
tools::Rectangle GetControlTextRect( OutputDevice& _rTargetDevice, const tools::Rectangle & rRect,

View File

@ -116,8 +116,6 @@ namespace com::sun::star::awt {
#define GLYPH_FONT_HEIGHT 256
#endif
typedef std::vector< tools::Rectangle > MetricVector;
// OutputDevice-Types
// Flags for DrawText()
@ -976,17 +974,17 @@ public:
void DrawText( const Point& rStartPt, const OUString& rStr,
sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
MetricVector* pVector = nullptr, OUString* pDisplayText = nullptr,
std::vector< tools::Rectangle >* pVector = nullptr, OUString* pDisplayText = nullptr,
const SalLayoutGlyphs* pLayoutCache = nullptr );
void DrawText( const tools::Rectangle& rRect,
const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::NONE,
MetricVector* pVector = nullptr, OUString* pDisplayText = nullptr,
std::vector< tools::Rectangle >* pVector = nullptr, OUString* pDisplayText = nullptr,
vcl::ITextLayout* _pTextLayout = nullptr );
static void ImplDrawText( OutputDevice& rTargetDevice, const tools::Rectangle& rRect,
const OUString& rOrigStr, DrawTextFlags nStyle,
MetricVector* pVector, OUString* pDisplayText, vcl::ITextLayout& _rLayout );
std::vector< tools::Rectangle >* pVector, OUString* pDisplayText, vcl::ITextLayout& _rLayout );
void ImplDrawText( SalLayout& );
@ -994,7 +992,7 @@ public:
void DrawCtrlText( const Point& rPos, const OUString& rStr,
sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
DrawTextFlags nStyle = DrawTextFlags::Mnemonic, MetricVector* pVector = nullptr, OUString* pDisplayText = nullptr,
DrawTextFlags nStyle = DrawTextFlags::Mnemonic, std::vector< tools::Rectangle >* pVector = nullptr, OUString* pDisplayText = nullptr,
const SalLayoutGlyphs* pGlyphs = nullptr);
void DrawTextLine( const Point& rPos, tools::Long nWidth,
@ -1235,7 +1233,7 @@ public:
ImplGetEmphasisMarkStyle( const vcl::Font& rFont );
bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex,
int nLen, MetricVector& rVector );
int nLen, std::vector< tools::Rectangle >& rVector );
sal_Int32 HasGlyphs( const vcl::Font& rFont, const OUString& rStr,
sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;

View File

@ -202,7 +202,7 @@ public:
virtual void GrabTableFocus() override;
// OutputDevice
virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) override;
virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override;
// Window
virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const override;

View File

@ -526,7 +526,7 @@ OUString BrowseBox::GetAccessibleCellText(sal_Int32 _nRow, sal_uInt16 _nColPos)
}
bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector )
bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector )
{
return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector );
}

View File

@ -31,7 +31,7 @@ namespace vcl
public:
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,
MetricVector* _pVector, OUString* _pDisplayText ) = 0;
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 sal_Int32 GetTextBreak( const OUString& _rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
virtual bool DecomposeTextRectAction() const = 0;
@ -61,7 +61,7 @@ namespace vcl
const OUString& _rText,
sal_Int32 _nStartIndex,
sal_Int32 _nLength,
MetricVector* _pVector,
std::vector< tools::Rectangle >* _pVector,
OUString* _pDisplayText ) override;
virtual void GetCaretPositions( const OUString& _rText,
@ -92,7 +92,7 @@ namespace vcl
tools::Rectangle DrawText( const tools::Rectangle& _rRect,
const OUString& _rText, DrawTextFlags _nStyle,
MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize );
std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize );
tools::Rectangle GetTextRect( const tools::Rectangle& _rRect,
const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize );

View File

@ -431,7 +431,7 @@ void Control::ImplInitSettings()
}
tools::Rectangle Control::DrawControlText( OutputDevice& _rTargetDevice, const tools::Rectangle& rRect, const OUString& _rStr,
DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize ) const
DrawTextFlags _nStyle, std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize ) const
{
OUString rPStr = _rStr;
DrawTextFlags nPStyle = _nStyle;

View File

@ -2710,7 +2710,7 @@ void ImplWin::DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout)
aTextRect.AdjustLeft(maImage.GetSizePixel().Width() + IMG_TXT_DISTANCE );
}
MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : nullptr;
std::vector< tools::Rectangle >* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : nullptr;
OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : nullptr;
rRenderContext.DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText );
}

View File

@ -46,7 +46,7 @@ namespace vcl
}
void DefaultTextLayout::DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex,
sal_Int32 _nLength, MetricVector* _pVector, OUString* _pDisplayText )
sal_Int32 _nLength, std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText )
{
m_rTargetDevice.DrawText( _rStartPoint, _rText, _nStartIndex, _nLength, _pVector, _pDisplayText );
}
@ -75,14 +75,14 @@ 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, MetricVector* _pVector, OUString* _pDisplayText ) 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 sal_Int32 GetTextBreak(const OUString& _rText, tools::Long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength) const override;
virtual bool DecomposeTextRectAction() const override;
public:
// equivalents to the respective OutputDevice methods, which take the reference device into account
tools::Rectangle DrawText( const tools::Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize );
tools::Rectangle DrawText( const tools::Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize );
tools::Rectangle GetTextRect( const tools::Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize );
private:
@ -193,14 +193,14 @@ namespace vcl
return GetTextArray( _rText, nullptr, _nStartIndex, _nLength );
}
void ReferenceDeviceTextLayout::DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, MetricVector* _pVector, OUString* _pDisplayText )
void ReferenceDeviceTextLayout::DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText )
{
if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
return;
if ( _pVector && _pDisplayText )
{
MetricVector aGlyphBounds;
std::vector< tools::Rectangle > aGlyphBounds;
m_rReferenceDevice.GetGlyphBoundRects( _rStartPoint, _rText, _nStartIndex, _nLength, aGlyphBounds );
_pVector->insert( _pVector->end(), aGlyphBounds.begin(), aGlyphBounds.end() );
*_pDisplayText += _rText.subView( _nStartIndex, _nLength );
@ -239,7 +239,7 @@ namespace vcl
}
tools::Rectangle ReferenceDeviceTextLayout::DrawText( const tools::Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle,
MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize )
std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize )
{
if ( _rText.isEmpty() )
return tools::Rectangle();
@ -334,7 +334,7 @@ namespace vcl
}
tools::Rectangle ControlTextRenderer::DrawText( const tools::Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle,
MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize )
std::vector< tools::Rectangle >* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize )
{
return m_pImpl->DrawText( _rRect, _rText, _nStyle, _pVector, _pDisplayText, i_pDeviceSize );
}

View File

@ -1363,7 +1363,7 @@ sal_Int32 OutputDevice::ValidateKashidas ( const OUString& rTxt,
}
bool OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr,
int nIndex, int nLen, MetricVector& rVector )
int nIndex, int nLen, std::vector< tools::Rectangle >& rVector )
{
rVector.clear();

View File

@ -790,7 +790,7 @@ const SalLayoutFlags eDefaultLayout = SalLayoutFlags::BiDiStrong;
void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
sal_Int32 nIndex, sal_Int32 nLen,
MetricVector* pVector, OUString* pDisplayText,
std::vector< tools::Rectangle >* pVector, OUString* pDisplayText,
const SalLayoutGlyphs* pLayoutCache
)
{
@ -824,11 +824,11 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
}
if( ! aClip.IsNull() )
{
MetricVector aTmp;
std::vector< tools::Rectangle > aTmp;
GetGlyphBoundRects( rStartPt, rStr, nIndex, nLen, aTmp );
bool bInserted = false;
for( MetricVector::const_iterator it = aTmp.begin(); it != aTmp.end(); ++it, nIndex++ )
for( std::vector< tools::Rectangle >::const_iterator it = aTmp.begin(); it != aTmp.end(); ++it, nIndex++ )
{
bool bAppend = false;
@ -836,7 +836,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
bAppend = true;
else if( rStr[ nIndex ] == ' ' && bInserted )
{
MetricVector::const_iterator next = it;
std::vector< tools::Rectangle >::const_iterator next = it;
++next;
if( next != aTmp.end() && aClip.IsOver( *next ) )
bAppend = true;
@ -1460,7 +1460,7 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, tools::Long nTextWid
void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Rectangle& rRect,
const OUString& rOrigStr, DrawTextFlags nStyle,
MetricVector* pVector, OUString* pDisplayText,
std::vector< tools::Rectangle >* pVector, OUString* pDisplayText,
vcl::ITextLayout& _rLayout )
{
@ -1751,7 +1751,7 @@ void OutputDevice::AddTextRectActions( const tools::Rectangle& rRect,
}
void OutputDevice::DrawText( const tools::Rectangle& rRect, const OUString& rOrigStr, DrawTextFlags nStyle,
MetricVector* pVector, OUString* pDisplayText,
std::vector< tools::Rectangle >* pVector, OUString* pDisplayText,
vcl::ITextLayout* _pTextLayout )
{
assert(!is_double_buffered_window());
@ -2059,7 +2059,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice,
void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr,
sal_Int32 nIndex, sal_Int32 nLen,
DrawTextFlags nStyle, MetricVector* pVector, OUString* pDisplayText,
DrawTextFlags nStyle, std::vector< tools::Rectangle >* pVector, OUString* pDisplayText,
const SalLayoutGlyphs* pGlyphs )
{
assert(!is_double_buffered_window());

View File

@ -162,7 +162,7 @@ void GroupBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
}
}
MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : nullptr;
std::vector< tools::Rectangle >* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : nullptr;
OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : nullptr;
DrawControlText( *pDev, aRect, aText, nTextStyle, pVector, pDisplayText );
}

View File

@ -1051,7 +1051,7 @@ void SvHeaderTabListBox::GrabTableFocus()
GrabFocus();
}
bool SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector )
bool SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector )
{
return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector );
}
@ -1110,7 +1110,7 @@ tools::Rectangle SvHeaderTabListBox::GetFieldCharacterBounds(sal_Int32,sal_Int32
sal_Int32 SvHeaderTabListBox::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
{
OUString sText = GetAccessibleCellText( _nRow, static_cast< sal_uInt16 >( _nColumnPos ) );
MetricVector aRects;
std::vector< tools::Rectangle > aRects;
if ( GetGlyphBoundRects(Point(0,0), sText, 0, sText.getLength(), aRects) )
{
sal_Int32 nPos = 0;

View File

@ -1962,7 +1962,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize,
if (pData->bIsTemporary)
nStyle |= DrawTextFlags::Disable;
MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : nullptr;
std::vector< tools::Rectangle >* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : nullptr;
OUString* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : nullptr;
if (bLayout)
{