Kaydet (Commit) fb31134e authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

refactor cui tabpages controls to use RenderContext

Change-Id: I91db162053cddfd669abe081e39bb85d3ee3e1f5
üst 9fd81f77
......@@ -145,36 +145,35 @@ void SvxNumberPreview::NotifyChange( const OUString& rPrevStr,
#*
#************************************************************************/
void SvxNumberPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
vcl::Font aDrawFont = GetFont();
Size aSzWnd = GetOutputSizePixel();
OUString aTmpStr( aPrevStr );
long nLeadSpace = (aSzWnd.Width() - GetTextWidth( aTmpStr )) /2;
vcl::Font aDrawFont = rRenderContext.GetFont();
Size aSzWnd = rRenderContext.GetOutputSizePixel();
OUString aTmpStr( aPrevStr );
long nLeadSpace = (aSzWnd.Width() - rRenderContext.GetTextWidth(aTmpStr)) / 2;
aDrawFont.SetColor( aPrevCol );
SetFont( aDrawFont );
aDrawFont.SetColor(aPrevCol);
rRenderContext.SetFont(aDrawFont);
if ( mnPos != -1 )
if (mnPos != -1)
{
long nCharWidth = GetTextWidth( OUString( mnChar ) );
long nCharWidth = rRenderContext.GetTextWidth(OUString(mnChar));
int nNumCharsToInsert = 0;
if (nCharWidth > 0) nNumCharsToInsert = nLeadSpace / nCharWidth;
if (nCharWidth > 0)
nNumCharsToInsert = nLeadSpace / nCharWidth;
if ( nNumCharsToInsert > 0)
if (nNumCharsToInsert > 0)
{
for ( int i = 0; i < nNumCharsToInsert; ++i )
aTmpStr = aTmpStr.replaceAt( mnPos, 0, OUString(mnChar) );
for (int i = 0; i < nNumCharsToInsert; ++i)
aTmpStr = aTmpStr.replaceAt(mnPos, 0, OUString(mnChar));
}
}
Point aPosText = Point( ( mnPos != -1 ) ? 0 : nLeadSpace,
(aSzWnd.Height() - GetTextHeight())/2 );
DrawText( aPosText, aTmpStr );
Point aPosText = Point((mnPos != -1) ? 0 : nLeadSpace,
(aSzWnd.Height() - GetTextHeight()) / 2);
rRenderContext.DrawText(aPosText, aTmpStr);
}
void SvxNumberPreview::InitSettings( bool bForeground, bool bBackground )
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment