LibreOffice Module svx (master)
1
|
#include <tablelayouter.hxx>
Classes | |
struct | Layout |
Public Member Functions | |
TableLayouter (const TableModelRef &xTableModel) | |
~TableLayouter () | |
void | LayoutTable (::tools::Rectangle &rRectangle, bool bFitWidth, bool bFitHeight) |
try to fit the table into the given rectangle. More... | |
void | UpdateBorderLayout () |
bool | getCellArea (const CellRef &xCell, const CellPos &rPos, basegfx::B2IRectangle &rArea) const |
::sal_Int32 | getRowCount () const |
::sal_Int32 | getColumnCount () const |
sal_Int32 | getRowHeight (sal_Int32 nRow) const |
sal_Int32 | getColumnWidth (sal_Int32 nColumn) const |
sal_Int32 | calcPreferredColumnWidth (sal_Int32 nColumn, Size aSize) const |
sal_Int32 | getMinimumColumnWidth (sal_Int32 nColumn) |
bool | isEdgeVisible (sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal) const |
checks if the given edge is visible. More... | |
editeng::SvxBorderLine * | getBorderLine (sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal) const |
returns the requested borderline in rpBorderLine or a null pointer if there is no border at this edge More... | |
void | updateCells (::tools::Rectangle const &rRectangle) |
std::vector< EdgeInfo > | getHorizontalEdges () |
sal_Int32 | getHorizontalEdge (int nEdgeY, sal_Int32 *pnMin, sal_Int32 *pnMax) |
std::vector< EdgeInfo > | getVerticalEdges () |
sal_Int32 | getVerticalEdge (int nEdgeX, sal_Int32 *pnMin, sal_Int32 *pnMax) |
void | DistributeColumns (::tools::Rectangle &rArea, sal_Int32 nFirstCol, sal_Int32 nLastCol, const bool bOptimize, const bool bMinimize) |
void | DistributeRows (::tools::Rectangle &rArea, sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize) |
void | dumpAsXml (xmlTextWriterPtr pWriter) const |
Private Types | |
typedef std::vector< Layout > | LayoutVector |
Private Member Functions | |
CellRef | getCell (const CellPos &rPos) const |
basegfx::B2ITuple | getCellSize (const CellRef &xCell, const CellPos &rPos) const |
void | LayoutTableWidth (::tools::Rectangle &rArea, bool bFit) |
void | LayoutTableHeight (::tools::Rectangle &rArea, bool bFit) |
bool | isValidColumn (sal_Int32 nColumn) const |
bool | isValidRow (sal_Int32 nRow) const |
bool | isValid (const CellPos &rPos) const |
void | ClearBorderLayout () |
void | ResizeBorderLayout () |
void | ResizeBorderLayout (BorderLineMap &rMap) |
void | SetBorder (sal_Int32 nCol, sal_Int32 nRow, bool bHorizontal, const editeng::SvxBorderLine *pLine) |
Static Private Member Functions | |
static void | ClearBorderLayout (BorderLineMap &rMap) |
static bool | HasPriority (const editeng::SvxBorderLine *pThis, const editeng::SvxBorderLine *pOther) |
static sal_Int32 | distribute (LayoutVector &rLayouts, sal_Int32 nDistribute) |
Private Attributes | |
TableModelRef | mxTable |
LayoutVector | maRows |
LayoutVector | maColumns |
BorderLineMap | maHorizontalBorders |
BorderLineMap | maVerticalBorders |
Definition at line 66 of file tablelayouter.hxx.
|
private |
Definition at line 155 of file tablelayouter.hxx.
|
explicit |
Definition at line 52 of file tablelayouter.cxx.
sdr::table::TableLayouter::~TableLayouter | ( | ) |
Definition at line 58 of file tablelayouter.cxx.
References ClearBorderLayout().
sal_Int32 sdr::table::TableLayouter::calcPreferredColumnWidth | ( | sal_Int32 | nColumn, |
Size | aSize | ||
) | const |
Definition at line 170 of file tablelayouter.cxx.
References getCell(), isValidColumn(), and maRows.
Referenced by DistributeColumns().
|
private |
Definition at line 1044 of file tablelayouter.cxx.
References maHorizontalBorders, and maVerticalBorders.
Referenced by ResizeBorderLayout(), and ~TableLayouter().
|
staticprivate |
Definition at line 1050 of file tablelayouter.cxx.
|
staticprivate |
Definition at line 499 of file tablelayouter.cxx.
References o3tl::checked_add(), o3tl::checked_multiply(), o3tl::checked_sub(), sdr::table::TableLayouter::Layout::mnMinSize, mnSize, sdr::table::TableLayouter::Layout::mnSize, n, nCount, nIndex, and o3tl::saturating_add().
Referenced by LayoutTableHeight(), and LayoutTableWidth().
void sdr::table::TableLayouter::DistributeColumns | ( | ::tools::Rectangle & | rArea, |
sal_Int32 | nFirstCol, | ||
sal_Int32 | nLastCol, | ||
const bool | bOptimize, | ||
const bool | bMinimize | ||
) |
Definition at line 1137 of file tablelayouter.cxx.
References Any, calcPreferredColumnWidth(), Exception, getColumnCount(), getColumnWidth(), sdr::table::gsSize(), LayoutTable(), mxTable, nIndex, and TOOLS_WARN_EXCEPTION.
void sdr::table::TableLayouter::DistributeRows | ( | ::tools::Rectangle & | rArea, |
sal_Int32 | nFirstRow, | ||
sal_Int32 | nLastRow, | ||
const bool | bOptimize, | ||
const bool | bMinimize | ||
) |
Definition at line 1234 of file tablelayouter.cxx.
References tools::Rectangle::AdjustBottom(), Any, Exception, getRowHeight(), sdr::table::gsSize(), LayoutTable(), maRows, mnSize, mxTable, and TOOLS_WARN_EXCEPTION.
void sdr::table::TableLayouter::dumpAsXml | ( | xmlTextWriterPtr | pWriter | ) | const |
Definition at line 1317 of file tablelayouter.cxx.
SvxBorderLine * sdr::table::TableLayouter::getBorderLine | ( | sal_Int32 | nEdgeX, |
sal_Int32 | nEdgeY, | ||
bool | bHorizontal | ||
) | const |
returns the requested borderline in rpBorderLine or a null pointer if there is no border at this edge
Definition at line 228 of file tablelayouter.cxx.
References maHorizontalBorders, maVerticalBorders, and size.
Referenced by sdr::table::SdrTableObj::AddToHdlList(), and sdr::contact::impGetLineStyle().
Definition at line 967 of file tablelayouter.cxx.
References Exception, sdr::table::CellPos::mnCol, sdr::table::CellPos::mnRow, mxTable, and TOOLS_WARN_EXCEPTION.
Referenced by calcPreferredColumnWidth(), LayoutTableHeight(), LayoutTableWidth(), UpdateBorderLayout(), and updateCells().
bool sdr::table::TableLayouter::getCellArea | ( | const CellRef & | xCell, |
const CellPos & | rPos, | ||
basegfx::B2IRectangle & | rArea | ||
) | const |
For RTL Table Calculate the Right End of cell instead of Left
Definition at line 107 of file tablelayouter.cxx.
References o3tl::checked_add(), o3tl::checked_sub(), Exception, getCellSize(), Tuple2D< sal_Int32 >::getX(), Tuple2D< sal_Int32 >::getY(), isValid(), maColumns, maRows, sdr::table::CellPos::mnCol, sdr::table::CellPos::mnRow, mxTable, TOOLS_WARN_EXCEPTION, x, and y.
Referenced by updateCells().
|
private |
Definition at line 64 of file tablelayouter.cxx.
References Exception, getColumnCount(), getRowCount(), maColumns, maRows, sdr::table::CellPos::mnCol, sdr::table::CellPos::mnRow, o3tl::saturating_add(), and TOOLS_WARN_EXCEPTION.
Referenced by getCellArea().
|
inline |
Definition at line 88 of file tablelayouter.hxx.
References maColumns.
Referenced by DistributeColumns(), getCellSize(), getVerticalEdge(), LayoutTable(), LayoutTableHeight(), LayoutTableWidth(), ResizeBorderLayout(), UpdateBorderLayout(), and updateCells().
sal_Int32 sdr::table::TableLayouter::getColumnWidth | ( | sal_Int32 | nColumn | ) | const |
Definition at line 162 of file tablelayouter.cxx.
References isValidColumn(), and maColumns.
Referenced by sdr::table::SdrTableObj::AddToHdlList(), and DistributeColumns().
sal_Int32 sdr::table::TableLayouter::getHorizontalEdge | ( | int | nEdgeY, |
sal_Int32 * | pnMin, | ||
sal_Int32 * | pnMax | ||
) |
Definition at line 281 of file tablelayouter.cxx.
References getRowCount(), and maRows.
Referenced by getHorizontalEdges().
std::vector< EdgeInfo > sdr::table::TableLayouter::getHorizontalEdges | ( | ) |
Definition at line 249 of file tablelayouter.cxx.
References getHorizontalEdge(), i, and maRows.
sal_Int32 sdr::table::TableLayouter::getMinimumColumnWidth | ( | sal_Int32 | nColumn | ) |
Definition at line 485 of file tablelayouter.cxx.
References isValidColumn(), and maColumns.
Referenced by getVerticalEdge().
|
inline |
Definition at line 87 of file tablelayouter.hxx.
References maRows.
Referenced by getCellSize(), getHorizontalEdge(), LayoutTable(), LayoutTableHeight(), LayoutTableWidth(), ResizeBorderLayout(), UpdateBorderLayout(), and updateCells().
sal_Int32 sdr::table::TableLayouter::getRowHeight | ( | sal_Int32 | nRow | ) | const |
Definition at line 153 of file tablelayouter.cxx.
References isValidRow(), and maRows.
Referenced by sdr::table::SdrTableObj::AddToHdlList(), and DistributeRows().
sal_Int32 sdr::table::TableLayouter::getVerticalEdge | ( | int | nEdgeX, |
sal_Int32 * | pnMin, | ||
sal_Int32 * | pnMax | ||
) |
Definition at line 311 of file tablelayouter.cxx.
References getColumnCount(), getMinimumColumnWidth(), maColumns, and mxTable.
Referenced by getVerticalEdges().
std::vector< EdgeInfo > sdr::table::TableLayouter::getVerticalEdges | ( | ) |
Definition at line 265 of file tablelayouter.cxx.
References getVerticalEdge(), i, and maColumns.
|
staticprivate |
bool sdr::table::TableLayouter::isEdgeVisible | ( | sal_Int32 | nEdgeX, |
sal_Int32 | nEdgeY, | ||
bool | bHorizontal | ||
) | const |
checks if the given edge is visible.
Edges between merged cells are not visible.
Definition at line 209 of file tablelayouter.cxx.
References maHorizontalBorders, maVerticalBorders, and size.
Referenced by sdr::table::SdrTableObj::AddToHdlList().
|
inlineprivate |
Definition at line 134 of file tablelayouter.hxx.
References isValidColumn(), isValidRow(), sdr::table::CellPos::mnCol, and sdr::table::CellPos::mnRow.
Referenced by getCellArea().
|
inlineprivate |
Definition at line 132 of file tablelayouter.hxx.
References maColumns.
Referenced by calcPreferredColumnWidth(), getColumnWidth(), getMinimumColumnWidth(), and isValid().
|
inlineprivate |
Definition at line 133 of file tablelayouter.hxx.
References maRows.
Referenced by getRowHeight(), and isValid().
void sdr::table::TableLayouter::LayoutTable | ( | ::tools::Rectangle & | rRectangle, |
bool | bFitWidth, | ||
bool | bFitHeight | ||
) |
try to fit the table into the given rectangle.
If the rectangle is too small, it will be grown to fit the table.
if bFitWidth or bFitHeight is set, the layouter tries to scale the rows and/or columns to the given area. The result my be bigger to fulfill constrains.
if bFitWidth or bFitHeight is set, the model is changed.
If the rectangle is too small, it will be grown to fit the table.
Definition at line 908 of file tablelayouter.cxx.
References getColumnCount(), getRowCount(), LayoutTableHeight(), LayoutTableWidth(), maColumns, maRows, mxTable, and UpdateBorderLayout().
Referenced by DistributeColumns(), and DistributeRows().
|
private |
Definition at line 724 of file tablelayouter.cxx.
References Any, DBG_ASSERT, distribute(), getCell(), getColumnCount(), tools::Rectangle::getHeight(), getRowCount(), tools::Rectangle::GetWidth(), sdr::table::gsSize(), maRows, mnSize, mxTable, o3tl::saturating_add(), tools::Rectangle::SetSize(), u, and updateCells().
Referenced by LayoutTable().
|
private |
Definition at line 575 of file tablelayouter.cxx.
References Any, DBG_ASSERT, distribute(), getCell(), getColumnCount(), tools::Rectangle::GetHeight(), getRowCount(), tools::Rectangle::getWidth(), sdr::table::gsSize(), maColumns, mnSize, mxTable, sdr::table::RangeIterator< T >::next(), o3tl::saturating_add(), tools::Rectangle::SetSize(), u, and updateCells().
Referenced by LayoutTable().
|
private |
Definition at line 1071 of file tablelayouter.cxx.
References ClearBorderLayout(), maHorizontalBorders, and maVerticalBorders.
Referenced by UpdateBorderLayout().
|
private |
Definition at line 1079 of file tablelayouter.cxx.
References getColumnCount(), getRowCount(), and size.
|
private |
Definition at line 1016 of file tablelayouter.cxx.
References sdr::table::gEmptyBorder, HasPriority(), maHorizontalBorders, maVerticalBorders, and size.
Referenced by UpdateBorderLayout().
void sdr::table::TableLayouter::UpdateBorderLayout | ( | ) |
Definition at line 1095 of file tablelayouter.cxx.
References SvxBoxItem::GetBottom(), getCell(), getColumnCount(), SvxBoxItem::GetLeft(), SvxBoxItem::GetRight(), getRowCount(), SvxBoxItem::GetTop(), sdr::table::CellPos::mnCol, sdr::table::CellPos::mnRow, ResizeBorderLayout(), SDRATTR_TABLE_BORDER(), and SetBorder().
Referenced by LayoutTable().
void sdr::table::TableLayouter::updateCells | ( | ::tools::Rectangle const & | rRectangle | ) |
Definition at line 937 of file tablelayouter.cxx.
References getCell(), getCellArea(), getColumnCount(), Range2D< sal_Int32, Int32Traits >::getMaxX(), Range2D< sal_Int32, Int32Traits >::getMaxY(), Range2D< sal_Int32, Int32Traits >::getMinX(), Range2D< sal_Int32, Int32Traits >::getMinY(), getRowCount(), tools::Rectangle::Left(), sdr::table::CellPos::mnCol, sdr::table::CellPos::mnRow, tools::Rectangle::Move(), tools::Rectangle::SetBottom(), tools::Rectangle::SetLeft(), tools::Rectangle::SetRight(), tools::Rectangle::SetTop(), and tools::Rectangle::Top().
Referenced by LayoutTableHeight(), and LayoutTableWidth().
|
private |
Definition at line 161 of file tablelayouter.hxx.
Referenced by dumpAsXml(), getCellArea(), getCellSize(), getColumnCount(), getColumnWidth(), getMinimumColumnWidth(), getVerticalEdge(), getVerticalEdges(), isValidColumn(), LayoutTable(), and LayoutTableWidth().
|
private |
Definition at line 163 of file tablelayouter.hxx.
Referenced by ClearBorderLayout(), getBorderLine(), isEdgeVisible(), ResizeBorderLayout(), and SetBorder().
|
private |
Definition at line 160 of file tablelayouter.hxx.
Referenced by calcPreferredColumnWidth(), DistributeRows(), dumpAsXml(), getCellArea(), getCellSize(), getHorizontalEdge(), getHorizontalEdges(), getRowCount(), getRowHeight(), isValidRow(), LayoutTable(), and LayoutTableHeight().
|
private |
Definition at line 164 of file tablelayouter.hxx.
Referenced by ClearBorderLayout(), getBorderLine(), isEdgeVisible(), ResizeBorderLayout(), and SetBorder().
|
private |
Definition at line 159 of file tablelayouter.hxx.
Referenced by DistributeColumns(), DistributeRows(), getCell(), getCellArea(), getVerticalEdge(), LayoutTable(), LayoutTableHeight(), and LayoutTableWidth().