diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-08-11 22:44:56 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-08-11 22:44:56 +0200 |
commit | 3fe3f3a985ae85e3cd3010f875ca4acc62219bb6 (patch) | |
tree | 407327b7e76a1753d4aacfab5dcbbe40d863d72e | |
parent | chart2: fix rendering of table borders of row/column headers (diff) | |
download | core-3fe3f3a985ae85e3cd3010f875ca4acc62219bb6.tar.gz core-3fe3f3a985ae85e3cd3010f875ca4acc62219bb6.zip |
chart2: render line legend symbols better in a data table
Change-Id: I556b4f249688a3836bbeeb3f554cb9ecf1d31f65
-rw-r--r-- | chart2/source/view/main/DataTableView.cxx | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/chart2/source/view/main/DataTableView.cxx b/chart2/source/view/main/DataTableView.cxx index eafb64c69f60..7202f332b143 100644 --- a/chart2/source/view/main/DataTableView.cxx +++ b/chart2/source/view/main/DataTableView.cxx @@ -276,8 +276,10 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV { xCellTextRange->setString(rString); - bool bLeft = (bOutline && nColumn == 1) || (bVBorder && nColumn > 1 && nColumn < nColumnCount); - bool bRight = (bOutline && nColumn == nColumnCount) || (bVBorder && nColumn > 1 && nColumn < nColumnCount); + bool bLeft + = (bOutline && nColumn == 1) || (bVBorder && nColumn > 1 && nColumn < nColumnCount); + bool bRight = (bOutline && nColumn == nColumnCount) + || (bVBorder && nColumn > 1 && nColumn < nColumnCount); setCellProperties(xPropertySet, bLeft, bOutline, bRight, bOutline); setCellCharAndParagraphProperties(xPropertySet); } @@ -285,16 +287,22 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV } // ROW HEADER - // Prepare keys + // Prepare keys (symbols) + sal_Int32 nMaxSymbolWidth = 0; if (bKeys) { - awt::Size aMaxSymbolExtent(300, 300); for (VSeriesPlotter* pSeriesPlotter : m_pSeriesPlotterList) { if (pSeriesPlotter) { + sal_Int32 nSymbolWidth = 300; + if (pSeriesPlotter->getLegendSymbolStyle() == LegendSymbolStyle::Line) + nSymbolWidth = 600; + + nMaxSymbolWidth = std::max(nSymbolWidth, nMaxSymbolWidth); + std::vector<ViewLegendSymbol> aNewEntries = pSeriesPlotter->createSymbols( - aMaxSymbolExtent, m_xTarget, m_xComponentContext); + { nSymbolWidth, 300 }, m_xTarget, m_xComponentContext); aSymbols.insert(aSymbols.end(), aNewEntries.begin(), aNewEntries.end()); } } @@ -309,7 +317,8 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV if (xCellTextRange.is()) { bool bTop = (bOutline && nRow == 1) || (bHBorder && nRow > 1 && nRow < nRowCount); - bool bBottom = (bOutline && nRow == nRowCount) || (bHBorder && nRow > 1 && nRow < nRowCount); + bool bBottom + = (bOutline && nRow == nRowCount) || (bHBorder && nRow > 1 && nRow < nRowCount); setCellProperties(xCellPropertySet, bOutline, bTop, bOutline, bBottom); auto xText = xCellTextRange->getText(); @@ -324,7 +333,8 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV xCellPropertySet->setPropertyValue("ParaAdjust", uno::Any(style::ParagraphAdjust_LEFT)); if (bKeys) - xCellPropertySet->setPropertyValue("ParaLeftMargin", uno::Any(500)); + xCellPropertySet->setPropertyValue("ParaLeftMargin", + uno::Any(nMaxSymbolWidth + 200)); } nRow++; } @@ -373,6 +383,7 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV pTableObject->DistributeColumns(0, nColumnCount - 1, true, true); pTableObject->DistributeRows(0, nRowCount - 1, true, true); + xBroadcaster->lockBroadcasts(); uno::Reference<beans::XPropertySet> xPropertySet(xTableColumns->getByIndex(0), uno::UNO_QUERY); sal_Int32 nWidth = 0; xPropertySet->getPropertyValue("Width") >>= nWidth; @@ -403,6 +414,7 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV nTotalHeight += nHeight; } } + xBroadcaster->unlockBroadcasts(); } void DataTableView::initializeShapes(const rtl::Reference<SvxShapeGroupAnyD>& xTarget) |