Bump version to 5.0-14
[LibreOffice.git] / svtools / inc / table / gridtablerenderer.hxx
blob4df38f8eeaf579363d1cb1300bc74ef110696f11
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
25 #include <boost/scoped_ptr.hpp>
28 namespace svt { namespace table
32 struct GridTableRenderer_Impl;
35 //= GridTableRenderer
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 : public ITableRenderer
44 private:
45 ::boost::scoped_ptr< GridTableRenderer_Impl > m_pImpl;
47 public:
48 /** creates a table renderer associated with the given model
50 @param _rModel
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();
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 );
66 public:
67 // ITableRenderer overridables
68 virtual void PaintHeaderArea(
69 OutputDevice& _rDevice, const Rectangle& _rArea,
70 bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
71 const StyleSettings& _rStyle ) SAL_OVERRIDE;
72 virtual void PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
73 OutputDevice& _rDevice, const Rectangle& _rArea,
74 const StyleSettings& _rStyle ) SAL_OVERRIDE;
75 virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
76 OutputDevice& _rDevice, const Rectangle& _rRowArea,
77 const StyleSettings& _rStyle ) SAL_OVERRIDE;
78 virtual void PaintRowHeader(
79 bool i_hasControlFocus, bool _bSelected,
80 OutputDevice& _rDevice, const Rectangle& _rArea,
81 const StyleSettings& _rStyle ) SAL_OVERRIDE;
82 virtual void PaintCell( ColPos const i_col,
83 bool i_hasControlFocus, bool _bSelected,
84 OutputDevice& _rDevice, const Rectangle& _rArea,
85 const StyleSettings& _rStyle ) SAL_OVERRIDE;
86 virtual void ShowCellCursor( vcl::Window& _rView, const Rectangle& _rCursorRect) SAL_OVERRIDE;
87 virtual void HideCellCursor( vcl::Window& _rView, const Rectangle& _rCursorRect) SAL_OVERRIDE;
88 virtual bool FitsIntoCell(
89 ::com::sun::star::uno::Any const & i_cellContent,
90 ColPos const i_colPos, RowPos const i_rowPos,
91 bool const i_active, bool const i_selected,
92 OutputDevice& i_targetDevice, Rectangle const & i_targetArea
93 ) const SAL_OVERRIDE;
94 virtual bool GetFormattedCellString(
95 ::com::sun::star::uno::Any const & i_cellValue,
96 ColPos const i_colPos, RowPos const i_rowPos,
97 OUString & o_cellString
98 ) const SAL_OVERRIDE;
100 private:
101 struct CellRenderContext;
103 void impl_paintCellContent(
104 CellRenderContext const & i_context
106 void impl_paintCellImage(
107 CellRenderContext const & i_context,
108 Image const & i_image
110 void impl_paintCellText(
111 CellRenderContext const & i_context,
112 OUString const & i_text
116 } } // namespace svt::table
119 #endif // INCLUDED_SVTOOLS_INC_TABLE_GRIDTABLERENDERER_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */