LibreOffice Module toolkit (master) 1
gridtablerenderer.hxx
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#pragma once
21
23#include <vcl/image.hxx>
24
25#include <memory>
26
27
28namespace svt::table
29{
30
31
32 struct GridTableRenderer_Impl;
33
34
35 //= GridTableRenderer
36
42 class GridTableRenderer final : public ITableRenderer
43 {
44 private:
45 ::std::unique_ptr< GridTableRenderer_Impl > m_pImpl;
46
47 public:
56 virtual ~GridTableRenderer() override;
57
60 bool useGridLines() const;
61
64 void useGridLines( bool const i_use );
65
66 public:
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
90 ) const override;
91 virtual bool GetFormattedCellString(
92 css::uno::Any const & i_cellValue,
93 OUString & o_cellString
94 ) const override;
95
96 private:
97 struct CellRenderContext;
98
100 CellRenderContext const & i_context
101 );
103 CellRenderContext const & i_context,
104 Image const & i_image
105 );
107 CellRenderContext const & i_context,
108 OUString const & i_text
109 );
110 };
111
112} // namespace svt::table
113
114
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
a default implementation for the ->ITableRenderer interface
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
declares the interface to implement by an abstract table model
Definition: tablemodel.hxx:242
interface to implement by components rendering a ->TableControl
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