summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-12-04 17:55:22 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-12-05 12:19:49 +0100
commit5e709d4d665fa14aed4e686080e4eda797440d36 (patch)
tree84b9b1d123cbe8df1a7a137581eb1fbed0756154 /sw/source/core/layout
parent458c8ef1fa78ac57cc5593a61c64d6049307d21e (diff)
tdf#128611 sw: improve rotated text layout in table cells
The problem was that in case a table with 1 row and 2 cells has rotated text in the A1 cell, then the row height is 0, so we aggressively try to break up the text into multiple lines. Then the A2 cell adds more content, so the row height is increased, but the A1 cell is not re-layouted to make use of the increased amount of vertical space. A similar (but working) situation is vertical alignment of cell content, there adding more content to A2 re-formats A1. Fix the problem in a similar way: track if a text frame contains at least one rotated portion, and throw away the portions of the text frame at the end of SwCellFrame::Format(), after vertical alignment is handled. (cherry picked from commit 0fa95852b0968fa2a35efb8ca816949c58af56e0) Change-Id: I65383bb1af486771dc671dca3d8bbf1831ba94ff Reviewed-on: https://gerrit.libreoffice.org/84506 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/tabfrm.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 1327dfbbe755..42150626aa10 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -5223,6 +5223,25 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
lcl_ArrangeLowers( this, lYStart, true );
}
}
+
+ // Handle rotated portions of lowers: it's possible that we have changed amount of vertical
+ // space since the last format, and this affects how many rotated portions we need. So throw
+ // away the current portions to build them using the new line width.
+ for (SwFrame* pFrame = Lower(); pFrame; pFrame = pFrame->GetNext())
+ {
+ if (!pFrame->IsTextFrame())
+ {
+ continue;
+ }
+
+ auto pTextFrame = static_cast<SwTextFrame*>(pFrame);
+ if (!pTextFrame->GetHasRotatedPortions())
+ {
+ continue;
+ }
+
+ pTextFrame->Prepare();
+ }
}
void SwCellFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )