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 .
22 #include <controls/table/tablemodel.hxx>
23 #include <vcl/image.hxx>
32 struct GridTableRenderer_Impl
;
37 /** a default implementation for the ->ITableRenderer interface
39 This class is able to paint a table grid, table headers, and cell
40 backgrounds according to the selected/active state of cells.
42 class GridTableRenderer final
: public ITableRenderer
45 ::std::unique_ptr
< GridTableRenderer_Impl
> m_pImpl
;
48 /** creates a table renderer associated with the given model
51 the model which should be rendered. The caller is responsible
52 for lifetime control, that is, the model instance must live
53 at least as long as the renderer instance lives
55 GridTableRenderer( ITableModel
& _rModel
);
56 virtual ~GridTableRenderer() override
;
58 /** determines whether or not to paint grid lines
60 bool useGridLines() const;
62 /** controls whether or not to paint grid lines
64 void useGridLines( bool const i_use
);
67 // ITableRenderer overridables
68 virtual void PaintHeaderArea(
69 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rArea
,
70 bool _bIsColHeaderArea
, bool _bIsRowHeaderArea
,
71 const StyleSettings
& _rStyle
) override
;
72 virtual void PaintColumnHeader( ColPos _nCol
,
73 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rArea
,
74 const StyleSettings
& _rStyle
) override
;
75 virtual void PrepareRow( RowPos _nRow
, bool i_hasControlFocus
, bool _bSelected
,
76 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rRowArea
,
77 const StyleSettings
& _rStyle
) override
;
78 virtual void PaintRowHeader(
79 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rArea
,
80 const StyleSettings
& _rStyle
) override
;
81 virtual void PaintCell( ColPos
const i_col
,
82 bool i_hasControlFocus
, bool _bSelected
,
83 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rArea
,
84 const StyleSettings
& _rStyle
) override
;
85 virtual void ShowCellCursor( vcl::Window
& _rView
, const tools::Rectangle
& _rCursorRect
) override
;
86 virtual void HideCellCursor( vcl::Window
& _rView
) override
;
87 virtual bool FitsIntoCell(
88 css::uno::Any
const & i_cellContent
,
89 OutputDevice
& i_targetDevice
, tools::Rectangle
const & i_targetArea
91 virtual bool GetFormattedCellString(
92 css::uno::Any
const & i_cellValue
,
93 OUString
& o_cellString
97 struct CellRenderContext
;
99 void impl_paintCellContent(
100 CellRenderContext
const & i_context
102 void impl_paintCellImage(
103 CellRenderContext
const & i_context
,
104 Image
const & i_image
106 void impl_paintCellText(
107 CellRenderContext
const & i_context
,
108 OUString
const & i_text
112 } // namespace svt::table
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */