diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-08-11 22:44:56 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-08-16 08:15:56 +0200 |
commit | e4e5d77bcc30beb1d976fadf5da0247f00f5b9cc (patch) | |
tree | 5ff1e3a39aced09761cad29524cd99b90bb57c7c /chart2 | |
parent | 5dcfa8f3750d549d895246c50285bb38690f9734 (diff) |
chart2: render line legend symbols better in a data table
Change-Id: I556b4f249688a3836bbeeb3f554cb9ecf1d31f65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138301
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/main/DataTableView.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/chart2/source/view/main/DataTableView.cxx b/chart2/source/view/main/DataTableView.cxx index d80e753d9e65..ae90b475e75a 100644 --- a/chart2/source/view/main/DataTableView.cxx +++ b/chart2/source/view/main/DataTableView.cxx @@ -287,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()); } } @@ -327,7 +333,10 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV xCellPropertySet->setPropertyValue("ParaAdjust", uno::Any(style::ParagraphAdjust_LEFT)); if (bKeys) - xCellPropertySet->setPropertyValue("ParaLeftMargin", uno::Any(sal_Int32(500))); + { + xCellPropertySet->setPropertyValue("ParaLeftMargin", + uno::Any(nMaxSymbolWidth + sal_Int32(200))); + } } nRow++; } @@ -376,6 +385,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; @@ -406,6 +416,7 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV nTotalHeight += nHeight; } } + xBroadcaster->unlockBroadcasts(); } void DataTableView::initializeShapes(const rtl::Reference<SvxShapeGroupAnyD>& xTarget) |