1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "cellvalueconversion.hxx"
22 #include "table/gridtablerenderer.hxx"
23 #include <svtools/colorcfg.hxx>
25 #include <com/sun/star/graphic/XGraphic.hpp>
27 #include <comphelper/processfactory.hxx>
28 #include <tools/debug.hxx>
29 #include <tools/diagnose_ex.h>
30 #include <vcl/window.hxx>
31 #include <vcl/image.hxx>
32 #include <vcl/virdev.hxx>
33 #include <vcl/decoview.hxx>
34 #include <vcl/settings.hxx>
37 namespace svt
{ namespace table
39 using ::css::uno::Any
;
40 using ::css::uno::Reference
;
41 using ::css::uno::UNO_QUERY
;
42 using ::css::uno::XInterface
;
43 using ::css::uno::TypeClass_INTERFACE
;
44 using ::css::graphic::XGraphic
;
45 using ::css::style::HorizontalAlignment
;
46 using ::css::style::HorizontalAlignment_LEFT
;
47 using ::css::style::HorizontalAlignment_CENTER
;
48 using ::css::style::HorizontalAlignment_RIGHT
;
49 using ::css::style::VerticalAlignment
;
50 using ::css::style::VerticalAlignment_TOP
;
51 using ::css::style::VerticalAlignment_MIDDLE
;
52 using ::css::style::VerticalAlignment_BOTTOM
;
55 //= CachedSortIndicator
57 class CachedSortIndicator
61 : m_lastHeaderHeight( 0 )
62 , m_lastArrowColor( COL_TRANSPARENT
)
66 BitmapEx
const & getBitmapFor(OutputDevice
const & i_device
, long const i_headerHeight
,
67 StyleSettings
const & i_style
, bool const i_sortAscending
);
70 long m_lastHeaderHeight
;
71 Color m_lastArrowColor
;
72 BitmapEx m_sortAscending
;
73 BitmapEx m_sortDescending
;
76 BitmapEx
const & CachedSortIndicator::getBitmapFor(vcl::RenderContext
const& i_device
, long const i_headerHeight
,
77 StyleSettings
const & i_style
, bool const i_sortAscending
)
79 BitmapEx
& rBitmap(i_sortAscending
? m_sortAscending
: m_sortDescending
);
80 if (!rBitmap
|| (i_headerHeight
!= m_lastHeaderHeight
) || (i_style
.GetActiveColor() != m_lastArrowColor
))
82 long const nSortIndicatorWidth
= 2 * i_headerHeight
/ 3;
83 long const nSortIndicatorHeight
= 2 * nSortIndicatorWidth
/ 3;
85 Point
const aBitmapPos( 0, 0 );
86 Size
const aBitmapSize( nSortIndicatorWidth
, nSortIndicatorHeight
);
87 ScopedVclPtrInstance
< VirtualDevice
> aDevice( i_device
, 0, 0 );
88 aDevice
->SetOutputSizePixel( aBitmapSize
);
90 DecorationView
aDecoView(aDevice
.get());
91 aDecoView
.DrawSymbol(Rectangle(aBitmapPos
, aBitmapSize
),
92 i_sortAscending
? SymbolType::SPIN_UP
: SymbolType::SPIN_DOWN
,
93 i_style
.GetActiveColor());
95 rBitmap
= aDevice
->GetBitmapEx(aBitmapPos
, aBitmapSize
);
96 m_lastHeaderHeight
= i_headerHeight
;
97 m_lastArrowColor
= i_style
.GetActiveColor();
103 //= GridTableRenderer_Impl
105 struct GridTableRenderer_Impl
110 CachedSortIndicator aSortIndicator
;
111 CellValueConversion aStringConverter
;
113 GridTableRenderer_Impl( ITableModel
& _rModel
)
115 , nCurrentRow( ROW_INVALID
)
116 , bUseGridLines( true )
128 static Rectangle
lcl_getContentArea( GridTableRenderer_Impl
const & i_impl
, Rectangle
const & i_cellArea
)
130 Rectangle
aContentArea( i_cellArea
);
131 if ( i_impl
.bUseGridLines
)
133 --aContentArea
.Right();
134 --aContentArea
.Bottom();
138 static Rectangle
lcl_getTextRenderingArea( Rectangle
const & i_contentArea
)
140 Rectangle
aTextArea( i_contentArea
);
141 aTextArea
.Left() += 2; aTextArea
.Right() -= 2;
142 ++aTextArea
.Top(); --aTextArea
.Bottom();
146 static DrawTextFlags
lcl_getAlignmentTextDrawFlags( GridTableRenderer_Impl
const & i_impl
, ColPos
const i_columnPos
)
148 DrawTextFlags nVertFlag
= DrawTextFlags::Top
;
149 VerticalAlignment
const eVertAlign
= i_impl
.rModel
.getVerticalAlign();
150 switch ( eVertAlign
)
152 case VerticalAlignment_MIDDLE
: nVertFlag
= DrawTextFlags::VCenter
; break;
153 case VerticalAlignment_BOTTOM
: nVertFlag
= DrawTextFlags::Bottom
; break;
158 DrawTextFlags nHorzFlag
= DrawTextFlags::Left
;
159 HorizontalAlignment
const eHorzAlign
= i_impl
.rModel
.getColumnCount() > 0
160 ? i_impl
.rModel
.getColumnModel( i_columnPos
)->getHorizontalAlign()
161 : HorizontalAlignment_CENTER
;
162 switch ( eHorzAlign
)
164 case HorizontalAlignment_CENTER
: nHorzFlag
= DrawTextFlags::Center
; break;
165 case HorizontalAlignment_RIGHT
: nHorzFlag
= DrawTextFlags::Right
; break;
170 return nVertFlag
| nHorzFlag
;
176 //= GridTableRenderer
179 GridTableRenderer::GridTableRenderer( ITableModel
& _rModel
)
180 :m_pImpl( new GridTableRenderer_Impl( _rModel
) )
185 GridTableRenderer::~GridTableRenderer()
190 bool GridTableRenderer::useGridLines() const
192 return m_pImpl
->bUseGridLines
;
196 void GridTableRenderer::useGridLines( bool const i_use
)
198 m_pImpl
->bUseGridLines
= i_use
;
204 Color
lcl_getEffectiveColor(boost::optional
<Color
> const& i_modelColor
,
205 StyleSettings
const& i_styleSettings
,
206 Color
const& (StyleSettings::*i_getDefaultColor
) () const)
209 return *i_modelColor
;
210 return (i_styleSettings
.*i_getDefaultColor
)();
215 void GridTableRenderer::PaintHeaderArea(vcl::RenderContext
& rRenderContext
, const Rectangle
& _rArea
,
216 bool _bIsColHeaderArea
, bool _bIsRowHeaderArea
, const StyleSettings
& _rStyle
)
218 OSL_PRECOND(_bIsColHeaderArea
|| _bIsRowHeaderArea
, "GridTableRenderer::PaintHeaderArea: invalid area flags!");
220 rRenderContext
.Push(PushFlags::FILLCOLOR
| PushFlags::LINECOLOR
);
222 Color
const background
= lcl_getEffectiveColor(m_pImpl
->rModel
.getHeaderBackgroundColor(),
223 _rStyle
, &StyleSettings::GetDialogColor
);
224 rRenderContext
.SetFillColor(background
);
226 rRenderContext
.SetLineColor();
227 rRenderContext
.DrawRect(_rArea
);
229 // delimiter lines at bottom/right
230 boost::optional
<Color
> aLineColor(m_pImpl
->rModel
.getLineColor());
231 Color
const lineColor
= !aLineColor
? _rStyle
.GetSeparatorColor() : *aLineColor
;
232 rRenderContext
.SetLineColor(lineColor
);
233 rRenderContext
.DrawLine(_rArea
.BottomLeft(), _rArea
.BottomRight());
234 rRenderContext
.DrawLine(_rArea
.BottomRight(), _rArea
.TopRight());
236 rRenderContext
.Pop();
237 (void)_bIsColHeaderArea
;
238 (void)_bIsRowHeaderArea
;
242 void GridTableRenderer::PaintColumnHeader(ColPos _nCol
, bool _bActive
, bool _bSelected
, vcl::RenderContext
& rRenderContext
,
243 const Rectangle
& _rArea
, const StyleSettings
& _rStyle
)
245 rRenderContext
.Push(PushFlags::LINECOLOR
);
247 OUString sHeaderText
;
248 PColumnModel
const pColumn
= m_pImpl
->rModel
.getColumnModel( _nCol
);
249 DBG_ASSERT( !!pColumn
, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
251 sHeaderText
= pColumn
->getName();
253 Color
const textColor
= lcl_getEffectiveColor( m_pImpl
->rModel
.getTextColor(), _rStyle
, &StyleSettings::GetFieldTextColor
);
254 rRenderContext
.SetTextColor(textColor
);
256 Rectangle
const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl
, _rArea
) ) );
257 DrawTextFlags nDrawTextFlags
= lcl_getAlignmentTextDrawFlags( *m_pImpl
, _nCol
) | DrawTextFlags::Clip
;
258 if (!m_pImpl
->rModel
.isEnabled())
259 nDrawTextFlags
|= DrawTextFlags::Disable
;
260 rRenderContext
.DrawText( aTextRect
, sHeaderText
, nDrawTextFlags
);
262 boost::optional
<Color
> const aLineColor( m_pImpl
->rModel
.getLineColor() );
263 Color
const lineColor
= !aLineColor
? _rStyle
.GetSeparatorColor() : *aLineColor
;
264 rRenderContext
.SetLineColor( lineColor
);
265 rRenderContext
.DrawLine( _rArea
.BottomRight(), _rArea
.TopRight());
266 rRenderContext
.DrawLine( _rArea
.BottomLeft(), _rArea
.BottomRight() );
268 // draw sort indicator if the model data is sorted by the given column
269 ITableDataSort
const * pSortAdapter
= m_pImpl
->rModel
.getSortAdapter();
270 ColumnSort aCurrentSortOrder
;
271 if ( pSortAdapter
!= NULL
)
272 aCurrentSortOrder
= pSortAdapter
->getCurrentSortOrder();
273 if ( aCurrentSortOrder
.nColumnPos
== _nCol
)
275 long const nHeaderHeight( _rArea
.GetHeight() );
276 BitmapEx
const aIndicatorBitmap
= m_pImpl
->aSortIndicator
.getBitmapFor(rRenderContext
, nHeaderHeight
, _rStyle
,
277 aCurrentSortOrder
.eSortDirection
== ColumnSortAscending
);
278 Size
const aBitmapSize( aIndicatorBitmap
.GetSizePixel() );
279 long const nSortIndicatorPaddingX
= 2;
280 long const nSortIndicatorPaddingY
= ( nHeaderHeight
- aBitmapSize
.Height() ) / 2;
282 if ( nDrawTextFlags
& DrawTextFlags::Right
)
284 // text is right aligned => draw the sort indicator at the left hand side
285 rRenderContext
.DrawBitmapEx(Point(_rArea
.Left() + nSortIndicatorPaddingX
, _rArea
.Top() + nSortIndicatorPaddingY
),
290 // text is left-aligned or centered => draw the sort indicator at the right hand side
291 rRenderContext
.DrawBitmapEx(Point(_rArea
.Right() - nSortIndicatorPaddingX
- aBitmapSize
.Width(), nSortIndicatorPaddingY
),
296 rRenderContext
.Pop();
299 // no special painting for the active column at the moment
302 // selection for column header not yet implemented
306 void GridTableRenderer::PrepareRow(RowPos _nRow
, bool i_hasControlFocus
, bool _bSelected
, vcl::RenderContext
& rRenderContext
,
307 const Rectangle
& _rRowArea
, const StyleSettings
& _rStyle
)
309 // remember the row for subsequent calls to the other ->ITableRenderer methods
310 m_pImpl
->nCurrentRow
= _nRow
;
312 rRenderContext
.Push(PushFlags::FILLCOLOR
| PushFlags::LINECOLOR
);
314 Color backgroundColor
= _rStyle
.GetFieldColor();
316 boost::optional
<Color
> const aLineColor( m_pImpl
->rModel
.getLineColor() );
317 Color lineColor
= !aLineColor
? _rStyle
.GetSeparatorColor() : *aLineColor
;
319 Color
const activeSelectionBackColor
= lcl_getEffectiveColor(m_pImpl
->rModel
.getActiveSelectionBackColor(),
320 _rStyle
, &StyleSettings::GetHighlightColor
);
323 // selected rows use the background color from the style
324 backgroundColor
= i_hasControlFocus
325 ? activeSelectionBackColor
326 : lcl_getEffectiveColor(m_pImpl
->rModel
.getInactiveSelectionBackColor(), _rStyle
, &StyleSettings::GetDeactiveColor
);
328 lineColor
= backgroundColor
;
332 boost::optional
< std::vector
<Color
> > aRowColors
= m_pImpl
->rModel
.getRowBackgroundColors();
335 // use alternating default colors
336 Color
const fieldColor
= _rStyle
.GetFieldColor();
337 if (_rStyle
.GetHighContrastMode() || ((m_pImpl
->nCurrentRow
% 2) == 0))
339 backgroundColor
= fieldColor
;
343 Color hilightColor
= activeSelectionBackColor
;
344 hilightColor
.SetRed( 9 * ( fieldColor
.GetRed() - hilightColor
.GetRed() ) / 10 + hilightColor
.GetRed() );
345 hilightColor
.SetGreen( 9 * ( fieldColor
.GetGreen() - hilightColor
.GetGreen() ) / 10 + hilightColor
.GetGreen() );
346 hilightColor
.SetBlue( 9 * ( fieldColor
.GetBlue() - hilightColor
.GetBlue() ) / 10 + hilightColor
.GetBlue() );
347 backgroundColor
= hilightColor
;
352 if (aRowColors
->empty())
354 // all colors have the same background color
355 backgroundColor
= _rStyle
.GetFieldColor();
359 backgroundColor
= aRowColors
->at(m_pImpl
->nCurrentRow
% aRowColors
->size());
364 rRenderContext
.SetLineColor();
365 rRenderContext
.SetFillColor(backgroundColor
);
366 rRenderContext
.DrawRect(_rRowArea
);
368 rRenderContext
.Pop();
372 void GridTableRenderer::PaintRowHeader(bool /*i_hasControlFocus*/, bool /*_bSelected*/, vcl::RenderContext
& rRenderContext
,
373 const Rectangle
& _rArea
, const StyleSettings
& _rStyle
)
375 rRenderContext
.Push( PushFlags::LINECOLOR
| PushFlags::TEXTCOLOR
);
377 boost::optional
<Color
> const aLineColor( m_pImpl
->rModel
.getLineColor() );
378 Color
const lineColor
= !aLineColor
? _rStyle
.GetSeparatorColor() : *aLineColor
;
379 rRenderContext
.SetLineColor(lineColor
);
380 rRenderContext
.DrawLine(_rArea
.BottomLeft(), _rArea
.BottomRight());
382 Any
const rowHeading( m_pImpl
->rModel
.getRowHeading( m_pImpl
->nCurrentRow
) );
383 OUString
const rowTitle( m_pImpl
->aStringConverter
.convertToString( rowHeading
) );
384 if (!rowTitle
.isEmpty())
386 Color
const textColor
= lcl_getEffectiveColor(m_pImpl
->rModel
.getHeaderTextColor(),
387 _rStyle
, &StyleSettings::GetFieldTextColor
);
388 rRenderContext
.SetTextColor(textColor
);
390 Rectangle
const aTextRect(lcl_getTextRenderingArea(lcl_getContentArea(*m_pImpl
, _rArea
)));
391 DrawTextFlags nDrawTextFlags
= lcl_getAlignmentTextDrawFlags(*m_pImpl
, 0) | DrawTextFlags::Clip
;
392 if (!m_pImpl
->rModel
.isEnabled())
393 nDrawTextFlags
|= DrawTextFlags::Disable
;
394 // TODO: is using the horizontal alignment of the 0'th column a good idea here? This is pretty ... arbitray ..
395 rRenderContext
.DrawText(aTextRect
, rowTitle
, nDrawTextFlags
);
398 rRenderContext
.Pop();
402 struct GridTableRenderer::CellRenderContext
404 OutputDevice
& rDevice
;
405 Rectangle
const aContentArea
;
406 StyleSettings
const & rStyle
;
407 ColPos
const nColumn
;
408 bool const bSelected
;
409 bool const bHasControlFocus
;
411 CellRenderContext( OutputDevice
& i_device
, Rectangle
const & i_contentArea
,
412 StyleSettings
const & i_style
, ColPos
const i_column
, bool const i_selected
, bool const i_hasControlFocus
)
414 ,aContentArea( i_contentArea
)
417 ,bSelected( i_selected
)
418 ,bHasControlFocus( i_hasControlFocus
)
424 void GridTableRenderer::PaintCell(ColPos
const i_column
, bool _bSelected
, bool i_hasControlFocus
,
425 vcl::RenderContext
& rRenderContext
, const Rectangle
& _rArea
, const StyleSettings
& _rStyle
)
427 rRenderContext
.Push(PushFlags::LINECOLOR
| PushFlags::FILLCOLOR
);
429 Rectangle
const aContentArea(lcl_getContentArea(*m_pImpl
, _rArea
));
430 CellRenderContext
const aCellRenderContext(rRenderContext
, aContentArea
, _rStyle
, i_column
, _bSelected
, i_hasControlFocus
);
431 impl_paintCellContent(aCellRenderContext
);
433 if ( m_pImpl
->bUseGridLines
)
435 ::boost::optional
< ::Color
> aLineColor( m_pImpl
->rModel
.getLineColor() );
436 ::Color lineColor
= !aLineColor
? _rStyle
.GetSeparatorColor() : *aLineColor
;
438 if ( _bSelected
&& !aLineColor
)
440 // if no line color is specified by the model, use the usual selection color for lines in selected cells
441 lineColor
= i_hasControlFocus
442 ? lcl_getEffectiveColor( m_pImpl
->rModel
.getActiveSelectionBackColor(), _rStyle
, &StyleSettings::GetHighlightColor
)
443 : lcl_getEffectiveColor( m_pImpl
->rModel
.getInactiveSelectionBackColor(), _rStyle
, &StyleSettings::GetDeactiveColor
);
446 rRenderContext
.SetLineColor( lineColor
);
447 rRenderContext
.DrawLine( _rArea
.BottomLeft(), _rArea
.BottomRight() );
448 rRenderContext
.DrawLine( _rArea
.BottomRight(), _rArea
.TopRight() );
451 rRenderContext
.Pop();
455 void GridTableRenderer::impl_paintCellImage( CellRenderContext
const & i_context
, Image
const & i_image
)
457 Point
imagePos( Point( i_context
.aContentArea
.Left(), i_context
.aContentArea
.Top() ) );
458 Size imageSize
= i_image
.GetSizePixel();
459 if ( i_context
.aContentArea
.GetWidth() > imageSize
.Width() )
461 const HorizontalAlignment eHorzAlign
= m_pImpl
->rModel
.getColumnModel( i_context
.nColumn
)->getHorizontalAlign();
462 switch ( eHorzAlign
)
464 case HorizontalAlignment_CENTER
:
465 imagePos
.X() += ( i_context
.aContentArea
.GetWidth() - imageSize
.Width() ) / 2;
467 case HorizontalAlignment_RIGHT
:
468 imagePos
.X() = i_context
.aContentArea
.Right() - imageSize
.Width();
476 imageSize
.Width() = i_context
.aContentArea
.GetWidth();
478 if ( i_context
.aContentArea
.GetHeight() > imageSize
.Height() )
480 const VerticalAlignment eVertAlign
= m_pImpl
->rModel
.getVerticalAlign();
481 switch ( eVertAlign
)
483 case VerticalAlignment_MIDDLE
:
484 imagePos
.Y() += ( i_context
.aContentArea
.GetHeight() - imageSize
.Height() ) / 2;
486 case VerticalAlignment_BOTTOM
:
487 imagePos
.Y() = i_context
.aContentArea
.Bottom() - imageSize
.Height();
494 imageSize
.Height() = i_context
.aContentArea
.GetHeight() - 1;
495 DrawImageFlags
const nStyle
= m_pImpl
->rModel
.isEnabled() ? DrawImageFlags::NONE
: DrawImageFlags::Disable
;
496 i_context
.rDevice
.DrawImage( imagePos
, imageSize
, i_image
, nStyle
);
500 void GridTableRenderer::impl_paintCellContent( CellRenderContext
const & i_context
)
503 m_pImpl
->rModel
.getCellContent( i_context
.nColumn
, m_pImpl
->nCurrentRow
, aCellContent
);
505 if ( aCellContent
.getValueTypeClass() == TypeClass_INTERFACE
)
507 Reference
< XInterface
> const xContentInterface( aCellContent
, UNO_QUERY
);
508 if ( !xContentInterface
.is() )
512 Reference
< XGraphic
> const xGraphic( aCellContent
, UNO_QUERY
);
513 ENSURE_OR_RETURN_VOID( xGraphic
.is(), "GridTableRenderer::impl_paintCellContent: only XGraphic interfaces (or NULL) are supported for painting." );
515 const Image
aImage( xGraphic
);
516 impl_paintCellImage( i_context
, aImage
);
520 const OUString
sText( m_pImpl
->aStringConverter
.convertToString( aCellContent
) );
521 impl_paintCellText( i_context
, sText
);
525 void GridTableRenderer::impl_paintCellText( CellRenderContext
const & i_context
, OUString
const & i_text
)
527 if ( i_context
.bSelected
)
529 ::Color
const textColor
= i_context
.bHasControlFocus
530 ? lcl_getEffectiveColor( m_pImpl
->rModel
.getActiveSelectionTextColor(), i_context
.rStyle
, &StyleSettings::GetHighlightTextColor
)
531 : lcl_getEffectiveColor( m_pImpl
->rModel
.getInactiveSelectionTextColor(), i_context
.rStyle
, &StyleSettings::GetDeactiveTextColor
);
532 i_context
.rDevice
.SetTextColor( textColor
);
536 ::Color
const textColor
= lcl_getEffectiveColor( m_pImpl
->rModel
.getTextColor(), i_context
.rStyle
, &StyleSettings::GetFieldTextColor
);
537 i_context
.rDevice
.SetTextColor( textColor
);
540 Rectangle
const textRect( lcl_getTextRenderingArea( i_context
.aContentArea
) );
541 DrawTextFlags nDrawTextFlags
= lcl_getAlignmentTextDrawFlags( *m_pImpl
, i_context
.nColumn
) | DrawTextFlags::Clip
;
542 if ( !m_pImpl
->rModel
.isEnabled() )
543 nDrawTextFlags
|= DrawTextFlags::Disable
;
544 i_context
.rDevice
.DrawText( textRect
, i_text
, nDrawTextFlags
);
548 void GridTableRenderer::ShowCellCursor( vcl::Window
& _rView
, const Rectangle
& _rCursorRect
)
550 _rView
.ShowFocus( _rCursorRect
);
554 void GridTableRenderer::HideCellCursor( vcl::Window
& _rView
, const Rectangle
& _rCursorRect
)
561 bool GridTableRenderer::FitsIntoCell( Any
const & i_cellContent
, ColPos
const i_colPos
, RowPos
const i_rowPos
,
562 bool const i_active
, bool const i_selected
, OutputDevice
& i_targetDevice
, Rectangle
const & i_targetArea
) const
564 if ( !i_cellContent
.hasValue() )
567 if ( i_cellContent
.getValueTypeClass() == TypeClass_INTERFACE
)
569 Reference
< XInterface
> const xContentInterface( i_cellContent
, UNO_QUERY
);
570 if ( !xContentInterface
.is() )
573 Reference
< XGraphic
> const xGraphic( i_cellContent
, UNO_QUERY
);
575 // for the moment, assume it fits. We can always scale it down during painting ...
578 OSL_ENSURE( false, "GridTableRenderer::FitsIntoCell: only XGraphic interfaces (or NULL) are supported for painting." );
582 OUString
const sText( m_pImpl
->aStringConverter
.convertToString( i_cellContent
) );
583 if ( sText
.isEmpty() )
586 Rectangle
const aTargetArea( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl
, i_targetArea
) ) );
588 long const nTextHeight
= i_targetDevice
.GetTextHeight();
589 if ( nTextHeight
> aTargetArea
.GetHeight() )
592 long const nTextWidth
= i_targetDevice
.GetTextWidth( sText
);
593 if ( nTextWidth
> aTargetArea
.GetWidth() )
596 OSL_UNUSED( i_active
);
597 OSL_UNUSED( i_selected
);
598 OSL_UNUSED( i_rowPos
);
599 OSL_UNUSED( i_colPos
);
604 bool GridTableRenderer::GetFormattedCellString( Any
const & i_cellValue
, ColPos
const i_colPos
, RowPos
const i_rowPos
, OUString
& o_cellString
) const
606 o_cellString
= m_pImpl
->aStringConverter
.convertToString( i_cellValue
);
608 OSL_UNUSED( i_colPos
);
609 OSL_UNUSED( i_rowPos
);
614 } } // namespace svt::table
617 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */