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 .
20 #ifndef INCLUDED_SVTOOLS_INC_TABLE_GRIDTABLERENDERER_HXX
21 #define INCLUDED_SVTOOLS_INC_TABLE_GRIDTABLERENDERER_HXX
23 #include <svtools/table/tablemodel.hxx>
24 #include <vcl/image.hxx>
29 namespace svt
{ namespace table
33 struct GridTableRenderer_Impl
;
38 /** a default implementation for the ->ITableRenderer interface
40 This class is able to paint a table grid, table headers, and cell
41 backgrounds according to the selected/active state of cells.
43 class GridTableRenderer
: public ITableRenderer
46 ::std::unique_ptr
< GridTableRenderer_Impl
> m_pImpl
;
49 /** creates a table renderer associated with the given model
52 the model which should be rendered. The caller is responsible
53 for lifetime control, that is, the model instance must live
54 at least as long as the renderer instance lives
56 GridTableRenderer( ITableModel
& _rModel
);
57 virtual ~GridTableRenderer() override
;
59 /** determines whether or not to paint grid lines
61 bool useGridLines() const;
63 /** controls whether or not to paint grid lines
65 void useGridLines( bool const i_use
);
68 // ITableRenderer overridables
69 virtual void PaintHeaderArea(
70 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rArea
,
71 bool _bIsColHeaderArea
, bool _bIsRowHeaderArea
,
72 const StyleSettings
& _rStyle
) override
;
73 virtual void PaintColumnHeader( ColPos _nCol
,
74 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rArea
,
75 const StyleSettings
& _rStyle
) override
;
76 virtual void PrepareRow( RowPos _nRow
, bool i_hasControlFocus
, bool _bSelected
,
77 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rRowArea
,
78 const StyleSettings
& _rStyle
) override
;
79 virtual void PaintRowHeader(
80 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rArea
,
81 const StyleSettings
& _rStyle
) override
;
82 virtual void PaintCell( ColPos
const i_col
,
83 bool i_hasControlFocus
, bool _bSelected
,
84 vcl::RenderContext
& _rDevice
, const tools::Rectangle
& _rArea
,
85 const StyleSettings
& _rStyle
) override
;
86 virtual void ShowCellCursor( vcl::Window
& _rView
, const tools::Rectangle
& _rCursorRect
) override
;
87 virtual void HideCellCursor( vcl::Window
& _rView
) override
;
88 virtual bool FitsIntoCell(
89 css::uno::Any
const & i_cellContent
,
90 OutputDevice
& i_targetDevice
, tools::Rectangle
const & i_targetArea
92 virtual bool GetFormattedCellString(
93 css::uno::Any
const & i_cellValue
,
94 OUString
& o_cellString
98 struct CellRenderContext
;
100 void impl_paintCellContent(
101 CellRenderContext
const & i_context
103 void impl_paintCellImage(
104 CellRenderContext
const & i_context
,
105 Image
const & i_image
107 void impl_paintCellText(
108 CellRenderContext
const & i_context
,
109 OUString
const & i_text
113 } } // namespace svt::table
116 #endif // INCLUDED_SVTOOLS_INC_TABLE_GRIDTABLERENDERER_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */