LibreOffice Module toolkit (master) 1
gridtablerenderer.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20
24
25#include <com/sun/star/graphic/XGraphic.hpp>
26
27#include <tools/debug.hxx>
29#include <vcl/window.hxx>
30#include <vcl/image.hxx>
31#include <vcl/virdev.hxx>
32#include <vcl/decoview.hxx>
33#include <vcl/settings.hxx>
34
35
36namespace svt::table
37{
38 using ::css::uno::Any;
39 using ::css::uno::Reference;
40 using ::css::uno::UNO_QUERY;
41 using ::css::uno::XInterface;
42 using ::css::uno::TypeClass_INTERFACE;
43 using ::css::graphic::XGraphic;
44 using ::css::style::HorizontalAlignment;
45 using ::css::style::HorizontalAlignment_CENTER;
46 using ::css::style::HorizontalAlignment_RIGHT;
47 using ::css::style::VerticalAlignment;
48 using ::css::style::VerticalAlignment_MIDDLE;
49 using ::css::style::VerticalAlignment_BOTTOM;
50
51
52 //= CachedSortIndicator
53
54 namespace {
55
56 class CachedSortIndicator
57 {
58 public:
59 CachedSortIndicator()
62 {
63 }
64
65 BitmapEx const & getBitmapFor(vcl::RenderContext const & i_device, tools::Long const i_headerHeight,
66 StyleSettings const & i_style, bool const i_sortAscending);
67
68 private:
73 };
74
75 }
76
77 BitmapEx const & CachedSortIndicator::getBitmapFor(vcl::RenderContext const& i_device, tools::Long const i_headerHeight,
78 StyleSettings const & i_style, bool const i_sortAscending )
79 {
80 BitmapEx& rBitmap(i_sortAscending ? m_sortAscending : m_sortDescending);
81 if (rBitmap.IsEmpty() || (i_headerHeight != m_lastHeaderHeight) || (i_style.GetActiveColor() != m_lastArrowColor))
82 {
83 tools::Long const nSortIndicatorWidth = 2 * i_headerHeight / 3;
84 tools::Long const nSortIndicatorHeight = 2 * nSortIndicatorWidth / 3;
85
86 Point const aBitmapPos( 0, 0 );
87 Size const aBitmapSize( nSortIndicatorWidth, nSortIndicatorHeight );
88 ScopedVclPtrInstance< VirtualDevice > aDevice(i_device, DeviceFormat::WITH_ALPHA);
89 aDevice->SetOutputSizePixel( aBitmapSize );
90
91 DecorationView aDecoView(aDevice.get());
92 aDecoView.DrawSymbol(tools::Rectangle(aBitmapPos, aBitmapSize),
93 i_sortAscending ? SymbolType::SPIN_UP : SymbolType::SPIN_DOWN,
94 i_style.GetActiveColor());
95
96 rBitmap = aDevice->GetBitmapEx(aBitmapPos, aBitmapSize);
97 m_lastHeaderHeight = i_headerHeight;
99 }
100 return rBitmap;
101 }
102
103
104 //= GridTableRenderer_Impl
105
107 {
111 CachedSortIndicator aSortIndicator;
113
115 : rModel( _rModel )
117 , bUseGridLines( true )
118 , aSortIndicator( )
120 {
121 }
122 };
123
124
125 //= helper
126
127 namespace
128 {
129 tools::Rectangle lcl_getContentArea( GridTableRenderer_Impl const & i_impl, tools::Rectangle const & i_cellArea )
130 {
131 tools::Rectangle aContentArea( i_cellArea );
132 if ( i_impl.bUseGridLines )
133 {
134 aContentArea.AdjustRight( -1 );
135 aContentArea.AdjustBottom( -1 );
136 }
137 return aContentArea;
138 }
139 tools::Rectangle lcl_getTextRenderingArea( tools::Rectangle const & i_contentArea )
140 {
141 tools::Rectangle aTextArea( i_contentArea );
142 aTextArea.AdjustLeft(2 ); aTextArea.AdjustRight( -2 );
143 aTextArea.AdjustTop( 1 ); aTextArea.AdjustBottom( -1 );
144 return aTextArea;
145 }
146
147 DrawTextFlags lcl_getAlignmentTextDrawFlags( GridTableRenderer_Impl const & i_impl, ColPos const i_columnPos )
148 {
149 DrawTextFlags nVertFlag = DrawTextFlags::Top;
150 VerticalAlignment const eVertAlign = i_impl.rModel.getVerticalAlign();
151 switch ( eVertAlign )
152 {
153 case VerticalAlignment_MIDDLE: nVertFlag = DrawTextFlags::VCenter; break;
154 case VerticalAlignment_BOTTOM: nVertFlag = DrawTextFlags::Bottom; break;
155 default:
156 break;
157 }
158
159 DrawTextFlags nHorzFlag = DrawTextFlags::Left;
160 HorizontalAlignment const eHorzAlign = i_impl.rModel.getColumnCount() > 0
161 ? i_impl.rModel.getColumnModel( i_columnPos )->getHorizontalAlign()
162 : HorizontalAlignment_CENTER;
163 switch ( eHorzAlign )
164 {
165 case HorizontalAlignment_CENTER: nHorzFlag = DrawTextFlags::Center; break;
166 case HorizontalAlignment_RIGHT: nHorzFlag = DrawTextFlags::Right; break;
167 default:
168 break;
169 }
170
171 return nVertFlag | nHorzFlag;
172 }
173
174 }
175
176
177 //= GridTableRenderer
178
179
181 :m_pImpl( new GridTableRenderer_Impl( _rModel ) )
182 {
183 }
184
185
187 {
188 }
189
190
192 {
193 return m_pImpl->bUseGridLines;
194 }
195
196
197 void GridTableRenderer::useGridLines( bool const i_use )
198 {
199 m_pImpl->bUseGridLines = i_use;
200 }
201
202
203 namespace
204 {
205 Color lcl_getEffectiveColor(std::optional<Color> const& i_modelColor,
206 StyleSettings const& i_styleSettings,
207 Color const& (StyleSettings::*i_getDefaultColor) () const)
208 {
209 if (!!i_modelColor)
210 return *i_modelColor;
211 return (i_styleSettings.*i_getDefaultColor)();
212 }
213 }
214
215
217 bool _bIsColHeaderArea, bool _bIsRowHeaderArea, const StyleSettings& _rStyle)
218 {
219 OSL_PRECOND(_bIsColHeaderArea || _bIsRowHeaderArea, "GridTableRenderer::PaintHeaderArea: invalid area flags!");
220
222
223 Color const background = lcl_getEffectiveColor(m_pImpl->rModel.getHeaderBackgroundColor(),
225 rRenderContext.SetFillColor(background);
226
227 rRenderContext.SetLineColor();
228 rRenderContext.DrawRect(_rArea);
229
230 // delimiter lines at bottom/right
231 std::optional<Color> aLineColor(m_pImpl->rModel.getLineColor());
232 Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
233 rRenderContext.SetLineColor(lineColor);
234 rRenderContext.DrawLine(_rArea.BottomLeft(), _rArea.BottomRight());
235 rRenderContext.DrawLine(_rArea.BottomRight(), _rArea.TopRight());
236
237 rRenderContext.Pop();
238 }
239
240
242 ColPos _nCol,
243 vcl::RenderContext& rRenderContext,
244 const tools::Rectangle& _rArea, const StyleSettings& _rStyle)
245 {
246 rRenderContext.Push(vcl::PushFlags::LINECOLOR);
247
248 OUString sHeaderText;
249 PColumnModel const pColumn = m_pImpl->rModel.getColumnModel( _nCol );
250 DBG_ASSERT( pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
251 if ( pColumn )
252 sHeaderText = pColumn->getName();
253
254 Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), _rStyle, &StyleSettings::GetFieldTextColor );
255 rRenderContext.SetTextColor(textColor);
256
257 tools::Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) );
258 DrawTextFlags nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, _nCol ) | DrawTextFlags::Clip;
259 if (!m_pImpl->rModel.isEnabled())
260 nDrawTextFlags |= DrawTextFlags::Disable;
261 rRenderContext.DrawText( aTextRect, sHeaderText, nDrawTextFlags );
262
263 std::optional<Color> const aLineColor( m_pImpl->rModel.getLineColor() );
264 Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
265 rRenderContext.SetLineColor( lineColor );
266 rRenderContext.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
267 rRenderContext.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
268
269 // draw sort indicator if the model data is sorted by the given column
270 ITableDataSort const * pSortAdapter = m_pImpl->rModel.getSortAdapter();
271 ColumnSort aCurrentSortOrder;
272 if ( pSortAdapter != nullptr )
273 aCurrentSortOrder = pSortAdapter->getCurrentSortOrder();
274 if ( aCurrentSortOrder.nColumnPos == _nCol )
275 {
276 tools::Long const nHeaderHeight( _rArea.GetHeight() );
277 BitmapEx const aIndicatorBitmap = m_pImpl->aSortIndicator.getBitmapFor(rRenderContext, nHeaderHeight, _rStyle,
278 aCurrentSortOrder.eSortDirection == ColumnSortAscending);
279 Size const aBitmapSize( aIndicatorBitmap.GetSizePixel() );
280 tools::Long const nSortIndicatorPaddingX = 2;
281 tools::Long const nSortIndicatorPaddingY = ( nHeaderHeight - aBitmapSize.Height() ) / 2;
282
283 if ( nDrawTextFlags & DrawTextFlags::Right )
284 {
285 // text is right aligned => draw the sort indicator at the left hand side
286 rRenderContext.DrawBitmapEx(Point(_rArea.Left() + nSortIndicatorPaddingX, _rArea.Top() + nSortIndicatorPaddingY),
287 aIndicatorBitmap);
288 }
289 else
290 {
291 // text is left-aligned or centered => draw the sort indicator at the right hand side
292 rRenderContext.DrawBitmapEx(Point(_rArea.Right() - nSortIndicatorPaddingX - aBitmapSize.Width(), nSortIndicatorPaddingY),
293 aIndicatorBitmap);
294 }
295 }
296
297 rRenderContext.Pop();
298 }
299
300
301 void GridTableRenderer::PrepareRow(RowPos _nRow, bool i_hasControlFocus, bool _bSelected, vcl::RenderContext& rRenderContext,
302 const tools::Rectangle& _rRowArea, const StyleSettings& _rStyle)
303 {
304 // remember the row for subsequent calls to the other ->ITableRenderer methods
305 m_pImpl->nCurrentRow = _nRow;
306
308
309 Color backgroundColor = _rStyle.GetFieldColor();
310
311 Color const activeSelectionBackColor = lcl_getEffectiveColor(m_pImpl->rModel.getActiveSelectionBackColor(),
313 if (_bSelected)
314 {
315 // selected rows use the background color from the style
316 backgroundColor = i_hasControlFocus
317 ? activeSelectionBackColor
318 : lcl_getEffectiveColor(m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor);
319 }
320 else
321 {
322 std::optional< std::vector<Color> > aRowColors = m_pImpl->rModel.getRowBackgroundColors();
323 if (!aRowColors)
324 {
325 // use alternating default colors
326 Color const fieldColor = _rStyle.GetFieldColor();
327 if (_rStyle.GetHighContrastMode() || ((m_pImpl->nCurrentRow % 2) == 0))
328 {
329 backgroundColor = fieldColor;
330 }
331 else
332 {
333 Color hilightColor = activeSelectionBackColor;
334 hilightColor.SetRed( 9 * ( fieldColor.GetRed() - hilightColor.GetRed() ) / 10 + hilightColor.GetRed() );
335 hilightColor.SetGreen( 9 * ( fieldColor.GetGreen() - hilightColor.GetGreen() ) / 10 + hilightColor.GetGreen() );
336 hilightColor.SetBlue( 9 * ( fieldColor.GetBlue() - hilightColor.GetBlue() ) / 10 + hilightColor.GetBlue() );
337 backgroundColor = hilightColor;
338 }
339 }
340 else
341 {
342 if (aRowColors->empty())
343 {
344 // all colors have the same background color
345 backgroundColor = _rStyle.GetFieldColor();
346 }
347 else
348 {
349 backgroundColor = aRowColors->at(m_pImpl->nCurrentRow % aRowColors->size());
350 }
351 }
352 }
353
354 rRenderContext.SetLineColor();
355 rRenderContext.SetFillColor(backgroundColor);
356 rRenderContext.DrawRect(_rRowArea);
357
358 rRenderContext.Pop();
359 }
360
361
363 const tools::Rectangle& _rArea, const StyleSettings& _rStyle)
364 {
366
367 std::optional<Color> const aLineColor( m_pImpl->rModel.getLineColor() );
368 Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
369 rRenderContext.SetLineColor(lineColor);
370 rRenderContext.DrawLine(_rArea.BottomLeft(), _rArea.BottomRight());
371
372 Any const rowHeading( m_pImpl->rModel.getRowHeading( m_pImpl->nCurrentRow ) );
373 OUString const rowTitle( m_pImpl->aStringConverter.convertToString( rowHeading ) );
374 if (!rowTitle.isEmpty())
375 {
376 Color const textColor = lcl_getEffectiveColor(m_pImpl->rModel.getHeaderTextColor(),
378 rRenderContext.SetTextColor(textColor);
379
380 tools::Rectangle const aTextRect(lcl_getTextRenderingArea(lcl_getContentArea(*m_pImpl, _rArea)));
381 DrawTextFlags nDrawTextFlags = lcl_getAlignmentTextDrawFlags(*m_pImpl, 0) | DrawTextFlags::Clip;
382 if (!m_pImpl->rModel.isEnabled())
383 nDrawTextFlags |= DrawTextFlags::Disable;
384 // TODO: is using the horizontal alignment of the 0'th column a good idea here? This is pretty ... arbitrary ..
385 rRenderContext.DrawText(aTextRect, rowTitle, nDrawTextFlags);
386 }
387
388 rRenderContext.Pop();
389 }
390
391
393 {
398 bool const bSelected;
400
401 CellRenderContext( OutputDevice& i_device, tools::Rectangle const & i_contentArea,
402 StyleSettings const & i_style, ColPos const i_column, bool const i_selected, bool const i_hasControlFocus )
403 :rDevice( i_device )
404 ,aContentArea( i_contentArea )
405 ,rStyle( i_style )
406 ,nColumn( i_column )
407 ,bSelected( i_selected )
408 ,bHasControlFocus( i_hasControlFocus )
409 {
410 }
411 };
412
413
414 void GridTableRenderer::PaintCell(ColPos const i_column, bool _bSelected, bool i_hasControlFocus,
415 vcl::RenderContext& rRenderContext, const tools::Rectangle& _rArea, const StyleSettings& _rStyle)
416 {
418
419 tools::Rectangle const aContentArea(lcl_getContentArea(*m_pImpl, _rArea));
420 CellRenderContext const aCellRenderContext(rRenderContext, aContentArea, _rStyle, i_column, _bSelected, i_hasControlFocus);
421 impl_paintCellContent(aCellRenderContext);
422
423 if ( m_pImpl->bUseGridLines )
424 {
425 ::std::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() );
426 ::Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
427
428 if ( _bSelected && !aLineColor )
429 {
430 // if no line color is specified by the model, use the usual selection color for lines in selected cells
431 lineColor = i_hasControlFocus
432 ? lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionBackColor(), _rStyle, &StyleSettings::GetHighlightColor )
433 : lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor );
434 }
435
436 rRenderContext.SetLineColor( lineColor );
437 rRenderContext.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
438 rRenderContext.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
439 }
440
441 rRenderContext.Pop();
442 }
443
444
445 void GridTableRenderer::impl_paintCellImage( CellRenderContext const & i_context, Image const & i_image )
446 {
447 Point imagePos( i_context.aContentArea.Left(), i_context.aContentArea.Top() );
448 Size imageSize = i_image.GetSizePixel();
449 if ( i_context.aContentArea.GetWidth() > imageSize.Width() )
450 {
451 const HorizontalAlignment eHorzAlign = m_pImpl->rModel.getColumnModel( i_context.nColumn )->getHorizontalAlign();
452 switch ( eHorzAlign )
453 {
454 case HorizontalAlignment_CENTER:
455 imagePos.AdjustX(( i_context.aContentArea.GetWidth() - imageSize.Width() ) / 2 );
456 break;
457 case HorizontalAlignment_RIGHT:
458 imagePos.setX( i_context.aContentArea.Right() - imageSize.Width() );
459 break;
460 default:
461 break;
462 }
463
464 }
465 else
467
468 if ( i_context.aContentArea.GetHeight() > imageSize.Height() )
469 {
470 const VerticalAlignment eVertAlign = m_pImpl->rModel.getVerticalAlign();
471 switch ( eVertAlign )
472 {
473 case VerticalAlignment_MIDDLE:
474 imagePos.AdjustY(( i_context.aContentArea.GetHeight() - imageSize.Height() ) / 2 );
475 break;
476 case VerticalAlignment_BOTTOM:
477 imagePos.setY( i_context.aContentArea.Bottom() - imageSize.Height() );
478 break;
479 default:
480 break;
481 }
482 }
483 else
484 imageSize.setHeight( i_context.aContentArea.GetHeight() - 1 );
485 DrawImageFlags const nStyle = m_pImpl->rModel.isEnabled() ? DrawImageFlags::NONE : DrawImageFlags::Disable;
486 i_context.rDevice.DrawImage( imagePos, imageSize, i_image, nStyle );
487 }
488
489
491 {
492 Any aCellContent;
493 m_pImpl->rModel.getCellContent( i_context.nColumn, m_pImpl->nCurrentRow, aCellContent );
494
495 if ( aCellContent.getValueTypeClass() == TypeClass_INTERFACE )
496 {
497 Reference< XInterface > const xContentInterface( aCellContent, UNO_QUERY );
498 if ( !xContentInterface.is() )
499 // allowed. kind of.
500 return;
501
502 Reference< XGraphic > const xGraphic( aCellContent, UNO_QUERY );
503 ENSURE_OR_RETURN_VOID( xGraphic.is(), "GridTableRenderer::impl_paintCellContent: only XGraphic interfaces (or NULL) are supported for painting." );
504
505 const Image aImage( xGraphic );
506 impl_paintCellImage( i_context, aImage );
507 return;
508 }
509
510 const OUString sText( m_pImpl->aStringConverter.convertToString( aCellContent ) );
511 impl_paintCellText( i_context, sText );
512 }
513
514
515 void GridTableRenderer::impl_paintCellText( CellRenderContext const & i_context, OUString const & i_text )
516 {
517 if ( i_context.bSelected )
518 {
519 ::Color const textColor = i_context.bHasControlFocus
520 ? lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionTextColor(), i_context.rStyle, &StyleSettings::GetHighlightTextColor )
521 : lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionTextColor(), i_context.rStyle, &StyleSettings::GetDeactiveTextColor );
522 i_context.rDevice.SetTextColor( textColor );
523 }
524 else
525 {
526 ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), i_context.rStyle, &StyleSettings::GetFieldTextColor );
527 i_context.rDevice.SetTextColor( textColor );
528 }
529
530 tools::Rectangle const textRect( lcl_getTextRenderingArea( i_context.aContentArea ) );
531 DrawTextFlags nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, i_context.nColumn ) | DrawTextFlags::Clip;
532 if ( !m_pImpl->rModel.isEnabled() )
533 nDrawTextFlags |= DrawTextFlags::Disable;
534 i_context.rDevice.DrawText( textRect, i_text, nDrawTextFlags );
535 }
536
537
539 {
540 _rView.ShowFocus( _rCursorRect );
541 }
542
543
545 {
546 _rView.HideFocus();
547 }
548
549
550 bool GridTableRenderer::FitsIntoCell( Any const & i_cellContent,
551 OutputDevice& i_targetDevice, tools::Rectangle const & i_targetArea ) const
552 {
553 if ( !i_cellContent.hasValue() )
554 return true;
555
556 if ( i_cellContent.getValueTypeClass() == TypeClass_INTERFACE )
557 {
558 Reference< XInterface > const xContentInterface( i_cellContent, UNO_QUERY );
559 if ( !xContentInterface.is() )
560 return true;
561
562 Reference< XGraphic > const xGraphic( i_cellContent, UNO_QUERY );
563 if ( xGraphic.is() )
564 // for the moment, assume it fits. We can always scale it down during painting ...
565 return true;
566
567 OSL_ENSURE( false, "GridTableRenderer::FitsIntoCell: only XGraphic interfaces (or NULL) are supported for painting." );
568 return true;
569 }
570
571 OUString const sText( m_pImpl->aStringConverter.convertToString( i_cellContent ) );
572 if ( sText.isEmpty() )
573 return true;
574
575 tools::Rectangle const aTargetArea( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, i_targetArea ) ) );
576
577 tools::Long const nTextHeight = i_targetDevice.GetTextHeight();
578 if ( nTextHeight > aTargetArea.GetHeight() )
579 return false;
580
581 tools::Long const nTextWidth = i_targetDevice.GetTextWidth( sText );
582 return nTextWidth <= aTargetArea.GetWidth();
583 }
584
585
586 bool GridTableRenderer::GetFormattedCellString( Any const & i_cellValue, OUString & o_cellString ) const
587 {
588 o_cellString = m_pImpl->aStringConverter.convertToString( i_cellValue );
589
590 return true;
591 }
592
593
594} // namespace svt::table
595
596
597/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawImageFlags
DrawTextFlags
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
bool IsEmpty() const
const Size & GetSizePixel() const
sal_uInt8 GetBlue() const
void SetGreen(sal_uInt8 nGreen)
void SetRed(sal_uInt8 nRed)
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
void SetBlue(sal_uInt8 nBlue)
void DrawSymbol(const tools::Rectangle &rRect, SymbolType eType, const Color &rColor, DrawSymbolFlags nStyle=DrawSymbolFlags::NONE)
Size GetSizePixel() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetLineColor()
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
void SetTextColor(const Color &rColor)
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
void SetFillColor()
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetDeactiveTextColor() const
const Color & GetFieldTextColor() const
bool GetHighContrastMode() const
const Color & GetFieldColor() const
const Color & GetDeactiveColor() const
Color GetSeparatorColor() const
const Color & GetActiveColor() const
const Color & GetDialogColor() const
const Color & GetHighlightColor() const
const Color & GetHighlightTextColor() const
reference_type * get() const
virtual void PaintCell(ColPos const i_col, bool i_hasControlFocus, bool _bSelected, vcl::RenderContext &_rDevice, const tools::Rectangle &_rArea, const StyleSettings &_rStyle) override
paints a certain cell
::std::unique_ptr< GridTableRenderer_Impl > m_pImpl
virtual void PaintRowHeader(vcl::RenderContext &_rDevice, const tools::Rectangle &_rArea, const StyleSettings &_rStyle) override
paints the header of a row
virtual void HideCellCursor(vcl::Window &_rView) override
hides the cell cursor previously drawn into the given rectangle
bool useGridLines() const
determines whether or not to paint grid lines
virtual void PaintColumnHeader(ColPos _nCol, vcl::RenderContext &_rDevice, const tools::Rectangle &_rArea, const StyleSettings &_rStyle) override
paints the header for a given column
virtual void PrepareRow(RowPos _nRow, bool i_hasControlFocus, bool _bSelected, vcl::RenderContext &_rDevice, const tools::Rectangle &_rRowArea, const StyleSettings &_rStyle) override
prepares a row for painting
virtual void PaintHeaderArea(vcl::RenderContext &_rDevice, const tools::Rectangle &_rArea, bool _bIsColHeaderArea, bool _bIsRowHeaderArea, const StyleSettings &_rStyle) override
paints a (part of) header area
virtual void ShowCellCursor(vcl::Window &_rView, const tools::Rectangle &_rCursorRect) override
draws a cell cursor in the given rectangle
void impl_paintCellImage(CellRenderContext const &i_context, Image const &i_image)
virtual bool FitsIntoCell(css::uno::Any const &i_cellContent, OutputDevice &i_targetDevice, tools::Rectangle const &i_targetArea) const override
checks whether a given cell content fits into a given target area on a given device.
void impl_paintCellContent(CellRenderContext const &i_context)
GridTableRenderer(ITableModel &_rModel)
creates a table renderer associated with the given model
void impl_paintCellText(CellRenderContext const &i_context, OUString const &i_text)
virtual bool GetFormattedCellString(css::uno::Any const &i_cellValue, OUString &o_cellString) const override
attempts to format the content of the given cell as string
provides sorting functionality for the data underlying an ITableModel
Definition: tablesort.hxx:58
virtual ColumnSort getCurrentSortOrder() const =0
retrieves the current sort order of the data
declares the interface to implement by an abstract table model
Definition: tablemodel.hxx:242
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr tools::Long Right() const
constexpr Point BottomRight() const
constexpr Point TopRight() const
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr Point BottomLeft() const
void HideFocus()
virtual void ShowFocus(const tools::Rectangle &rRect)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define DBG_ASSERT(sCon, aError)
#define ENSURE_OR_RETURN_VOID(c, m)
tools::Long m_lastHeaderHeight
BitmapEx m_sortAscending
BitmapEx m_sortDescending
Color m_lastArrowColor
Size imageSize(const sk_sp< SkImage > &image)
@ ColumnSortAscending
Definition: tablesort.hxx:32
sal_Int32 RowPos
a value denoting a row position within a table
Definition: tabletypes.hxx:34
sal_Int32 ColPos
a value denoting a column position within a table
Definition: tabletypes.hxx:32
std::shared_ptr< IColumnModel > PColumnModel
Definition: tablemodel.hxx:234
long Long
ColumnSortDirection eSortDirection
Definition: tablesort.hxx:42
CellRenderContext(OutputDevice &i_device, tools::Rectangle const &i_contentArea, StyleSettings const &i_style, ColPos const i_column, bool const i_selected, bool const i_hasControlFocus)
GridTableRenderer_Impl(ITableModel &_rModel)
#define ROW_INVALID
denotes an invalid row index
Definition: tabletypes.hxx:46